1. (простой способ)
Откройте
/themes/ваша-тема/product-list.tpl и внутри
Код:
{foreach from=$products item=product name=products}
добавьте:
Код:
{assign var='sp' value=SpecificPrice::getByProductId($product.id_product)}
{if $sp}
<div>
<table class="std table-product-discounts">
<thead>
<tr>
<th>Кол-во</th>
<th>Скидка</th>
<th>Общая</th>
</tr>
</thead>
<tbody>
{foreach from=$sp item='discount'}
<tr>
<td>
{$discount.from_quantity|intval}
</td>
<td>
{$discount.reduction*100|floatval}%
</td>
<td>
{$discountPrice=$product.price-($product.price*$discount.reduction)|floatval}
{$discountPrice=$discountPrice*$discount.from_quantity}
{$qtyProductPrice = $product.price*$discount.from_quantity}
{convertPrice price=$qtyProductPrice-$discountPrice}
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{/if}
2. (способ посложнее)
Откройте
/controllers/front/CategoryController.php и после:
Код:
foreach ($this->cat_products as &$product)
if ($product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity']))
$product['minimal_quantity'] = $product['product_attribute_minimal_quantity'];
добавьте:
Код:
$id_customer = (isset($this->context->customer) ? (int)$this->context->customer->id : 0);
$id_group = (int)Group::getCurrent()->id;
$id_country = (int)$id_customer ? Customer::getCurrentCountry($id_customer) : Configuration::get('PS_COUNTRY_DEFAULT');
$id_currency = (int)$this->context->cookie->id_currency;
$id_shop = $this->context->shop->id;
foreach ($this->cat_products as &$product)
{
$quantity_discounts = SpecificPrice::getQuantityDiscounts($product['id_product'], $id_shop, $id_currency, $id_country, $id_group, null, true, (int)$this->context->customer->id);
foreach ($quantity_discounts as &$quantity_discount)
{
if ($quantity_discount['id_product_attribute'])
{
$combination = new Combination((int)$quantity_discount['id_product_attribute']);
$attributes = $combination->getAttributesName((int)$this->context->language->id);
foreach ($attributes as $attribute)
$quantity_discount['attributes'] = $attribute['name'].' - ';
$quantity_discount['attributes'] = rtrim($quantity_discount['attributes'], ' - ');
}
if ((int)$quantity_discount['id_currency'] == 0 && $quantity_discount['reduction_type'] == 'amount')
$quantity_discount['reduction'] = Tools::convertPriceFull($quantity_discount['reduction'], null, Context::getContext()->currency);
}
$_product = new Product((int)$product['id_product']);
$product_price = $_product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false);
$tax = (float)$_product->getTaxesRate(new Address((int)$this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
$ecotax_tax_amount = Tools::ps_round($_product->ecotax, 2);
$product['quantity_discounts'] = $this->formatQuantityDiscounts($quantity_discounts, $product_price, (float)$tax, $ecotax_tax_amount);
}
Метод formatQuantityDiscounts скопировать из
/controllers/front/ProductController.php
Откройте
/themes/ваша-тема/product-list.tpl и внутри
Код:
{foreach from=$products item=product name=products}
добавьте:
Код:
{if (isset($product.quantity_discounts) && count($product.quantity_discounts) > 0)}
<div id="quantityDiscount">
<table class="std table-product-discounts">
<thead>
<tr>
<th>Кол-во</th>
<th>Скидка</th>
<th>Общая</th>
</tr>
</thead>
<tbody>
{foreach from=$product.quantity_discounts item='quantity_discount' name='quantity_discounts'}
<tr id="quantityDiscount_{$quantity_discount.id_product_attribute}" class="quantityDiscount_{$quantity_discount.id_product_attribute}" data-discount-type="{$quantity_discount.reduction_type}" data-discount="{$quantity_discount.real_value|floatval}" data-discount-quantity="{$quantity_discount.quantity|intval}">
<td>
{$quantity_discount.quantity|intval}
</td>
<td>
{if $quantity_discount.price >= 0 || $quantity_discount.reduction_type == 'amount'}
{convertPrice price=$quantity_discount.real_value|floatval}
{else}
{$quantity_discount.real_value|floatval}%
{/if}
</td>
<td>
{if $quantity_discount.price >= 0 || $quantity_discount.reduction_type == 'amount'}
{$discountPrice=$product.price-$quantity_discount.real_value|floatval}
{else}
{$discountPrice=$product.price-($product.price*$quantity_discount.reduction)|floatval}
{/if}
{$discountPrice=$discountPrice*$quantity_discount.quantity}
{$qtyProductPrice = $product.price*$quantity_discount.quantity}
{convertPrice price=$qtyProductPrice-$discountPrice}
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{/if}
3. (правильный)
Написать модуль с перехватом хука actionProductListOverride и обработкой товарных позиций на стороне модуля (не забираясь в основные контроллеры).