Support is online

Inconsistent Category Path Export in RO CSVI for VirtueMart #83510

Resolved Locked czombos opened this topic Wednesday, 21 May 2025 · 8 replies
Author

Hi,

We are experiencing inconsistent behavior with the VirtueMart category import/export functionality in RO CSVI.

The currently installed Joomla! version is 4.3.4
The currently installed RO CSVI and VM addon is 8.18.1
The currently installed VirtueMart 4.4.4 11101

Problem:
During category exports, the parent category (e.g., “Brand/”) is sometimes missing from the category_path field, even though

  • The category is properly nested under its parent in the VirtueMart backend.

    The structure is visible and correct when browsing the categories in the admin panel or on the frontend.

    No recent changes were made to these entries manually.

    Re-importing the same exported file sometimes duplicates categories or places them at the root level instead of under the intended parent, even when using the "virtuemart_category_id".

What we noticed:
In the exported file, some entries have the full path like Brand/Arezzo Design, but others that are clearly nested do not contain the parent (Brand/) at all — even though they are correctly nested in the backend.

If we manually add the missing parent path to the category_path column before import, everything works fine.

Steps we've taken:

  • Reverted database to earlier state and re-exported — same issue.

    Verified CSVI is up to date.

    Tried both CSV and XLSX format – same results.

I have attached a log file of the export, and one line from the export that should have the Brand ("Márka" in Hungarian) in the Category path.

You can see it on the attached screenshot that the category ID is the same in the spreadsheet and in the VM Admin for that category, and it is nested in the "Márka" category.

(I know, we use Brand as a Category, that's another story)

Can you please advise:

Why does the category_path sometimes omit the parent category during export?

Is there a known bug or setting that affects the hierarchy resolution during export?

Is there a workaround to ensure the full path is always included?

Thanks in advance for your support!

Best regards,
Attila Czombos

Support

Hello Attila,
There is only one possibility I can think for this issue especially if it works for few records and not for others. VirtueMart in its 3.6 version added a new field category_parent_id to #__categories table. There is already a category_parent_id field in #__categories_categories table as well. From then category_parent_id value is saved in both of these tables. RO CSVI gets this value from #__categories table in export. I am thinking you must be having some old data and the new field category_parent_id value #__categories table is saved as 0. That could be the reason you are not getting parent values for few categories. If you know on how to access the database you can check the value category_parent_id in #__categories table for virtuemart_category_id 60. You can also try resaving this category from VirtueMart and check the export. That will save the value in this new field. Try and let me know on how that goes.

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Tharuna,

Thank you for your response.

I have checked the #__virtuemart_category_categories table, and for id = 60, the category_parent_id is still set to 0.

However, in the #__virtuemart_categories table, the values are correct:

virtuemart_category_id = 60
category_parent_id = 53

I tried resaving this category via the VirtueMart backend, but it didn’t update the category_parent_id in the virtuemart_category_categories table — it remained 0.

Could you please confirm:
Is it safe and recommended to manually update the category_parent_id in virtuemart_category_categories using the values from the virtuemart_categories table?

To synchronise the category_parent_id between the two tables, I would run an SQL query like this:

UPDATE invict4_virtuemart_category_categories AS ccc
JOIN invict4_virtuemart_categories AS cat
  ON ccc.id = cat.virtuemart_category_id
SET ccc.category_parent_id = cat.category_parent_id
WHERE ccc.category_parent_id != cat.category_parent_id;

Thanks again for your help!

Support

Hello Atila,

Is it safe and recommended to manually update the category_parent_id in virtuemart_category_categories using the values from the virtuemart_categories table?

Yes please change category_parent_id for virtuemart_category_id 60 row and check the export. If that works then you can change other records. Make sure to take backup of these tables before doing this change.

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Tharuna,

Interestingly, it doesn't allow me to change it.

UPDATE `invict4_virtuemart_category_categories` SET `category_parent_id` = '53' WHERE `invict4_virtuemart_category_categories`.`id` = 60
#1062 - Duplicate entry '53-60' for key 'invict4_virtuemart_category_categories.category_parent_id'
  • parentid.png
Support

Hello Atila,,

UPDATE invict4_virtuemart_category_categories SET category_parent_id = '53' WHERE invict4_virtuemart_category_categories.id = 60

This query is wrong. You should be checking for row with category_child_id value as 60 and update that row with category_parent_id value to 53. This query shows you are updating row with id as 60. Can you check that?

Your actual query should be

UPDATE `invict4_virtuemart_category_categories` SET `category_parent_id` = '53' WHERE `invict4_virtuemart_category_categories`.`category_child_id` = 60

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Tharuna,

It is basically the same, and I got the same error:

Error
SQL query: Copy

UPDATE `invict4_virtuemart_category_categories` SET `category_parent_id` = '53' WHERE `invict4_virtuemart_category_categories`.`category_child_id` = 60;
MySQL said: Documentation

#1062 - Duplicate entry '53-60' for key 'invict4_virtuemart_category_categories.category_parent_id'

If you check the screenshot I attached, you can see that in the invict4_virtuemart_category_categories table, the ID and the category_child_id are always the same.

  • child_id.png
Support

Hello Atila,
In that case there is already a row with category_parent_id 53 and category_child_id 60 and so you get that Duplicate entry error. You can run the below select query and check the rows for category_child_id 60.

SELECT * FROM `invict4_virtuemart_category_categories` WHERE `invict4_virtuemart_category_categories`.`category_child_id` = 60;

If you have multiple rows then you can delete rows with category_parent_id as 0 and leave rows with a value in category_parent_id and then check the export.

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Tharuna,

Thank you very much for pointing me in the right direction and ultimately to the solution.

Here are the steps taken so that all parent and child categories are now correctly stored in the DB, therefore exporting correctly:

Select the duplicated category child IDs

SELECT *
FROM invict4_virtuemart_category_categories
WHERE category_child_id IN (
    SELECT category_child_id
    FROM invict4_virtuemart_category_categories
    GROUP BY category_child_id
    HAVING COUNT(*) > 1
)
ORDER BY category_child_id;

From these duplicates select only where category_parent_id = 0

SELECT *
FROM invict4_virtuemart_category_categories
WHERE category_child_id IN (
    SELECT category_child_id
    FROM invict4_virtuemart_category_categories
    GROUP BY category_child_id
    HAVING COUNT(*) > 1
)
AND category_parent_id = 0
ORDER BY category_child_id, id;
DELETE cat_cat
FROM invict4_virtuemart_category_categories AS cat_cat
JOIN (
    SELECT category_child_id
    FROM invict4_virtuemart_category_categories
    GROUP BY category_child_id
    HAVING COUNT(*) > 1
) AS dupes
ON cat_cat.category_child_id = dupes.category_child_id
WHERE cat_cat.category_parent_id = 0;

**To update category_parent_id in the invict4_virtuemart_category_categories table by matching category_child_id with virtuemart_category_id from the invict4_virtuemart_categories table
**

SELECT
  cat_cat.id,
  cat_cat.category_child_id,
  cat_cat.category_parent_id AS current_parent_id,
  cat.category_parent_id AS new_parent_id
FROM invict4_virtuemart_category_categories AS cat_cat
JOIN invict4_virtuemart_categories AS cat
  ON cat_cat.category_child_id = cat.virtuemart_category_id
WHERE cat_cat.category_parent_id = 0;
UPDATE invict4_virtuemart_category_categories AS cat_cat
JOIN invict4_virtuemart_categories AS cat
  ON cat_cat.category_child_id = cat.virtuemart_category_id
SET cat_cat.category_parent_id = cat.category_parent_id
WHERE cat_cat.category_parent_id = 0;

Thank you again.
Awesome Support.

This topic is locked. New replies are not possible.

Log in to reply to this topic.