[TomatoCart] Show Book Now Button Instead of Add to Cart Button While Product is Out of Stock

You may need to show the book now button instead of add to cart button for the out of stock product.  In this article, I will show the steps to achieve it for the bootstrap template.

Step 1. Import a language definition for book now button.

— Go to admin panel > Definitions > Languages > Edit.

— Import following language definition into general group:

button_book_now: Book now

Snip20140727_12

Step 2. Replace the button in the new products module.

— Go to templates > bootstrap > modules > content > new_products.php

— Find following code snippet:

<?php echo $osC_Language->get('button_buy_now'); ?>

— Replace it with following code snippet:

<?php if ($osC_Product->getQuantity() > 0): ?>
<?php echo $osC_Language->get('button_buy_now'); ?>
<?php else: ?>
<?php echo $osC_Language->get('button_book_now'); ?>
<?php endif;?>

Snip20140727_13

Step 2. Replace the button in the product listing.

— Go to templates > bootstrap > modules > product_listing.php.

— Find following code snippet:

<?php echo $osC_Language->get('button_buy_now'); ?>

— Replace it with following code snippet:

<?php if ($osC_Product->getQuantity() > 0): ?>
<?php echo $osC_Language->get('button_buy_now'); ?>
<?php else: ?>
<?php echo $osC_Language->get('button_book_now'); ?>
<?php endif;?>

Snip20140727_14

Step 3. Replace the button in the product info page.

— Go to templates > bootstrap > content > products > info.php.

— Find following code snippet:

<?php echo $osC_Language->get('button_add_to_cart'); ?>

— Replace it with following code:

<?php if ($osC_Product->getQuantity() > 0): ?>
<?php echo $osC_Language->get('button_add_to_cart'); ?>
<?php else: ?>
<?php echo $osC_Language->get('button_book_now'); ?>
<?php endif;?>

Snip20140727_15

Step 4. Replace the button in the feature products module.

— Go to templates > bootstrap > modules > content > feature_products.php

— Find following code snippet:

<?php echo $osC_Language->get('button_buy_now'); ?>

— Replace it with following code:

<?php if ($osC_Product->getQuantity() > 0): ?>
<?php echo $osC_Language->get('button_buy_now'); ?>
<?php else: ?>
<?php echo $osC_Language->get('button_book_now'); ?>
<?php endif;?>

Snip20140727_16

Done. Now, all of buy now or add to cart buttons are replaced with book now button in your bootstrap template.

If you can’t complete above steps by yourself, please contact support@tomtaocart.com to get technical support. We provide free technical support service for arvixe users.

Looking for quality web hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , , , , , | Posted under TomatoCart | RSS 2.0

Author Spotlight

Jack Yin

Jack Yin

TomatoCart Developer & Co Founder - Arvixe Web Hosting / TomatoCart Community Liaison

Leave a Reply

Your email address will not be published. Required fields are marked *


9 − 4 =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>