Author Topic: Custom field on category page  (Read 328 times)

roman5527

  • Jr. Member
  • **
  • Posts: 209
Custom field on category page
« on: April 21, 2021, 15:08:09 pm »
Hi, i need show custom field from position addtocart on category page but only one from all on position addtocart.

Is it possible show custom field based example ID ?? or other identification ?

Can you help me with code ??

Many Thanks

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4448
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Custom field on category page
« Reply #1 on: April 21, 2021, 22:33:19 pm »
Virtuemart have no context option, so you need to code yourself a solution.
You can check for eg, if you are in category or not and check the customfield_id of the custom fields.

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1129
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Custom field on category page
« Reply #2 on: April 22, 2021, 09:21:49 am »
Quote
Hi, i need show custom field from position addtocart on category page but only one from all on position addtocart.

I don't understand, can you write more information?.
- one customfield (add to cart) in category page for all products in one place (it is sound like catproduct plugin) or one for every product on category page (== 6 products == 6 customfields add to cart) ?

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

roman5527

  • Jr. Member
  • **
  • Posts: 209
Re: Custom field on category page
« Reply #3 on: April 22, 2021, 13:43:42 pm »
I have two custom fields for products in the addtocart position.
I show both in the product detail.
But I only want to see one of them on the categories page.
It cannot be solved by assigning one of them to another position because these are the inputs of the basket so it must be in the addtocart position.

Therefore, my question is whether it is possible to display a custom field from the addtocart position based on an ID or other identifier.

well thank you

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1129
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Custom field on category page
« Reply #4 on: April 22, 2021, 16:59:49 pm »
Yes,

in PHP you can use IF/ELSE custom code
and then show this customfield in category view
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

roman5527

  • Jr. Member
  • **
  • Posts: 209
Re: Custom field on category page
« Reply #5 on: April 23, 2021, 13:46:35 pm »
Ok  . please can you please show me some sample code? How to do it ?

thanks

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4448
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Custom field on category page
« Reply #6 on: April 24, 2021, 11:44:03 am »
But perhaps a better solution is to use another positionand not addtocart ?
Why you have field to show in category in the cart position ?