Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Contact Form Emails including Shopping Cart Content - Possible?


Recommended Posts



First I want to thank everyone who posted resources in this forum! I have been using OsC for some time now and this was always a great resource: most of the things I wanted to accomplish I was able to do by searching the forum.


There is one thing however that I was hoping to do, but can't seem to find an existing solution. (I tried to figure it out but was sadly unable to as I do not know php coding, I most modifications with "search this - replace with that" methods.)


What I am looking for:

-When a customer sends an email with the contact form (asks a question about a product, shipping methods, or anything else)

-In the sent email (that I receive) I would like the contents of the cart to be included (what products they have in the cart)

-No modifications to the visible user-end would be necessary


This can be really useful information for example when customers assume that I know which product they are talking about (which I obviously don't).


Is it possible? How can this be done in the simplest way?


Thank you in advance!



Link to comment
Share on other sites



Have you considered using the Ask a product question contribution ? (It allows customers to send you mail directly from the product information page and tells you which product they are asking about)


The only other way would involve editing the contact form to include the session and cart information. Since the contact us form is not SSL protected I would not recommend this.




Link to comment
Share on other sites

  • 2 weeks later...



Try this (not sure about the \n as I'm not working on a live site)


in contact_us.php find the line


tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);


add above that:


  //the gent would like the cart contents so we'll go get 'em and add them to $enquiry
    if ($cart->count_contents() > 0) {
  $extra=$our_hr.'Currently in cart:'.$our_hr.'\n';
	 $products = $cart->get_products();
  for ($i=0, $n=sizeof($products); $i<$n; $i++) {
   $extra.= $products[$i]['quantity'].' x '.$products[$i]['name'].$our_hr;

 $extra='\nCart empty';
  //end of extra code


That gets the current cart contents by calling in the values from the cart class and then spins through them one at a time to grab quantity and name - if you want to add in stuff like attributes, prices etc then go to the shopping_cart.php and 'borrow' the code from there

Link to comment
Share on other sites


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

  • Create New...