type:
snippet
category:
checkout
name:
Displaying PO payment option
reference:
http://forum.foxycart.com/comments.php?DiscussionID=4109&page=1
tags:
snippets, checkout, advance
date:
2011-05-27

Displaying PO payment option

Displaying PO payment option if certain criteria is met, using the shipping_phone field to fake a custom field for the customer.

FoxEE Setup:

  1. You must force the user to login on the EE side before you checkout. You can accomplish this by using the custom add to cart foxEE tag and using a hidden input redirect to redirect the user to a EE custom login/checkout page. Make sure to turn FoxyBox Off. You can turn it on later once you force the user to login and/or if you want the ability to update quantity of the items in the cart. I didn't really have time to figure out how to update quantity using foxEE tags.
  2. Create a custom profile field called purchase order under the members and groups section. I use a straight text field and use either 0 or 1 in that field. 0 for false, 1 for true.
  3. FoxEE Module –> General Settings –> Click “Automatically Create and Map Member Fields”
  4. FoxEE Module –> General Settings –> Change the radio button for “Shipping Fields are the same?” = “No”
  5. Map the shipping phone field to the purchase order field created in step 2.
  6. Go to the member and click on edit profile. Set the member custom profile field.

FoxyCart Setup:

  1. Enable purchase order purchase in the payment settings
  2. Add the following code to the checkout template right above the </head> tag.
<script type="text/javascript">
jQuery(document).ready(function() {
var purchase_order = parseInt(jQuery('input[name=shipping_phone]').val());
window.alert( $('input[name=shipping_phone]').val());
if (purchase_order == 0) {
FC.checkout.config.storeDetails.supportsPurchaseOrder = false;
} else {
FC.checkout.config.storeDetails.supportsPurchaseOrder = true;
}
});</script>
  1. Css hide the Shipping Phone Field using the CSS override documented on the foxycart site.

Site Tools