Loading speed with variations (resolved)

  • Posts: 180
  • Thank you received: 13
12 years 5 months ago #54810

Categories and product listings pages load with speed as you would expect.

When loading a page with a large number of variations, (3 colour and 7 sizes) the product page takes over 5 seconds to load, and this is running local (i am using MAMP for development).

Caching and ZIP are both one, and as I have said the rest of the site, including the pages from Hikashop that are not the product page load with speed.

It can not be image creation (e.g. creating thumbnails) as they have already been done on the first visit to the page.

I am baffled about the speed and rather worried about it's implications.

Any advice or feedback would be appreciated.

Last edit: 12 years 4 months ago by esotechie.

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

  • Posts: 180
  • Thank you received: 13
12 years 5 months ago #54811

Hmmm. I did a bit more testing switching things on and off and it seems to slow right down with "Display vote in products page" turned on. Turn off and the page loads in 3 seconds, which even though is slower than I would like, considerably better.

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

  • Posts: 180
  • Thank you received: 13
12 years 5 months ago #54844

Some more information from my testing:

The bottleneck is in the file administrator->components->com_hikashop->classes->product.php

and the part of the code causing the slow load is:

			if(isset($element->$field) && is_array($element->$field) && count($element->$field)){
				$array=array();
				foreach($element->$field as $k => $v){
					$array[$k] = (PHP_VERSION < 5) ? $v : clone($v);
				}
				$variant->$field=$array;
			}else{

				if($field=='product_name'){
					$config =& hikashop_config();
					if(!empty($variant->characteristics)){
						$separator = $config->get('characteristics_values_separator',' ');
						foreach($variant->characteristics as $val){
							$variant->characteristics_text.=$separator.$val->characteristic_value;
						}
					}
				}else{
					$variant->$field = @$element->$field;
				}
			}

I believe it is the line $variant->$field = @$element->$field; that does the most damage. Looking at the products it is the text in the description which is making it slow, reducing the description to a couple of words makes it fast. This means that any product with multiple variations and large text, are slow to load, which is not great.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
12 years 5 months ago #54930

Hi,

Yes, as you can set a different description for each variant of a product, that code helps the system fill the default description of the main product for variants without a description (and that's the same for all the other fields in fact).

As a quick fix, you can disable the copy of the description here, and remove the div display variants description in the "show" file of the "product" view.

As a long term solution, we would have to optimize the code so that if none of the variants have a value for a field, we could just not copy the data to the variants and skip the display of the variants value for that field.
That would have the double benefit to reduce the page size and improve a bit the number of characteristics/variants a product could have before crashing (a few hundred variants at the moment for a normal server).

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

  • Posts: 180
  • Thank you received: 13
12 years 5 months ago #54934

Thanks for the reply Nicolas. Clear answer.

I'll have to wait and judge it on a project basis on :
1) if variants have different values
2) the size of the data

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

  • Posts: 180
  • Thank you received: 13
12 years 5 months ago #55024

Sorry Nicolas but I can not see what I need to change in the file administrator->components->com_hikashop->classes->product.php to disable the variant description loads but still have the main product description to show. If I comment out $variant->$field = @$element->$field;, not description appears.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
12 years 5 months ago #55065

You need to remove that line yes. And as I said in my message, you also need to remove the div display variants description in the "show" file of the "product" view. That way the system will always use the description of the main product.

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

  • Posts: 180
  • Thank you received: 13
12 years 4 months ago #55120

Seems the issue was being magnified by the same issue as in my thread "Comments and Vote unusable due to speed"

i.e. jQueryEasy.

Have to find an uneasy way to manage jQuery libraries :)

Last edit: 12 years 4 months ago by esotechie.

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

Time to create page: 0.064 seconds
Powered by Kunena Forum