Author Topic: custom field on category  (Read 468 times)

welrachid

  • Jr. Member
  • **
  • Posts: 260
  • 3rd party plugin developer
  • Skype Name: wel.rachid
  • VirtueMart Version: Always LATEST stable
custom field on category
« on: October 29, 2018, 12:47:54 pm »
Hi guys.
using the newest VM 3.4.2 is it possible to somehow get a custom text for each category that is NOT the description?

I looking for a way to put in custom html or text into these boxes:
https://prnt.sc/lbrkzu

This is a front-page category display, where for most categories im going to list of all subproducts in a <ul><li> form. But there might be some categories where i wish to maybe describe or show something custom for that category.


Thanks.
Best regards,
Wel

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3907
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: custom field on category
« Reply #1 on: October 29, 2018, 22:06:58 pm »
You can use a Joomla KEY using the ID of the category for eg.
Eg.
Code: [Select]
vmText::_('VM_CATEGORY_CUSTOM_'.$catId);Of course you need to check if the key exist and set a Joomla KEY per category id. But if you only need it for 5 or 6 categories or view, it's a simple and fast way to do it(and do not use server resource with a plugin).

welrachid

  • Jr. Member
  • **
  • Posts: 260
  • 3rd party plugin developer
  • Skype Name: wel.rachid
  • VirtueMart Version: Always LATEST stable
Re: custom field on category
« Reply #2 on: October 30, 2018, 11:36:53 am »
Arh. nice hack. You are ofcourse talking about Joomla language overrides, correct? :)
Best regards,
Wel

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3907
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: custom field on category
« Reply #3 on: October 30, 2018, 18:25:17 pm »
Yes, you have function to verify if a key exist JLanguage::hasKey

welrachid

  • Jr. Member
  • **
  • Posts: 260
  • 3rd party plugin developer
  • Skype Name: wel.rachid
  • VirtueMart Version: Always LATEST stable
Re: custom field on category
« Reply #4 on: October 30, 2018, 22:10:32 pm »
Sweet. Thanks!
Best regards,
Wel