Page 5 of 7 FirstFirst ... 34567 LastLast
Results 41 to 50 of 65
  1. #41
    Join Date
    Apr 2009
    Posts
    12
    Plugin Contributions
    0

    red flag Re: Dependant Attributes - Can I do this?

    I'm experimenting with this right now, and it (sort of) works..

    I see the selection boxes, the first one is fully populated, but the second one doesn't include all possible variants..

    Right now I'm just a bit too tired of setting up everything that I can't really see straight and follow the code, so please give me some advice here..


    The generated selection box code on the page is this:
    HTML Code:
    <!--bof Attributes Module -->
    <div id="productAttributes">
      <table border="0" cellspacing="0" cellpadding="2">
        <tr>
          <td class="main" colspan="2"><b>Glöm inte att välja: </b></td>
        </tr>
        <tr>
          <td align="right" class="main"><b>Storlek:</b></td>
          <td class="main"><select name="id[1]" onchange="i1(this.form);">
              <option value="0" selected="selected">First select Storlek</option>
              <option value="1"></option>
              <option value="2">9</option>
              <option value="3"></option>
              <option value="4">10</option>
              <option value="5">10½</option>
              <option value="6">11</option>
            </select></td>
        </tr>
        <tr>
          <td align="right" class="main"><b>Färg:</b></td>
          <td class="main"><select name="id[2]">
              <option value="0" selected="selected">Next select Färg</option>
            </select></td>
        </tr>
        <tr>
          <td colspan="2">&nbsp;
            <script type="text/javascript" language="javascript"><!--
      var stk={1:{8:1,9:1,13:1},2:{8:1,9:1,13:1},3:{8:1,9:1,13:1},4:{8:1,9:1,13:1},5:{8:1,9:1,13:1},6:{8:1,9:1,13:1}};
      var txt2={8:'Svart ',9:'Barely black ',11:'Platina ',12:'Choklad ',13:'Brons '};
      function i1(frm) {
        frm['id[2]'].length=1;
        for (opt in stk[frm['id[1]'].value]) {
          frm['id[2]'].options[frm['id[2]'].length]=new Option(txt2[opt],opt);
        }
      }
      i1(document.cart_quantity);
      function chksel() {
        var ok=true;
        if (this['id[1]'].value==0) ok=false;
        if (this['id[2]'].value==0) ok=false;
        if (!ok) alert('Du måste välja vilken storlek, färg med mera du vill ha.');
        return ok;
      }
      document.cart_quantity.onsubmit=chksel;
    //--></script></td>
        </tr>
      </table>
      <br class="clearBoth" />
    </div>
    <!--eof Attributes Module -->
    But the database contains the proper values, and as far as I can see, quite some more options to choose from in the second selection box.

    Code:
    stock_id ; products_id ; stock_attributes ; quantity ;
    1 ; 4 ; 1,7 ; 500000
    2 ; 4 ; 2,7 ; 500000
    3 ; 4 ; 3,7 ; 500000
    4 ; 4 ; 4,7 ; 500000
    5 ; 4 ; 5,7 ; 500000
    6 ; 4 ; 6,7 ; 500000
    7 ; 4 ; 1,8 ; 500000
    8 ; 4 ; 2,8 ; 500000
    9 ; 4 ; 3,8 ; 500000
    10 ; 4 ; 4,8 ; 500000
    11 ; 4 ; 5,8 ; 500000
    12 ; 4 ; 6,8 ; 500000
    13 ; 4 ; 11,1 ; 500000
    14 ; 4 ; 11,2 ; 500000
    15 ; 4 ; 11,3 ; 500000
    16 ; 4 ; 11,4 ; 500000
    17 ; 4 ; 11,5 ; 500000
    18 ; 4 ; 11,6 ; 500000
    19 ; 4 ; 10,1 ; 500000
    20 ; 4 ; 10,2 ; 500000
    21 ; 4 ; 10,3 ; 500000
    22 ; 4 ; 10,4 ; 500000
    23 ; 4 ; 10,5 ; 500000
    24 ; 4 ; 10,6 ; 500000
    25 ; 4 ; 1,9 ; 500000
    26 ; 4 ; 2,9 ; 500000
    27 ; 4 ; 3,9 ; 500000
    28 ; 4 ; 4,9 ; 500000
    29 ; 4 ; 5,9 ; 500000
    30 ; 4 ; 6,9 ; 500000

  2. #42
    Join Date
    Apr 2009
    Posts
    12
    Plugin Contributions
    0

    Default Re: Dependant Attributes - Can I do this?

    I think I'm on to something...

    In pad_multiple_dropdowns.php there's a query in the beginning that I understand is to get the combinations available, it reads:
    Code:
    $attribute_stock_query = $db->Execute("
    SELECT quantity FROM products_with_attributes_stock AS a LEFT JOIN products_attributes AS b
    ON (b.options_id=". (int)$attributes[$o]['oid'] ."
    AND b.options_values_id=".(int)$attributes[$o]['ovals'][$a]['id'].")
    WHERE a.products_id = '" . (int)$this->products_id . "'
    AND a.stock_attributes = b.products_attributes_id
    AND a.quantity > 0 order by b.products_options_sort_order
    ");
    And I think the problem is in the 'a.stock_attributes = b.products_attributes_id' part..
    a.stock_attributes is a comma delimited varchar field,
    b.products_attributes_id is a integer field in the database.. It's like comparing apples to bananas.

    Like in my case, the query tried to test if the integer 11 is equal to the string "11,6" - Which it can't be of course.

    I need to dig more in this..

  3. #43
    Join Date
    Apr 2009
    Posts
    12
    Plugin Contributions
    0

    Default Re: Dependant Attributes - Can I do this?

    Seems like the biggest problem is how the stock_attributes is populated when using some of the "All" alternatives when adding attributes in admin/products_with_attributes_stock.php

    For some reason, the values are added in the wrong order.. Instead of (example) adding:
    0,4,13
    0,4,14

    the values are added as:
    0,13,4
    0,14,4

    which confuses the parser when reading in the values for populating the selection boxes. Highly annoying since I have some 60-70 combinations per article to enter..

  4. #44
    Join Date
    Apr 2009
    Posts
    12
    Plugin Contributions
    0

    Default Re: Dependant Attributes - Can I do this?

    Can't say if it's "correct", but editing admin/products_with_attributes_stock.php seems to work for me.

    Section:
    Code:
    if(sizeof($attributes) > 1) {
    	sort($attributes);
    	$stock_attributes = implode(',', $attributes);
    } else {
    	$stock_attributes = $attributes[0];
    Comment out the array sort:
    // sort($attributes);

  5. #45
    Join Date
    May 2006
    Posts
    321
    Plugin Contributions
    0

    Default Re: Dependant Attributes - Can I do this?

    I am also having this error:

    1146 Table 'jus0912702071770.products_with_attributes_stock' doesn't exist
    in:
    [SELECT quantity FROM products_with_attributes_stock AS a LEFT JOIN products_attributes AS b ON (b.options_id=3 AND b.options_values_id=5) WHERE a.products_id = '1' AND a.stock_attributes = b.products_attributes_id AND a.quantity > 0 order by b.products_options_sort_order]

    I have added this to database_tables.php
    define('TABLE_PRODUCTS_STOCK', DB_PREFIX . 'products_with_attributes_stock');

    the table is in my database (zen_products_with_attributes_stock), but still the error...help? Please?

  6. #46
    Join Date
    May 2009
    Posts
    25
    Plugin Contributions
    0

    Default Re: Dependant Attributes - Can I do this?

    I have read through this thread and cannot find the answer to my issue. I have installed the stocks by attributes 4.7 and it was working. I then installed the dynamic dropdowns and I am receiving this error,

    1146 Table 'tablename_zc1.products_with_attributes_stock' doesn't exist
    in:
    [select quantity from products_with_attributes_stock where products_id = '2' AND quantity > 0]

    When I check my database, I see this table.

    Please help.

  7. #47
    Join Date
    Oct 2008
    Posts
    28
    Plugin Contributions
    0

    Default Re: Dependant Attributes - Can I do this?

    Hi Jade,

    I noticed that on this Monkey Pants page [http://www.monkeypantskids.com/fuzzi...aper-p-5.html] each colour swatch is shown 3 times. Is this because each colour is in stock in each size?

    The repeated swatches effect does not appear to be happening on other pages, such as [http://www.monkeypantskids.com/thirs...over-p-8.html]. Have you coded this page differently to prevent it happening?

    Also, you asked about displaying stock quantities against attributes - have you had any luck getting this to work?

    Thanks!

  8. #48
    Join Date
    Jan 2010
    Location
    Lake Nocona, Texas
    Posts
    9
    Plugin Contributions
    0

    Default Re: Dependant Attributes - Can I do this?

    I can not find the dependent attributes module in the free software add ons. Can some one tell where it is?
    Jerry

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

    Default Re: Dependant Attributes - Can I do this?

    Quote Originally Posted by jerryclunsford View Post
    I can not find the dependent attributes module in the free software add ons. Can some one tell where it is?
    I suspect that you mean this.
    Kuroi Web Design and Development | Twitter

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

  10. #50
    Join Date
    Jan 2010
    Location
    Lake Nocona, Texas
    Posts
    9
    Plugin Contributions
    0

    Default Re: Dependant Attributes - Can I do this?

    Quote Originally Posted by kuroi View Post
    I suspect that you mean this.
    I have found and installed the The above mentioned mod.
    in another post it was stated you had to install it and the Dependant Attributes mod.
    Please forgive my ignorance I am new to this. Are they in the same package?
    Jerry

 

 
Page 5 of 7 FirstFirst ... 34567 LastLast

Similar Threads

  1. v151 Child/dependant attributes on products?
    By Foster in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 17 May 2013, 07:46 PM
  2. Discounts dependant on attributes
    By lazerradial2003 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 1 Sep 2007, 01:01 PM
  3. Dependant attributes prices
    By redgorilla in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 16 Aug 2007, 12:23 PM
  4. Dependant Attributes
    By Wrongsauce in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 26 Jul 2007, 08:06 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