Merge pull request #937 from PhpMadman/DiscountPrice

[*] FO : Added possibility to display new price instead of quantity discount
This commit is contained in:
Jérôme Nadaud committed 2013-11-06 08:06:16 -08:00
commit d0522417eb
2 files changed
+18 -2

No files matched your search

@@ -180,7 +180,15 @@ class AdminPPreferencesControllerCore extends AdminController
'validation' => 'isBool', 'validation' => 'isBool',
'cast' => 'intval', 'cast' => 'intval',
'type' => 'bool' '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( 'stock' => array(
+9 -1
View File
@@ -463,7 +463,7 @@ var fieldRequired = '{l s='Please fill in all the required fields before saving
<tr> <tr>
<th>{l s='Product'}</th> <th>{l s='Product'}</th>
<th>{l s='From (qty)'}</th> <th>{l s='From (qty)'}</th>
<th>{l s='Discount'}</th> <th>{if Configuration::get('PS_DISPLAY_DISCOUNT_PRICE')}{l s='Price'}{else}{l s='Discount'}{/if}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -479,10 +479,18 @@ var fieldRequired = '{l s='Please fill in all the required fields before saving
<td>{$quantity_discount.quantity|intval}</td> <td>{$quantity_discount.quantity|intval}</td>
<td> <td>
{if $quantity_discount.price >= 0 OR $quantity_discount.reduction_type == 'amount'} {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} -{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} {else}
-{$quantity_discount.real_value|floatval}% -{$quantity_discount.real_value|floatval}%
{/if} {/if}
{/if}
</td> </td>
</tr> </tr>
{/foreach} {/foreach}