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


PHP Mage_Sales_Model_Order_Item类代码示例

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


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

示例1: isItemAvailableForReorder

 /**
  * Check item product availability for reorder
  *
  * @param  Mage_Sales_Model_Order_Item $orderItem
  * @return boolean
  */
 public function isItemAvailableForReorder(Mage_Sales_Model_Order_Item $orderItem)
 {
     if ($orderItem->getProduct()) {
         return $orderItem->getProduct()->getStockItem()->getIsInStock();
     }
     return false;
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:13,代码来源:Sidebar.php

示例2: getItemHtml

 public function getItemHtml(Mage_Sales_Model_Order_Item $item)
 {
     $warehouseData = $this->getWarehouseFlatArray();
     $html = '';
     $children = $item->getChildrenItems();
     if (empty($children)) {
         $children = array($item);
     }
     /** @var Mage_Sales_Model_Order_Item $childItem  */
     foreach ($children as $childItem) {
         $serializedAdditionalData = $childItem->getAdditionalData();
         if (empty($serializedAdditionalData)) {
             continue;
         }
         $additionalData = unserialize($serializedAdditionalData);
         $tmpHtml = sprintf('<tr class="border"><td><strong>%s</strong><br/><strong>SKU:</strong> %s</td>', $childItem->getName(), $childItem->getSku());
         $tmpCount = 0;
         foreach ($warehouseData as $wid => $wdata) {
             $qty = 0;
             if (array_key_exists($wid, $additionalData)) {
                 $qty = $additionalData[$wid];
             }
             $tmpCount += $qty;
             $qty = $this->_formatQty($qty, $childItem->getIsQtyDecimal());
             $tmpHtml .= '<td class="a-center" style="vertical-align:middle;">' . $qty . '</td>';
         }
         if ($tmpCount) {
             $html .= $tmpHtml;
         }
         $html .= '</tr>';
     }
     return $html;
 }
开发者ID:technomagegithub,项目名称:colb2b,代码行数:33,代码来源:Order.php

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

示例4: init

 /**
  * Initialize block with order item
  * 
  * @param Mage_Sales_Model_Order_Item $item
  * @return SSE_EditCustomOptions_Block_Options
  */
 public function init(Mage_Sales_Model_Order_Item $item)
 {
     $this->_item = $item;
     $_product = $this->_item->getProduct();
     Mage::helper('catalog/product')->prepareProductOptions($_product, $this->_getBuyRequest());
     $this->addOptionRenderer('text', 'catalog/product_view_options_type_text', 'catalog/product/view/options/type/text.phtml')->addOptionRenderer('file', 'catalog/product_view_options_type_file', 'catalog/product/view/options/type/file.phtml')->addOptionRenderer('select', 'catalog/product_view_options_type_select', 'catalog/product/view/options/type/select.phtml')->addOptionRenderer('date', 'catalog/product_view_options_type_date', 'catalog/product/view/options/type/date.phtml')->setTemplate('catalog/product/view/options.phtml')->setProduct($_product);
     return $this;
 }
开发者ID:helirexi,项目名称:EditCustomOptions,代码行数:14,代码来源:Options.php

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

示例6: getItemAllocationInformation

 /**
  * get allocation information for an item
  *
  * @param  Mage_Sales_Model_Order_Item
  * @return EbayEnterprise_Inventory_Model_Allocation|null
  */
 public function getItemAllocationInformation(Mage_Sales_Model_Order_Item $item)
 {
     $result = $this->getInventorySession()->getAllocationResult();
     if ($result) {
         return $result->lookupAllocationByItemId($item->getQuoteItemId());
     }
     $this->logger->debug('Unable to get allocation information for item {sku} id {item_id}', $this->logContext->getMetaData(__CLASS__, ['sku' => $item->getSku(), 'item_id' => $item->getQuoteItemId()]));
     return null;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:15,代码来源:Service.php

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

示例8: _loadDefaultAddressForItem

 /**
  * Get a default address for an item if one exists. For virtual items,
  * the default address will be the billing address of the order the item
  * belongs to. For non-virtual items, the default address will be the
  * primary shipping address of the order the item belongs to. If the
  * appropriate default address for the item does not exits, no address
  * will be returned.
  *
  * @param Mage_Sales_Model_Order_Item
  * @return Mage_Sales_Model_Order_Address|null
  */
 protected function _loadDefaultAddressForItem(Mage_Sales_Model_Order_Item $item)
 {
     $order = $item->getOrder();
     if (!$order) {
         return null;
     }
     $defaultAddress = $item->getIsVirtual() ? $order->getBillingAddress() : $order->getShippingAddress();
     // If the appropriate default address did not exist in the order, false
     // will have been returned. In such cases, return null to indicate that
     // no such address exists.
     return $defaultAddress ?: null;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:23,代码来源:Factory.php

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

示例10: _getItemOptions

 /**
  * Return custom options from item
  * 
  * @see Mage_Sales_Block_Order_Item_Renderer_Default::getItemOptions()
  * @return array
  */
 protected function _getItemOptions(Mage_Sales_Model_Order_Item $item)
 {
     $result = array();
     if ($options = $item->getProductOptions()) {
         if (isset($options['options'])) {
             $result = array_merge($result, $options['options']);
         }
         if (isset($options['additional_options'])) {
             $result = array_merge($result, $options['additional_options']);
         }
         if (isset($options['attributes_info'])) {
             $result = array_merge($result, $options['attributes_info']);
         }
     }
     return $result;
 }
开发者ID:helirexi,项目名称:EditCustomOptions,代码行数:22,代码来源:Buyrequest.php

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

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

示例13: 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;
         }
         /*********************************************Set custom price selected starts************************************************************/
         if (!$this->getSession()->getReordered() && $orderItem->getOriginalPrice() != $orderItem->getPrice()) {
             if ($orderItem->getProductType() == 'configurable' || $orderItem->getProductType() == 'bundle') {
                 $productId = $orderItem->getProductId();
                 $quoteItemId = $orderItem->getQuoteItemId();
                 $items = $this->getQuote()->getItemsCollection();
                 foreach ($items as $item) {
                     if ($item->getProduct()->getId() == $productId && !$item->getApplyPriceFlag()) {
                         if ($orderItem->getOriginalPrice() != $orderItem->getPrice()) {
                             $item->setCustomPrice($orderItem->getPrice())->setOriginalCustomPrice($orderItem->getPrice());
                         }
                         //$item->setApplyPriceFlag(true);
                     }
                 }
             } else {
                 $item->setCustomPrice($orderItem->getPrice())->setOriginalCustomPrice($orderItem->getPrice());
             }
         }
         /*********************************************Set custom price selected ends************************************************************/
         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:CE-Webmaster,项目名称:CE-Hub,代码行数:50,代码来源:Create.php

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

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


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