stanjones0net Posted December 31, 2016 Share Posted December 31, 2016 How can I hide the quantity and make it with a default of one? Customers can only order one item (kind of like ordering jet airplanes, each order is one airplane). Link to comment Share on other sites More sharing options...
Ricky Blunda Posted January 1, 2017 Share Posted January 1, 2017 (edited) Hi I managed to do this by commenting out sections of code. Locate your "product.tpl" file in your themes folder. You can edit out (i.e. "ignore" sections of code by wrapping it as such: {* UNWANTED CODE *}. Comment out the below lines in your product.tpl file: <p id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}> {*<label for="quantity_wanted">{l s='Quantity'}</label>*} <input type="hidden" min="1" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" /> {*<a href="#" data-field-qty="qty" class="btn btn-default button-minus product_quantity_down"> <span><i class="icon-minus"></i></span> </a> <a href="#" data-field-qty="qty" class="btn btn-default button-plus product_quantity_up"> <span><i class="icon-plus"></i></span> </a> <span class="clearfix"></span>*} </p> Edited January 1, 2017 by Ricky Blunda (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 1, 2017 Share Posted January 1, 2017 what about quantity field and [+] [-] buttons that are avaialble during checkout (cart page) Link to comment Share on other sites More sharing options...
Ricky Blunda Posted January 1, 2017 Share Posted January 1, 2017 @vek: I can help you with that tomorrow if no one else answers before me (its late evening i here in europe). Link to comment Share on other sites More sharing options...
Ricky Blunda Posted January 2, 2017 Share Posted January 2, 2017 (edited) @Vekia: oh, now I recognize you In any case, for those interested to remove quantity fields on the checkout page: you will want to remove both title and the quantity boxes (+/-/value box), else the coloumns will not align correctly. To remove the +/-/value box, comment out this section of code from the file "shopping-cart-product-line.tpl", like so: ------------------------------------------------ {*<td class="cart_quantity text-center" data-title="{l s='Quantity'}"> {if (isset($cannotModify) && $cannotModify == 1)} <span> {if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)} {$product.customizationQuantityTotal} {else} {$product.cart_quantity-$quantityDisplayed} {/if} </span> {else} {if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0} <span id="cart_quantity_custom_{$product.id_product}_{$product.id_product_attribute}_{$product.id_address_delivery|intval}" >{$product.customizationQuantityTotal}</span> {/if} {if !isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0} <input type="hidden" value="{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}_hidden" /> <input size="2" type="text" autocomplete="off" class="cart_quantity_input form-control grey" value="{if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if}" name="quantity_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" /> <div class="cart_quantity_button clearfix"> {if $product.minimal_quantity < ($product.cart_quantity-$quantityDisplayed) OR $product.minimal_quantity <= 1} <a rel="nofollow" class="cart_quantity_down btn btn-default button-minus" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add=1&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&id_address_delivery={$product.id_address_delivery|intval}&op=down&token={$token_cart}")|escape:'html':'UTF-8'}" title="{l s='Subtract'}"> <span><i class="icon-minus"></i></span> </a> {else} <a class="cart_quantity_down btn btn-default button-minus disabled" href="#" id="cart_quantity_down_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" title="{l s='You must purchase a minimum of %d of this product.' sprintf=$product.minimal_quantity}"> <span><i class="icon-minus"></i></span> </a> {/if} <a rel="nofollow" class="cart_quantity_up btn btn-default button-plus" id="cart_quantity_up_{$product.id_product}_{$product.id_product_attribute}_{if $quantityDisplayed > 0}nocustom{else}0{/if}_{$product.id_address_delivery|intval}" href="{$link->getPageLink('cart', true, NULL, "add=1&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&id_address_delivery={$product.id_address_delivery|intval}&token={$token_cart}")|escape:'html':'UTF-8'}" title="{l s='Add'}"><span><i class="icon-plus"></i></span></a> </div> {/if} {/if} </td>*} ------------------------------------------------ And to remove the column title, comment out this section of code from the file "shopping-cart.tpl", like so: ------------------------------------------------ {*<th class="cart_quantity item text-center">{l s='Qty'}</th>*} ------------------------------------------------ That should do the trick! Edited January 2, 2017 by Ricky Blunda (see edit history) Link to comment Share on other sites More sharing options...
stanjones0net Posted January 7, 2017 Author Share Posted January 7, 2017 Thanks, except an installed module is replacing product.tpl and I can't find the relevant code. The second part in the cart works fine. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now