Virtuemart Import problem - No product images

  • Posts: 62
  • Thank you received: 4
  • Hikashop Business
9 years 1 month ago #215597

-- url of the page with the problem -- : www.sombrerobrands.com
-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.3
-- Browser(s) name and version -- : Internet Explorer 11
-- Error-message(debug-mod must be tuned on) -- : No error messages

None of the images are being imported into HikaCart from Virtuemart. Permissions are wide open. I see all of the images in the images/com_hikashop/upload directory.
Why can't I easily import all of my products? Please help!

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 1 month ago #215699

Hi,

Do you have a link in your website which will allow us to know a little more about what has been imported ?
Or maybe some information from the HikaShop product edition page or from the table "hikashop_file" ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 62
  • Thank you received: 4
  • Hikashop Business
9 years 1 month ago #215701

You have the latest stable version of HikaShop Business: 2.6.0

All of the products imported fine, but the images are all showing place holders with a few exceptions such as categories.
www.sombrerobrands.com/new

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

  • Posts: 62
  • Thank you received: 4
  • Hikashop Business
9 years 1 month ago #215705

When I use the 2.6 version to import, I get this nice sql error.

Unknown column 'vmp.product_id' in 'field list' SQL=INSERT IGNORE INTO `l7hr9_hikashop_product` (`product_name`,`product_description`,`product_quantity`,`product_code`,`product_published`,`product_hit`,`product_created`,`product_modified`,`product_sale_start`,`product_tax_id`,`product_type`,`product_url`,`product_weight`,`product_weight_unit`,`product_dimension_unit`,`product_sales`,`product_width`,`product_length`,`product_height`) SELECT vmpeg.product_name,CONCAT(vmpeg.product_s_desc,'<hr id="system-readmore"/>',vmpeg.product_desc),case when vmp.product_in_stock IS NULL or vmp.product_in_stock < 0 then 0 else vmp.product_in_stock end,case when vmp.product_sku IS NULL or vmp.product_sku="" then MD5(vmp.product_id) else vmp.product_sku end,vmp.published,0,UNIX_TIMESTAMP(vmp.created_on),UNIX_TIMESTAMP(vmp.modified_on),UNIX_TIMESTAMP(vmp.product_available_date),hkc.category_id,'main',vmp.product_url,vmp.product_weight,LOWER(vmp.product_weight_uom),LOWER(vmp.product_lwh_uom),vmp.product_sales,vmp.product_width,vmp.product_length,vmp.product_height FROM `l7hr9_virtuemart_products` AS vmp INNER JOIN `l7hr9_virtuemart_products_en_gb` vmpeg ON vmp.virtuemart_product_id = vmpeg.virtuemart_product_id LEFT JOIN `l7hr9_virtuemart_product_prices` vmpp ON vmpeg.virtuemart_product_id = vmpp.virtuemart_product_id LEFT JOIN `l7hr9_hikashop_taxation` hkt ON hkt.tax_vm_id = vmpp.product_tax_id LEFT JOIN `l7hr9_hikashop_category` hkc ON hkc.category_namekey = hkt.category_namekey LEFT JOIN `l7hr9_hikashop_vm_prod` AS hkp ON vmp.virtuemart_product_id = hkp.vm_id WHERE hkp.hk_id IS NULL AND vmp.virtuemart_product_id > 0 GROUP BY vmp.virtuemart_product_id ORDER BY vmp.virtuemart_product_id ASC LIMIT 100;

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 1 month ago #215767

Hi,

You can redownload HikaShop 2.6.0 ; we create a patch yesterday for that issue.
In the "vm2.php" file, we replaced

'product_code' => 'case when vmp.product_sku IS NULL or vmp.product_sku="" then MD5(vmp.product_id) else vmp.product_sku end',
into
'product_code' => 'case when vmp.product_sku IS NULL or vmp.product_sku="" then MD5(vmp.virtuemart_product_id) else vmp.product_sku end',

Otherwise, in your "new" website, I can see one product but I don't know where to look exactly.
Because I don't think that your first product is an imported product from VM.
sombrerobrands.com/new/index.php?option=...lf-putter&Itemid=357

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 62
  • Thank you received: 4
  • Hikashop Business
9 years 1 month ago #215812

I'm still not able to get the import tool to import ANY product images. We have two websites that I need to migrate from VirtueMart and both are unable to import product images. Can someone help?

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

  • Posts: 62
  • Thank you received: 4
  • Hikashop Business
9 years 1 month ago #215821

I've purchased CSV Improved in hopes of importing from a csv file, but not having any success there either.
Why don't the images come through? I see lots of these errors while importing:
File already exists "C:\wamp\www\sombrero\images\com_hikashop\upload\/shanks-diagram-670-x-799.jpg" ("C:\wamp\www\sombrero\images/stories/virtuemart/product/shanks-diagram-670-x-799.jpg")

Any assistance would be greatly appreciated.

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

  • Posts: 62
  • Thank you received: 4
  • Hikashop Business
9 years 1 month ago #215840

Since no one has taken the time to help with this issue, I created a stored procedure in MySQL to import the images from VirtueMart to HikaShop. I'd suggest deleting any product images from the hikashop_file table first. Obviously you will need to change the table prefix to match your table prefix.

I've provided it here for anyone with the same problem:
DELIMITER |
DROP PROCEDURE IF EXISTS import_images |
CREATE PROCEDURE import_images()
BEGIN
DECLARE v_title varchar(100);
DECLARE v_product_id INT;
DECLARE DONE INT DEFAULT 0;
DECLARE flag1 VARCHAR(5) DEFAULT 'START' ;
DECLARE getImages CURSOR FOR SELECT l7hr9_virtuemart_medias.file_title, l7hr9_virtuemart_product_medias.virtuemart_product_id
FROM l7hr9_virtuemart_product_medias
INNER JOIN l7hr9_virtuemart_medias ON l7hr9_virtuemart_product_medias.virtuemart_media_id = l7hr9_virtuemart_medias.virtuemart_media_id;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET flag1 = 'END';

OPEN getImages;
WHILE flag1 <> 'END' DO
FETCH getImages INTO v_title,v_product_id;
IF flag1 <> 'END' THEN
insert into l7hr9_hikashop_file(file_path,file_type,file_ref_id)
VALUES(concat('/',v_title),'product', v_product_id);
END IF;
END WHILE;

CLOSE getImages;


END |
DELIMITER ;

Last edit: 9 years 1 month ago by tadosborn.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 1 month ago #216050

Hi,

Thank you for your feedback.
The issue is that VM keeps changing the way they store the images of the products.
Sometimes it's in the file_meta field, sometimes in the file_url field.
So the import system handles these two, but not yet file_title.

I've added some additional code on our end to take into account that field, by adding the code:

if(!$result && !empty($c->file_title) ) {
					$file_name = str_replace('\\','/',$c->file_title);
					if( strpos($file_name,'/') !== false ) {
						$file_name = substr($file_name, strrpos($file_name,'/'));
					}
					$result = $this->copyFile($this->copyImgDir,$c->file_title, $this->options->uploadfolder.$file_name);
					if($result){
						$meta_files[] = $this->db->Quote($c->file_title);
					}
				}
after the code
if( !empty($c->file_meta) ) {
					$file_name = str_replace('\\','/',$c->file_meta);
					if( strpos($file_name,'/') !== false ) {
						$file_name = substr($file_name, strrpos($file_name,'/'));
					}
					$result = $this->copyFile($this->copyImgDir,$c->file_meta, $this->options->uploadfolder.$file_name);
					if($result){
						$meta_files[] = $this->db->Quote($c->file_meta);
					}
				}
and changing the code:
'SELECT vmp.virtuemart_product_id, vmm.file_meta, vmm.file_url '.
to:
'SELECT vmp.virtuemart_product_id, vmm.file_meta, vmm.file_url, vmm.file_title '.
in the file administrator/components/com_hikashop/helpers/import/vm.php
Hopefully, that will be enough to support that.

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

  • Posts: 30
  • Thank you received: 0
9 years 1 month ago #216377

I got the problem that the url isnt correct. it shows halfways a backslash and a forward slash.

/home/deb55134/domains/onzetoekomst.nl/public_html/bsl/images\/stories\/virtuemart\/product\/MM1007_Dark_Antraciet.jpg

after the images folder it goes wrong... :blink:

how can i fix this ?

i am at the moment using starter, but if i can make this work i am buying the essential version :)
vm3
joomla 3.4.3
Hikashop 2.6.0

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 1 month ago #216452

Hi,

Is it possible to know your exact HikaShop build number ?
You can find that information in the HikaShop configuration, in the "main" tab under "advanced" section.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 30
  • Thank you received: 0
9 years 1 month ago #216498

This is my hikashop version : HikaShop Starter 2.6.0 [1510051113]

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 1 month ago #216619

Hi,

Okay so you have the latest patch except the patch Nicolas gave in that thread 5 days ago.
Did you applied that patch .

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 30
  • Thank you received: 0
9 years 1 month ago #216624

Yes i have tried replacing the code, which didnt solved the problem with importing the product images.
It also didnt import the products, is the image related to the products? So that if the image upload fails the products wont be imported either?

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

  • Posts: 30
  • Thank you received: 0
9 years 1 month ago #217130

Is there any progress in the virtuemart import problem with the product images ?

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

  • Posts: 30
  • Thank you received: 0
9 years 1 month ago #217416

Hey, i have never worked with stored procedures.
How can i use this ?
Is this something i load into PHPmyAdmin ?

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

  • Posts: 62
  • Thank you received: 4
  • Hikashop Business
9 years 3 days ago #221263

I just had to create a new stored procedure to import images because the import script failed to import ANY images. The version of VirtueMart had put the images in a different location (table and file location). Here is the stored procedure that you can adapt to your install to get the images imported:
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `import_images`()
BEGIN
DECLARE v_title varchar(100);
DECLARE v_product_id INT;
DECLARE v_hika_product_id INT;
DECLARE v_new_image varchar(100);
DECLARE DONE INT DEFAULT 0;
DECLARE flag1 VARCHAR(5) DEFAULT 'START' ;
DECLARE getImages CURSOR FOR SELECT
xn39k_virtuemart_product_medias.virtuemart_product_id,
xn39k_hikashop_vm_prod.hk_id,
xn39k_virtuemart_medias.file_url
FROM
xn39k_virtuemart_product_medias
INNER JOIN xn39k_virtuemart_medias ON xn39k_virtuemart_product_medias.virtuemart_media_id = xn39k_virtuemart_medias.virtuemart_media_id
INNER JOIN xn39k_hikashop_vm_prod ON xn39k_hikashop_vm_prod.vm_id = xn39k_virtuemart_product_medias.virtuemart_product_id;

DECLARE CONTINUE HANDLER FOR NOT FOUND SET flag1 = 'END';

OPEN getImages;
WHILE flag1 <> 'END' DO
FETCH getImages INTO v_product_id,v_hika_product_id, v_title;
IF flag1 <> 'END' THEN
-- find image name
SET v_new_image = substring_index(v_title,'/',-1);
insert into xn39k_hikashop_file(file_path,file_type,file_ref_id)
VALUES(concat('/',v_new_image),'product', v_hika_product_id);
END IF;
END WHILE;

CLOSE getImages;



END$$
DELIMITER ;

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

Time to create page: 0.094 seconds
Powered by Kunena Forum