Add WC_Product::get_formatted_name()

For #2788
This commit is contained in:
Brent Shepherd 2013-03-27 17:57:26 +10:00
parent 3626a2c2e4
commit 022d0a6480
1 changed files with 18 additions and 0 deletions

View File

@ -1271,4 +1271,22 @@ class WC_Product {
return $image;
}
/**
* Get product name with extra details such as SKU price and attributes. Used within admin.
*
* @access public
* @param mixed $product
* @return void
*/
function get_formatted_name() {
if ( $this->get_sku() )
$identifier = $this->get_sku();
else
$identifier = '#' . $this->id;
return sprintf( __( '%s – %s', 'woocommerce' ), $identifier, $this->get_title() );
}
}