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


PHP Mage_Sales_Model_Quote_Item::getProductId方法代码示例

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


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

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

示例2: setQuoteItem

 public function setQuoteItem(Mage_Sales_Model_Quote_Item $item)
 {
     $this->setQuoteItemId($item->getId());
     $this->setQuoteId($item->getQuoteId());
     $this->setProductId($item->getProductId());
     $this->setStoreId($item->getStoreId());
     $this->setQty($item->getQty());
     $this->setIsActive(true);
     $expireDateTime = Mage::helper('zab_timedcart')->getExpireDatetime(now());
     $this->setExpireDatetime($expireDateTime);
     return $this;
 }
开发者ID:becchius,项目名称:fiordivaniglia,代码行数:12,代码来源:Item.php

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

示例4: compare

 /**
  * Compare item
  *
  * @param   Mage_Sales_Model_Quote_Item $item
  * @return  bool
  */
 public function compare($item)
 {
     if ($this->getProductId() != $item->getProductId()) {
         return false;
     }
     foreach ($this->getOptions() as $option) {
         if (in_array($option->getCode(), $this->_notRepresentOptions) && !$item->getProduct()->hasCustomOptions()) {
             continue;
         }
         if ($itemOption = $item->getOptionByCode($option->getCode())) {
             $itemOptionValue = $itemOption->getValue();
             $optionValue = $option->getValue();
             // dispose of some options params, that can cramp comparing of arrays
             if (is_string($itemOptionValue) && is_string($optionValue)) {
                 try {
                     /** @var Unserialize_Parser $parser */
                     $parser = Mage::helper('core/unserializeArray');
                     $_itemOptionValue = $parser->unserialize($itemOptionValue);
                     $_optionValue = $parser->unserialize($optionValue);
                     if (is_array($_itemOptionValue) && is_array($_optionValue)) {
                         $itemOptionValue = $_itemOptionValue;
                         $optionValue = $_optionValue;
                         // looks like it does not break bundle selection qty
                         unset($itemOptionValue['qty'], $itemOptionValue['uenc']);
                         unset($optionValue['qty'], $optionValue['uenc']);
                     }
                 } catch (Exception $e) {
                     Mage::logException($e);
                 }
             }
             if ($itemOptionValue != $optionValue) {
                 return false;
             }
         } else {
             return false;
         }
     }
     return true;
 }
开发者ID:mswebdesign,项目名称:Mswebdesign_Magento_1_Community_Edition,代码行数:45,代码来源:Item.php

示例5: getRowUrl

 /**
  * Retrieve row url
  *
  * @param Mage_Sales_Model_Quote_Item $row
  * @return string
  */
 public function getRowUrl($row)
 {
     return $this->getUrl('*/catalog_product/edit', array('id' => $row->getProductId()));
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:10,代码来源:Cart.php

示例6: _skip

 /**
  * determines if we should skip the items with special price or other (in futeure) conditions
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @param Amasty_Promo_Model_Sales_Quote_Address $address
  *
  * @return bool
  */
 protected function _skip($item, $address)
 {
     if (!Mage::getStoreConfig('ampromo/general/skip_special_price')) {
         return false;
     }
     if ($item->getProductType() == 'bundle') {
         return false;
     }
     if (is_null($this->_itemsWithDiscount) || count($this->_itemsWithDiscount) == 0) {
         $productIds = array();
         $this->_itemsWithDiscount = array();
         foreach ($this->_getAllItems($address) as $addressItem) {
             $productIds[] = $addressItem->getProductId();
         }
         if (!$productIds) {
             return false;
         }
         $productsCollection = Mage::getModel('catalog/product')->getCollection()->addPriceData()->addAttributeToFilter('entity_id', array('in' => $productIds))->addAttributeToFilter('price', array('gt' => new Zend_Db_Expr('final_price')));
         foreach ($productsCollection as $product) {
             $this->_itemsWithDiscount[] = $product->getId();
         }
     }
     if (Mage::getStoreConfig('ampromo/general/skip_special_price_configurable')) {
         if ($item->getProductType() == "configurable") {
             foreach ($item->getChildren() as $child) {
                 if (in_array($child->getProductId(), $this->_itemsWithDiscount)) {
                     return true;
                 }
             }
         }
     }
     if (!in_array($item->getProductId(), $this->_itemsWithDiscount)) {
         return false;
     }
     return true;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:44,代码来源:Observer.php

示例7: getProductName

 /**
  * Returns the name for a quote item.
  * Configurable products will have their chosen options added to their name.
  * Bundle products will have their chosen child product names added.
  * Grouped products will have their parent product name prepended.
  * All others will have their own name only.
  *
  * @param Mage_Sales_Model_Quote_Item $item the quote item model.
  *
  * @return string
  */
 public function getProductName($item)
 {
     $name = $item->getName();
     $optNames = array();
     if ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
         /** @var Mage_Catalog_Model_Product_Type_Configurable $model */
         $model = Mage::getModel('catalog/product_type_configurable');
         $parentIds = $model->getParentIdsByChild($item->getProductId());
         // If the product has a configurable parent, we assume we should tag
         // the parent. If there are many parent IDs, we are safer to tag the
         // products own name alone.
         if (count($parentIds) === 1) {
             $attributes = $item->getBuyRequest()->getData('super_attribute');
             if (is_array($attributes)) {
                 foreach ($attributes as $id => $value) {
                     /** @var Mage_Catalog_Model_Resource_Eav_Attribute $attribute */
                     $attribute = Mage::getModel('catalog/resource_eav_attribute')->load($id);
                     $label = $attribute->getSource()->getOptionText($value);
                     if (!empty($label)) {
                         $optNames[] = $label;
                     }
                 }
             }
         }
     } elseif ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
         /* @var $helper Mage_Catalog_Helper_Product_Configuration */
         $helper = Mage::helper('catalog/product_configuration');
         foreach ($helper->getConfigurableOptions($item) as $opt) {
             if (isset($opt['value']) && is_string($opt['value'])) {
                 $optNames[] = $opt['value'];
             }
         }
     } elseif ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
         $type = $item->getProduct()->getTypeInstance(true);
         $opts = $type->getOrderOptions($item->getProduct());
         if (isset($opts['bundle_options']) && is_array($opts['bundle_options'])) {
             foreach ($opts['bundle_options'] as $opt) {
                 if (isset($opt['value']) && is_array($opt['value'])) {
                     foreach ($opt['value'] as $val) {
                         $qty = '';
                         if (isset($val['qty']) && is_int($val['qty'])) {
                             $qty .= $val['qty'] . ' x ';
                         }
                         if (isset($val['title']) && is_string($val['title'])) {
                             $optNames[] = $qty . $val['title'];
                         }
                     }
                 }
             }
         }
     } elseif ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
         $config = $item->getBuyRequest()->getData('super_product_config');
         if (isset($config['product_id'])) {
             /** @var Mage_Catalog_Model_Product $parent */
             $parent = Mage::getModel('catalog/product')->load($config['product_id']);
             $parentName = $parent->getName();
             if (!empty($parentName)) {
                 $name = $parentName . ' - ' . $name;
             }
         }
     }
     if (!empty($optNames)) {
         $name .= ' (' . implode(', ', $optNames) . ')';
     }
     return $name;
 }
开发者ID:nosto,项目名称:nosto-magento-extension,代码行数:77,代码来源:Cart.php

示例8: getCatalogRewardsRuleIds

 /**
  * Gets a list of all rule ID's that are associated with the given item.
  *
  * @param   Mage_Sales_Model_Quote_Item $item   : The item object with which the returned rules are associated
  * @return  array(int)                          : An array of rule ID's that are associated with the item
  */
 public function getCatalogRewardsRuleIds($item, $wId = null)
 {
     return $this->getCatalogRewardsRuleIdsForProduct($item->getProductId(), $wId);
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:10,代码来源:Transfer.php

示例9: addItem

 /**
  * Add new product to registry
  *
  * @param int|Mage_Sales_Model_Quote_Item $itemToAdd
  * @param Varien_Object $request
  * @return Enterprise_GiftRegistry_Model_Item
  */
 public function addItem($itemToAdd, $request = null)
 {
     if ($itemToAdd instanceof Mage_Sales_Model_Quote_Item) {
         $productId = $itemToAdd->getProductId();
         $qty = $itemToAdd->getQty();
     } else {
         $productId = $itemToAdd;
         $qty = $request && $request->getQty() ? $request->getQty() : 1;
     }
     $product = $this->getProduct($productId);
     if ($product->getTypeInstance(true)->hasRequiredOptions($product) && (!$request && !$itemToAdd instanceof Mage_Sales_Model_Quote_Item)) {
         throw new Mage_Core_Exception(null, self::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS);
     }
     if ($itemToAdd instanceof Mage_Sales_Model_Quote_Item) {
         $cartCandidate = $itemToAdd->getProduct();
         $cartCandidate->setCustomOptions($itemToAdd->getOptionsByCode());
         $cartCandidates = array($cartCandidate);
     } else {
         if (!$request) {
             $request = new Varien_Object();
             $request->setBundleOption(array());
             //Bundle options mocking for compatibility
         }
         $cartCandidates = $product->getTypeInstance(true)->prepareForCart($request, $product);
     }
     if (is_string($cartCandidates)) {
         //prepare process has error, seems like we have bundle
         throw new Mage_Core_Exception($cartCandidates, self::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS);
     }
     $item = Mage::getModel('enterprise_giftregistry/item');
     $items = $item->getCollection()->addRegistryFilter($this->getId());
     foreach ($cartCandidates as $currentCandidate) {
         if ($currentCandidate->getParentProductId()) {
             continue;
         }
         $alreadyExists = false;
         $productId = $currentCandidate->getId();
         foreach ($items as $itemForCheck) {
             if ($itemForCheck->isRepresentProduct($currentCandidate)) {
                 $alreadyExists = true;
                 $matchedItem = $itemForCheck;
                 break;
             }
         }
         $candidateQty = $currentCandidate->getCartQty();
         if (!empty($candidateQty)) {
             $qty = $candidateQty;
         }
         if ($alreadyExists) {
             $matchedItem->setQty($matchedItem->getQty() + $qty)->save();
         } else {
             $customOptions = $currentCandidate->getCustomOptions();
             $item = Mage::getModel('enterprise_giftregistry/item');
             $item->setEntityId($this->getId())->setProductId($productId)->setOptions($customOptions)->setQty($qty)->save();
         }
     }
     return $item;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:65,代码来源:Entity.php

示例10: _retrieveProductIdFromQuoteItem

 /**
  * Retrieve simple product id from quote item
  *
  * @param Mage_Sales_Model_Quote_Item|Mage_Sales_Model_Quote_Address_Item $item
  *
  * @return int
  */
 protected function _retrieveProductIdFromQuoteItem($item)
 {
     $productId = $item->getProductId();
     if ($item->getOptionByCode('simple_product')) {
         $productId = $item->getOptionByCode('simple_product')->getProduct()->getId();
     }
     return $productId;
 }
开发者ID:onepica,项目名称:avatax,代码行数:15,代码来源:Tools.php

示例11: getQuoteItemVendor

 /**
  * Return vendor ID for quote item based on requested qty
  *
  * if $qty===true, always return dropship vendor id
  * if $qty===false, always return local vendor id
  * otherwise return local vendor if enough qty in stock
  *
  * @param Mage_Sales_Model_Quote_Item $item
  * @param integer|boolean $qty
  * @return integer
  * @deprecated since 1.6.0
  */
 public function getQuoteItemVendor($item, $qty = 0)
 {
     $product = $item->getProduct();
     if (!$product || !$product->hasUdropshipVendor()) {
         // if not available, load full product info to get product vendor
         $product = Mage::getModel('catalog/product')->load($item->getProductId());
     }
     $store = $item->getQuote() ? $item->getQuote()->getStore() : $item->getOrder()->getStore();
     $localVendorId = $this->getLocalVendorId($store);
     $vendorId = $product->getUdropshipVendor();
     // product doesn't have vendor specified OR force local vendor
     if (!$vendorId || $qty === false) {
         return $localVendorId;
     }
     // force real vendor
     if ($qty === true) {
         return $vendorId;
     }
     // local stock is available
     if (Mage::getSingleton('udropship/stock_availability')->getUseLocalStockIfAvailable($store, $vendorId) && $product->getStockItem()->checkQty($qty)) {
         return $localVendorId;
     }
     // all other cases
     return $vendorId;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:37,代码来源:Data.php

示例12: _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
  */
 private 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());
     }
 }
开发者ID:xiaoguizhidao,项目名称:mydigibits,代码行数:29,代码来源:Data.php

示例13: _isDownloadableEcodeItem

 private function _isDownloadableEcodeItem(Mage_Sales_Model_Quote_Item $quoteItem)
 {
     $product = Mage::getModel('catalog/product')->load($quoteItem->getProductId());
     if ($product->getSerialRequired()) {
         return true;
     }
     return false;
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:8,代码来源:ICC_Ecodes_Model_Observer.php

示例14: compare

 /**
  * Compare item
  *
  * @param   Mage_Sales_Model_Quote_Item $item
  * @return  bool
  */
 public function compare($item)
 {
     if ($this->getProductId() != $item->getProductId()) {
         return false;
     }
     foreach ($this->getOptions() as $option) {
         if (in_array($option->getCode(), $this->_notRepresentOptions)) {
             continue;
         }
         if ($itemOption = $item->getOptionByCode($option->getCode())) {
             $itemOptionValue = $itemOption->getValue();
             $optionValue = $option->getValue();
             // dispose of some options params, that can cramp comparing of arrays
             if (is_string($itemOptionValue) && is_string($optionValue)) {
                 $_itemOptionValue = @unserialize($itemOptionValue);
                 $_optionValue = @unserialize($optionValue);
                 if (is_array($_itemOptionValue) && is_array($_optionValue)) {
                     $itemOptionValue = $_itemOptionValue;
                     $optionValue = $_optionValue;
                     // looks like it does not break bundle selection qty
                     unset($itemOptionValue['qty'], $itemOptionValue['uenc'], $optionValue['qty'], $optionValue['uenc']);
                 }
             }
             if ($itemOptionValue != $optionValue) {
                 return false;
             }
         } else {
             return false;
         }
     }
     return true;
 }
开发者ID:relue,项目名称:magento2,代码行数:38,代码来源:Item.php

示例15: _getProductForItemCode

 /**
  * Retrieve product for item code
  *
  * @param Mage_Sales_Model_Quote_Address_Item|Mage_Sales_Model_Quote_Item $item
  * @return null|Mage_Catalog_Model_Product
  * @throws OnePica_AvaTax_Exception
  */
 protected function _getProductForItemCode($item)
 {
     $product = $this->_getProductByProductId($item->getProductId());
     if (!$this->_getCalculationHelper()->isConfigurable($item)) {
         return $product;
     }
     $children = $item->getChildren();
     if (isset($children[0]) && $children[0]->getProductId()) {
         $product = $this->_getProductByProductId($children[0]->getProductId());
     }
     return $product;
 }
开发者ID:onepica,项目名称:avatax,代码行数:19,代码来源:Estimate.php


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