VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: divined on May 29, 2017, 11:58:27 AM

Title: Custom fields in Short Description
Post by: divined on May 29, 2017, 11:58:27 AM
Hello everybody

I need to add some custom fields to the short description part of my page. The fields must be checkboxes denoting various read-only attributes of the product.  I see that I can add Boolean custom fields to a product but these are only displayed as text. Is this supported under stock virtuemarkt or do I need an extension/modification of code?
Title: Re: Custom fields in Short Description
Post by: aftertaf on May 29, 2017, 12:12:28 PM
you can create your own placement for custom fields.
You'll need to override the layout in your template and create the placeholders there.
search in the docs for custom fields and template overrides, its possible without extensions or modifying core files, but will require some php for the override.
or : http://forum.virtuemart.net/index.php?topic=99225.0
Title: Re: Custom fields in Short Description
Post by: divined on June 02, 2017, 14:18:04 PM
I'm using the vmbeez3 template. That means I need to create the placeholders in templates/vmbeez3/css/template.css?
Title: Re: Custom fields in Short Description
Post by: aftertaf on June 02, 2017, 15:16:09 PM
i believe so.. i've sorta taught myself, and found good bits of help on this site. look in some of the pinned posts in Templating section.
I think any page can have a template 'override'...
https://docs.virtuemart.net/tutorials/33-templating-layouts/78-introduction-template-system.html
https://forum.virtuemart.net/index.php?topic=132441.0
example for category layout: copy
components/com_virtuemart/views/category/tmpl/default.php
to
your_template/html/com_virtuemart/category/default.php


you can also over-ride the sublayouts in /YOUR_TEMPLATE/html/com_virtuemart/sublayouts
...
Title: Re: Custom fields in Short Description
Post by: divined on June 03, 2017, 20:29:08 PM
I think I need to override the /templates/vmbeez3/html/com_virtuemart/category/default.php and write php code that will display them custom fields in the short field description section.

Unfortunately, no com_virtuemarkt subdirectory exists in the /templates/vmbeez3/html directory. Am I supposed to create it myself?
Title: Re: Custom fields in Short Description
Post by: K&K media production on June 03, 2017, 23:04:36 PM
QuoteAm I supposed to create it myself?

yes
Title: Re: Custom fields in Short Description
Post by: divined on June 07, 2017, 06:32:15 AM
I created an empty default.php and the category view now returns a blank page. Do I need to copy the whole contents of the initial com_virtuemart template php file into this and then edit it as I require?
Title: Re: Custom fields in Short Description
Post by: jenkinhill on June 07, 2017, 12:12:19 PM
Quote from: aftertaf on June 02, 2017, 15:16:09 PM
copy
components/com_virtuemart/views/category/tmpl/default.php
to
your_template/html/com_virtuemart/category/default.php

And then edit the file as necessary, assuming that the category view is the one you wish to edit.  The actual short description code is to be found in a sublayout, though, which is called from default.php.  This is components/com_virtuemart/sublayouts/products.php  and this file should be copied to  /templates/vmbeez3/html/com_virtuemart/sublayouts/ before editing.