今天,我将在我的产品上添加视觉贴纸,以便向用户显示哪些运营商是可用的,这样他们就不会有一辆购物车上有10个产品交付,1个产品在商店提货。他们会立即知道他们能做什么。
在单个产品页面上没有问题,在ProductController.php中添加以下内容就足够了:
$this->context->smarty->assign(array(
'pictures' => $pictures,
'textFields' => $text_fields,
'carriers' => $this->product->getCarriers(),
));重点是进入产品列表页面...我似乎找不到我可以做些什么来将运营商链接到该类别的每个产品。
通过查看ProductListingFrontController.php,我注意到我可以在以下位置获得$variables中的所有类别产品:
protected function doProductSearch($template, $params = array(), $locale = null)
{
if ($this->ajax) {
ob_end_clean();
header('Content-Type: application/json');
$this->ajaxRender(json_encode($this->getAjaxProductSearchVariables()));
return;
} else {
$variables = $this->getProductSearchVariables();有没有人已经在Prestashop 1.7.x中做过这样的事情?
发布于 2020-10-27 02:05:51
我建议你利用本地的Prestashop钩子displayProductListReviews和displayProductAdditionalInfo来构建一个非常simple module来返回你想要的内容。
您可以轻松地访问钩子$params中的所有产品属性,以获取可用的运营商。
https://stackoverflow.com/questions/64540185
复制相似问题