Magento:在前端显示禁用的产品 [英] Magento: Display disabled products on frontend
本文介绍了Magento:在前端显示禁用的产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在前端展示禁用产品.但是我该怎么办呢?
I want to show disabled products on front end. But how can I do it??
尽管我不希望它们出现在目录或搜索中,但是我希望它们在通过直接网址访问时显示为产品已禁用".
Although I don't want them to be appeared in catalog or search, but I do want them to be appeared when accessed by direct url saying "Product is Disabled".
现在,目录/产品中的view.phtml不会触发并提供404页面.
Right now view.phtml in catalog/product is not triggering and giving a 404 page.
我该怎么做.
推荐答案
仅针对类别中的禁用产品尝试此方法
Try this one for only disabled products within a category
$products = Mage::getModel('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*')
->addAttributeToFilter(
'status',
array('eq' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED)
);
状态已启用= 1,状态已禁用= 2
Status Enabled = 1 and Status Disabled = 2
$products = Mage::getModel('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*')
->addAttributeToFilter(
'status',
array('eq' => '2')
);
这篇关于Magento:在前端显示禁用的产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文