GeordiSi Posted August 29, 2006 Share Posted August 29, 2006 Hi. I seem to straddle two contributions so I thought I'd send a new post. I want to include the Product Extra Fields in the Simple Template system. I used some code from another posting and modified it. I added it to my product_info.php STS include. $fieldnum = 1; $extra_fields_query = tep_db_query("SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef LEFT JOIN ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf ON ptf.products_extra_fields_id=pef.products_extra_fields_id WHERE ptf.products_id=".$HTTP_GET_VARS['products_id']." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."') and (products_extra_fields_order=$fieldnum)"); $counter = tep_db_num_rows($extra_fields_query); if($counter > 0){ while($extra_fields = tep_db_fetch_array($extra_fields_query)) { if(!$extra_fields['status']) // show only enabled extra field continue; $template_pinfo['product_extra_field_name'.$fieldnum] = $extra_fields['name']; $template_pinfo['product_extra_field_value'.$fieldnum] = $extra_fields['value']; } } else { $template_pinfo['product_extra_field_name'.$fieldnum] = ''; $template_pinfo['product_extra_field_value'.$fieldnum] = ''; } I'm too new to PHP to streamline the code and all attempts to set up loop to create variables for all the new fields have proven unsuccessful. Any help would be greatly appreciated. Many thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.