Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Nov 2007
    Location
    USA
    Posts
    874
    Plugin Contributions
    5

    Default Hide Product Price When Quantity 0

    Hi:

    For v157+ I'd like to only show the 'Out of Stock' button without a price; when quantity is 0.
    Is there already a function for this? Thanks.

    Tried this:

    /includes/modules/YOUR_TEMPLATE_FOLDER/product_listing.php

    Code:
    /** Show Price When Out of Stock
            $lc_text =  $lc_price;
    */
            
        if ($listing->fields['products_quantity'] > 0) { 
            $lc_text =  $lc_price;     
            } else { 
            $lc_text =  ''; 
            }
    Last edited by Webskipper; 11 Dec 2020 at 05:18 PM. Reason: sp
    Cheers!
    v2.0+

  2. #2
    Join Date
    Nov 2007
    Location
    USA
    Posts
    874
    Plugin Contributions
    5

    Default Re: Hide Product Price When Quantity 0

    Has this been solved elsewhere?

    It would nice to show products out of stock without a price.
    Cheers!
    v2.0+

  3. #3
    Join Date
    Jan 2019
    Location
    UK
    Posts
    101
    Plugin Contributions
    0

    Default Re: Hide Product Price When Quantity 0

    I don't know if there is an easy way to write it into the template or a module, but as a quick fix you could temporarily set an out of stock product to 'call for price' with only a few clicks. Just edit the product, sell call for price, then when you have stock to sell just call for price back to NO and it will display the price again.

  4. #4
    Join Date
    Nov 2007
    Location
    USA
    Posts
    874
    Plugin Contributions
    5

    Default Re: Hide Product Price When Quantity 0

    Hide Price when quantity is zero.

    ‘Call for Price’ button could be re-worded and price still needs to be hidden.

    Could Showcase mode code be applied to individual products?

    I want to hide the price so I don’t get shopped.
    Cheers!
    v2.0+

  5. #5
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Idea or Suggestion Re: Hide Product Price When Quantity 0

    Webskipper - I whipped this up today, let me know if it performs the way you wanted...


    *****
    Twitch Hide Price when Quantity is Zero/Out of Stock
    Version 21a for Zen Cart 1.57c
    June 8.2021

    This will hide the price when the product is out of stock - quantity 0.

    Installs into Admin > Configuration > Product Info


    TRACER: Twitch Hide Price Out of Stock, SHOW_HOOPS

    Copyright (C) 2021 Twitchtoo Media


    ***** DEVELOPERS START *****

    ## SQL Update - Twitch Hide Price Out of Stock
    INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Twitch Hide Price when Quantity is Zero/Out of Stock', 'SHOW_HOOPS', 'Show', 'Hide = Hide Price when Quantity is Zero/Out of Stock <br/> Default => Show', '18', '300', 'zen_cfg_select_option(array(\'Show\', \'Hide\'), ', now());
    #

    ## DELETE CODE
    # DELETE FROM configuration WHERE configuration_key in ('SHOW_HOOPS');
    ## DELETE CODE


    includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

    Change this:
    <!--bof Product Price block -->
    <h2 id="productPrices" class="productGeneral">
    <?php
    // base price
    if ($show_onetime_charges_description == 'true') {
    $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
    } else {
    $one_time = '';
    }
    echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
    ?></h2>
    <!--eof Product Price block -->


    To this:
    <!--bof Product Price block -->
    <h2 id="productPrices" class="productGeneral">
    <?php
    // base price
    if ($show_onetime_charges_description == 'true') {
    $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
    } else {
    $one_time = '';
    }
    if (SHOW_HOOPS == 'Hide' && $products_quantity == 0) {
    // hide the price display
    } else { // stock
    echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
    }
    ?></h2>
    <!--eof Product Price block -->


    ***** DEVELOPERS END *****


    Twitch Hide Price Out of Stock Installation Complete!


    ***** Please Donate *****

    If my work has helped you today in any way, show your appreciation with things like positive feedback or donations.
    Find me at www.twitchtoo.com

    Thanks

    Twitch.

    *****
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base8 - Obsidian - This, is what's new.

  6. #6
    Join Date
    Nov 2007
    Location
    USA
    Posts
    874
    Plugin Contributions
    5

    Default Re: Hide Product Price When Quantity 0

    Very cool, thanks!

    It does hide the product price when quantity is zero on the product page only.

    How to hide the price on the category page?

    Sold out button shows when product quantity is 0.

    Thank you in advance.
    Cheers!
    v2.0+

  7. #7
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: Hide Product Price When Quantity 0

    Easy breezy...

    Hide Product Price on Product Listing when Quantity is Zero/Out of Stock


    includes/modules/YOUR_TEMPLATE/product_listing.php

    Change this:
    case 'PRODUCT_LIST_PRICE':
    $lc_price = '<div class="list-price">' . zen_get_products_display_price($listing->fields['products_id']) . '</div>';
    $lc_align = 'right';
    if ($product_listing_layout_style == 'columns') $lc_align = 'center';
    $lc_text = $lc_price;


    To this:
    case 'PRODUCT_LIST_PRICE':
    if (SHOW_HOOPS == 'Hide' && $listing->fields['products_quantity'] == 0) {
    // hide the price display - send empty placeholder
    $lc_price = '<div class="list-price">&nbsp;</div>';
    } else { // stock
    $lc_price = '<div class="list-price">' . zen_get_products_display_price($listing->fields['products_id']) . '</div>';
    }
    $lc_align = 'right';
    if ($product_listing_layout_style == 'columns') $lc_align = 'center';
    $lc_text = $lc_price;


    This uses the same HOOPS switch in Admin and maintains the original Zen Cart code when the switch is off.
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base8 - Obsidian - This, is what's new.

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

    Default Re: Hide Product Price When Quantity 0

    There was this thread that covered "all" of it: https://www.zen-cart.com/showthread....s-Out-of-Stock

    Though I thought I recalled around the original time of starting this thread that DrByte and perhaps swguy or torvista (can't remember who as it could be yet someone else) had identified an "inner" or central notifier that supported impacting all such locations at once. I remembered it was something I didn't expect to support the operation, but it did. At the time I had also lost track of who started which thread and if the two had "found" each other. Apparently not... I found the above by using my favorite search engine searching on Zen Cart hide price with zero product.

    The above thread doesn't make changes to the database and I believe only modifies template override files.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #9
    Join Date
    Nov 2007
    Location
    USA
    Posts
    874
    Plugin Contributions
    5

    Default Re: Hide Product Price When Quantity 0

    And just like that, it works exactly how you’d want expect. Wow Thanks!

    On to replacing the non-functioning ‘Out of Stock’ button with a functioning ‘Add to Wish List’ button to keep the Shopper on the site longer.
    Cheers!
    v2.0+

  10. #10
    Join Date
    Nov 2007
    Location
    USA
    Posts
    874
    Plugin Contributions
    5

    Default Re: Hide Product Price When Quantity 0

    MC12345678, the code in your link was referenced in the original post.

    Twitchtoo solved this. Another beneficial plugin. Thanks!
    Cheers!
    v2.0+

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. hide price when CALL FOT PRICE
    By satello in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 24 May 2014, 09:25 PM
  2. Replies: 17
    Last Post: 19 Feb 2013, 12:45 PM
  3. v151 Hide price in dropdown list when pricing by attribute eg: (+£7.50)
    By mickyholmes in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 14 Oct 2012, 01:48 PM
  4. automatic hide product when quantity 0
    By ebaobao in forum Customization from the Admin
    Replies: 7
    Last Post: 22 Nov 2010, 02:14 AM
  5. How to hide quantity when it's over certain value?
    By Miro in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 15 Jul 2010, 09: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