From d95885caaeef0dbedcdc03d6c897966e8837133e Mon Sep 17 00:00:00 2001 From: PhpMadman Date: Wed, 6 Nov 2013 14:41:42 +0100 Subject: [PATCH] [*] FO : Added posibilty to display new price instead of quantity discount --- .../admin/AdminPPreferencesController.php | 10 ++- themes/default/product.tpl | 64 +++++++++++-------- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/controllers/admin/AdminPPreferencesController.php b/controllers/admin/AdminPPreferencesController.php index 22656808d..45588b6be 100644 --- a/controllers/admin/AdminPPreferencesController.php +++ b/controllers/admin/AdminPPreferencesController.php @@ -180,7 +180,15 @@ class AdminPPreferencesControllerCore extends AdminController 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool' - ) + ), + 'PS_DISPLAY_DISCOUNT_PRICE' => array( + 'title' => $this->l('Display discounted price'), + 'desc' => $this->l('Insted of showing the discount (-5%) it will instead show the new price with the discount applied'), + 'validation' => 'isBool', + 'cast' => 'intval', + 'required' => false, + 'type' => 'bool' + ), ) ), 'stock' => array( diff --git a/themes/default/product.tpl b/themes/default/product.tpl index 8224f865f..9c3c0e6da 100644 --- a/themes/default/product.tpl +++ b/themes/default/product.tpl @@ -459,34 +459,42 @@ var fieldRequired = '{l s='Please fill in all the required fields before saving
- - - - - - - - - {foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'} - - - - - - {/foreach} - + + + + + + + + + {foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'} + + + + + + {/foreach} +
{l s='Product'}{l s='From (qty)'}{l s='Discount'}
- {if (isset($quantity_discount.attributes) && ($quantity_discount.attributes))} - {$product->getProductName($quantity_discount.id_product, $quantity_discount.id_product_attribute)} - {else} - {$product->getProductName($quantity_discount.id_product)} - {/if} - {$quantity_discount.quantity|intval} - {if $quantity_discount.price >= 0 OR $quantity_discount.reduction_type == 'amount'} - -{convertPrice price=$quantity_discount.real_value|floatval} - {else} - -{$quantity_discount.real_value|floatval}% - {/if} -
{l s='Product'}{l s='From (qty)'}{if Configuration::get('PS_DISPLAY_DISCOUNT_PRICE')}{l s='Price'}{else}{l s='Discount'}{/if}
+ {if (isset($quantity_discount.attributes) && ($quantity_discount.attributes))} + {$product->getProductName($quantity_discount.id_product, $quantity_discount.id_product_attribute)} + {else} + {$product->getProductName($quantity_discount.id_product)} + {/if} + {$quantity_discount.quantity|intval} + {if $quantity_discount.price >= 0 OR $quantity_discount.reduction_type == 'amount'} + {if Configuration::get('PS_DISPLAY_DISCOUNT_PRICE')} + {convertPrice price=$productPrice-$quantity_discount.real_value|floatval} + {else} + -{convertPrice price=$quantity_discount.real_value|floatval} + {/if} + {else} + {if Configuration::get('PS_DISPLAY_DISCOUNT_PRICE')} + {convertPrice price = $productPrice-($productPrice*$quantity_discount.reduction)|floatval} + {else} + -{$quantity_discount.real_value|floatval}% + {/if} + {/if} +
{/if}