Added/tweaked functionality options
-
I’ve added two options to control some functionality by adding to the cart and purchase confirmed pages. Thought I’d share them here, maybe can end up in a future upgrade, or you can enter them yourself.
File: classes/admin.php
approximately line 79 or 80, I added these lines:scabn_Admin::custom_add_settings_field('checkout_msg', 'Purchase Complete Message: ', 'general', 'general_options','input_textbox_option'); scabn_Admin::custom_add_settings_field('cart_msg', 'Checkout Cart Message: ', 'general', 'general_options','input_textbox_option');' Approximately line 152, I added these lines:
//Generate html for a text box input option
function input_textbox_option($arg) {
$options = get_option(‘scabn_options’);
echo “<input id='” . $arg[‘id’] . “‘ name=’scabn_options[” . $arg[‘id’] . “]’ size=’70’ type=’text’ value='” . $options[$arg[‘id’]] . “‘/>”;}`
I did also change the paypal_pdt_token line to have a longer textbox. Search for the paypal_pdt_token and change “input_text_option” to read “input_textbox_option”.
Then, I copied the file templates/display.php to templates/WHATEVER.php. You can name the file whatever you want it to be.
Add these lines:remove_filter('scabn_shoppingCartInfo',array($this,'shoppingCartInfo'),10); add_filter('scabn_shoppingCartInfo','shippingCartInfo',10,1); function shippingCartInfo($items) { //print "I'm being called!"; $options=get_option('scabn_options'); $cart_msg = $options['cart_msg']; $output= $cart_msg; return $output; }
That one adds your optional shopping cart message into the page. Then add these lines to include the message for when the customer returns with a completed payment.
remove_filter('scabn_display_paypal_receipt',array($this->display,'display_paypal_receipt'),10); add_filter('scabn_display_paypal_receipt','display_paypal_receipt',10,1); function display_paypal_receipt($keyarray) { $options=get_option('scabn_options'); $chkout_msg = $options['checkout_msg']; $output=""; $firstname = $keyarray['first_name']; $lastname = $keyarray['last_name']; $payer_phone = $keyarray['contact_phone']; $payer_email = $keyarray['payer_email']; $amount = $keyarray['payment_gross']; $output .= "<p><h3>Checkout Complete -- Thank you for your purchase!</h3></p>"; $output .= "<h4>Payment Details</h4><ul>\n"; $output .= "<li>Name: $firstname $lastname</li>\n"; $output .= "<li>Phone: $payer_phone</li>\n"; $output .= "<li>email: $payer_email</li>\n"; $output .= "<li>Total Amount: $amount</li>\n"; $output .= "</ul>"; $output .= $chkout_msg; return $output; }
- The topic ‘Added/tweaked functionality options’ is closed to new replies.