News:

Support the VirtueMart project and become a member

Main Menu

Custom fields in Short Description

Started by divined, May 29, 2017, 11:58:27 AM

Previous topic - Next topic

divined

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?

aftertaf

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

divined

I'm using the vmbeez3 template. That means I need to create the placeholders in templates/vmbeez3/css/template.css?

aftertaf

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
...

divined

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?

K&K media production

QuoteAm I supposed to create it myself?

yes

divined

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?

jenkinhill

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.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum