Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Removing customer order comments on logout, etc.


Recommended Posts

Hi Guys,


I have some custom functionally with one of my osCommerce sites. Basically, i have setup a wizard so customers can use the wizard and then the information they enter on page 1, then page 2 they will select the product they wish to purchase. Then once they click the product and add it to the card, the comments on page 1 wizard will be entered inside of the cart and added to ''Customer Order Comments'' @ checkout_shipping.php and throughout the order process.


It is setup and works great, although i am not having a problem when a customer uses the wizard and goes to the checkout, some customers decide they no longer wish to purchase the product selected, so they remove the product from the cart. Well, i have come to a problem it still adds the comments to the customers order when the product has been removed from the cart. Also when customer enters wizard information on page 1 and doesn't complete the wizard process through the wizard session, then head over to another product and clicks add to cart, it enters the information on a product which has nothing to do with the wizard. If this makes sense..?


Also when the customer comes back to the site later in date and logs on and purchases a product which has nothing to do with the wizard, the order comments are still there and not removing. They only remove when you clear history, but some customers don't sign out and save history.


- When a customer removes wizard product, possibly clear the comments?

- When the customer logouts the website, clear the customer order comments. I'm using $cart->reset(); to clear the cart, which works, but how to clear comments?

- Prevent the comments showing ever again when customer makes new order. New Session, Cookies, etc?


Another question, how do i get this information to display the product title rather than entering the product ID on the comments.



if (is_array($_SESSION['comments2'])) foreach ($_SESSION['comments2'] as $key => $val) {
[b] $comm .= "Product ID: ".$key."\n".$val."\n\n";[/b]

$_SESSION['comments'] = $comm;


Example of the wizard we have in place:

$comments = '';

if ($_POST['make']) $comments .= 'Manufacturer: '.$_POST['make']."\n";
if ($_POST['code']) $comments .= 'Code: '.$_POST['code']."\n";
if ($_POST['base-colour']) $comments .= 'Colour: '.$_POST['base-colour']."\n";
if ($_POST['year']) $comments .= 'Level: '.$_POST['year']."\n";

if ($comments) tep_session_register('comments');

if (!$comments) tep_redirect('wizard.php');

$breadcrumb->add('wizard1', tep_href_link('wizard.php', '', 'SSL'));


Wizard output information Example on invoice/order edit page for administrators to work on.

Product ID: 386 (How to make this product title, rather than id)
Manufacturer: RAL
Code: 5002
Colour: Blue
Level: Gloss


First site i have created with osCommerce, installed many addons and has worked great. Only problem i am experiencing is this comment problem with the wizard. Any help would be much appreciated. Looking forward into building more sites with osCommerce. Cheers! :)

Link to comment
Share on other sites

Never mind. Found a simple solution, which i cannot believe i didn't think of in the first place. Obviously Kill the session..


// reset session token

$sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());


// Reset customers cart.



This will reset the session, clear the customers 'add to order comments'.

Link to comment
Share on other sites


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

  • Create New...