Page 63 of 113 FirstFirst ... 1353616263646573 ... LastLast
Results 621 to 630 of 1125
  1. #621
    Join Date
    Sep 2008
    Posts
    22
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    Quote Originally Posted by kellan4459 View Post
    You can see the example at
    http://www.tks-atl.com/index.php?mai...products_id=68

    Hopefully that clears it up a little and is what Cropinstop is also trying to accomplish
    I'm trying accomplish the exact same dropdown as displayed in the example above. I believe I modified the sql successfully on attributes.php.

    My question is what php was changed to get the quanity to display inside the dropdown next to selection?

    Thanks

  2. #622
    Join Date
    Nov 2008
    Posts
    53
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    Hello Kellan,

    Were does this peace of code have to go, were do i put it ?

    regards,



    Quote Originally Posted by kellan4459 View Post
    I added the following to make the quantity show in select boxes if a quantity is specified for the individual attribute since some of my products will use the Item Quantity and not an individual item attribute quantity.


    Code:
    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);

  3. #623
    Join Date
    Sep 2008
    Posts
    22
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    Quote Originally Posted by karimm View Post
    Were does this peace of code have to go, were do i put it ?
    Thanks for the post karimm, I must have missed seeing that code in earlier post. It was the missing item text/code I was just asking about above.

    It goes into attributes.php right around line 105, depends if already made the change for the sql statement in same file, also posted by kellan.

    Thanks

  4. #624
    Join Date
    Nov 2008
    Posts
    53
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    i have this code around line 105.

    $products_options_array[] = array('id' => $products_options->fields['products_options_values_id'],
    'text' => $products_options->fields['products_options_values_name']);


    ----------

    do i have to overwrite it or just put i in ?

    please send me a peace of your code with the adjustment.

    Thanks

  5. #625
    Join Date
    Sep 2008
    Posts
    22
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    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.

  6. #626
    Join Date
    Sep 2008
    Posts
    22
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    Corrections to my test below.
    Quote Originally Posted by s58smith View Post
    3. Now go back and add the additional attribute names/values to the product. add those attributes first and then set the quantity.

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

    Example:
    Is having some attributes that are "read only" to give additional information about a product. But they don't effect overall quantity. If you attach two attribute names to a product when you go to build the quantity with attributes by stock it will build a cross table of multiple values and the code above won't work.

  7. #627
    Join Date
    Nov 2008
    Posts
    53
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    thanks alot for you help, it works like a charm.

  8. #628
    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.

  9. #629
    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.)

  10. #630
    Join Date
    Nov 2008
    Posts
    53
    Plugin Contributions
    0

    Default Re: Stocks by attributes

    Would it also be possible to add the text sold out to the dropdown list, when the stock is 0 ? and if the customer selects a sold out product he/she will not get the checkout button of instead of the button the text wil appear that that option is unavaible !

 

 
Page 63 of 113 FirstFirst ... 1353616263646573 ... LastLast

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

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