Echo custom fields

  • Posts: 7
  • Thank you received: 0
12 years 10 months ago #43239

Guys,

I want to show my customers the result of a simple calculation. I want to show them what they can save a year when they use LED lighting in staid of normal light bulbs.
For this simple calculation I need to get the wattage from the lamp, this witch is stored in 'hikashop_product_custom_name_23'.

Now for the problem. How can I get the value of 'hikashop_product_custom_name_23' in lets say 'view.html.php'.

Thanks!

A Product from my site

Please Log in or Create an account to join the conversation.

  • Posts: 83103
  • Thank you received: 13417
  • MODERATOR
12 years 10 months ago #43361

You should edit the file "show_default" via the menu Display->Views and add your code there.
Getting the field value is easy in that file.
Just do like that:
<?php
echo $this->element->hikashop_product_custom_name_23;
?>

The following user(s) said Thank You: spithoven

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 0
12 years 10 months ago #43379

Nicolas, thanks for your reply!

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 0
12 years 10 months ago #43383

When I edit the 'show_default' it does not echo anything. When I edit the 'show', it only shows my txt echo, not the custom name var.

<?php
echo "My Test Echo";
echo $this->element->hikashop_product_custom_name_23;
?>

Please Log in or Create an account to join the conversation.

  • Posts: 83103
  • Thank you received: 13417
  • MODERATOR
12 years 10 months ago #43507

If you have characteristics attached to your product, you should do like that:

echo $this->element->main->hikashop_product_custom_name_23;

Also make sure that the column name of your custom field is hikashop_product_custom_name_23

Please Log in or Create an account to join the conversation.

Time to create page: 0.057 seconds
Powered by Kunena Forum