Jump to content
r00tb33r

Disable Default Attribute Values

Recommended Posts

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 by r00tb33r (see edit history)
  • Like 3

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites

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 by c64girl (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites

I'm looking for ideas as well (1.6 or TB)

  • I can set a default product called "choose" as 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.
     
  • Javascript.
    My old html site has something like these examples
    w3schools.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 find
    w3schools.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 by johnrobertson (see edit history)

Share this post


Link to post
Share on other sites

PS 1.6 - possibly solved
TB 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 by johnrobertson (see edit history)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More