Page 303 of 359 FirstFirst ... 203253293301302303304305313353 ... LastLast
Results 3,021 to 3,030 of 3589
  1. #3021
    Join Date
    Jan 2014
    Posts
    223
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    I ran the following sql files
    Installation
    Full/Upgrade DB Install
    Full, makes all script changes to the database (DB) (i.e., adds new SBA table, adds entries into the Admin page, and new entries into the Configuration file).
    Upgrade, updates Configuration file and the SBA table as needed. If run again, it will "Clean" table entries and reapply the settings, it will not affect current data in the "products_with_attributes_stock" table.

    and Add all Product Attributes

  2. #3022
    Join Date
    Jan 2014
    Posts
    223
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    So if for each item I set up the quantity for each color individual it will work. Click image for larger version. 

Name:	Image3.jpg 
Views:	69 
Size:	75.1 KB 
ID:	18076
    If I set just the pick color so it will run SBA Click image for larger version. 

Name:	Image4.jpg 
Views:	64 
Size:	13.6 KB 
ID:	18077
    it only shows pick color in stock and all others are out of stock.
    Click image for larger version. 

Name:	Image5.jpg 
Views:	40 
Size:	58.6 KB 
ID:	18078

  3. #3023
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    Quote Originally Posted by cubmanky View Post
    So I grabbed the files from https://github.com/mc12345678/Stock_...butes_Combined and uploaded them to my site. I ran the above script and looking in and the attribute type is set to AV, Still no luck. On test product I have set the qty for each color individual. for test2 product I just made pick a color at 100 units I have in the out of stock that white is out. Still any color i click on will tell me out of stock when i try to click to add it to the cart.
    Unfortunately I'm having to look into this as my tests being run in parallel with yours are also not working as expected. I've even gone into the class file and changed the setting that is supposed to determine the attribute stock presence by either first looking at the loaded stock or by looking at the non_stock table and ignore the SBA quantity variant.

    I needed to look more at the code with the proposed setup in mind. I couldn't seem to recall if/how other settings came into play such as checking the stock level, reducing stock after purchase, allowance for overselling, etc... I knew that when it was first incorporated and publicized, it worked...

    Mind you, when this was first incorporated the primary thought/concern was what was considered the "gift" option. A choice that could be made that would *always* be available when selecting other attributes that were related to the stock of the product... So, what that meant was that there would always be at least 2 attributes (2 option names) with every product except for some specific characteristic type attributes (Files and text boxes)... Well, development was considered for the single attribute product, but it was not completed. Further, I built in a sort of "safety" of overselling product by causing those such options to not support the non-stock characteristics. Could have left just a little more of a note to myself; however, had commented the area about what needed to be done not so much of how it behaved currently.

    Anyways, if you go to includes/classes/class.products_with_attributes_class_stock.php and then modify line 1351 from:
    Code:
            return false;
    to:
    Code:
            return true;
    Then when the product has a single attribute and the option values/option names are identified as being non-stock, if the option value is not assigned to SBA, it will be possible to select it and add it to the cart. The total available will be identified as the quantity of product as entered in the product information page.

    One thing about it though is that I had set aside some comments in that area of things I thought would be valuable to address to ensure that the data pushed would be validated. I'll get to it, but at least you can get through this issue now. There are a few things to consider as I realized when working with a single attribute that if the option value is not captured in SBA then a quantity is displayed, but when I tried to add the product to the cart, the cart notified that the option wasn't available, even though it appeared in the list. I've spent a great deal more on multiple attributes than single attributes, so need to go back and revisit that operation and functionality.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #3024
    Join Date
    Jan 2014
    Posts
    223
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    First I'm glad its not something on my end as you are having the issue.
    I made the change and updated the file on my site
    On my test2 product it shows all colors in stock. On white I have it still set as out of stock. I click white color and pick 5 then click add to cart It adds them but tells me 1 available.

  5. #3025
    Join Date
    Jan 2014
    Posts
    223
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    SO I went in a deleted all variants for test2 then went back and added 100 to pick a color and I get the error Product 23 update failed: IT still shows 100 for each color in the dropdown window
    Last edited by cubmanky; 20 Oct 2018 at 05:06 AM.

  6. #3026
    Join Date
    Jan 2013
    Posts
    898
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    when a product is out of stock, mark_product_out_of_stock it looks at products_quantity to determine this, A splash screen in red shows up and informs the customer, and the products are marked out of stock(Special Ordered) how can i also get it to look at the attribute stock, and show that same splash screen. some of the attributes are instock and some are not but the products quantity has quantity from the ones that do.
    this is when no product quantity Click image for larger version. 

Name:	Screenshot_2018-10-20 The Shopping Cart JNS Flooring and Supplies Inc , All About Floors Floorin.jpg 
Views:	72 
Size:	35.9 KB 
ID:	18079
    and this is no attribute quantity Click image for larger version. 

Name:	Screenshot_2018-10-20 The Shopping Cart JNS Flooring and Supplies Inc , All About Floors Floorin.png 
Views:	80 
Size:	14.0 KB 
ID:	18080

  7. #3027
    Join Date
    Jan 2013
    Posts
    898
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    i modified a shipping module to detect out of stock to ship another way so having a problem looking at attribute stock to determine
    ex.
    Code:
    // Variable holds information about the products in the order
    		$this->_products = $_SESSION['cart']->get_products();
    		$_SESSION['cart']->shopping_stock = 1;
    		$inStock = 0;
            $outStock = 0;
            $_SESSION['cart']->in_stock_products = [];
            $_SESSION['cart']->out_stock_products = [];
    		foreach ($this->_products as $product) {
    			$pid = $product["id"];
    			$qty = $product["quantity"];
    			$product_query = "select products_quantity
                              from " . TABLE_PRODUCTS . "
                              where products_id = '" . (int)$pid . "'";
          			$product = $db->Execute($product_query);
    			$quantity = $product->fields["products_quantity"];
    
    
                if ($quantity < $qty){
                    $_SESSION['cart']->shopping_stock = 2;
                    array_push($_SESSION['cart']->out_stock_products,(int)$pid);
                    $outStock = 1;
    
                }else{
                    $_SESSION['cart']->shopping_stock = 1;
                    array_push($_SESSION['cart']->in_stock_products,(int)$pid);
                    $inStock = 1;
                }
    		}
            if($outStock == 1 && $inStock == 1 && count($this->_products) > 0){
                $_SESSION['cart']->shopping_stock=3;
            }

  8. #3028
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    Quote Originally Posted by jimmie View Post
    i modified a shipping module to detect out of stock to ship another way so having a problem looking at attribute stock to determine
    ex.
    Code:
    // Variable holds information about the products in the order
    		$this->_products = $_SESSION['cart']->get_products();
    		$_SESSION['cart']->shopping_stock = 1;
    		$inStock = 0;
            $outStock = 0;
            $_SESSION['cart']->in_stock_products = [];
            $_SESSION['cart']->out_stock_products = [];
    		foreach ($this->_products as $product) {
    			$pid = $product["id"];
    			$qty = $product["quantity"];
    			$product_query = "select products_quantity
                              from " . TABLE_PRODUCTS . "
                              where products_id = '" . (int)$pid . "'";
          			$product = $db->Execute($product_query);
    			$quantity = $product->fields["products_quantity"];
    
    
                if ($quantity < $qty){
                    $_SESSION['cart']->shopping_stock = 2;
                    array_push($_SESSION['cart']->out_stock_products,(int)$pid);
                    $outStock = 1;
    
                }else{
                    $_SESSION['cart']->shopping_stock = 1;
                    array_push($_SESSION['cart']->in_stock_products,(int)$pid);
                    $inStock = 1;
                }
    		}
            if($outStock == 1 && $inStock == 1 && count($this->_products) > 0){
                $_SESSION['cart']->shopping_stock=3;
            }
    There's already a ZC function that determines the stock availability which SBA "hooks" into (reason the includes/functions/functions_lookups.php file requires modification in ZC 1.5.5 and below. In ZC 1.5.6 there is expected to be code that will be in place and won't require modification of that file). There is also a function in the includes/classes file added for SBA that also supports, but I would recommend using the modified SBA function if for any reason SBA is removed.

    The modification made to the function is to obtain/use the attributes of the product and from there determine if it is tracked by SBA and what the associated stock is. That function is:
    Code:
    zen_get_products_stock($products_id, $attributes = null, $dupTest = null)
    You only need to pass the first two parameters. I'm not where I can easily identify (and at the moment don't remember) the makeup of the attributes portion off of a cart's entry to say what it takes to pull the attributes off of the product information. I'd have to get back to you if you don't know/find it.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #3029
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    Found it:

    $_SESSION['cart']->contents[$products_id]['attributes']
    or as used above:
    $product['attributes']

    So something like:
    Code:
     $attributes = null;
    if (isset(
    $product['attributes']) { $attributes =
    $product['attributes']; } $quantity = zen_get_products_stock($products_id, $attributes);


    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #3030
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    Quote Originally Posted by mc12345678 View Post
    Found it:

    $_SESSION['cart']->contents[$products_id]['attributes']
    or as used above:
    $product['attributes']

    So something like:
    Code:
     $attributes = null;
    if (isset(
    $product['attributes'])) { $attributes =
    $product['attributes']; } $quantity = zen_get_products_stock($products_id, $attributes);


    Darnit, forgot a right parenthesis on the if statement line. Just happened to be looking over the code and see the imbalance.
    Code:
     $attributes = null;
    if (isset($product['attributes'])) {
      $attributes = $product['attributes'];
    }
    
    $quantity = zen_get_products_stock($products_id, $attributes);
    Last edited by mc12345678; 21 Oct 2018 at 02:05 PM.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Problems with addon: Dynamic Drop Downs for Stock By Attribute
    By Dunk in forum All Other Contributions/Addons
    Replies: 56
    Last Post: 30 Apr 2014, 07:55 PM
  2. MySQL Problem with Product with Attribute Stock addon
    By rtwingfield in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 20 Sep 2011, 03:35 PM
  3. Hide Zero Quantity Attributes with attribute-stock addon
    By leevil123 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 11 Feb 2010, 05:06 PM
  4. Replies: 4
    Last Post: 22 Jan 2010, 10:43 PM
  5. Price Products in the grid by 'Stock by Attribute' addon?
    By Salixia in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 27 Oct 2009, 06:03 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