0
こんにちは皆私は、製品とカスタムテーブルに読み込まれたいくつかの他の機能の間の関連を探すPrestashop 1.6の高度な検索モジュールを書いています。Prestshop 1.6モジュールカスタム検索ビュー
私はModuleFrontController
を書いています。フォーム提出後に結果ページを返さなければならないが、ビューには基本レイアウトがありません。
$this->setTemplate('advanced-search.tpl');
に書かれたように私は、この関数を呼び出すしかし、それは唯一の製品リストと他には何も、ヘッダーなし、ノーフッター、ノーサイドバーを示しinitContent()
メソッド内
これは私のコードです:
class MyModuleSearchModuleFrontController extends ModuleFrontController
{
protected static $config_post_submit_values = ['action'];
public function initContent()
{
parent::initContent();
switch (Tools::getValue($this->getPostSubmitValue())) {
// Filter action
case 'filter_1':
/*
* DO STUFF TO RETRIEVE PRODUCTS
*/
case 'filter_2':
/*
* DO STUFF TO RETRIEVE PRODUCTS
*/
default:
$products = [];
}
$this->smarty->assign(['products' => $products]);
$this->setTemplate('advanced-search.tpl');
}
/**
* Get the action submited from the configuration page
* @return string
*/
protected function getPostSubmitValue()
{
foreach (self::$config_post_submit_values as $value) {
if (Tools::isSubmit($value)) {
return $value;
}
}
return false;
}
}
ご協力いただきありがとうございます!