r00tb33r Posted February 5, 2016 Share Posted February 5, 2016 (edited) Doh, I wrote a long post, then the forum ate it. Let's try this again. This question, or similar has been asked before, however the answers I've seen are not satisfactory. As of PrestaShop 1.6.1.4 there is still a default combination for a product, however for some attributes this is not logical. For example, people don't come in a default size, therefore it is not logical to have a default t-shirt size or default shoe size. A dropdown should say "Please select" until the customer chose a size. There should not be any value there until the customer puts it there. What the shop should do: 1. Force the customer to choose a size (and not set a default one) 2. Hide the Add to Cart button until a valid attribute value was selected Please suggest how to implement this cleanly. Some of the suggestions I've seen: 1. Use a JavaScript popup to ask the customer if they remembered to change the default attribute value. This is not a good solution because there shouldn't be a default value for some attributes, and JavaScript popups aren't optimal anyway. 2. Add the value "Please select" to each attribute type and set the quantity of the resulting combinations to 0 (zero). This is a bad solution because the shop shows a confusing and misleading message that the product is out of stock, when in fact this is only due to the fact that a valid attribute value has not yet been selected. I consider my question critical as it prevents many ordering mistakes. Please help. Thanks in advance! Edited February 5, 2016 by r00tb33r (see edit history) 4 Link to comment Share on other sites More sharing options...
Casper_O Posted February 23, 2016 Share Posted February 23, 2016 Interesting. I was looking for a solution like this also, hope you came up with something ? Link to comment Share on other sites More sharing options...
afshop Posted March 1, 2016 Share Posted March 1, 2016 Doh, I wrote a long post, then the forum ate it. Let's try this again. This question, or similar has been asked before, however the answers I've seen are not satisfactory. As of PrestaShop 1.6.1.4 there is still a default combination for a product, however for some attributes this is not logical. For example, people don't come in a default size, therefore it is not logical to have a default t-shirt size or default shoe size. A dropdown should say "Please select" until the customer chose a size. There should not be any value there until the customer puts it there. What the shop should do: 1. Force the customer to choose a size (and not set a default one) 2. Hide the Add to Cart button until a valid attribute value was selected Please suggest how to implement this cleanly. Some of the suggestions I've seen: 1. Use a JavaScript popup to ask the customer if they remembered to change the default attribute value. This is not a good solution because there shouldn't be a default value for some attributes, and JavaScript popups aren't optimal anyway. 2. Add the value "Please select" to each attribute type and set the quantity of the resulting combinations to 0 (zero). This is a bad solution because the shop shows a confusing and misleading message that the product is out of stock, when in fact this is only due to the fact that a valid attribute value has not yet been selected. I consider my question critical as it prevents many ordering mistakes. Please help. Thanks in advance! Hi, The default attribute already selected is a big problem for a fashion shop Did you solve it? Thanks Angela Link to comment Share on other sites More sharing options...
paintbox Posted June 15, 2016 Share Posted June 15, 2016 I also have this problem, coming from an HTML background when creating a drop-down there is always the top default value which states "select" or "choose" and then the form cannot be submitted unless a value has been selected meaning not the fist one. This really is pretty basic and I am surprised at this oversite 1 Link to comment Share on other sites More sharing options...
fxdesca Posted June 24, 2016 Share Posted June 24, 2016 any clue on how to solve it ? Link to comment Share on other sites More sharing options...
c64girl Posted July 11, 2016 Share Posted July 11, 2016 (edited) If You have a product that have like 5x attributes and they have quantity more than 0 add one that will have 0. I noticed when You add attribute with quantity 0 to product PS always ask costumer to pick attribute. One problem with this is when You enter Products > Monitoring You will have all products with attributes quantity 0 ;( Edited July 11, 2016 by c64girl (see edit history) 1 Link to comment Share on other sites More sharing options...
peter750 Posted September 6, 2017 Share Posted September 6, 2017 Is there any update on this very annoying bug of feature? 1 Link to comment Share on other sites More sharing options...
MerseyRayUK Posted September 6, 2017 Share Posted September 6, 2017 Whats more annoying with this default attribute.If you have colour options and the default colour is out of stock. The whole product in the categroy view shows as out of stock. If clicking "add to cart" from the category view, a lightbox should pop up and ask which option they want. 1 Link to comment Share on other sites More sharing options...
Dennis Mortensgaard Posted January 7, 2018 Share Posted January 7, 2018 Im having the same issue here - makes no sense with the default attribute - please let us force customers to choose an attribute! 1 Link to comment Share on other sites More sharing options...
tarmogr Posted March 24, 2018 Share Posted March 24, 2018 Still no solution? (ver 1.6) 1 Link to comment Share on other sites More sharing options...
mistertendance Posted September 9, 2018 Share Posted September 9, 2018 i need also a solution for this issue 1 Link to comment Share on other sites More sharing options...
johnrobertson Posted November 7, 2019 Share Posted November 7, 2019 (edited) I'm looking for ideas as well (1.6 or TB) Default product "choose" can be out of stock. The customer sees an out of stock error message like "choose is out of stock" when ordering by mistake. But I have to show other out of stock items; I don't know how to make a special case for the default showing and the other out-of-stock not showing. HTML5 and such are new to me; modern browsers can refuse to select a selection called <select><optgroup>choose</optgroup> <option>small</option> <option>large</option> </select> They also refuse options with disabled written after option, and prefer a value there called value="" over the value the customer sees, so there are HTML methods that someone might know how to use. Javascript. My old html site has something like these examplesw3schools.com/js/js_validation.asp When I look at the source code of Prestashop I.6 I can see stuff about form validation but am not quite sure how to change it. The script could either change viability settings on the order button or pop-up an alert and make the form unusable. Searching for solutions I findw3schools.com/jsref/event_preventdefault.asp ...and that preventdefault is something that people use on Prestashop 1.6 web sites, so this is quite close to a solution. Somebody somewhere must know the answer. Any ideas welcome! Edited December 15, 2019 by johnrobertson added html bit in case it prompts someone (see edit history) Link to comment Share on other sites More sharing options...
johnrobertson Posted November 13, 2019 Share Posted November 13, 2019 (edited) PS 1.6 - possibly solvedTB 1.10 - for drop down menus - SOLVED ... for me at least - with an answer on another forum about a free theme called Niara which might not work on PS1.6 but is pretty similar in the template.tpl file. If the same area about select menus is different in a Prestashop 1.6 theme product.tpl file, you could use an online text comparison tool to find the important change between code snippets below, then guess where to put it in the file. The theme also needs to have a javascript that reacts to non-existent products being displayed. This theme hides the order button when there's a non-existent product. Maybe other themes do. I doubt I can answer questions about it beyond that, but you can find the original post with a search engine and these scripts. Replace this bit of product.tpl with its long option value... {if ($group.group_type == 'select')} <select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="form-control attribute_select no-print"> {foreach from=$group.attributes key=id_attribute item=group_attribute} <option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'html':'UTF-8'}">{$group_attribute|escape:'html':'UTF-8'}</option> {/foreach} </select> {elseif ($group.group_type == 'color')} ...with this replacement that has a shorter option value defined a line further up. It only works on drop-down menus but could probably be adapted. {if ($group.group_type == 'select')} <select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="form-control attribute_select no-print"> <option value="0" selected="selected" title="{l s='Choose'}">{l s='Choose'}</option> {foreach from=$group.attributes key=id_attribute item=group_attribute} <option value="{$id_attribute|intval}" title="{$group_attribute|escape:'html':'UTF-8'}">{$group_attribute|escape:'html':'UTF-8'}</option> {/foreach} </select> {elseif ($group.group_type == 'color')} The new attribute is called "choose", which makes sense and can be translated in the back office. I transcribed this so you can find it with a search engine. Hope it helps someone else as much as it has helped me. Edited November 13, 2019 by johnrobertson (see edit history) Link to comment Share on other sites More sharing options...
Ezequielb Posted April 14, 2020 Share Posted April 14, 2020 Hello, Is there a solution for PS 1.7.6.x? Need to disable the default option and change it to "choose" , also gray out the add to cart button untill an option is selected. Link to comment Share on other sites More sharing options...
JBW Posted April 15, 2020 Share Posted April 15, 2020 I have developed following module which is compatible for 1.7.6 - check out the demo store: https://addons.prestashop.com/de/product.php?id_product=47851 Link to comment Share on other sites More sharing options...
mkdgs Posted March 9, 2021 Share Posted March 9, 2021 There is a quick solution in js, for 1.7 and radio button https://gist.github.com/mkdgs/2463574b05657f4b1ce42d1c146884fe Link to comment Share on other sites More sharing options...
c64girl Posted March 10, 2021 Share Posted March 10, 2021 I just added CSS to hide all the attributes that are not avalable: #product .st_unavailable_combination { display: none !important; visibility: hidden !important; } And changed the translation to pick other attribute 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