Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    16
    Plugin Contributions
    0

    Default attribute boxes with unique ids help

    So I have a product that is a kit/assortment that will be filled with specific items the user chooses.
    I've customized my attributes divs so they can be boxes that are side by side (to represent the cells in the kit).
    the pictures in this link will give you an idea of what i'm trying to accomplish
    http://imgur.com/a/XmXlh

    I'm trying to give each attribute div its own unique id.
    All this is to be able to spread the bottom 3 cells(divs) evenly.

    the edit i made obviously doesn't work and have replaced the highlighted area with:
    <?php echo $products_options_names->fields['products_options_id'][$i]; ?>

    but... only the first cells gets a correct id, the "cell2" get id=5 (what's up with that?) , and the rest are blank.

    I need some php code that will properly display the attribute id

  2. #2
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    16
    Plugin Contributions
    0

    Default Re: attribute boxes with unique ids help

    I solved it!
    made a new variable called:
    $option_id[] = 'attrib-' . $products_options_names->fields['products_options_id'];
    placed it right after "normal dropdown menu display" in attributes.php
    then in tpl_module_attributes put it in like this
    <div class="wrapperAttribsOptions" id="<?php echo $option_id[$i]; ?>">
    and bang! divs with ids that reflect the option id number

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

    Default Re: attribute boxes with unique ids help

    Good for you! That is part of what Flexible Attributes in Plugins does, if you want to look at another version of the functionality.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: attribute boxes with unique ids help

    The generated attributes HTML already includes an ID with each pulldown menu's markup:
    PHP Code:
                      $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'] . '"') . "\n"
    I must be misreading what you meant to say about what was missing.

    Aren't you causing multiple identical ID tags to be output to your page, thus breaking validation?
    ie:
    Code:
    <div class="wrapperAttribsOptions" id="attrib-2"> 
    <h4 class="optionName back"><label class="attribsSelect" for="attrib-2">Size</label></h4> 
    <div class="back">
    <select name="id[2]" id="attrib-2">
      <option value="19">X-Small</option>
      <option value="21">Small</option>
      <option value="18" selected="selected">Medium</option>
      <option value="20">Large</option>
    </select>
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

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

    Default Re: attribute boxes with unique ids help

    The actual input part of each attribute is uniquely identified as stock, but the wrappers are not necessarily unique, making it trickier to control them as a unit. This is a large part of what Flexible Attributes addresses, using ids like #wAttrib23 so as not to interfere with other attribute-specific ids.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: attribute boxes with unique ids help

    Good. :)

    Mikey D will probably want to make some small adjustments then ;)
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Replies: 6
    Last Post: 7 Mar 2013, 04:36 PM
  2. Creating Unique Product Ids based on Attributes
    By TwitchDesign in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 9 Mar 2011, 08:42 PM
  3. Reset prod IDs and Categories IDs
    By savchenko01 in forum General Questions
    Replies: 2
    Last Post: 31 Jan 2011, 05:21 PM
  4. Unique quantity for each attribute
    By Pengus in forum General Questions
    Replies: 2
    Last Post: 2 Jul 2009, 06:13 PM
  5. Product Attribute Variations with Unique Model#s?
    By smap in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 17 Oct 2007, 11:58 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