Optimisations and emails can contain gateway specific text. Closes #131.
This commit is contained in:
parent
c67e4452f9
commit
b7d9cb18ae
|
@ -444,7 +444,7 @@ jQuery(document).ready(function($) {
|
|||
|
||||
}
|
||||
|
||||
if (woocommerce_params.is_checkout==1) {
|
||||
if (woocommerce_params.is_checkout==1 || woocommerce_params.is_pay_page==1) {
|
||||
|
||||
var updateTimer;
|
||||
|
||||
|
@ -553,7 +553,7 @@ jQuery(document).ready(function($) {
|
|||
});
|
||||
|
||||
// Update on page load
|
||||
update_checkout();
|
||||
if (woocommerce_params.is_checkout==1) update_checkout();
|
||||
|
||||
/* AJAX Form Submission */
|
||||
$('form.checkout').submit(function(){
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -29,17 +29,14 @@ class woocommerce_cart {
|
|||
|
||||
/** constructor */
|
||||
function __construct() {
|
||||
add_action('init', array(&$this, 'init'), 1);
|
||||
add_action('init', array(&$this, 'init'), 1); // Get cart on init
|
||||
add_action('wp', array(&$this, 'calculate_totals'), 1); // Defer calculate totals so we can detect page
|
||||
}
|
||||
|
||||
function init () {
|
||||
$this->applied_coupons = array();
|
||||
|
||||
$this->get_cart_from_session();
|
||||
|
||||
if ( isset($_SESSION['coupons']) ) $this->applied_coupons = $_SESSION['coupons'];
|
||||
|
||||
$this->calculate_totals();
|
||||
}
|
||||
|
||||
/** Gets the cart data from the PHP session */
|
||||
|
@ -467,6 +464,9 @@ class woocommerce_cart {
|
|||
$this->subtotal_ex_tax = $this->cart_contents_total_ex_tax; // Subtotal without tax
|
||||
$this->subtotal = $this->cart_contents_total; // Subtotal
|
||||
|
||||
// Only go beyond this point if on the cart/checkout
|
||||
if (!is_checkout() && !is_cart() && !defined('WOOCOMMERCE_CHECKOUT') && !is_ajax()) return;
|
||||
|
||||
// Cart Discounts
|
||||
if ($this->applied_coupons) foreach ($this->applied_coupons as $code) :
|
||||
$coupon = &new woocommerce_coupon( $code );
|
||||
|
|
|
@ -35,6 +35,9 @@ class woocommerce_bacs extends woocommerce_payment_gateway {
|
|||
// Actions
|
||||
add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options'));
|
||||
add_action('woocommerce_thankyou_bacs', array(&$this, 'thankyou_page'));
|
||||
|
||||
// Customer Emails
|
||||
add_action('woocommerce_email_before_order_table', array(&$this, 'email_instructions'), 10, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,45 +133,55 @@ class woocommerce_bacs extends woocommerce_payment_gateway {
|
|||
}
|
||||
|
||||
function thankyou_page() {
|
||||
if ($this->description) echo wpautop(wptexturize($this->description));
|
||||
?><h2><?php _e('Our Details', 'woothemes') ?></h2><ul class="order_details bacs_details"><?php
|
||||
if ($this->account_name) { ?>
|
||||
<li class="account_name">
|
||||
<?php _e('Account Name', 'woothemes') ?>:
|
||||
<strong><?php echo wptexturize($this->account_name) ?></strong>
|
||||
</li>
|
||||
<?php }
|
||||
if ($this->account_number) { ?>
|
||||
<li class="account_number">
|
||||
<?php _e('Account Number', 'woothemes') ?>:
|
||||
<strong><?php echo wptexturize($this->account_number) ?></strong>
|
||||
</li>
|
||||
<?php }
|
||||
if ($this->sort_code) { ?>
|
||||
<li class="sort_code">
|
||||
<?php _e('Sort Code', 'woothemes') ?>:
|
||||
<strong><?php echo wptexturize($this->sort_code) ?></strong>
|
||||
</li>
|
||||
<?php }
|
||||
if ($this->bank_name) { ?>
|
||||
<li class="bank_name">
|
||||
<?php _e('Bank Name', 'woothemes') ?>:
|
||||
<strong><?php echo wptexturize($this->bank_name) ?></strong>
|
||||
</li>
|
||||
<?php }
|
||||
if ($this->iban) { ?>
|
||||
<li class="iban">
|
||||
<?php _e('IBAN', 'woothemes') ?>:
|
||||
<strong><?php echo wptexturize($this->iban) ?></strong>
|
||||
</li>
|
||||
<?php }
|
||||
if ($this->bic) { ?>
|
||||
<li class="bic">
|
||||
<?php _e('BIC', 'woothemes') ?>:
|
||||
<strong><?php echo wptexturize($this->bic) ?></strong>
|
||||
</li>
|
||||
<?php }
|
||||
echo "</ul>";
|
||||
if ($this->description) echo wpautop(wptexturize($this->description));
|
||||
|
||||
?><h2><?php _e('Our Details', 'woothemes') ?></h2><ul class="order_details bacs_details"><?php
|
||||
|
||||
$fields = array(
|
||||
'account_name' => __('Account Name', 'woothemes'),
|
||||
'account_number'=> __('Account Number', 'woothemes'),
|
||||
'sort_code' => __('Sort Code', 'woothemes'),
|
||||
'bank_name' => __('Bank Name', 'woothemes'),
|
||||
'iban' => __('IBAN', 'woothemes'),
|
||||
'bic' => __('BIC', 'woothemes')
|
||||
);
|
||||
|
||||
foreach ($fields as $key=>$value) :
|
||||
echo '<li class="'.$key.'">'.$key.': <strong>'.wptexturize($this->$key).'</strong></li>';
|
||||
endforeach;
|
||||
|
||||
?></ul><?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Add text to user email
|
||||
**/
|
||||
function email_instructions( $order, $sent_to_admin ) {
|
||||
|
||||
if ( $sent_to_admin ) return;
|
||||
|
||||
if ( $order->status !== 'on-hold') return;
|
||||
|
||||
if ( $order->payment_method !== 'bacs') return;
|
||||
|
||||
if ($this->description) echo wpautop(wptexturize($this->description));
|
||||
|
||||
?><h2><?php _e('Our Details', 'woothemes') ?></h2><ul class="order_details bacs_details"><?php
|
||||
|
||||
$fields = array(
|
||||
'account_name' => __('Account Name', 'woothemes'),
|
||||
'account_number'=> __('Account Number', 'woothemes'),
|
||||
'sort_code' => __('Sort Code', 'woothemes'),
|
||||
'bank_name' => __('Bank Name', 'woothemes'),
|
||||
'iban' => __('IBAN', 'woothemes'),
|
||||
'bic' => __('BIC', 'woothemes')
|
||||
);
|
||||
|
||||
foreach ($fields as $key=>$value) :
|
||||
echo '<li class="'.$key.'">'.$key.': <strong>'.wptexturize($this->$key).'</strong></li>';
|
||||
endforeach;
|
||||
|
||||
?></ul><?php
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,6 +29,9 @@ class woocommerce_cheque extends woocommerce_payment_gateway {
|
|||
// Actions
|
||||
add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options'));
|
||||
add_action('woocommerce_thankyou_cheque', array(&$this, 'thankyou_page'));
|
||||
|
||||
// Customer Emails
|
||||
add_action('woocommerce_email_before_order_table', array(&$this, 'email_instructions'), 10, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,6 +93,16 @@ class woocommerce_cheque extends woocommerce_payment_gateway {
|
|||
if ($this->description) echo wpautop(wptexturize($this->description));
|
||||
}
|
||||
|
||||
function email_instructions( $order, $sent_to_admin ) {
|
||||
if ( $sent_to_admin ) return;
|
||||
|
||||
if ( $order->status !== 'on-hold') return;
|
||||
|
||||
if ( $order->payment_method !== 'cheque') return;
|
||||
|
||||
if ($this->description) echo wpautop(wptexturize($this->description));
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the payment and return the result
|
||||
**/
|
||||
|
|
|
@ -92,6 +92,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
|
|||
* Added functions which show tax/vat conditionally
|
||||
* Made use of transients to store average ratings and improve performance
|
||||
* Added page installer on installation to make it optional (you may want to import your pages)
|
||||
* BACS and Cheque gateways now contain payment instructions
|
||||
* Custom field for product total_sales when sold
|
||||
* Best sellers widget based on new total_sales field
|
||||
* Ability to exclude product ids
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
<p><?php _e("Your order is complete. Your order's details are below:", 'woothemes'); ?></p>
|
||||
|
||||
<?php do_action('woocommerce_email_before_order_table', $order, false); ?>
|
||||
|
||||
<h2><?php echo __('Order #:', 'woothemes') . ' ' . $order->id; ?></h2>
|
||||
|
||||
<table cellspacing="0" cellpadding="2" style="width: 100%;">
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
<p><?php echo sprintf( __("An order has been created for you on “%s”. To pay for this order please use the following link: %s", 'woothemes'), get_bloginfo('name'), $order->get_checkout_payment_url() ); ?></p>
|
||||
|
||||
<?php do_action('woocommerce_email_before_order_table', $order, false); ?>
|
||||
|
||||
<h2><?php echo __('Order #:', 'woothemes') . ' ' . $order->id; ?></h2>
|
||||
|
||||
<table cellspacing="0" cellpadding="2" style="width: 100%;">
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
<?php do_action('woocommerce_email_header'); ?>
|
||||
|
||||
<p><?php _e("Thank you, we are now processing your order. Your order's details are below:", 'woothemes'); ?></p>
|
||||
<p><?php _e("Thank you, we are now processing your order. Your order's details are below.", 'woothemes'); ?></p>
|
||||
|
||||
<?php do_action('woocommerce_email_before_order_table', $order, false); ?>
|
||||
|
||||
<h2><?php echo __('Order #:', 'woothemes') . ' ' . $order->id; ?></h2>
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
<p><?php echo __('You have received an order from', 'woothemes') . ' ' . $order->billing_first_name . ' ' . $order->billing_last_name . __(". Their order is as follows:", 'woothemes'); ?></p>
|
||||
|
||||
<?php do_action('woocommerce_email_before_order_table', $order, true); ?>
|
||||
|
||||
<h2><?php echo __('Order #:', 'woothemes') . ' ' . $order->id; ?></h2>
|
||||
|
||||
<table cellspacing="0" cellpadding="2" style="width: 100%;">
|
||||
|
|
|
@ -237,12 +237,18 @@ function woocommerce_frontend_scripts() {
|
|||
if (isset($_SESSION['min_price'])) $woocommerce_params['min_price'] = $_SESSION['min_price'];
|
||||
if (isset($_SESSION['max_price'])) $woocommerce_params['max_price'] = $_SESSION['max_price'];
|
||||
|
||||
if ( is_page(get_option('woocommerce_checkout_page_id')) || is_page(get_option('woocommerce_pay_page_id')) ) :
|
||||
if ( is_page(get_option('woocommerce_checkout_page_id')) ) :
|
||||
$woocommerce_params['is_checkout'] = 1;
|
||||
else :
|
||||
$woocommerce_params['is_checkout'] = 0;
|
||||
endif;
|
||||
|
||||
if (is_page(get_option('woocommerce_pay_page_id'))) :
|
||||
$woocommerce_params['is_pay_page'] = 1;
|
||||
else :
|
||||
$woocommerce_params['is_pay_page'] = 0;
|
||||
endif;
|
||||
|
||||
if ( is_cart() ) :
|
||||
$woocommerce_params['is_cart'] = 1;
|
||||
else :
|
||||
|
|
Loading…
Reference in New Issue