- Posts: 128
- Thank you received: 3
Product description based on custom field values
11 years 1 month ago #211605
by deuce4884
Product description based on custom field values was created by deuce4884
-- 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:
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.
-- 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:
Code:
{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.
11 years 1 month ago #211607
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Product description based on custom field values
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,
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.
The following user(s) said Thank You: deuce4884
Please Log in or Create an account to join the conversation.
11 years 1 month ago #211665
by deuce4884
Replied by deuce4884 on topic Product description based on custom field values
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.146 seconds