Admin improvements

This commit is contained in:
Mike Jolley 2011-08-19 00:14:35 +01:00
parent 1472315f1b
commit 3a4effd48a
8 changed files with 116 additions and 31 deletions

View File

@ -245,6 +245,14 @@ $options_settings = apply_filters('woocommerce_options_settings', array(
) )
), ),
array(
'name' => __('Cart redirect', 'woothemes'),
'desc' => __('Redirect to cart after adding a product to the cart (on single product pages)', 'woothemes'),
'id' => 'woocommerce_cart_redirect_after_add',
'std' => 'no',
'type' => 'checkbox'
),
array( 'type' => 'sectionend'), array( 'type' => 'sectionend'),
array( 'name' => __('Pricing Settings', 'woothemes'), 'type' => 'title','desc' => '', 'id' => '' ), array( 'name' => __('Pricing Settings', 'woothemes'), 'type' => 'title','desc' => '', 'id' => '' ),
@ -822,12 +830,28 @@ function woocommerce_admin_fields($options) {
break; break;
case "gateway_options" : case "gateway_options" :
$links = array();
foreach (woocommerce_payment_gateways::payment_gateways() as $gateway) :
$title = ($gateway->title) ? ucwords($gateway->title) : ucwords($gateway->id);
$links[] = '<a href="#gateway-'.$gateway->id.'">'.$title.'</a>';
endforeach;
echo '<div class="subsubsub_section"><ul class="subsubsub"><li>' . implode(' | </li><li>', $links) . '</li></ul><br class="clear" />';
foreach (woocommerce_payment_gateways::payment_gateways() as $gateway) : foreach (woocommerce_payment_gateways::payment_gateways() as $gateway) :
echo '<div class="section" id="gateway-'.$gateway->id.'">';
$gateway->admin_options(); $gateway->admin_options();
echo '</div>';
endforeach; endforeach;
echo '</div>';
break; break;
endswitch; endswitch;
@ -836,6 +860,7 @@ function woocommerce_admin_fields($options) {
<p class="submit"><input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'woothemes') ?>" /></p> <p class="submit"><input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'woothemes') ?>" /></p>
<script type="text/javascript"> <script type="text/javascript">
jQuery(function() { jQuery(function() {
// Tabs // Tabs
jQuery('.woo-nav-tab-wrapper a:first').addClass('nav-tab-active'); jQuery('.woo-nav-tab-wrapper a:first').addClass('nav-tab-active');
jQuery('div.panel:not(div.panel:first)').hide(); jQuery('div.panel:not(div.panel:first)').hide();
@ -854,6 +879,17 @@ function woocommerce_admin_fields($options) {
jQuery('.woo-nav-tab-wrapper a:eq(<?php echo $_COOKIE['woocommerce_settings_tab_index']; ?>)').click(); jQuery('.woo-nav-tab-wrapper a:eq(<?php echo $_COOKIE['woocommerce_settings_tab_index']; ?>)').click();
<?php endif; ?> <?php endif; ?>
// Subsubsub tabs
jQuery('ul.subsubsub li a').click(function(){
jQuery('a', jQuery(this).closest('ul.subsubsub')).removeClass('current');
jQuery(this).addClass('current');
jQuery('.section', jQuery(this).closest('.subsubsub_section')).hide();
jQuery( jQuery(this).attr('href') ).show();
});
jQuery('ul.subsubsub').each(function(){
jQuery('li a:eq(0)', jQuery(this)).click();
});
// Options // Options
jQuery('tr.hidden_unless_enabled').hide(); jQuery('tr.hidden_unless_enabled').hide();
jQuery('tr.option_enabled input').change(function(){ jQuery('tr.option_enabled input').change(function(){

View File

@ -352,7 +352,7 @@ function woocommerce_process_product_meta( $post_id, $post ) {
update_post_meta( $post_id, 'weight', stripslashes( $_POST['weight'] ) ); update_post_meta( $post_id, 'weight', stripslashes( $_POST['weight'] ) );
update_post_meta( $post_id, 'tax_status', stripslashes( $_POST['tax_status'] ) ); update_post_meta( $post_id, 'tax_status', stripslashes( $_POST['tax_status'] ) );
update_post_meta( $post_id, 'tax_class', stripslashes( $_POST['tax_class'] ) ); update_post_meta( $post_id, 'tax_class', stripslashes( $_POST['tax_class'] ) );
if (isset($_POST['stock_status'])) update_post_meta( $post_id, 'stock_status', stripslashes( $_POST['stock_status'] ) ); update_post_meta( $post_id, 'stock_status', stripslashes( $_POST['stock_status'] ) );
update_post_meta( $post_id, 'visibility', stripslashes( $_POST['visibility'] ) ); update_post_meta( $post_id, 'visibility', stripslashes( $_POST['visibility'] ) );
if ($_POST['featured']) update_post_meta( $post_id, 'featured', 'yes' ); else update_post_meta( $post_id, 'featured', 'no' ); if ($_POST['featured']) update_post_meta( $post_id, 'featured', 'yes' ); else update_post_meta( $post_id, 'featured', 'no' );
@ -517,6 +517,10 @@ function woocommerce_process_product_meta( $post_id, $post ) {
update_post_meta( $post_id, 'manage_stock', 'yes' ); update_post_meta( $post_id, 'manage_stock', 'yes' );
update_post_meta( $post_id, 'backorders', stripslashes( $_POST['backorders'] ) ); update_post_meta( $post_id, 'backorders', stripslashes( $_POST['backorders'] ) );
if ($_POST['backorders']=='no' && $_POST['stock']<1) :
update_post_meta( $post_id, 'stock_status', 'outofstock' );
endif;
else : else :
update_post_meta( $post_id, 'stock', '0' ); update_post_meta( $post_id, 'stock', '0' );

View File

@ -48,7 +48,7 @@ class woocommerce_bacs extends woocommerce_payment_gateway {
<h3><?php _e('BACS Payment', 'woothemes'); ?></h3> <h3><?php _e('BACS Payment', 'woothemes'); ?></h3>
<p><?php _e('Allows payments by BACS (Bank Account Clearing System), more commonly known as direct bank/wire transfer.', 'woothemes'); ?></p> <p><?php _e('Allows payments by BACS (Bank Account Clearing System), more commonly known as direct bank/wire transfer.', 'woothemes'); ?></p>
<table class="form-table"> <table class="form-table">
<tr valign="top" class="option_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Enable/disable', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Enable/disable', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<fieldset><legend class="screen-reader-text"><span><?php _e('Enable/disable', 'woothemes') ?></span></legend> <fieldset><legend class="screen-reader-text"><span><?php _e('Enable/disable', 'woothemes') ?></span></legend>
@ -57,49 +57,49 @@ class woocommerce_bacs extends woocommerce_payment_gateway {
</fieldset> </fieldset>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Method Title', 'woocommerce') ?></th> <th scope="row" class="titledesc"><?php _e('Method Title', 'woocommerce') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_bacs_title" id="woocommerce_bacs_title" value="<?php if ($value = get_option('woocommerce_bacs_title')) echo $value; else echo 'BACS Payment'; ?>" /> <span class="description"><?php _e('This controls the title which the user sees during checkout.','woothemes') ?></span> <input class="input-text" type="text" name="woocommerce_bacs_title" id="woocommerce_bacs_title" value="<?php if ($value = get_option('woocommerce_bacs_title')) echo $value; else echo 'BACS Payment'; ?>" /> <span class="description"><?php _e('This controls the title which the user sees during checkout.','woothemes') ?></span>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Customer Message', 'woocommerce') ?></th> <th scope="row" class="titledesc"><?php _e('Customer Message', 'woocommerce') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text wide-input" type="text" name="woocommerce_bacs_description" id="woocommerce_bacs_description" value="<?php if ($value = get_option('woocommerce_bacs_description')) echo $value; ?>" /> <span class="description"><?php _e('Give the customer instructions for paying via BACS, and let them know that their order won\'t be shipping until the money is received.','woothemes') ?></span> <input class="input-text wide-input" type="text" name="woocommerce_bacs_description" id="woocommerce_bacs_description" value="<?php if ($value = get_option('woocommerce_bacs_description')) echo $value; ?>" /> <span class="description"><?php _e('Give the customer instructions for paying via BACS, and let them know that their order won\'t be shipping until the money is received.','woothemes') ?></span>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><a href="#" tabindex="99"></a><?php _e('Account Name', 'woothemes') ?></th> <th scope="row" class="titledesc"><a href="#" tabindex="99"></a><?php _e('Account Name', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_bacs_account_name" id="woocommerce_bacs_account_name" value="<?php if ($value = get_option('woocommerce_bacs_account_name')) echo $value; ?>" /> <input class="input-text" type="text" name="woocommerce_bacs_account_name" id="woocommerce_bacs_account_name" value="<?php if ($value = get_option('woocommerce_bacs_account_name')) echo $value; ?>" />
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><a href="#" tabindex="99"></a><?php _e('Account Number', 'woothemes') ?></th> <th scope="row" class="titledesc"><a href="#" tabindex="99"></a><?php _e('Account Number', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_bacs_account_number" id="woocommerce_bacs_account_number" value="<?php if ($value = get_option('woocommerce_bacs_account_number')) echo $value; ?>" /> <input class="input-text" type="text" name="woocommerce_bacs_account_number" id="woocommerce_bacs_account_number" value="<?php if ($value = get_option('woocommerce_bacs_account_number')) echo $value; ?>" />
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><a href="#" tabindex="99"></a><?php _e('Sort Code', 'woothemes') ?></th> <th scope="row" class="titledesc"><a href="#" tabindex="99"></a><?php _e('Sort Code', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_bacs_sort_code" id="woocommerce_bacs_sort_code" value="<?php if ($value = get_option('woocommerce_bacs_sort_code')) echo $value; ?>" /> <input class="input-text" type="text" name="woocommerce_bacs_sort_code" id="woocommerce_bacs_sort_code" value="<?php if ($value = get_option('woocommerce_bacs_sort_code')) echo $value; ?>" />
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><a href="#" tabindex="99"></a><?php _e('Bank Name', 'woothemes') ?></th> <th scope="row" class="titledesc"><a href="#" tabindex="99"></a><?php _e('Bank Name', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_bacs_bank_name" id="woocommerce_bacs_bank_name" value="<?php if ($value = get_option('woocommerce_bacs_bank_name')) echo $value; ?>" /> <input class="input-text" type="text" name="woocommerce_bacs_bank_name" id="woocommerce_bacs_bank_name" value="<?php if ($value = get_option('woocommerce_bacs_bank_name')) echo $value; ?>" />
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('IBAN', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('IBAN', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_bacs_iban" id="woocommerce_bacs_iban" value="<?php if ($value = get_option('woocommerce_bacs_iban')) echo $value; ?>" /> <span class="description"><?php _e('Your bank may require this for international payments','woothemes') ?></span> <input class="input-text" type="text" name="woocommerce_bacs_iban" id="woocommerce_bacs_iban" value="<?php if ($value = get_option('woocommerce_bacs_iban')) echo $value; ?>" /> <span class="description"><?php _e('Your bank may require this for international payments','woothemes') ?></span>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('BIC (formerly \'Swift\')', 'woocommerce') ?></th> <th scope="row" class="titledesc"><?php _e('BIC (formerly \'Swift\')', 'woocommerce') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_bacs_bic" id="woocommerce_bacs_bic" value="<?php if ($value = get_option('woocommerce_bacs_bic')) echo $value; ?>" /> <span class="description"><?php _e('Your bank may require this for international payments','woothemes') ?></span> <input class="input-text" type="text" name="woocommerce_bacs_bic" id="woocommerce_bacs_bic" value="<?php if ($value = get_option('woocommerce_bacs_bic')) echo $value; ?>" /> <span class="description"><?php _e('Your bank may require this for international payments','woothemes') ?></span>

View File

@ -37,7 +37,7 @@ class woocommerce_cheque extends woocommerce_payment_gateway {
<h3><?php _e('Cheque Payment', 'woothemes'); ?></h3> <h3><?php _e('Cheque Payment', 'woothemes'); ?></h3>
<p><?php _e('Allows cheque payments. Why would you take cheques in this day and age? Well you probably wouldn\'t but it does allow you to make test purchases without having to use the sandbox area of a payment gateway which is useful for demonstrating to clients and for testing order emails and the \'success\' pages etc.', 'woothemes'); ?></p> <p><?php _e('Allows cheque payments. Why would you take cheques in this day and age? Well you probably wouldn\'t but it does allow you to make test purchases without having to use the sandbox area of a payment gateway which is useful for demonstrating to clients and for testing order emails and the \'success\' pages etc.', 'woothemes'); ?></p>
<table class="form-table"> <table class="form-table">
<tr valign="top" class="option_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Enable/disable', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Enable/disable', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<fieldset><legend class="screen-reader-text"><span><?php _e('Enable/disable', 'woothemes') ?></span></legend> <fieldset><legend class="screen-reader-text"><span><?php _e('Enable/disable', 'woothemes') ?></span></legend>
@ -46,13 +46,13 @@ class woocommerce_cheque extends woocommerce_payment_gateway {
</fieldset> </fieldset>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Method Title', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Method Title', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_cheque_title" id="woocommerce_cheque_title" value="<?php if ($value = get_option('woocommerce_cheque_title')) echo $value; else echo 'Cheque Payment'; ?>" /> <span class="description"><?php _e('This controls the title which the user sees during checkout.', 'woothemes') ?></span> <input class="input-text" type="text" name="woocommerce_cheque_title" id="woocommerce_cheque_title" value="<?php if ($value = get_option('woocommerce_cheque_title')) echo $value; else echo 'Cheque Payment'; ?>" /> <span class="description"><?php _e('This controls the title which the user sees during checkout.', 'woothemes') ?></span>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Customer Message', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Customer Message', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text wide-input" type="text" name="woocommerce_cheque_description" id="woocommerce_cheque_description" value="<?php if ($value = get_option('woocommerce_cheque_description')) echo $value; ?>" /> <span class="description"><?php _e('Let the customer know the payee and where they should be sending the cheque too and that their order won\'t be shipping until you receive it.', 'woothemes') ?></span> <input class="input-text wide-input" type="text" name="woocommerce_cheque_description" id="woocommerce_cheque_description" value="<?php if ($value = get_option('woocommerce_cheque_description')) echo $value; ?>" /> <span class="description"><?php _e('Let the customer know the payee and where they should be sending the cheque too and that their order won\'t be shipping until you receive it.', 'woothemes') ?></span>

View File

@ -45,7 +45,7 @@ class woocommerce_moneybookers extends woocommerce_payment_gateway {
<h3><?php _e('Moneybookers', 'woothemes'); ?></h3> <h3><?php _e('Moneybookers', 'woothemes'); ?></h3>
<p><?php _e('Moneybookers works by using an iFrame to submit payment information securely to Moneybookers.', 'woothemes'); ?></p> <p><?php _e('Moneybookers works by using an iFrame to submit payment information securely to Moneybookers.', 'woothemes'); ?></p>
<table class="form-table"> <table class="form-table">
<tr valign="top" class="option_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Enable/disable', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Enable/disable', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<fieldset><legend class="screen-reader-text"><span><?php _e('Enable/disable', 'woothemes') ?></span></legend> <fieldset><legend class="screen-reader-text"><span><?php _e('Enable/disable', 'woothemes') ?></span></legend>
@ -54,25 +54,25 @@ class woocommerce_moneybookers extends woocommerce_payment_gateway {
</fieldset> </fieldset>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Method Title', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Method Title', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_moneybookers_title" id="woocommerce_moneybookers_title" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_moneybookers_title')) echo $value; else echo 'moneybookers'; ?>" /> <span class="description"><?php _e('This controls the title which the user sees during checkout.', 'woothemes') ?></span> <input class="input-text" type="text" name="woocommerce_moneybookers_title" id="woocommerce_moneybookers_title" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_moneybookers_title')) echo $value; else echo 'moneybookers'; ?>" /> <span class="description"><?php _e('This controls the title which the user sees during checkout.', 'woothemes') ?></span>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Moneybookers merchant e-mail', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Moneybookers merchant e-mail', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_moneybookers_email" id="woocommerce_moneybookers_email" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_moneybookers_email')) echo $value; ?>" /> <span class="description"><?php _e('Please enter your moneybookers email address; this is needed in order to take payment!', 'woothemes') ?></span> <input class="input-text" type="text" name="woocommerce_moneybookers_email" id="woocommerce_moneybookers_email" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_moneybookers_email')) echo $value; ?>" /> <span class="description"><?php _e('Please enter your moneybookers email address; this is needed in order to take payment!', 'woothemes') ?></span>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Moneybookers Secret Word', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Moneybookers Secret Word', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_moneybookers_secret_word" id="woocommerce_moneybookers_secret_word" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_moneybookers_secret_word')) echo $value; ?>" /> <span class="description"><?php _e('Please enter your moneybookers secretword; this is needed in order to take payment!', 'woothemes') ?></span> <input class="input-text" type="text" name="woocommerce_moneybookers_secret_word" id="woocommerce_moneybookers_secret_word" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_moneybookers_secret_word')) echo $value; ?>" /> <span class="description"><?php _e('Please enter your moneybookers secretword; this is needed in order to take payment!', 'woothemes') ?></span>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Moneybookers Customer ID', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Moneybookers Customer ID', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_moneybookers_customer_id" id="woocommerce_moneybookers_customer_id" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_moneybookers_customer_id')) echo $value; ?>" /> <span class="description"><?php _e('Please enter your moneybookers Customer ID; this is needed in order to take payment!', 'woothemes') ?></span> <input class="input-text" type="text" name="woocommerce_moneybookers_customer_id" id="woocommerce_moneybookers_customer_id" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_moneybookers_customer_id')) echo $value; ?>" /> <span class="description"><?php _e('Please enter your moneybookers Customer ID; this is needed in order to take payment!', 'woothemes') ?></span>

View File

@ -49,7 +49,7 @@ class woocommerce_paypal extends woocommerce_payment_gateway {
<h3><?php _e('PayPal standard', 'woothemes'); ?></h3> <h3><?php _e('PayPal standard', 'woothemes'); ?></h3>
<p><?php _e('PayPal standard works by sending the user to <a href="https://www.paypal.com/uk/mrb/pal=JFC9L8JJUZZK2">PayPal</a> to enter their payment information.', 'woothemes'); ?></p> <p><?php _e('PayPal standard works by sending the user to <a href="https://www.paypal.com/uk/mrb/pal=JFC9L8JJUZZK2">PayPal</a> to enter their payment information.', 'woothemes'); ?></p>
<table class="form-table"> <table class="form-table">
<tr valign="top" class="option_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Enable/disable', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Enable/disable', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<fieldset><legend class="screen-reader-text"><span><?php _e('Enable/disable', 'woothemes') ?></span></legend> <fieldset><legend class="screen-reader-text"><span><?php _e('Enable/disable', 'woothemes') ?></span></legend>
@ -58,25 +58,25 @@ class woocommerce_paypal extends woocommerce_payment_gateway {
</fieldset> </fieldset>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Method Title', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Method Title', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_paypal_title" id="woocommerce_paypal_title" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_paypal_title')) echo $value; else echo 'PayPal'; ?>" /> <span class="description"><?php _e('This controls the title which the user sees during checkout.', 'woothemes') ?></span> <input class="input-text" type="text" name="woocommerce_paypal_title" id="woocommerce_paypal_title" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_paypal_title')) echo $value; else echo 'PayPal'; ?>" /> <span class="description"><?php _e('This controls the title which the user sees during checkout.', 'woothemes') ?></span>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Description', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Description', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text wide-input" type="text" name="woocommerce_paypal_description" id="woocommerce_paypal_description" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_paypal_description')) echo $value; ?>" /> <span class="description"><?php _e('This controls the description which the user sees during checkout.', 'woothemes') ?></span> <input class="input-text wide-input" type="text" name="woocommerce_paypal_description" id="woocommerce_paypal_description" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_paypal_description')) echo $value; ?>" /> <span class="description"><?php _e('This controls the description which the user sees during checkout.', 'woothemes') ?></span>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('PayPal email address', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('PayPal email address', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<input class="input-text" type="text" name="woocommerce_paypal_email" id="woocommerce_paypal_email" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_paypal_email')) echo $value; ?>" /> <span class="description"><?php _e('Please enter your PayPal email address; this is needed in order to take payment!', 'woothemes') ?></span> <input class="input-text" type="text" name="woocommerce_paypal_email" id="woocommerce_paypal_email" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_paypal_email')) echo $value; ?>" /> <span class="description"><?php _e('Please enter your PayPal email address; this is needed in order to take payment!', 'woothemes') ?></span>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('Shipping details', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('Shipping details', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<fieldset><legend class="screen-reader-text"><span><?php _e('Shipping details', 'woothemes') ?></span></legend> <fieldset><legend class="screen-reader-text"><span><?php _e('Shipping details', 'woothemes') ?></span></legend>
@ -85,7 +85,7 @@ class woocommerce_paypal extends woocommerce_payment_gateway {
</fieldset> </fieldset>
</td> </td>
</tr> </tr>
<tr valign="top" class="hidden_unless_enabled"> <tr valign="top">
<th scope="row" class="titledesc"><?php _e('PayPal sandbox', 'woothemes') ?></th> <th scope="row" class="titledesc"><?php _e('PayPal sandbox', 'woothemes') ?></th>
<td class="forminp"> <td class="forminp">
<fieldset><legend class="screen-reader-text"><span><?php _e('PayPal sandbox', 'woothemes') ?></span></legend> <fieldset><legend class="screen-reader-text"><span><?php _e('PayPal sandbox', 'woothemes') ?></span></legend>

View File

@ -14,6 +14,7 @@ class woocommerce_product {
var $id; var $id;
var $exists; var $exists;
var $attributes; var $attributes;
var $children;
var $post; var $post;
var $sku; var $sku;
var $price; var $price;
@ -21,8 +22,14 @@ class woocommerce_product {
var $stock; var $stock;
var $stock_status; var $stock_status;
var $backorders; var $backorders;
var $children; var $manage_stock;
var $sale_price;
var $regular_price;
var $weight;
var $tax_status;
var $tax_class;
var $upsell_ids;
var $crosssell_ids;
var $product_type; var $product_type;
@ -122,6 +129,10 @@ class woocommerce_product {
if ($this->managing_stock()) : if ($this->managing_stock()) :
$reduce_to = $this->stock - $by; $reduce_to = $this->stock - $by;
update_post_meta($this->id, 'stock', $reduce_to); update_post_meta($this->id, 'stock', $reduce_to);
// Out of stock attribute
if (!$this->is_in_stock()) update_post_meta($this->id, 'stock_status', 'outofstock');
return $reduce_to; return $reduce_to;
endif; endif;
} }
@ -135,6 +146,10 @@ class woocommerce_product {
if ($this->managing_stock()) : if ($this->managing_stock()) :
$increase_to = $this->stock + $by; $increase_to = $this->stock + $by;
update_post_meta($this->id, 'stock', $increase_to); update_post_meta($this->id, 'stock', $increase_to);
// Out of stock attribute
if ($this->is_in_stock()) update_post_meta($this->id, 'stock_status', 'instock');
return $increase_to; return $increase_to;
endif; endif;
} }
@ -229,7 +244,8 @@ class woocommerce_product {
return false; return false;
endif; endif;
endif; endif;
return true; if ($this->stock_status=='instock') return true;
return false;
} }
/** Returns whether or not the product can be backordered */ /** Returns whether or not the product can be backordered */
@ -321,6 +337,13 @@ class woocommerce_product {
/** Returns whether or not the product is visible */ /** Returns whether or not the product is visible */
function is_visible() { function is_visible() {
// Out of stock visibility
if (get_option('woocommerce_hide_out_of_stock_items')=='yes') :
if (!$this->is_in_stock()) return false;
endif;
// visibility setting
if ($this->visibility=='hidden') return false; if ($this->visibility=='hidden') return false;
if ($this->visibility=='visible') return true; if ($this->visibility=='visible') return true;
if ($this->visibility=='search' && is_search()) return true; if ($this->visibility=='search' && is_search()) return true;

View File

@ -356,7 +356,11 @@ function woocommerce_add_to_cart_action( $url = false ) {
if (isset($_POST['quantity'])) $quantity = $_POST['quantity']; if (isset($_POST['quantity'])) $quantity = $_POST['quantity'];
woocommerce_cart::add_to_cart($_GET['add-to-cart'], $quantity); woocommerce_cart::add_to_cart($_GET['add-to-cart'], $quantity);
woocommerce::add_message( sprintf(__('<a href="%s" class="button">View Cart &rarr;</a> Product successfully added to your basket.', 'woothemes'), woocommerce_cart::get_cart_url()) ); if (get_option('woocommerce_cart_redirect_after_add')=='yes') :
woocommerce::add_message( __('Product successfully added to your basket.', 'woothemes') );
else :
woocommerce::add_message( sprintf(__('<a href="%s" class="button">View Cart &rarr;</a> Product successfully added to your basket.', 'woothemes'), woocommerce_cart::get_cart_url()) );
endif;
elseif ($_GET['add-to-cart']=='variation') : elseif ($_GET['add-to-cart']=='variation') :
@ -391,7 +395,13 @@ function woocommerce_add_to_cart_action( $url = false ) {
if ($variation_id>0) : if ($variation_id>0) :
// Add to cart // Add to cart
woocommerce_cart::add_to_cart($product_id, $quantity, $variations, $variation_id); woocommerce_cart::add_to_cart($product_id, $quantity, $variations, $variation_id);
woocommerce::add_message( sprintf(__('<a href="%s" class="button">View Cart &rarr;</a> Product successfully added to your basket.', 'woothemes'), woocommerce_cart::get_cart_url()) );
if (get_option('woocommerce_cart_redirect_after_add')=='yes') :
woocommerce::add_message( __('Product successfully added to your basket.', 'woothemes') );
else :
woocommerce::add_message( sprintf(__('<a href="%s" class="button">View Cart &rarr;</a> Product successfully added to your basket.', 'woothemes'), woocommerce_cart::get_cart_url()) );
endif;
else : else :
woocommerce::add_error( __('Sorry, this variation is not available.', 'woothemes') ); woocommerce::add_error( __('Sorry, this variation is not available.', 'woothemes') );
endif; endif;
@ -416,7 +426,13 @@ function woocommerce_add_to_cart_action( $url = false ) {
foreach ($_POST['quantity'] as $item => $quantity) : foreach ($_POST['quantity'] as $item => $quantity) :
if ($quantity>0) : if ($quantity>0) :
woocommerce_cart::add_to_cart($item, $quantity); woocommerce_cart::add_to_cart($item, $quantity);
woocommerce::add_message( sprintf(__('<a href="%s" class="button">View Cart &rarr;</a> Product successfully added to your basket.', 'woothemes'), woocommerce_cart::get_cart_url()) );
if (get_option('woocommerce_cart_redirect_after_add')=='yes') :
woocommerce::add_message( __('Product successfully added to your basket.', 'woothemes') );
else :
woocommerce::add_message( sprintf(__('<a href="%s" class="button">View Cart &rarr;</a> Product successfully added to your basket.', 'woothemes'), woocommerce_cart::get_cart_url()) );
endif;
$total_quantity = $total_quantity + $quantity; $total_quantity = $total_quantity + $quantity;
endif; endif;
endforeach; endforeach;
@ -444,8 +460,14 @@ function woocommerce_add_to_cart_action( $url = false ) {
exit; exit;
} }
// Redirect to cart option
elseif (get_option('woocommerce_cart_redirect_after_add')=='yes' && woocommerce::error_count() == 0) {
wp_safe_redirect( woocommerce_cart::get_cart_url() );
exit;
}
// Otherwise redirect to where they came // Otherwise redirect to where they came
else if ( isset($_SERVER['HTTP_REFERER'])) { elseif ( isset($_SERVER['HTTP_REFERER'])) {
wp_safe_redirect($_SERVER['HTTP_REFERER']); wp_safe_redirect($_SERVER['HTTP_REFERER']);
exit; exit;
} }