Skip to main content

Cart view images incorrect after updating to 2.6.0

More
10 years 11 months ago #216991 by GW
-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.4

Hi,

after updating to HikaShop Business 2.6.0 yesterday, the product thumbnail images are incorrect on our cart display page. The images shown are not the main product image, but instead a thumbnail of the last image of the product (all our products have two or three images).

This happens only in the cart view, in the checkout and emails the thumbnails are the correct main product image. We have no idea what could be causing this, as this appears only on our live webshop and not on our local test site while the "showcart.php" code is identical for both; we have not modified any of the code.

Any help would be greatly appreciated, thanks in advance!

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

More
10 years 11 months ago #217031 by Xavier
Hi,

The same kind of code is used on both views. We take the first image.
Could you try to edit the view and replace that code:
Code:
$width = (int)$this->config->get('thumbnail_x'); $height = (int)$this->config->get('thumbnail_y'); if(isset($cart->images[0])) { $image_options = array( 'default' => true, 'forcesize' => $this->config->get('image_force_size', true), 'scale' => $this->config->get('image_scale_mode','inside') ); $img = $this->image->getThumbnail(@$cart->images[0]->file_path, array('width' => $width, 'height' => $height), $image_options); if($img->success) { echo '<img class="hikashop_product_cart_image" title="'.$this->escape(@$cart->images[0]->file_description).'" alt="'.$this->escape(@$cart->images[0]->file_name).'" src="'.$img->url.'"/>'; } }
By this one:
Code:
$width = (int)$this->config->get('thumbnail_x'); $height = (int)$this->config->get('thumbnail_y'); if(!empty($cart->images)){ $image = reset($cart->images); $this->image = hikashop_get('helper.image'); $this->image->checkSize($width,$height,$image); $image_options = array( 'default' => true, 'forcesize' => $this->config->get('image_force_size', true), 'scale' => $this->config->get('image_scale_mode','inside') ); $img = $this->image->getThumbnail(@$image->file_path, array('width' => $width, 'height' => $height), $image_options); if($img->success) { echo '<img class="hikashop_product_cart_image" title="'.$this->escape(@$cart->images[0]->file_description).'" alt="'.$this->escape(@$cart->images[0]->file_name).'" src="'.$img->url.'"/>'; } }

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

More
10 years 11 months ago #217102 by GW
Hi,

thanks for the reply, unfortunately changing the code did not help anything. The cart display page still shows the last product image rather than the first one.
So for example if we have a product with images A, B, C the cart is showing a thumbnail of image C. We are certain we're changing the right showcart.php file.

We would be very glad of any further help, as all our customers checking their cart are now undoubtedly confused by the images.

Thanks again!

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

More
10 years 11 months ago - 10 years 11 months ago #217105 by Xavier
Hi,

This error has been reported in another topic too, and as I said this issue is strange as this code has not been changed since more than one year.

In the product edition page, are you sure that the images are in the desired order ?

And if you try that code:
Code:
$width = (int)$this->config->get('thumbnail_x'); $height = (int)$this->config->get('thumbnail_y'); if(!empty($cart->images)){ $image = end($cart->images); $this->image = hikashop_get('helper.image'); $this->image->checkSize($width,$height,$image); $image_options = array( 'default' => true, 'forcesize' => $this->config->get('image_force_size', true), 'scale' => $this->config->get('image_scale_mode','inside') ); $img = $this->image->getThumbnail(@$image->file_path, array('width' => $width, 'height' => $height), $image_options); if($img->success) { echo '<img class="hikashop_product_cart_image" title="'.$this->escape(@$image->file_description).'" alt="'.$this->escape(@$image->file_name).'" src="'.$img->url.'"/>'; } }
Last edit: 10 years 11 months ago by Xavier.

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

More
10 years 11 months ago #217192 by GW
Hi,

unfortunately that code also did not make any difference.
We are certain the images of our products are in the desired order. Also because in the checkout and in emails the correct first image of every product is shown, it's only in the cart view that the last image is shown.

We hope there's a solution soon, thanks for your time!

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

More
10 years 11 months ago #217233 by Xavier
Hi,

I was able to reproduce the issue on our end, please edit the file "components/com_hikashop/views/cart/view.html.php" and in the function "showcart()" replace the code:
Code:
$query = 'SELECT * FROM '.hikashop_table('file').' WHERE file_ref_id IN ('.implode(',',$cids).') AND file_type IN (\'product\',\'file\') ORDER BY file_ref_id ASC, file_ordering ASC, file_id ASC'; $database->setQuery($query); $product_files = $database->loadObjectList('file_ref_id');
By:
Code:
$query = 'SELECT * FROM '.hikashop_table('file').' WHERE file_ref_id IN ('.implode(',',$cids).') AND file_type IN (\'product\',\'file\') ORDER BY file_ref_id ASC, file_ordering ASC, file_id ASC'; $database->setQuery($query); $product_files = $database->loadObjectList();
The following user(s) said Thank You: GW

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

More
10 years 11 months ago #217268 by GW
Hi Xavier,

perfect, that fixed it. Thanks very much!

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

Time to create page: 0.231 seconds
Powered by Kunena Forum