amorxoigel Posted June 7, 2019 Share Posted June 7, 2019 The question is about having a prompt appearing by default in the dropdown box for a product attribute, rather than the value of the attribute for the default combination. On many websites you would see "--Please Select--" or something similar in the box, and you would not be able to proceed unless you make a selection from the dropdown list. This removes the risk of the customer just placing the default combination in the cart - they would be forced to select the desired attribute(s). This avoids subsequent order queries/amendments, issuing of credit notes, etc. I tried to change the product-variants.tpl by adding this line after the foreach "{if $group.group_type == 'select'} <select class="form-control form-control-select" id="group_{$id_attribute_group}" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" > {foreach from=$group.attributes key=id_attribute item=group_attribute} <option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name}</option> {/foreach} <option value="--choose--" selected="selected" title="--choose--">{l s='--Please select--'}</option> </select>" Now actually when i load a product page it show the "please select" in the select form. The only problem is everytime i select any other value it refresh again and set back to "please select". Any ideas how to solve it? Prestashop 1.7.5.0 themes/xxx/templates/catalog/_partials/product-variants.tpl Thank you guys! Link to comment Share on other sites More sharing options...
JBW Posted June 9, 2019 Share Posted June 9, 2019 Put your option before the foreach and remove the selected="selected" attribute. Link to comment Share on other sites More sharing options...
amorxoigel Posted June 10, 2019 Author Share Posted June 10, 2019 11 hours ago, JBW said: Put your option before the foreach and remove the selected="selected" attribute. Hey, thanks you for ur reply. I already tried what u suggested but it doesnt work. If i do what u suggested when i load the product page it will show the standard combination in the label instead of "please select" 😕 Link to comment Share on other sites More sharing options...
giulym Posted August 26, 2019 Share Posted August 26, 2019 Hi. Did you find a solution? I tried with "required" but it doesn't work. Link to comment Share on other sites More sharing options...
Mikus1234 Posted September 30, 2020 Share Posted September 30, 2020 On 8/26/2019 at 12:30 PM, giulym said: Hi. Did you find a solution? I tried with "required" but it doesn't work. Found this from an outside source. I haven't tested but came across this thread and the below when searching for a fix myself https://www.thekeylesslab.com/2018/06/13/how-to-disable-default-combination-for-products/ Link to comment Share on other sites More sharing options...
JBW Posted September 30, 2020 Share Posted September 30, 2020 You can check out my "Please choose" module. It works with checkboxes, radio options and color selections and is compatible with Prestashop 1.6 and 1.7. Here is the link to the module in the addon store: https://addons.prestashop.com/de/product.php?id_product=47851 Link to comment Share on other sites More sharing options...
Jose Lorenzini Posted October 9, 2020 Share Posted October 9, 2020 add this before your foreach <option value="">--- Select ---</option> Link to comment Share on other sites More sharing options...
JBW Posted October 9, 2020 Share Posted October 9, 2020 1 hour ago, Jose Lorenzini said: add this before your foreach <option value="">--- Select ---</option> This will cause major issue when the customer forgets to choose one attribute and tries to add it to cart. And doesn't work for color or select boxes Link to comment Share on other sites More sharing options...
Jose Lorenzini Posted October 9, 2020 Share Posted October 9, 2020 (edited) works for me , i added this in a select option form in offlinecredit card module , ofcourse you need to do the validation if is empty or not , etcetc Edited October 9, 2020 by Jose Lorenzini (see edit history) 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