News:

Support the VirtueMart project and become a member

Main Menu

Custom field on category page

Started by roman5527, April 21, 2021, 15:08:09 PM

Previous topic - Next topic

roman5527

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

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

QuoteHi, 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 for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

roman5527

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

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 for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

roman5527

Ok  . please can you please show me some sample code? How to do it ?

thanks

Studio 42

But perhaps a better solution is to use another positionand not addtocart ?
Why you have field to show in category in the cart position ?