Hide price of out-of-stock items

Because our products are one-in-a-kind vintage items, I want to hide the price of sold-out items from shortlist(compact list) and item details, then display “SOLD OUT” text or images instead.



Could someone advise me how to modify the price field?



I guess, common_templates/price.tpl would be related on this, but I have no idea what to do :confused:


{* $Id$ *}<br />
{strip}<br />
{if $settings.General.alternative_currency == "Y"}<br />
	{$value|format_price:$currencies.$primary_currency:$span_id:$class:false}{if $secondary_currency != $primary_currency}&nbsp;{if $class}<span class="{$class}">{/if}({if $class}</span>{/if}{$value|format_price:$currencies.$secondary_currency:$span_id:$class:true:$is_integer}{if $class}<span class="{$class}">{/if}){if $class}</span>{/if}{/if}<br />
{else}<br />
	{$value|format_price:$currencies.$secondary_currency:$span_id:$class:true}<br />
{/if}<br />
{/strip}
```<br />
<br />
Thank you.

http://demo.cs-cart…tion_id=General



Show out of stock products



(sorry did not read properly thought you want to hide product) :D

Thank you, Darius.

But I wanna keep sold-out products listed on our website for a while.



Additionally, I , …actually my client, wanted to show CONTACT US and RESERVED text too.

CONTACT US text for special items, and RESERVED for sold-from-cart items.

Then, after shipping and any other transaction, the products should be modified manually and be literary SOLD OUT.

(but still listed on products list)



Below is my solution for now.





1. editing price template



common_templates/price.tpl

{* $Id$ *}
{strip}
{if $product_amount == 99}
CONTACT US
{elseif $product_amount > 0}
{if $settings.General.alternative_currency == "Y"}
{$value|format_price:$currencies.$primary_currency:$span_id:$class:false}{if $secondary_currency != $primary_currency} {if $class}{/if}({if $class}{/if}{$value|format_price:$currencies.$secondary_currency:$span_id:$class:true:$is_integer}{if $class}{/if}){if $class}{/if}{/if}
{else}
{$value|format_price:$currencies.$secondary_currency:$span_id:$class:true}
{/if}
{else}
RESERVED
{/if}
{/strip}




2. editing cart template



buttons/add_to_cart.overrride.tpl (hook)

[color=#0000ff]/avoid to display cart for 99-stock items/[/color]


{if $product_amount != 99}
{assign var="c_url" value=$config.current_url|escape:url}
:
: codes to display cart
:
{else}
Place link to contact form
{/if}




3. set sero price action


  • not to allow customers adding the items to cart
  • edit contact_us_for_price language variable to SOLD OUT



    When the product is sold from cart, it will be reserved on online store,

    Then, after confirmation, or shipping, the price of sold items will be set to zero by staffs.







    It looks like working.

    However, if you anyone found something wrong, or better way, please advise me.

    Thank you.

I got new problem.



It seems working on category page, and items detail page,

but when I put the item in the cart,

$product_amount will be “0” immediately.



That causes, showing cart, the price is displayed as “RESERVED”, that means sold-out.

Still, if i click the product name and display the item, price is displayed properly.



Is there alternative variables for $product_amount that won't change until the checkout completed?



Please help me. Thank you.