0
我需要限制產品相對於日期的列表。在magento中使用日期限制產品
比如我需要顯示2015年1月1日之間產生的產品,以2016年1月1日
這裏是我的代碼
$products=Mage::getModel('catalog/product')->getCollection();
//$products->addAttributeToSelect('name');
$products->addAttributeToSelect(array('name', 'thumbnail', 'price','description','special_price'));
foreach ($products as $product) {
$p['products'][] = array(
'id' => $product->getId(),
'sku' => $product->getSku(),
'name' => $product->getName(),
'thumb' => (string)Mage::helper('catalog/image')->init($product, 'thumbnail'),
'description' => $product->getDescription(),
'weight' => $product->getWeight(),
'created at' => $product->getCreatedAt(),
'pirce' => Mage::helper('core')->currency($product->getPrice(), true, false), //." ".$currencyCode,
'Special pirce' => Mage::helper('core')->currency($product->getFinalPrice(), true, false)
);
}
var_dump($result);
請建議我一個解決方案
致命錯誤:調用一個成員函數getBackend()一個非對象在/app/code/core/Mage/Eav/Model/Entity/Abstract.php線816 –
其工作,謝謝 –
爲什麼會出現這種情況: - 調用成員函數getBackend()在/app/code/core/Mage/Eav/Model/Entity/Abstract.php中的非對象 –