/** * Retrieve product for item code * * @param Mage_Sales_Model_Quote_Address_Item|Mage_Sales_Model_Quote_Item $item * @return null|Mage_Catalog_Model_Product * @throws OnePica_AvaTax_Exception */ protected function _getProductForItemCode($item) { $product = $this->_getProductByProductId($item->getProductId()); if (!$this->_getCalculationHelper()->isConfigurable($item)) { return $product; } $children = $item->getChildren(); if (isset($children[0]) && $children[0]->getProductId()) { $product = $this->_getProductByProductId($children[0]->getProductId()); } return $product; }
/** * Retrieve simple product id from quote item * * @param Mage_Sales_Model_Quote_Item|Mage_Sales_Model_Quote_Address_Item $item * * @return int */ protected function _retrieveProductIdFromQuoteItem($item) { $productId = $item->getProductId(); if ($item->getOptionByCode('simple_product')) { $productId = $item->getOptionByCode('simple_product')->getProduct()->getId(); } return $productId; }