Revert 136456f805ccdf9b7b6bce027dc24da3c14d4281^..HEAD

This commit is contained in:
Mike Jolley 2012-01-12 00:43:30 +00:00
parent b6248e66e9
commit 1dc5a3bc0b
27 changed files with 2156 additions and 2183 deletions

View File

@ -753,12 +753,12 @@ function woocommerce_product_type_box() {
), $product_type) ) ); ), $product_type) ) );
// Visibility // Visibility
woocommerce_wp_select( array( 'id' => '_visibility', 'label' => __('Visibility', 'woocommerce'), 'options' => apply_filters('woocommerce_product_visibility_options', array( woocommerce_wp_select( array( 'id' => '_visibility', 'label' => __('Product visibility', 'woocommerce'), 'options' => apply_filters('woocommerce_product_visibility_options', array(
'visible' => __('Catalog & search', 'woocommerce'), 'visible' => __('Catalog & Search', 'woocommerce'),
'catalog' => __('Catalog', 'woocommerce'), 'catalog' => __('Catalog', 'woocommerce'),
'search' => __('Search', 'woocommerce'), 'search' => __('Search', 'woocommerce'),
'hidden' => __('Hidden', 'woocommerce') 'hidden' => __('Hidden', 'woocommerce')
)), 'description' => __('Define the loops this product should be visible in. It will still be accessible directly.', 'woocommerce') ) ); )) ) );
woocommerce_wp_checkbox( array( 'id' => '_virtual', 'wrapper_class' => 'show_if_simple', 'label' => __('Virtual', 'woocommerce'), 'description' => __('Enable this option if a product is not shipped or there is no shipping cost', 'woocommerce') ) ); woocommerce_wp_checkbox( array( 'id' => '_virtual', 'wrapper_class' => 'show_if_simple', 'label' => __('Virtual', 'woocommerce'), 'description' => __('Enable this option if a product is not shipped or there is no shipping cost', 'woocommerce') ) );

View File

@ -39,8 +39,6 @@ add_action('admin_init', 'woocommerce_admin_init');
function woocommerce_admin_init() { function woocommerce_admin_init() {
global $pagenow; global $pagenow;
ob_start();
include_once( 'woocommerce-admin-hooks.php' ); include_once( 'woocommerce-admin-hooks.php' );
include_once( 'woocommerce-admin-functions.php' ); include_once( 'woocommerce-admin-functions.php' );

View File

@ -38,15 +38,13 @@ form.cart .button{vertical-align:middle;float:left;}
span.onsale{color:#fff;min-height:32px;min-width:32px;padding:4px;font-size:12px;font-weight:bold;position:absolute;text-align:center;line-height:32px;top:6px;left:6px;margin:0;-webkit-border-radius:20px;-moz-border-radius:20px;border-radius:20px;background:#a1c41e;background:-webkit-gradient(linear, left top, left bottom, from(#a1c41e), to(#8fae1b));background:-webkit-linear-gradient(#a1c41e, #8fae1b);background:-moz-linear-gradient(center top, #a1c41e 0%, #8fae1b 100%);background:-moz-gradient(center top, #a1c41e 0%, #8fae1b 100%);text-shadow:0 -1px 0 #8fae1b;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.3),inset 0 -1px 0 rgba(0, 0, 0, 0.2),0 1px 2px rgba(0, 0, 0, 0.2);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.3),inset 0 -1px 0 rgba(0, 0, 0, 0.2),0 1px 2px rgba(0, 0, 0, 0.2);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.3),inset 0 -1px 0 rgba(0, 0, 0, 0.2),0 1px 2px rgba(0, 0, 0, 0.2);} span.onsale{color:#fff;min-height:32px;min-width:32px;padding:4px;font-size:12px;font-weight:bold;position:absolute;text-align:center;line-height:32px;top:6px;left:6px;margin:0;-webkit-border-radius:20px;-moz-border-radius:20px;border-radius:20px;background:#a1c41e;background:-webkit-gradient(linear, left top, left bottom, from(#a1c41e), to(#8fae1b));background:-webkit-linear-gradient(#a1c41e, #8fae1b);background:-moz-linear-gradient(center top, #a1c41e 0%, #8fae1b 100%);background:-moz-gradient(center top, #a1c41e 0%, #8fae1b 100%);text-shadow:0 -1px 0 #8fae1b;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.3),inset 0 -1px 0 rgba(0, 0, 0, 0.2),0 1px 2px rgba(0, 0, 0, 0.2);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.3),inset 0 -1px 0 rgba(0, 0, 0, 0.2),0 1px 2px rgba(0, 0, 0, 0.2);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.3),inset 0 -1px 0 rgba(0, 0, 0, 0.2),0 1px 2px rgba(0, 0, 0, 0.2);}
.products ul,ul.products{margin:0 0 14px;padding:0;list-style:none outside;}.products ul li,ul.products li{list-style:none outside;} .products ul,ul.products{margin:0 0 14px;padding:0;list-style:none outside;}.products ul li,ul.products li{list-style:none outside;}
.related,.upsells.products{overflow:hidden;zoom:1;}.related ul.products,.upsells.products ul.products,.related ul,.upsells.products ul{float:none;}.related ul.products li,.upsells.products ul.products li,.related ul li,.upsells.products ul li{width:48%;}.related ul.products li img,.upsells.products ul.products li img,.related ul li img,.upsells.products ul li img{width:100%;height:auto;} .related,.upsells.products{overflow:hidden;zoom:1;}.related ul.products,.upsells.products ul.products,.related ul,.upsells.products ul{float:none;}.related ul.products li,.upsells.products ul.products li,.related ul li,.upsells.products ul li{width:48%;}.related ul.products li img,.upsells.products ul.products li img,.related ul li img,.upsells.products ul li img{width:100%;height:auto;}
ul.products{clear:both;margin-left:0;padding-left:0;}ul.products li{float:left;margin:0 3.8% 2.992em 0;padding:0;position:relative;width:22.05%;margin-left:0;}ul.products li .onsale{top:0;right:0;left:auto;margin:-6px -6px 0 0;} ul.products{clear:both;margin-left:0;padding-left:0;}ul.products li{float:left;margin:0 3.8% 20px 0;padding:0;position:relative;width:22.05%;margin-left:0;}ul.products li .onsale{top:0;right:0;left:auto;margin:-6px -6px 0 0;}
ul.products li h3{padding:.5em 0;margin:0;font-size:1em;}
ul.products li a{text-decoration:none;} ul.products li a{text-decoration:none;}
ul.products li a img{width:100%;height:auto;display:block;margin:0 0 8px;border:1px solid #ddd;box-shadow:0 1px 2px 0 rgba(0, 0, 0, 0.1);-webkit-box-shadow:0 1px 2px 0 rgba(0, 0, 0, 0.1);-moz-box-shadow:0 1px 2px 0 rgba(0, 0, 0, 0.1);} ul.products li a img{width:100%;height:auto;display:block;margin:0 0 8px;border:1px solid #ddd;box-shadow:0 1px 2px 0 rgba(0, 0, 0, 0.1);-webkit-box-shadow:0 1px 2px 0 rgba(0, 0, 0, 0.1);-moz-box-shadow:0 1px 2px 0 rgba(0, 0, 0, 0.1);}
ul.products li a:hover img{border:1px solid #bbb;} ul.products li a:hover img{border:1px solid #bbb;}
ul.products li strong{color:#555;display:block;} ul.products li strong{color:#555;display:block;}
ul.products li .price{color:#8fae1b;display:block;font-weight:normal;margin-bottom:.5em;}ul.products li .price del{font-size:11px;line-height:10px;margin:-2px 0 0 0;display:block;color:#ccc;} ul.products li .price{color:green;display:block;font-weight:normal;}ul.products li .price del{font-size:10px;line-height:10px;margin:-2px 0 0 0;display:block;color:#ccc;}
ul.products li .price ins{background:none;} ul.products li .price .from{font-size:10px;line-height:10px;margin:-2px 0 0 0;display:block;color:#ccc;}
ul.products li .price .from{font-size:11px;line-height:10px;margin:-2px 0 0 0;display:block;text-transform:uppercase;color:#ccc;}
ul.products li.first{clear:both;} ul.products li.first{clear:both;}
ul.products li.last{margin-right:0;} ul.products li.last{margin-right:0;}
.woocommerce_ordering{margin-bottom:24px;} .woocommerce_ordering{margin-bottom:24px;}
@ -89,7 +87,7 @@ table.shop_table tfoot td{font-weight:bold;}
table.my_account_orders{font-size:0.85em;}table.my_account_orders th,table.my_account_orders td{padding:4px 8px;vertical-align:top;} table.my_account_orders{font-size:0.85em;}table.my_account_orders th,table.my_account_orders td{padding:4px 8px;vertical-align:top;}
table.my_account_orders .button{white-space:nowrap;} table.my_account_orders .button{white-space:nowrap;}
table.cart img{width:32px;height:auto;} table.cart img{width:32px;height:auto;}
ul.cart_list,ul.product_list_widget{list-style:none outside;padding:0;margin:0;}ul.cart_list li,ul.product_list_widget li{padding:4px 0;margin:0;list-style:none;}ul.cart_list li:after,ul.product_list_widget li:after{content:"";display:block;clear:both;} ul.cart_list,ul.product_list_widget{list-style:none outside;padding:0;margin:0;}ul.cart_list li,ul.product_list_widget li{padding:4px 0;margin:0;}ul.cart_list li:after,ul.product_list_widget li:after{content:"";display:block;clear:both;}
ul.cart_list li a,ul.product_list_widget li a{display:block;font-weight:bold;} ul.cart_list li a,ul.product_list_widget li a{display:block;font-weight:bold;}
ul.cart_list li img,ul.product_list_widget li img{float:left;margin-right:4px;border:1px solid #ddd;width:32px;height:auto;} ul.cart_list li img,ul.product_list_widget li img{float:left;margin-right:4px;border:1px solid #ddd;width:32px;height:auto;}
.widget_shopping_cart .total{border-top:3px double #ddd;padding:4px 0 0;margin:0;}.widget_shopping_cart .total strong{min-width:40px;display:inline-block;} .widget_shopping_cart .total{border-top:3px double #ddd;padding:4px 0 0;margin:0;}.widget_shopping_cart .total strong{min-width:40px;display:inline-block;}
@ -177,6 +175,6 @@ ol.commentlist.notes li.note .description p:last-child{margin-bottom:0;}
.widget_price_filter .ui-slider-horizontal .ui-slider-range{top:0;height:100%;} .widget_price_filter .ui-slider-horizontal .ui-slider-range{top:0;height:100%;}
.widget_price_filter .ui-slider-horizontal .ui-slider-range-min{left:0;} .widget_price_filter .ui-slider-horizontal .ui-slider-range-min{left:0;}
.widget_price_filter .ui-slider-horizontal .ui-slider-range-max{right:0;} .widget_price_filter .ui-slider-horizontal .ui-slider-range-max{right:0;}
.widget_layered_nav ul{margin:0;padding:0;border:0;list-style:none outside;}.widget_layered_nav ul li{overflow:hidden;zoom:1;padding:0 0 1px;list-style:none;}.widget_layered_nav ul li a,.widget_layered_nav ul li span{padding:1px 0;float:left;} .widget_layered_nav ul{margin:0;padding:0;border:0;list-style:none outside;}.widget_layered_nav ul li{overflow:hidden;zoom:1;padding:0 0 1px;}.widget_layered_nav ul li a,.widget_layered_nav ul li span{padding:1px 0;float:left;}
.widget_layered_nav ul li.chosen a{padding:0 6px 0 18px;border:1px solid #3399cc;background:#3399cc url(../images/cross_white.png) no-repeat 6px center;box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.5) #888888;-webkit-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.5) #888888;-moz-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.5) #888888;color:#fff;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} .widget_layered_nav ul li.chosen a{padding:0 6px 0 18px;border:1px solid #3399cc;background:#3399cc url(../images/cross_white.png) no-repeat 6px center;box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.5) #888888;-webkit-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.5) #888888;-moz-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.5) #888888;color:#fff;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
.widget_layered_nav ul small.count{float:right;margin-left:6px;font-size:1em;padding:1px 0;color:#999;} .widget_layered_nav ul small.count{float:right;margin-left:6px;font-size:1em;padding:1px 0;color:#999;}

View File

@ -317,6 +317,7 @@ form.cart {
.button { .button {
vertical-align: middle; vertical-align: middle;
float: left; float: left;
//margin: 2px 0;
} }
} }
@ -383,7 +384,7 @@ ul.products {
padding-left:0; padding-left:0;
li { li {
float: left; float: left;
margin: 0 3.8% 2.992em 0; margin: 0 3.8% 20px 0;
padding: 0; padding: 0;
position: relative; position: relative;
width:22.05%; width:22.05%;
@ -394,11 +395,6 @@ ul.products {
left: auto; left: auto;
margin: -6px -6px 0 0; margin: -6px -6px 0 0;
} }
h3 {
padding:.5em 0;
margin:0;
font-size:1em;
}
a { a {
text-decoration: none; text-decoration: none;
} }
@ -418,26 +414,21 @@ ul.products {
display: block; display: block;
} }
.price { .price {
color: #8fae1b; color: green;
display: block; display: block;
font-weight: normal; font-weight: normal;
margin-bottom:.5em;
del { del {
font-size: 11px; font-size: 10px;
line-height: 10px; line-height: 10px;
margin: -2px 0 0 0; margin: -2px 0 0 0;
display: block; display: block;
color: #ccc; color: #ccc;
} }
ins {
background: none;
}
.from { .from {
font-size: 11px; font-size: 10px;
line-height: 10px; line-height: 10px;
margin: -2px 0 0 0; margin: -2px 0 0 0;
display: block; display: block;
text-transform: uppercase;
color: #ccc; color: #ccc;
} }
} }
@ -491,10 +482,20 @@ a.button, button.button, input.button, #review_form #submit {
0 1px 2px rgba(0,0,0,0.1); 0 1px 2px rgba(0,0,0,0.1);
&.loading { &.loading {
//.opacity(0.5);
color:#999; color:#999;
border-color:#ccc; border-color:#ccc;
&:before { &:before {
/*content:"";
position: absolute;
height:16px;
width:16px;
top:0.35em;
right:-26px;
text-indent: 0;
background: url(../images/ajax-loader.gif) no-repeat;*/
content: ""; content: "";
position: absolute; position: absolute;
top:0; top:0;
@ -745,6 +746,10 @@ table.shop_table {
border-top: 1px solid #E7E7E7; border-top: 1px solid #E7E7E7;
padding: 6px 12px; padding: 6px 12px;
vertical-align: middle; vertical-align: middle;
a.button {
//margin:0 3px;
}
} }
tfoot td { tfoot td {
font-weight: bold; font-weight: bold;
@ -759,6 +764,7 @@ table.my_account_orders {
} }
.button { .button {
white-space: nowrap; white-space: nowrap;
//margin: 4px 0;
} }
} }
@ -782,7 +788,6 @@ ul.cart_list, ul.product_list_widget {
padding: 4px 0; padding: 4px 0;
margin: 0; margin: 0;
.clearfix; .clearfix;
list-style: none;
a { a {
display: block; display: block;
font-weight: bold; font-weight: bold;
@ -843,6 +848,7 @@ td.actions {
} }
.button.alt { .button.alt {
float: right; float: right;
//margin:2px 0 0 6px;
} }
} }
td.product-name { td.product-name {
@ -935,6 +941,7 @@ td.quantity {
} }
.cart input { .cart input {
//width:100px;
margin: 0; margin: 0;
vertical-align: middle; vertical-align: middle;
line-height: 1em; line-height: 1em;
@ -1349,7 +1356,6 @@ ol.commentlist.notes {
overflow: hidden; overflow: hidden;
zoom: 1; zoom: 1;
padding: 0 0 1px; padding: 0 0 1px;
list-style: none;
a, span { a, span {
padding: 1px 0; padding: 1px 0;
float: left; float: left;

View File

@ -160,10 +160,12 @@ class woocommerce_checkout {
if (!defined('WOOCOMMERCE_CHECKOUT')) define('WOOCOMMERCE_CHECKOUT', true); if (!defined('WOOCOMMERCE_CHECKOUT')) define('WOOCOMMERCE_CHECKOUT', true);
$woocommerce->verify_nonce('process_checkout');
do_action('woocommerce_before_checkout_process'); do_action('woocommerce_before_checkout_process');
if (isset($_POST) && $_POST && !isset($_POST['login']) && !isset($_POST['coupon_code'])) :
$woocommerce->verify_nonce('process_checkout');
if (sizeof($woocommerce->cart->get_cart())==0) : if (sizeof($woocommerce->cart->get_cart())==0) :
$woocommerce->add_error( sprintf(__('Sorry, your session has expired. <a href="%s">Return to homepage &rarr;</a>', 'woocommerce'), home_url()) ); $woocommerce->add_error( sprintf(__('Sorry, your session has expired. <a href="%s">Return to homepage &rarr;</a>', 'woocommerce'), home_url()) );
endif; endif;
@ -297,7 +299,7 @@ class woocommerce_checkout {
endif; endif;
// Terms // Terms
if (!isset($_POST['woocommerce_checkout_update_totals']) && empty($this->posted['terms']) && woocommerce_get_page_id('terms')>0 ) $woocommerce->add_error( __('You must accept our Terms &amp; Conditions.', 'woocommerce') ); if (!isset($_POST['update_totals']) && empty($this->posted['terms']) && woocommerce_get_page_id('terms')>0 ) $woocommerce->add_error( __('You must accept our Terms &amp; Conditions.', 'woocommerce') );
if ($woocommerce->cart->needs_shipping()) : if ($woocommerce->cart->needs_shipping()) :
@ -323,7 +325,7 @@ class woocommerce_checkout {
do_action( 'woocommerce_after_checkout_validation', $this->posted ); do_action( 'woocommerce_after_checkout_validation', $this->posted );
if (!isset($_POST['woocommerce_checkout_update_totals']) && $woocommerce->error_count()==0) : if (!isset($_POST['update_totals']) && $woocommerce->error_count()==0) :
$user_id = get_current_user_id(); $user_id = get_current_user_id();
@ -411,10 +413,10 @@ class woocommerce_checkout {
'tax_class' => $_product->get_tax_class() // Tax class (adjusted by filters) 'tax_class' => $_product->get_tax_class() // Tax class (adjusted by filters)
), $values); ), $values);
endforeach; // Check cart items for errors
do_action('woocommerce_check_cart_items', $order_items);
// Check order items for errors endforeach;
do_action('woocommerce_check_new_order_items', $order_items);
if ($woocommerce->error_count()>0) break; if ($woocommerce->error_count()>0) break;
@ -565,6 +567,7 @@ class woocommerce_checkout {
$result = apply_filters('woocommerce_payment_successful_result', $result ); $result = apply_filters('woocommerce_payment_successful_result', $result );
if (is_ajax()) : if (is_ajax()) :
ob_clean();
echo json_encode( $result ); echo json_encode( $result );
exit; exit;
else : else :
@ -586,6 +589,7 @@ class woocommerce_checkout {
// Redirect to success/confirmation/payment page // Redirect to success/confirmation/payment page
if (is_ajax()) : if (is_ajax()) :
ob_clean();
echo json_encode( array('redirect' => apply_filters( 'woocommerce_checkout_no_payment_needed_redirect', get_permalink(woocommerce_get_page_id('thanks')))) ); echo json_encode( array('redirect' => apply_filters( 'woocommerce_checkout_no_payment_needed_redirect', get_permalink(woocommerce_get_page_id('thanks')))) );
exit; exit;
else : else :
@ -604,8 +608,13 @@ class woocommerce_checkout {
// If we reached this point then there were errors // If we reached this point then there were errors
if (is_ajax()) : if (is_ajax()) :
ob_clean();
$woocommerce->show_messages(); $woocommerce->show_messages();
exit; exit;
else :
$woocommerce->show_messages();
endif;
endif; endif;
} }

View File

@ -211,7 +211,7 @@ class woocommerce_bacs extends woocommerce_payment_gateway {
// Return thankyou redirect // Return thankyou redirect
return array( return array(
'result' => 'success', 'result' => 'success',
'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('thanks')))) 'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(woocommerce_get_page_id('thanks'))))
); );
} }

View File

@ -22,7 +22,7 @@ class woocommerce_order {
} }
/** Get the order if ID is passed, otherwise the order is new and empty */ /** Get the order if ID is passed, otherwise the order is new and empty */
function __construct ( $id='' ) { function woocommerce_order( $id='' ) {
$this->calc_taxes = (get_option('woocommerce_calc_taxes')=='yes') ? true : false; $this->calc_taxes = (get_option('woocommerce_calc_taxes')=='yes') ? true : false;
$this->prices_include_tax = (get_option('woocommerce_prices_include_tax')=='yes') ? true : false; $this->prices_include_tax = (get_option('woocommerce_prices_include_tax')=='yes') ? true : false;
$this->display_totals_ex_tax = (get_option('woocommerce_display_totals_excluding_tax')=='yes') ? true : false; $this->display_totals_ex_tax = (get_option('woocommerce_display_totals_excluding_tax')=='yes') ? true : false;
@ -682,7 +682,7 @@ class woocommerce_order {
$this->add_order_note( sprintf( __('Item #%s stock reduced from %s to %s.', 'woocommerce'), $item['id'], $old_stock, $new_quantity) ); $this->add_order_note( sprintf( __('Item #%s stock reduced from %s to %s.', 'woocommerce'), $item['id'], $old_stock, $new_quantity) );
if ($new_quantity<0) : if ($new_quantity<0) :
do_action('woocommerce_product_on_backorder', array( 'product' => $item['id'], 'order_id' => $this->id, 'quantity' => $item['qty'])); do_action('woocommerce_product_on_backorder', array( 'product' => $item['id'], 'order_id' => $this->id, 'quantity' => $item['quantity']));
endif; endif;
// stock status notifications // stock status notifications

View File

@ -440,7 +440,7 @@ 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( $single = false ) {
$visible = true; $visible = true;
@ -450,6 +450,7 @@ class woocommerce_product {
// visibility setting // visibility setting
elseif ($this->visibility=='hidden') $visible = false; elseif ($this->visibility=='hidden') $visible = false;
elseif ($this->visibility=='visible') $visible = true; elseif ($this->visibility=='visible') $visible = true;
elseif ($single) $visible = true;
// Visibility in loop // Visibility in loop
elseif ($this->visibility=='search' && is_search()) $visible = true; elseif ($this->visibility=='search' && is_search()) $visible = true;

View File

@ -91,7 +91,8 @@ class woocommerce_email {
return $message; return $message;
} }
function send( $to, $subject, $message, $headers = "", $attachments = "" ) { function send( $to, $subject, $message, $headers = '', $attachments = "" ) {
if (!$headers) $headers = "Content-Type: text/html\r\n";
add_filter( 'wp_mail_from', array(&$this, 'get_from_address') ); add_filter( 'wp_mail_from', array(&$this, 'get_from_address') );
add_filter( 'wp_mail_from_name', array(&$this, 'get_from_name') ); add_filter( 'wp_mail_from_name', array(&$this, 'get_from_name') );

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
=== WooCommerce === === WooCommerce ===
Contributors: woothemes, mikejolley, jameskoster Contributors: woothemes, mikejolley
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, shop, shopping, cart, checkout, widgets, reports, shipping, tax, paypal, inventory Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, shop, shopping, cart, checkout, widgets, reports, shipping, tax, paypal, inventory
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@woothemes.com&item_name=Donation+for+WooCommerce Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@woothemes.com&item_name=Donation+for+WooCommerce
Requires at least: 3.3 Requires at least: 3.3
@ -120,9 +120,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
* Change textdomain from woothemes to woocommerce * Change textdomain from woothemes to woocommerce
* Free shipping coupons ignore min-amount * Free shipping coupons ignore min-amount
* Delete all variations option * Delete all variations option
* Removed the need of ob_start on most frontend pages to improve page loading speed
* Product category widget option to show current children only * Product category widget option to show current children only
* Tweaked visibility settings and made them more clear
= 1.3.2.1 - 15/12/2011 = = 1.3.2.1 - 15/12/2011 =
* Category/Ordering fix * Category/Ordering fix

View File

@ -15,15 +15,25 @@ function get_woocommerce_checkout( $atts ) {
} }
function woocommerce_checkout( $atts ) { function woocommerce_checkout( $atts ) {
global $woocommerce; global $woocommerce, $woocommerce_checkout;
if (sizeof($woocommerce->cart->get_cart())==0) return; if (!defined('WOOCOMMERCE_CHECKOUT')) define('WOOCOMMERCE_CHECKOUT', true);
$non_js_checkout = (isset($_POST['woocommerce_checkout_update_totals']) && $_POST['woocommerce_checkout_update_totals']) ? true : false; if (sizeof($woocommerce->cart->get_cart())==0) :
wp_redirect(get_permalink(woocommerce_get_page_id('cart')));
exit;
endif;
$non_js_checkout = (isset($_POST['update_totals']) && $_POST['update_totals']) ? true : false;
$woocommerce_checkout = $woocommerce->checkout();
$woocommerce_checkout->process_checkout();
do_action('woocommerce_check_cart_items'); do_action('woocommerce_check_cart_items');
if ( $woocommerce->error_count()==0 && $non_js_checkout) $woocommerce->add_message( __('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'woocommerce') ); if ( $woocommerce->error_count()==0 && $non_js_checkout) $woocommerce->add_message( __('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'woocommerce') );
woocommerce_get_template('checkout/form.php', false); woocommerce_get_template('checkout/form.php', false);
} }

View File

@ -72,7 +72,10 @@ function woocommerce_my_account( $atts ) {
function woocommerce_edit_address() { function woocommerce_edit_address() {
global $woocommerce, $load_address, $address; global $woocommerce, $load_address, $address;
if ( ! is_user_logged_in() ) return; if ( ! is_user_logged_in() ) :
wp_safe_redirect( get_permalink( woocommerce_get_page_id('myaccount') ) );
exit;
endif;
$load_address = woocommerce_get_address_to_edit(); $load_address = woocommerce_get_address_to_edit();
@ -85,6 +88,9 @@ function woocommerce_edit_address() {
* Save and and update a billing or shipping address if the * Save and and update a billing or shipping address if the
* form was submitted through the user account page. * form was submitted through the user account page.
* *
* @todo Address fields should be loaded using the array defined in
* the checkout class.
*
* @package WooCommerce * @package WooCommerce
* @since 1.4 * @since 1.4
*/ */
@ -181,7 +187,10 @@ function woocommerce_get_address_to_edit() {
function woocommerce_change_password() { function woocommerce_change_password() {
global $woocommerce; global $woocommerce;
if ( ! is_user_logged_in() ) return; if ( ! is_user_logged_in() ) :
wp_safe_redirect( get_permalink( woocommerce_get_page_id('myaccount') ) );
exit;
endif;
woocommerce_get_template( 'myaccount/change-password.php' ); woocommerce_get_template( 'myaccount/change-password.php' );
} }
@ -237,15 +246,18 @@ add_action( 'template_redirect', 'woocommerce_save_password' );
function woocommerce_view_order() { function woocommerce_view_order() {
global $woocommerce; global $woocommerce;
if ( ! is_user_logged_in() ) return; if ( ! is_user_logged_in() ) :
wp_safe_redirect( get_permalink( woocommerce_get_page_id('myaccount') ) );
exit;
endif;
$user_id = get_current_user_id(); $user_id = get_current_user_id();
$order_id = (isset($_GET['order'])) ? $_GET['order'] : 0; $order_id = (isset($_GET['order'])) ? $_GET['order'] : 0;
$order = new woocommerce_order( $order_id ); $order = new woocommerce_order( $order_id );
if ( $order_id==0 || $order->user_id != $user_id ) : if ( $order_id==0 || $order->user_id != $user_id ) :
echo '<div class="woocommerce_error">' . __('Invalid order.', 'woocommerce') . ' <a href="'.get_permalink( woocommerce_get_page_id('myaccount') ).'">'. __('My Account &rarr;', 'woocommerce') .'</a>' . '</div>'; wp_safe_redirect( get_permalink( woocommerce_get_page_id('myaccount') ) );
return; exit;
endif; endif;
$status = get_term_by('slug', $order->status, 'shop_order_status'); $status = get_term_by('slug', $order->status, 'shop_order_status');

View File

@ -34,6 +34,40 @@ function woocommerce_pay() {
if ($order->billing_state) $woocommerce->customer->set_state( $order->billing_state ); if ($order->billing_state) $woocommerce->customer->set_state( $order->billing_state );
if ($order->billing_postcode) $woocommerce->customer->set_postcode( $order->billing_postcode ); if ($order->billing_postcode) $woocommerce->customer->set_postcode( $order->billing_postcode );
// Pay form was posted - process payment
if (isset($_POST['pay']) && $woocommerce->verify_nonce('pay')) :
// Update payment method
if ($order->order_total > 0 ) :
$payment_method = woocommerce_clean($_POST['payment_method']);
$available_gateways = $woocommerce->payment_gateways->get_available_payment_gateways();
// Update meta
update_post_meta( $order_id, '_payment_method', $payment_method);
if (isset($available_gateways) && isset($available_gateways[$payment_method])) :
$payment_method_title = $available_gateways[$payment_method]->title;
endif;
update_post_meta( $order_id, '_payment_method_title', $payment_method_title);
$result = $available_gateways[$payment_method]->process_payment( $order_id );
// Redirect to success/confirmation/payment page
if ($result['result']=='success') :
wp_redirect( $result['redirect'] );
exit;
endif;
else :
// No payment was required for order
$order->payment_complete();
wp_safe_redirect( get_permalink(woocommerce_get_page_id('thanks')) );
exit;
endif;
endif;
// Show form // Show form
woocommerce_get_template('checkout/pay_for_order.php'); woocommerce_get_template('checkout/pay_for_order.php');
@ -90,15 +124,15 @@ function woocommerce_pay() {
else : else :
$woocommerce->add_error( __('Your order has already been paid for. Please contact us if you need assistance.', 'woocommerce') ); wp_safe_redirect( get_permalink(woocommerce_get_page_id('myaccount')) );
$woocommerce->show_messages(); exit;
endif; endif;
else : else :
$woocommerce->add_error( __('Invalid order.', 'woocommerce') ); wp_safe_redirect( get_permalink(woocommerce_get_page_id('myaccount')) );
$woocommerce->show_messages(); exit;
endif; endif;

View File

@ -20,8 +20,6 @@ function get_woocommerce_thankyou( $atts ) {
function woocommerce_thankyou( $atts ) { function woocommerce_thankyou( $atts ) {
global $woocommerce, $order; global $woocommerce, $order;
$order = false;
// Pay for order after checkout step // Pay for order after checkout step
if (isset($_GET['order'])) $order_id = $_GET['order']; else $order_id = 0; if (isset($_GET['order'])) $order_id = $_GET['order']; else $order_id = 0;
if (isset($_GET['key'])) $order_key = $_GET['key']; else $order_key = ''; if (isset($_GET['key'])) $order_key = $_GET['key']; else $order_key = '';

View File

@ -1,4 +1,4 @@
<?php global $woocommerce; $woocommerce_checkout = $woocommerce->checkout(); ?> <?php global $woocommerce, $woocommerce_checkout; ?>
<?php $woocommerce->show_messages(); ?> <?php $woocommerce->show_messages(); ?>

View File

@ -71,7 +71,7 @@
<div class="form-row"> <div class="form-row">
<?php $woocommerce->nonce_field('pay')?> <?php $woocommerce->nonce_field('pay')?>
<input type="submit" class="button alt" name="woocommerce_pay" id="place_order" value="<?php _e('Pay for order', 'woocommerce'); ?>" /> <input type="submit" class="button-alt" name="pay" id="place_order" value="<?php _e('Pay for order', 'woocommerce'); ?>" />
</div> </div>

View File

@ -226,13 +226,13 @@
<div class="form-row"> <div class="form-row">
<noscript><?php _e('Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce'); ?><br/><input type="submit" class="button-alt" name="woocommerce_checkout_update_totals" value="<?php _e('Update totals', 'woocommerce'); ?>" /></noscript> <noscript><?php _e('Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce'); ?><br/><input type="submit" class="button-alt" name="update_totals" value="<?php _e('Update totals', 'woocommerce'); ?>" /></noscript>
<?php $woocommerce->nonce_field('process_checkout')?> <?php $woocommerce->nonce_field('process_checkout')?>
<?php do_action( 'woocommerce_review_order_before_submit' ); ?> <?php do_action( 'woocommerce_review_order_before_submit' ); ?>
<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="<?php echo apply_filters('woocommerce_order_button_text', __('Place order', 'woocommerce')); ?>" /> <input type="submit" class="button alt" name="place_order" id="place_order" value="<?php echo apply_filters('woocommerce_order_button_text', __('Place order', 'woocommerce')); ?>" />
<?php if (woocommerce_get_page_id('terms')>0) : ?> <?php if (woocommerce_get_page_id('terms')>0) : ?>
<p class="form-row terms"> <p class="form-row terms">

View File

@ -1,6 +1,6 @@
<?php if (!defined('ABSPATH')) exit; ?> <?php if (!defined('ABSPATH')) exit; ?>
<?php global $order; ?> <?php global $order, $woocommerce; ?>
<?php do_action('woocommerce_email_header'); ?> <?php do_action('woocommerce_email_header'); ?>

View File

@ -103,7 +103,7 @@ function woocommerce_ajax_update_order_review() {
if (!defined('WOOCOMMERCE_CHECKOUT')) define('WOOCOMMERCE_CHECKOUT', true); if (!defined('WOOCOMMERCE_CHECKOUT')) define('WOOCOMMERCE_CHECKOUT', true);
if (sizeof($woocommerce->cart->get_cart())==0) : if (sizeof($woocommerce->cart->get_cart())==0) :
echo '<div class="woocommerce_error">'.__('Sorry, your session has expired.', 'woocommerce').' <a href="'.home_url().'">'.__('Return to homepage &rarr;', 'woocommerce').'</a></div>'; echo '<p class="error">'.__('Sorry, your session has expired.', 'woocommerce').' <a href="'.home_url().'">'.__('Return to homepage &rarr;', 'woocommerce').'</a></p>';
die(); die();
endif; endif;
@ -162,7 +162,7 @@ add_action('wp_ajax_woocommerce-checkout', 'woocommerce_process_checkout');
add_action('wp_ajax_nopriv_woocommerce-checkout', 'woocommerce_process_checkout'); add_action('wp_ajax_nopriv_woocommerce-checkout', 'woocommerce_process_checkout');
function woocommerce_process_checkout () { function woocommerce_process_checkout () {
global $woocommerce; global $woocommerce, $woocommerce_checkout;
$woocommerce_checkout = $woocommerce->checkout(); $woocommerce_checkout = $woocommerce->checkout();
$woocommerce_checkout->process_checkout(); $woocommerce_checkout->process_checkout();

View File

@ -27,7 +27,7 @@ function woocommerce_mail( $to, $subject, $message, $headers = "Content-Type: te
**/ **/
if (!function_exists('woocommerce_get_page_id')) { if (!function_exists('woocommerce_get_page_id')) {
function woocommerce_get_page_id( $page ) { function woocommerce_get_page_id( $page ) {
return apply_filters('woocommerce_get_' . $page . '_page_id', get_option('woocommerce_' . $page . '_page_id')); return (int) apply_filters('woocommerce_get_' . $page . '_page_id', get_option('woocommerce_' . $page . '_page_id'));
} }
} }
@ -72,6 +72,7 @@ if (!function_exists('is_checkout')) {
if (!function_exists('is_account_page')) { if (!function_exists('is_account_page')) {
function is_account_page() { function is_account_page() {
if ( is_page(woocommerce_get_page_id('myaccount')) || is_page(woocommerce_get_page_id('edit_address')) || is_page(woocommerce_get_page_id('view_order')) || is_page(woocommerce_get_page_id('change_password')) ) return true; else return false; if ( is_page(woocommerce_get_page_id('myaccount')) || is_page(woocommerce_get_page_id('edit_address')) || is_page(woocommerce_get_page_id('view_order')) || is_page(woocommerce_get_page_id('change_password')) ) return true; else return false;
return is_page(woocommerce_get_page_id('myaccount'));
} }
} }
if (!function_exists('is_ajax')) { if (!function_exists('is_ajax')) {

View File

@ -10,35 +10,13 @@
*/ */
/** /**
* Handle redirects before content is output - hooked into template_redirect so is_page works * When default permalinks are enabled, redirect shop page to post type archive url
**/ **/
function woocommerce_redirects() { function woocommerce_shop_page_archive_redirect() {
global $woocommerce;
// When default permalinks are enabled, redirect shop page to post type archive url
if ( isset($_GET['page_id']) && get_option( 'permalink_structure' )=="" && $_GET['page_id'] == woocommerce_get_page_id('shop') ) : if ( isset($_GET['page_id']) && get_option( 'permalink_structure' )=="" && $_GET['page_id'] == woocommerce_get_page_id('shop') ) :
wp_safe_redirect( get_post_type_archive_link('product') ); wp_safe_redirect( get_post_type_archive_link('product') );
exit; exit;
endif; endif;
// When on the checkout with an empty cart, redirect to cart page
if (is_page(woocommerce_get_page_id('checkout')) && sizeof($woocommerce->cart->get_cart())==0) :
wp_redirect(get_permalink(woocommerce_get_page_id('cart')));
exit;
endif;
// When on pay page with no query string, redirect to checkout
if (is_page(woocommerce_get_page_id('pay')) && !isset($_GET['order'])) :
wp_redirect(get_permalink(woocommerce_get_page_id('checkout')));
exit;
endif;
// My account page redirects (logged out)
if (!is_user_logged_in() && ( is_page(woocommerce_get_page_id('edit_address')) || is_page(woocommerce_get_page_id('view_order')) || is_page(woocommerce_get_page_id('change_password')) )) :
wp_redirect(get_permalink(woocommerce_get_page_id('myaccount')));
exit;
endif;
} }
/** /**
@ -360,7 +338,7 @@ function woocommerce_add_to_cart_message() {
$woocommerce->add_message( sprintf('<a href="%s" class="button">%s</a> %s', $return_to, __('Continue Shopping &rarr;', 'woocommerce'), __('Product successfully added to your cart.', 'woocommerce') )); $woocommerce->add_message( sprintf('<a href="%s" class="button">%s</a> %s', $return_to, __('Continue Shopping &rarr;', 'woocommerce'), __('Product successfully added to your cart.', 'woocommerce') ));
else : else :
$woocommerce->add_message( sprintf('<a href="%s" class="button">%s</a> %s', get_permalink(woocommerce_get_page_id('cart')), __('View Cart &rarr;', 'woocommerce'), __('Product successfully added to your cart.', 'woocommerce') )); $woocommerce->add_message( sprintf('<a href="%s" class="button">%s</a> %s', $return_to, __('View Cart &rarr;', 'woocommerce'), __('Product successfully added to your cart.', 'woocommerce') ));
endif; endif;
} }
@ -402,81 +380,6 @@ function woocommerce_clear_cart_after_payment() {
endif; endif;
} }
/**
* Process the checkout form
**/
function woocommerce_checkout_action() {
global $woocommerce;
if (isset($_POST['woocommerce_checkout_place_order']) || isset($_POST['woocommerce_checkout_update_totals'])) :
if (sizeof($woocommerce->cart->get_cart())==0) :
wp_redirect(get_permalink(woocommerce_get_page_id('cart')));
exit;
endif;
$woocommerce_checkout = $woocommerce->checkout();
$woocommerce_checkout->process_checkout();
endif;
}
/**
* Process the pay form
**/
function woocommerce_pay_action() {
global $woocommerce;
if (isset($_POST['woocommerce_pay']) && $woocommerce->verify_nonce('pay')) :
// Pay for existing order
$order_key = urldecode( $_GET['order'] );
$order_id = (int) $_GET['order_id'];
$order = new woocommerce_order( $order_id );
if ($order->id == $order_id && $order->order_key == $order_key && in_array($order->status, array('pending', 'failed'))) :
// Set customer location to order location
if ($order->billing_country) $woocommerce->customer->set_country( $order->billing_country );
if ($order->billing_state) $woocommerce->customer->set_state( $order->billing_state );
if ($order->billing_postcode) $woocommerce->customer->set_postcode( $order->billing_postcode );
// Update payment method
if ($order->order_total > 0 ) :
$payment_method = woocommerce_clean($_POST['payment_method']);
$available_gateways = $woocommerce->payment_gateways->get_available_payment_gateways();
// Update meta
update_post_meta( $order_id, '_payment_method', $payment_method);
if (isset($available_gateways) && isset($available_gateways[$payment_method])) :
$payment_method_title = $available_gateways[$payment_method]->title;
endif;
update_post_meta( $order_id, '_payment_method_title', $payment_method_title);
$result = $available_gateways[$payment_method]->process_payment( $order_id );
// Redirect to success/confirmation/payment page
if ($result['result']=='success') :
wp_redirect( $result['redirect'] );
exit;
endif;
else :
// No payment was required for order
$order->payment_complete();
wp_safe_redirect( get_permalink(woocommerce_get_page_id('thanks')) );
exit;
endif;
endif;
endif;
}
/** /**
* Process the login form * Process the login form
**/ **/

View File

@ -39,6 +39,7 @@ add_action( 'woocommerce_before_subcategory_title', 'woocommerce_subcategory_thu
/* Before Single Products */ /* Before Single Products */
add_action( 'woocommerce_before_single_product', array(&$woocommerce, 'show_messages'), 10 ); add_action( 'woocommerce_before_single_product', array(&$woocommerce, 'show_messages'), 10 );
add_action( 'woocommerce_before_single_product', 'woocommerce_check_product_visibility', 10);
/* Before Single Products Summary Div */ /* Before Single Products Summary Div */
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20); add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20);
@ -96,7 +97,7 @@ add_action( 'woocommerce_thankyou', 'woocommerce_order_details_table', 10 );
/** Store Event Hooks *****************************************************/ /** Store Event Hooks *****************************************************/
/* Shop Page Handling and Support */ /* Shop Page Handling and Support */
add_action( 'template_redirect', 'woocommerce_redirects' ); add_action( 'init', 'woocommerce_shop_page_archive_redirect' );
add_filter( 'wp_nav_menu_objects', 'woocommerce_nav_menu_item_classes', 2, 20 ); add_filter( 'wp_nav_menu_objects', 'woocommerce_nav_menu_item_classes', 2, 20 );
add_action( 'wp', 'woocommerce_front_page_archive_paging_fix', 1 ); add_action( 'wp', 'woocommerce_front_page_archive_paging_fix', 1 );
add_action( 'loop_start', 'woocommerce_front_page_archive', 1 ); add_action( 'loop_start', 'woocommerce_front_page_archive', 1 );
@ -117,10 +118,6 @@ add_action( 'init', 'woocommerce_update_catalog_ordering' );
add_action( 'init', 'woocommerce_update_cart_action' ); add_action( 'init', 'woocommerce_update_cart_action' );
add_action( 'init', 'woocommerce_add_to_cart_action' ); add_action( 'init', 'woocommerce_add_to_cart_action' );
/* Checkout Actions */
add_action( 'init', 'woocommerce_checkout_action' );
add_action( 'init', 'woocommerce_pay_action' );
/* Login and Registration */ /* Login and Registration */
add_action( 'init', 'woocommerce_process_login' ); add_action( 'init', 'woocommerce_process_login' );
add_action( 'init', 'woocommerce_process_coupon_form' ); add_action( 'init', 'woocommerce_process_coupon_form' );

View File

@ -182,6 +182,17 @@ if (!function_exists('woocommerce_get_product_thumbnail')) {
} }
} }
/**
* Check product visibility in loop
**/
if (!function_exists('woocommerce_check_product_visibility')) {
function woocommerce_check_product_visibility() {
global $post, $product;
if (!$product->is_visible( true ) && $post->post_parent > 0) : wp_safe_redirect(get_permalink($post->post_parent)); exit; endif;
if (!$product->is_visible( true )) : wp_safe_redirect(home_url()); exit; endif;
}
}
/** /**
* Pagination * Pagination
**/ **/

View File

@ -52,7 +52,6 @@ class woocommerce {
var $countries; var $countries;
var $validation; var $validation;
var $woocommerce_email; var $woocommerce_email;
var $checkout;
/** Taxonomies ************************************************************/ /** Taxonomies ************************************************************/
@ -891,12 +890,8 @@ class woocommerce {
* Get Checkout Class * Get Checkout Class
*/ */
function checkout() { function checkout() {
if ( !class_exists('woocommerce_checkout') ) : if ( !class_exists('woocommerce_checkout') ) include( 'classes/checkout.class.php' );
include( 'classes/checkout.class.php' ); return new woocommerce_checkout();
$this->checkout = new woocommerce_checkout();
endif;
return $this->checkout;
} }
/** /**