Export is missing product_parent_id values

  • Posts: 141
  • Thank you received: 3
  • Hikashop Business
3 years 6 months ago #324303

-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.21
-- PHP version -- : 7.3.22
-- Browser(s) name and version -- : Safari

Has the Parent ID field when using Variants changed lately?

I just exported products from a test site to CSV and there are no product_parent_id values, even though there are a few product I created last night with 8-10 Variants each.

Are custom Product Codes for Variants still allowed (as opposed to using the automatically generated Product Codes)?

Since we use lots of Variant pricing for package sizes, I do much of my inventory management via CSV import and export instead of using the Hikashop Product interface.

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
3 years 6 months ago #324346

Hi,

We did one change to the products export system in the 4.4.0:

We've improved the product CSV export to be based on the type of the columns in the database in order to better handle conversion of types when generating the CSV file.

And I think it's linked to that.
Add the line:
$columnsArray['product_parent_id'] = 'varchar';
after the line:
$columnsArray['categories_ordering'] = 'varchar';
in the file product / export;php via the menu display>Views and that should fix the problem.

The following user(s) said Thank You: icomex

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

  • Posts: 141
  • Thank you received: 3
  • Hikashop Business
3 years 6 months ago #324352

Success!
Can I assume this will be included in future releases? or will I need to keep my customization as I upgrade?

Thank you very much.

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
3 years 6 months ago #324355

Hi,

Thanks for your feedback. Yes, it will be included.

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

  • Posts: 141
  • Thank you received: 3
  • Hikashop Business
3 years 6 months ago #324380

I'm still testing Hikashop 4.4.0, and might have found a related issue.

In the past, I have updated most of my datasets using CSV imports, including variants and variant pricing. With 4.4.0, I exported the Product with Variants, the data appeared as I expected.

I then attempted to import that complete set of data with minor alterations to the product_name, product_alias and pricing values of the Variant records.

The result created a new set of Variant Records (including a modified product_parent_id value) instead of updating the existing Variants, and also updated the Product record but removed its relationship to the Characteristic ("Packaging"). When I re-load the Characteristic connection into the Product, the connection to the original Variants re-appeared along with the new Variants, but all the new Variant titles were the same as the first one loaded, and no default Variant was selected. When I selected a default on the Variant List, I got a SQL error:

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
When I reloaded the Product Form, ALL the Variants were marked as Default.

I'll keep on this to see if I found some pattern.

Last edit: 3 years 6 months ago by icomex.

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
3 years 6 months ago #324381

Hi,

Please check the product_parent_id of you CSV. The column needs to be filled for variant rows in your CSV.
And without the modification I provided above that wouldn't be the case. So you need to do the modification too.

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

  • Posts: 141
  • Thank you received: 3
  • Hikashop Business
3 years 6 months ago #324404

I did correct the product_parent_id before importing.

What I'm seeing is that when I import new Variants for existing Main products, the Product records for the variants are created, but the Original Product record has no knowledge of the Characteristic. If I add the Characteristic to the Main Product, all the Variants become linked to the Main Product, all the Variants are listed on the Edit Product Page, but are all marked the default value (though the Code and Price values are correct).

To correct it, I have to open and re-save each Variant, selecting the proper Characteristic value. THEN, everything displays properly. However, if I import the same data again, the correct Variant records remain linked to the Main Product, but lose their Characteristic Value. At the same time, a NEW set of Variants is created with the same problems as the original import (but now with a number appended to Product Codes).

Here is the data I used for one Product and its Variants.

product_code	product_parent_id	product_name	product_type	product_page_title	product_alias	product_hit	product_sales	product_sort_price	price_value	price_currency_id	product_weight	product_weight_unit	product_description	product_quantity	product_published	product_url	product_canonical	product_tax_id	product_description_raw	product_description_type	product_width	product_length	product_height	product_dimension_unit	product_created	product_modified	product_last_seen_date	product_keywords	product_meta_description	product_access	product_group_after_purchase	product_display_quantity_field	product_waitlist	product_layout	product_average_score	product_total_vote	product_price_percentage	product_msrp	product_warehouse_id	product_condition	categories	price_min_quantity	price_access	price_users	files	images	related	product_option_method	options
ACARM		Almond Caramel	main	Almond Caramel	almond-caramel	17	3	11.65		USD	1.1	lb	<p>Rich vanillla caramel combined with chopped Almonds</p>	-1	1			11			0	0	0	m	1597335178	1597347867	1601415289			all		0	0		0	0	0	0	0		Caramels	0	all			acarm.png	LCARM		
ACARM_BG_8_oz	ACARM	8 oz. bag	variant	Almond Caramel	acarm_bg_8_oz	0	0	6.20	6.20	USD	0.6	lb	<p>Rich vanillla caramel combined with chopped Almonds</p>	-1	1			11			0	0	0	m	1597335178	1597347867	1601415289			all		0	0		0	0	0	0	0		Caramels	0	all			acarm.png	LCARM		
ACARM_BG_1_lb	ACARM	1 lb. bag	variant	Almond Caramel	acarm_bg_1_lb	0	0	12.40	12.40	USD	1.1	lb	<p>Rich vanillla caramel combined with chopped Almonds</p>	-1	1			11			0	0	0	m	1597335178	1597347867	1601415289			all		0	0		0	0	0	0	0		Caramels	0	all			acarm.png	LCARM		
ACARM_BX_1_lb	ACARM	1 lb. box	variant	Almond Caramel	acarm_bx_1_lb	0	0	13.40	13.40	USD	1.15	lb	<p>Rich vanillla caramel combined with chopped Almonds</p>	-1	1			11			0	0	0	m	1597335178	1597347867	1601415289			all		0	0		0	0	0	0	0		Caramels	0	all			acarm.png	LCARM		
ACARM_BX_2_lb	ACARM	2 lb. box	variant	Almond Caramel	acarm_bx_2_lb	0	0	25.80	25.80	USD	2.26	lb	<p>Rich vanillla caramel combined with chopped Almonds</p>	-1	1			11			0	0	0	m	1597335178	1597347867	1601415289			all		0	0		0	0	0	0	0		Caramels	0	all			acarm.png	LCARM		
ACARM_BX_3_lb	ACARM	3 lb. box	variant	Almond Caramel	acarm_bx_3_lb	0	0	38.20	38.20	USD	3.29	lb	<p>Rich vanillla caramel combined with chopped Almonds</p>	-1	1			11			0	0	0	m	1597335178	1597347867	1601415289			all		0	0		0	0	0	0	0		Caramels	0	all			acarm.png	LCARM		
ACARM_BX_5_lb	ACARM	5 lb. box	variant	Almond Caramel	acarm_bx_5_lb	0	0	63.60	63.60	USD	5.4	lb	<p>Rich vanillla caramel combined with chopped Almonds</p>	-1	1			11			0	0	0	m	1597335178	1597347867	1601415289			all		0	0		0	0	0	0	0		Caramels	0	all			acarm.png	LCARM

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
3 years 6 months ago #324446

Hi,

I don't see any column for each characteristic of your shop.
You normally have one column per characteristic in a CSV.
And for the main product row, you have the default value of the characteristic in that column.
And for each variant row, you have the value of the variant for that characteristic in that column.
That's how the system link the product with the variants through the characteristic(s).

On the page www.hikashop.com/support/documentation/73-hikashop-import.html we have an example of import with variants that you can check out.
And if you export the CSV of a product with variants, you should see these additional columns filled for each row.

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

  • Posts: 141
  • Thank you received: 3
  • Hikashop Business
3 years 6 months ago #324455

Thanks. I don't know why I didn't notice that, because I've seen it before in other installations.

Early tests are good, including a few new product insertions. I'll keep you informed.

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

  • Posts: 141
  • Thank you received: 3
  • Hikashop Business
3 years 6 months ago #324549

It's working beautifully now, all my issues regarding importing and exporting appear to be sorted out.

Thank you very much for your help.

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

Time to create page: 0.075 seconds
Powered by Kunena Forum