[*] FO : Better gesture of product discounts.
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12904 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -111,14 +111,14 @@ class SpecificPriceCore extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getByProductId($id_product, $id_product_attribute = false, $id_cart = 0)
|
||||
public static function getByProductId($id_product, $id_product_attribute = false, $id_cart = false)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'specific_price`
|
||||
WHERE `id_product` = '.(int)$id_product.'
|
||||
AND id_product_attribute='.(int)$id_product_attribute.'
|
||||
AND id_cart='.(int)$id_cart);
|
||||
WHERE `id_product` = '.(int)$id_product.
|
||||
($id_product_attribute ? 'AND id_product_attribute = '.(int)$id_product_attribute : '').'
|
||||
AND id_cart = '.(int)$id_cart);
|
||||
}
|
||||
|
||||
public static function deleteByIdCart($id_cart, $id_product = false, $id_product_attribute = false)
|
||||
|
||||
@@ -733,6 +733,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function processPriceAddition($token)
|
||||
{
|
||||
$id_product = Tools::getValue('id_product');
|
||||
$id_product_attribute = Tools::getValue('sp_id_product_attribute');
|
||||
$id_shop = Tools::getValue('sp_id_shop');
|
||||
$id_currency = Tools::getValue('sp_id_currency');
|
||||
$id_country = Tools::getValue('sp_id_country');
|
||||
@@ -748,7 +749,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
$specificPrice = new SpecificPrice();
|
||||
$specificPrice->id_product = (int)$id_product;
|
||||
$specificPrice->id_product_attribute = (int)Tools::getValue('id_product_attribute');
|
||||
$specificPrice->id_product_attribute = (int)$id_product_attribute;
|
||||
$specificPrice->id_shop = (int)$id_shop;
|
||||
$specificPrice->id_currency = (int)($id_currency);
|
||||
$specificPrice->id_country = (int)($id_country);
|
||||
|
||||
@@ -118,9 +118,13 @@ function findCombination(firstTime)
|
||||
else
|
||||
selectedCombination['ecotax'] = default_eco_tax;
|
||||
|
||||
//show the large image in relation to the selected combination
|
||||
if (combinations[combination]['image'] && combinations[combination]['image'] != -1)
|
||||
displayImage( $('#thumb_'+combinations[combination]['image']).parent() );
|
||||
//show the large image in relation to the selected combination
|
||||
if (combinations[combination]['image'] && combinations[combination]['image'] != -1)
|
||||
displayImage( $('#thumb_'+combinations[combination]['image']).parent() );
|
||||
|
||||
//show discounts values according to the selected combination
|
||||
if (combinations[combination]['idCombination'] && combinations[combination]['idCombination'] > 0)
|
||||
displayDiscounts(combinations[combination]['idCombination']);
|
||||
|
||||
//get available_date for combination product
|
||||
selectedCombination['available_date'] = combinations[combination]['available_date'];
|
||||
@@ -425,7 +429,7 @@ function displayImage(domAAroundImgThumb)
|
||||
$('#bigpic').fadeOut('fast', function(){
|
||||
$(this).attr('src', newSrc).show();
|
||||
if (typeof(jqZoomEnabled) != 'undefined' && jqZoomEnabled)
|
||||
$(this).attr('alt', domAAroundImgThumb.attr('href'));
|
||||
$(this).attr('alt', domAAroundImgThumb.attr('href'));
|
||||
});
|
||||
}
|
||||
$('#views_block li a').removeClass('shown');
|
||||
@@ -433,6 +437,18 @@ function displayImage(domAAroundImgThumb)
|
||||
}
|
||||
}
|
||||
|
||||
//update display of the discounts table
|
||||
function displayDiscounts(combination)
|
||||
{
|
||||
$('#quantityDiscount table tbody tr').each(function() {
|
||||
if (($(this).attr('id') != 'quantityDiscount_0') &&
|
||||
($(this).attr('id') != 'quantityDiscount_'+combination))
|
||||
$(this).fadeOut('slow');
|
||||
});
|
||||
|
||||
$('#quantityDiscount_'+combination).show();
|
||||
}
|
||||
|
||||
// Serialscroll exclude option bug ?
|
||||
function serialScrollFixLock(event, targeted, scrolled, items, position)
|
||||
{
|
||||
|
||||
+29
-24
@@ -455,33 +455,38 @@ var fieldRequired = '{l s='Please fill in all required fields, then save the cus
|
||||
{if isset($quantity_discounts) && $quantity_discounts}
|
||||
<!-- quantity discount -->
|
||||
<ul class="idTabs clearfix">
|
||||
<li><a href="#" style="cursor: pointer" class="selected">{l s='Quantity discount'}</a></li>
|
||||
<li><a href="#discount" style="cursor: pointer" class="selected">{l s='Quantity discount'}</a></li>
|
||||
</ul>
|
||||
<div id="quantityDiscount">
|
||||
<table class="std">
|
||||
<tr>
|
||||
{foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}
|
||||
<th>{$quantity_discount.quantity|intval}
|
||||
{if $quantity_discount.quantity|intval > 1}
|
||||
{l s='quantities'}
|
||||
{else}
|
||||
{l s='quantity'}
|
||||
{/if}
|
||||
{if $quantity_discount.attributes}{$quantity_discount.attributes}{/if}
|
||||
</th>
|
||||
{/foreach}
|
||||
</tr>
|
||||
<tr>
|
||||
{foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}
|
||||
<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>
|
||||
{/foreach}
|
||||
</tr>
|
||||
<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}">
|
||||
<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>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user