0
嗨如何將價值從phtml傳遞到塊?Magento通過價值來阻止功能
下面是我的代碼: store.php
public function __construct($type1)
{
parent::__construct();
$items = Mage::getModel('redemption/store')->getCollection()
->addFieldToFilter('status', array('eq' => 1))
->addFieldToFilter('category', array('eq' => $type1))
->addAttributeToSort('mreward_required', 'asc');
$this ->setCollection($items);
}
index.phtml
$type1 = 'Celcom';
$items = $this->getCollection($type1);
它沒有工作。
我想要這樣做,是因爲我想打出類別的兌換產品基礎。這是更好的方法嗎? – 2013-04-30 04:56:52
如果你想這樣做,你可以調用'$ this-> getCollection($ type)'並在塊'public function getCollection($ type){}'上重新定義'getCollection'函數。 – 2013-05-01 03:15:39