/wp-content/plugins/ directoryOR
In any post where you have a product add this tag:
[quickshop:NAME_OF_YOUR_PRODUCT:price:YOUR_PRODUCT_PRICE:shipping:YOUR_SHIPPING_PRICE:shipping2:SHIPPING_PRICE_FOR_MULTIPLE_PRODUCTS_AFTER_FIRST:end]
This will create the form button 'Add to Cart' as well as pricing. Shipping is optional, you can end it like so: [quickshop:Test:price:30:end],
or even [quickshop:Test:price:30:shipping:2:end].
You may also create a drop-down using this format: quickshop:NAMEOFYOURPRODUCTTYPE1|NAMEOFYOURPRODUCTTYPE2:price
The | character seperates each product type.
You can also optionally create a price for each of the items in the drop-down instead of having a single price for all of them:
:price:PRICE_1|PRICE_2:shipping:
NEW - Paypal subscribe and donate buttons!
[quickdonate:YOUR_EMAIL:d_name:DONATION_PURPOSE:d_id:OPTIONAL_ID:d_amount:DEFAULT_DONATION_AMOUNT:d_currency:PAYMENT_CURRENCY:d_locale:YOUR_COUNTRY:d_end]
The time type in subscribe is for day, week, month, or year.
[quicksubscribe:YOUR_EMAIL:s_name:SUBSCRIPTION:s_id:OPTIONAL_ID:s_amount:PRICE:s_currency:PAYMENT_CURRENCY:s_locale:YOUR_COUNTRY:sc_value:TIME_PERIOD:sc_time:TIME_TYPE(D,W,M,Y):s_end]
Add either cart widget to your sidebar.
Did you use the Paypal widget? Then you're done! Otherwise, see below for WP-GBCF and CFormsII implementation:
WP-GBCF
If you want shipping calculated as well in this form I'll add it here as soon as I can...
You must remember with the following code to remove all backticks: `
Also WP-GBCF has been updated (v. 2008.02.07). I've give updated line numbers and new code below. If you want old code see a pre 1.3.4 QuickShop README.
Add this after Line 1220 of WP-GBCF V2.0 (wp-gbcf_form.php):
unset($_SESSION['qscart']); // This line clears the cart after the email is sent.
Starting from Line 1286 - 1289 of WP-GBCF V. 2.0 (wp-gbcf_form.php):
$forms.=(' </select>
'.$x_or_h_br.'
<!-- Required Form Comments Area -->
<label for="message">Message</label>'.$x_or_h_br.'<textarea tabindex="'.$tab_message.'" class="textbox" rows="12" cols="60" name="message" id="message">');
// Add quickshop integration by adding the cart info into the text area.
if ($_SESSION['qscart'] && is_array($_SESSION['qscart']))
{
$forms .= ('I would like to order the following items:
');
foreach ($_SESSION['qscart'] as $item)
{
$forms .= ("".$item['name']." - Price: $".$item['price']." - Quantity: ".$item['quantity']."
");
}
}
$forms.=('</textarea>'.$x_or_h_br.'
CFormsII - Thanks to aproxis for providing this solution
Create new form using cForms. For example - it will be the form #2.
Go to the "Core Form Admin / Email Options" Check "Use custom input field NAMES & ID's"
We are taking an example from help topics of cForms.
Create new .php file (orderform.php)
Paste into it (remember to remove any backticks: `):
<?php
/* here is an example from cForms help topics. i've edited it a little bit */
$fields = array();
$formdata = array(
array('Your name[id:yourName]|Name','textfield',0,1,0,1,0), /* is
required, auto clears on focus */
array('Your Email[id:yourEmail]|Email','textfield',0,1,1,1,0), /* is
required, is email, auto clears on focus */
array('Your Order[id:yourorder]','textarea',0,1,0,0,1) /* is
required, and is not editable */
);
$i=0;
foreach ( $formdata as $field ) {
$fields['label'][$i] = $field[0];
$fields['type'][$i] = $field[1];
$fields['isdisabled'][$i] = $field[2];
$fields['isreq'][$i] = $field[3];
$fields['isemail'][$i] = $field[4];
$fields['isclear'][$i] = $field[5];
$fields['isreadonly'][$i++] = $field[6];
}
/* inserting QuickShop-related strings */
if ($_SESSION['qscart'] && is_array($_SESSION['qscart']))
{
foreach ($_SESSION['qscart'] as $item)
{
$forms .= ("".$item['name']." - ".$item['quantity']." pcs.,
".$item['price']." each.
");
}
}
/* inserting is done. now - inserting the form */
insert_custom_cform($fields,'2'); /* 2 - is number of your form */
/* fixing some troubles with newlines */
$fnd = array("\n","\r");
$rep = array('\n','\r');
$result = str_replace($fnd, $rep, addslashes($forms));
/* and now - mix it all together using javascript*/
?>
<script>
document.getElementById("yourorder").value = "<?php echo $result ?>";
</script>
----- Save and close the orderform.php -----
Now, create in wordpress administration a new page (for your order form). And another new page for redirect after submitting order form.
After that - edit your page.php file from your theme folder. You should insert two conditional IF's (before or inside the Loop). Here is an example:
<?php get_header(); ?>
<?php if (is_page('3')) : /* page #3 - it is page for redirect after
submitting form */ ?>
<?php unset($_SESSION['qscart']); ?>
<?php endif; ?>
<?php if (is_page('2')) : /* it is page with the form. you should
point your QuckShop plugin to this page in settings */ ?>
<?php include (TEMPLATEPATH . '/orderform.php'); /* upload
orderform.php in your theme folder */?>
<?php elseif (have_posts()) : while (have_posts()) : the_post(); ?>
------- Save and close the page.php --------
And one more thing. In settings of your form in "Redirection, Messages, Text and Button Label" Look for "Redirect options:" Then select "Enable alternative success page (redirect)" And enter the URL of "page for redirect" (with ID #3)
How to do Optional Totals for the custom forms
$total = 0;
$count = 1;
foreach ($_SESSION['qscart'] as $item)
{
// Following is the code that you would run after the normal 'add info to form textbox code'
$total += $item['price'] * $item['quantity'];
$count += $item['quantity'];
if ($item['shipping2'])
$postage += (($item['quantity'] - 1) * $item['shipping2']) + $item['shipping'];
else
$postage += $item['quantity'] * $item['shipping'];
}
// Following is the totals code that you want to appear in the text box.
// I'll leave it for you to replace 'echo' with the WP-GBCF or CFormsII implementation
if ($count)
{
if (!get_option('quickshop_total'))
{
if ($freeshipv && ($freeshipv < $total))
$postage = 0;
echo "Subtotal: ".output_currency($total, $symbol, $decimal)."
Postage: ".output_currency($postage, $symbol, $decimal);
}
echo "Total: ".output_currency($total + $postage, $symbol, $decimal);
}




