Merge pull request #937 from PhpMadman/DiscountPrice
[*] FO : Added possibility to display new price instead of quantity discount
This commit is contained in:
@@ -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(
|
||||
|
||||
+36
-28
@@ -459,34 +459,42 @@ var fieldRequired = '{l s='Please fill in all the required fields before saving
|
||||
</ul>
|
||||
<div id="quantityDiscount">
|
||||
<table class="std">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Product'}</th>
|
||||
<th>{l s='From (qty)'}</th>
|
||||
<th>{l s='Discount'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}
|
||||
<tr id="quantityDiscount_{$quantity_discount.id_product_attribute}" class="quantityDiscount_{$quantity_discount.id_product_attribute}">
|
||||
<td>
|
||||
{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}
|
||||
</td>
|
||||
<td>{$quantity_discount.quantity|intval}</td>
|
||||
<td>
|
||||
{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}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Product'}</th>
|
||||
<th>{l s='From (qty)'}</th>
|
||||
<th>{if Configuration::get('PS_DISPLAY_DISCOUNT_PRICE')}{l s='Price'}{else}{l s='Discount'}{/if}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}
|
||||
<tr id="quantityDiscount_{$quantity_discount.id_product_attribute}" class="quantityDiscount_{$quantity_discount.id_product_attribute}">
|
||||
<td>
|
||||
{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}
|
||||
</td>
|
||||
<td>{$quantity_discount.quantity|intval}</td>
|
||||
<td>
|
||||
{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}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user