Jump to content

Edit History

amorxoigel

amorxoigel

I guys!
i was wondering if i could set a limit to product-quantity selection on the product-add-to-cart.tpl page.

 

            <div class="product-quantity">
                <div class="qty">
                    <span class="control-label">{l s='Quantity:' d='Shop.Theme.Catalog'}</span>
                    <input
                        type="text"
                        name="qty"
                        id="quantity_wanted"
                        value="{$product.quantity_wanted}"
                        class="input-group"
                        min="{$product.minimal_quantity}"
                        />
                </div>
                <div class="add">
				{if $product.add_to_cart_url}
                    <button onclick="return validateSelection();" class="btn btn-primary add-to-cart" data-button-action="add-to-cart" type="submit">
                        <i class="fa fa-shopping-basket">{l s=' BUY NOW!' d='Shop.Theme.Catalog'}</i>
                    </button>      
				{/if}
				{if !$product.add_to_cart_url}
                    <button class="btn btn-primary add-to-cart" data-button-action="add-to-cart" type="submit" disabled="">
                        <i class="fa fa-shopping-basket"> {l s=' SOLD OUT' d='Shop.Theme.Catalog'}</i>
                    </button>      
				{/if}				
                    {hook h='displayProductListFunctionalButtons' product=$product}
                    {hook h='displayCompareButton' product=$product}
                </div>
            </div>

This is the parte of the code i think i've to change.
What i'm trying to achieve is this:
image.png.a1404869ed105c4696947830cf715f82.png
i dont want to be able to add 800 item when there's only like 10 available. I would like i could only choose as max the number of items that are available.
I'm on prestashop 1.7.6
If anyone could help me it would be nice

amorxoigel

amorxoigel

I guys!
i was wondering i could i set a limit to product-quantity selection on the product-add-to-cart.tpl page.

 

            <div class="product-quantity">
                <div class="qty">
                    <span class="control-label">{l s='Quantity:' d='Shop.Theme.Catalog'}</span>
                    <input
                        type="text"
                        name="qty"
                        id="quantity_wanted"
                        value="{$product.quantity_wanted}"
                        class="input-group"
                        min="{$product.minimal_quantity}"
                        />
                </div>
                <div class="add">
				{if $product.add_to_cart_url}
                    <button onclick="return validateSelection();" class="btn btn-primary add-to-cart" data-button-action="add-to-cart" type="submit">
                        <i class="fa fa-shopping-basket">{l s=' BUY NOW!' d='Shop.Theme.Catalog'}</i>
                    </button>      
				{/if}
				{if !$product.add_to_cart_url}
                    <button class="btn btn-primary add-to-cart" data-button-action="add-to-cart" type="submit" disabled="">
                        <i class="fa fa-shopping-basket"> {l s=' SOLD OUT' d='Shop.Theme.Catalog'}</i>
                    </button>      
				{/if}				
                    {hook h='displayProductListFunctionalButtons' product=$product}
                    {hook h='displayCompareButton' product=$product}
                </div>
            </div>

This is the parte of the code i think i've to change.
What i'm trying to achieve is this:
image.png.a1404869ed105c4696947830cf715f82.png
i dont want to be able to add 800 item when there's only like 10 available. I would like i could only choose as max the number of items that are available.
I'm on prestashop 1.7.6
If anyone could help me it would be nice

×
×
  • Create New...