Jump to content



Latest News: (loading..)

- - - - -

DOCS: Add order totals to checkout_shipping.ph


This topic has been archived. This means that you cannot reply to this topic.
13 replies to this topic

#1   TerryK

TerryK
  • Members
  • 1,359 posts

Posted 07 June 2004 - 10:06 PM

INTRODUCTION
============

When a customer with items in their cart proceeds to checkout, the
cart contents are not displayed unless they first click the 'Cart
Contents' button. If they click the 'Checkout' button, they are
automatically directed to the checkout_shipping.php page, where cart
contents are not displayed by default.


SOLUTION
========

Add display of cart contents to the checkout_shipping.php page. To do
that, the following steps are required:

1. Around line 17 of
/catalog/includes/languages/english/checkout_shipping.php, look for:

define('HEADING_TITLE', 'Delivery Information');

Replace with:

define('HEADING_TITLE', 'Delivery Information');

define('HEADING_PRODUCTS', 'PRODUCTS ORDERED');
define('TEXT_EDIT', 'Edit');

2. Around line 23 of /catalog/checkout_shipping.php, look for:

// if there is nothing in the customers cart, redirect them to the 
shopping cart page
  if ($cart->count_contents() < 1) {
    tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
  }

Replace with:

// if there is nothing in the customers cart, redirect them to the 
shopping cart page
  if ($cart->count_contents() < 1) {
    tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
  }

// Stock Check
  if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) 
{
    $products = $cart->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
      if (tep_check_stock($products[$i]['id'], 
$products[$i]['quantity'])) {
        tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
        break;
      }
    }
  }

Around line 218, look for:

      <tr>
        <td><table border="0" width="100%" cellspacing="0" 
cellpadding="2">
          <tr>
            <td class="main"><b><?php echo 
TABLE_HEADING_SHIPPING_ADDRESS; ?></b></td>
          </tr>
        </table></td>
      </tr>


Replace with:

      <tr>
        <td><table border="0" width="100%" cellspacing="0" 
cellpadding="2">
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" 
cellpadding="3" class="infoBox">
          <tr class="infoBoxContents">
 	 <td><table border="0" width="100%" cellspacing="0" 
cellpadding="3">
<?php
  if (sizeof($order->info['tax_groups']) > 1) {
?>
                  <tr>
                    <td class="main" colspan="2"><?php echo '<b>' . 
HEADING_PRODUCTS . '</b> <a href="' . 
tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' 
. TEXT_EDIT . ')</span></a>'; ?></td>
                    <td class="smallText" align="right"><b><?php echo 
HEADING_TAX; ?></b></td>
                    <td class="smallText" align="right"><b><?php echo 
HEADING_TOTAL; ?></b></td>
                  </tr>
      <tr>
        <td COLSPAN="4"><?php echo 
tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></td>
      </tr>
<?php
  } else {
?>
                  <tr>
                    <td class="main" colspan="3"><?php echo '<b>' . 
HEADING_PRODUCTS . '</b> <a href="' . 
tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' 
. TEXT_EDIT . ')</span></a>'; ?></td>
                  </tr>
      <tr>
        <td COLSPAN="3"><?php echo 
tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  }

  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
    echo '          <tr>' . "\n" .
         '            <td width="10%" class="main" align="right" 
valign="top">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" 
.
         '            <td width="60%" class="main" valign="top">' . 
$order->products[$i]['name'] . '<br><small>Price, Each: USD $' . 
$order->products[$i]['price'] . '</small>' . '<br><small>Item #' . 
$order->products[$i]['item_number'] . '</small>';

    if (STOCK_CHECK == 'true') {
      echo '<br>' . tep_check_stock($order->products[$i]['id'], 
$order->products[$i]['qty']);
    }

    if ( (isset($order->products[$i]['attributes'])) && 
(sizeof($order->products[$i]['attributes']) > 0) ) {
      for ($j=0, $n2=sizeof($order->products[$i]['attributes']); 
$j<$n2; $j++) {
        echo '<br><small>&nbsp;<i> - ' . $order-
>products[$i]['attributes'][$j]['option'] . ': ' . $order-
>products[$i]['attributes'][$j]['value'] . '</i></small>';
      }
    }

    echo '</td>' . "\n";

    if (sizeof($order->info['tax_groups']) > 1) echo '            <td 
class="main" valign="top" align="right">' . 
tep_display_tax_value($order->products[$i]['tax']) . '%&nbsp;</td>' . 
"\n";

    echo '            <td width="30%"class="main" align="right" 
valign="top">' . $currencies->display_price($order-
>products[$i]['final_price'], $order->products[$i]['tax'], $order-
>products[$i]['qty']) . '&nbsp;</td>' . "\n" .
         '          </tr>' . "\n";
  }
?>
      <tr>
        <td align="right" class="main" COLSPAN="3"><b><?php echo 
SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart-
>show_total()); ?></b></td>
      </tr>
      <tr>
        <td COLSPAN="3"><?php echo 
tep_draw_separator('pixel_trans.gif', '100%', '25'); ?></td>
      </tr>
  </table></td>
	</tr>
	</table></td>
   </tr>
  </table></td>
  </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" 
cellpadding="2">
          <tr>
            <td class="main"><b><?php echo 
TABLE_HEADING_SHIPPING_ADDRESS; ?></b></td>
          </tr>
        </table></td>
      </tr>

Upload the changes, and the cart contents should now be displayed on
the page.



HTH,

Terry
Terry Kluytmans

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

Add order total to checkout_shipment
Add order total to checkout_payment
Add radio buttons at checkout_shipping (for backorder options, etc.)
Duplicate Table Rate Shipping Module
Better Product Review Flow

* If at first you don't succeed, find out if there's a prize for the loser. *

#2   TerryK

TerryK
  • Members
  • 1,359 posts

Posted 07 June 2004 - 10:13 PM

RELATED LINK: Add order totals to checkout_payment.php
Terry Kluytmans

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

Add order total to checkout_shipment
Add order total to checkout_payment
Add radio buttons at checkout_shipping (for backorder options, etc.)
Duplicate Table Rate Shipping Module
Better Product Review Flow

* If at first you don't succeed, find out if there's a prize for the loser. *

#3   Melinda Odom

Melinda Odom
  • Members
  • 1,212 posts

Posted 08 June 2004 - 03:47 PM

Terry,

Usually when the customer puts an item in the cart they can keep shopping and if they put another item in the cart they are at the cart contents page and can see their order before they click the checkout button.

When they get to the checkout_confirmation.php page the products they are purchasing are at the top of the page showing the product and the price.

What is the purpose of putting this list on the checkout_shipping.php page in your opinion?

#4   TerryK

TerryK
  • Members
  • 1,359 posts

Posted 08 June 2004 - 04:25 PM

Hi Melinda,

Two reasons:

1. Without viewing cart contents, a customer does not know until they reach the checkout confirmation page -- AFTER they've already submitted their credit card details -- whether a product is in stock or not. By adding the display of cart contents to the checkout_shipping page, there is no question about availability (provided, of course, that a shop owner maintains accurate stock levels in their store).

(In my case, I've also added a form for user input to advise how to handle shipping where a portion of the order is on backorder. That's a separate contribution which I'll put together soon.)

2. Once a customer completes the checkout_shipping.php page and goes to the checkout_payment.php page, I felt that it was very important they know exactly what their total charges would be BEFORE submitting their credit card details. Tax, for example, can add a significant amount to an order, but would otherwise not be displayed until after they'd provided CC info. With this modification, it is all there are there are no surprises.

I have found in my store (which has been online now for 7 years) that many of my customers need a good bit of hand-holding. I'd rather make the process less confusing than more...

HTH,

Terry
Terry Kluytmans

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

Add order total to checkout_shipment
Add order total to checkout_payment
Add radio buttons at checkout_shipping (for backorder options, etc.)
Duplicate Table Rate Shipping Module
Better Product Review Flow

* If at first you don't succeed, find out if there's a prize for the loser. *

#5   Melinda Odom

Melinda Odom
  • Members
  • 1,212 posts

Posted 08 June 2004 - 04:38 PM

Quote

1. Without viewing cart contents, a customer does not know until they reach the checkout confirmation page -- AFTER they've already submitted their credit card details -- whether a product is in stock or not. By adding the display of cart contents to the checkout_shipping page, there is no question about availability (provided, of course, that a shop owner maintains accurate stock levels in their store).

The customer knows if an item is out of stock when they put it in the cart...if item is not in stock and you have the stock section setup then customer will get this message in red text:
Products marked with *** don't exist in desired quantity in our stock.
You can buy them anyway and check the quantity we have in stock for immediate delivery in the checkout process.

Quote

2. Once a customer completes the checkout_shipping.php page and goes to the checkout_payment.php page, I felt that it was very important they know exactly what their total charges would be BEFORE submitting their credit card details. Tax, for example, can add a significant amount to an order, but would otherwise not be displayed until after they'd provided CC info. With this modification, it is all there are there are no surprises.

I agree with you on this one.  Customer does know what the total will be before confirming the order but not before seeing their products and amounts all listed together.

Maybe this can be brought up to the developers and they can incorporate it into ms2-2.3.

#6   TerryK

TerryK
  • Members
  • 1,359 posts

Posted 08 June 2004 - 04:50 PM

Quote

The customer knows if an item is out of stock when they put it in the cart...if item is not in stock and you have the stock section setup then customer will get this message in red text:
Products marked with *** don't exist in desired quantity in our stock.
You can buy them anyway and check the quantity we have in stock for immediate delivery in the checkout process.

But that only works if you display cart after adding product, does it not?

As far as I can see, the message doesn't appear on the product_info.php page, so if in your store configuration, you set 'Display Cart After Adding Products' to false, they would not see the stock message. By adding the cart contents to the shipping page, the information is there for a customer who goes directly to checkout instead of displaying cart contents first.

Terry
Terry Kluytmans

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

Add order total to checkout_shipment
Add order total to checkout_payment
Add radio buttons at checkout_shipping (for backorder options, etc.)
Duplicate Table Rate Shipping Module
Better Product Review Flow

* If at first you don't succeed, find out if there's a prize for the loser. *

#7   volumax

volumax
  • Members
  • 111 posts

Posted 20 June 2004 - 03:18 PM

Hi Terry K

I am tring to find how to add cart to each page as a customer goes through and found this http://wiki.oscommerce.com/helpHowtoAddCartPages, which helped but it doesnt do when i need.

I also need to show the customer the carts NETT total and the carts TAX Total and carts SHIPPING Total as well as how many items and then grand total.

Weird but its what the clients have asked for.

So I have fount that $cart->show_total(), is in the classes particulaly shopping_cart.php and that the function to work it out is function calculate();

I need to add the bits that will allow the return of the NETT, TAX and SHIPPING and here is the but i don'y know enough about php and mysql to work out what to add, i have been asking for weeks for assistance but no one seems to be able to answer.

The cart is nearly ready to go live just got to add content and this is the only thing holding it up.

Any help appreciated, as am close to pulling hair out  :(

Regards
Andy
Literally, Laterally Thinking! If you cannot get through it, go round it.

#8   TerryK

TerryK
  • Members
  • 1,359 posts

Posted 23 June 2004 - 05:17 PM

*** CORRECTION TO STEP 2 & 3 INSTRUCTIONS ***

2. Around line 22 of /catalog/checkout_shipping.php, look for:

// if there is nothing in the customers cart, redirect them to the shopping cart page
  if ($cart->count_contents() < 1) {
    tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
  }
// if no shipping destination address was selected, use the customers own address as default

Replace with:

// if there is nothing in the customers cart, redirect them to the shopping cart page
  if ($cart->count_contents() < 1) {
    tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
  }

// Stock Check
  if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
    $products = $cart->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
      if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
        tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
        break;
      }
    }
  }

// if no shipping destination address was selected, use the customers own address as default

3. Around line 205 of /catalog/checkout_shipping.php, look for:

<!-- body_text //-->
    <td width="100%" valign="top"><?php echo tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_delivery.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><b><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></b></td>
          </tr>
        </table></td>
      </tr>

Replace with:

<!-- body_text //-->
    <td width="100%" valign="top"><?php echo tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_delivery.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="3">
          <tr>
 	 <td><table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBox">
<?php
  if (sizeof($order->info['tax_groups']) > 1) {
?>
                  <tr class="infoBoxContents">
                    <td class="main" colspan="2"><?php echo '<b>' . HEADING_PRODUCTS . '</b> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
                    <td class="smallText" align="right"><b><?php echo HEADING_TAX; ?></b></td>
                    <td class="smallText" align="right"><b><?php echo HEADING_TOTAL; ?></b></td>
                  </tr>
      <tr>
        <td COLSPAN="4"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></td>
      </tr>
<?php
  } else {
?>
                  <tr class="infoBoxContents">
                    <td class="main" colspan="3"><?php echo '<b>' . HEADING_PRODUCTS . '</b> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></td>
                  </tr>
      <tr>
        <td COLSPAN="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  }

  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
    echo '          <tr>' . "\n" .
         '            <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" .
         '            <td class="main" valign="top">' . $order->products[$i]['name'];

    if (STOCK_CHECK == 'true') {
      echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);
    }

    if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
      for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
        echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
      }
    }

    echo '</td>' . "\n";

    if (sizeof($order->info['tax_groups']) > 1) echo '            <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";

    echo '            <td class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . '</td>' . "\n" .
         '          </tr>' . "\n";
  }
?>
      <tr>
        <td align="right" class="main" COLSPAN="3"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b></td>
      </tr>
      <tr>
        <td COLSPAN="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
  </table></td>
	</tr>
	</table></td>
   </tr>
  </table></td>
  </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><b><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></b></td>
          </tr>
        </table></td>
      </tr>

Okay, now this should work. Sorry for the confusion...

Terry
Terry Kluytmans

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

Add order total to checkout_shipment
Add order total to checkout_payment
Add radio buttons at checkout_shipping (for backorder options, etc.)
Duplicate Table Rate Shipping Module
Better Product Review Flow

* If at first you don't succeed, find out if there's a prize for the loser. *

#9   koder

koder
  • Members
  • 2 posts

Posted 24 November 2004 - 12:53 AM

THANKS for making this forum contrib!!  this works beautifully.  i'm about to do the one for payment info.
http://www.moondreams.net
peace,
jim

#10   cluboutfits

cluboutfits
  • Members
  • 17 posts

Posted 29 November 2004 - 12:16 AM

I follow the instructions and get a completely black product box.  No text just completely black.  Any ideas why?

#11   dealwititp

dealwititp
  • Members
  • 46 posts

Posted 20 April 2005 - 08:06 AM

I followed all the steps and it worked fine expect on the checkout_shipping.php page I get the following:

Products Ordered (Edit)

1 x Widget $0.99
SUB_TITLE_SUB_TOTAL $0.99

I found the reference to this process in the checkout_shipping.php, but in what file should "SUB_TITLE_SUB_TOTAL" be defined?

I also installed the checkout_payment.php contrib and this works good. I noticed that the code is slightly different from the checkout_shipping.php in regards to calling up the order total. I tried inserting it into the checkout_shipping.php with no success. Any suggestions?  :huh:

Thanks,
Walt

#12   TerryK

TerryK
  • Members
  • 1,359 posts

Posted 20 April 2005 - 03:24 PM

Quote

Products Ordered (Edit)

1 x Widget $0.99
SUB_TITLE_SUB_TOTAL $0.99

I found the reference to this process in the checkout_shipping.php, but in what file should "SUB_TITLE_SUB_TOTAL" be defined?

Sorry, I missed that step. It should be defined in /catalog/includes/languages/english/checkout_shipping.php, like so:

define('SUB_TITLE_SUB_TOTAL', 'Sub-Total:');

HTH,

Terry
Terry Kluytmans

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

Add order total to checkout_shipment
Add order total to checkout_payment
Add radio buttons at checkout_shipping (for backorder options, etc.)
Duplicate Table Rate Shipping Module
Better Product Review Flow

* If at first you don't succeed, find out if there's a prize for the loser. *

#13   oldworldcharms

oldworldcharms
  • Members
  • 356 posts

Posted 11 August 2005 - 07:57 PM

I got this working. Does anyone know the code that gives a total, cost of item, shipping, total.

Thanks
Elizabeth

#14   akvario

akvario
  • Members
  • 28 posts

Posted 06 December 2006 - 08:48 PM

Also looking for the code that gives me the total cost included shipping ;)