Вот что нашел в сети.
мануал на английском, но все понятно
Hi,
first of all I apologize for take so long to post a replay, but i've been a little busy these days.
I am testing prestashop 1.4.2.5 now, and a tried to make these modifications work on it doing the following changes to the originall files of prestashop 1.4.2.5.
In admin/tabs/AdminAttributeGenerator.php,
Change
Код:
$price += (float)($_POST['price_impact_'.(int)($attr)]); $weight += (float)($_POST['weight_impact'][(int)($attr)]);
to
Код:
if (($attribute_price > 0)) $price *= (float)($_POST['price_impact'][(int)($attr)]); else $price += (float)($_POST['price_impact'][(int)($attr)]); $weight += (float)($_POST['weight_impact'][(int)($attr)]);
In admin/tabs/AdminProducts.php,
Change
Код:
<span id="span_impact"> '.$this->l('of').' '.($currency->format % 2 != 0 ? $currency->sign.' ' : '').'
to
Код:
<span id="span_impact"> x
In classes/Product.php
Change
Код:
if ($id_product_attribute !== false) // If you want the default combination, please use NULL value instead $price += $attribute_price;
to
Код:
if (($attribute_price > 0)) $price *= $attribute_price; else $price += $attribute_price;
so far i think it is all correct, i test a little and all seems to work fine. But i have problems to get the correct display price in the product page. I did the following.
in themes//js/product.js
Change
Код:
var taxExclPrice = (specific_price ? (specific_currency ? specific_price : specific_price * currencyRate) : productPriceTaxExcluded) + combination_add_price * currencyRate;
to
Код:
if (selectedCombination['price'] = 0 ) var taxExclPrice = (specific_price ? (specific_currency ? specific_price : specific_price * currencyRate) : productPriceTaxExcluded) + (combination_add_price * currencyRate); else var taxExclPrice = (specific_price ? (specific_currency ? specific_price : specific_price * currencyRate) : productPriceTaxExcluded) * combination_add_price * currencyRate;
Whit this change the price displayed is correct when the attribute has a price impact different from zero.
But when the price impact is equal to 0 the price displayed is 0.00, if you add to cart, in blockcart the price is correct.
Now to get this work well, if you do not want that the attribute has an impact on the price, you have to define the price impact is equal to 1.
I think it is better that if you don't to modify the price in an attribute ther price impact should be 0 but i can't get this.
I am doing something wrong but i don't know what it is.
If anyone that knows a little more than me about this code can take a look and give us any suggestions we would be so grateful.
В крадце - способ работает, но на странице товара цена не преобразуется. а отображается только основная. То есть, если товар стоит 200 рублей, то выбирая атрибут - цена на странице товара все равно 200 рублей. Но после добавления в корзину - в корзине видна измененная цена.
Автор пишет об этом и предлагает изменить код в файле in themes//js/product.js
но мне не помогло
Собственно как это победить?
Сообщение отредактировал Michel II (05-12-2015 02:32)