是否可以在我的购物车中加载最后注册(创建)的产品?如何?
我知道这听起来很疯狂,但我的一个项目需要这个。
我认为这是加载产品的部分:
购物车控制器.php
/**
* Initialize product instance from request data
*
* @return Mage_Catalog_Model_Product || false
*/
protected function _initProduct()
{
$productId = (int) $this->getRequest()->getParam('product');
if ($productId) {
$product = Mage::getSingelton('checkout/session')->getQuote()->getAllItems()
->setStoreId(Mage::app()->getStore()->getId())
->load($productId);
if ($product->getId()) {
return $product;
}
}
return false;
}
这个(如果我是对的)我需要用商店中最后一个创建的产品替换 - 听起来很奇怪,但我需要这个....