Import csv (product isn't shown in backend)

  • Posts: 8
  • Thank you received: 0
13 years 11 months ago #2734

Hi again,

I try to import new products via an import of a csv file.

My csv file looks like:

product_code;product_name;product_keywords;categories;price_value;product_published
123445;Ustersbacher;Ustersbacher;10;4,99;1
The import via backend shows "succesfully imported 1 product". But I don't see that product in my hikashop? Strange is I have set category to 10 for example but nothing has changed after import in db table jos_hikashop_product_category.

category 10 in jos_hikashop_category is:
(10, 2, 'product', 'Biere', '', 1, 1, 3, 4, 2, 'product_1291030852_336393291', 1291030852, 1291030852);

The only change after the import i see is done in jos_hikashop_product. Here I have now one new line like this:
(6, 0, 'Ustersbacher', '', -1, '123445', 1, 0, 1291296100, 0, 0, 0, 0, 'main', 0, 0, '', 0.000, 'Ustersbacher', 'kg', 1291296100, '', 'm', 0.000, 0.000, 0.000, 0);

That's all in the db (and as said nothing about this new imported product in the joomla hikahsop backend).

Is my csv file not 100% correct?

Last edit: 13 years 11 months ago by Heart.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 11 months ago #2735

Hi,

In the backend listing, could you set the filter on the top right corner to "all sub elements". Do you see your product after that ?

If you have the value "direct sub elements" in that filter, only the products linked to the current category are displayed (the main product category by default) and since your product is not directly linked to the main product category, it won't be displayed unless you display the products of the category Biere or that you set the filter to "all sub elements".

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

  • Posts: 8
  • Thank you received: 0
13 years 11 months ago #2736

"All sub elements" is set but I don't see that imported "Ustersbacher" product either :(

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 11 months ago #2737

If the system was able to link the product to the category, in the table hikashop_product_category, you should have an entry: 6,10,0
Is that the case ?

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

  • Posts: 8
  • Thank you received: 0
13 years 11 months ago #2738

as posted in #1 (made it bold) there is no new entry made in the table jos_hikashop_product_category :(

update: as said... also no new entry in db jos_hikashop_price (price_value is there in my csv file)

update2: set debugging on in joomla config and get this error when importing the csv file

JDatabaseMySQL::query: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 SQL=INSERT IGNORE INTO jos_hikashop_price (`price_value`,`price_currency_id`,`price_min_quantity`,`price_product_id`) VALUES ('4.99',1,0,)

So there is no price_product_id set in insert statement, is it? And this cause the missing entries in jos_hikashop_price and jos_hikashop_product_category?

complete output is on nopaste.info/a4290b5662.html

Last edit: 13 years 11 months ago by Heart.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 11 months ago #2739

I tested your CSV on our dev environment and we had the same problem.

It is due to the fact that your product_code is a numeric value and that the PHP array_merge function we use at some point in the import process behaves differently when the keys are numeric.
We usually use strings with letters for prodcuts code so we didn't had that problem.

In the file administrator/components/com_hikashop/helpers/import.php near the end of the file you will find the code

$this->codes = array_merge($this->codes,(array)$this->db->loadObjectList('product_code'));
that you can replace by
$newCodes = (array)$this->db->loadObjectList('product_code');
				foreach($newCodes as $k => $code){
					$this->codes[$k]=$code;
				}
Then, delete the product in the database and import your CSV again. This time, you should see the product in the listing of the back end.

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

  • Posts: 8
  • Thank you received: 0
13 years 11 months ago #2740

Perfect, now it works! Thanks for that fantastic support.

Next update will include this change? (so I can update with no fear that I loose this working csv import)

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

  • Posts: 8
  • Thank you received: 0
13 years 11 months ago #2741

One feature wish for that csv import:

Now when I import an article with a product_code which is already in the db this article is skipped, isn'it?

Suggest I get a new csv list from my external program (there all products are managed incl. price).
When I raise the price for several products I have no chance to update my hikashop products with this new price (because every line with the existing product_code are skipped!?). So it would be nice to have a choice on the hikashop csv import page like i.e.

Skip product_codes which are already in the db? YES / NO

If user set "NO" all fields of products which product_code is already in the db should be updated with the values of that new csv file.

What do you think?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 11 months ago #2743

Of course version 1.4.0 will include it :)
We released this morning version 1.3.9 but didn't push it yet so you might not have the latest version in which case you should update and reapply the patch now. Or wait for next release next week.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 11 months ago #2744

That is a feature we already have in the todo list.

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

  • Posts: 8
  • Thank you received: 0
13 years 11 months ago #2745

perfect B)

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

Time to create page: 0.074 seconds
Powered by Kunena Forum