Php Prestashop:显示我的愿望列表标题菜单项上的产品数量
如何显示我的愿望列表标题菜单中的产品数量?这就是我想要的样子: 我试过这样的方法:Php Prestashop:显示我的愿望列表标题菜单项上的产品数量,php,smarty,prestashop,prestashop-1.5,prestashop-1.6,Php,Smarty,Prestashop,Prestashop 1.5,Prestashop 1.6,如何显示我的愿望列表标题菜单中的产品数量?这就是我想要的样子: 我试过这样的方法: <a href="/index.php?fc=module&module=blockwishlist&controller=mywishlist" title="{l s='My wishlists' mod='blockwishlist'}" rel="nofollow">{l s='Wishlist' mod='blockwishlist'} ({'wishlist'|coun
<a href="/index.php?fc=module&module=blockwishlist&controller=mywishlist"
title="{l s='My wishlists' mod='blockwishlist'}"
rel="nofollow">{l s='Wishlist' mod='blockwishlist'} ({'wishlist'|count})
</a>
但它似乎只计算我的愿望清单,而不是愿望清单中的产品。这里有一个快速解决此问题的方法。这不是100%的效率,但它可以做到
$current_user = (int)$this->context->cookie->id_customer;
$id_wishlist = Db::getInstance()->getValue("SELECT id_wishlist FROM `"._DB_PREFIX_."wishlist` WHERE id_customer = '$current_user'");
$count_products = Db::getInstance()->getValue("SELECT COUNT(id_wishlist_product) FROM `"._DB_PREFIX_."wishlist_product` WHERE id_wishlist = '$id_wishlist'");
$this->smarty->assign(array(
'current_user' => $count_products,
'cart' => $this->context->cart,
'cart_qties' => $this->context->cart->nbProducts(),
'logged' => $this->context->customer->isLogged(),
'customerName' => ($this->context->customer->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false),
'firstName' => ($this->context->customer->logged ? $this->context->customer->firstname : false),
'lastName' => ($this->context->customer->logged ? $this->context->customer->lastname : false),
'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order'
));
return $this->display(__FILE__, 'blockuserinfo.tpl');
}{l s='Wishlist' mod='blockwishlist'} ({$current_user})
为什么我的问题被否决了?