Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add order total to checkout_payment.php


TerryK

Recommended Posts

Posted

First, I should note that I'm using osC2.2-MS2...

 

The checkout process wasn't sitting too well with me because I felt the customer should know exactly how much they will have to pay BEFORE they hand over their credit card information. With the existing method, they see their product total first, without shipping costs -- if, that is, they click on the Cart Contents button before proceeding to checkout. With my customers, I know that isn't always the case.

 

Then, on the shipping page, the shipping costs are displayed, but without the product cost. If they can't add, they may not have a clue how much they've just spent. At the point where credit card information is collected, they still aren't given an order total. It isn't until they review the order --- AFTER providing their credit card information -- that they know the exact amount that has been charged to their card.

 

So, I just made a quick modification to my checkout_payment.php file to display it on that screen.

 

I've done a fair bit of modification on the checkout pages, so you may have to play around with your code to get this to display the way you want it, but here's the general gist of it, assuming you want to put the cart details/total at the top of the page, before the billing address.

 

BACKUP, BACKUP, BACKUP BEFORE MAKING ANY OF THESE CHANGES!

 

First, in /catalog/includes/languages/english/checkout_payment.php, add this code (I put mine right underneath the define('HEADING_TITLE'... line):

 

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

 

Next, open /catalog/checkout_payment.php. Look for this code at around line 49 on a clean copy:

 

// if no billing destination address was selected, use the customers own address as default
?if (!tep_session_is_registered('billto')) {
? ?tep_session_register('billto');
? ?$billto = $customer_default_address_id;
?} else {
// verify the selected billing address
? ?$check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'");
? ?$check_address = tep_db_fetch_array($check_address_query);

 

Right above it, add:

 

// load the selected shipping module
?require(DIR_WS_CLASSES . 'shipping.php');
?$shipping_modules = new shipping($shipping);

?require(DIR_WS_CLASSES . 'order_total.php');
?$order_total_modules = new order_total;

 

Next, around line 178 on a clean copy, look for:

 

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

 

Right above the first <tr>, add this code:

 

 ? ? ? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ? ? ?<td class="main" colspan="4"><?php echo '<b>' . HEADING_PRODUCTS . '</b> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . TEXT_EDIT . ')</span></a>'; ?></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" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
? ? ? ? ' ? ? ? ? ? ?<td width="60%" 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> <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 width="30%"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 COLSPAN="4" valign="top" align="right"><table border="0" cellspacing="0" cellpadding="3">
<?php
?if (MODULE_ORDER_TOTAL_INSTALLED) {
? ?$order_total_modules->process();
? ?echo $order_total_modules->output();
?}
?>
?</table></td>
? ? ? ? ?</tr>
?</table></td>
? ? ? ? ?</tr>
?</table></td>
? ? ? ? ?</tr>
? ? ? ? ? ? ? ?</table></td>
? ? ? ? ? ? ?</tr>

 

Voila! You should now have order details displayed on your page. :) You can see it in action on my site -- click on the www link in my sig to try it out if you want.

 

Hope this helps someone else out there!

 

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. *

Posted

Great..........!!

 

I got another question.

 

I can see on the order confirmation I get via e-mail under billing adress the telephone number........please tell me how you did this, I am looking a long time now to get that also.

 

Thanks

Posted

MAKE A BACKUP COPY OF YOUR FILES BEFORE MAKING ANY CHANGES!

 

For osc2.2-MS2, open /catalog/checkout_process.php. Look for:

 

  $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                 EMAIL_SEPARATOR . "\n" .
                 tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {

 

Change to:

 

  $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                 EMAIL_SEPARATOR . "\n" .
                 tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
   EMAIL_TEXT_TELEPHONE . $order->customer['telephone'] . "\n\n";
 if (is_object($$payment)) {

 

Then, in /catalog/includes/languages/english/checkout_process.php, look for:

 

define('EMAIL_TEXT_BILLING_ADDRESS', 'Billing Address');

 

Right after it, add:

 

define('EMAIL_TEXT_TELEPHONE', 'Phone Number:');

 

I think that's all you need... it's been so long since I added it, I'm not sure if I've missed anything or not. Give it a try and let me know.

 

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. *

Posted

Everything is still working, but still no telephonenumber on te confirmation

Posted

This is what i have in my catalog/checkout_process.php

 

 

// lets start with the email confirmation

$email_order = STORE_NAME . "\n" .

// additional text message

$email_order .= "\n\nBedankt voor uw bestelling. Gemiddelde levertijd is, indien niet op voorraad, 10-12 werkdagen. Kettler apparatuur leveren wij alleen op bestelling met een levertijd van 3-4 weken. Als de door u bestelde artikelen binnen zijn nemen wij telefonisch contact met u op. Als u verder nog vragen mocht hebben kunt u ons altijd bellen op 0251-319406, elke dag van 10.00 tot 20.00 uur. Indien u vooruit wenst te betalen dan graag uw ordernummer vermelden bij betaling.\n\n" .

// end of additional text message

EMAIL_SEPARATOR . "\n" .

EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .

EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .

EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

if ($order->info['comments']) {

$email_order .= tep_db_output($order->info['comments']) . "\n\n";

}

$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .

EMAIL_SEPARATOR . "\n" .

$products_ordered .

EMAIL_SEPARATOR . "\n";

 

for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";

}

 

if ($order->content_type != 'virtual') {

$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .

EMAIL_SEPARATOR . "\n" .

tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";

}

 

$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

EMAIL_SEPARATOR . "\n" .

tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";

EMAIL_TEXT_TELEPHONE . $order->customer['telephone'] . "\n\n";

if (is_object($$payment)) {

$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .

EMAIL_SEPARATOR . "\n";

$payment_class = $$payment;

$email_order .= $payment_class->title . "\n\n";

if ($payment_class->email_footer) {

$email_order .= $payment_class->email_footer . "\n\n";

}

}

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

Posted

I've made some changes to mine, so you'll have to work around that, but here's how mine shows -- maybe you can compare the two to see what's different:

 

// lets start with the email confirmation
 $email_order = STORE_NAME . "\n" .
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' .
strftime(DATE_FORMAT_LONG) . "\n" .
                EMAIL_SEPARATOR . "\n" .
                EMAIL_TEXT_INVOICE_URL . "\n\n" . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n\n";
 if ($order->info['comments']) {
   $email_order .= EMAIL_SEPARATOR . "\n" .
  	 EMAIL_TEXT_COMMENTS . "\n\n" .
tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_SEPARATOR . "\n" .
     EMAIL_TEXT_PRODUCTS . "\n\n" .
                 $products_ordered .
                 EMAIL_SEPARATOR . "\n\n";

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
  	 $email_order .= "\n" .      EMAIL_SEPARATOR . "\n" .
EMAIL_TEXT_DELIVERY_ADDRESS . "\n\n" .
  	 tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n\n" .
  	 EMAIL_SEPARATOR . "\n" .
  	 EMAIL_TEXT_BILLING_ADDRESS . "\n\n" .
  	 tep_address_label($customer_id, $billto, 0, '', "\n") . "\n" .
  	 EMAIL_TEXT_TELEPHONE . $order->customer['telephone'] . "\n\n";
 }

 if (is_object($$payment)) {
   $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
                   EMAIL_SEPARATOR . "\n";
   $payment_class = $$payment;
   $email_order .= $payment_class->title . "\n\n";
   if ($payment_class->email_footer) {
     $email_order .= $payment_class->email_footer . "\n\n";
   }
 }
 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT . $insert_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// BOF: WebMakers.com Added: Include Order # in Subject and name, phone and email in body to extra emails

 

 

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. *

Posted

Yesss.....................i just copied yours and its working now.

 

Thanks for your help, Also comming to Amsterdan next week?

I only live 20 minutes from there.

Posted

Unfortunately, no. Vancouver Island, Canada is a looooong way from Amsterdam. Maybe one day! :)

 

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. *

Posted

can I have your complete catalog/checkout_process.php file.

 

I got the phonenumber now but like to have that you can see what you ordered also like you threat was going about.

Posted

Here you go...

 

<?php
/*
 $Id: checkout_process.php,v 1.128 2003/05/28 18:00:29 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 include('includes/application_top.php');

// if the customer is not logged on, redirect them to the login page
 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

 if (!tep_session_is_registered('sendto')) {
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }

 if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) {
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}

// avoid hack attempts during the checkout procedure by checking the internal cartID
 if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
   if ($cart->cartID != $cartID) {
     tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
   }
 }

 include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

// load selected payment module
 require(DIR_WS_CLASSES . 'payment.php');
 $payment_modules = new payment($payment);

// load the selected shipping module
 require(DIR_WS_CLASSES . 'shipping.php');
 $shipping_modules = new shipping($shipping);

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

// load the before_process function from the payment modules
 $payment_modules->before_process();

 require(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;

 $order_totals = $order_total_modules->process();

 $sql_data_array = array('customers_id' => $customer_id,
                         'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
                         'customers_company' => $order->customer['company'],
                         'customers_street_address' => $order->customer['street_address'],
                         'customers_suburb' => $order->customer['suburb'],
                         'customers_city' => $order->customer['city'],
                         'customers_postcode' => $order->customer['postcode'],
                         'customers_state' => $order->customer['state'],
                         'customers_country' => $order->customer['country']['title'],
                         'customers_telephone' => $order->customer['telephone'],
                         'customers_email_address' => $order->customer['email_address'],
                         'customers_address_format_id' => $order->customer['format_id'],
                         'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
                         'delivery_company' => $order->delivery['company'],
                         'delivery_street_address' => $order->delivery['street_address'],
                         'delivery_suburb' => $order->delivery['suburb'],
                         'delivery_city' => $order->delivery['city'],
                         'delivery_postcode' => $order->delivery['postcode'],
                         'delivery_state' => $order->delivery['state'],
                         'delivery_country' => $order->delivery['country']['title'],
                         'delivery_address_format_id' => $order->delivery['format_id'],
                         'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'],
                         'billing_company' => $order->billing['company'],
                         'billing_street_address' => $order->billing['street_address'],
                         'billing_suburb' => $order->billing['suburb'],
                         'billing_city' => $order->billing['city'],
                         'billing_postcode' => $order->billing['postcode'],
                         'billing_state' => $order->billing['state'],
                         'billing_country' => $order->billing['country']['title'],
                         'billing_address_format_id' => $order->billing['format_id'],
                         'payment_method' => $order->info['payment_method'],
                         'cc_type' => $order->info['cc_type'],
                         'cc_owner' => $order->info['cc_owner'],
                         'cc_number' => $order->info['cc_number'],
                         'cc_expires' => $order->info['cc_expires'],
                         'date_purchased' => 'now()',
                         'orders_status' => $order->info['order_status'],
                         'currency' => $order->info['currency'],
                         'currency_value' => $order->info['currency_value']);
 tep_db_perform(TABLE_ORDERS, $sql_data_array);
 $insert_id = tep_db_insert_id();
 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $sql_data_array = array('orders_id' => $insert_id,
                           'title' => $order_totals[$i]['title'],
                           'text' => $order_totals[$i]['text'],
                           'value' => $order_totals[$i]['value'],
                           'class' => $order_totals[$i]['code'],
                           'sort_order' => $order_totals[$i]['sort_order']);
   tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
 }

 $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
 $sql_data_array = array('orders_id' => $insert_id,
                         'orders_status_id' => $order->info['order_status'],
                         'date_added' => 'now()',
                         'customer_notified' => $customer_notification,
                         'comments' => $order->info['comments']);
 tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

// initialized for the email confirmation
 $products_ordered = '';
 $subtotal = 0;
 $total_tax = 0;

 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// Stock Update - Joao Correia
   if (STOCK_LIMITED == 'true') {
     if (DOWNLOAD_ENABLED == 'true') {
       $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename
                           FROM " . TABLE_PRODUCTS . " p
                           LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                            ON p.products_id=pa.products_id
                           LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                            ON pa.products_attributes_id=pad.products_attributes_id
                           WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
       $products_attributes = $order->products[$i]['attributes'];
       if (is_array($products_attributes)) {
         $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
       }
       $stock_query = tep_db_query($stock_query_raw);
     } else {
       $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
     }
     if (tep_db_num_rows($stock_query) > 0) {
       $stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
       if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
         $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
       } else {
         $stock_left = $stock_values['products_quantity'];
       }
       tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
       if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
         tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
       }
     }
   }

// Update products_ordered (for bestsellers list)
   tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

   $sql_data_array = array('orders_id' => $insert_id,
                           'products_id' => tep_get_prid($order->products[$i]['id']),
                           'products_model' => $order->products[$i]['model'],
                           'products_name' => $order->products[$i]['name'],
                           'products_price' => $order->products[$i]['price'],
                           'final_price' => $order->products[$i]['final_price'],
                           'products_tax' => $order->products[$i]['tax'],
                           'products_quantity' => $order->products[$i]['qty']);
   tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
   $order_products_id = tep_db_insert_id();

//------insert customer choosen option to order--------
   $attributes_exist = '0';
   $products_ordered_attributes = '';
   if (isset($order->products[$i]['attributes'])) {
     $attributes_exist = '1';
     for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
       if (DOWNLOAD_ENABLED == 'true') {
         $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename
                              from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                              left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                               on pa.products_attributes_id=pad.products_attributes_id
                              where pa.products_id = '" . $order->products[$i]['id'] . "'
                               and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'
                               and pa.options_id = popt.products_options_id
                               and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'
                               and pa.options_values_id = poval.products_options_values_id
                               and popt.language_id = '" . $languages_id . "'
                               and poval.language_id = '" . $languages_id . "'";
         $attributes = tep_db_query($attributes_query);
       } else {
         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
       }
       $attributes_values = tep_db_fetch_array($attributes);

       $sql_data_array = array('orders_id' => $insert_id,
                               'orders_products_id' => $order_products_id,
                               'products_options' => $attributes_values['products_options_name'],
                               'products_options_values' => $attributes_values['products_options_values_name'],
                               'options_values_price' => $attributes_values['options_values_price'],
                               'price_prefix' => $attributes_values['price_prefix']);
       tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

       if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {
         $sql_data_array = array('orders_id' => $insert_id,
                                 'orders_products_id' => $order_products_id,
                                 'orders_products_filename' => $attributes_values['products_attributes_filename'],
                                 'download_maxdays' => $attributes_values['products_attributes_maxdays'],
                                 'download_count' => $attributes_values['products_attributes_maxcount']);
         tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
       }
       $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
     }
   }
//------insert customer choosen option eof ----
   $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
   $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
   $total_cost += $total_products_price;

   $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
 }

// lets start with the email confirmation
 $email_order = STORE_NAME . "\n" .
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' .
strftime(DATE_FORMAT_LONG) . "\n" .
                EMAIL_SEPARATOR . "\n" .
                EMAIL_TEXT_INVOICE_URL . "\n\n" . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n\n";
 if ($order->info['comments']) {
   $email_order .= EMAIL_SEPARATOR . "\n" .
  	 EMAIL_TEXT_COMMENTS . "\n\n" .
tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_SEPARATOR . "\n" .
     EMAIL_TEXT_PRODUCTS . "\n\n" .
                 $products_ordered .
                 EMAIL_SEPARATOR . "\n\n";

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
  	 $email_order .= "\n" .      EMAIL_SEPARATOR . "\n" .
EMAIL_TEXT_DELIVERY_ADDRESS . "\n\n" .
  	 tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n\n" .
  	 EMAIL_SEPARATOR . "\n" .
  	 EMAIL_TEXT_BILLING_ADDRESS . "\n\n" .
  	 tep_address_label($customer_id, $billto, 0, '', "\n") . "\n" .
  	 EMAIL_TEXT_TELEPHONE . $order->customer['telephone'] . "\n\n";
 }

 if (is_object($$payment)) {
   $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
                   EMAIL_SEPARATOR . "\n";
   $payment_class = $$payment;
   $email_order .= $payment_class->title . "\n\n";
   if ($payment_class->email_footer) {
     $email_order .= $payment_class->email_footer . "\n\n";
   }
 }
 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT . $insert_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// BOF: WebMakers.com Added: Include Order # in Subject and name, phone and email in body to extra emails

// send emails to other people

if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
  tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT . $insert_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}

// load the after_process function from the payment modules
 $payment_modules->after_process();

 $cart->reset(true);

// unregister session variables used during checkout
 tep_session_unregister('sendto');
 tep_session_unregister('billto');
 tep_session_unregister('shipping');
 tep_session_unregister('payment');
 tep_session_unregister('comments');

 tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

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. *

Posted

Note: the checkout_process.php file above was not part of my original trick, nor does it relate in any way to it.

 

It may or may not work with your version of osC, so if you plan on using it, please do so AT YOUR OWN RISK, and BACKUP FIRST!

 

Thanks,

 

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. *

Posted

I already noticed it..............but now i want to have it like yours

Posted

Hi Mike,

 

Sorry, I have no idea -- it certainly couldn't hurt to try, as long as you make backup copies of your files first. You could always revert back to your old copies if it doesn't.

 

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. *

Posted

Terry,

 

Thank you for your great posts... They were extremely helpful!

 

I was wondering if you could suggest a way to place the order quantity and total (as well as other dynamic elements) in the main_page.tpl.php page using something like <?php echo $orderquanity; ?> right in the HTML.

 

I have a design already done and am bypassing column_left.php and boxes.php.

 

How would you go about doing this?

 

Best Regards

Mitch Moccia

http://www.xpancom.com

Posted

Mitch, thanks for your feedback!

 

I'm quite php-challenged, so I am probably the LAST person you want to ask this question to!!! It took me a lot of trial and error to get the trick here working the way I wanted it to.

 

That said, it seems to me that there is a contribution to just put product count and total in header or other area on your pages -- check the Features or InfoBox sections in Contributions (link at top of forum pages).

 

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. *

Posted

Total number of items in the cart and total price would be:

echo $cart->count_contents();
echo $cart->show_total();

Is this what you wanted?

 

Hth,

Matt

Always back up before making changes.

Posted

Yes thank you.... works great. How would you add an HTML template (i.e. aboutus.html changed to .php) ? I tried adding aboutus.php to the root and adding the "echo $cart" code but I get open_basedir File is in wrong directory errors and more.

 

Thanks for any advice you could offer. I will post a link to the site shortly so you can see what you helped with (many thanks!)

 

Mitch

Posted

One addition to the last post.... you know the code you posted above:

 

echo $cart->count_contents();

echo $cart->show_total();

 

Do you have or know where to get a list of all dynamic items that can be placed in a PHP page like the cart content above?

 

What are the limitations of doing it this way if any?

 

Thanks again.

Mitch

Posted

Terry

 

I tried to add this code to MS1, but I get a blank page trying to go to checkout_payment. Do you have any idea what part of the code I could change so it would work with MS1?

 

Thanks

 

Mike

Posted

Sorry, Mike -- I haven't worked with MS1, nor have I seen the code, so I have absolutely no idea. Maybe someone else browsing the thread will be able to help...

 

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. *

Posted

This code is very helpful, but I need a little more help. When I add the code as you suggested it displays the info I want but it screws with all the other tables in the page. I would like to have the info posted in a box very similiar to the two boxes already on the page.

 

You can see the result I get when the code is added as you suggested:

 

http://dacsky.com/consumercart/

 

 

Can someone help me but the info in a nice box like the rest of the info? I would really like it to look just like the "Billing Address" box without the change address button. I will change the header outside the box and the info to the left. Does this make sense?

 

Ryan

Posted

Ok I have it looking the way I need but know the tax it off. I should be charging 6% tax for Indiana. Can anyone tell me why it is off. Is something in the new code changing it?

 

 

<?php
/*
 $Id: checkout_payment.php,v 1.103 2002/11/23 02:08:10 thomasamoulton Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

// if the customer is not logged on, redirect them to the login page
 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot();
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

// 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, '', 'NONSSL'));
 }

// if no shipping method has been selected, redirect the customer to the shipping method selection page
 if (!tep_session_is_registered('shipping')) {
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
 }

// avoid hack attempts during the checkout procedure by checking the internal cartID
 if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
   if ($cart->cartID != $cartID) {
     tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
   }
 }

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

// load the selected shipping module
require(DIR_WS_CLASSES . 'shipping.php');
$shipping_modules = new shipping($shipping);

require(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;

// if no billing destination address was selected, use the customers own address as default
 if (!tep_session_is_registered('billto')) {
   tep_session_register('billto');
   $billto = $customer_default_address_id;
 } else {
// verify the selected billing address
   $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "' and address_book_id = '" . $billto . "'");
   $check_address = tep_db_fetch_array($check_address_query);

   if ($check_address['total'] != '1') {
     $billto = $customer_default_address_id;
     if (tep_session_is_registered('payment')) tep_session_unregister('payment');
   }
 }

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

 $total_weight = $cart->show_weight();
 $total_count = $cart->count_contents();

// load all enabled payment modules
 require(DIR_WS_CLASSES . 'payment.php');
 $payment_modules = new payment;

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);

 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
var selected;

function selectRowEffect(object, buttonSelect) {
 if (!selected) {
   if (document.getElementById) {
     selected = document.getElementById('defaultSelected');
   } else {
     selected = document.all['defaultSelected'];
   }
 }

 if (selected) selected.className = 'moduleRow';
 object.className = 'moduleRowSelected';
 selected = object;

// one button is not an array
 if (document.checkout_payment.payment[0]) {
   document.checkout_payment.payment[buttonSelect].checked=true;
 } else {
   document.checkout_payment.payment.checked=true;
 }
}

function rowOverEffect(object) {
 if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
 if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
//--></script>
<?php echo $payment_modules->javascript_validation(); ?>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"'); ?><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="main" align="right">We Accept:<br>
                 <a href="http://usa.visa.com" target="_blank"><img src="images/visa1_37x23_a.gif" alt="Visa" border=0></a> <a href="http://www.mastercard.com" target="_blank"><img src="images/mc_accpt_023_gif.gif" alt="Mastercard" border=0></a></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="main"><b><?php echo $error['title']; ?></b></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBoxNotice">
         <tr class="infoBoxNoticeContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main" width="100%" valign="top"><?php echo $error['error']; ?></td>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }
?>
           <tr>
                  <td class="main" colspan="4"><?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><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 
               <td class="main" width="50%" valign="top"><?php


for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
  echo '          <tr>' . "\n" .
       '            <td width="10%" class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
       '            <td width="60%" 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> <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 width="30%"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 COLSPAN="4" valign="top" align="right"><table border="0" cellspacing="0" cellpadding="3">
<?php
if (MODULE_ORDER_TOTAL_INSTALLED) {
  $order_total_modules->process();
  echo $order_total_modules->output();
}
?></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_BILLING_ADDRESS; ?></b></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 
               <td class="main" width="50%" valign="top"><?php echo TEXT_SELECTED_BILLING_DESTINATION; ?><br><br><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'; ?></td>
               <td align="right" width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="2">
                 <tr>
                   <td class="main" align="center" valign="top"><b><?php echo TITLE_BILLING_ADDRESS; ?></b><br><?php echo tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td>
                   <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 
                   <td class="main" valign="top"><?php echo tep_address_label($customer_id, $billto, true, ' ', '<br>'); ?></td>
                   <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 
                 </tr>
               </table></td>
             </tr>
           </table></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_PAYMENT_METHOD; ?></b></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
 $selection = $payment_modules->selection();

 $sel_size = sizeof($selection);
 if ($sel_size > 1) {
?>
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main" width="50%" valign="top"><?php echo TEXT_SELECT_PAYMENT_METHOD; ?></td>
               <td class="main" width="50%" valign="top" align="right"><b><?php echo TITLE_PLEASE_SELECT; ?></b><br><?php echo tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
<?php
 } else {
?>
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main" width="100%" colspan="2"><?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?></td>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
<?php
 }

 $radio_buttons = 0;
 for ($i=0, $n=$sel_size; $i<$n; $i++) {
?>
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
   if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) {
     echo '                  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
   } else {
     echo '                  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
   }
?>
                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                   <td class="main" colspan="3"><b><?php echo $selection[$i]['module']; ?></b></td>
                   <td class="main" align="right">
<?php
   if ($sel_size > 1) {
     echo tep_draw_radio_field('payment', $selection[$i]['id']);
   } else {
     echo tep_draw_hidden_field('payment', $selection[$i]['id']);
   }
?>
                   </td>
                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                 </tr>
<?php
   if (isset($selection[$i]['error'])) {
?>
                 <tr>
                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                   <td class="main" colspan="4"><?php echo $selection[$i]['error']; ?></td>
                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                 </tr>
<?php
   } else {
?>
                 <tr>
                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                   <td colspan="4"><table border="0" cellspacing="0" cellpadding="2">
<?php
     $size = sizeof($selection[$i]['fields']);
     for ($j=0, $n2=$size; $j<$n2; $j++) {
?>
                     <tr>
                       <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                       <td class="main"><?php echo $selection[$i]['fields'][$j]['title']; ?></td>
                       <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                       <td class="main"><?php echo $selection[$i]['fields'][$j]['field']; ?></td>
                       <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                     </tr>
<?php
     }
?>
                   </table></td>
                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                 </tr>
<?php
     $radio_buttons++;
   }
?>
               </table></td>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 
             </tr>
<?php
 }
?>
           </table></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="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main"><b><?php echo TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE;d?></td>
               <td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></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="0">
         <tr>
           <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr>
               <td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
             </tr>
           </table></td>
           <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
               <td><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
             </tr>
           </table></td>
           <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
           <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
             </tr>
           </table></td>
         </tr>
         <tr>
           <td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>
           <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
           <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
           <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
         </tr>
       </table></td>
     </tr>
   </table>
   </form></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

 

 

Thanks,

 

Ryan

Posted

Is it somehow possible to grab order quantity (no. of units ordered) and pass it to a variable?

 

I am selling a single item on my site and customer purchase a number of credits to be able to use the site. If I were able to grab quantity ordered during checkout, I would pass the same to a new field in the customers table and then the credits used could be compared against credits purchased to disable customers site-usage if the difference between two was zero.

 

Any help will be much appreciated.

 

Rgds

John

  • 2 months later...
Posted

I've now added the items ordered/sub-total to the checkout_shipping.php page (osC2.2MS2). For anyone who wants to know, here's how:

 

First, in /catalog/includes/languages/english/checkout_shipping.php, add this code (I put mine right underneath the define('HEADING_TITLE'... line):

 

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

 

In /catalog/checkout_shipping.php, look for this code at around line 23 on a clean copy:

 

// 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;
? ? ?}
? ?}
?}

 

Then, 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>

 

Right above it, add:

 

 ? ? ?<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'] . ' 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> <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']) . '% </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']) . ' </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>

 

That should do it! :) You can see it in action via the WWW link in my signature below.

 

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. *

Archived

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

×
×
  • Create New...