- Posts: 176
- Thank you received: 8
add custom product thumbnail to the cart
9 years 7 months ago - 9 years 7 months ago #266299
by jean-loup
add custom product thumbnail to the cart was created by jean-loup
-- 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
-- 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
Code:
$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: 9 years 7 months ago by Jerome. Reason: [code] is nice
Please Log in or Create an account to join the conversation.
9 years 7 months ago #266318
by nicolas
Replied by nicolas on topic add custom product thumbnail to the cart
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.
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.041 seconds