Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Extra Fields with Simple Template System


GeordiSi

Recommended Posts

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...