
open: system/library/cart.php
replace
if ($product_special_query->num_rows) { $price = $product_special_query->row['price']; }
with
if ($product_special_query->num_rows) { if($product_discount_query->num_rows&&$product_discount_query->row['price']<=$product_special_query->row['price']){ $price = $product_discount_query->row['price']; }else{ $price = $product_special_query->row['price']; } }
open: catalog/controller/product/product.php
foreach ($discounts as $discount) { $this->data['discounts'][] = array( 'quantity' => $discount['quantity'], 'price' => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) ); }
with
foreach ($discounts as $discount) { if((float)$product_info['special']){ if($product_info['special']>$discount['price']){ $this->data['discounts'][] = array( 'quantity' => $discount['quantity'], 'price' => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) ); } }else{ $this->data['discounts'][] = array( 'quantity' => $discount['quantity'], 'price' => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) ); } }
or if you use vQmod to save from core file overwriting:
<modification>
<id>Fix Discounts wtih Specials</id>
<version>1.0</version>
<vqmver>1.2.3</vqmver>
<author>uksb</author>
<file name=”system/library/cart.php”>
<operation>
<search position=”replace” offset=”2″><![CDATA[ if ($product_special_query->num_rows) {]]></search>
<add><![CDATA[ if ($product_special_query->num_rows) {
if($product_discount_query->num_rows&&$product_discount_query->row[‘price’]<=$product_special_query->row[‘price’]){
$price = $product_discount_query->row[‘price’];
}else{
$price = $product_special_query->row[‘price’];
}
}]]></add>
</operation>
</file>
<file name=”catalog/controller/product/product.php”>
<operation>
<search position=”replace” offset=”5″><![CDATA[ foreach ($discounts as $discount) {]]></search>
<add><![CDATA[ foreach ($discounts as $discount) {
if((float)$product_info[‘special’]){
if($product_info[‘special’]>$discount[‘price’]){
$this->data[‘discounts’][] = array(
‘quantity’ => $discount[‘quantity’],
‘price’ => $this->currency->format($this->tax->calculate($discount[‘price’], $product_info[‘tax_class_id’], $this->config->get(‘config_tax’)))
);
}
}else{
$this->data[‘discounts’][] = array(
‘quantity’ => $discount[‘quantity’],
‘price’ => $this->currency->format($this->tax->calculate($discount[‘price’], $product_info[‘tax_class_id’], $this->config->get(‘config_tax’)))
);
}
}]]></add>
</operation>
</file>
</modification>
Leave a Reply