Export product_parent_id column contains product_name not parent_id

  • Posts: 33
  • Thank you received: 0
  • Hikashop Business
5 years 4 months ago #301656

-- url of the page with the problem -- : labco.co.uk/products/standard-exetainer-.../category_pathway-15
-- HikaShop version -- : 4.0.1
-- Joomla version -- : 3.9.1
-- PHP version -- : 7.2
-- Browser(s) name and version -- : vivaldi
-- Error-message(debug-mod must be tuned on) -- : no error message

The CSV export file product_parent_id column contains the product_name and not the product_id of the parent. The csv file is attached.

Attachments:

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

  • Posts: 81504
  • Thank you received: 13063
  • MODERATOR
5 years 4 months ago #301669

Hi,

No, that's the product code not the product name. That's done on purpose so that when you import the CSV on a website without these products, HikaShop can link the variants with the corresponding product properly as the products might not have the same product_id.
If you don't want that, you can remove the code:

foreach($this->products as $k => $product) {
		if($product->product_type == 'variant' && !empty($product->product_parent_id))
			$this->products[$k]->product_parent_id = $this->products[$product->product_parent_id]->product_code;
	}
in the file "export" of the view "product" via the menu Display>Views as a view override.

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

  • Posts: 33
  • Thank you received: 0
  • Hikashop Business
5 years 4 months ago #301695

Thank you for the reply which I understand, but the problem I now have is that my customer has used the export/import process to update the prices of some of the products and variants on the CSV file and then imported the updated file. The imported updated variants now have the first 3 numbers of the product code as their parent_product_id in the database and do not connect with their parent product. So they exist in the database but without the correct parent_product_id they cannot be attached to the product. The product 948W (Case of 2000) with a product_id of 335 demonstrates the problem. The customer had started to recreate the apparently missing variants but then realised that he if he tried to enter the correct name of the variant, the process failed (as the name already existed) and he then found he could add the variant by including an extra blank space in the name, so for product_id 335 there are duplicate variants but with differing parent_product_ids.
I've attached a csv database export of the product table for you.

Attachments:

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

  • Posts: 81504
  • Thank you received: 13063
  • MODERATOR
5 years 4 months ago #301697

Hi,

To update the prices, it's better to use the mass actions system where you can select the columns you want to export and the import is made to update data, while the Products>Import system is more to add new products.
The fact that your product codes start with numbers worsten the issue as the import system actually thought that these were product_ids and thus assigned the variants to products with the product_id being the numbers at the beginning of the product code in the product_parent_id.
I would recommend to get a backup from before the import for the hikashop_product, the hikashop_variant, the hikashop_file, hikashop_price and the hikashop_product_category tables and then redo the export/import using the mass action system.
If you don't have any backup, I'm afraid that it will require fixing the CSV manually and then importing it back after clearing the tables mentioned above. Or running MySQL queries to fix the product_parent_id of the variants one product by one product.

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

  • Posts: 33
  • Thank you received: 0
  • Hikashop Business
5 years 4 months ago #301811

Thank you for the explanation about the mass actions. I had used a mass action to update the prices by a set % but the customer also wanted to change some of the prices on an individual basis. Hence using the product import/export as I didn't know that you can use the mass actions to export/import and be more selective, which I will do in the future.

We do have a backup but the customer now wants to update the CSV manually, if that fails I'll restore the tables from the backup.

Thank you for your prompt, helpful replies.

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

Time to create page: 0.055 seconds
Powered by Kunena Forum