Using Website Favorites as Order Submission

By Rusty - January 19, 2011 - edited: January 20, 2011

I'm trying to use/manipulate the Website Favorites plug so that a viewer can add individual items from a list page to a list (easily done via Website Favorites). Then from the favorites overview page be able to enter a quantity for each items in the Favorites List. Then the viewer clicks submit, and the email form will pull the User Company Name, Phone, & Address from the User Accounts page, and also include the text from the Text Input (Item quantity) and the Item name.

And I need to display to display the total number of items favorited as well...

Any suggestions on how best to proceed would be greatly appreciated.
Rusty

Re: [Rusty] Using Website Favorites as Order Submission

By Jason - January 20, 2011

Hi Rusty,

join() is used for adding a string in between elements of an array. since item_number is a single value, you can use the concatenation operator (.) to put the _qty suffix on the end like this:

$qty_string = $record['item_number'] . "_qty";

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Using Website Favorites as Order Submission

By Rusty - January 26, 2011 - edited: January 26, 2011

The concatenation operator fixed the error messages, however the email that's being generated are still coming through blank.

I can't seem to get to the variable to pull up properly.

<!-- START SEND MAIL SCRIPT -->
<div id="done">
<h2>Order Successfully Submitted!</h2>
<p>Your order has been placed.<br/ >
Thank you for your business, should you have any questions please call us at 503-649-0168.</p>
</div>
<?php error_reporting( E_ALL & ~E_NOTICE );
$mail = $_POST['email'];


$to = "rusty@website.com";
$subject = "New Order from Website";
$headers = "From: Website <noreply@website.com>";
$message = "Sent from the Website\n";
//$message .= "\nName: " . $_POST['contactname'];
//$message .= "\nEmail: " . $_POST['contactemail'];
//$message .= "\nTelephone: " . $_POST['contactphone'];

foreach ($favoriteRecords as $record) {
$message .= "\n________________________________________________________________";
This part works great with concatenation
If I just have $message .= "\nQuantity:" . $qty_string;
The form will email the item number with _qty appended to it
something like 987654_qty

$qty_string = $record['item_number'] . "_qty";
This is where I was having issues.
I got it working by removing the '' Single Quotes within the brackets
I can dynamically call up the joined item number quantity with this

$message .= "\nQuantity:" . $_POST[$qty_string];

$message .= "\nItem Number:" . $record['item_number'];
$message .= "\nDescription:" . $record['title'];

}

$message .= "\nMessage: " . $_POST['contactmessage'];

//Receive Variable
$sentOk = mail($to,$subject,$message,$headers);
}
?>
<!-- END SEND MAIL SCRIPT -->

Rusty

Re: [Rusty] Using Website Favorites as Order Submission

By Jason - January 26, 2011

Hi Rusty,

Glad to hear you got that sorted out. Let me know if you run into any other issues.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/