Hi all,
Today I've learnt another new thing on Magento. That is to edit the in stock and out of stock messages on the product page.
By default, the messages are:
Availability: In stock.
Availability: Out of stock.
The issue is, some people might want to customize or remove the stock message.
So let's begin on how to edit it:
First the files are located in:
/public_html/app/design/frontend/default/default/template/catalog/product/view/type
Important!!!
If you want to keep your changes, be sure to use a custom template instead. E.g.
/public_html/app/design/frontend/default/Your_Template_Name/template/catalog/product/view/type\
Next, just a bit of code editing. Do note that if you use all the 4 types of products in Magento you'll have to edit all 4 .phmtl files.
Now here's something a little advanced.
What if we want to do something special for certain products? Like a new hot product, but needs a special message like "Available in 2 days, check back soon!" instead of "Out of stock"?.
You can create a custom attribute to be tagged to all your product types. For example, I'll create "product_sale_status" attribute with the "normal" and "special" options.
All I have changed is:
if($_product->isSaleable()): ?>
to:
if($_product->isSaleable() && $_product->getData('product_sale_status') != 152): ?>
So on the product pages, if you wish to have a custom message, all you have to do is to select the product status to "Special" and enter your custom text in the appropriate places (I'm using Comparison Chart Link field). Note: To get the data number 152, use an php echo on the getData('product_sale_status') somewhere, preferably HTML commented.
Have fun!