当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Quote_Item::setHasError方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Quote_Item::setHasError方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Item::setHasError方法的具体用法?PHP Mage_Sales_Model_Quote_Item::setHasError怎么用?PHP Mage_Sales_Model_Quote_Item::setHasError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Quote_Item的用法示例。


在下文中一共展示了Mage_Sales_Model_Quote_Item::setHasError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _addQuoteItemError

 protected function _addQuoteItemError(Mage_Sales_Model_Quote_Item $item, $itemError, $quoteError, $errorIndex = 'error')
 {
     $item->setHasError(true);
     $item->setMessage($itemError);
     $item->setQuoteMessage($quoteError);
     $item->setQuoteMessageIndex($errorIndex);
     return $this;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:8,代码来源:Item.php

示例2: checkQuoteItemQty

 /**
  * Check Quote item qty. If qty is not enougth for order, error flag and message added to $quote item
  *
  * @param Mage_Sales_Model_Quote_Item $quoteItem
  */
 protected function checkQuoteItemQty($quoteItem)
 {
     $qty = $quoteItem->getQty();
     if (($options = $quoteItem->getQtyOptions()) && $qty > 0) {
         $qty = $quoteItem->getProduct()->getTypeInstance(true)->prepareQuoteItemQty($qty, $quoteItem->getProduct());
         $quoteItem->setData('qty', $qty);
         foreach ($options as $option) {
             $optionQty = $qty * $option->getValue();
             $increaseOptionQty = ($quoteItem->getQtyToAdd() ? $quoteItem->getQtyToAdd() : $qty) * $option->getValue();
             $stockItem = $option->getProduct()->getStockItem();
             /* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */
             if (!$stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) {
                 $quoteItem->setHasError(true)->setMessage('Stock item for Product in option is not valid');
                 return;
             }
             $result = $stockItem->checkQuoteItemQty($optionQty, $optionQty, $option->getValue());
             if ($result->getHasError()) {
                 $quoteItem->setHasError(true)->setMessage($result->getQuoteMessage());
             }
         }
     } else {
         $stockItem = $quoteItem->getProduct()->getStockItem();
         /* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */
         if (!$stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) {
             Mage::throwException(Mage::helper('cataloginventory')->__('Stock item for Product is not valid'));
         }
         /**
          * When we work with subitem (as subproduct of bundle or configurable product)
          */
         if ($quoteItem->getParentItem()) {
             $rowQty = $quoteItem->getParentItem()->getQty() * $qty;
             /**
              * we are using 0 because original qty was processed
              */
             $qtyForCheck = 0;
         } else {
             $increaseQty = $quoteItem->getQtyToAdd() ? $quoteItem->getQtyToAdd() : $qty;
             $rowQty = $qty;
             $qtyForCheck = $qty;
         }
         $result = $stockItem->checkQuoteItemQty($rowQty, $qtyForCheck, $qty);
         if ($result->getHasError()) {
             $quoteItem->setHasError(true)->setMessage($result->getQuoteMessage());
         }
     }
 }
开发者ID:xiaoguizhidao,项目名称:mydigibits,代码行数:51,代码来源:Create.php


注:本文中的Mage_Sales_Model_Quote_Item::setHasError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。