0
嗨我需要訪問prestashop smarty變量,這是默認情況下在所有頁面上都不可用。 特定$主頁(索引頁)上的$ compareProducts和$ comparator_max_item。如何訪問默認分配到一個頁面的所有頁面上的smarty變量
有人可以告訴我如何在不覆蓋prestashop核心的情況下執行此操作(在所有頁面上訪問它們)?
嗨我需要訪問prestashop smarty變量,這是默認情況下在所有頁面上都不可用。 特定$主頁(索引頁)上的$ compareProducts和$ comparator_max_item。如何訪問默認分配到一個頁面的所有頁面上的smarty變量
有人可以告訴我如何在不覆蓋prestashop核心的情況下執行此操作(在所有頁面上訪問它們)?
使用PrestaShop可以重寫控制器。
http://doc.prestashop.com/display/PS15/Overriding+default+behaviors
編輯這個文件:
/override/classes/controller/FrontController.php
有:
<?php
class FrontController extends FrontControllerCore
{
public function process()
{
parent::process();
$this->context->smarty->assign('comparator_max_item', (int)(Configuration::get('PS_COMPARATOR_MAX_ITEM')));
}
}
的Prestashop核心不更新,而只是與他人重寫類,它可能會更新您的prestashop版本。
PS:樣品的Prestashop V1.5
是不是最好創建用於特定目的的獨立的模塊?我發現你的方式有點侵入性和更新錯誤傾向。 –