Merge pull request #591 from GeertDD/show_partial_dimensions

Show partial dimensions if available
This commit is contained in:
Mike Jolley 2012-02-07 09:23:01 -08:00
commit e35d477170
1 changed files with 13 additions and 7 deletions

View File

@ -799,13 +799,19 @@ class WC_Product {
function get_dimensions() {
if (!$this->dimensions) :
$this->dimensions = '';
$length = $this->length;
$width = $this->width;
$height = $this->height;
if (($length && $width && $height))
$this->dimensions = $length . get_option('woocommerce_dimension_unit') . ' x ' . $width . get_option('woocommerce_dimension_unit') . ' x ' . $height . get_option('woocommerce_dimension_unit');
// Show length
if ($this->length) {
$this->dimensions = $this->length.get_option('woocommerce_dimension_unit');
// Show width also
if ($this->width) {
$this->dimensions .= ' × '.$this->width.get_option('woocommerce_dimension_unit');
// Show height also
if ($this->height) {
$this->dimensions .= ' × '.$this->height.get_option('woocommerce_dimension_unit');
}
}
}
endif;
return $this->dimensions;
}