/** * Set current attribute to entry (for specified product) * * @param Mage_Catalog_Model_Product $product * @param Varien_Gdata_Gshopping_Entry $entry * @return Varien_Gdata_Gshopping_Entry */ public function convertAttribute($product, $entry) { $entry->cleanTaxes(); if (Mage::helper('tax')->getConfig()->priceIncludesTax()) { return $entry; } $calc = Mage::helper('tax')->getCalculator(); $customerTaxClass = $calc->getDefaultCustomerTaxClass($product->getStoreId()); $rates = $calc->getRatesByCustomerAndProductTaxClasses($customerTaxClass, $product->getTaxClassId()); $targetCountry = Mage::getSingleton('googleshopping/config')->getTargetCountry($product->getStoreId()); $ratesTotal = 0; foreach ($rates as $rate) { if ($targetCountry == $rate['country']) { $regions = $this->_parseRegions($rate['state'], $rate['postcode']); $ratesTotal += count($regions); if ($ratesTotal > self::RATES_MAX) { Mage::throwException(Mage::helper('googleshopping')->__("Google shopping only supports %d tax rates per product", self::RATES_MAX)); } foreach ($regions as $region) { $entry->addTax(array('tax_rate' => $rate['value'] * 100, 'tax_country' => empty($rate['country']) ? '*' : $rate['country'], 'tax_region' => $region)); } } } return $entry; }
private function getProductTaxRate() { /** @var $taxCalculator Mage_Tax_Model_Calculation */ $taxCalculator = Mage::getSingleton('tax/calculation'); $request = $taxCalculator->getRateRequest($this->quoteBuilder->getQuote()->getShippingAddress(), $this->quoteBuilder->getQuote()->getBillingAddress(), $this->quoteBuilder->getQuote()->getCustomerTaxClassId(), $this->quoteBuilder->getQuote()->getStore()); $request->setProductClassId($this->product->getTaxClassId()); return $taxCalculator->getRate($request); }
/** * Import item data from product model object * * @param Mage_Catalog_Model_Product $product * @return Mage_Sales_Model_Quote_Item */ public function importCatalogProduct(Mage_Catalog_Model_Product $product) { $this->setProductId($product->getId())->setSku($product->getSku())->setName($product->getName())->setWeight($product->getWeight())->setTaxClassId($product->getTaxClassId())->setCost($product->getCost())->setIsQtyDecimal($product->getIsQtyDecimal()); if ($product->getSuperProduct()) { $this->setSuperProductId($product->getSuperProduct()->getId()); if ($product->getSuperProduct()->isConfigurable()) { $this->setName($product->getSuperProduct()->getName()); } } $this->setProduct($product); return $this; }
/** * Retrieve current tax percent for customer based on subscription and product * * @param Adyen_Subscription_Model_Subscription $subscription * @param Mage_Catalog_Model_Product $product * @return int */ public function getCustomerTaxPercent(Adyen_Subscription_Model_Subscription $subscription, Mage_Catalog_Model_Product $product) { $percent = $product->getTaxPercent(); $includingPercent = null; $taxClassId = $product->getTaxClassId(); if (is_null($percent)) { if ($taxClassId) { $request = Mage::getSingleton('tax/calculation')->getRateRequest($subscription->getShippingAddress(), $subscription->getBillingAddress(), $subscription->getCustomer()->getTaxClassId(), $product->getStore()); $percent = Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxClassId)); } } return $percent ?: 0; }
/** * Set current attribute to entry (for specified product) * * @param Mage_Catalog_Model_Product $product * @param Varien_Gdata_Gshopping_Entry $entry * @return Varien_Gdata_Gshopping_Entry */ public function convertAttribute($product, $entry) { $entry->cleanTaxes(); if (Mage::helper('Mage_Tax_Helper_Data')->getConfig()->priceIncludesTax()) { return $entry; } $calc = Mage::helper('Mage_Tax_Helper_Data')->getCalculator(); $customerTaxClass = $calc->getDefaultCustomerTaxClass($product->getStoreId()); $rates = $calc->getRatesByCustomerAndProductTaxClasses($customerTaxClass, $product->getTaxClassId()); $targetCountry = Mage::getSingleton('Mage_GoogleShopping_Model_Config')->getTargetCountry($product->getStoreId()); foreach ($rates as $rate) { if ($targetCountry == $rate['country']) { $entry->addTax(array('tax_rate' => $rate['value'] * 100, 'tax_country' => empty($rate['country']) ? '*' : $rate['country'], 'tax_region' => empty($rate['state']) ? '*' : $rate['state'])); } } return $entry; }
/** * Get the tax info, if this product has a tax class * This will load a default tax rate (default address, default customer type) * * @param Mage_Catalog_Model_Product $product * @return boolean|array */ public function getProductTax(Mage_Catalog_Model_Product $product) { $taxId = $product->getTaxClassId(); if (null === $taxId) { return false; } $store = $this->_getStore(); $taxCalculation = Mage::getModel('tax/calculation'); $taxRequest = $taxCalculation->getRateRequest(null, null, null, $store); //for default address and customer class $taxRate = $taxCalculation->getRate($taxRequest->setProductClassId($taxId)); //get calculated default rate //get detailed tax info $taxRateInfo = $taxCalculation->getResource()->getRateInfo($taxRequest); $taxLabel = isset($taxRateInfo['process'][0]['id']) ? $taxRateInfo['process'][0]['id'] : ''; $isTaxIncluded = Mage::helper('tax')->priceIncludesTax($store); $taxInfo = array('rate' => $taxRate, 'label' => $taxLabel, 'taxIncluded' => $isTaxIncluded, 'showLabel' => true); return $taxInfo; }
/** * set tax class */ public function setTaxClass() { if ($this->item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE && $this->item->getPriceType() == Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC) { $childIds = $this->item->getTypeInstance()->getChildrenIds($this->item->getId()); $taxRates = array(); foreach ($childIds as $childOption) { foreach ($childOption as $childId) { $product = Mage::getModel('catalog/product')->setStoreId($this->_getConfig()->getStoreViewId())->load($childId); $taxClassId = $product->getTaxClassId(); $taxRates[$taxClassId] = $this->_getTaxRate($product); } } parent::setTaxClass(array_search(max($taxRates), $taxRates)); } else { if (!($this->item->getTaxClassId() == Shopgate_Framework_Model_Export_Product_Xml::DEFAULT_TAX_CLASS_ID_NONE && $this->_parent)) { $taxClassId = $this->item->getTaxClassId(); if (!empty($taxClassId)) { parent::setTaxClass($taxClassId); } } } }
/** * Get product price with all tax settings processing * * @param Mage_Catalog_Model_Product $product * @param float $price inputed product price * @param bool $includingTax return price include tax flag * @param null|Mage_Customer_Model_Address $shippingAddress * @param null|Mage_Customer_Model_Address $billingAddress * @param null|int $ctc customer tax class * @param mixed $store * @param bool $priceIncludesTax flag what price parameter contain tax * @return float */ public function getPrice($product, $price, $includingTax = null, $shippingAddress = null, $billingAddress = null, $ctc = null, $store = null, $priceIncludesTax = null) { if (!$price) { return $price; } $store = Mage::app()->getStore($store); if (!$this->needPriceConversion($store)) { return $store->roundPrice($price); } if (is_null($priceIncludesTax)) { $priceIncludesTax = $this->priceIncludesTax($store); } $percent = $product->getTaxPercent(); $includingPercent = null; $taxClassId = $product->getTaxClassId(); if (is_null($percent)) { if ($taxClassId) { $request = Mage::getSingleton('tax/calculation')->getRateRequest($shippingAddress, $billingAddress, $ctc, $store); $percent = Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxClassId)); } } if ($taxClassId && $priceIncludesTax) { $request = Mage::getSingleton('tax/calculation')->getRateRequest(false, false, false, $store); $includingPercent = Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxClassId)); } if ($percent === false || is_null($percent)) { if ($priceIncludesTax && !$includingPercent) { return $price; } } $product->setTaxPercent($percent); if (!is_null($includingTax)) { if ($priceIncludesTax) { if ($includingTax) { /** * Recalculate price include tax in case of different rates */ if ($includingPercent != $percent) { $price = $this->_calculatePrice($price, $includingPercent, false); /** * Using regular rounding. Ex: * price incl tax = 52.76 * store tax rate = 19.6% * customer tax rate= 19% * * price excl tax = 52.76 / 1.196 = 44.11371237 ~ 44.11 * tax = 44.11371237 * 0.19 = 8.381605351 ~ 8.38 * price incl tax = 52.49531773 ~ 52.50 != 52.49 * * that why we need round prices excluding tax before applying tax * this calculation is used for showing prices on catalog pages */ if ($percent != 0) { $price = $this->getCalculator()->round($price); $price = $this->_calculatePrice($price, $percent, true); } } } else { $price = $this->_calculatePrice($price, $includingPercent, false); } } else { if ($includingTax) { $price = $this->_calculatePrice($price, $percent, true); } } } else { if ($priceIncludesTax) { switch ($this->getPriceDisplayType($store)) { case Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX: case Mage_Tax_Model_Config::DISPLAY_TYPE_BOTH: $price = $this->_calculatePrice($price, $includingPercent, false); break; case Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX: $price = $this->_calculatePrice($price, $includingPercent, false); $price = $this->_calculatePrice($price, $percent, true); break; } } else { switch ($this->getPriceDisplayType($store)) { case Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX: $price = $this->_calculatePrice($price, $percent, true); break; case Mage_Tax_Model_Config::DISPLAY_TYPE_BOTH: case Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX: break; } } } return $store->roundPrice($price); }
/** * Gets tax percents for current product * * @param Mage_Catalog_Model_Product $product * @return string */ protected function _loadTaxCalculationRate(Mage_Catalog_Model_Product $product) { $taxPercent = $product->getTaxPercent(); if (is_null($taxPercent)) { $taxClassId = $product->getTaxClassId(); if ($taxClassId) { $request = Mage::getSingleton('tax/calculation')->getRateRequest(null, null, null, null); $taxPercent = Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxClassId)); } } if ($taxPercent) { return $taxPercent; } return 0; }
/** * Get product price with all tax settings processing * * @param Mage_Catalog_Model_Product $product * @param float $price inputed product price * @param bool $includingTax return price include tax flag * @param null|Mage_Customer_Model_Address $shippingAddress * @param null|Mage_Customer_Model_Address $billingAddress * @param null|int $ctc customer tax class * @param mixed $store * @param bool $priceIncludesTax flag what price parameter contain tax * @return float */ public function getPrice($product, $price, $includingTax = null, $shippingAddress = null, $billingAddress = null, $ctc = null, $store = null, $priceIncludesTax = null) { $store = AO::app()->getStore($store); if (!$this->needPriceConversion($store)) { return $store->roundPrice($price); } if (is_null($priceIncludesTax)) { $priceIncludesTax = $this->priceIncludesTax($store); } $percent = $product->getTaxPercent(); $includingPercent = null; $taxClassId = $product->getTaxClassId(); if (is_null($percent)) { if ($taxClassId) { $request = AO::getSingleton('tax/calculation')->getRateRequest($shippingAddress, $billingAddress, $ctc, $store); $percent = AO::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxClassId)); } } if ($taxClassId && $priceIncludesTax) { $request = AO::getSingleton('tax/calculation')->getRateRequest(false, false, false, $store); $includingPercent = AO::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxClassId)); } if ($percent === false || is_null($percent)) { if ($priceIncludesTax && !$includingPercent) { return $price; } } $product->setTaxPercent($percent); if (!is_null($includingTax)) { if ($priceIncludesTax) { if ($includingTax) { $price = $this->_calculatePrice($price, $includingPercent, false); $price = $this->_calculatePrice($price, $percent, true); } else { $price = $this->_calculatePrice($price, $includingPercent, false); } } else { if ($includingTax) { $price = $this->_calculatePrice($price, $percent, true); } } } else { if ($priceIncludesTax) { switch ($this->getPriceDisplayType($store)) { case Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX: case Mage_Tax_Model_Config::DISPLAY_TYPE_BOTH: $price = $this->_calculatePrice($price, $includingPercent, false); break; case Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX: $price = $this->_calculatePrice($price, $includingPercent, false); $price = $this->_calculatePrice($price, $percent, true); break; } } else { switch ($this->getPriceDisplayType($store)) { case Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX: $price = $this->_calculatePrice($price, $percent, true); break; case Mage_Tax_Model_Config::DISPLAY_TYPE_BOTH: case Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX: break; } } } return $store->roundPrice($price); }
protected function _initProductTaxClassId(Mage_Catalog_Model_Product $product) { if (!is_null($this->_productTaxClassId)) { $product->setTaxClassId($this->_productTaxClassId); return; } if ($this->_taxPercent > 0) { // Getting tax percent for magento product // ------------------------- $requestTax = new Varien_Object(); $requestTax->setCountryId($this->_quote->getShippingAddress()->getCountryId())->setRegionId($this->_quote->getShippingAddress()->getRegionId())->setPostcode($this->_quote->getShippingAddress()->getPostcode())->setStore($this->_quote->getStore())->setCustomerClassId($this->_quote->getCustomerTaxClassId())->setProductClassId($product->getTaxClassId()); $productTaxPercent = Mage::getSingleton('tax/calculation')->getRate($requestTax); // ------------------------- // If magento product tax class has other tax percent // set temp tax class with ebay order tax percent // ------------------------- if ($this->_taxPercent != (double) $productTaxPercent) { $product->setTaxClassId($this->_getProductTaxClassId()); } else { $this->_productTaxClassId = $product->getTaxClassId(); } // ------------------------- } else { // If order has no tax - disable magento product tax class // ------------------------- $product->setTaxClassId(0); // ------------------------- } }
/** * @param int $taxCodeId * * @return string|null */ public function getProductTaxCode(Mage_Catalog_Model_Product $product) { return $this->getTaxCode($product->getTaxClassId()); }
/** * export tax class - for USA export only * * @param Mage_Catalog_Model_Product $product */ protected function _setTaxClass($product) { /* @var $taxClass Mage_Tax_Model_Class */ $taxClass = Mage::getModel("tax/class")->load($product->getTaxClassId()); if (!$taxClass->isEmpty()) { $this->_defaultRow['tax_class'] = "{$taxClass->getId()}=>{$taxClass->getClassName()}"; } }
protected function getTaxRequest(Mage_Catalog_Model_Product $product) { $request = $this->getTaxCalculator()->getRateRequest($this->_magentoQuote->getShippingAddress(), $this->_magentoQuote->getBillingAddress(), $this->_magentoQuote->getCustomerTaxClassId(), $this->_magentoQuote->getStore()); $request->setProductClassId($product->getTaxClassId()); return $request; }
/** * Get product price with all tax settings processing * * @param Mage_Catalog_Model_Product $product * @param float $price inputed product price * @param bool $includingTax return price include tax flag * @param null|Mage_Customer_Model_Address $shippingAddress * @param null|Mage_Customer_Model_Address $billingAddress * @param null|int $ctc customer tax class * @param null|Mage_Core_Model_Store $store * @param bool $priceIncludesTax flag what price parameter contain tax * @return float */ public function getPrice($product, $price, $includingTax = null, $shippingAddress = null, $billingAddress = null, $ctc = null, $store = null, $priceIncludesTax = null, $roundPrice = true) { if (!$price) { return $price; } $store = $this->_app->getStore($store); if (!$this->needPriceConversion($store)) { return $store->roundPrice($price); } if (is_null($priceIncludesTax)) { $priceIncludesTax = $this->priceIncludesTax($store); } $percent = $product->getTaxPercent(); $includingPercent = null; $taxClassId = $product->getTaxClassId(); if (is_null($percent)) { if ($taxClassId) { $request = Mage::getSingleton('tax/calculation')->getRateRequest($shippingAddress, $billingAddress, $ctc, $store); $percent = Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxClassId)); } } if ($taxClassId && $priceIncludesTax) { if ($this->isCrossBorderTradeEnabled($store)) { $includingPercent = $percent; } else { $request = Mage::getSingleton('tax/calculation')->getRateOriginRequest($store); $includingPercent = Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxClassId)); } } if ($percent === false || is_null($percent)) { if ($priceIncludesTax && !$includingPercent) { return $price; } } $product->setTaxPercent($percent); if ($product->getAppliedRates() == null) { $request = Mage::getSingleton('tax/calculation')->getRateRequest($shippingAddress, $billingAddress, $ctc, $store); $request->setProductClassId($taxClassId); $appliedRates = Mage::getSingleton('tax/calculation')->getAppliedRates($request); $product->setAppliedRates($appliedRates); } if (!is_null($includingTax)) { if ($priceIncludesTax) { if ($includingTax) { /** * Recalculate price include tax in case of different rates. Otherwise price remains the same. */ if ($includingPercent != $percent) { // determine the customer's price that includes tax $price = $this->_calculatePriceInclTax($price, $includingPercent, $percent, $store); } } else { $price = $this->_calculatePrice($price, $includingPercent, false); } } else { if ($includingTax) { $appliedRates = $product->getAppliedRates(); if (count($appliedRates) > 1) { $price = $this->_calculatePriceInclTaxWithMultipleRates($price, $appliedRates); } else { $price = $this->_calculatePrice($price, $percent, true); } } } } else { if ($priceIncludesTax) { switch ($this->getPriceDisplayType($store)) { case Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX: case Mage_Tax_Model_Config::DISPLAY_TYPE_BOTH: if ($includingPercent != $percent) { // determine the customer's price that includes tax $taxablePrice = $this->_calculatePriceInclTax($price, $includingPercent, $percent, $store); // determine the customer's tax amount, // round tax unless $roundPrice is set explicitly to false $tax = $this->getCalculator()->calcTaxAmount($taxablePrice, $percent, true, $roundPrice); // determine the customer's price without taxes $price = $taxablePrice - $tax; } else { //round tax first unless $roundPrice is set to false explicitly $price = $this->_calculatePrice($price, $includingPercent, false, $roundPrice); } break; case Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX: $price = $this->_calculatePrice($price, $includingPercent, false); $price = $this->_calculatePrice($price, $percent, true); break; } } else { switch ($this->getPriceDisplayType($store)) { case Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX: $appliedRates = $product->getAppliedRates(); if (count($appliedRates) > 1) { $price = $this->_calculatePriceInclTaxWithMultipleRates($price, $appliedRates); } else { $price = $this->_calculatePrice($price, $percent, true); } break; case Mage_Tax_Model_Config::DISPLAY_TYPE_BOTH: case Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX: break; } } } if ($roundPrice) { return $store->roundPrice($price); } else { return $price; } }
/** * Get Avatax tax code for given product * * @param Mage_Catalog_Model_Product $product * @return string */ protected function _getTaxClassCodeByProduct($product) { $taxClass = $this->_getTaxClassCollection()->getItemById($product->getTaxClassId()); return $taxClass ? $taxClass->getOpAvataxCode() : ''; }
/** * Gets tax percents for current product * * @param Mage_Catalog_Model_Product $product Product Model * @return string Tax Rate */ protected function _loadTaxCalculationRate(Mage_Catalog_Model_Product $product) { $taxPercent = $product->getTaxPercent(); if (is_null($taxPercent)) { $taxClassId = $product->getTaxClassId(); if ($taxClassId) { $store = Mage::app()->getStore(); $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId(); $group = Mage::getModel('customer/group')->load($groupId); $customerTaxClassId = $group->getData('tax_class_id'); /* @var $calculation Mage_Tax_Model_Calculation */ $calculation = Mage::getSingleton('tax/calculation'); $request = $calculation->getRateRequest(null, null, $customerTaxClassId, $store); $taxPercent = $calculation->getRate($request->setProductClassId($taxClassId)); } } if ($taxPercent) { return $taxPercent; } return 0; }
/** * Get Weee amounts associated with a product * * @param Mage_Catalog_Model_Product $product * @param Mage_Customer_Model_Address_Abstract $shipping * @param Mage_Customer_Model_Address_Abstract $billing * @param mixed $website * @param boolean $calculateTax * @param boolean $ignoreDiscount * @return array|\Varien_Object */ public function getProductWeeeAttributes($product, $shipping = null, $billing = null, $website = null, $calculateTax = null, $ignoreDiscount = false) { $result = array(); $allWeee = $this->getWeeeTaxAttributeCodes(); if (!$allWeee) { return $result; } $websiteId = Mage::app()->getWebsite($website)->getId(); $store = Mage::app()->getWebsite($website)->getDefaultGroup()->getDefaultStore(); $customer = null; if ($shipping) { $customerTaxClass = $shipping->getQuote()->getCustomerTaxClassId(); $customer = $shipping->getQuote()->getCustomer(); } else { $customerTaxClass = null; } $calculator = Mage::getModel('tax/calculation'); if ($customer) { $calculator->setCustomer($customer); } $rateRequest = $calculator->getRateRequest($shipping, $billing, $customerTaxClass, $store); $currentPercent = $product->getTaxPercent(); if (!$currentPercent) { $currentPercent = Mage::getSingleton('tax/calculation')->getRate($rateRequest->setProductClassId($product->getTaxClassId())); } $discountPercent = 0; if (!$ignoreDiscount && Mage::helper('weee')->isDiscounted($store)) { $discountPercent = $this->_getDiscountPercentForProduct($product); } $productAttributes = $product->getTypeInstance(true)->getSetAttributes($product); foreach ($productAttributes as $code => $attribute) { if (in_array($code, $allWeee)) { $attributeSelect = $this->getResource()->getReadConnection()->select(); $attributeSelect->from($this->getResource()->getTable('weee/tax'), 'value')->where('attribute_id = ?', (int) $attribute->getId())->where('website_id IN(?)', array($websiteId, 0))->where('country = ?', $rateRequest->getCountryId())->where('state IN(?)', array($rateRequest->getRegionId(), '*'))->where('entity_id = ?', (int) $product->getId())->limit(1); $order = array('state ' . Varien_Db_Select::SQL_DESC, 'website_id ' . Varien_Db_Select::SQL_DESC); $attributeSelect->order($order); $value = $this->getResource()->getReadConnection()->fetchOne($attributeSelect); if ($value) { if ($discountPercent) { $value = Mage::app()->getStore()->roundPrice($value - $value * $discountPercent / 100); } $taxAmount = 0; $amount = $value; if ($calculateTax && Mage::helper('weee')->isTaxable($store)) { if ($this->_taxHelper->isCrossBorderTradeEnabled($store)) { $defaultPercent = $currentPercent; } else { $defaultRateRequest = $calculator->getDefaultRateRequest($store); $defaultPercent = Mage::getModel('tax/calculation')->getRate($defaultRateRequest->setProductClassId($product->getTaxClassId())); } if (Mage::helper('weee')->isTaxIncluded($store)) { $taxAmount = Mage::app()->getStore()->roundPrice($value / (100 + $defaultPercent) * $currentPercent); $amount = $amount - $taxAmount; } else { $appliedRates = Mage::getModel('tax/calculation')->getAppliedRates($rateRequest); if (count($appliedRates) > 1) { $taxAmount = 0; foreach ($appliedRates as $appliedRate) { $taxRate = $appliedRate['percent']; $taxAmount += Mage::app()->getStore()->roundPrice($value * $taxRate / 100); } } else { $taxAmount = Mage::app()->getStore()->roundPrice($value * $currentPercent / 100); } } } $one = new Varien_Object(); $one->setName(Mage::helper('catalog')->__($attribute->getFrontend()->getLabel()))->setAmount($amount)->setTaxAmount($taxAmount)->setCode($attribute->getAttributeCode()); $result[] = $one; } } } return $result; }
/** * Get Avatax class for given product * * @param Mage_Catalog_Model_Product $product * @return string */ protected function _getTaxClassByProduct($product) { $taxClass = ''; if ($product->getTaxClassId()) { $taxClass = $this->_getTaxClassCollection()->getItemById($product->getTaxClassId())->getOpAvataxCode(); } return $taxClass; }