本文整理汇总了PHP中Mage_Sales_Model_Quote_Item::getParentItemId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Item::getParentItemId方法的具体用法?PHP Mage_Sales_Model_Quote_Item::getParentItemId怎么用?PHP Mage_Sales_Model_Quote_Item::getParentItemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Item
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Item::getParentItemId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isItemInventoried
/**
* Test if the item needs to have its quantity checked for available
* inventory.
* @param Mage_Sales_Model_Quote_Item $item The item to check
* @return bool True if inventory is managed, false if not
*/
public function isItemInventoried(Mage_Sales_Model_Quote_Item $item)
{
// never consider a child product as inventoried, allow the parent deal
// with inventory and let the child not need to worry about it as the parent
// will be the item to keep track of qty being ordered.
// Both checks needed as child items will not have a parent item id prior
// to being saved and a parent item prior to being added to the parent (e.g.
// immediately after being loaded from the DB).
if ($item->getParentItemId() || $item->getParentItem()) {
return false;
}
// when dealing with parent items, if any child of the product is managed
// stock, consider the entire item as managed stock - allows for the parent
// config product in the quote to deal with inventory while allowing child
// products to not care individually
if ($item->getHasChildren()) {
foreach ($item->getChildren() as $childItem) {
$childStock = $childItem->getProduct()->getStockItem();
if ($this->isManagedStock($childStock)) {
// This Parent is inventoried. Child's ROM setting is 'No backorders', and Manage Stock check hasn't been manually overridden
return true;
}
}
// if none of the children were managed stock, the parent is not inventoried
return false;
}
return $this->isManagedStock($item->getProduct()->getStockItem());
}
示例2: getItemGiftTax
/**
* Get item tax
*
* @param Mage_Sales_Model_Quote_Item $item
* @return int
*/
public function getItemGiftTax($item)
{
if ($item->getParentItemId()) {
return 0;
}
$ratesData = $this->_getRates();
$id = $item->getId();
return isset($ratesData['gw_items'][$id]['amt']) ? $ratesData['gw_items'][$id]['amt'] : 0;
}
示例3: getItemGiftTax
/**
* Get item tax
*
* @param Mage_Sales_Model_Quote_Item $item
* @return int
*/
public function getItemGiftTax($item)
{
if ($item->getParentItemId()) {
return 0;
}
$key = $this->_getRates($item);
$id = $item->getSku();
return isset($this->_rates[$key]['gw_items'][$id]['amt']) ? $this->_rates[$key]['gw_items'][$id]['amt'] : 0;
}
示例4: prepareQuoteItemData
/**
* @param Mage_Sales_Model_Quote_Item|null $quoteItem
* @param $operation
* @param array $_defaults
* @return array
*/
public function prepareQuoteItemData(Mage_Sales_Model_Quote_Item $quoteItem = null, $operation, $_defaults = array())
{
$_data = array();
$eventParams = array("opportunity_data" => &$_data);
switch ($operation) {
case self::CREATE_OPPORTUNITY:
$_data = array(self::IS_CLOSED => false, self::STAGE => $this->_getHelper()->getHardcodedOpportunityFields("default_stage"));
$_paths = Mage::app()->getRequest()->getParam(HooshMarketing_Marketo_Model_Personalize_Category_Path::CATEGORY_PATH);
$_data[self::OPPORTUNITY_TYPE] = isset($_paths[$quoteItem->getProduct()->getId()]) ? $_paths[$quoteItem->getProduct()->getId()] : current($this->_getPersonalizeCategoryPathModel()->getPath($quoteItem->getProduct()));
break;
case self::UPDATE_OPPORTUNITY:
if ($quoteItem->getParentItemId()) {
$_data[$this->getOpportunityKey()] = $quoteItem->getParentItemId();
}
break;
}
$eventParams["product"] = $quoteItem->getProduct();
if (!$quoteItem->getParentItemId()) {
//ignore children quote items
$eventParams["quote_item"] = $quoteItem;
}
Mage::dispatchEvent("opportunity_dynamic_before_{$operation}", $eventParams);
if (!empty($_defaults)) {
$_data = $_defaults + $_data;
//merge defaults and data. Data have priority
}
if ($quoteItem->getParentItemId()) {
$_data[$this->getOpportunityKey()] = $quoteItem->getParentItemId();
}
return $_data;
}
示例5: addActiveItemParentProduct
/**
* Add active parent product from item.
*
* @param Mage_Sales_Model_Quote_Item $item
* @return $this
*/
public function addActiveItemParentProduct($item)
{
if ($item && $item->getId() && $item->getParentItemId()) {
if ($item->getParentItem()->getProduct()->getTypeId() == 'configurable') {
// for price calculations to become accurate we need to reload the product,
// otherwise things like tier pricing won't be loaded on it and the calculations
// will ne dup being incorrect.
$this->_activeItemParentProducts[$item->getProduct()->getId()] = Mage::getModel('catalog/product')->load($item->getParentItem()->getProductId());
}
}
return $this;
}