Groups product titles. Closes #1966.

This commit is contained in:
Mike Jolley 2012-12-11 17:28:47 +00:00
parent d057ce7769
commit 681a2a8ba5
2 changed files with 18 additions and 2 deletions

View File

@ -56,6 +56,22 @@ class WC_Product_Simple extends WC_Product {
$this->check_sale_price();
}
/**
* Get the title of the post.
*
* @access public
* @return string
*/
function get_title() {
$title = $this->post->post_title;
if ( $this->get_parent() > 0 ) {
$title = get_the_title( $this->get_parent() ) . ' → ' . $title;
}
return apply_filters( 'woocommerce_product_title', apply_filters( 'the_title', $title, $this->id ), $this );
}
/**
* Checks sale data to see if the product is due to go on sale/sale has expired, and updates the main price.

View File

@ -54,9 +54,9 @@ foreach ( $product->get_children() as $child_id ) {
<td class="label"><label for="product-<?php echo $child_product['product']->id; ?>"><?php
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']->post->post_title . '</a>';
else
echo $child_product['product']->get_title();
echo $child_product['product']->post->post_title;
?></label></td>