Bug in percentage off in Savings

Just letting you know there is a bug in calculating the percentage off on products on sale.



It’s currently calculating the percentage off based on the sale price rather than the list price.



[url]http://beta.cs-cart.com/index.php?dispatch=products.view&product_id=29754[/url]



list price: $227.99

price: $150.00

You Save: $77.99 (52%)





It’s not 52% off. It’s 34% from the list price.



I notice this when I have lots of products that are over 100% off.

Here’s the fix.



Modify the file “fn.catalog.php” under the “core” directory.





Change line 314:



```php $product[‘list_discount_prc’] = sprintf(‘%d’, round($product[‘list_discount’] * 100 / $product[‘price’]));

```

To:



```php $product[‘list_discount_prc’] = sprintf(‘%d’, round($product[‘list_discount’] * 100 / $product[‘list_price’])); ```





Should look like:



```php // Get product discounts

if ($get_discounts == true && !isset($product[‘exclude_from_calculate’])) {

fn_promotion_apply(‘catalog’, $product, $auth);



if (empty($product[‘discount’]) && !empty($product[‘list_price’]) && !empty($product[‘price’]) && floatval($product[‘price’]) && $product[‘list_price’] > $product[‘price’]) {

$product[‘list_discount’] = fn_format_price($product[‘list_price’] - $product[‘price’]);

$product[‘list_discount_prc’] = sprintf(‘%d’, round($product[‘list_discount’] * 100 / $product[‘list_price’]));

}

} ```