Product description based on custom field values

  • Posts: 128
  • Thank you received: 3
10 years 1 month ago #211605

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.3.24

I'm trying to switch parts of a product's description based on values of that product's custom fields. I have the Nonumber Sourcerer extension to help place php in the product description. I have been able to get Sourcerer to do simple echo's and some other stuff. I can't get it to retrieve the custom field's value though. I'm still learning php and very new to Hikashop, so I'm sure it's my php code. The code I currently have is:

{source}
[[?php
$fieldClass = hikashop_get('class.field');
$fieldClass = $fieldClass->getField('headstamp','product');
echo $fieldClass->field_value[value];
?]]
{/source}

Right now I was just trying to get the output of the actual value, but I can't get that. I'm not sure if I have the right class or function. Eventually I want it to output a different description based on the value of the headstamp custom field. Any help would greatly be appreciated.

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 4 weeks ago #211607

Hi,

If you want to use some PHP and check the product fields ; the best will be to put that PHP directly in the HikaShop view.
You do not need to load the field class to access to the product fields data ; they are all already in the product object (available in the HikaShop product views).

www.hikashop.com/support/support/documen...-display.html#layout

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: deuce4884

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

  • Posts: 128
  • Thank you received: 3
10 years 4 weeks ago #211665

Thanks. After looking at the views I see where I can add in what I need dependent on my custom fields.

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

Time to create page: 0.054 seconds
Powered by Kunena Forum