Fix double tip Closes #1856.

This commit is contained in:
Mike Jolley 2012-11-28 18:02:12 +00:00
parent 0dd88985d7
commit a8a1af4ba3
3 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( $_product->get_sku() ) if ( $_product->get_sku() )
echo '<br/><strong>' . __( 'Product SKU:', 'woocommerce' ).'</strong> ' . esc_html( $_product->get_sku() ); echo '<br/><strong>' . __( 'Product SKU:', 'woocommerce' ).'</strong> ' . esc_html( $_product->get_sku() );
?>"><?php echo $_product->get_image(); ?></a> ?>"><?php echo $_product->get_image( 'shop_thumbnail', array( 'title' => '' ) ); ?></a>
</td> </td>
<td class="name"> <td class="name">

View File

@ -1193,15 +1193,15 @@ abstract class WC_Product {
* @param string $size (default: 'shop_thumbnail') * @param string $size (default: 'shop_thumbnail')
* @return string * @return string
*/ */
function get_image( $size = 'shop_thumbnail' ) { function get_image( $size = 'shop_thumbnail', $attr = array() ) {
global $woocommerce; global $woocommerce;
$image = ''; $image = '';
if ( has_post_thumbnail( $this->id ) ) { if ( has_post_thumbnail( $this->id ) ) {
$image = get_the_post_thumbnail( $this->id, $size ); $image = get_the_post_thumbnail( $this->id, $size, $attr );
} elseif ( ( $parent_id = wp_get_post_parent_id( $this->id ) ) && has_post_thumbnail( $parent_id ) ) { } elseif ( ( $parent_id = wp_get_post_parent_id( $this->id ) ) && has_post_thumbnail( $parent_id ) ) {
$image = get_the_post_thumbnail( $parent_id, $size ); $image = get_the_post_thumbnail( $parent_id, $size, $attr );
} else { } else {
$image = woocommerce_placeholder_img( $size ); $image = woocommerce_placeholder_img( $size );
} }

View File

@ -289,17 +289,17 @@ class WC_Product_Variation extends WC_Product {
* @param string $size (default: 'shop_thumbnail') * @param string $size (default: 'shop_thumbnail')
* @return string * @return string
*/ */
function get_image( $size = 'shop_thumbnail' ) { function get_image( $size = 'shop_thumbnail', $attr = array() ) {
global $woocommerce; global $woocommerce;
$image = ''; $image = '';
if ( $this->variation_id && has_post_thumbnail( $this->variation_id ) ) { if ( $this->variation_id && has_post_thumbnail( $this->variation_id ) ) {
$image = get_the_post_thumbnail( $this->variation_id, $size ); $image = get_the_post_thumbnail( $this->variation_id, $size, $attr );
} elseif ( has_post_thumbnail( $this->id ) ) { } elseif ( has_post_thumbnail( $this->id ) ) {
$image = get_the_post_thumbnail( $this->id, $size ); $image = get_the_post_thumbnail( $this->id, $size, $attr );
} elseif ( $parent_id = wp_get_post_parent_id( $this->id ) && has_post_thumbnail( $parent_id ) ) { } elseif ( $parent_id = wp_get_post_parent_id( $this->id ) && has_post_thumbnail( $parent_id ) ) {
$image = get_the_post_thumbnail( $parent_id, $size ); $image = get_the_post_thumbnail( $parent_id, $size , $attr);
} else { } else {
$image = woocommerce_placeholder_img( $size ); $image = woocommerce_placeholder_img( $size );
} }