Author Topic: Custom Fields not showing in Category View  (Read 205 times)

sscheidegger

  • Jr. Member
  • **
  • Posts: 97
Custom Fields not showing in Category View
« on: November 24, 2022, 16:28:38 pm »
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

  • Jr. Member
  • **
  • Posts: 261
    • Biżuteria etniczna orientalna arabska
  • VirtueMart Version: VM 4.0.8 / J3 /J4
Re: Custom Fields not showing in Category View
« Reply #1 on: November 24, 2022, 20:46:24 pm »
Just check the "search" option in the custom field that appears in the product list

sscheidegger

  • Jr. Member
  • **
  • Posts: 97
Re: Custom Fields not showing in Category View
« Reply #2 on: November 25, 2022, 09:03:18 am »
Quote
Just 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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3923
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Custom Fields not showing in Category View
« Reply #3 on: November 25, 2022, 13:09:14 pm »
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

  • Jr. Member
  • **
  • Posts: 97
Re: Custom Fields not showing in Category View
« Reply #4 on: November 25, 2022, 13:38:09 pm »
Quote
Could 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

  • Jr. Member
  • **
  • Posts: 97
Re: Custom Fields not showing in Category View
« Reply #5 on: November 25, 2022, 15:07:15 pm »
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:
Code: [Select]
1363        $child->customfields = $customfieldsModel->getCustomEmbeddedProductCustomFields ($child->allIds,0,$this->cartattribute, FALSE);Revision 10715:
Code: [Select]
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

  • Jr. Member
  • **
  • Posts: 261
    • Biżuteria etniczna orientalna arabska
  • VirtueMart Version: VM 4.0.8 / J3 /J4
Re: Custom Fields not showing in Category View
« Reply #6 on: November 25, 2022, 15:17:17 pm »
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

  • Jr. Member
  • **
  • Posts: 97
Re: Custom Fields not showing in Category View
« Reply #7 on: November 25, 2022, 16:21:56 pm »
Quote
Do 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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10495
  • VM4.0.7 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Custom Fields not showing in Category View
« Reply #8 on: December 02, 2022, 20:56:58 pm »
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/