Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Jun 2011
    Posts
    92
    Plugin Contributions
    0

    Default Need help urgently - can't figure out how something was done in the past

    At some point in the past I made a change based on a thread on the forum. This change made the cart disable the add to cart button and display out of stock when inventory was less than X amount. I have absolutely no idea where I did this and I'm having no luck finding the thread. Any help on how to reverse this would be GREATLY appreciated.
    Owner - MatchLock Arms, LLC and M&M Toys (Yes I sell toys and guns, but not toy guns)
    http://www.matchlockarms.com
    http://www.mandmtoys.com

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Need help urgently - can't figure out how something was done in the past

    stock should be settings in
    admin > config > stock
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Jun 2011
    Posts
    92
    Plugin Contributions
    0

    Default Re: Need help urgently - can't figure out how something was done in the past

    Quote Originally Posted by kobra View Post
    stock should be settings in
    admin > config > stock
    Kobra,

    Thanks for the reply, I could be wrong so please forgive me if I am but I'm 99% sure this was done on the code level. Something is telling zen cart that if inventory is less than 4 show out of stock.

    Take a look at this for an example https://www.matchlockarms.com/shotgu...4-rs-rfl-combo

    if this is fixable in the admin I just don't see it.

    Thanks again for your reply!
    Owner - MatchLock Arms, LLC and M&M Toys (Yes I sell toys and guns, but not toy guns)
    http://www.matchlockarms.com
    http://www.mandmtoys.com

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Need help urgently - can't figure out how something was done in the past

    I could be wrong so please forgive me if I am but I'm 99% sure this was done on the code level.
    Since you can not recall...your best bet is to download your files and grab a fresh distribution of the version you are using and run a file compare....

    Prior to this can you switch to the classic template and see if the issue persists
    If not then you only need look to your template override files
    Zen-Venom Get Bitten

  5. #5
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Need help urgently - can't figure out how something was done in the past

    Might be in this section of includes/classes/order.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']) . "'");
                }
              }
    .

    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
    Jun 2011
    Posts
    92
    Plugin Contributions
    0

    Default Re: Need help urgently - can't figure out how something was done in the past

    Quote Originally Posted by DrByte View Post
    Might be in this section of includes/classes/order.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']) . "'");
                }
              }
    I just got super excited when i saw your post and thought this was it for sure. Unfortunately it was not. I have a dev store (dev(dot)matchlockarms.com) setup that doesn't have this issues/change made to it and i did a diff on the files. They match exactly so the change wasn't made here. This has to be something very simple it's just buried somewhere. anyone know how to do a diff in linux that would compare all the files between the dev site and the production site? Thank you all for your help btw.
    Owner - MatchLock Arms, LLC and M&M Toys (Yes I sell toys and guns, but not toy guns)
    http://www.matchlockarms.com
    http://www.mandmtoys.com

  7. #7
    Join Date
    Jun 2011
    Posts
    92
    Plugin Contributions
    0

    Default Re: Need help urgently - can't figure out how something was done in the past

    Quote Originally Posted by kobra View Post
    Since you can not recall...your best bet is to download your files and grab a fresh distribution of the version you are using and run a file compare....

    Prior to this can you switch to the classic template and see if the issue persists
    If not then you only need look to your template override files
    I just used your suggestion of switching to classic and the change was made somewhere which causes it to exist in that template as well. Would this be a DB change perhaps? I can't believe i would change a core file and not use an override (BUT that's not to say i wasn't tired and did so :))
    Owner - MatchLock Arms, LLC and M&M Toys (Yes I sell toys and guns, but not toy guns)
    http://www.matchlockarms.com
    http://www.mandmtoys.com

  8. #8
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,262
    Plugin Contributions
    3

    Default Re: Need help urgently - can't figure out how something was done in the past

    It's most likely a MODULE, CLASS or a FUNCTION file.

    Unlikely to be a database issue - unless the value that determines the behaviour is adjustable somewhere in admin (but this would have been part of the code change as well.
    19 years a Zencart User

  9. #9
    Join Date
    Jun 2011
    Posts
    92
    Plugin Contributions
    0

    Default Re: Need help urgently - can't figure out how something was done in the past

    Quote Originally Posted by schoolboy View Post
    It's most likely a MODULE, CLASS or a FUNCTION file.

    Unlikely to be a database issue - unless the value that determines the behaviour is adjustable somewhere in admin (but this would have been part of the code change as well.

    I'm familiar with the location of the modules and the functions, but where are the CLASS? Thanks!
    Owner - MatchLock Arms, LLC and M&M Toys (Yes I sell toys and guns, but not toy guns)
    http://www.matchlockarms.com
    http://www.mandmtoys.com

  10. #10
    Join Date
    Jun 2011
    Posts
    92
    Plugin Contributions
    0

    Default Re: Need help urgently - can't figure out how something was done in the past

    Quote Originally Posted by matchlock View Post
    I'm familiar with the location of the modules and the functions, but where are the CLASS? Thanks!
    Disregard! You let this horse to water and I was able to drink and find exactly where this was done! Schoolboy, thank you so much! Also thank you to the others who contributed as well.

    for reference:
    in includes/functions file functions_general.php

    Original line
    case ($button_check->fields['products_quantity'] <= 0 and SHOW_PRODUCTS_SOLD_OUT_IMAGE == '1'):

    My line
    case ($button_check->fields['products_quantity'] <= 3 and SHOW_PRODUCTS_SOLD_OUT_IMAGE == '1'):\

    note the greater than equal to 3

    For anyone wonder or needing this function and finding this thread in the future here is the back story.

    My site is fed inventory counts from multiple wholesalers. Because of this fact if the inventory is low at a wholesaler I may not be able to secure an item before they sell out therefore leaving my customer without the product they ordered. The setting above solves this problem (sort of). What the setting does is sets a product to out of stock if the quantity is less than 3 available. This is great as a blanket setting, but occasionally i have inventory on hand (which is the case now). It would be nice and I'm sure it is possible (not a php guru) to exclude certain products from the setting but should you need to do something similar this is how it is done.

    All the best,
    Owner - MatchLock Arms, LLC and M&M Toys (Yes I sell toys and guns, but not toy guns)
    http://www.matchlockarms.com
    http://www.mandmtoys.com

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v150 Help Can't Figure out how to move header search box!!
    By Darion in forum General Questions
    Replies: 3
    Last Post: 15 Sep 2012, 07:17 PM
  2. Replies: 0
    Last Post: 20 Jun 2009, 11:25 AM
  3. Something I can't figure out.
    By holley2346 in forum General Questions
    Replies: 3
    Last Post: 5 Feb 2009, 09:35 PM
  4. Can someone help me figure out how to do this...
    By MCanes in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 15 Sep 2007, 05:54 AM
  5. I can't figure out how to use the newsletter manager!
    By awatts65 in forum General Questions
    Replies: 3
    Last Post: 9 Jul 2006, 10:53 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