- type:
- snippet
- category:
- checkout
- name:
- Displaying PO payment option
- reference:
- http://forum.foxycart.com/comments.php?DiscussionID=4109&page=1
- 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:
- 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.
- 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.
- FoxEE Module –> General Settings –> Click “Automatically Create and Map Member Fields”
- FoxEE Module –> General Settings –> Change the radio button for “Shipping Fields are the same?” = “No”
- Map the shipping phone field to the purchase order field created in step 2.
- Go to the member and click on edit profile. Set the member custom profile field.
FoxyCart Setup:
- Enable purchase order purchase in the payment settings
- 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>
- Css hide the Shipping Phone Field using the CSS override documented on the foxycart site.