Author Topic: How Do I Display Custom Labels On Front End?  (Read 408 times)

trevorellis

  • Beginner
  • *
  • Posts: 35
  • A beginner
  • VirtueMart Version: VirtueMart 3.2.14
How Do I Display Custom Labels On Front End?
« on: October 30, 2020, 15:10:05 pm »
Hello, we want to be able to display the custom field multi-variant custom labels on the front end of the site above the dropdowns. For instance on this product - https://magicflame.co.uk/menu/pizzas/margherita-detail, we want to it to display the custom label "Size" above the dropdown with the options "10inch", "12inch" and "14inch".

How do we achieve this alteration? Is there an option in the Virtuemart configuration? Or do we have to amend code? If so, can we do this with an override so that it's not replaced when we update Virtuemart?

I tried following this guide - http://forum.virtuemart.net/index.php?topic=123032.0 but the information appears to be out of date as I cannot find the line anywhere in the file, never mind line 965.

Any assistance would be greatly appreciated. Thanks in advance.

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 901
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: How Do I Display Custom Labels On Front End?
« Reply #1 on: October 30, 2020, 16:24:26 pm »
I think only setup Show title in customfiled setup (attachment)
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

trevorellis

  • Beginner
  • *
  • Posts: 35
  • A beginner
  • VirtueMart Version: VirtueMart 3.2.14
Re: How Do I Display Custom Labels On Front End?
« Reply #2 on: November 01, 2020, 14:59:07 pm »
Thanks for your help. However, that was not exactly what I wanted. I looked in the Custom Field settings and scrolled down and found setting "Show labels" to "Yes" was what I needed. Thanks anyway. It's working now.

anilreddy

  • Beginner
  • *
  • Posts: 1
  • A beginner
Re: How Do I Display Custom Labels On Front End?
« Reply #3 on: November 11, 2020, 12:15:14 pm »
1

I figured out how to add a class so they output in columns. Just in case anyone wants to know. I'm still open to input as to how to do this better, but for now this works.

<?php
// Display custom field value
echo '<div class="left">' . '<strong>Manufacturer: </strong>' . get_post_meta( get_the_ID(), '_text_field_1', true ) . '<br>' .
'<strong>Brand: </strong>' . get_post_meta( get_the_ID(), '_text_field', true ) . '<br>' .
'<strong>Retail Price: </strong>' . get_post_meta( get_the_ID(), '_number_field_1', true ) . '<br>' .
'<strong>Arnolds Price: </strong>' . get_post_meta( get_the_ID(), '_number_field', true ) . '</div>';

echo '<div class="right">' . '<strong>Features: </strong>' . get_post_meta( get_the_ID(), '_textarea_1', true ) . '<br>' .
'<strong>Additional Information: </strong>' . get_post_meta( get_the_ID(), '_textarea', true ) . '</div>';
?>