Issues with Product Category Parent display

I am having issues with product categories and how parent categories are displayed.

I have added the “is parent category” flag and “parent category name” fields to the list view via studio. I have a large number of categories, however one simple example is:

+Microwaves
±—Microwave - Small
±—Microwave - Regular
±—Microwave - Large

The list display appears to be repeating the parent category with each of the children being displayed. So instead of the expected 4 records I am getting 6 records. This is only happening when I include the “parent category name” field.

When viewing the details of a child records everything looks OK

When viewing the details of the parent I am seeing one of the children displayed in the “parent category name” field instead of the expected blank.

I’ve checked the database and everything appears to be stored correctly.

I figure this is related to the calculation of the non-db vardef, however I am a bit stumped on how to debug it.

I have also tested this on a fresh 7.3.1 MAX installation with no other changes made and can reproduce the same results so I am thinking it might be a product defect.

I am happy to get my hands dirty and try to debug/fix it but I am fairly new to SuiteCRM development and as I said - I’m stumped. Any pointers on where to look to fix this?

Thanks,

Matt.

I have the same issue, I also notice the data is correct but the display is totally wrong, I make the temporary fix of does not show the parent category name, and that works for the moment, I am in the wait for a most efficient solution.

So I finally managed to get some time to work on this and believe I have figured out what is wrong.

It appears that the non-db definition of the parent category name is using the wrong link. It is set to use the subcategory link instead of the parent link.

In the file “modules\AOS_Product_Categories\vardefs.php” you can find the definition for the parent_category_name, which looks like:

"parent_category_name" => array (
	'name' => 'parent_category_name',
	'type' => 'relate',
	'source' => 'non-db',
	'vname' => 'LBL_PRODUCT_CATEGORYS_NAME',
	'save' => true,
	'id_name' => 'parent_category_id',
	'link' => 'sub_product_categories',
	'table' => 'aos_product_categories',
	'module' => 'AOS_Product_Categories',
	'rname' => 'name',
),

What I did is change the link to be ‘parent_category’ so that it now looks like this:

"parent_category_name" => array (
	'name' => 'parent_category_name',
	'type' => 'relate',
	'source' => 'non-db',
	'vname' => 'LBL_PRODUCT_CATEGORYS_NAME',
	'save' => true,
	'id_name' => 'parent_category_id',
	'link' => 'parent_category',
	'table' => 'aos_product_categories',
	'module' => 'AOS_Product_Categories',
	'rname' => 'name',
),

This seems to have sorted it out for me. Let me know how it goes for you.

Cheers,

Matt

1 Like

I had the same problem.
Thanks, now works well :wink: . Does anyone know if this error was reported and will be fixed in the next version?
Thank you