Skip to main content

Echo custom fields

More
14 years 6 months ago #43239 by spithoven
Echo custom fields was created by spithoven
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.

More
14 years 6 months ago #43361 by nicolas
Replied by nicolas on topic Re: Echo custom fields
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.

More
14 years 6 months ago #43379 by spithoven
Replied by spithoven on topic Re: Echo custom fields
Nicolas, thanks for your reply!

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

More
14 years 6 months ago #43383 by spithoven
Replied by spithoven on topic Re: Echo custom fields
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.

More
14 years 6 months ago #43507 by nicolas
Replied by nicolas on topic Re: Echo custom fields
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.165 seconds
Powered by Kunena Forum