Dimensions don't show when there are variants :-(

  • Posts: 173
  • Thank you received: 8
  • Hikashop Essential
12 years 9 months ago #70734

Dimensions don't show when I have a variant without dimensions???

Have some love spoons in different wood, they all have the same dimension and weight, because they are setup with variant: Beech, yew and Oak the main product dimensions don't display.

Any way around this?

Thanks

Ian

Last edit: 12 years 9 months ago by ianspeed.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
12 years 8 months ago #70888

Hi,

This problem has been corrected, and will be in the next release.

You can correct it by replacing the code in "yourSite\administrator\component\com_hikashop\classes\product.php":

		if(isset($variant->product_weight) && $variant->product_weight==0){
			unset($variant->product_weight_unit);
		}
		if(isset($variant->product_length) && isset($variant->product_height) && isset($variant->product_width) && $variant->product_length==0 && $variant->product_height==0 && $variant->product_width==0){
			unset($variant->product_dimension_unit);
		}
By:
		if(isset($variant->product_weight) && $variant->product_weight==0){
			$variant->product_weight_unit=$element->product_weight_unit;
		}
		if(isset($variant->product_length) && isset($variant->product_height) && isset($variant->product_width) && $variant->product_length==0 && $variant->product_height==0 && $variant->product_width==0){
			$variant->product_dimension_unit=$element->product_dimension_unit;
		}

Then in the view "product / show" in HikaShop > Display > Views, replace the foreach starting by:
foreach (get_object_vars($this->element->main) as $name=>$value) {
By:
			foreach (get_object_vars($this->element->main) as $name=>$value) {
				if(!is_array($name)&&!is_object($name)){
					$required = false;

					foreach ($this->element->variants as $variant) {
						if(!empty($variant->$name) && (!is_numeric($variant->$name) || $variant->$name>0)){
							$required = true;
							break;
						}
					}
					if($required){
						foreach ($this->element->variants as $k=>$variant) {
							if(empty($variant->$name) || (is_numeric($variant->$name) && $variant->$name==0.0)){
								if($name=='product_quantity' && $this->element->$name==-1){
									continue;
								}
								$this->element->variants[$k]->$name=$this->element->main->$name;
							}
						}
					}
				}
			}

And in the view "product / show_block_dimension" add the lines at the top of the file (after the "<?php tag"):
if($this->element->product_weight==0 && $this->element->main->product_weight>0 ){
	$this->element->product_weight = $this->element->main->product_weight;
}
if($this->element->product_width==0 && $this->element->main->product_width>0 ){
	$this->element->product_width = $this->element->main->product_width;
}
if($this->element->product_height==0 && $this->element->main->product_height>0 ){
	$this->element->product_height = $this->element->main->product_height;
}
if($this->element->product_length==0 && $this->element->main->product_length>0 ){
	$this->element->product_length = $this->element->main->product_length;
}

Last edit: 12 years 8 months ago by Xavier.
The following user(s) said Thank You: ianspeed

Please Log in or Create an account to join the conversation.

  • Posts: 173
  • Thank you received: 8
  • Hikashop Essential
12 years 8 months ago #70889

Thanks Xavier,
When is the next release roughly? Might be worth waiting if I tell my customer it'll be sorted shortly :-)?

Also is there anyway to display product thumbnails in the search results...

Many thanks

Ian

Please Log in or Create an account to join the conversation.

  • Posts: 84102
  • Thank you received: 13638
  • MODERATOR
12 years 8 months ago #70948

We're hoping to release it before the end of the month.

If you want to display thumbnails on search results, you should not use the joomla search system, which can't handle that, but instead uses HikaShop filters:
www.hikashop.com/en/support/documentatio...-filter-listing.html
We have an example of such search module at the bottom of our demo website.

The following user(s) said Thank You: ianspeed

Please Log in or Create an account to join the conversation.

Time to create page: 0.048 seconds
Powered by Kunena Forum