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


PHP Mage_Sales_Model_Quote_Item::getProduct方法代码示例

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


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

示例1: 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)
 {
     /** @var Mage_Catalog_Model_Product $product */
     $product = $item->getProduct();
     /** @var Mage_CatalogInventory_Model_Stock_Item $stockItem */
     $stockItem = $product->getStockItem();
     $isBuyable = true;
     if ($product->isConfigurable()) {
         $parent = $product;
         $product = $product->getCustomOption('simple_product')->getProduct();
         $product->setShopgateItemNumber($parent->getShopgateItemNumber());
         $product->setShopgateOptions($parent->getShopgateOptions());
         $product->setShopgateInputs($parent->getShopgateInputs());
         $product->setShhopgateAttributes($parent->getShhopgateAttributes());
         $stockItem = $item->getProduct()->getCustomOption('simple_product')->getProduct()->getStockItem();
     }
     $errors = array();
     if (Mage::helper('shopgate/config')->getIsMagentoVersionLower1410()) {
         $checkIncrements = Mage::helper('shopgate')->checkQtyIncrements($stockItem, $item->getQty());
     } else {
         $checkIncrements = $stockItem->checkQtyIncrements($item->getQty());
     }
     if ($stockItem->getManageStock() && !$product->isSaleable() && (!$stockItem->getBackorders() || !$stockItem->getIsInStock())) {
         $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 ($stockItem->getManageStock() && !$stockItem->checkQty($item->getQty()) && !$stockItem->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;
         } else {
             if ($stockItem->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 = $isBuyable ? (int) $item->getQty() : (int) $stockItem->getQty();
     return Mage::helper('shopgate')->generateShopgateCartItem($product, $isBuyable, $qtyBuyable, $priceInclTax, $priceExclTax, $errors, (int) $stockItem->getQty());
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:57,代码来源:Simple.php

示例2: _addItemToQtyArray

 /**
  * Overwrite @method _addItemToQtyArray
  *
  * Adds stock item qty to $items (creates new entry or increments existing one)
  * $items is array with following structure:
  * array(
  *  $productId  => array(
  *      'qty'   => $qty,
  *      'item'  => $stockItems|null
  *  )
  * )
  *
  * @param Mage_Sales_Model_Quote_Item $quoteItem
  * @param array &$items
  */
 protected function _addItemToQtyArray($quoteItem, &$items)
 {
     $productId = $quoteItem->getProductId();
     if (!$productId) {
         return;
     }
     if (isset($items[$productId])) {
         $items[$productId]['qty'] += $quoteItem->getTotalQty();
     } else {
         $stockItem = null;
         if ($quoteItem->getProduct()) {
             $stockItem = $quoteItem->getProduct()->getStockItem();
         }
         $items[$productId] = array('item' => $stockItem, 'qty' => $quoteItem->getTotalQty(), 'quote_item_id' => $quoteItem->getId(), 'creditmemo_item_id' => null);
     }
 }
开发者ID:Rugento,项目名称:ADM_Warehouse,代码行数:31,代码来源:Observer.php

示例3: 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

示例4: 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

示例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->setDisplayMinimalPrice(true)->toHtml();
     $product->setRealPriceHtml($html);
     return $this->_getPriceContent($product);
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:14,代码来源:Configurable.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->setPriceElementIdPrefix('bundle-price-')->toHtml();
     $product->setRealPriceHtml($html);
     return $this->_getPriceContent($product);
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:14,代码来源:Bundle.php

示例7: getProduct

 public function getProduct()
 {
     $product = parent::getProduct();
     if (!$product->getTypeId()) {
         $product->setTypeId('simple');
     }
     return $product;
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:8,代码来源:Vendor.php

示例8: importQuoteItem

 public function importQuoteItem(Mage_Sales_Model_Quote_Item $quoteItem)
 {
     $this->setQuoteItemId($quoteItem->getId())->setProductId($quoteItem->getProductId())->setProduct($quoteItem->getProduct())->setSuperProductId($quoteItem->getSuperProductId())->setSuperProduct($quoteItem->getSuperProduct())->setSku($quoteItem->getSku())->setImage($quoteItem->getImage())->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:arslbbt,项目名称:mangentovies,代码行数:9,代码来源:Item.php

示例9: 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

示例10: 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

示例11: 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

示例12: getRecurringItemMessage

 /**
  * @param Mage_Sales_Model_Quote_Item $recQuoteItem
  * @return mixed
  */
 public function getRecurringItemMessage(Mage_Sales_Model_Quote_Item $recQuoteItem)
 {
     $recurringItemMessage = '';
     $initialFeeMessage = '';
     $rowTotal = $recQuoteItem->getNominalRowTotal();
     $currency_symbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
     $product = $recQuoteItem->getProduct();
     $productAdditionalInfo = unserialize($product->getCustomOption('info_buyRequest')->getValue());
     $deferredDateStamp = strtotime($productAdditionalInfo['recurring_profile_start_datetime']);
     if ($deferredDateStamp) {
         $initialFeeMessage = $this->__(" (initial fee only, 1st recurring fee will be charged on %s)", date('d-M-Y', $deferredDateStamp));
         $rowTotal = $recQuoteItem->getXpRecurringInitialFee() + $recQuoteItem->getInitialfeeTaxAmount();
     }
     $recurringItemMessage = $this->__("%s%s for recurring product '%s' in your cart.", number_format($rowTotal, 2, '.', ''), $currency_symbol, $recQuoteItem->getName());
     $mainMessage = $recurringItemMessage . $initialFeeMessage;
     return $mainMessage;
 }
开发者ID:payfort,项目名称:magento-payfort,代码行数:21,代码来源:Orderdetail.php

示例13: getProductOptionsParameters

 /**
  * Generate serialized product options as in POST or GET parameters
  * @param Mage_Sales_Model_Quote_Item $item
  * @return array
  */
 public function getProductOptionsParameters(Mage_Sales_Model_Quote_Item $item)
 {
     $product = $item->getProduct();
     $options = $this->getProductOptions($item);
     $data = array();
     foreach ($options as $option) {
         $id = $option['option_id'];
         $objOption = $product->getOptionById($id);
         $objValues = $objOption->getValuesCollection()->getItems();
         $value = $this->_mapValueToOptionValue($option['value'], $objValues);
         // overwrite multi-options
         if (in_array($option['option_type'], array('multiple', 'checkbox'))) {
             $values = array_filter(explode(', ', $value));
             $value = array();
             foreach ($values as $optionId) {
                 $value[] = $this->_mapValueToOptionValue($optionId, $objValues);
             }
         }
         // overwrite date-time options
         if (in_array($option['option_type'], array('date_time', 'date', 'time'))) {
             $timestamp = strtotime($value);
             $value = array();
             if (in_array($option['option_type'], array('date_time', 'date'))) {
                 $value['month'] = date('n', $timestamp);
                 $value['day'] = date('j', $timestamp);
                 $value['year'] = date('Y', $timestamp);
             }
             if (in_array($option['option_type'], array('date_time', 'time'))) {
                 $value['hour'] = date('g', $timestamp);
                 $value['minute'] = ltrim(date('i', $timestamp), '0');
                 $value['minute'] = $value['minute'] ? $value['minute'] : '0';
                 $value['day_part'] = date('a', $timestamp);
             }
         }
         $data[$id] = $value;
     }
     return $data;
 }
开发者ID:finelinePG,项目名称:finelink-dev,代码行数:43,代码来源:Cartitem.php

示例14: generateProductData

 /**
  * Add generate an array of product data
  *
  * @name generateProductData
  * @param Mage_Sales_Model_Quote_Item $item
  * @return array
  */
 public function generateProductData($item)
 {
     $orderOptions = array();
     $product = Mage::getModel('catalog/product')->load($item->getProductId());
     if ($product->getVisibility() == 1) {
         return null;
     }
     $productOptions = $item->getProductOptions();
     if (is_object($item->getProduct())) {
         $orderOptions = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct());
     }
     $productData = $this->parseObject($product, 'addProduct');
     $itemData = $this->parseObject($item, 'addProduct');
     $itemData['variant'] = $this->extractAttributes($productOptions, $orderOptions);
     return array_filter(array_merge($productData, $itemData), 'strlen');
 }
开发者ID:lapty,项目名称:UniversalAnalytics,代码行数:23,代码来源:Monitor.php

示例15: _prepareOptionsForRequest

 /**
  * Prepare options array for info buy request
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @return array
  */
 protected function _prepareOptionsForRequest($item)
 {
     $newInfoOptions = array();
     if ($optionIds = $item->getOptionByCode('option_ids')) {
         foreach (explode(',', $optionIds->getValue()) as $optionId) {
             $option = $item->getProduct()->getOptionById($optionId);
             $optionValue = $item->getOptionByCode('option_' . $optionId)->getValue();
             $group = Mage::getSingleton('catalog/product_option')->groupFactory($option->getType())->setOption($option)->setQuoteItem($item);
             $newInfoOptions[$optionId] = $group->prepareOptionValueForRequest($optionValue);
         }
     }
     return $newInfoOptions;
 }
开发者ID:beejhuff,项目名称:magento-1.13.0.2,代码行数:19,代码来源:Create.php


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