Results 1 to 6 of 6
  1. #1

    Default Hiding the 'default' option for required attributes

    Hi

    I would like to hide the default attribute - either when it is a radio box or as a dropdown so that the user only 'sees' the actual options rather than the one that says 'please choose' or whatever.

    My product I am testing on is at http://singleswalking.co.uk/index.ph...&products_id=9

    I had thought to make the default option sort order something like 99 and then use an if statement to say if the option is 99 then don't display it. Would that work?

    I don't know PHP very well so I am not sure I can fiddle the code although I sort of understand the logic I want.

    Any help gratefully received.


    Christine

  2. #2

    Default Re: Hiding the 'default' option for required attributes

    Hi

    I have moved a bit closer... by adding the following code I now have it doing something different for the default option as long as that default option is 'Please choose' and has a stock level of 0...

    But what I really want is not to display it at all - I tried that, but I still got the radio button.... I am actually happy to have the text 'Please choose' but I don't want the radio button to show.

    Help!

    Christine

    Here is my code

    if ($products_options->fields['quantity'] > 0)
    {
    $products_options_details = $products_options->fields['products_options_values_name'] . ' [' . TEXT_ATTRIBUTES_IN_STOCK . ']';
    } else {
    //next line checks to see if name of option is Please choose - so doesn't display out of stock message
    if ($products_options->fields['products_options_values_name'] == 'Please choose')
    {
    $products_options_details = '' . TEXT_ATTRIBUTES_DEFAULT . '';
    }
    else {
    $products_options_details = $products_options->fields['products_options_values_name'] . '[' . TEXT_ATTRIBUTES_NOT_IN_STOCK . ']';
    }
    }

    } else {
    // don't show option value name on TEXT or filename
    $products_options_details = '';
    }
    if ($products_options_names->fields['products_options_images_style'] >= 3) {
    $products_options_details .= $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : '');

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Hiding the 'default' option for required attributes

    You can suppress the display of any particular radiobutton with CSS, as they all have unique id's assigned by Zen Cart. For example, for your Quainton 1st January (25-45):
    Code:
    input#attrib-2-4, input#attrib-2-4+label {display: none;}
    The labels are all assigned the same class, but you can address a particular label by combining it with the input ahead of it (input#attrib-2-4+label). Class name not even needed here!

    I believe you will find that all instances of this particular radiobutton will now be suppressed, as the id is based on the option name and value.

  4. #4

    Default Re: Hiding the 'default' option for required attributes

    Thanks!

    It seems to work great in Firefox, but not in IE???

    Tis late so will try again in the morning, maybe its a cache problem.

    Christine

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Hiding the 'default' option for required attributes

    I wouldn't be surprised if the input#attrib-2-4+label didn't work in IE, as IE6 doesn't know how to handle adjacent sibling selectors (the "+"). But the input#attrib-2-4 should work in any browser, because that is fundamental CSS.

  6. #6

    Default Re: Hiding the 'default' option for required attributes

    Thanks Glenn

    I wasn't sure what to do about the bit that IE wouldn't support - so I took it out altogether and now it works in both browsers!

    Excellent!


    Christine

 

 

Similar Threads

  1. Required option on attributes has suddenly stopped working?
    By Argyle in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 23 Dec 2011, 11:31 AM
  2. Is Custom folder backup required for Option Name/Option Value creation?
    By MrRobert in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 18 Sep 2009, 10:57 AM
  3. Default Attributes for Category or Add Attributes when Creating Products
    By vegascoug in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 17 Sep 2009, 12:03 AM
  4. hiding the download option????
    By AliciaB in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 9 Nov 2006, 03:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg