Автор Тема: Скидка на атрибут(комбинацию)  (Прочитано 1023 раз)

16 Декабрь 2013, 20:18:45
  • Новичок
  • *
  • Сообщений: 6
  • Репутация: +0/-0
  • Сообщество PrestaShop
    • Просмотр профиля
Здравствуйте.
Prestashop 1.5.4

У меня в магазине есть несколько объемов, они заданы атрибутами.
Так вот я заметила если поставить скидку в 10% на один атрибут, скидка действует только на один атрибут, но почему то отображается везде.

Например у товара есть 2 объема 100ml и 50ml, ставим скидку на 100 ml.
Получаем следующую картину скидка на 100ml действует и верно все отображается, скидка на 50ml не действует, но все равно ярлык в 10% отображается.

в product.tpl
<p id="reduction_percent" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}><span id="reduction_percent_display">{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if}</span></p>
в product.js
{
  display_specific_price = selectedCombination.specific_price['price'];
  if (selectedCombination['specific_price'].reduction_type == 'percentage')
  {
    $('#reduction_amount').hide();
    $('#reduction_percent_display').html('-' + parseFloat(selectedCombination['specific_price'].reduction_percent) + '%');
    $('#reduction_percent').show();
  } else if (selectedCombination['specific_price'].reduction_type == 'amount' && selectedCombination['specific_price'].reduction_price != 0) {
    $('#reduction_amount_display').html('-' + formatCurrency(selectedCombination['specific_price'].reduction_price, currencyFormat, currencySign, currencyBlank));
    $('#reduction_percent').hide();
    $('#reduction_amount').show();
  } else {
    $('#reduction_percent').hide();
    $('#reduction_amount').hide();
  }
  }
Помогите где поправить так что бы скидка отображалась только там где она поставлена?
16 Декабрь 2013, 20:33:23
Ответ #1
  • Старожил
  • ****
  • Сообщений: 274
  • Репутация: +3/-0
    • Просмотр профиля
У меня тема стандарная, prestashop 1.5.6, скидка -10% показывается только у атрибута для которого определена спец.цена.
<div class="content_prices clearfix">
<!-- prices -->
{if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
{if $product->online_only}
<p class="online_only">{l s='Online only'}</p>
{/if}
<div class="price">
<p class="our_price_display">
{if $priceDisplay >= 0 && $priceDisplay <= 2}
<span id="our_price_display">{convertPrice price=$productPrice}</span>
{/if}
</p>
{if $product->on_sale}
<img src="{$img_dir}onsale_{$lang_iso}.gif" alt="{l s='On sale'}" class="on_sale_img"/>
<span class="on_sale">{l s='On sale!'}</span>
{elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutReduction > $productPrice}
<span class="discount">{l s='Reduced price!'}</span>
{/if}
{if $priceDisplay == 2}
<br />
<span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span>&nbsp;{l s='tax excl.'}</span>
{/if}
</div>
<p id="reduction_percent" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}><span id="reduction_percent_display">{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if}</span></p>
<p id="reduction_amount" {if !$product->specificPrice OR $product->specificPrice.reduction_type != 'amount' || $product->specificPrice.reduction|intval ==0} style="display:none"{/if}>
<span id="reduction_amount_display">
{if $product->specificPrice AND $product->specificPrice.reduction_type == 'amount' AND $product->specificPrice.reduction|intval !=0}
-{convertPrice price=$productPriceWithoutReduction-$productPrice|floatval}
{/if}
</span>
</p>
<p id="old_price"{if !$product->specificPrice || !$product->specificPrice.reduction} class="hidden"{/if}>
{if $priceDisplay >= 0 && $priceDisplay <= 2}
<span id="old_price_display">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction}{/if}</span>
{/if}
</p>
{if $packItems|@count && $productPrice < $product->getNoPackPrice()}
<p class="pack_price">{l s='Instead of'} <span style="text-decoration: line-through;">{convertPrice price=$product->getNoPackPrice()}</span></p>
<br class="clear" />
{/if}
{if $product->ecotax != 0}
<p class="price-ecotax">{l s='Include'} <span id="ecotax_price_display">{if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if}</span> {l s='For green tax'}
{if $product->specificPrice AND $product->specificPrice.reduction}
<br />{l s='(not impacted by the discount)'}
{/if}
</p>
{/if}
{if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
{math equation="pprice / punit_price"  pprice=$productPrice  punit_price=$product->unit_price_ratio assign=unit_price}
<p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'htmlall':'UTF-8'}</p>
{/if}
{/if}
<p id="add_to_cart" {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}style="display:none"{/if} class="buttons_bottom_block">
<span></span>
<input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" />
</p>
{if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}
<div class="clear"></div>
</div>
16 Декабрь 2013, 20:48:49
Ответ #2
  • Ветеран
  • *****
  • Сообщений: 33325
  • Репутация: +26771/-0
    • Просмотр профиля
В теме default все работает правильно. Скидки показывает только у тех комбинаций для которых они созданы.
Проверить нужно полностью шаблон product.tpl. Попробуйте заменить на стандарный из последней версии.
17 Декабрь 2013, 19:15:18
Ответ #3
  • Новичок
  • *
  • Сообщений: 6
  • Репутация: +0/-0
  • Сообщество PrestaShop
    • Просмотр профиля
Спасибо, уже сама разобралась.
Проблема была в файле product.js