我使用這個代碼,我在什麼地方找到我的所有活動的特殊產品:如何比較Magento查詢中的兩個字段?
$collection = $this->_addProductAttributesAndPrices($collection)
->addStoreFilter()
->addAttributeToFilter('special_from_date', array('date' => true, 'to' => $todayDate))
->addAttributeToFilter('special_to_date', array('or'=> array(
0 => array('date' => true, 'from' => $todayDate),
1 => array('is' => new Zend_Db_Expr('null')))
), 'left')
->setPageSize($this->get_prod_count())
->setCurPage($this->get_cur_page());
現在,我想只有有一個特殊的價格< =價格的產品,但是我仍然可以」不知道該怎麼做。
我一直在閱讀此頁:http://www.magentocommerce.com/wiki/5_-_modules_and_development/catalog/using_collections_in_magento
,我想這沒有成功:
->addAttributeToFilter('special_price', array('lt' => 'price'))
感謝您的幫助!
第二參數 '價格' 是被視爲字符串 – Nasaralla
這是正確的,這就是爲什麼我問,我不知道比較這些值的正確方法 – Shaz