Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

You Saved! on Checkout pages


roback

Recommended Posts

All,

 

i would like to put a simple calculator on my checkout_confirmation and checkout success pages that would display the how much the customers saved buy shopping at our store.

 

Simply taking the order total, without shipping, handling etc and subracting 10 or 12% from that and have that number displayed:

 

So for a $150 order it would read:

 

"You saved $15.00 on your order today!"

 

Is there a simple way to add this in?

 

i guess a secondary part to this might be store that number in the DB for each client and add them up so that we can display something that says:

"Our customers have saved $XXX.XX through us" Or something similar.

 

Any help would be greatly appreciated...

Link to comment
Share on other sites

In includes/languages/english/checkout_confirmation.php (or whatever language), add

define('YOU_SAVED_TODAY', 'You saved %s on your order today!');

and in checkout_confirmation.php, add (in the appropriate place with the appropriate surrounding HTML):

<?php
$amount_saved = .1 * $order->info['subtotal'];
$savings_display = $currencies->format($amount_saved);
printf(YOU_SAVED_TODAY, $savings_display);
?>

and see if that does what you want.

 

For checkout_success, you would have to generate the amount saved on checkout_process and then pass it to checkout_success as a GET variable (i.e. in the URL).

 

For determining total sales, I think that the following SQL would do it:

SELECT sum( value )as total_sales FROM `orders_total` WHERE `class` = 'ot_subtotal'

However, if you have a large number of orders, this might be hard on the database. Better to store a simple value representing the total sales and update it with each order. Every once in a while, check it by running the full query against the database.

Always back up before making changes.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...