Page 304 of 359 FirstFirst ... 204254294302303304305306314354 ... LastLast
Results 3,031 to 3,040 of 3589
  1. #3031
    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
    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 Attachment 18079
    and this is no attribute quantity Attachment 18080
    Finally being able to zoom in on these two images, I see that they are as later reported related to the shipping module, so hopefully the other assistance provided clarifies
    (or closely clarifies)
    this issue.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #3032
    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 will come back to this, very busy

  3. #3033
    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 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
    Couple of things.

    SBA works off of two stock quantities, 1 for the specific attribute (attribute combination when more than one attribute is involved) and the quantity of product identified overall for the product.
    Deleting the attribute(s) from the product and reassigning them does not change the non_stock table. This means that if an action hasn't been taken to remove the entries from the non-stock table, then the ones previously assigned remain in place and will cause the single dropdown option to appear to have the quantity available that is entered for the overall product once those attributes are again assigned to the product and the product assigned to SBA.
    The recommendation I made a few days ago to change return false to return true will cause the shopping_cart page to only support a quantity of 1 existing in the cart, even though on the product page it will appear that there are more available. The "value" returned should be the quantity of product that are purchasable at that time (either some sort of total quantity of all available product or perhaps some sort of maximum per purchase. This portion of the code as previously said had not been flushed out. Even now with this new concept of using it there are additional caveats to consider.
    If configuration->stock->subtract stock is true, then with each purchase, the total available quantity will decrease for both the attribute and the overall product quantity. So, recommend considering how the store's stock is used when trying to flush out operation. At the moment there is no individual setting against SBA that would prevent this decrease for either/both values other than the above described stock setting.

    So I hope that with any combination of the above information at least there is some more understanding. Of course I'd like to finish off the section of code in question.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #3034
    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 still have this changed to true
    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;
    For test2 I have now added two attributes. the first one is pick type of vinyl, the second one is to pick color. It works, but the colors I have shown in zc_products_with_attributes_stock_attributes_non_stock is what it shows as in stock.

  5. #3035
    Join Date
    Jan 2013
    Posts
    898
    Plugin Contributions
    0

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


    How do i incorporate this into code above. if products qty 0 and products attribute stock 0 this item is nonstock.
    if products qty 1 and products attribute stock 0 this item is nonstock,
    if products qty 0 and products attribute stock 1 this item is instock, etc.

  6. #3036
    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;
            }
    Quote Originally Posted by mc12345678 View Post
    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);
    Quote Originally Posted by jimmie View Post
    How do i incorporate this into code above. if products qty 0 and products attribute stock 0 this item is nonstock.
    if products qty 1 and products attribute stock 0 this item is nonstock,
    if products qty 0 and products attribute stock 1 this item is instock, etc.
    Mind you, there is also a function that has been incorporated/modified for SBA called zen_check_stock, which returns a string of text if the product is out-of-stock (less than zero would remain if the provided quantity to be removed from the stock would cause the quantity to be less than zero).

    The modified version of this call is: zen_check_stock($products_id, $quantity_to_try_to_obtain, $attributes);
    In your case, the second parameter would be $qty.

    While on the surface of things I would approach this differently, I have used the code I previously provided in the below since you have indicated that you want to know the actual numbers involved and not just whether the item would be in stock or not based on the program/code written to provide that information (zen_check_stock).


    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"]; */
    
                $attributes = null;
    
                if (isset($product['attributes'])) {
                  $attributes = $product['attributes'];
                }
    
                $quantityAttrib = zen_get_products_stock($products_id, $attributes);
                $quantityProd = zen_get_products_stock($products_id);
    
                /* Do whatever is necessary to mark product as in stock here in place of this comment block and then below take action if it is identified as out-of-stock  */
                $quantity = $qty;
    
                if (isset($attributes) && $quantityAttrib <= 0) {
                 /* out-of-stock */
                 /* This if block says that if there are attributes associated with the product (assuming all of the appropriate attributes have been provided)
                    and those attributes have made it such that there are no attribute related product then the product is considered out-of-stock
                    regardless of the quantity of the original product.
                 */
                 $quantity = $quantityAttrib;
                } else if (!isset($attributes) && $quantityProd <= 0) {
                  /* out-of-stock */
                  /* This block identifies that the product is out-of-stock based on not having attributes and the quantity available associated is out-of-stock.*/
                  $quantity = $quantityProd;
                }
     
                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;
            }
    Now, I note that here in the "shipping" page you are trying to assign/capture the current stock status. I don't know if the above is a one time only check or will be called again just before closing out the order during the order generation process. But there is a stock check evolution performed in checkout_confirmation processing to try to prevent an individual from checking out with product that have "just" been purchased by someone else. Further though, the session variables set here could become out-of-date if the purchase is not pushed through "quickly" and someone else purchases those items.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

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

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

    Thank you, u already know you are a coding genius, LOL
    one more thing, when products are not in stock a banner in reds tells the customer this, but banner doesnt show with attributes out of stock

  8. #3038
    Join Date
    Jan 2013
    Posts
    898
    Plugin Contributions
    0

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

    im sorry code did not work, i have a product attribute in cart with 0 Quantity, but product has 10000 quantity and it istrying to ship it as stock, should ship as a special order,(from Vendor)

  9. #3039
    Join Date
    Jan 2013
    Posts
    898
    Plugin Contributions
    0

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

    Product in question https://jnsflooringandsupplies.com/i...860adc5a9a58d1
    i disabled nonstock method from showing in shopping cart, i put a #1 in front of stock method title to know the different methods, there is a third shipping called stock an nonstock, when stock and nonstock are in cart.
    Last edited by jimmie; 26 Oct 2018 at 11:07 PM.

  10. #3040
    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

    I just was able to add a "special order" product to the cart and was provided a notification that there was special ordering required (when viewing shipping options from the shopping cart page), I added an instock product and had the same options overall, then removed the special order product and was provided a different series of shipping options. Don't recall which "special order" product I selected, but from my perspective and limited knowledge of the site, it seemed like *something* was handled correctly.
    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