Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function mf_productSummary($atts) {
- extract(shortcode_atts(array(
- 'formID' => '7'
- ), $atts));
- $thisForm = RGFormsModel::get_form_meta($formID);
- $result .= "<h1>Purchase Summary</h1>";
- foreach($thisForm['fields'] as $index => $fieldInfo) {
- if($fieldInfo['type'] == 'product') {
- $subLabel = $fieldInfo['label'];
- $postName = 'input_'.$fieldInfo['id']; //build name to get $_POST value using rgpost function
- $postedFieldValue = rgpost($postName);
- $choiceText = "(".RGFormsModel::get_choice_text($fieldInfo, $postedFieldValue, $fieldInfo['id']).")";
- $result .= "<h3>".formatProductPrice($postedFieldValue)." - $subLabel $choiceText</h3>";
- }
- }
- return $result;
- }
- add_shortcode('product_summary', 'mf_productSummary');
- function formatProductPrice($rawVal) {
- return "$".money_format('%6.2n',substr($rawVal,0,strpos($rawVal,'|')));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement