Jump to content

Custom out of stock message


Recommended Posts

Hi,

I have a product which is only available by sending an email to the shop owners. Basically, the product is only on the shop for show. What I want to do is make this particular product display a custom out of stock message instead of the message that all other products display when out of stock. At the moment I have hacked it by changing the Javascript in my theme's product.tpl file:

Replace

var doesntExistNoMore = '{l s='This product is no longer in stock' js=1}';
var doesntExistNoMoreBut = '{l s='with those attributes but is available with others' js=1}';



With

//Hack to give custom out of stock message
{if $product->id == 15}
   var doesntExistNoMore = '{l s='This product is only available by special request.\n\nPlease email [email protected]' js=1}';
   var doesntExistNoMoreBut = '{l s='' js=1}';
{else}
   var doesntExistNoMore = '{l s='This product is no longer in stock' js=1}';
   var doesntExistNoMoreBut = '{l s='with those attributes but is available with others' js=1}';
{/if};
//End of hack



It would be great if this feature could be added to the products page, right where the

Displayed text when in-stock:
Displayed text when allowed to be back-ordered:

fields are.

If anyone knows how to add this myself, that would also be helpful.

Would I just have to add a new variable to the product class, product->not_available and the DB then add this from a new text input field in the product form and then stick it in the template? How do these field get put into the DB? Which table?

Link to comment
Share on other sites

  • 5 years later...

I'm suprised that there is no answer to this since 2009.

 

I don't understand. If there can be custom message for "in stock" and "back-ordering", why not for "out of stock"?

I need to set this message for two type of product. One is unique, so the message should say "Sold" or something similar, not "Out of Stock" and second one can be restocked (but not backordered).

 

I was googling this multiple times but couldn't find anything...

 

If anyone can explain, what needs to be added (changed) in which files to make it work or at least explain, why it's not available I would appreciate it.

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

×
×
  • Create New...