This commit is contained in:
Frederik Svarre 2012-04-04 13:03:00 +02:00
commit 75db488a4f
12 changed files with 100 additions and 36 deletions

View File

@ -23,6 +23,7 @@ include_once('writepanel-order_downloads.php');
add_action( 'add_meta_boxes', 'woocommerce_meta_boxes' );
function woocommerce_meta_boxes() {
global $post;
// Products
add_meta_box( 'woocommerce-product-type', __('Product Type', 'woocommerce'), 'woocommerce_product_type_box', 'product', 'normal', 'high' );
@ -31,7 +32,16 @@ function woocommerce_meta_boxes() {
// Excerpt
if ( function_exists('wp_editor') ) {
remove_meta_box( 'postexcerpt', 'product', 'normal' );
add_meta_box( 'postexcerpt', __('Product Summary', 'woocommerce'), 'woocommerce_product_summary_meta_box', 'product', 'normal' );
add_meta_box( 'postexcerpt', __('Product Short Description', 'woocommerce'), 'woocommerce_product_short_description_meta_box', 'product', 'normal' );
}
// Comments/Reviews
remove_meta_box( 'commentstatusdiv', 'product', 'normal' );
add_meta_box( 'commentstatusdiv', __('Product Reviews', 'woocommerce'), 'woocommerce_product_review_status_meta_box', 'product', 'normal' );
if ( ('publish' == $post->post_status || 'private' == $post->post_status) ) {
remove_meta_box( 'commentsdiv', 'product', 'normal' );
add_meta_box( 'commentsdiv', __('Reviews', 'woocommerce'), 'post_comment_meta_box', 'product', 'normal' );
}
// Orders
@ -86,11 +96,11 @@ function woocommerce_meta_boxes_save( $post_id, $post ) {
}
/**
* Product Summary
* Product Short Description
*
* Replaces excerpt with a visual editor
*/
function woocommerce_product_summary_meta_box( $post ) {
function woocommerce_product_short_description_meta_box( $post ) {
$settings = array(
'quicktags' => array( 'buttons' => 'em,strong,link' ),
@ -103,6 +113,23 @@ function woocommerce_product_summary_meta_box( $post ) {
wp_editor( htmlspecialchars_decode( $post->post_excerpt ), 'excerpt', $settings );
}
/**
* Display comments status form fields.
*
* @param object $post
*/
function woocommerce_product_review_status_meta_box( $post ) {
?>
<input name="advanced_view" type="hidden" value="1" />
<p class="meta-options">
<label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e( 'Allow reviews.', 'woocommerce' ) ?></label><br />
<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php printf( __( 'Allow <a href="%s" target="_blank">trackbacks and pingbacks</a> on this page.' ), __( 'http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) ); ?></label>
<?php do_action('post_comment_status_meta_box-options', $post); ?>
</p>
<?php
}
/**
* Product data
*

View File

@ -678,9 +678,11 @@ class WC_Cart {
$this->set_quantity( $cart_item_key, $quantity );
} else {
$cart_item_key = $cart_id;
// Add item after merging with $cart_item_data - hook to allow plugins to modify cart item
$this->cart_contents[$cart_id] = apply_filters( 'woocommerce_add_cart_item', array_merge( $cart_item_data, array(
$this->cart_contents[$cart_item_key] = apply_filters( 'woocommerce_add_cart_item', array_merge( $cart_item_data, array(
'product_id' => $product_id,
'variation_id' => $variation_id,
'variation' => $variation,
@ -690,6 +692,8 @@ class WC_Cart {
}
do_action( 'woocommerce_add_to_cart', $cart_item_key );
$woocommerce->cart_has_contents_cookie( true );
$this->set_session();

View File

@ -54,7 +54,7 @@ class WC_Paypal extends WC_Payment_Gateway {
* Check if this gateway is enabled and available in the user's country
*/
function is_valid_for_use() {
if (!in_array(get_option('woocommerce_currency'), array('AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP'))) return false;
if (!in_array(get_option('woocommerce_currency'), array('AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB'))) return false;
return true;
}

View File

@ -145,8 +145,13 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
= 1.5.4 =
* Feature - Allow external products to be a part of a grouped product. Button titles will be respected when displayed.
* Tweaked - For the short description, removed the_content filter and used woocommerce_short_description
* Tweak - Don't send password in new account email (some customers complained/privacy concerns)
* Localization - Canada post code localle
* Tweak - Don't show unused tabs on the frontend (description and reviews)
* Tweak - Rename comments meta box to reviews
* Localization - Canada post code locale
* Localization - RMB paypal
* Localization - Bundled translation updates
= 1.5.3 - 29/03/2012 =
* Feature - Debug/status page with some handy functions to resolve common issues

View File

@ -9,7 +9,7 @@ global $post;
<div itemprop="description">
<?php echo apply_filters( 'the_content', $post->post_excerpt ) ?>
<?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?>
</div>

View File

@ -2,10 +2,19 @@
/**
* Single Product Tabs
*/
?>
<div class="woocommerce_tabs">
<ul class="tabs">
<?php do_action('woocommerce_product_tabs'); ?>
</ul>
<?php do_action('woocommerce_product_tab_panels'); ?>
</div>
// Get tabs
ob_start();
do_action('woocommerce_product_tabs');
$tabs = trim( ob_get_clean() );
if ( ! empty( $tabs ) ) : ?>
<div class="woocommerce_tabs">
<ul class="tabs">
<?php echo $tabs; ?>
</ul>
<?php do_action('woocommerce_product_tab_panels'); ?>
</div>
<?php endif; ?>

View File

@ -4,13 +4,15 @@
*/
global $woocommerce, $post, $product;
?>
<div class="panel" id="tab-attributes">
<?php $heading = apply_filters('woocommerce_product_additional_information_heading', __('Additional Information', 'woocommerce')); ?>
if ($product->has_attributes() || $product->has_dimensions() || $product->has_weight()) : ?>
<div class="panel" id="tab-attributes">
<h2><?php echo $heading; ?></h2>
<?php $heading = apply_filters('woocommerce_product_additional_information_heading', __('Additional Information', 'woocommerce')); ?>
<h2><?php echo $heading; ?></h2>
<?php $product->list_attributes(); ?>
<?php $product->list_attributes(); ?>
</div>
</div>
<?php endif; ?>

View File

@ -4,13 +4,15 @@
*/
global $woocommerce, $post;
?>
<div class="panel" id="tab-description">
<?php $heading = apply_filters('woocommerce_product_description_heading', __('Product Description', 'woocommerce')); ?>
if ( $post->post_content ) : ?>
<div class="panel" id="tab-description">
<h2><?php echo $heading; ?></h2>
<?php $heading = apply_filters('woocommerce_product_description_heading', __('Product Description', 'woocommerce')); ?>
<h2><?php echo $heading; ?></h2>
<?php the_content(); ?>
<?php the_content(); ?>
</div>
</div>
<?php endif; ?>

View File

@ -4,9 +4,11 @@
*/
global $woocommerce, $post;
?>
<div class="panel" id="tab-reviews">
<?php comments_template(); ?>
</div>
if ( comments_open() ) : ?>
<div class="panel" id="tab-reviews">
<?php comments_template(); ?>
</div>
<?php endif; ?>

View File

@ -1,5 +1,5 @@
<?php global $product; ?>
<?php global $product;
<?php if ($product->has_attributes() || $product->has_dimensions() || $product->has_weight()) : ?>
if ($product->has_attributes() || $product->has_dimensions() || $product->has_weight()) : ?>
<li><a href="#tab-attributes"><?php _e('Additional Information', 'woocommerce'); ?></a></li>
<?php endif; ?>

View File

@ -1 +1,5 @@
<li><a href="#tab-description"><?php _e('Description', 'woocommerce'); ?></a></li>
<?php global $post;
if ( $post->post_content ) : ?>
<li><a href="#tab-description"><?php _e('Description', 'woocommerce'); ?></a></li>
<?php endif; ?>

View File

@ -152,3 +152,12 @@ add_action( 'woocommerce_new_order', 'woocommerce_increase_coupon_counts' );
/* Star Ratings */
add_action( 'comment_post', 'woocommerce_add_comment_rating', 1 );
add_filter( 'preprocess_comment', 'woocommerce_check_comment_rating', 0 );
/* Text filters */
add_filter( 'woocommerce_short_description', 'wptexturize' );
add_filter( 'woocommerce_short_description', 'convert_smilies' );
add_filter( 'woocommerce_short_description', 'convert_chars' );
add_filter( 'woocommerce_short_description', 'wpautop' );
add_filter( 'woocommerce_short_description', 'shortcode_unautop' );
add_filter( 'woocommerce_short_description', 'prepend_attachment' );
add_filter( 'woocommerce_short_description', 'do_shortcode', 11 ); // AFTER wpautop()