Results 1 to 10 of 1125

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    6
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    Quote Originally Posted by s58smith View Post
    You can either comment out the old and paste in the new or you can just replace. Here are the changes you make.

    Copy modules/attributes.php into modules/(your template)/attributes.php

    Make the following two changes to the page.

    Around line 75 change sql. I commented out original and put new below so you could see both. You can just replace the original with the new if you like.

    Code:
                    /*
                    $sql = "select    pov.products_options_values_id,
                            pov.products_options_values_name,
                            pa.*
                  from      " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
                  where     pa.products_id = '" . (int)$_GET['products_id'] . "'
                  and       pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
                  and       pa.options_values_id = pov.products_options_values_id
                  and       pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
                    $order_by;
                    */
                    $sql = "select  pov.products_options_values_id,
                            pov.products_options_values_name,
                            pa.*,
                            pwas.*
                  from      " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_ATTRIBUTES . " pa LEFT JOIN " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas ON pwas.stock_attributes = pa.products_attributes_id
                  where     pa.products_id = '" . (int)$_GET['products_id'] . "'
                  and       pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
                  and       (pwas.quantity > 0 or pwas.quantity IS NULL)
                  and       pa.options_values_id = pov.products_options_values_id
                  and       pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
                    $order_by;
    Around line 105 change the statement you found. Again original in comment above and new below.
    Code:
    /*
                      $products_options_array[] = array('id' => $products_options->fields['products_options_values_id'],
                      'text' => $products_options->fields['products_options_values_name']);
    */
                      if($products_options->fields['quantity'])
                      {
                        $products_text_to_use = $products_options->fields['products_options_values_name'] . " (" .  $products_options->fields['quantity'] . " Available)"; //yes Available is improperly hard coded 
                      } 
                      else 
                      {
                        $products_text_to_use = $products_options->fields['products_options_values_name'];
                      }
                      $products_options_array[] = array('id' => $products_options->fields['products_options_values_id'],
                                                        'text' => $products_text_to_use);
    Now I didn't find this mentioned by anyone else, but I'll give you a heads up. If you plan on having multiple attribute names (not values under a single name) on a product, but only one attribute name will be controlling the quantity you need to do the following or won't display.

    1. Add the attributes controlling quantity first.
    2. Go into Products with Attributes Stock and setup stock. IMPORTANT Do this even on attributes that have no stock presently, but you may add later.
    3. Now go back and add the additional attribute names/values to the product. add those attributes first and then set the quantity.

    Hope you enjoy it. Worked well for me.
    I'd also like to have this work, but when I replaced the code as shown in this post, just a blank page was displayed. I already have "Stock by attribute 4-7 multiadd installed" How do I go about it? (My shop is at http://littleandlovely.com) if you'd like to see.

  2. #2
    Join Date
    Sep 2008
    Posts
    22
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    Quote Originally Posted by Galax View Post
    I'd also like to have this work, but when I replaced the code as shown in this post, just a blank page was displayed. I already have "Stock by attribute 4-7 multiadd installed" How do I go about it? (My shop is at http://littleandlovely.com) if you'd like to see.
    Looked at your site and I have one question. Are you doing a multi attribute quanity?
    For example on this page http://litenoglekker.no/index.php?ma...products_id=18 does size 0/brown have a quantity and size 1/brown a different quantity? If this is yes then the changes you are copy into attributes.php are not going to work for you.

    The changes only work when a single option name. In the category page http://litenoglekker.no/index.php?ma...ex&cPath=20_23 if this was actually a product page and the color was a single option name selection then the changes would work.

    You can see my first sample page at http://www.pot-gardens.com/catalog/i...&products_id=3. The drop down works as only one option name is associated to quantity. (Just be nice as I'm just starting on this site.)

 

 

Similar Threads

  1. v139h Stocks of certain products disappearing automatically
    By Lowwi in forum General Questions
    Replies: 4
    Last Post: 11 Aug 2015, 09:09 PM
  2. Installing Stocks by Attribute
    By dragon03kf in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 26 Oct 2008, 07:42 PM
  3. Stocks by attributes
    By hcd888 in forum General Questions
    Replies: 1
    Last Post: 12 May 2008, 08:52 AM
  4. Multiple stocks per product
    By jaycode in forum General Questions
    Replies: 4
    Last Post: 5 Aug 2007, 11:55 AM
  5. Products with attribute stocks
    By Svanis in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 5 Jul 2006, 03:19 AM

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