/** * Get the quantity results for an item. * * @param Mage_Sales_Model_Quote_Item_Abstract * @return EbayEnterprise_Inventory_Model_Quantity|null */ protected function _getQuantityResultForItem(Mage_Sales_Model_Quote_Item_Abstract $item) { return $this->_quantityCollector->getQuantityResultsForQuote($item->getQuote())->getQuantityBySku($this->_inventoryHelper->getRomSku($item->getSku())); }
/** * Inject general item data into the order item payload. * * @return self */ protected function _injectItemData() { $this->_orderItem->setLineNumber($this->_item->getId())->setItemId($this->_item->getSku())->setQuantity((int) $this->_item->getQty())->setDescription($this->_item->getName())->setHtsCode($this->_taxHelper->getProductHtsCodeByCountry($this->_itemProduct, $this->_address->getCountryId()))->setManufacturingCountryCode($this->_itemProduct->getCountryOfManufacture()); return $this; }
/** * Calculate the total quantity requested of a given item. All items in the * quote with the same SKU as the given item will be counted toward the * total quantity. * * @param Mage_Sales_Model_Quote_Item_Abstract * @param Mage_Sales_Model_Quote_Item_Abstract[] * @return int */ public function calculateTotalQuantityRequested(Mage_Sales_Model_Quote_Item_Abstract $item, array $allItems) { $sku = $item->getSku(); $quantitiesBySku = $this->calculateTotalQuantitiesBySku($allItems); return isset($quantitiesBySku[$sku]) ? $quantitiesBySku[$sku] : 0; }
public function fillOutShippingItem(IOrderItem $itemPayload, Mage_Sales_Model_Quote_Item_Abstract $item, Mage_Customer_Model_Address_Abstract $address) { $shippingMethod = $this->shippingHelper->getUsableMethod($address); $itemPayload->setItemId($item->getSku())->setLineId($item->getAddressItemId() ?: $item->getId())->setQuantity($this->quantityHelper->getRequestedItemQuantity($item))->setGiftWrapRequested($this->isItemGiftWrapped($item))->setAddressLines($address->getStreet(static::ADDRESS_ALL_STREET_LINES))->setAddressCity($address->getCity())->setAddressCountryCode($address->getCountryId())->setShippingMethod($this->shippingHelper->getMethodSdkId($shippingMethod))->setAddressMainDivision($address->getRegionCode())->setAddressPostalCode($address->getPostcode())->setShippingMethodDisplayText($this->shippingHelper->getMethodTitle($shippingMethod)); }
/** * Transfer data from a quote item to a quantity * request item payload. * * @param Mage_Sales_Model_Quote_Item_Abstract * @param IQuantityItem * @return IQuantityItem */ public function itemToQuantityItem(Mage_Sales_Model_Quote_Item_Abstract $item, IQuantityItem $itemPayload) { return $itemPayload->setItemId($this->inventoryHelper->getRomSku($item->getSku()))->setLineId($item->getId()); }
/** * Convert quote item to order item * * @param Mage_Sales_Model_Quote_Item_Abstract $item * @return Mage_Sales_Model_Order_Item */ public function itemToOrderItem(Mage_Sales_Model_Quote_Item_Abstract $item) { $orderItem = Mage::getModel('sales/order_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())->setIsQtyDecimal($item->getIsQtyDecimal())->setQtyOrdered($item->getQty())->setOriginalPrice($item->getOriginalPrice())->setAppliedRuleIds($item->getAppliedRuleIds())->setAdditionalData($item->getAdditionalData())->setPrice($item->getCalculationPrice())->setTaxPercent($item->getTaxPercent())->setTaxAmount($item->getTaxAmount())->setRowWeight($item->getRowWeight())->setRowTotal($item->getRowTotal())->setBasePrice($item->getBaseCalculationPrice())->setBaseOriginalPrice($item->getPrice())->setBaseTaxAmount($item->getBaseTaxAmount())->setBaseRowTotal($item->getBaseRowTotal()); if (!$item->getNoDiscount()) { $orderItem->setDiscountPercent($item->getDiscountPercent())->setDiscountAmount($item->getDiscountAmount())->setBaseDiscountAmount($item->getBaseDiscountAmount()); } Mage::dispatchEvent('sales_convert_quote_item_to_order_item', array('order_item' => $orderItem, 'item' => $item)); return $orderItem; }
/** * Get the product the item represents. * * @param Mage_Sales_Model_Quote_Item_Abstract * @return Mage_Catalog_Model_Product */ protected function getItemProduct(Mage_Sales_Model_Quote_Item_Abstract $item) { // When dealing with configurable items, need to get tax data from // the child product and not the parent. if ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) { $sku = $item->getSku(); $children = $item->getChildren(); if ($children) { foreach ($children as $childItem) { $childProduct = $childItem->getProduct(); // If the SKU of the child product matches the SKU of the // item, the simple product being ordered was found and should // be used. if ($childProduct->getSku() === $sku) { return $childProduct; } } } } return $item->getProduct() ?: Mage::getModel('catalog/product')->load($item->getProductId()); }