Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2013
    Location
    Southampton, UK
    Posts
    51
    Plugin Contributions
    0

    Default Replace Sold out with text & qty with "in stock at suppliers" or something similar

    Hi all,

    I would like to make adjustments in they way zen cart shows the amount of stock when out of stock. I would like to allow checkout regardless of stock quantity (which I can already configure within zen cart) but in the product listing, show text rather than just the red out of stock label. I also want to be able to do the same sort of thing within the product description but replace the "0 units in stock" with in stock at suppliers" or words to that effect.

    Any help and suggestions would be greatly appreciated.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Replace Sold out with text & qty with "in stock at suppliers" or something simila

    Generically can search for: units in stock
    using the developers toolkit located in the tools section of the admin panel

    Lower left corner, enter the text being searched, select catalog in the dropdown, if the capitalization of what has been entered is important then mark the checkbox in that row, and then select search.

    The result will provide the file(s) that contain that particular wording and approximate line number (there was a line numbering issue in ZC 1.5.1 that identified one line larger than the actual). The word on the left side of the define in ALL_CAPS is the constant used to handle the info on the right side.

    Now that the ALL_CAPS word has been found, search on it to find exactly where it is used... A result should include the includes/templates directory. If the file(s) in question is not yet in your own templates directory, then before modifying the file, save a copy from the template_default directory to YOUR_TEMPLATE directory with the same folder structure and filename. Modify the file as necessary.

    As for the red image button, similar scenario, but replace the image of that red button with an image that displays what you want. Otherwise, may need to use CSS buttons to provide the customized text that is desired for the button(s).
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Dec 2013
    Location
    Southampton, UK
    Posts
    51
    Plugin Contributions
    0

    Default Re: Replace Sold out with text & qty with "in stock at suppliers" or something simila

    Hi,

    Thanks for your reply. Unfortunately it is not quite what I meant. I have included pictures below to explain a bit better:

    I want to change this Name:  units.jpg
Views: 219
Size:  9.8 KB to this Name:  units2.jpg
Views: 216
Size:  9.4 KB

    In basic terms,

    x = qty

    if x > 0 then all stays as normal

    if x = or < 0 then custom text is shown

    I would also like to display text instead of the out of stock button but still show the add to cart quantity box to allow customers to checkout. Displaying the text would be easy enough, but displaying the add to cart quantity box as well as the text is the main part I am stuck on.

    if x= 0 or < 0 then custom text is shown as well as add to cart box.

    Any ideas?

  4. #4
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Replace Sold out with text & qty with "in stock at suppliers" or something simila

    Quote Originally Posted by Axeman View Post
    Hi,

    Thanks for your reply. Unfortunately it is not quite what I meant. I have included pictures below to explain a bit better:

    I want to change this Name:  units.jpg
Views: 219
Size:  9.8 KB to this Name:  units2.jpg
Views: 216
Size:  9.4 KB

    In basic terms,

    x = qty

    if x > 0 then all stays as normal

    if x = or < 0 then custom text is shown

    I would also like to display text instead of the out of stock button but still show the add to cart quantity box to allow customers to checkout. Displaying the text would be easy enough, but displaying the add to cart quantity box as well as the text is the main part I am stuck on.

    if x= 0 or < 0 then custom text is shown as well as add to cart box.

    Any ideas?
    Right, so my statement about the custom text still applies, need to find where/how the text is displayed and add your conditionals around it.

    As for the second, I'll be that I can't seem to remember the settings, but under configuration, possibly in my store, there is an option to allow checkout with negative stock and I believe add to cart when quantity is zero or something similar... It is part of ZC that allows/offers exactly what you are looking for to have "someone" else handle the missing stock... Darnit I can't seem to remember, but I thought it was a combination of some settings.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Replace Sold out with text & qty with "in stock at suppliers" or something simila

    So, following the process I dsscribed above, the area for the "units in stock" is found at the following:

    includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

    Code:
    Line #138 : <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>' : '') . "\n"; ?>
    At least that was the line number for one of my templates.

    The text TEXT_PRODUCT_QUANTITY is/was defined in:

    Code:
    includes/languages/english/YOUR_TEMPLATE/product_free_shipping_info.php
    
    Line #18 : define('TEXT_PRODUCT_QUANTITY', ' Units in Stock');
    Well, that's the product_free_shipping file, but there is one for each product type... So product_info.php I think is the one for the above example but at a different line number...

    The first set of code would need the if statement and use a different language define constant.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Dec 2013
    Location
    Southampton, UK
    Posts
    51
    Plugin Contributions
    0

    Default Re: Replace Sold out with text & qty with "in stock at suppliers" or something simila

    I have just looked at my comment with the pictures that I uploaded and I have notice a mistake that I think has caused a little confusion. The 82 Units in stock should read 0 units in stock.

    So when my stock count reaches 0 then the custom text shows instead of 0 units in stock. Until my stock reaches 0 I want the amount of units in stock to show. The problem I can see there is that if I change the define text it will affect what will be displayed no matter how much is in stock.

    The other thing is that when the out of stock sign is showing there is no option of a qty box to continue checkout. I could keep the 0 units in stock and alter the sign to say the same thing. The main issue is that I still need to have a qty box which will not show if I have the out of stock sign showing.

  7. #7
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Replace Sold out with text & qty with "in stock at suppliers" or something simila

    Quote Originally Posted by Axeman View Post
    I have just looked at my comment with the pictures that I uploaded and I have notice a mistake that I think has caused a little confusion. The 82 Units in stock should read 0 units in stock.

    So when my stock count reaches 0 then the custom text shows instead of 0 units in stock. Until my stock reaches 0 I want the amount of units in stock to show. The problem I can see there is that if I change the define text it will affect what will be displayed no matter how much is in stock.

    The other thing is that when the out of stock sign is showing there is no option of a qty box to continue checkout. I could keep the 0 units in stock and alter the sign to say the same thing. The main issue is that I still need to have a qty box which will not show if I have the out of stock sign showing.
    There was a misunderstanding. You are exactly correct, if you modify the words of that define it will affect that constant everywhere; however.... to create something new, required using something existing... You will need to establish a new define with a constant that doesn't already exist that has the "out of stock" message you want displayed.. In the code identifier, I provided approximate line numbers where you will need to build your logic to display the "normal" message when there is product in stock, and your "new" message when the stock is <=0...

    Then, as relates to the "quantity" box not displaying, a search of the forum on "stock zero sell" provided results that included the following:

    http://www.zen-cart.com/showthread.p...ght=sell+stock

    I tried to find something in the FAQ but didn't come up with anything quickly, so provided this...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

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

    Default Re: Replace Sold out with text & qty with "in stock at suppliers" or something simila

    So in tpl_product_info_display.php, find the following code around Line #138 :
    Code:
     <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>' : '') . "\n"; ?>
    And change to something like:

    Code:
     <?php 
    if ($flag_show_product_info_quantity == 1) {
     if ($products_quantity >0 ) {
     echo ( '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>') . "\n";
     } else {
     echo ( '<li>' . TEXT_PRODUCT_AT_SUPPLIERS . '</li>') . "\n";
     }
    } else {
    echo "\n";
    } ?>
    Then in the language file for product_info add a define like:

    Code:
    define('TEXT_PRODUCT_AT_SUPPLIERS', 'At Suppliers');
    That what you are wanting and to apply the settings described in the previous message so that stock can go negative and still have the ability to purchase any item from the store that is "out-of-stock" (locally).
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Dec 2013
    Location
    Southampton, UK
    Posts
    51
    Plugin Contributions
    0

    Default Re: Replace Sold out with text & qty with "in stock at suppliers" or something simila

    Thanks for the info. I will give this a try as soon as I can and let you know whether it all worked ok.

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

    Default Re: Replace Sold out with text & qty with "in stock at suppliers" or something simila

    FYI, you could add the new define into your template override to support future upgrades not effecting this change (though some comparison would still be suggested in the event other aspects are changed), copy over the existing version of the below file to your template directory:

    from:
    Code:
    /includes/languages/YOUR_LANGUAGE/product_info.php
    to:
    Code:
    /includes/languages/YOUR_LANGUAGE/YOUR_TEMPLATE/product_info.php
    There are other similar files depending on what product type(s) you use or have had created. The default/frequently used type though is product_info.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v150 Replace Sold Out Image with Text
    By pyro_maniac in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 1 Apr 2012, 02:02 PM
  2. Adding a "New" image to the product listing (similar to "Sold Out" image)
    By javaman in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 18 Feb 2010, 11:44 PM
  3. How hold sold items in catalog with show "SOLD OUT"?
    By NickolasB in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 18 Oct 2007, 06:47 PM
  4. "Sold out" won't replace "Buy Now"
    By Donnettacb in forum Basic Configuration
    Replies: 22
    Last Post: 15 Nov 2006, 01:27 AM
  5. How do I replace SOLD OUT Images with text?
    By DavidRambo in forum Basic Configuration
    Replies: 6
    Last Post: 24 Jul 2006, 04:49 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