Unable to Import from a Exported CSV file.

  • Posts: 135
  • Thank you received: 5
6 years 4 months ago #294753

-- HikaShop version -- : 3.4.1
-- Joomla version -- : 3.8.10
-- PHP version -- : 5.6.3
-- Browser(s) name and version -- : Chrome 67.0.3396.79 (Official Build) (64-bit)
-- Error-message(debug-mod must be tuned on) -- : You need 73 arguments per line

@support, @forum,

I did a export of ONE product (checked the product and selected export).
Generated the hikashopexport.csv
I updated 4 variants (record numbers #29251, #29275, #29283 & #29291) with Image file paths and names in the csv file, saved it.

Ran the import, and error message "You need 73 arguments per line" came up.

Have attached the csv file, and 3 screen shots with the config for the import and error messages.

I read the doco and that didn't help, has there been a change in the 3.4.1 version ?

I realise there are way too many Variants for the product, but I am just trying to make this easier for me to get all the products and variants into the shop without screen input everything.

Thanks and Regards,

MSF

Attachments:

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

  • Posts: 135
  • Thank you received: 5
6 years 4 months ago #294766

And now I have a database full of junk from that import.

See attached.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
6 years 4 months ago #294759

Hi,

It seems that your CSV editor added some double quotes around all the elements of the CSV and it messed the CSV file itself.
I would recommend to do the export again, open it with libreoffice / openoffice's calc and modify it there.
Also, you can remove all the category lines that are not useful since you already have all the categories in the shop.

The following user(s) said Thank You: markfell

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

  • Posts: 135
  • Thank you received: 5
6 years 4 months ago #294795

Thanks Nicolas,
I thought it may have been the editor when I thought about it, but not having looked at this exported file before, wasn't so sure.

Is there a way that I can delete all the extra product lines that it put in.?

MyPhpadmin, export the SQL, drop the product data set, edit the sql file and then import it ?? After a backup of course ?
How do I know good / bad product and their links ?
Good or bad idea ?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
6 years 4 months ago #294799

Hi,

You could delete the wrong product entries via the interface if you can. You don't necessarily have to do that via PHPMyAdmin.
Now, how do you know if the product is good or bad, that I don't know myself. I suppose you know better than me which products are correct or not.
You should definitely do a backup, but specially before doing an import like that. Specially the first time you do it and you're not sure about the file you're importing.

The following user(s) said Thank You: markfell

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

  • Posts: 135
  • Thank you received: 5
6 years 4 months ago #294840

Hi Nicolas,

The products are no in the hikashop interface, there just 1000's of rouge entries in the Product Database set.
Hence why I was thinking of just doing SQL dump and cleaning that up and re-importing it.

MSF

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
6 years 4 months ago #294851

Hi,

Then, yes, through PHPMyAdmin. And yes, in that case, I would recommend doing a backup before just in case.

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

  • Posts: 135
  • Thank you received: 5
6 years 4 months ago #295407

Hi,

Where in the DB is the counter for the product ID number ?

After my rogue database import, all my id's are now starting at 39000 and I only have 1600 records in the database.

I would like to reset it to 2000.

Also, why does the import put a name (truncated image name) in the Main Options name of the Variant when the import file has "" in the csv field?

I have attached the csv file, look at product_id 39119, then look at the attached screen shot of the Variant after the import, and last image is of the hikashop_file dataset and what it puts in there. It also replaces name also with a truncated image file name.

I have wasted hours today, deleting and rebuilding the database in phpmyadmin.

I have 34 more imports to do, I just want it to work, if I say "" in name field or something, thats what I would like.

Is there a patch needed to fix this, or some code replace you want to send me ?


Thanks in Advance,
MSF

Attachments:
Last edit: 6 years 4 months ago by markfell. Reason: Other errors in the Import program.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
6 years 4 months ago #295408

Hi,

The product ID is stored in the product_id column of the "hikashop_product" table.
The ID for new products is incremented with the auto increment feature of MySQL:
dev.mysql.com/doc/mysql-tutorial-excerpt...-auto-increment.html

Regarding the name of the variants being filled automatically, that's a side effect of the capability HikaShop has to generate products from images in a folder automatically. In such cases, there is no name given and the name is automatically filled with the name of the file used to generate the product.
To avoid that, you can change the line:
if(empty($product->product_name)){
to:
if(empty($product->product_name) && $product->product_type != 'variant'){
in the file administrator/components/com_hikashop/helpers/import.php
We'll do that change on our end too for the next version.

Last edit: 6 years 4 months ago by nicolas.
The following user(s) said Thank You: markfell

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

  • Posts: 135
  • Thank you received: 5
6 years 4 months ago #295460

Hi,

Also modified the code when using another product as the template. It used the name of the product and places it in all the variants names.

$product->product_name = $this->template->product_name; to

$product->product_name = "";

MSF

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
6 years 4 months ago #295464

Hi,

Thanks for the feedback.
However that change is not correct as it will have side effects you don't want. For example, if you try to duplicate a product with the "copy" button on the products listing, the product name won't be copied over if you do that modification.
Instead, it will be better to change the line:
if(empty($product->product_name) && !empty($this->template->product_name)){
to:
if(empty($product->product_name) && !empty($this->template->product_name) && $product->product_type != 'variant'){

The following user(s) said Thank You: markfell

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

  • Posts: 135
  • Thank you received: 5
6 years 4 months ago #295505

Hi,

Thanks Nicolas, have changed the code.

MSF

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

Time to create page: 0.077 seconds
Powered by Kunena Forum