Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shipping cost not being added to confirmation email


pctek

Recommended Posts

Posted

Hi,

 

This is weird (I've put in a couple of hours of searching) - the customer is being charged for shipping at the checkout but the cost is not being added to the confirmation email...

 

I'm getting this as a confirmation email:

 

------------------------------------------------------
Order Number: 5
Date Ordered: Monday 10 March, 2008

Products
------------------------------------------------------
1 x z191 Weighted Punchbag Mitts (Z191) = £38.00

1 x z187 Lonsdale Lightweight Sweatsuit (Z187) = £27.00

1 x z182 Lonsdale Leather Medicine Ball 3kg (Z182) = £34.00
------------------------------------------------------

Delivery Address
------------------------------------------------------

 

 

In checkout_process.php is this the only section that relates to adding the shipping cost please?

 

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

 

 

 

Thanks

 

 

:)

Posted

I'm sorry about this but I've had to go live without resolving this issue as I couldn't justify spending another day searching through hundreds of threads on the forum. Atm desperation has forced me to try to isolate the problem by doing file compares with the originals.

The three character word search engine restriction on the forums makes it impossible for me to search out a reference in a thread that's been made to a complete line of code.

 

so...

 

I've got to ask

 

In checkout_process.php the lines marked in red are those added or edited by PWA, the line in blue I removed in order to take out the email history link (the PWA "no display of invoice URL if PWA customer") comment wouldn't do it...

 

Is there anything here that would cause the above problem to occur please?

Line 221 approx:

// PWA

//lets start with the email confirmation

// DDB - 041103 - Add test for PWA : no display of invoice URL if PWA customer if (!tep_session_is_registered('noaccount'))

{

$email_order = STORE_NAME . "\n" .

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";

} else {

$email_order = STORE_NAME . "\n" .

EMAIL_SEPARATOR . "\n" .

EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\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";

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);

//end PWA

 

// send emails to other people

if (SEND_EXTRA_ORDER_EMAILS_TO != '') {

tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

}

 

You know you've come to the end of the line when accurately formatting a message is easier than searching for an answer...

 

Thanks :)

Posted

I do have another file on my system which does have the above code (same as the original checkout_process.php) and it's worldpay_junior.php. Would it make any difference if I merged the above code marked in red into this file?

 

Yes or no?

 

Any opinion would be appreciated if only to prevent me from screwing a live online store...

 

 

 

Do you know what the above would look like in Perl?

 

Something like this:

 

# Send email conformation to the customer.....
open (MAIL,"|$mailprogram");
print MAIL "To: $b_email\n";
print MAIL "From: $youremail\n";
print MAIL "Subject: Order Confirmation\n";
print MAIL "\n\n";
print MAIL "A new order has been received.  A summary of this order appears below.\n";
print MAIL "\n";
print MAIL "Order Date: $months[$month] $day, $year $hour:$min:$sec \n"; 
print MAIL " \n";
print MAIL "OrderID: $orderid \n";
print MAIL " \n";
print MAIL "Bill To: \n";
print MAIL "-------- \n";
print MAIL "   $b_first $b_last \n";
print MAIL "   $b_addr \n";
print MAIL "   $b_addr2 \n";
print MAIL "   $b_city, $b_state  $b_zip \n";
print MAIL "   $b_phone \n";
print MAIL "   $b_fax \n";
print MAIL "   $b_email \n";
print MAIL " \n";
print MAIL " \n";
print MAIL "Ship To: \n";
print MAIL "-------- \n";

if ( $s_addr eq "" ) {
  print MAIL "   Use Billing Address\n";
} else {
  print MAIL "   $s_first $s_last \n";
  print MAIL "   $s_addr \n";
  print MAIL "   $s_addr2 \n";
  print MAIL "   $s_city, $s_state  $s_zip \n";
  print MAIL "   $s_phone \n";
}

print MAIL " \n";
print MAIL " \n";
print MAIL "Qty  Price(GBP)   Product ID  - Product Name\n";
print MAIL "===================================================================== \n";
print MAIL "$QUANTITY_1	\£$PRICE_1	$ID_1 - $NAME_1   $ADDTLINFO_1  \n";
if( $NAME_2 ) {print MAIL "$QUANTITY_2	\£$PRICE_2	$ID_2 - $NAME_2   $ADDTLINFO_2  \n";}
if( $NAME_3 ) {print MAIL "$QUANTITY_3	\£$PRICE_3	$ID_3 - $NAME_3   $ADDTLINFO_3  \n";}
print MAIL "===================================================================== \n";
print MAIL "SUBTOTAL: $SUBTOTAL \n";
print MAIL "TOTAL: $TOTAL \n";
print MAIL "\n";
print MAIL "FREIGHT: $SHIPPING \n";
print MAIL "\n\n";
print MAIL "Comments: \n";
print MAIL "--------- \n";
print MAIL "$comment \n";
print MAIL " \n";
close MAIL;

 

Isn't that easy?

 

You can almost read what the code is doing - no handfull of files controlling the checkout here...

 

It doesn't require server-side applications/enabled services - it's just the one file, not half a dozen different ones all linked together ready to do a domino effect and produce a mysql database error three operations back up the chain if you misconfigure one line...

 

I'm sorry but this PHP stuff really does scare the cr@p out of me...

 

 

 

;)

Archived

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

×
×
  • Create New...