kasimb Posted January 2, 2014 Share Posted January 2, 2014 Hello All, Can i set a different theme for specific pages like for order page i have to show a page from different theme without overriding. Thanks Link to comment Share on other sites More sharing options...
vekia Posted January 2, 2014 Share Posted January 2, 2014 everything is possible but in this case - only with customization. if you want to achieve it without overrides, you will have to modify your theme template files. depending on what page is loaded (if condition: {if $page_name=="order"}) you will need to load other .tpl file / display other tpl code with different css styles) Link to comment Share on other sites More sharing options...
kasimb Posted January 3, 2014 Author Share Posted January 3, 2014 (edited) Hello,Thanks for the reply. Instead of overriding, I have created the module . So after creating the order context I am redirecting to my module URL i.e.. BASE_URL\modules\oconnector\paymentpage.php But this redirects me to, BASE_URL\index.php?controller=ocpayment&module=oconnector and shows page not available error These are my two files. 1. modulename\paymentpage.php <?php $useSSL = true; include(dirname(__FILE__).'/../../config/config.inc.php'); include(dirname(__FILE__).'/../../init.php'); // init front controller in order to use Tools::redirect $controller = new FrontController(); $controller->init(); Tools::redirect(Context::getContext()->link->getModuleLink('oconnector', 'ocpayment')); ?> 2. modulename\controllers\front\ocpayment.php require_once (dirname(__file__) . '/../../oconnector.php'); class OconnectorocpaymentModuleFrontController extends OrderOpcController { /** * @var Module */ public $module; public $ssl = true; public $php_self = 'ocpayment'; public function init() { parent::init(); } public function __construct() { parent::__construct(); error_reporting(1); define('_OC_THEME_DIR_MOBILE',dirname(__FILE__).'/themes/default/mobile/'); define('_OC_THEME_DIR_',dirname(__FILE__).'/themes/default/mobile/'); define('_OC_THEME_MOBILE_JS_DIR_',dirname(__FILE__)._OC_THEME_DIR_MOBILE.'js/opc.js'); define('_OC_THEME_JS_DIR_',dirname(__FILE__)._OC_THEME_DIR_.'tools/statesManagement.js'); $this->context = Context::getContext(); if (!isset($this->context->cart) || empty($this->context->cart)) { if (isset($this->context->cookie->id_cart)) { $this->context->cart = new Cart($this->context->cookie->id_cart); } } $this->init(); $this->initContent(); $this->setMedia(); } public function initContent() { parent::initContent(); /* id_carrier is not defined in database before choosing a carrier, set it to a default one to match a potential cart _rule */ if (empty($this->context->cart->id_carrier)) { $checked = $this->context->cart->simulateCarrierSelectedOutput(); $checked = ((int)Cart::desintifier($checked)); $this->context->cart->id_carrier = $checked; $this->context->cart->update(); CartRule::autoRemoveFromCart($this->context); CartRule::autoAddToCart($this->context); } // SHOPPING CART $this->_assignSummaryInformations(); // WRAPPING AND TOS $this->_assignWrappingAndTOS(); $selectedCountry = (int)(Configuration::get('PS_COUNTRY_DEFAULT')); if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true); else $countries = Country::getCountries($this->context->language->id, true); // If a rule offer free-shipping, force hidding shipping prices $free_shipping = false; foreach ($this->context->cart->getCartRules() as $rule) if ($rule['free_shipping'] && !$rule['carrier_restriction']) { $free_shipping = true; break; } $this->context->smarty->assign(array( 'free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, 'sl_country' => isset($selectedCountry) ? $selectedCountry : 0, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'errorCarrier' => Tools::displayError('You must choose a carrier.', false), 'errorTOS' => Tools::displayError('You must accept the Terms of Service.', false), 'isPaymentStep' => (bool)(isset($_GET['isPaymentStep']) && $_GET['isPaymentStep']), 'genders' => Gender::getGenders(), 'one_phone_at_least' => (int)Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop'), 'HOOK_DISPLAYPAYMENT_PAAGE'=> Module::hookExec('dispPaymentPageMobile') )); $years = Tools::dateYears(); $months = Tools::dateMonths(); $days = Tools::dateDays(); $this->context->smarty->assign(array( 'years' => $years, 'months' => $months, 'days' => $days, )); /* Load guest informations */ if ($this->isLogged && $this->context->cookie->is_guest) $this->context->smarty->assign('guestInformations', $this->_getGuestInformations()); // ADDRESS if ($this->isLogged) $this->_assignAddress(); // CARRIER $this->_assignCarrier(); // PAYMENT $this->_assignPayment(); Tools::safePostVars(); $this->_processAddressFormat(); return $this->context->smarty->fetch(_OC_THEME_DIR_MOBILE.'order-opc.tpl'); } public function setMedia() { parent::setMedia(); $this->addJS(_OC_THEME_MOBILE_JS_DIR_.'opc.js'); $this->addJS(_OC_THEME_JS_DIR_.'tools/statesManagement.js'); } } Edited January 3, 2014 by kasimb (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 3, 2014 Share Posted January 3, 2014 it's not order page, it's module page, it's a separate php file so it's not related to prestashop theme (?) Link to comment Share on other sites More sharing options...
kasimb Posted January 4, 2014 Author Share Posted January 4, 2014 Yes correct it's not a theme.I will redirect the page to my module if checkout is from mobile device and show mobile order-opc page I am just trying to show to mobile order-opc.tpl when request is coming from mobile. By the way page not found issue is solved by adding parameter fc=module. But i am not able to override functions by extending OrderOpcControllerCore using class OconnectorocpaymentModuleFrontController extends OrderOpcController Like setMedia etc. Please help Link to comment Share on other sites More sharing options...
Recommended Posts