本文整理汇总了PHP中Mage_Sales_Model_Quote_Item_Abstract::getParentItemId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Item_Abstract::getParentItemId方法的具体用法?PHP Mage_Sales_Model_Quote_Item_Abstract::getParentItemId怎么用?PHP Mage_Sales_Model_Quote_Item_Abstract::getParentItemId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Item_Abstract
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Item_Abstract::getParentItemId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: itemToOrderItem
/**
* Convert quote item to order item. Most part of the code was taken from Mage_Sales_Model_Convert_Quote::itemToOrderItem()
*
* @param Mage_Sales_Model_Quote_Item_Abstract $item
* @param null|Mage_Sales_Model_Order_Item $orderItem
* @return Mage_Sales_Model_Order_Item
*/
public function itemToOrderItem(Mage_Sales_Model_Quote_Item_Abstract $item, $orderItem = null)
{
if (is_null($orderItem)) {
$orderItem = Mage::getModel('sales/order_item');
}
$orderItem->setStoreId($item->getStoreId())->setQuoteItemId($item->getId())->setQuoteParentItemId($item->getParentItemId())->setProductId($item->getProductId())->setProductType($item->getProductType())->setQtyBackordered($item->getBackorders())->setProduct($item->getProduct())->setBaseOriginalPrice($item->getBaseOriginalPrice());
$options = $item->getProductOrderOptions();
if (!$options) {
$options = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct());
}
$orderItem->setProductOptions($options);
Mage::helper('core')->copyFieldset('sales_convert_quote_item', 'to_order_item', $item, $orderItem);
if ($item->getParentItem()) {
$orderItem->setQtyOrdered($orderItem->getQtyOrdered() * $item->getParentItem()->getQty());
}
if (!$item->getNoDiscount()) {
Mage::helper('core')->copyFieldset('sales_convert_quote_item', 'to_order_item_discount', $item, $orderItem);
}
Mage::dispatchEvent('sales_convert_quote_item_to_order_item', array('order_item' => $orderItem, 'item' => $item));
return $orderItem;
}
示例2: addItem
/**
* Add item to address
*
* @param Mage_Sales_Model_Quote_Item_Abstract $item
* @param int $qty
* @return Mage_Sales_Model_Quote_Address
*/
public function addItem(Mage_Sales_Model_Quote_Item_Abstract $item, $qty = null)
{
if ($item instanceof Mage_Sales_Model_Quote_Item) {
if ($item->getParentItemId()) {
return $this;
}
$addressItem = Mage::getModel('Mage_Sales_Model_Quote_Address_Item')->setAddress($this)->importQuoteItem($item);
$this->getItemsCollection()->addItem($addressItem);
if ($item->getHasChildren()) {
foreach ($item->getChildren() as $child) {
$addressChildItem = Mage::getModel('Mage_Sales_Model_Quote_Address_Item')->setAddress($this)->importQuoteItem($child)->setParentItem($addressItem);
$this->getItemsCollection()->addItem($addressChildItem);
}
}
} else {
$addressItem = $item;
$addressItem->setAddress($this);
if (!$addressItem->getId()) {
$this->getItemsCollection()->addItem($addressItem);
}
}
if ($qty) {
$addressItem->setQty($qty);
}
return $this;
}
示例3: itemToOrderItem
/**
* 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 = AO::getModel('sales/order_item')->setStoreId($item->getStoreId())->setQuoteItemId($item->getId())->setQuoteParentItemId($item->getParentItemId())->setProductId($item->getProductId())->setProductType($item->getProductType())->setProductOptions($item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct()))->setQtyBackordered($item->getBackorders());
AO::helper('core')->copyFieldset('sales_convert_quote_item', 'to_order_item', $item, $orderItem);
if ($item->getParentItem()) {
$orderItem->setQtyOrdered($orderItem->getQtyOrdered() * $item->getParentItem()->getQty());
}
// ->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()) {
AO::helper('core')->copyFieldset('sales_convert_quote_item', 'to_order_item_discount', $item, $orderItem);
// $orderItem->setDiscountPercent($item->getDiscountPercent())
// ->setDiscountAmount($item->getDiscountAmount())
// ->setBaseDiscountAmount($item->getBaseDiscountAmount());
}
AO::dispatchEvent('sales_convert_quote_item_to_order_item', array('order_item' => $orderItem, 'item' => $item));
return $orderItem;
}