function show_wp_cart_email_settings_page() { if (isset($_POST['wpspc_email_settings_update'])) { $nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce, 'wpspc_email_settings_update')) { wp_die('Error! Nonce Security Check Failed! Go back to email settings menu and save the settings again.'); } update_option('wpspc_send_buyer_email', isset($_POST['wpspc_send_buyer_email']) && $_POST['wpspc_send_buyer_email'] != '' ? 'checked="checked"' : ''); update_option('wpspc_buyer_from_email', stripslashes((string) $_POST["wpspc_buyer_from_email"])); update_option('wpspc_buyer_email_subj', stripslashes((string) $_POST["wpspc_buyer_email_subj"])); update_option('wpspc_buyer_email_body', stripslashes((string) $_POST["wpspc_buyer_email_body"])); update_option('wpspc_send_seller_email', isset($_POST['wpspc_send_seller_email']) && $_POST['wpspc_send_seller_email'] != '' ? 'checked="checked"' : ''); update_option('wpspc_notify_email_address', stripslashes((string) $_POST["wpspc_notify_email_address"])); update_option('wpspc_seller_email_subj', stripslashes((string) $_POST["wpspc_seller_email_subj"])); update_option('wpspc_seller_email_body', stripslashes((string) $_POST["wpspc_seller_email_body"])); echo '<div id="message" class="updated fade"><p><strong>'; echo 'Email Settings Updated!'; echo '</strong></p></div>'; } $wpspc_send_buyer_email = ''; if (get_option('wpspc_send_buyer_email')) { $wpspc_send_buyer_email = 'checked="checked"'; } $wpspc_buyer_from_email = get_option('wpspc_buyer_from_email'); $wpspc_buyer_email_subj = get_option('wpspc_buyer_email_subj'); $wpspc_buyer_email_body = get_option('wpspc_buyer_email_body'); $wpspc_send_seller_email = ''; if (get_option('wpspc_send_seller_email')) { $wpspc_send_seller_email = 'checked="checked"'; } $wpspc_notify_email_address = get_option('wpspc_notify_email_address'); if (empty($wpspc_notify_email_address)) { $wpspc_notify_email_address = get_bloginfo('admin_email'); //default value } $wpspc_seller_email_subj = get_option('wpspc_seller_email_subj'); if (empty($wpspc_seller_email_subj)) { $wpspc_seller_email_subj = "Notification of product sale"; } $wpspc_seller_email_body = get_option('wpspc_seller_email_body'); if (empty($wpspc_seller_email_body)) { $wpspc_seller_email_body = "Dear Seller\n" . "\nThis mail is to notify you of a product sale.\n" . "\n{product_details}" . "\n\nThe sale was made to {first_name} {last_name} ({payer_email})" . "\n\nThanks"; } ?> <div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;"> <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "wordpress-simple-paypal-shopping-cart"); ?> <br /> <a href="https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" target="_blank"><?php _e("WP Simple Cart Homepage", "wordpress-simple-paypal-shopping-cart"); ?> </a></p> </div> <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <?php wp_nonce_field('wpspc_email_settings_update'); ?> <input type="hidden" name="info_update" id="info_update" value="true" /> <div class="postbox"> <h3 class="hndle"><label for="title"><?php _e("Purchase Confirmation Email Settings", "wordpress-simple-paypal-shopping-cart"); ?> </label></h3> <div class="inside"> <p><i><?php _e("The following options affect the emails that gets sent to your buyers after a purchase.", "wordpress-simple-paypal-shopping-cart"); ?> </i></p> <table class="form-table"> <tr valign="top"> <th scope="row"><?php _e("Send Emails to Buyer After Purchase", "wordpress-simple-paypal-shopping-cart"); ?> </th> <td><input type="checkbox" name="wpspc_send_buyer_email" value="1" <?php echo $wpspc_send_buyer_email; ?> /><span class="description"><?php _e("If checked the plugin will send an email to the buyer with the sale details. If digital goods are purchased then the email will contain the download links for the purchased products.", "wordpress-simple-paypal-shopping-cart"); ?> </a></span></td> </tr> <tr valign="top"> <th scope="row"><?php _e("From Email Address", "wordpress-simple-paypal-shopping-cart"); ?> </th> <td><input type="text" name="wpspc_buyer_from_email" value="<?php echo $wpspc_buyer_from_email; ?> " size="50" /> <br /><p class="description"><?php _e("Example: Your Name <sales@your-domain.com> This is the email address that will be used to send the email to the buyer. This name and email address will appear in the from field of the email.", "wordpress-simple-paypal-shopping-cart"); ?> </p></td> </tr> <tr valign="top"> <th scope="row"><?php _e("Buyer Email Subject", "wordpress-simple-paypal-shopping-cart"); ?> </th> <td><input type="text" name="wpspc_buyer_email_subj" value="<?php echo $wpspc_buyer_email_subj; ?> " size="50" /> <br /><p class="description"><?php _e("This is the subject of the email that will be sent to the buyer.", "wordpress-simple-paypal-shopping-cart"); ?> </p></td> </tr> <tr valign="top"> <th scope="row"><?php _e("Buyer Email Body", "wordpress-simple-paypal-shopping-cart"); ?> </th> <td> <textarea name="wpspc_buyer_email_body" cols="90" rows="7"><?php echo $wpspc_buyer_email_body; ?> </textarea> <br /><p class="description"><?php _e("This is the body of the email that will be sent to the buyer. Do not change the text within the braces {}. You can use the following email tags in this email body field:", "wordpress-simple-paypal-shopping-cart"); ?> <br />{first_name} – <?php _e("First name of the buyer", "wordpress-simple-paypal-shopping-cart"); ?> <br />{last_name} – <?php _e("Last name of the buyer", "wordpress-simple-paypal-shopping-cart"); ?> <br />{payer_email} – <?php _e("Email Address of the buyer", "wordpress-simple-paypal-shopping-cart"); ?> <br />{address} – <?php _e("Address of the buyer", "wordpress-simple-paypal-shopping-cart"); ?> <br />{product_details} – <?php _e("The item details of the purchased product (this will include the download link for digital items).", "wordpress-simple-paypal-shopping-cart"); ?> <br />{transaction_id} – <?php _e("The unique transaction ID of the purchase", "wordpress-simple-paypal-shopping-cart"); ?> <br />{purchase_amt} – <?php _e("The amount paid for the current transaction", "wordpress-simple-paypal-shopping-cart"); ?> <br />{purchase_date} – <?php _e("The date of the purchase", "wordpress-simple-paypal-shopping-cart"); ?> <br />{coupon_code} – <?php _e("Coupon code applied to the purchase", "wordpress-simple-paypal-shopping-cart"); ?> </p></td> </tr> <tr valign="top"> <th scope="row"><?php _e("Send Emails to Seller After Purchase", "wordpress-simple-paypal-shopping-cart"); ?> </th> <td><input type="checkbox" name="wpspc_send_seller_email" value="1" <?php echo $wpspc_send_seller_email; ?> /><span class="description"><?php _e("If checked the plugin will send an email to the seller with the sale details", "wordpress-simple-paypal-shopping-cart"); ?> </a></span></td> </tr> <tr valign="top"> <th scope="row"><?php _e("Notification Email Address*", "wordpress-simple-paypal-shopping-cart"); ?> </th> <td><input type="text" name="wpspc_notify_email_address" value="<?php echo $wpspc_notify_email_address; ?> " size="50" /> <br /><p class="description"><?php _e("This is the email address where the seller will be notified of product sales. You can put multiple email addresses separated by comma (,) in the above field to send the notification to multiple email addresses.", "wordpress-simple-paypal-shopping-cart"); ?> </p></td> </tr> <tr valign="top"> <th scope="row"><?php _e("Seller Email Subject*", "wordpress-simple-paypal-shopping-cart"); ?> </th> <td><input type="text" name="wpspc_seller_email_subj" value="<?php echo $wpspc_seller_email_subj; ?> " size="50" /> <br /><p class="description"><?php _e("This is the subject of the email that will be sent to the seller for record.", "wordpress-simple-paypal-shopping-cart"); ?> </p></td> </tr> <tr valign="top"> <th scope="row"><?php _e("Seller Email Body*", "wordpress-simple-paypal-shopping-cart"); ?> </th> <td> <textarea name="wpspc_seller_email_body" cols="90" rows="7"><?php echo $wpspc_seller_email_body; ?> </textarea> <br /><p class="description"><?php _e("This is the body of the email that will be sent to the seller for record. Do not change the text within the braces {}. You can use the following email tags in this email body field:", "wordpress-simple-paypal-shopping-cart"); ?> <br />{first_name} – <?php _e("First name of the buyer", "wordpress-simple-paypal-shopping-cart"); ?> <br />{last_name} – <?php _e("Last name of the buyer", "wordpress-simple-paypal-shopping-cart"); ?> <br />{payer_email} – <?php _e("Email Address of the buyer", "wordpress-simple-paypal-shopping-cart"); ?> <br />{address} – <?php _e("Address of the buyer", "wordpress-simple-paypal-shopping-cart"); ?> <br />{product_details} – <?php _e("The item details of the purchased product (this will include the download link for digital items).", "wordpress-simple-paypal-shopping-cart"); ?> <br />{transaction_id} – <?php _e("The unique transaction ID of the purchase", "wordpress-simple-paypal-shopping-cart"); ?> <br />{purchase_amt} – <?php _e("The amount paid for the current transaction", "wordpress-simple-paypal-shopping-cart"); ?> <br />{purchase_date} – <?php _e("The date of the purchase", "wordpress-simple-paypal-shopping-cart"); ?> <br />{coupon_code} – <?php _e("Coupon code applied to the purchase", "wordpress-simple-paypal-shopping-cart"); ?> </p></td> </tr> </table> </div></div> <div class="submit"> <input type="submit" class="button-primary" name="wpspc_email_settings_update" value="<?php echo __("Update Options »", "wordpress-simple-paypal-shopping-cart"); ?> " /> </div> </form> <?php wpspsc_settings_menu_footer(); }
function show_wp_cart_coupon_discount_settings_page() { if (isset($_POST['wpspsc_coupon_settings'])) { $nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce, 'wpspsc_coupon_settings')) { wp_die('Error! Nonce Security Check Failed! Go back to Coupon/Discount menu and save the settings again.'); } update_option('wpspsc_enable_coupon', isset($_POST['wpspsc_enable_coupon']) && $_POST['wpspsc_enable_coupon'] == '1' ? '1' : ''); echo '<div id="message" class="updated fade"><p><strong>'; echo 'Coupon Settings Updated!'; echo '</strong></p></div>'; } if (isset($_POST['wpspsc_save_coupon'])) { $nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce, 'wpspsc_save_coupon')) { wp_die('Error! Nonce Security Check Failed! Go back to email settings menu and save the settings again.'); } $collection_obj = WPSPSC_Coupons_Collection::get_instance(); $coupon_code = trim(stripcslashes($_POST["wpspsc_coupon_code"])); $discount_rate = trim($_POST["wpspsc_coupon_rate"]); $expiry_date = trim($_POST["wpspsc_coupon_expiry_date"]); $coupon_item = new WPSPSC_COUPON_ITEM($coupon_code, $discount_rate, $expiry_date); $collection_obj->add_coupon_item($coupon_item); WPSPSC_Coupons_Collection::save_object($collection_obj); echo '<div id="message" class="updated fade"><p><strong>'; echo 'Coupon Saved!'; echo '</strong></p></div>'; } if (isset($_REQUEST['wpspsc_delete_coupon_id'])) { $coupon_id = $_REQUEST['wpspsc_delete_coupon_id']; $collection_obj = WPSPSC_Coupons_Collection::get_instance(); $collection_obj->delete_coupon_item_by_id($coupon_id); echo '<div id="message" class="updated fade"><p>'; echo 'Coupon successfully deleted!'; echo '</p></div>'; } $wpspsc_enable_coupon = ''; if (get_option('wpspsc_enable_coupon') == '1') { $wpspsc_enable_coupon = 'checked="checked"'; } ?> <div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;"> <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "wordpress-simple-paypal-shopping-cart"); ?> <br /> <a href="https://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" target="_blank"><?php _e("WP Simple Cart Homepage", "wordpress-simple-paypal-shopping-cart"); ?> </a></p> </div> <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <?php wp_nonce_field('wpspsc_coupon_settings'); ?> <input type="hidden" name="coupon_settings_update" id="coupon_settings_update" value="true" /> <div class="postbox"> <h3 class="hndle"><label for="title"><?php _e("Coupon/Discount Settings", "wordpress-simple-paypal-shopping-cart"); ?> </label></h3> <div class="inside"> <form method="post" action=""> <table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6"> <tr valign="top"> <th scope="row"><?php _e("Enable Discount Coupon Feature", "wordpress-simple-paypal-shopping-cart"); ?> </th> <td> <input type="checkbox" name="wpspsc_enable_coupon" value="1" <?php echo $wpspsc_enable_coupon; ?> /> <span class="description"><?php _e("When checked your customers will be able to enter a coupon code in the shopping cart before checkout.", "wordpress-simple-paypal-shopping-cart"); ?> </span> </td> </tr> <tr valign="top"> <th scope="row"> <div class="submit"> <input type="submit" name="wpspsc_coupon_settings" class="button-primary" value="<?php echo __("Update »", "wordpress-simple-paypal-shopping-cart"); ?> " /> </div> </th> <td></td> </tr> </table> </form> </div></div> <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <?php wp_nonce_field('wpspsc_save_coupon'); ?> <input type="hidden" name="info_update" id="info_update" value="true" /> <div class="postbox"> <h3 class="hndle"><label for="title"><?php _e("Add Coupon/Discount", "wordpress-simple-paypal-shopping-cart"); ?> </label></h3> <div class="inside"> <form method="post" action=""> <table class="form-table" border="0" cellspacing="0" cellpadding="6" style="max-width:650px;"> <tr valign="top"> <td width="25%" align="left"> Coupon Code<br /> <input name="wpspsc_coupon_code" type="text" size="15" value=""/> </td> <td width="25%" align="left"> Discount Rate (%)<br /> <input name="wpspsc_coupon_rate" type="text" size="7" value=""/> </td> <td width="25%" align="left"> Expiry Date<br /> <input name="wpspsc_coupon_expiry_date" class="wpspsc_coupon_expiry" type="text" size="15" value=""/> </td> <td width="25%" align="left"> <div class="submit"> <input type="submit" name="wpspsc_save_coupon" class="button-primary" value="<?php echo __("Save Coupon »", "wordpress-simple-paypal-shopping-cart"); ?> " /> </div> </td> </tr> </table> </form> </div></div> <?php //display table $output = ""; $output .= ' <table class="widefat" style="max-width:800px;"> <thead><tr> <th scope="col">' . __("Coupon Code", "wordpress-simple-paypal-shopping-cart") . '</th> <th scope="col">' . __("Discount Rate (%)", "wordpress-simple-paypal-shopping-cart") . '</th> <th scope="col">' . __("Expiry Date", "wordpress-simple-paypal-shopping-cart") . '</th> <th scope="col"></th> </tr></thead> <tbody>'; $collection_obj = WPSPSC_Coupons_Collection::get_instance(); if ($collection_obj) { $coupons = $collection_obj->coupon_items; $number_of_coupons = count($coupons); if ($number_of_coupons > 0) { $row_count = 0; foreach ($coupons as $coupon) { $output .= '<tr>'; $output .= '<td><strong>' . $coupon->coupon_code . '</strong></td>'; $output .= '<td><strong>' . $coupon->discount_rate . '</strong></td>'; if (empty($coupon->expiry_date)) { $output .= '<td><strong>' . __('No Expiry', 'wordpress-simple-paypal-shopping-cart') . '</strong></td>'; } else { $output .= '<td><strong>' . $coupon->expiry_date . '</strong></td>'; } $output .= '<td>'; $output .= "<form method=\"post\" action=\"\" onSubmit=\"return confirm('Are you sure you want to delete this entry?');\">"; $output .= "<input type=\"hidden\" name=\"wpspsc_delete_coupon_id\" value=" . $coupon->id . " />"; $output .= '<input style="border: none; background-color: transparent; padding: 0; cursor:pointer;" type="submit" name="Delete" value="Delete">'; $output .= "</form>"; $output .= '</td>'; $output .= '</tr>'; $row_count = $row_count + 1; } } else { $output .= '<tr><td colspan="5">' . __("No Coupons Configured.", "wordpress-simple-paypal-shopping-cart") . '</td></tr>'; } } else { $output .= '<tr><td colspan="5">' . __("No Record found", "wordpress-simple-paypal-shopping-cart") . '</td></tr>'; } $output .= '</tbody> </table>'; //$output .= '<p><a href="options-general.php?page=wordpress-paypal-shopping-cart&action=discount-settings">Add New</a></p>'; echo $output; wpspsc_settings_menu_footer(); }