New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix specific prices #8002
Fix specific prices #8002
Conversation
hibatallahAouadni
commented
Jun 13, 2017
•
edited by vincentbz
edited by vincentbz
Questions | Answers |
---|---|
Branch? | 1.6.1.x |
Description? | when you use specific prices for different quantities of product, as you increase the qty, the discount value will be displayed instead of discounted price, so the user will have no idea about the new discounted price |
Type? | bug fix |
Category? | FO |
BC breaks? | no |
Deprecations? | no |
Fixed ticket? | http://forge.prestashop.com/browse/PSCSX-9102 & http://forge.prestashop.com/browse/PSCSX-9095 & http://forge.prestashop.com/browse/PSCSX-9144 |
How to test? | create multiple specific prices for different quantities (amount or percentage, with fixed price or without, it doesn't matter). As you increase the quantity of product on its page (in FO), the specific prices will be displayed correctly. |
Unfortunately, this is a too huge front modification. |
@maximebiloe it's not a big change :/ it's the code review who made all this green in the tpl folder |
@@ -323,24 +323,24 @@ protected function assignPriceAndTax() | |||
$ecotax_rate = (float)Tax::getProductEcotaxRate($this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); | |||
if (Product::$_taxCalculationMethod == PS_TAX_INC && (int)Configuration::get('PS_TAX')) { | |||
$ecotax_tax_amount = Tools::ps_round($this->product->ecotax * (1 + $ecotax_rate / 100), 2); | |||
} else { | |||
$ecotax_tax_amount = Tools::ps_round($this->product->ecotax, 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
caused by Code review
|
||
$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'] = $attribute['name'] . ' - '; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
caused by Code review
// Tables & rows selection | ||
var quantityDiscountTable = $('#quantityDiscount'); | ||
var combinationsSpecificQuantityDiscount = $('.quantityDiscount_'+combination, quantityDiscountTable); | ||
var combinationsSpecificQuantityDiscount = $('.quantityDiscount_' + combination, quantityDiscountTable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
caused by Code review
{ | ||
$('#quantityDiscount tbody tr').each(function(){ | ||
function updateDiscountTable(newPrice) { | ||
$('#quantityDiscount tbody tr').each(function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
caused by Code review
} | ||
else if (type == 'amount') | ||
{ | ||
else if (type == 'amount') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
var discountUpTo = newPrice * (discount/100) * quantity; | ||
if (type == 'percentage') { | ||
var discountedPrice = newPrice * (1 - discount / 100); | ||
var discountUpTo = newPrice * (discount / 100) * quantity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
var discountedPrice = newPrice - discount; | ||
var discountUpTo = discount * quantity; | ||
} | ||
|
||
if (displayDiscountPrice != 0) | ||
$(this).children('td').eq(1).text( formatCurrency(discountedPrice * currencyRate, currencyFormat, currencySign, currencyBlank) ); | ||
$(this).children('td').eq(1).text(formatCurrency(discountedPrice * currencyRate, currencyFormat, currencySign, currencyBlank)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
{/if} | ||
{if (isset($quantity_discounts) && count($quantity_discounts) > 0)} | ||
<!-- quantity discount --> | ||
<section class="page-product-box {if $content_only}hidden{/if}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only add {if $content_only}hidden{/if}
@@ -399,72 +399,70 @@ | |||
{/if} | |||
</div> <!-- end pb-right-column--> | |||
</div> <!-- end primary_block --> | |||
{if !$content_only} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I place this if bellow (*)
</div> | ||
</section> | ||
{/if} | ||
{if !$content_only} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(*) just right here
data-discount="{$quantity_discount.real_value|floatval}" | ||
data-base-Price="{convertPrice price= $quantity_discount.base_price}" | ||
data-discount-formatted="{if $quantity_discount.reduction_type == 'amount'}{convertPrice price=($quantity_discount.real_value*-1)}{else}{($quantity_discount.real_value * -1)|floatval}%{/if}" | ||
data-discount-quantity="{$quantity_discount.quantity|intval}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right here I add some data that I need it to calculate the new price with reduction
if (noTaxForThisProduct || customerGroupWithoutTax) | ||
updateDiscountTable(priceWithDiscountsWithoutTax); | ||
else | ||
updateDiscountTable(priceWithDiscountsWithTax); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(**) this one I placed just above
} | ||
else { | ||
updateDiscountTable(priceWithDiscountsWithTax); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(**) just right here
Yes, but as you modify the |
ok |
hi, this might work for the following situation as described before: "when you use specific prices for different quantities of product, as you increase the qty, the discount value will be displayed instead of discounted price, so the user will have no idea about the new discounted price" but it surely does NOT work when you instead of "Apply a discount of" use " change base price", meaning i need to change the base price from a certain quantity and not apply a discount of Is there any possibility to adapt the changes for both situations and not only for the "discount" situation? Regards |
Hi @hibatallahAouadni . i have just tested #8099 and it is still wrong. Moreover in the "Volume discounts" table i have displayed only the qty from which the new price is changed and there is no info about the new base price, only reduction, again with 0.00€ i ll post this comment there too |
@hibatallahAouadni |