2
我想在集合中创建一个IF CONDITION。如果$mtype
不为空,则此条件工作addFieldToFilter('main_table.m_type', $mtype)
,如果条件不匹配,则此过滤器将不起作用。Magento有条件的addFieldToFilter
$collection = Mage::getModel('manufacturers/manufacturers')->getCollection()
->addStoreFilter(Mage::app()->getStore(true)->getId())
->addFieldToFilter('main_table.status', 1)
->addFieldToFilter('main_table.m_type', $mtype)
->addOrder(Mage::helper('manufacturers')->getManufacturerSort(), Mage::helper('manufacturers')->getManufacturerOrder())
->getData();
我希望你们的人知道这个问题的答案,否则你会指导我一个更好的办法。
感谢, 哈南阿里
它不工作我有这个给一试 – 2012-01-06 14:15:52