kronoszx
2/25/2017 - 1:35 PM

Prestashop PageCache + AdvancedURL

Prestashop PageCache + AdvancedURL

Install our module with pagecache, you need some hack like following:

1. Install pageache first.
2. Edit /modules/vipadvancedurl/overrides/classes/Dispatcher.php, delete or rename function dispatch().
3. Install our module.
4. Manual edit /overrides/classes/Dispatcher.php and find at nearly end of function dispatch_16()

<?php
========

$controller=Controller::getController($controller_class);
if (isset($params_hook_action_dispatcher))
Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
========

replace to

========
if (isset($params_hook_action_dispatcher))
Hook::exec('actionDispatcher', $params_hook_action_dispatcher);

// Advanced Dispatcher
if ($this->advanced_dispatcher) {
if ($this->front_controller==self::FC_FRONT) {
$controller_class=$controllers[Tools::strtolower($this->controller)];
} elseif ($this->front_controller==self::FC_MODULE) {
$module_name=Validate::isModuleName(Tools::getValue('module')) ? Tools::getValue('module') : '';
$module=Module::getInstanceByName($module_name);
$controller_class='PageNotFoundController';
if (Validate::isLoadedObject($module) && $module->active) {
$controllers=Dispatcher::getControllers(_PS_MODULE_DIR_.$module_name.'/controllers/front/');
if (isset($controllers[Tools::strtolower($this->controller)])) {
include_once(_PS_MODULE_DIR_.$module_name.'/controllers/front/'.$this->controller.'.php');
$controller_class=$module_name.$this->controller.'ModuleFrontController';
}
}
}
}
// Advanced Dispatcher

$controller=Controller::getController($controller_class);
========