Change Add to Cart button to Pre-Order in Magento

As it is known Magento allows to manage the products inventory. Together with this one can order by default only those products that are in stock. Herewith there is a possibility to order even those products that are out of stock (backorders), namely when their number (stock) is either 0 or lower than a minimal quantity (Qty for Item's Status to Become Out of Stock attribute). 

In order to make out of stock products orders possible it is necessary to state that for such products backorders are allowed, namely the number of products in stock can be negative.

The problem that arises in such a case is that customers see that a product is out of stock (in case that availability is displayed in attribute settings for the product) but at the same time there is the Add to Cart  button both on category page and the product page.Not all customers pay attention to the fact that the product is out of stock while making an order which can result in an unpleasant situation when a product is not shipped on time and a customer's expectations are not fulfilled.

One of the solutions for such a situation can be changing the Add to Cart button to the Pre-order button.

If you wish to display Pre-Order button instead of Add to Cart when the product quantity is 0, here's how to do it.

 

Product List and Grid:

Open app/design/frontend/yourpackage/yourtheme/template/catalog/product/list.phtml
Find:

<?php $_productCollection=$this->getLoadedProductCollection() ?>

Add below:

<?php $addtocart = $this->__('Add to Cart'); ?>
<?php $preorder = $this->__('Pre-Order'); ?>

 

Find:

<p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>

Replace with:

<p><button type="button" title="<?php if(Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()>0): echo $addtocart; else: echo $preorder; endif; ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php if(Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()>0): echo $addtocart; else: echo $preorder; endif; ?></span></span></button></p>

 

Find:

<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>

Replace with:

<button type="button" title="<?php if(Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()>0): echo $addtocart; else: echo $preorder; endif; ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php if(Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()>0): echo $addtocart; else: echo $preorder; endif; ?></span></span></button>

 

Product view page:

Open app/design/frontend/yourpackage/yourtheme/template/catalog/product/view/addtocart.phtml
Find:

<?php $_product = $this->getProduct(); ?>

Add below:

<?php $addtocart = $this->__('Add to Cart'); ?>
<?php $preorder = $this->__('Pre-Order'); ?>

 

Find:

<button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>

Replace with:

<button type="button" title="<?php if($_product->getStockItem()->getQty()>0): echo $addtocart; else: echo $preorder; endif; ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php if($_product->getStockItem()->getQty()>0): echo $addtocart; else: echo $preorder; endif; ?></span></span></button>

Tested with Magento 1.7.0.2