Jump to content

Replace stock number with message [Solved]


Recommended Posts

Hello,

We do not want our customers knowing stock levels, as some are fabricated as we do not know exact numbers in our warehouse.

Basically instead of it showing like this;

Stock: 100 Items in stock

 

to

 

In stock  / or / Out of stock

 

How would I do this?  This is the code in question (I think?)

I do not have the time to edit each product individually..

 

			<div class="refpink" {if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
				<!-- availability -->
			<p id="availability_statut"{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
				<span id="availability_label" class="reftitle">{l s='Availability:'}</span>
				<span id="availability_value"{if $product->quantity <= 0} class="warning_inline"{/if}>{if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='Out of stock'}{/if}{else}{$product->available_now}{/if}</span>
								
			</p>
			<p id="availability_date"{if ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}>
				<span id="availability_date_label">{l s='Availability date:'}</span>
				<span id="availability_date_value">{dateFormat date=$product->available_date full=false}</span>
			</p>


			<!-- Out of stock hook -->
			<div id="oosHook"{if $product->quantity > 0} style="display: none;"{/if}>
				{$HOOK_PRODUCT_OOS}
			</div>

			<p class="warning_inline" id="last_quantities"{if ($product->quantity > $last_qties OR $product->quantity <= 0) OR $allow_oosp OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none"{/if} >{l s='Warning: Last items in stock!'}</p>
		 </div>
Edited by omgzhobbs (see edit history)
Link to comment
Share on other sites

Ace thanks, sadly it seems the 'Price Hide' module I have installed replaces the 'In Stock' message and  'Not in stock' message with login in for info, even when logged in.

Anyway of me being able to replace the code so that it just shows in stock or not in stock via the tpl file?  As I need this module to say active as we are a 'trade only' business.

Link to comment
Share on other sites

In that case you can just edit the product.tpl file

 

Look for this code and edit as per your requirement :

<!-- number of item in stock -->
			{if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}
			<p id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}>
				<span id="quantityAvailable">{$product->quantity|intval}</span>
				<span {if $product->quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='Item in stock'}</span>
				<span {if $product->quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='Items in stock'}</span>
			</p>
			{/if}
Edited by ibndawood (see edit history)
Link to comment
Share on other sites

Have tried editing it but now I get;

"300 item in stockItem in stock"

Sorry if im being a bit slow, its been a long day.. haha.. which bit exactly of the following should i edit?

 

			<div class="refwhite"><span class="reftitle">{l s='Stock: '}</span>
				<!-- number of item in stock -->
				{if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}
				<div id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}>
					<span id="quantityAvailable">{$product->quantity|intval}</span>
					<span {if $product->quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='Item in stock'}</span>
					<span {if $product->quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='Items in stock'}</span>
				</div>
				{else}
				<a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='Login For Info'}" class="login" rel="nofollow">{l s='Login For Info'}</a>
				{/if}
			</div>
Link to comment
Share on other sites

<div class="refwhite"><span class="reftitle">{l s='Stock: '}</span>
				<!-- number of item in stock -->
				{if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}

				<div id="pQuantityAvailable">
					<span>{if $product->quantity > 0}{l s='In Stock'}{else}{l s='Out of Stock'}{/if}</span>
				</div>
				{else}
				<a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='Login For Info'}" class="login" rel="nofollow">{l s='Login For Info'}</a>
				{/if}
			</div>

The above code should work. But I did not test.

 

Make sure you clear the cache as well. :)

Edited by ibndawood (see edit history)
Link to comment
Share on other sites

  • 2 months later...
<div class="refwhite"><span class="reftitle">{l s='Stock: '}</span>
				<!-- number of item in stock -->
				{if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}

				<div id="pQuantityAvailable">
					<span>{if $product->quantity > 0}{l s='In Stock'}{else}{l s='Out of Stock'}{/if}</span>
				</div>
				{else}
				<a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='Login For Info'}" class="login" rel="nofollow">{l s='Login For Info'}</a>
				{/if}
			</div>

The above code should work. But I did not test.

 

Make sure you clear the cache as well. :)

 

Hi!

Thanks for your reply. 

But is it possible to set it up using combinations like this (when switching combinations in front office:

- if clicked on combination that is out of stock, it shows "available only with other combinations"

- if clicked on combination that is in stock, it show x pcs left in stock

- if all combinations are out of stock, it shows "out of stock"

 

if you could do this one, my shop would be 100% complete

Link to comment
Share on other sites

×
×
  • Create New...