• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Mage_Sales_Model_Quote_Item类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getItemEditOptionsHtml

 /**
  * @param Mage_Sales_Model_Quote_Item $item
  * @return string
  */
 public function getItemEditOptionsHtml(Mage_Sales_Model_Quote_Item $item)
 {
     $product = $item->getProduct();
     $optionsBlock = $this->getLayout()->createBlock('emjainteractive_advancedoptions/catalog_product_view_options', 'product.info.options.' . $item->getId())->addOptionRenderer('file', 'emjainteractive_advancedoptions/catalog_product_view_options_type_text', 'emjainteractive/advancedoptions/catalog/product/view/options/type/text.phtml')->addOptionRenderer('select', 'emjainteractive_advancedoptions/catalog_product_view_options_type_select', 'emjainteractive/advancedoptions/catalog/product/view/options/type/select.phtml')->addOptionRenderer('date', 'emjainteractive_advancedoptions/catalog_product_view_options_type_date', 'emjainteractive/advancedoptions/catalog/product/view/options/type/date.phtml')->addOptionRenderer('text', 'emjainteractive_advancedoptions/catalog_product_view_options_type_text', 'emjainteractive/advancedoptions/catalog/product/view/options/type/text.phtml')->setTemplate('catalog/product/view/options.phtml')->setProduct($product)->setQuoteItem($item);
     $jsBlock = $this->getLayout()->createBlock('core/template', 'options_js' . $item->getId())->setTemplate('catalog/product/view/options/js.phtml');
     return $jsBlock->toHtml() . $optionsBlock->toHtml();
 }
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:11,代码来源:Cart.php


示例2: _removeErrorsFromQuoteAndItem

 /**
  * Removes error statuses from quote and item, set by this observer
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @param int $code
  * @return Mage_CatalogInventory_Model_Observer
  */
 protected function _removeErrorsFromQuoteAndItem($item, $code)
 {
     //if(ITwebexperts_Payperrentals_Helper_Data::isReservationType($item->getProduct()) && ($item->getProduct()->getTypeId() == ITwebexperts_Payperrentals_Helper_Data::PRODUCT_TYPE_CONFIGURABLE || $item->getProduct()->getTypeId() == ITwebexperts_Payperrentals_Helper_Data::PRODUCT_TYPE_BUNDLE || $item->getProduct()->getTypeId() == ITwebexperts_Payperrentals_Helper_Data::PRODUCT_TYPE_GROUPED)){
     //  return $this;
     //}
     if ($item->getHasError()) {
         $params = array('origin' => 'cataloginventory', 'code' => $code);
         $item->removeErrorInfosByParams($params);
     }
     $quote = $item->getQuote();
     $quoteItems = $quote->getItemsCollection();
     $canRemoveErrorFromQuote = true;
     foreach ($quoteItems as $quoteItem) {
         if ($quoteItem->getItemId() == $item->getItemId()) {
             continue;
         }
         $errorInfos = $quoteItem->getErrorInfos();
         foreach ($errorInfos as $errorInfo) {
             if ($errorInfo['code'] == $code) {
                 $canRemoveErrorFromQuote = false;
                 break;
             }
         }
         if (!$canRemoveErrorFromQuote) {
             break;
         }
     }
     if ($quote->getHasError() && $canRemoveErrorFromQuote) {
         $params = array('origin' => 'cataloginventory', 'code' => $code);
         $quote->removeErrorInfosByParams(null, $params);
     }
     return $this;
 }
开发者ID:hueyl77,项目名称:fourwindsgear,代码行数:40,代码来源:Observer.php


示例3: compare

 /**
  * Compare item
  *
  * @param   Mage_Sales_Model_Quote_Item $item
  * @return  bool
  */
 public function compare($item)
 {
     if ($item->getOptionByCode('chili_document_id')) {
         return false;
     }
     return parent::compare($item);
 }
开发者ID:finelinePG,项目名称:finelink-dev,代码行数:13,代码来源:Item.php


示例4: _removeErrorsFromQuoteAndItem

 /**
  * Removes error statuses from quote and item, set by this observer
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @param string $origin
  * @param int $code
  * @return Jarlssen_CustomCartValidation_Model_Observer
  */
 protected function _removeErrorsFromQuoteAndItem($item, $origin, $code)
 {
     if ($item->getHasError()) {
         $params = array('origin' => $origin, 'code' => $code);
         $item->removeErrorInfosByParams($params);
     }
     $quote = $item->getQuote();
     $quoteItems = $quote->getItemsCollection();
     $canRemoveErrorFromQuote = true;
     foreach ($quoteItems as $quoteItem) {
         if ($quoteItem->getItemId() == $item->getItemId()) {
             continue;
         }
         $errorInfos = $quoteItem->getErrorInfos();
         foreach ($errorInfos as $errorInfo) {
             if ($errorInfo['code'] == $code) {
                 $canRemoveErrorFromQuote = false;
                 break;
             }
         }
         if (!$canRemoveErrorFromQuote) {
             break;
         }
     }
     if ($quote->getHasError() && $canRemoveErrorFromQuote) {
         $params = array('origin' => $origin, 'code' => $code);
         $quote->removeErrorInfosByParams(null, $params);
     }
     return $this;
 }
开发者ID:elvetemedve,项目名称:Jarlssen_CustomCartValidation,代码行数:38,代码来源:Observer.php


示例5: getMsrpHtml

 /**
  * Get html for MAP product enabled
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @return string
  */
 public function getMsrpHtml($item)
 {
     $product = $item->getProduct();
     $block = $this->_preparePriceBlock($product);
     $html = $block->setPriceElementIdPrefix('bundle-price-')->toHtml();
     $product->setRealPriceHtml($html);
     return $this->_getPriceContent($product);
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:14,代码来源:Bundle.php


示例6: getMsrpHtml

 /**
  * Get html for MAP product enabled
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @return string
  */
 public function getMsrpHtml($item)
 {
     $product = $item->getProduct();
     $block = $this->_preparePriceBlock($product);
     $html = $block->setDisplayMinimalPrice(true)->toHtml();
     $product->setRealPriceHtml($html);
     return $this->_getPriceContent($product);
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:14,代码来源:Configurable.php


示例7: getEddMessage

 /**
  * Get an estimated delivery message for a quote item.
  *
  * @param  Mage_Sales_Model_Quote_Item
  * @return string
  */
 public function getEddMessage(Mage_Sales_Model_Quote_Item $item)
 {
     /** @var string $singularOrPluralItem */
     $singularOrPluralItem = (int) $item->getQty() > 1 ? 's' : '';
     /** @var EbayEnterprise_Inventory_Model_Details_Item | Varien_Object | null $eddItem */
     $eddItem = $this->detailService->getDetailsForItem($item) ?: $this->inventoryHelper->getStreetDateForBackorderableItem($item);
     return $eddItem ? $this->inventoryHelper->__($this->inventoryConfig->estimatedDeliveryTemplate, $singularOrPluralItem, $eddItem->getDeliveryWindowFromDate()->format('m/d/y'), $eddItem->getDeliveryWindowToDate()->format('m/d/y')) : '';
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:14,代码来源:Edd.php


示例8: setParentItem

 /**
  * Set parent item
  *
  * @param  Mage_Sales_Model_Quote_Item $parentItem
  * @return Mage_Sales_Model_Quote_Item
  */
 public function setParentItem($parentItem)
 {
     if ($parentItem) {
         $this->_parentItem = $parentItem;
         $parentItem->addChild($this);
     }
     return $this;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:14,代码来源:Abstract.php


示例9: setUp

 protected function setUp()
 {
     $this->_block = new Mage_Checkout_Block_Cart_Item_Renderer();
     $item = new Mage_Sales_Model_Quote_Item();
     $product = new Mage_Catalog_Model_Product();
     $product->load(1);
     $item->setProduct($product);
     $this->_block->setItem($item);
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:9,代码来源:Renderer.php


示例10: quoteItemHasCustomTagOptions

 public function quoteItemHasCustomTagOptions(Mage_Sales_Model_Quote_Item $quoteItem)
 {
     return array_reduce($quoteItem->getOptions(), function ($acc, Mage_Sales_Model_Quote_Item_Option $option) {
         if ($acc || !preg_match('/^option_/', $option->getCode())) {
             return $acc;
         }
         return !!Mage::getResourceModel('catalog/product_option_value_collection')->addFieldToFilter('option_type_id', $option->getValue())->addFieldToFilter('is_custom_tag', '1')->setPageSize(1)->load()->getSize();
     }, false);
 }
开发者ID:suspiciousfellow,项目名称:TaggedOption,代码行数:9,代码来源:Data.php


示例11: validate

 /**
  * Implementation of the validation logic
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @return bool
  */
 public function validate($item)
 {
     $multipleNumber = $this->_helper->getMultipleQtyNumber();
     $qty = $item->getQty();
     //For example 100 % 10
     if ($qty % $multipleNumber != 0) {
         return false;
     }
     return true;
 }
开发者ID:Engr-Kaka,项目名称:MyCompany_ExampleValidation,代码行数:16,代码来源:ValidateMultipleQty.php


示例12: importQuoteItem

 public function importQuoteItem(Mage_Sales_Model_Quote_Item $quoteItem)
 {
     $this->_quote = $quoteItem->getQuote();
     $this->setQuoteItem($quoteItem)->setQuoteItemId($quoteItem->getId())->setProductId($quoteItem->getProductId())->setProduct($quoteItem->getProduct())->setSku($quoteItem->getSku())->setName($quoteItem->getName())->setDescription($quoteItem->getDescription())->setWeight($quoteItem->getWeight())->setPrice($quoteItem->getPrice())->setCost($quoteItem->getCost());
     if (!$this->hasQty()) {
         $this->setQty($quoteItem->getQty());
     }
     $this->setQuoteItemImported(true);
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:10,代码来源:Quote_Address_Item.php


示例13: validateStock

 /**
  * Validate stock of a quoteItem
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @param float                       $priceInclTax
  * @param float                       $priceExclTax
  * @return ShopgateCartItem $result
  */
 public function validateStock(Mage_Sales_Model_Quote_Item $item, $priceInclTax, $priceExclTax)
 {
     switch ($item->getProduct()->getTypeId()) {
         case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
             $model = Mage::getModel('shopgate/shopgate_cart_validation_stock_bundle');
             break;
         default:
             $model = Mage::getModel('shopgate/shopgate_cart_validation_stock_simple');
     }
     return $model->validateStock($item, $priceInclTax, $priceExclTax);
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:19,代码来源:Stock.php


示例14: getConfigureButtonHtml

 /**
  * Get button to configure product
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @return mixed
  */
 public function getConfigureButtonHtml($item)
 {
     $product = $item->getProduct();
     $options = array('label' => Mage::helper('sales')->__('Configure'));
     if ($product->canConfigure()) {
         $options['onclick'] = sprintf('orderEditItems.showQuoteItemConfiguration(%s)', $item->getId());
     } else {
         $options['class'] = ' disabled';
         $options['title'] = Mage::helper('sales')->__('This product does not have any configurable options');
     }
     return $this->getLayout()->createBlock('adminhtml/widget_button')->setData($options)->toHtml();
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:18,代码来源:Itemsgrid.php


示例15: setItem

 /**
  * Get gifregistry params by quote item
  *
  * @param Mage_Sales_Model_Quote_Item $newItem
  * @return Enterprise_GiftRegistry_Block_Cart_Product_Mark
  */
 public function setItem($newItem)
 {
     if ($this->hasItem() && $this->getItem()->getId() == $newItem->getId()) {
         return $this;
     }
     if ($newItem->getGiftregistryItemId()) {
         $this->setData('item', $newItem);
         $entity = Mage::getModel('enterprise_giftregistry/entity')->loadByEntityItem($newItem->getGiftregistryItemId());
         $this->setEntity($entity);
     }
     return $this;
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:18,代码来源:Mark.php


示例16: validateStock

 /**
  * Validate stock of a quoteItem
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @param float                       $priceInclTax
  * @param float                       $priceExclTax
  *
  * @return ShopgateCartItem $result
  */
 public function validateStock(Mage_Sales_Model_Quote_Item $item, $priceInclTax, $priceExclTax)
 {
     $product = $item->getProduct();
     /** @var Mage_CatalogInventory_Model_Stock_Item $stockItem */
     $stockItem = $product->getStockItem();
     $errors = array();
     $isBuyable = true;
     $qtyBuyable = null;
     foreach ($item->getChildren() as $childItem) {
         /** @var Mage_Catalog_Model_Product $childProduct */
         $childProduct = $childItem->getProduct();
         /** @var Mage_CatalogInventory_Model_Stock_Item $childStock */
         $childStock = $childProduct->getStockItem();
         if ($childStock->getManageStock() && !$childProduct->isSaleable() && !$childStock->getBackorders()) {
             $isBuyable = false;
             $error = array();
             $error['type'] = ShopgateLibraryException::CART_ITEM_OUT_OF_STOCK;
             $error['message'] = ShopgateLibraryException::getMessageFor(ShopgateLibraryException::CART_ITEM_OUT_OF_STOCK);
             $errors[] = $error;
         } else {
             if ($childStock->getManageStock() && !$childStock->checkQty($childItem->getQty()) && !$childStock->getBackorders()) {
                 $isBuyable = false;
                 $error = array();
                 $error['type'] = ShopgateLibraryException::CART_ITEM_REQUESTED_QUANTITY_NOT_AVAILABLE;
                 $error['message'] = ShopgateLibraryException::getMessageFor(ShopgateLibraryException::CART_ITEM_REQUESTED_QUANTITY_NOT_AVAILABLE);
                 $errors[] = $error;
                 if ($qtyBuyable == null || $qtyBuyable > $childStock->getQty()) {
                     $qtyBuyable = $childStock->getQty();
                 }
             } else {
                 if (Mage::helper('shopgate/config')->getIsMagentoVersionLower1410()) {
                     $checkIncrements = Mage::helper('shopgate')->checkQtyIncrements($childStock, $childItem->getQty());
                 } else {
                     $checkIncrements = $childStock->checkQtyIncrements($childItem->getQty());
                 }
                 if ($childStock->getManageStock() && $checkIncrements->getHasError()) {
                     $isBuyable = false;
                     $error = array();
                     $error['type'] = ShopgateLibraryException::CART_ITEM_REQUESTED_QUANTITY_NOT_AVAILABLE;
                     $error['message'] = ShopgateLibraryException::getMessageFor(ShopgateLibraryException::CART_ITEM_REQUESTED_QUANTITY_NOT_AVAILABLE);
                     $errors[] = $error;
                     $stockItem->setQty((int) ($item->getQtyToAdd() / $stockItem->getQtyIncrements()) * $stockItem->getQtyIncrements());
                 }
             }
         }
     }
     $qtyBuyable = $qtyBuyable == null ? (int) $item->getQty() : (int) $qtyBuyable;
     return Mage::helper('shopgate')->generateShopgateCartItem($product, $isBuyable, $qtyBuyable, $priceInclTax, $priceExclTax, $errors, (int) $stockItem->getQty());
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:58,代码来源:Bundle.php


示例17: _getPriceByItem

 protected function _getPriceByItem(Mage_Sales_Model_Quote_Item $item)
 {
     $product = $item->getProduct();
     if (!$product->hasMtmPricelist() || $product->getMtmPricelist() == '') {
         return false;
     }
     $pricelist = $product->getAttributeText('mtm_pricelist');
     $helper = Mage::helper('catalog/product_configuration');
     $options = $helper->getCustomOptions($item);
     $options = array_column($options, 'value', 'option_type');
     $model = Mage::getModel("xxx_catalog/pricelist");
     $width = $options['width'];
     $height = $options['height'];
     $buyRequest = $product->getCustomOption('info_buyRequest')->getValue();
     $buyRequest = unserialize($buyRequest);
     $mtmParameters = [];
     foreach ($buyRequest as $key => $value) {
         if (strpos($key, 'mtm_') === 0) {
             $mtmParameters[] = $value;
         }
     }
     $price = 0;
     $price += $this->_getGraphicPrice($buyRequest);
     if (count($mtmParameters) > 0) {
         $paramsChain = implode('-', $mtmParameters);
         $price += $model->getPriceForSize($pricelist, $width, $height, $paramsChain);
         return $price;
     }
     // in case of wrong (incomplete) pricelist loaded by user, prevent setting product price to 0
     $price = $price > 0 ? $price : 999.99;
     return $price;
 }
开发者ID:mkutyba,项目名称:sample-magento-code,代码行数:32,代码来源:Observer.php


示例18: getBuyRequest

 /**
  * Use our own method to get buyRequest
  * @param Mage_Sales_Model_Quote_Item $salesItem
  * @return Varien_Object
  *
  */
 public function getBuyRequest($salesItem, $option = false)
 {
     if ($option) {
         $option = $salesItem->getOptionByCode('info_buyRequest');
         $buyRequest = new Varien_Object($option && $option->getValue() ? unserialize($option->getValue()) : null);
         $buyRequest->setOriginalQty($buyRequest->getQty())->setQty($salesItem->getQty() * 1);
         return $buyRequest;
     }
     $option = $salesItem->getProductOptionByCode('info_buyRequest');
     if (!$option) {
         $option = array();
     }
     $buyRequest = new Varien_Object($option);
     $buyRequest->setQty($salesItem->getQtyOrdered() * 1);
     return $buyRequest;
 }
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:22,代码来源:AW_Collpur_Helper_Data.php


示例19: getRuleModels

 /**
  * Spawn the correct validator object and init it
  *
  * @param $rulesConfig array
  * @param Mage_Sales_Model_Quote_Item $item
  * @return Jarlssen_CustomCartValidation_Model_Factory
  */
 public function getRuleModels($rulesConfig, $item)
 {
     $ruleModels = array();
     $productType = $item->getProductType();
     foreach ($rulesConfig as $config) {
         if ('*' == $config['product_type'] || $config['product_type'] == $productType) {
             try {
                 $ruleModel = Mage::getModel($config['model']);
                 $ruleModel->setItem($item)->setCode($config['code'])->setOrigin($config['origin']);
                 $ruleModels[] = $ruleModel;
             } catch (Exception $e) {
                 Mage::logException($e);
             }
         }
     }
     return $ruleModels;
 }
开发者ID:elvetemedve,项目名称:Jarlssen_CustomCartValidation,代码行数:24,代码来源:Factory.php


示例20: isItemInventoried

 /**
  * Test if the item needs to have its quantity checked for available
  * inventory.
  * @param  Mage_Sales_Model_Quote_Item $item The item to check
  * @return bool True if inventory is managed, false if not
  */
 public function isItemInventoried(Mage_Sales_Model_Quote_Item $item)
 {
     // never consider a child product as inventoried, allow the parent deal
     // with inventory and let the child not need to worry about it as the parent
     // will be the item to keep track of qty being ordered.
     // Both checks needed as child items will not have a parent item id prior
     // to being saved and a parent item prior to being added to the parent (e.g.
     // immediately after being loaded from the DB).
     if ($item->getParentItemId() || $item->getParentItem()) {
         return false;
     }
     // when dealing with parent items, if any child of the product is managed
     // stock, consider the entire item as managed stock - allows for the parent
     // config product in the quote to deal with inventory while allowing child
     // products to not care individually
     if ($item->getHasChildren()) {
         foreach ($item->getChildren() as $childItem) {
             $childStock = $childItem->getProduct()->getStockItem();
             if ($this->isManagedStock($childStock)) {
                 // This Parent is inventoried. Child's ROM setting is 'No backorders', and Manage Stock check hasn't been manually overridden
                 return true;
             }
         }
         // if none of the children were managed stock, the parent is not inventoried
         return false;
     }
     return $this->isManagedStock($item->getProduct()->getStockItem());
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:34,代码来源:Item.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap