【发布时间】:2014-04-18 10:06:41
【问题描述】:
我正在开发自定义价格的扩展,我想知道如何从购物车中获取单价我试过这个:
$itemProduct = $this->getProduct();
$cart = Mage::getModel('checkout/cart')->getQuote();
foreach ($cart->getAllItems() as $item) {
$productId = $item->getProduct()->getProductId();
$productPrice = $item->getProduct()->getPrice();
if($productId == $itemProduct->getId()){
/*
* do our check for 'same product' here.
* Returns true if attribute is the same thus it is hte same product
*/
if ($productPrice == $itemProduct->getPrice()) {
return true; //same product
} else {
return false; //different product
}
}
但它总是返回 false 我想我没有得到单价
怎么做?
【问题讨论】:
标签: magento shopping-cart