我试图关注this,但无法将其应用到我的商店。除此之外,我需要隐藏产品,没有图像也来自类别和特色产品。 目标是仅从首页隐藏所有没有图像的产品。 使用prestashop 1.6
答案 0 :(得分:0)
尝试此操作以隐藏前端中的产品而不禁用它:
UPDATE ps_product
SET visibility = 'none'
WHERE id_product NOT IN (
SELECT id_product
FROM ps_image
GROUP BY id_product
)
答案 1 :(得分:0)
您可以覆盖controllers / CategoryController.php
中的assignProductList方法在这个方法中,首先得到的产品图像是这样的:
$allImg = Db::getInstance()->ExecuteS('SELECT `id_image` FROM `'._DB_PREFIX_.'image` WHERE `id_product` = '.(int)($product['id_product']).' ORDER BY `position`');
然后如果count为0
foreach ($this->cat_products as $prodKey => &$product)
{
$allImg = Db::getInstance()->ExecuteS('SELECT `id_image` FROM `'._DB_PREFIX_.'image` WHERE `id_product` = '.(int)($product['id_product']).' ORDER BY `position`');
if !(count($allImg)) {
unset($this->cat_products[$prodKey]);
}
}