add custom product thumbnail to the cart

  • Posts: 163
  • Thank you received: 6
  • Hikashop Business
7 years 7 months ago #266299

-- url of the page with the problem -- : www.121time.com
-- HikaShop version -- : 3.0.1
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.6.22
-- Browser(s) name and version -- : chrome

Dear Team

We have a website where customised products are added to the cart, all products being unique (watches)

We developed a module where we could integrate and add each product to the basket without any issues. But we cannot add the image/thumbnail (generated by our server in png) of the custom product and attach it to the related product in the cart.

We added in our helper file the code below. Can you see an obvious reason or could give us a few tricks how we can add the visual of the product in the cart also?

Thank you in advance for your help

Jean-Loup

	$image = new stdClass();
	$image->file_ref_id = $result;
	$image->file_type = 'product';
	$image->file_path = $imageURL;
	$fileClass = hikashop_get('class.file');
	$id = $fileClass->save($image);
	$product->images = array($id);
	$productClass->updateFiles($product,$result,'images');

Last edit: 7 years 7 months ago by Jerome. Reason: [code] is nice

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
7 years 7 months ago #266318

Hi,

HikaShop cannot handle a URL in the file_path column of a file entry of the type "product".
It has to be a relative path from the upload folder to the image.
So if your upload folder is images/com_hikashop/upload/, like it is by default, and that you have an image called myimage.jpg in it, the you just need to specify the file name in that file_path column.

The rest of your code looks good to me.

The following user(s) said Thank You: jean-loup

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

Time to create page: 0.051 seconds
Powered by Kunena Forum