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


PHP Mage_Sales_Model_Order_Item::getProductId方法代码示例

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


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

示例1: __construct

 /**
  * @param array $args Must contain key/values for:
  *                         - item => Mage_Sales_Model_Order_Item
  *                         - tax_records => EbayEnterprise_Tax_Model_Record[]
  *                         - order_item_payload => eBayEnterprise\RetailOrderManagement\Payload\Order\IOrderItem
  *                         May contain key/values for:
  *                         - logger => EbayEnterprise_MageLog_Helper_Data
  *                         - log_context => EbayEnterprise_MageLog_Helper_Context
  *                         - payload_helper => EbayEnterprise_Tax_Helper_Payload
  *                         - tax_config => EbayEnterprise_Eb2cCore_Model_Config_Registry
  *                         - fees => EbayEnterprise_Tax_Model_Fee[]
  *                         - duty => EbayEnterprise_Tax_Model_Duty
  */
 public function __construct(array $args = [])
 {
     list($this->_item, $this->_taxRecords, $this->_orderItemPayload, $this->_logger, $this->_logContext, $this->_payloadHelper, $this->_taxConfig, $this->_fees, $this->_duty) = $this->_checkTypes($args['item'], $args['tax_records'], $args['order_item_payload'], $this->_nullCoalesce($args, 'logger', Mage::helper('ebayenterprise_magelog')), $this->_nullCoalesce($args, 'log_context', Mage::helper('ebayenterprise_magelog/context')), $this->_nullCoalesce($args, 'payload_helper', Mage::helper('ebayenterprise_tax/payload')), $this->_nullCoalesce($args, 'tax_config', Mage::helper('ebayenterprise_tax')->getConfigModel()), $this->_nullCoalesce($args, 'fees', []), $this->_nullCoalesce($args, 'duty', null));
     $this->_indexTaxRecords();
     // The order item *should* already have the associated product entity
     // loaded but if it doesn't, load the product using the product id of the item.
     $this->_itemProduct = $this->_item->getProduct() ?: Mage::getModel('catalog/product')->load($this->_item->getProductId());
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:21,代码来源:Orderitem.php

示例2: getProductTypeByOrderItem

 /**
  * Get names of second level categories for ordered item
  *
  * @item Mage_Sales_Model_Order_Item
  * @return string
  */
 public function getProductTypeByOrderItem(Mage_Sales_Model_Order_Item $item)
 {
     $ret = null;
     if ($item->getProductId() && ($_product = Mage::getModel('catalog/product')->load($item->getProductId()))) {
         /* @var $_product Gorilla_Catalog_Model_Product */
         if ($typeId = $_product->getItemType()) {
             $ret = $_product->getResource()->getAttribute("item_type")->getSource()->getOptionText($typeId);
         }
     }
     return $ret;
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:17,代码来源:ICC_GoogleAnalytics_Block_Ga.php

示例3: setItem

 /**
  * Set item
  * 
  * @param Mage_Sales_Model_Order_Item $item
  * @return Uecommerce_Mundipagg_Model_Recurrency
  */
 public function setItem(Mage_Sales_Model_Order_Item $item)
 {
     $this->_item = $item;
     $this->_product = Mage::getModel('catalog/product')->load($item->getProductId());
     if ($this->_product->getMundipaggRecurrent() && $this->isRecurrent()) {
         $this->_setRecurrencyByProduct($this->_product);
     }
     return $this;
 }
开发者ID:rorteg,项目名称:rafaelmage,代码行数:15,代码来源:Recurrency.php

示例4: getKwixoCategoryFromOrderItem

 protected function getKwixoCategoryFromOrderItem(Mage_Sales_Model_Order_Item $item)
 {
     $product = Mage::getModel('catalog/product')->load($item->getProductId());
     $kwixoCategoryId = null;
     foreach ($product->getCategoryIds() as $categoryId) {
         $kwixoCategory = Mage::getModel('ops/kwixo_category_mapping')->loadByCategoryId($categoryId);
         if (!is_null($kwixoCategory->getId())) {
             $kwixoCategoryId = $kwixoCategory->getKwixoCategoryId();
             break;
         }
     }
     return $kwixoCategoryId;
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:13,代码来源:Abstract.php

示例5: crateFromOrderItem

 public static function crateFromOrderItem(Mage_Sales_Model_Order_Item $orderItem)
 {
     $productId = $orderItem->getProductId();
     /** @var Mage_Catalog_Model_Product $product */
     $product = Mage::getModel('catalog/product')->load($productId);
     $discounts = $product->getPrice() - $product->getFinalPrice();
     $aArticle = new self();
     $aArticle->id = $productId;
     $aArticle->name = $orderItem->getName();
     $aArticle->url = $product->getProductUrl();
     $aArticle->image_url = $product->getImageUrl();
     $aArticle->quantity = intval($orderItem->getQtyOrdered());
     $aArticle->price = Aplazame_Sdk_Serializer_Decimal::fromFloat($orderItem->getPrice() + $discounts);
     $aArticle->description = substr($product->getDescription(), 0, 255);
     $aArticle->tax_rate = Aplazame_Sdk_Serializer_Decimal::fromFloat(self::getProductTaxRate($product));
     $aArticle->discount = Aplazame_Sdk_Serializer_Decimal::fromFloat($discounts);
     return $aArticle;
 }
开发者ID:aplazame,项目名称:magento,代码行数:18,代码来源:Article.php

示例6: addOrderItem

 /**
  * Convert order item to quote item
  *
  * @param Mage_Sales_Model_Order_Item $orderItem
  * @param mixed $qtyFlag if is null set product qty like in order
  * @return Mage_Checkout_Model_Cart
  */
 public function addOrderItem($orderItem, $qtyFlag = null)
 {
     /* @var $orderItem Mage_Sales_Model_Order_Item */
     if (is_null($orderItem->getParentItem())) {
         $product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->load($orderItem->getProductId());
         if (!$product->getId()) {
             return $this;
         }
         $info = $orderItem->getProductOptionByCode('info_buyRequest');
         $info = new Varien_Object($info);
         if (is_null($qtyFlag)) {
             $info->setQty($orderItem->getQtyOrdered());
         } else {
             $info->setQty(1);
         }
         $this->addProduct($product, $info);
     }
     return $this;
 }
开发者ID:vuhung,项目名称:Magento-Rack-Ketai,代码行数:26,代码来源:Cart.php

示例7: renderSerialOptionOnOrderItem

 public function renderSerialOptionOnOrderItem(Mage_Sales_Model_Order_Item $orderItem, $noSerialsAvailableMessage = null, $checkIfSerialRequired = false)
 {
     if ($checkIfSerialRequired) {
         $product = Mage::getModel('catalog/product')->load($orderItem->getProductId());
         if (!$product->getSerialRequired()) {
             return $this;
         }
     }
     if (is_null($noSerialsAvailableMessage)) {
         $noSerialsAvailableMessage = self::DEFAULT_MISSING_SERIAL_MESSAGE;
     }
     $downloadableCollection = Mage::getModel('ecodes/downloadable')->getCollection();
     $assignedSerials = $downloadableCollection->getAssignedSerials($orderItem);
     $order = Mage::getModel('sales/order')->load($orderItem->getOrderId());
     if ($order->getVolumeLicense() != 0 && $order->getParentOrderId() == NULL) {
         $noSerialsAvailableMessage = self::SERIALS_VOLUME_LICENSE_PARENT_ORDER_MESSAGE;
     }
     $orderItemProductOptions = $orderItem->getProductOptions();
     $value = $assignedSerials ? implode(',', $assignedSerials) : $noSerialsAvailableMessage;
     $orderItemProductOptions['options']['ecodes_downloadable_serials']['label'] = 'Assigned Serials';
     $orderItemProductOptions['options']['ecodes_downloadable_serials']['value'] = $value;
     $orderItem->setProductOptions($orderItemProductOptions);
     return $this;
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:24,代码来源:ICC_Ecodes_Helper_Downloadable.php

示例8: buildItemName

 /**
  * Returns the name for a sales 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 parents name prepended.
  * All others will have their own name only.
  *
  * @param Mage_Sales_Model_Order_Item $item the sales item model.
  *
  * @return string
  */
 protected function buildItemName(Mage_Sales_Model_Order_Item $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) {
         $opts = $item->getProductOptionByCode('attributes_info');
         if (is_array($opts)) {
             foreach ($opts as $opt) {
                 if (isset($opt['value']) && is_string($opt['value'])) {
                     $optNames[] = $opt['value'];
                 }
             }
         }
     } elseif ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
         $opts = $item->getProductOptionByCode('bundle_options');
         if (is_array($opts)) {
             foreach ($opts 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->getProductOptionByCode('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:kurtinge,项目名称:nosto-magento-extension,代码行数:77,代码来源:Order.php

示例9: loadCatalogData

 /**
  * Loads all relevant product and category data for the item
  *
  * @param  Mage_Sales_Model_Order_Item|Mage_Sales_Model_Quote_Item $item
  * @param  int $orderStoreId
  * @param  int $websiteId
  * @param  int $maxLimit
  */
 public function loadCatalogData($item, $storeId, $websiteId, $maxLimit = 10)
 {
     $product = null;
     $categories = array();
     $related = array();
     $upsells = array();
     // load product details
     if ($item->getProductId()) {
         $product = Mage::getModel('catalog/product')->load($item->getProductId());
         // deleted
         if (!$product->getId()) {
             $product = null;
         }
         if ($product) {
             $relatedCollection = $product->getRelatedProductCollection()->addAttributeToSelect('name')->addAttributeToSelect('sku')->addAttributeToSelect('url_path')->addAttributeToSelect('image')->addAttributeToSelect('visibility')->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)->setPageSize($maxLimit);
             foreach ($relatedCollection as $p) {
                 $websiteIds = $p->getWebsiteIds();
                 if (in_array($websiteId, $websiteIds)) {
                     $related[$p->getId()] = $this->convertAttributeData($p);
                 }
             }
             $upsellCollection = $product->getUpSellProductCollection()->addAttributeToSelect('name')->addAttributeToSelect('sku')->addAttributeToSelect('url_path')->addAttributeToSelect('image')->addAttributeToSelect('visibility')->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)->setPageSize($maxLimit);
             foreach ($upsellCollection as $p) {
                 $websiteIds = $p->getWebsiteIds();
                 if (in_array($websiteId, $websiteIds)) {
                     $upsells[$p->getId()] = $this->convertAttributeData($p);
                 }
             }
             $categoryCollection = $product->getCategoryCollection()->addAttributeToSelect('name')->addAttributeToSelect('is_active')->addAttributeToSelect('url_path')->addAttributeToFilter('level', array('gt' => 1))->setPageSize($maxLimit);
             foreach ($categoryCollection as $category) {
                 $storeIds = $category->getStoreIds();
                 if (in_array($storeId, $storeIds)) {
                     $categories[$category->getId()] = $this->convertAttributeData($category);
                 }
             }
             $product->setRelatedProducts($related);
             $product->setUpSellProducts($upsells);
         }
         $item->setData('product', $product);
         $item->setCategories($categories);
     }
 }
开发者ID:shopgo-magento1,项目名称:Magento-HubspotIntegration,代码行数:50,代码来源:Data.php

示例10: initFromOrderItem

 /**
  * Initialize creation data from existing order Item
  *
  * @param Mage_Sales_Model_Order_Item $orderItem
  * @param int $qty
  * @return Mage_Sales_Model_Quote_Item | string
  */
 public function initFromOrderItem(Mage_Sales_Model_Order_Item $orderItem, $qty = null)
 {
     if (!$orderItem->getId()) {
         return $this;
     }
     $product = Mage::getModel('catalog/product')->setStoreId($this->getSession()->getStoreId())->load($orderItem->getProductId());
     if ($product->getId()) {
         $product->setSkipCheckRequiredOption(true);
         $buyRequest = $orderItem->getBuyRequest();
         if (is_numeric($qty)) {
             $buyRequest->setQty($qty);
         }
         $item = $this->getQuote()->addProduct($product, $buyRequest);
         if (is_string($item)) {
             return $item;
         }
         if ($additionalOptions = $orderItem->getProductOptionByCode('additional_options')) {
             $item->addOption(new Varien_Object(array('product' => $item->getProduct(), 'code' => 'additional_options', 'value' => serialize($additionalOptions))));
         }
         Mage::dispatchEvent('sales_convert_order_item_to_quote_item', array('order_item' => $orderItem, 'quote_item' => $item));
         return $item;
     }
     return $this;
 }
开发者ID:beejhuff,项目名称:magento-1.13.0.2,代码行数:31,代码来源:Create.php

示例11: sync

 /**
  * Sync the given order item to Klevu. Returns true on successful sync and
  * the error message otherwise.
  *
  * @param Mage_Sales_Model_Order_Item $item
  *
  * @return bool|string
  */
 protected function sync($item)
 {
     if (!$this->getApiKey($item->getStoreId())) {
         return "Klevu Search is not configured for this store.";
     }
     $parent = null;
     if ($item->getParentItemId()) {
         $parent = Mage::getModel("sales/order_item")->load($item->getParentItemId());
     }
     $response = Mage::getModel("klevu_search/api_action_producttracking")->execute(array("klevu_apiKey" => $this->getApiKey($item->getStoreId()), "klevu_type" => "checkout", "klevu_productId" => Mage::helper("klevu_search")->getKlevuProductId($item->getProductId(), $parent ? $parent->getProductId() : 0), "klevu_unit" => $item->getQtyOrdered() ? $item->getQtyOrdered() : ($parent ? $parent->getQtyOrdered() : null), "klevu_salePrice" => $item->getPriceInclTax() ? $item->getPriceInclTax() : ($parent ? $parent->getPriceInclTax() : null), "klevu_currency" => $this->getStoreCurrency($item->getStoreId()), "klevu_shopperIP" => $this->getOrderIP($item->getOrderId())));
     if ($response->isSuccessful()) {
         return true;
     } else {
         return $response->getMessage();
     }
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:24,代码来源:Sync.php

示例12: _getIdToUse

 /**
  * Get the product ID to use based on Item visibility
  *
  * @param Mage_Sales_Model_Order_Item $item
  * @param Mage_Catalog_Model_Product  $itemProduct
  * @param boolean                     $checkVisible
  *
  * @return int
  */
 protected function _getIdToUse(Mage_Sales_Model_Order_Item $item, Mage_Catalog_Model_Product $itemProduct, $checkVisible = true)
 {
     if ($checkVisible && in_array($itemProduct->getVisibility(), array('2', '4'))) {
         return $item->getProductId();
     } else {
         $superProductConfig = $this->_getSuperProductConfig($item);
         if ($superProductConfig && array_key_exists('product_id', $superProductConfig)) {
             return $superProductConfig['product_id'];
         } elseif (method_exists($item, 'getParentItemId')) {
             return $item->getParentItemId();
         } else {
             return $item->getProductId();
         }
     }
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:24,代码来源:Data.php

示例13: itemToQuoteItem

 /**
  * Retrieve
  *
  * @param Mage_Sales_Model_Order_Item $item
  * @return unknown
  */
 public function itemToQuoteItem(Mage_Sales_Model_Order_Item $item)
 {
     $quoteItem = Mage::getModel('sales/quote_item')->setStoreId($item->getStoreId())->setQuoteItemId($item->getId())->setProductId($item->getProductId())->setSuperProductId($item->getSuperProductId())->setParentProductId($item->getParentProductId())->setSku($item->getSku())->setName($item->getName())->setDescription($item->getDescription())->setWeight($item->getWeight())->setCustomPrice($item->getPrice())->setDiscountPercent($item->getDiscountPercent())->setDiscountAmount($item->getDiscountAmount())->setTaxPercent($item->getTaxPercent())->setTaxAmount($item->getTaxAmount())->setRowWeight($item->getRowWeight())->setRowTotal($item->getRowTotal())->setAppliedRuleIds($item->getAppliedRuleIds())->setBaseDiscountAmount($item->getBaseDiscountAmount())->setBaseTaxAmount($item->getBaseTaxAmount())->setBaseRowTotal($item->getBaseRowTotal());
     return $quoteItem;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:11,代码来源:Order.php

示例14: _createSimpleOrderLineData

 /**
  * Returns SimpleOrderLineData record
  *
  * @param Mage_Sales_Model_Order_Item $item
  * @return array
  */
 protected function _createSimpleOrderLineData(Mage_Sales_Model_Order_Item $item)
 {
     /** @var $product Mage_Catalog_Model_Product */
     $product = Mage::getModel('catalog/product')->setStoreId($item->getStoreId())->load($item->getProductId());
     $data = array('orderLineId' => null, 'itemId' => (string) $item->getId(), 'orderNumber' => (string) $this->getOrderNumber(), 'quantity' => (double) $item->getQtyOrdered(), 'productSku' => (string) $item->getSku(), 'itemDescription' => (string) ($product->getShortDescription() ? $product->getShortDescription() : $product->getDescription()), 'unitPrice' => $this->_createOrderLinePrice($item, $item->getQtyOrdered()), 'totalTaxAmount' => $this->_createCurrencyAmount($item->getTaxAmount()), 'status' => $this->_createOrderItemStatus($item), 'price' => $this->_createCurrencyAmount($item->getBaseRowTotal()), 'allDiscounts' => null, 'dateCancelled' => null, 'dateDelivered' => null, 'dateShipped' => null, 'dateReturned' => null, 'dateInvoiced' => null, 'destination' => $this->_createShipTo($item->getOrder()->getShippingAddress()), 'shipmentId' => null, 'offerId' => null, 'offerUrl' => null);
     return $data;
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:13,代码来源:Order.php

示例15: getAssignedSerials

 /**
  * @param Mage_Sales_Model_Order_Item $orderItem
  * @return array
  */
 public function getAssignedSerials(Mage_Sales_Model_Order_Item $orderItem)
 {
     $gpSku = $this->getGpSkuFromProductId($orderItem->getProductId());
     $select = $this->getSelect()->reset(Zend_Db_Select::COLUMNS)->columns('serial')->where('enabled = ?', true)->where('order_item_id = ?', $orderItem->getId())->where('gp_sku = ?', $gpSku);
     $assignedSerials = array();
     foreach ($this->getConnection()->fetchAll($select) as $serial) {
         $assignedSerials[] = $serial['serial'];
     }
     return $assignedSerials;
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:14,代码来源:ICC_Ecodes_Model_Mysql4_Downloadable_Collection.php


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