Results 1 to 10 of 13

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Problem with products not switching off when out of stock..

    Hi Everyone

    Im hoping you can help. For some strange reason whether my

    Configuration/Stock/Products status in Catalog when out of stock should be set to

    is set to 0 or 1, neither is turning my products off when out of stock???

    Is this a known issue, it is only recently I am trying to use this feature and do not know if it has occurred since installing other mods or customizing my zen??

    is there any specific code I can check??

    Any Help or Direction would be very much appreciated..

    Regards
    Phil


  2. #2
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,033
    Plugin Contributions
    31

    Default Re: Problem with products not switching off when out of stock..

    Quote Originally Posted by philip937 View Post
    Hi Everyone

    Im hoping you can help. For some strange reason whether my

    Configuration/Stock/Products status in Catalog when out of stock should be set to

    is set to 0 or 1, neither is turning my products off when out of stock???

    Is this a known issue, it is only recently I am trying to use this feature and do not know if it has occurred since installing other mods or customizing my zen??

    is there any specific code I can check??

    Any Help or Direction would be very much appreciated..

    Regards
    Phil

    This fix might help

  3. #3
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Problem with products not switching off when out of stock..

    Quote Originally Posted by clydejones View Post
    I might need more guidance on this. My standard product listings are showing out of stock products even when change status to 0 is selected. I'm not sure how to use the suggested fix for the New and upcoming products to fix my problem.

    Thanks
    Phil

  4. #4
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Problem with products not switching off when out of stock..

    Quote Originally Posted by philip937 View Post
    I might need more guidance on this. My standard product listings are showing out of stock products even when change status to 0 is selected. I'm not sure how to use the suggested fix for the New and upcoming products to fix my problem.

    Thanks
    Phil
    I looked in /includes/modules/products_listing.php and there doesn't seem to be any similar code to the suggested support thread? im lost, no idea where to begin looking.

  5. #5
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Problem with products not switching off when out of stock..

    Your problem could be related to many things, including:
    a) manually injecting product and attribute records instead of using the built-in UI designed for that purpose: http://www.zen-cart.com/forum/showthread.php?t=138644
    b) using an addon that replaces the normal stock-handling logic http://www.zen-cart.com/forum/showth...881#post790881
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default

    Quote Originally Posted by DrByte View Post
    Your problem could be related to many things, including:
    a) manually injecting product and attribute records instead of using the built-in UI designed for that purpose: http://www.zen-cart.com/forum/showthread.php?t=138644
    b) using an addon that replaces the normal stock-handling logic http://www.zen-cart.com/forum/showth...881#post790881
    Assuming it's one of these 2, I'm going to for now assume it's not b as no one else using stock by attributes seems to have this problem. So if it's a, please help me understand the normal logic, if I manually inject stock levels, which yes I am, I would have thought this to be no different than setting a stock level to 0 through the admin UI? Ontop of which surely all the change status of product when stock is zero, just checks the value of the product_id's stock?

    When I set an out of stock image to be placed next to a product listing when out of stock, this works fine, so zen must be recognising these levels regardless of manually setting stock levels no?

    If you can explain to me the zen functions when calculating whether or not a products status should be on or not perhaps I can either check mines not corrupt or maybe adapt for the way I'm using zen?

    Many Thanks
    Phil
    Posted via Mobile Device

  7. #7
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Problem with products not switching off when out of stock..

    I'm not convinced that it's not your addon.

    But if you've not set the out-of-stock product-status to 0 then it's not going to work either.

    You can see that the code in a clean install of Zen Cart properly sets the product status to 0 by looking for this in the order.php class file:
    Code:
     if (SHOW_PRODUCTS_SOLD_OUT == '0') {
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default

    I have set the out of stock status to 0, and it didn't work that's the point I figured there was something up.

    I haven't however looked in order.php class file, so I shall check that this code is there I guess? So that is the code that the setting in configuration/stock looks at right?

    Phil
    Posted via Mobile Device

  9. #9
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Problem with products not switching off when out of stock..

    Quote Originally Posted by DrByte View Post
    I'm not convinced that it's not your addon.

    But if you've not set the out-of-stock product-status to 0 then it's not going to work either.

    You can see that the code in a clean install of Zen Cart properly sets the product status to 0 by looking for this in the order.php class file:
    Code:
     if (SHOW_PRODUCTS_SOLD_OUT == '0') {
    I am just looking at the code you said about, I have the follwoing:

    PHP Code:
            if ($stock_left <= 0) {
                
    // only set status to off when not displaying sold out
                
    if (SHOW_PRODUCTS_SOLD_OUT == '0') {
                  
    $db->Execute("update " TABLE_PRODUCTS " set products_status = 0 where products_id = '" zen_get_prid($this->products[$i]['id']) . "'"); 
    So does this database queery only take place when a product is checked out and stock then reaches 0? If so the option works differently to how i imagined, I thought that if you set the option to turn product status to 0 if out of stock it would just not show any products with stock less that 0 in the prduct listings???

    Is there a way to do what I need it to do? so effectively hide all product_id's where their stock level is less than 0???

    I really really dont want out of stock products showing

  10. #10
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Problem with products not switching off when out of stock..

    The simplest way to do that is to go and set the products_status to 0 for all your products whose stock is less than 1.

    Or, you can go through every query in the core code and adjust it to suit your own needs.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v139h manually set item with out of stock notice but not shut the item off?
    By djtrillian in forum General Questions
    Replies: 14
    Last Post: 21 Mar 2014, 06:56 PM
  2. Help with sorry,product not avail. (when out of stock)
    By prissypups in forum Basic Configuration
    Replies: 2
    Last Post: 30 Nov 2009, 04:55 PM
  3. Products with Attributes - Problem when attribute has "0" in stock
    By abran1984 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 15 Oct 2009, 10:03 PM
  4. Problem with switching columns on/off
    By ajhb in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 28 Aug 2008, 04:47 AM
  5. Out of stock products showing when they shouldn't be
    By deepfrydaniel in forum Customization from the Admin
    Replies: 8
    Last Post: 16 Jun 2007, 03:09 PM

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