protected function _getFinalPrice($product, $price) { $discountedObj = new Varien_Object(array('price' => $price, 'discounted' => false)); Mage::dispatchEvent('affiliateplus_product_get_final_price', array('product' => $product, 'discounted_obj' => $discountedObj)); if ($discountedObj->getDiscounted()) { return $discountedObj->getPrice(); } $price = $discountedObj->getPrice(); $discountType = $this->_getConfigHelper()->getDiscountConfig('discount_type'); $discountValue = $this->_getConfigHelper()->getDiscountConfig('discount'); if (Mage::helper('affiliateplus/cookie')->getNumberOrdered()) { if ($this->_getConfigHelper()->getDiscountConfig('use_secondary')) { $discountType = $this->_getConfigHelper()->getDiscountConfig('secondary_type'); $discountValue = $this->_getConfigHelper()->getDiscountConfig('secondary_discount'); } } if ($discountType == 'fixed' || $discountType == 'cart_fixed') { $price -= floatval($discountValue); } elseif ($discountType == 'percentage') { $price -= floatval($discountValue) / 100 * $price; } if ($price < 0) { return 0; } return $price; }
protected function _getFinalPrice($product, $price) { $discountedObj = new Varien_Object(array('price' => $price, 'discounted' => false)); Mage::dispatchEvent('affiliateplus_product_get_final_price', array('product' => $product, 'discounted_obj' => $discountedObj)); if ($discountedObj->getDiscounted()) { return $discountedObj->getPrice(); } $price = $discountedObj->getPrice(); if ($this->_getConfigHelper()->getGeneralConfig('discount_type') == 'fixed') { $price -= floatval($this->_getConfigHelper()->getGeneralConfig('discount')); } elseif ($this->_getConfigHelper()->getGeneralConfig('discount_type') == 'percentage') { $price -= floatval($this->_getConfigHelper()->getGeneralConfig('discount')) / 100 * $price; } if ($price < 0) { return 0; } return $price; }