Jump to content

quantity discount displays not right.


Recommended Posts

I work with the module: quantity discounts

But it displays the discount prices without taxes!?

The part of the code from the module which display the prices etc:

function writeDiscountsContent(price) {ldelim}
   var discountStr = "
";
   var discountedPrice = 0;

   {foreach from=$qd_quantity_discounts item='qd_quantity_discount' name='quantity_discounts'}
       discountStr += "{$qd_quantity_discount.quantity|intval} ";
       {if $qd_quantity_discount.quantity|intval > 1}
           discountStr += "{l s='quantities' mod='quantitydiscounts'}: ";
       {else}
           discountStr += "{l s='quantity' mod='quantitydiscounts'}: ";
       {/if}
       {if $qd_quantity_discount.id_discount_type|intval == 1}
           discountedPrice = price - (price * {$qd_quantity_discount.value} / 100);
       {else}
           discountedPrice = price - {$qd_quantity_discount.value}; 
       {/if}
       discountStr += formatCurrency(discountedPrice, currencyFormat, currencySign, currencyBlank) + "
";
   {/foreach}        
   discountStr += "
";




P.S: It is the module from presto-changeo (I have also contact them, but the are on holiday, and I need it soon fixed!)

When somebody have the solution, let me know!

Link to comment
Share on other sites

Nobody? This module works not for me so have somebody a alternative method for this?

I need display the product discounts (quantity discounts) on the product page (product.tpl).

Please help me, when it's a paid solution, let me know.

Link to comment
Share on other sites

Hello Stefand,
I have the same problem for this module.
In the table of discount why the visualized prices are wrong while in calculation in the cart it is executed correctly?

4 quantities € 34,20 but the correct price is € 34,65
8 quantities € 32,30 but the correct price is € 32,73
12 quantities € 30,40 but the correct price is € 30,80

This is a bug or my error??? :(

31143_QUcsEHsdJDS5DxWH9kBa_t

Link to comment
Share on other sites

@bambi

I use PS 1.3.1.


I have noticed that the module it applies a discount of 1.3% but I do not understand from where takes it!

Ex: € 34,65 - 1,3% = € 34,20 for 4 quantities
Ex: € 32,73 - 1,3% = € 32,30 for 8 quantities


P.S. Sorry for my bad english but I use a on-line traslator

Link to comment
Share on other sites

I think the problem is there:

function fetchCurrentPrice() {ldelim}
   var val = $("#our_price_display").text();
   var qd_price = "";
   for (var i = 0 ; i < val.length ; i++)
       if (/[0-9.,]/.test(val.charAt(i)))
           qd_price += val.charAt(i);

   return parseFloat(qd_price);



The function parseFloat() doesnt like the comma for separating the decimal. Do you have a dot or a comma in your prices on your website?
I think in english we use a comma, and in french a dot (for separating the decimal).

Link to comment
Share on other sites

Yes it is.
Add this line in your function:

val =val.replace(",", ".");


So the function becomes:

function fetchCurrentPrice() {ldelim}
   var val = $("#our_price_display").text();
   var qd_price = "";
   val =val.replace(",", ".");
   for (var i = 0 ; i < val.length ; i++)
       if (/[0-9.,]/.test(val.charAt(i)))
           qd_price += val.charAt(i);

   return parseFloat(qd_price);
{rdelim}



You will see it works now.

EDIT: the file is /www/modules/quantitydiscounts/quantitydiscounts.tpl

Link to comment
Share on other sites

I just install the modules. The view price show correctly how ever if you add your product into cart with the discount quantity you got the wrong price. This modules some how add 0.1395... into the unit price. Please advise!
Thanks,


What percentage/amount of discount have you configured in the back office?
Link to comment
Share on other sites

Have you created at least one discount for this product?


Yes, I did, are you using Prestashop version 1.3.2?


No I have the 1.3.1.1.

Does the discounts showup without the module installed?
Have you tried with different browsers? (could be javascript issue)


I think I figure out, it may be the theme problem. The original theme has not problem. Do you know which code and file will affect this?
Link to comment
Share on other sites

Have you created at least one discount for this product?


Yes, I did, are you using Prestashop version 1.3.2?


No I have the 1.3.1.1.

Does the discounts showup without the module installed?
Have you tried with different browsers? (could be javascript issue)


I think I figure out, it may be the theme problem. The original theme has not problem. Do you know which code and file will affect this?



I think it could be in

/www/themes/***/product.tpl
Link to comment
Share on other sites

I just install the modules. The view price show correctly how ever if you add your product into cart with the discount quantity you got the wrong price. This modules some how add 0.1395... into the unit price. Please advise!
Thanks,


I see $30 Tax EXCLUDED, maybe it has something to do with the tax....
Link to comment
Share on other sites

I just install the modules. The view price show correctly how ever if you add your product into cart with the discount quantity you got the wrong price. This modules some how add 0.1395... into the unit price. Please advise!
Thanks,


What percentage/amount of discount have you configured in the back office?


Thanks for replying!
When I configure quantity discount using percentage, is it working perfectly (see attachment), taxes are fine.
But it doesn't work with "by amount" quantity discount, wrong price, always add 0.13953.

Maybe it has something to do with the code

function writeDiscountsContent(price) {ldelim}
   var discountStr = "
";
   var discountedPrice = 0;

   {foreach from=$qd_quantity_discounts item='qd_quantity_discount' name='quantity_discounts'}
       discountStr += "{$qd_quantity_discount.quantity|intval} ";
       {if $qd_quantity_discount.quantity|intval > 1}
           discountStr += "{l s='quantities' mod='quantitydiscounts'}: ";
       {else}
           discountStr += "{l s='quantity' mod='quantitydiscounts'}: ";
       {/if}
       {if $qd_quantity_discount.id_discount_type|intval == 1}
           discountedPrice = price - (price * {$qd_quantity_discount.value} / 100);
       {else}
           discountedPrice = price - {$qd_quantity_discount.value}; 
       {/if}
       discountStr += formatCurrency(discountedPrice, currencyFormat, currencySign, currencyBlank) + "
";
   {/foreach}        
   discountStr += "
";





Note: I use PrestaShop v.1.3.2

31851_489coK5mipVKwHTAwZzw_t

31852_jZkMMsJCtigPiFt7Afgk_t

Link to comment
Share on other sites

Have you created at least one discount for this product?


Yes, I did, are you using Prestashop version 1.3.2?


No I have the 1.3.1.1.

Does the discounts showup without the module installed?
Have you tried with different browsers? (could be javascript issue)


I think I figure out, it may be the theme problem. The original theme has not problem. Do you know which code and file will affect this?



I think it could be in

/www/themes/***/product.tpl


I have tried on this file half of the day, but still not figure out the issue :(, do you know?
Link to comment
Share on other sites

I just install the modules. The view price show correctly how ever if you add your product into cart with the discount quantity you got the wrong price. This modules some how add 0.1395... into the unit price. Please advise!
Thanks,


What percentage/amount of discount have you configured in the back office?


Thanks for replying!
When I configure quantity discount using percentage, is it working perfectly (see attachment), taxes are fine.
But it doesn't work with "by amount" quantity discount, wrong price, always add 0.13953.

Maybe it has something to do with the code

function writeDiscountsContent(price) {ldelim}
   var discountStr = "
";
   var discountedPrice = 0;

   {foreach from=$qd_quantity_discounts item='qd_quantity_discount' name='quantity_discounts'}
       discountStr += "{$qd_quantity_discount.quantity|intval} ";
       {if $qd_quantity_discount.quantity|intval > 1}
           discountStr += "{l s='quantities' mod='quantitydiscounts'}: ";
       {else}
           discountStr += "{l s='quantity' mod='quantitydiscounts'}: ";
       {/if}
       {if $qd_quantity_discount.id_discount_type|intval == 1}
           discountedPrice = price - (price * {$qd_quantity_discount.value} / 100);
       {else}
           discountedPrice = price - {$qd_quantity_discount.value}; 
       {/if}
       discountStr += formatCurrency(discountedPrice, currencyFormat, currencySign, currencyBlank) + "
";
   {/foreach}        
   discountStr += "
";





Note: I use PrestaShop v.1.3.2



So I think the module we were taking about here is not the issue. (I think the module is just displaying the discount in a better place.) You probably have an issue with the code of prestashop itself. Maybe you can start a new thread or make a bug report.

@skykit
No, sorry.
Link to comment
Share on other sites

  • 1 month later...
Yes it is.
Add this line in your function:
val =val.replace(",", ".");


So the function becomes:

function fetchCurrentPrice() {ldelim}
   var val = $("#our_price_display").text();
   var qd_price = "";
   val =val.replace(",", ".");
   for (var i = 0 ; i < val.length ; i++)
       if (/[0-9.,]/.test(val.charAt(i)))
           qd_price += val.charAt(i);

   return parseFloat(qd_price);
{rdelim}



You will see it works now.

EDIT: the file is /www/modules/quantitydiscounts/quantitydiscounts.tpl



This did the job :D thx
Link to comment
Share on other sites

Yes it is.
Add this line in your function:
val =val.replace(",", ".");


So the function becomes:

function fetchCurrentPrice() {ldelim}
   var val = $("#our_price_display").text();
   var qd_price = "";
   val =val.replace(",", ".");
   for (var i = 0 ; i < val.length ; i++)
       if (/[0-9.,]/.test(val.charAt(i)))
           qd_price += val.charAt(i);

   return parseFloat(qd_price);
{rdelim}



You will see it works now.

EDIT: the file is /www/modules/quantitydiscounts/quantitydiscounts.tpl



This did the job :D thx


You are welcome :)
Link to comment
Share on other sites

Hi!

I have some products which prices = 0
but I have also discount prices for these products
I use attributes to calculate the final prices (so initial product price is equal to 0 and attribute = 100 $ for instance)


How may I hide the discount in that case ?
because, as expected, discounted prices are displayed like that : discount : 0,00 $

tks for your help !!

Link to comment
Share on other sites

Hi!

I have some products which prices = 0
but I have also discount prices for these products
I use attributes to calculate the final prices (so initial product price is equal to 0 and attribute = 100 $ for instance)


How may I hide the discount in that case ?
because, as expected, discounted prices are displayed like that : discount : 0,00 $

tks for your help !!


I think in the template, you can do a if with smarty. Something like:
{if price==0}
{/if}
Link to comment
Share on other sites

  • 3 months later...

Hi,

I just need to find out how to enter the quantity discount amounts as actual prices for each given quantity break, instead of discounts from a base item price.

For instance:
Qty. Price
250 $1.45
500 $1.39
1000 $1.25

And so on. Right now, in PrestaShop 1.3.6, I have to enter a base price (which I am OK doing), but I will be selling my products in bulk quantities, as shown in the above example. I will be importing a large number of products into the store's back end, but all the info I have on the Quantity discounts for each product is in the above format.

Does anyone have a solution for this challenge, even a paid module or modification that I can purchase?

Again, all I need is a way to enter/import the price quantity discounts as actual prices for any given quantity of the product (instead of reductions from the base price), and have them displayed as actual prices in the product detail page. The add to cart obviously needs to pick up the right quantity price, based on the quantity added to cart.

Seems simple enough to me, but not sure if it requires extensive modifications to the quantity discounts files/templates.

Many thanks in advance for any and all advice.

Alex

40263_zjXfe2f6UFvKXElYIpeE_t

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

quite nice! i am using prestashop 1.4 and it shows from the highest quantities first to the lowest...
I saw someone did a display from lowest quantities first to highest! Do you know how to change the code for that? there's nothing in the back office to make such things...

Thanks

Link to comment
Share on other sites

  • 1 month later...
quite nice! i am using prestashop 1.4 and it shows from the highest quantities first to the lowest...
I saw someone did a display from lowest quantities first to highest! Do you know how to change the code for that? there's nothing in the back office to make such things...

Thanks


I also want to know how to do this.
Thanks.
Link to comment
Share on other sites

×
×
  • Create New...