Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2008
    Posts
    51
    Plugin Contributions
    0

    Default Can dropdown boxes be rescaled?

    I have about 30 attributes inside of a single dropdown box in my product page. So now when I pull down the dropdown box, there is a very long list of attribute choices.

    Is it possible to add code to the dropdown box so that it remains a constant size, displaying only 5 items max and the rest through scrollbars?

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Can dropdown boxes be rescaled?

    Selection boxes can work in two different ways. Either as a dropdown menu that starts as a single line and expands, or as a fixed number of lines with a scroll bar.

    For Zen Cart attributes the code dictates that the options are displayed as a dropdown menu. It would be possible to tweak the code to define a size (i.e. number of rows) to change this to a scroll box. You would do this by over-riding the includes/modules/attributes.php file to add the code highlighted in red below, where xxx is the number of rows that you want. You'll find this code at about line 595 in Zen Cart 1.3.7 or 1.3.8
    $options_menu[] = zen_draw_pull_down_menu('id[' . $products_options_names->fields['products_options_id'] . ']', $products_options_array, $selected_attribute, 'id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '" size="xxx"') . "\n";
    Note, though that this will change all dropdown menus used for displaying attributes. If you wanted to restrict this change to a particu;ar attribute, you would need to insert some conditional code based on the products option id.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Mar 2008
    Posts
    51
    Plugin Contributions
    0

    Default Re: Can dropdown boxes be rescaled?

    thank you kuroi. The designated size of the attribute box is what I wanted and the code worked out nicely.

    Do you think it is possible to add an option in the product view to let the customer switch styles of the attributes from a fixed box with scrollbars to a checkbox?

  4. #4
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Can dropdown boxes be rescaled?

    I guess they could. It would require a number of tweaks, but here are the two most important to get you started.

    Go back into your override version of the attributes.php module and find the folowing at about line 177
    PHP Code:
    // prepare product options details
    $prod_id $_GET['products_id'];
    //die($prod_id); 
    Immediately afterwards add
    PHP Code:
    if ($_GET['checkboxes'] && $products_options_names->fields['products_options_type'] == ) {
      
    $products_options_names->fields['products_options_type'] = PRODUCTS_OPTIONS_TYPE_CHECKBOX;

    Then find the following (now at about line 597)
    PHP Code:
    $options_name[] = '<label class="attribsSelect" for="' 'attrib-' $products_options_names->fields['products_options_id'] . '">' $products_options_names->fields['products_options_name'] . '</label>'
    and extend it to
    PHP Code:
    $options_name[] = '<label class="attribsSelect" for="' 'attrib-' $products_options_names->fields['products_options_id'] . '">' $products_options_names->fields['products_options_name'] . '</label>' '<a href="' zen_href_link(FILENAME_PRODUCT_INFO'cPath=' $_GET['cPath'] . '&products_id=' $prod_id '&checkboxes=1') . '">click to show as checkboxes</a>'
    This will work but is most likely just a beginning. You would also want to style the link, the option titles (or at least this one to give it a line of its own) and the checkboxes. The link text should really be moved into a language file. And you may wish to restrict this visitor option to a particular products or even specific option by tweaking the first change, and make it persistent by recording use of the link in a session variable or cookie and using that in the first condition instead of using the $_GET parameter directly.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  5. #5
    Join Date
    Apr 2008
    Posts
    24
    Plugin Contributions
    0

    Default Re: Can dropdown boxes be rescaled?

    Thanks Kuroi
    for pointing out the option_menu[] code fragment. it solved many problems for me. added style="width:150px"; to increase the width of the option menu.
    thanks.
    i tried to increas the character size and display in the arrtibue controller but it did not worked so had to do manually.

    but still work searching

    regards
    salman

 

 

Similar Threads

  1. v151 Editing the design of Quantity boxes or other boxes such as the filter dropdown box
    By lornski_b in forum Templates, Stylesheets, Page Layout
    Replies: 13
    Last Post: 3 Oct 2013, 05:45 PM
  2. dropdown boxes
    By psychosis in forum General Questions
    Replies: 1
    Last Post: 19 Aug 2010, 01:02 AM
  3. multiple dropdown selection boxes
    By swdynamic in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 5 Aug 2010, 09:33 PM
  4. How can I create several informational dropdown boxes for a product?
    By UnrealPHD.com in forum Basic Configuration
    Replies: 1
    Last Post: 30 Apr 2010, 01:44 AM
  5. Dropdown Boxes and --None--
    By Darkwander in forum General Questions
    Replies: 0
    Last Post: 14 Sep 2006, 06:22 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR