News:

Looking for documentation? Take a look on our wiki

Main Menu

Custom Fields not showing in Category View

Started by sscheidegger, November 24, 2022, 16:28:38 PM

Previous topic - Next topic

sscheidegger

Hi all,

I just updated to Virtuemart 4.0.8, using Joomla 3.10.11.

After the update, in FE all custom fields in category view are missing. In product details view, the custom fields are displayed correctly.

I am cheking the template overrides at the moment. It seems $this->products[ i ]->customfieldsSorted does not exist anymore. Is this a bug or did the sturcture change? If so, how can custom fields be accessed in the latest version?

Thanks a lot, best regards,
Stefan

hazael

Just check the "search" option in the custom field that appears in the product list

sscheidegger

QuoteJust check the "search" option in the custom field that appears in the product list

I am not sure I understand. Are you talking about the backend?
I can see all custom fields in BE and I can see and edit custom fields for my products. My problem is the frontend. Custom fields only show in productdetails view, but not in category view!

Jörgen

Could be related to your template. Checked with default template ?

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

sscheidegger

QuoteCould be related to your template. Checked with default template ?

The default template does not seem to render any custom fields in category view. So I cannot compare to the default template.

It worked fine until Virtuemart 4.0.6. The question is, if this feature is not supported anymore, if it is still supported but in a different way or if it is a bug...

sscheidegger

#5
Ok, so I checked the changes since version 4.0.6 and found that the following line of code is causing the problem:

trunk/virtuemart/administrator/components/com_virtuemart/models/product.php
Revision 10716:
1363        $child->customfields = $customfieldsModel->getCustomEmbeddedProductCustomFields ($child->allIds,0,$this->cartattribute, FALSE);
Revision 10715:
1344        $child->customfields = $customfieldsModel->getCustomEmbeddedProductCustomFields ($child->allIds,0,-1, FALSE);


It seems in category view, all cartatributes are 1 and the customfields are not getting populated. If I change the function argument back to -1, all custom fields are displayed again.

As I understand, I should configure all my custom fields to be cart attributes in order to display also in the lastest version in category view. However, I don't want those attributes to show in cart.

@Max Milbers: How should I configure my custom fields to display in category view, in productsdetails view, but not in cart?

Best regards,
Stefan

hazael

#6
Do as I wrote - in custom fields settings: searchable - nothing more.
It works with the last version of VM and Joomla 3 and 4

sscheidegger

QuoteDo as I wrote - in custom fields settings: searchable - nothing more.
It works with the last version of VM and Joomla 3 and 4

Now I got what you mean. Just tested it, working like a charm! Thank you so much!

Milbo

Haha, that is also a way to solve this and makes a lot sense. The old ways to load anything, related categories, related products and whatever people use. But we did not display any of that.

It is also clear, that it makes sense to load only, what we want to show in the browse view. Typically the customfields, which are cart related. Another method to solve this is to use an option, I dont know if it is currently hidden or not.

But your solution is better, because if this attributes are important to select the right product, then it should be shown in the browse view. Furthermore it works as tag now. Your customers can search for this attributes, directly.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/