Don't show price when variation prices don't differ. Closes #1199.

This commit is contained in:
Mike Jolley 2012-07-11 23:19:29 +01:00
parent ea60024453
commit 880e8b6b0f
5 changed files with 26 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@ -116,7 +116,7 @@ div.product, #content div.product {
} }
/* Price */ /* Price */
p.price { span.price, p.price {
color: @highlight; color: @highlight;
font-size: 1.25em; font-size: 1.25em;
ins { ins {
@ -311,7 +311,6 @@ div.product, #content div.product {
div.quantity { div.quantity {
float:none; float:none;
margin: 0; margin: 0;
width: 72px;
} }
small.stock { small.stock {
display:block; display:block;
@ -319,18 +318,35 @@ div.product, #content div.product {
} }
} }
.variations { .variations {
margin-bottom: 1em;
label { label {
font-weight:bold; font-weight: bold;
} }
select { select {
width: 100%; width: 100%;
float:left; float:left;
} }
td.label {
padding-right: 1em;
}
td {
vertical-align: top;
}
} }
.button { .button {
vertical-align: middle; vertical-align: middle;
float:left; float:left;
} }
.group_table {
td.label {
padding-right: 1em;
padding-left: 1em;
}
td {
vertical-align: top;
}
}
} }
} }

View File

@ -622,7 +622,7 @@ class WC_Product {
else : else :
if ( !$this->min_variation_price || $this->min_variation_price !== $this->max_variation_price ) if ( ! $this->min_variation_price || $this->min_variation_price !== $this->max_variation_price )
$price .= $this->get_price_html_from_text(); $price .= $this->get_price_html_from_text();
$price .= woocommerce_price( $this->get_price() ); $price .= woocommerce_price( $this->get_price() );
@ -647,7 +647,7 @@ class WC_Product {
else : else :
if ( !$this->min_variation_price || $this->min_variation_price !== $this->max_variation_price ) if ( ! $this->min_variation_price || $this->min_variation_price !== $this->max_variation_price )
$price .= $this->get_price_html_from_text(); $price .= $this->get_price_html_from_text();
$price .= __('Free!', 'woocommerce'); $price .= __('Free!', 'woocommerce');
@ -1071,7 +1071,7 @@ class WC_Product {
'attributes' => $variation_attributes, 'attributes' => $variation_attributes,
'image_src' => $image, 'image_src' => $image,
'image_link' => $image_link, 'image_link' => $image_link,
'price_html' => '<span class="price">' . $variation->get_price_html() . '</span>', 'price_html' => $this->min_variation_price != $this->max_variation_price ? '<span class="price">' . $variation->get_price_html() . '</span>' : '',
'availability_html' => $availability_html, 'availability_html' => $availability_html,
'sku' => __( 'SKU:', 'woocommerce' ) . ' ' . $variation->get_sku(), 'sku' => __( 'SKU:', 'woocommerce' ) . ' ' . $variation->get_sku(),
'min_qty' => 1, 'min_qty' => 1,

View File

@ -49,7 +49,7 @@ foreach ( $product->get_children() as $child_id ) {
<?php endif; ?> <?php endif; ?>
</td> </td>
<td><label for="product-<?php echo $child_product['product']->id; ?>"><?php <td class="label"><label for="product-<?php echo $child_product['product']->id; ?>"><?php
if ($child_product['product']->is_visible()) if ($child_product['product']->is_visible())
echo '<a href="'.get_permalink($child_product['product']->id).'">' . $child_product['product']->get_title() . '</a>'; echo '<a href="'.get_permalink($child_product['product']->id).'">' . $child_product['product']->get_title() . '</a>';

View File

@ -16,8 +16,8 @@ global $woocommerce, $product, $post;
<tbody> <tbody>
<?php $loop = 0; foreach ( $attributes as $name => $options ) : $loop++; ?> <?php $loop = 0; foreach ( $attributes as $name => $options ) : $loop++; ?>
<tr> <tr>
<td><label for="<?php echo sanitize_title($name); ?>"><?php echo $woocommerce->attribute_label($name); ?></label></td> <td class="label"><label for="<?php echo sanitize_title($name); ?>"><?php echo $woocommerce->attribute_label($name); ?></label></td>
<td><select id="<?php echo esc_attr( sanitize_title($name) ); ?>" name="attribute_<?php echo sanitize_title($name); ?>"> <td class="value"><select id="<?php echo esc_attr( sanitize_title($name) ); ?>" name="attribute_<?php echo sanitize_title($name); ?>">
<option value=""><?php echo __('Choose an option', 'woocommerce') ?>&hellip;</option> <option value=""><?php echo __('Choose an option', 'woocommerce') ?>&hellip;</option>
<?php <?php
if ( is_array( $options ) ) { if ( is_array( $options ) ) {