✏️ 正在编辑: redirect.php
路径:
/home/bpioifn/www/pigmentse/modules/axepta/controllers/front/redirect.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php /** * 2007-2019 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <contact@prestashop.com> * @copyright 2007-2019 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ require_once _PS_MODULE_DIR_ . 'axepta/classes/AxeptaApi.php'; require_once(_PS_CONFIG_DIR_ . '/config.inc.php'); require_once _PS_MODULE_DIR_ . 'axepta/classes/AxeptaLogger.php'; class AxeptaRedirectModuleFrontController extends ModuleFrontController { public $ssl = true; public $php_self = 'axepta_redirect'; public function initContent() { $this->display_column_left = false; $this->display_column_right = false; parent::initContent(); } /** * Do whatever you have to before redirecting the customer on the website of your payment processor. */ public function postProcess() { $merchant = new AxeptaConfigurationAccount(Tools::getValue('id_account')); $isLogged = $this->context->customer->isLogged(); $isRecurring = false; foreach ($this->context->cart->getProducts() as $product) { if (AxeptaPaymentRecurring::isThisProductPaymentRecurring((int) $product['id_product'])) { $isRecurring = true; break; } } // Forbidden Access if not logged + recurring payment if (!$isLogged && $isRecurring) { Tools::redirect('index.php?controller=order'); } if ($merchant->logs) { $message = 'PASSAGE DANS redirect.php fonction =>'; $message .= 'Les paramètres envoyés seront les suivants =>'; $message .= ' Params: '; AxeptaLogger::log($message, AxeptaLogger::LOG_DEBUG, AxeptaLogger::FILE_DEBUG); } if (Tools::getValue('payment_mode') == 'oneclick' && Tools::getValue('id_saved_card')) { $params = AxeptaApi::getParams(Tools::getValue('method_code'), Tools::getValue('payment_mode'), Tools::getValue('id_account'), Tools::getValue('id_saved_card')); $oneclick_card = new AxeptaCustomerOneClickPaymentCard(Tools::getValue('id_saved_card')); $this->context->smarty->assign('card', $oneclick_card); } else { $params = AxeptaApi::getParams(Tools::getValue('method_code'), Tools::getValue('payment_mode'), Tools::getValue('id_account')); } $mode_view = $merchant->mode_view; $use_iframe = false; if ($mode_view == 2 && Tools::getValue('payment_mode') != 'oneclick' && !Tools::getValue('exclude_iframe')) { $use_iframe = true; } // Force normal mode if (in_array(Tools::getValue('method_code'), AxeptaApi::$IGNORE_IFRAME)) { $use_iframe = false; } $this->context->smarty->assign('params', $params); $this->context->smarty->assign('cart_id', $this->context->cart->id); $this->context->smarty->assign('secure_key', $this->context->customer->secure_key); $this->context->smarty->assign('mode_view', $mode_view); $this->context->smarty->assign('id_account', Tools::getValue('id_account')); $this->context->smarty->assign('use_iframe', $use_iframe); if (Tools::getValue('payment_mode') == 'oneclick') { $this->setTemplate('module:axepta/views/templates/front/oneclick.tpl'); } else { $this->setTemplate('module:axepta/views/templates/front/redirect.tpl'); } } public function setMedia() { $this->registerJavascript( 'frontJsMouvement', 'modules/' . $this->module->name . '/views/js/redirect-iframe.js' ); parent::setMedia(); } }
💾 保存文件
← 返回文件管理器