Our company wanted just this facility. I have knocked up a quick and dirty solution that does the job.
Firstly, as stated by Adjustware, set ‘Manage Stock’ to ‘No’. I will expand on adding custom messages to your catalog views.
Now create this code in your code/local folder (I put it in a further subdirectory, so the full path was code/local/ebdj/myfunctions.php
<?php function custom_messages($object,$_product)
/* to use: <?php require_once 'ebdj/myfunctions.php'; custom_messages($this,$_product); ?> */
$due_in_message = $_product->getData('due_in_message');
$due_in_message_expiry = $_product->getData('due_in_message_expiry');
$custom_message = $_product->getData('custom_message');
$custom_message_expiry = $_product->getData('custom_message_expiry');
$delivery_message = $_product->getData('delivery_message');
if(($due_in_message !='') and (($due_in_message_expiry == '') or (strtotime($due_in_message_expiry) > time()) ) )
if(($custom_message !='') and (($custom_message_expiry == '') or (strtotime($custom_message_expiry) > time()) ) )
$message_flag=($due_in_flag or $delivery_flag or $custom_flag);
echo $object->__('<div class="custom_clubhouse_messages">');
// Due In Message
echo $object->__('<p class="custom_due_in_message">');
// Custom Message
echo $object->__('<p class="custom_promotion_message">');
// Delivery Message
echo $object->__('<p class="custom_delivery_message">');
This code requires 5 attributes be created for your products in the ‘General’ section of the Attributes with the following SKU’s and field types:
due_in_message - text field
due_in_message_expiry - date field
custom_message - text field
custom_message_expiry - date field
delivery_message - text field
The purpose of due_in_message_expiry and custom_message_expiry I hope are self explanatory, after these dates the associated fields will not be displayed. Leaving these dates blank means the associated messages will be displayed ad-infinitum.
Also remember to set all the attributes visibilities to ‘Yes’ in the appropriate section.
What remains then is to place the call to this function in the appropriate phtml files in your frontend - as my company wanted to replace altogether the ‘Out Of Stock’ messages I had to track down a number of places such as list.phtml and view/type/simple.phtml (example below). If you are happy to have the default Out Of Stock message displayed along with the custom messages you really only need to edit the list.phtml and view.phtml files (possibly also the phtml’s associated to Wishlist and Compare) for the template you are using.
If you are unsure of which phtml files are responsible for displaying the particular view you want the messages in, activate the ‘display template hints’ under your Developer options in Magento backend.
Note in list.phtml you need to add the line in both list view and grid view.
The actual additional line is very simple, shown below denoted with ‘new code by Jason’.
<?php $_product = $this->getProduct() ?>
<?php /* removed by Jason if($_product->isSaleable()): ?>
<p class="availability"><?php echo $this->__('Availability') ?>: <span class="in-stock"><?php echo $this->__('In stock') ?></span></p>
<?php else: ?>
<p class="availability"><?php echo $this->__('Availability') ?>: <span class="out-of-stock"><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; */ ?>
<?php /* new code by Jason */?>
<?php require_once 'ebdj/myfunctions.php'; custom_messages($this,$_product); ?>
<?php /* End new code by Jason */?>
/ebdj is a subdirectoy in my code/local folder, if you saved the myfunctions.php file directly into code/local the additional line would simply read:
<?php require_once 'myfunctions.php'; custom_messages($this,$_product); ?>
The messages have a custom css class for your own styles associated, which I hope are clear enough from the code, and I hope it’s obvious enough how to add/remove messages as required.
I’m sure this is all terrible from a system design and good coding practice standpoint, but as a quick dirty fix to this exact same problem I was presented, it does the job.