| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Email cart contents? | ||||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() Hi,
I need to use "Email us for shipping costs" on a site for any country outside the UK. For anyone outside the UK I have not put any shipping costs into my xcart admin. The user goes through to the basket and sees the message "Before we can process your order we need to work out your shipping costs." which is fine. I need for the to somehow be able to send me an email with their cart contents so that I can work out their shipping can this be done? ie I don not want them to have to type out everything in their basket just press a button and I get a copy of the products. Thanks in advance Dan
__________________
X Cart Version 4.2 |
|||||||
#2
|
|||||||||
|
|||||||||
![]() Do you have any PHP experience?
If so, you could create a PHP page on the site root, say called emailcart.php - in this, the first lines would read <?php require "./auth.php"; x_load("cart"); This will give you access to the $cart variable, then just loop through $cart["products"], writing the details to a table, then use some of the other $cart variables to put in total, taxes, discounts etc. then wrap that whole string up into PHP's mail function and send it off to your address. Then simply use JavaScript so that when someone clicks on that button, a popup box appears with emailcart.php loaded. Use JavaScript within emailcart.php to close the popup window when the page has fully loaded (i.e. the mail has been sent). Does this make sense?
__________________
John ElegantXMods.com QuickOrder AJAX-based search and ordering system now available giving you complete control over how customers browse and search for your products. Click here for details. PriceSlider - easily filter categories by price range - only $9.99 - details here X-Cart 4.1, X-Cart 4.2 on Windows/IIS and Linux/Apache. |
|||||||||
#3
|
|||||||
|
|||||||
![]() Thank you very much for the reply.
Not sure I understand the following: This will give you access to the $cart variable, then just loop through $cart["products"], writing the details to a table, then use some of the other $cart variables to put in total, taxes, discounts etc. then wrap that whole string up into PHP's mail function and send it off to your address. The other parts make sense. Thank you again, this is very helpful. Regards Dan
__________________
X Cart Version 4.2 |
|||||||
#4
|
|||||||
|
|||||||
![]() Sorry to bother you again but how would the script be written to email the cart contents straight through to the email address info@test.com.
__________________
X Cart Version 4.2 |
|||||||
#5
|
|||||||||
|
|||||||||
![]() Not tested this, but it should be pretty close to what you want:
<?php require "./auth.php"; x_load('cart'); $html = " <body> <h2>Date: ". date(DATE_RFC822) ."</h2> <table> <tr> <th>Product Code</th> <th>Product Name</th> <th>Price (". $config["General"]["currency_symbol"] .")</th> <th>Qty</th> <th>Subtotal (". $config["General"]["currency_symbol"] .")</th> </tr>"; for ($i = 0; $i < $cart["max_cartid"]; $i++){ $html .= "<tr> <td>". $cart["products"][$i]["productcode"] ."</td> <td>". $cart["products"][$i]["product"] ."</td> <td>". $cart["products"][$i]["price"] ."</td> <td>". $cart["products"][$i]["amount"] ."</td> <td>". $cart["products"][$i]["display_subtotal"] ."</td> </tr>"; } $html .= "</table> <table> <tr> <td>Subtotal (". $config["General"]["currency_symbol"] .")</td> <td>". $cart["subtotal"] ."</td> </tr> <tr> <td>Discount (". $config["General"]["currency_symbol"] .")</td> <td>". $cart["discount"] ."</td> </tr> <tr> <td>Taxes: (". $config["General"]["currency_symbol"] .")</td> <td>". $cart["tax_cost"] ."</td> </tr> <tr> <td><b>Total (". $config["General"]["currency_symbol"] .")</b></td> <td><b>". $cart["display_discounted_subtotal"] ."</b></td> </tr> </table> </body>"; mail ("from@domain.com", "to@domain.com", "Subject Line", $html); ?>
__________________
John ElegantXMods.com QuickOrder AJAX-based search and ordering system now available giving you complete control over how customers browse and search for your products. Click here for details. PriceSlider - easily filter categories by price range - only $9.99 - details here X-Cart 4.1, X-Cart 4.2 on Windows/IIS and Linux/Apache. |
|||||||||
#6
|
|||||||
|
|||||||
![]() Thanks very much,
Just tried it out. created a new page called emailcart.php and put this in my xcart directory root directory along with the home.php, cart.php etc.) Copied the code you kindly wrote below into emailcart.php and put the file over. Then made a link on my cart.php page to open up mydomain/shop/emailcart.php in a blank window, the page opens up but it is completely blank. There is nothing at all on the page. Any ideas? I'm sorry to keep on bothering you but i'm not that experienced with this code. Sorry Thank you for your patience and help, it is very much appreciated. Regards Dan
__________________
X Cart Version 4.2 |
|||||||
#7
|
|||||||||
|
|||||||||
![]() The page itself won't show anything, all it does is put together a bunch of text and mails it out.
A few tips: If there are no error messages, then the mail may have been sent correctly, did you remember to change 'to@domain.com'? Have you got Firebug and Firefox? Did the page request come back with 200 OK or 500 Internal Server Error?
__________________
John ElegantXMods.com QuickOrder AJAX-based search and ordering system now available giving you complete control over how customers browse and search for your products. Click here for details. PriceSlider - easily filter categories by price range - only $9.99 - details here X-Cart 4.1, X-Cart 4.2 on Windows/IIS and Linux/Apache. |
|||||||||
#8
|
|||||||
|
|||||||
![]() yes, I did change the email address to the one I wanted.
Just cannot get it to work for some reason. I cannot see any button/link to close the window and also no email whatsoever comes back to me ![]() Regards Dan
__________________
X Cart Version 4.2 |
|||||||
#9
|
|||||||||
|
|||||||||
![]() Hi Dan,
Unfortunately I don't have the time at present to debug this for you. Have you tried the following?
__________________
John ElegantXMods.com QuickOrder AJAX-based search and ordering system now available giving you complete control over how customers browse and search for your products. Click here for details. PriceSlider - easily filter categories by price range - only $9.99 - details here X-Cart 4.1, X-Cart 4.2 on Windows/IIS and Linux/Apache. |
|||||||||
#10
|
|||||||||
|
|||||||||
![]() Any luck with this?
I'm sure it's just a typo - did you manage to add error reporting to the page?
__________________
John ElegantXMods.com QuickOrder AJAX-based search and ordering system now available giving you complete control over how customers browse and search for your products. Click here for details. PriceSlider - easily filter categories by price range - only $9.99 - details here X-Cart 4.1, X-Cart 4.2 on Windows/IIS and Linux/Apache. |
|||||||||
|
|||
X-Cart forums © 2001-2020
|