本文整理汇总了PHP中Mage_Sales_Model_Quote_Item_Abstract::getParentItem方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Item_Abstract::getParentItem方法的具体用法?PHP Mage_Sales_Model_Quote_Item_Abstract::getParentItem怎么用?PHP Mage_Sales_Model_Quote_Item_Abstract::getParentItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Item_Abstract
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Item_Abstract::getParentItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getItemQty
/**
* Return discount item qty
*
* @param Mage_Sales_Model_Quote_Item_Abstract $item
* @param Mage_SalesRule_Model_Rule $rule
* @return int
*/
protected function _getItemQty($item, $rule)
{
//@nelkaake: Magento 1.3 and lower doesnt have the item->getTotalQty attribute.
if (Mage::helper('rewards/version')->isBaseMageVersionAtLeast('1.4')) {
$qty = $item->getTotalQty();
} else {
$qty = $item->getQty();
if ($item->getParentItem()) {
$qty *= $item->getParentItem()->getQty();
}
}
return $rule->getDiscountQty() ? min($qty, $rule->getDiscountQty()) : $qty;
}
示例2: getRequestedItemQuantity
/**
* Get the quantity requeted for a single item.
*
* @param Mage_Sales_Model_Quote_Item_Abstract
* @return int
*/
public function getRequestedItemQuantity(Mage_Sales_Model_Quote_Item_Abstract $item)
{
// Child item quantity is the static quantity of the child
// item within a single unit of the parent. E.g. a configurable
// product's child item's quantity, will always be 1 - one child in
// the configurable item. Bundle items, however, will be
// the number of the child items in a single unit of the
// parent bundle, depending on how the bundle was configured when
// added to cart - actual quantity of the child is child
// quantity * parent quantity.
$parentItem = $item->getParentItem();
return $item->getQty() * ($parentItem ? $parentItem->getQty() : 1);
}
示例3: isExcludedItem
/**
* returns true if the item is the child of configurable/grouped product
*
* @param Mage_Sales_Model_Quote_Item_Abstract
* @return bool
*/
public function isExcludedItem(Mage_Sales_Model_Quote_Item_Abstract $item)
{
return $item->getParentItem() instanceof Mage_Sales_Model_Quote_Item;
}
示例4: itemIsConfigurableChild
/**
* Check if the item is the child of a configurable product.
*
* @param Mage_Sales_Model_Quote_Item_Abstract
* @return bool
*/
protected function itemIsConfigurableChild(Mage_Sales_Model_Quote_Item_Abstract $item)
{
$parentItem = $item->getParentItem();
return $parentItem && $parentItem->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE;
}
示例5: _recalculateChildDiscount
/**
* Recalculate child discount. Separate discount between children
*
* @param Mage_Sales_Model_Quote_Item_Abstract $child
* @return Mage_SalesRule_Model_Quote_Discount
*/
protected function _recalculateChildDiscount($child)
{
$item = $child->getParentItem();
$prices = array('base' => $item->getBaseOriginalPrice(), 'current' => $item->getPrice());
$keys = array('discount_amount', 'original_discount_amount');
foreach ($keys as $key) {
$child->setData($key, $child->getData($key) * $child->getPrice() / $prices['current']);
$child->setData('base_' . $key, $child->getData('base_' . $key) * $child->getPrice() / $prices['base']);
}
return $this;
}