【发布时间】:2018-07-12 10:14:06
【问题描述】:
当客户将产品添加到购物车并且该产品从商店中删除时,有两条消息 enter image description here
如何在调用第一条消息时删除关于删除产品的第二条消息。
还有调用消息的下一个函数:
protected function _getProduct($productInfo)
{
$product = null;
if ($productInfo instanceof Mage_Catalog_Model_Product) {
$product = $productInfo;
} elseif (is_int($productInfo) || is_string($productInfo)) {
$product = Mage::getModel('catalog/product')
->setStoreId(Mage::app()->getStore()->getId())
->load($productInfo);
}
$currentWebsiteId = Mage::app()->getStore()->getWebsiteId();
if (!$product
|| !$product->getId()
|| !is_array($product->getWebsiteIds())
|| !in_array($currentWebsiteId, $product->getWebsiteIds())
) {
Mage::getSingleton('checkout/session')->addSuccess(Mage::helper('checkout')->__('The product could not be found.'));
}
return $product;
}
第二条额外信息
public function addItemRemoveNotification(Varien_Event_Observer $observer)
{
/* @var $quoteItem Advox_Sales_Model_Quote_Item */
$quoteItem = $observer->getQuoteItem();
if (true === boolval($quoteItem->getData('is_a_free_sample'))) {
return $this;
}
Mage::getSingleton('core/session')->addSuccess(
Mage::helper('checkout')->__("%s successfully removed from basket.", $quoteItem->getData('name'))
);
return $this;
}
【问题讨论】:
标签: php magento magento-1.9 message checkout