Author Topic: Additional Custom Fields for Category views  (Read 321 times)

derek webster

  • Jr. Member
  • **
  • Posts: 71
Additional Custom Fields for Category views
« on: June 19, 2019, 11:58:50 am »
Hi I can't seem to find any information on this elsewhere on the forum - I'm on Joomla 3.9 and VM 3.4.2.
I'd like the ability to add extra information into the Category View - for example, Additional Meta Information, secondary description, associated downloads and various on/off checkboxes sop that I can control front end display logic within a category.

I've done this extensively with old sites using VM1.5 but I hardcoded into the browse code and category queries.

I now want to do a similar thing with VM3 but in a way that is future proof and updatable.

What would be the best way to do this? Is it feasible to have a custom plugin written that may give me this functionality?

Ive achieved a workaround by using a component builder that references the Categories by ID (then I just run a query to pull in the cat info to my category) but this requires me to use a separate component for any "additional fields" I want to use for a category.

Even if There was a way of bringing this components functionality "into" the category editing page that would be a massive step forward.

Any advice would be welcomed





Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3907
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Additional Custom Fields for Category views
« Reply #1 on: June 19, 2019, 12:43:46 pm »
Hi,
a solution is to do an override in the back-end template to add additional fields.
You have to create a plugin to fill a DB table on save.
Note that because you need an ID, the field display can only be rendered after saving 1 time the category
In the front, you can then do an override to get this informations to, using another override.
For front you can create a static function call for eg. $catInfo = mycategoryplugin::information($id); to get the informations from the plugin
Quick and not too dirty

derek webster

  • Jr. Member
  • **
  • Posts: 71
Re: Additional Custom Fields for Category views
« Reply #2 on: June 24, 2019, 11:48:26 am »
Sorry For the late reply - This is extremely helpful. I'm familiar with doing template overrides for admin pages but not creating the plugin to fill in a DB on save.
I'll look for someone to help me on this - unless its something you'd consider working on? paid of course!

Actually I'll post this in the Commercial Jobs section - if you don't mind

Many thanks

derek webster

  • Jr. Member
  • **
  • Posts: 71
Re: Additional Custom Fields for Category views
« Reply #3 on: June 24, 2019, 11:52:36 am »
Actually a similar plugin for the Product Pages would also be required. Im finding the Custom fields VERY cumbersome to manage - especially groups - if we add a new field to a group it does not update in the product.

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 2235
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Additional Custom Fields for Category views
« Reply #4 on: June 24, 2019, 11:56:43 am »
I gave up using groups, since this is only valid when You import the group for the first time. Using a template product (hidden parent) You can get what You want. All the custom fields from the parent are inherited and changing the parent will update ALL the children. This is when You get used to it quite useful. Overriding and hiding on a product basis is possible if You want that too.

Jörgen @ Kreativ Fotografi
Joomla 3.9.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10338
  • VirtueMart Version: 3+
Re: Additional Custom Fields for Category views
« Reply #5 on: June 25, 2019, 22:16:44 pm »
You should download some free product plugins, and see how they work.

I have plugins for my site with 6 fields. You can make more or less unlimited fields (parameters) within a single instance of a customfield.

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)