Changing the quantity using Jquerry


I want that when someone click on 10 Stuck the quantity and price will be changed. If someone click on 20 Stuck the quantity changed to 20 and 25.1% discount will be applied to the price.

What I’ve done till now is,
First I’m doing for only quantity that the quantity will be changed.

I put each of them in ANCHOR tags, and then in DT tag I put the DATA-QTY so I can use it on JQUERRY. This is how my PRICEINFO.tpl looks like

[{foreach from=$oDetailsProduct->loadAmountPriceInfo() item=priceItem name=amountPrice}]
<a href"#">

oxprice2article__oxamount->value}]>[{oxmultilang ident=“ab”}] [{$priceItem->oxprice2article__oxamount->value}] [{oxmultilang ident=“PCS”}]

[{oxscript include=“js/libs/discount.js” priority=2}]

[{if $priceItem->oxprice2article__oxaddperc->value}]
[{$priceItem->oxprice2article__oxaddperc->value}]% [{oxmultilang ident=“DISCOUNT”}]
[{block name=“details_productmain_price”}]
[{$priceItem->fbrutprice}] [{$currency->sign}]
[{if $oDetailsProduct->getUnitName() and $priceItem->fbrutamountprice}]
 ([{$priceItem->fbrutamountprice}] [{$currency->sign}] / [{$oDetailsProduct->getUnitName()}])


And my jquerry looks like this
$(’.dl-horizontal > a’).click(function(){
$(this).each(function() {

Any Idea what I’m doing wrong??
Because in $(’#amountToBasket’).val(‘data-qty’); when i put 10 instead of ‘data-qty’ and click on the link in my shop, and click on link it changes the quantity to 10. But on every link it does the same. I want that when someone click on 10 Stuck the quantity change to 10 and when click on 20 stuck it change to 20.

I’ll be really happy if someone help me regarding that.


Hi Abdullah,

i tried to reconstruct your problem and wasn’t able. Are you trying to also change the displayed price beside the “In den Warenkorb” button? In the wave theme the “Staffelpreis” logic seems only to be calculated in the cart and not on the normal page.

Best regards,

1 Like

Hi @sebastian.bauer

Thank you for the reply. I’m trying to do it in FLOW theme. And yes I want to change both the QUANTITY and the PRICE in normal page.

Right now I’m just focusing on just QUANTITY not on price. And if you click on

“ab 10 Stück 16.73% Rabatt” or the below links the quantity is changing from 1 to 10. But I want when someone clicks on

“ab 10 Stück 16.73% Rabatt” the quantity change to 10
“ab 20 Stück 25.1% Rabatt” the quantity change to 20 and similar for 30 too.

Hope you understand my question.

Thanks and regards

Hi @Abdullah_Qamer,

lets have a look on your JavaScript: i am not sure, if i understand what you were trying to do. If you output the interim results with console.log(), you can see a bit more clearly, that things are a bit messed up. After throwing the following into the console, it seemed to work as you wanted (i am no JS guru and prefer the easy solutions :wink: ):

$('.dl-horizontal > a').click(function(){
    let qty = $(this).find('dt').attr('data-qty');


Best regards,

1 Like

Hi @sebastian.bauer

I also lack in Jquery stuffs so I’m thinking to do the easiest way by doing it locally on HTML, CSS and JS. If it works perfectly then I’ll try to do it on it too.

And I’ll use your method too so I can understand what my problem is. Thanks a lot for helping me


1 Like

i have a little bit different approach for dynamic amount price calculation in my template:

1 Like

Hi @vanilla_thunder

Thanks for your reply. Can you show me what your code is doing? I want to see it.


sure, check those two products:

one has % discounts the other has absolute amount prices


Hi @vanilla_thunder

Thank you so much. I can look into your code and try to understand. Maybe I’ll get an idea how to do what I want.

Thank you so much again.

1 Like