Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Extra Fields


KiLLaH

Recommended Posts

The problem is I'm using "fancy product info" and didn't know where to put the code for the extra fields. Here's a snip of the problem area in my product_info.php file:

<!--//Start Fancy Product Info//-->

 

<?php

} else {

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

 

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

 

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

 

$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s><br> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

 

} else {

$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

}

 

if (tep_not_null($product_info['products_model'])) {

$products_name = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td class="pageHeading" align="left" width="60%">' . $product_info['products_name'] . '</td><td align="center" class="main">Model: ' . $product_info['products_model'] . '</td></tr></table>';

} else {

$products_name = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td class="pageHeading" align="left">' . $product_info['products_name'] . '</td></tr></table>';

}

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<td>

<table class="productinfoBox1" width="100%" align="center" cellspacing="0" cellpadding="2" border="2" bordercolor="#000000" style="border-collapse: collapse; " bordercolorlight="#AABBDD" bordercolordark="#000080">

<tr>

<td>

<table width="100%" cellspacing="0" cellpadding="0" border="0">

<tr>

<td><?php echo $products_name; ?></td>

<?php

// START: Extra Fields Contribution v2.0i with fix

list($products_id_clean) = split('{', $product_info['products_id']);

$extra_fields_query = tep_db_query("

SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value ,pef.products_extra_fields_status as status

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=".$products_id_clean." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."')

ORDER BY products_extra_fields_order");

 

while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {

if (! $extra_fields['status']) // show only enabled extra field

continue;

echo '<tr>

<td>

<table border="0" width="50%" cellspacing="0" cellpadding="2px"><tr>

<td class="main" align="left" vallign="middle"><b><font size="1" color="#666666">'.$extra_fields['name'].': </b></font>';

echo '<font size="1" color="#666666">' .$extra_fields['value'].'<BR></font> </tr>

</table>

</td>

</tr>';

}

// END: Extra Fields Contribution

?>

</tr>

</table>

<p> 

<table width="100%" cellspacing="0" cellpadding="2" border="0" style="border-collapse: collapse" bordercolor="#111111">

<tr>

<td class="main" width="60%" align="center">

<table cellspacing="0" cellpadding="2" border="0" style="border-collapse: collapse" bordercolor="#111111">

<tr>

<td align="center" class="smallText">

<script language="javascript"><!--

document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

//--></script>

<noscript>

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>

</noscript>

<?php

if (tep_not_null($product_info['products_image'])) {

?>

</td>

</tr>

</table>

 

 

<p> 

<td class="Price" align="center" valign="middle"><p><?php echo $products_price; ?><p>

<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?><p>

<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?>

<?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table>

</td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

</table>

<?php

}

?>

<!--//End Fancy Product Info//-->

 

<p><?php echo stripslashes($product_info['products_description']); ?></p>

<tr>

<td>

<?php

$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");

$products_attributes = tep_db_fetch_array($products_attributes_query);

if ($products_attributes['total'] > 0) {

Link to comment
Share on other sites

  • Replies 225
  • Created
  • Last Reply

Top Posters In This Topic

any idea how to add the product extra field to product listing?

Also tried to add it to easypopulate but keep getting errors. any help with this would be great.

 

Kunal :thumbsup:

 

I would also like to know that :-)

 

Thanks,

Kjolebutikken

Best regards

Kjolebutikken

Link to comment
Share on other sites

Is there a way to make the product extra field in admin (on the product page where you add/edit a specific product) as big as the product description field? I want to iuse one of the extra fields as a second description field. This because I now have both a description text and a slideshow for each product in the description field, but it gives me complications on some of my pages (f.ex. compare products side by side page), so I want to split it up in two description fields, one for the text and one for the slideshow.

 

Can anyone help?

 

Or is it easyer just to add a second description field otherwise?

 

Thanks,

Best regards

Kjolebutikken

Link to comment
Share on other sites

Is there a way to make the product extra field in admin (on the product page where you add/edit a specific product) as big as the product description field? I want to iuse one of the extra fields as a second description field. This because I now have both a description text and a slideshow for each product in the description field, but it gives me complications on some of my pages (f.ex. compare products side by side page), so I want to split it up in two description fields, one for the text and one for the slideshow.

 

Can anyone help?

 

Or is it easyer just to add a second description field otherwise?

 

Thanks,

 

I managed to make it work. In admin/categories.php I changed:

 

<tr bgcolor="#ebebff">
		<td class="main"><?php echo $extra_fields['products_extra_fields_name']; ?>:</td>
		<td class="main"><?php echo $m . ' ' . tep_draw_input_field("extra_field[".$extra_fields['products_extra_fields_id']."]", $pInfo->extra_field[$extra_fields['products_extra_fields_id']]); ?></td>
	  </tr>

 

to:

 

<tr bgcolor="#ebebff">
		<td class="main"><?php echo $extra_fields['products_extra_fields_name']; ?>:</td>
		<td class="main"><?php echo $m . ' ' . tep_draw_textarea_field("extra_field[".$extra_fields['products_extra_fields_id'].']', 'soft', '70', '15', $pInfo->extra_field[$extra_fields['products_extra_fields_id']]); ?></td>
	  </tr>

 

 

Afterwards, in databasetable, table products_to_products_extra_fields, change the value of products_extra_fields from varchar(64) to text. Then you'll be able to put in as much text as you want. This tip of changing the value in db I got from atsekabe in this forum. Thanks pal :-))))

Best regards

Kjolebutikken

Link to comment
Share on other sites

  • 2 weeks later...

Greets,

 

Can someone tell me how to get Product Extra Fields to show up under a Master Product? I've installed Product Extra Fields on a clean OsC and everything worked fine. But when I install it on my Master Products enabled site nothing shows up on the admin or front side while under a Master Product. (shows up fine on the admin side on the slaves).

 

Any help would be greatly appreciated.

 

Cheers

Shane

Link to comment
Share on other sites

Hi,

 

I've been trying for a few weeks now to get the products extra fields to show in my pdf datasheets for the products. I think my main problem is to implement the product extra fields query into the print_catalog query for the pdf output. I have tried but I only get an parse error. This is what I have this far:

 

$print_catalog_query = tep_db_query("select p.products_id, pd.products_name, cd.categories_name, p.". PDF_ALT_IMAGE .", p.products_model, pd.products_description, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.products_status, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price,  s.expires_date, m.manufacturers_name from ". TABLE_PRODUCTS . " p left join " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_id = '" . $products_id . "' and
					p.products_id = pd.products_id
					and pd.language_id = '" . $languages_id  . "'

$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=". (int)$HTTP_GET_VARS['products_id'] ." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."')
ORDER BY products_extra_fields_order");

while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
if (! $extra_fields['status']) // show only enabled extra field
continue;
}

 

Can anyone help me with this?

 

Thanks:-)

Best regards

Kjolebutikken

Link to comment
Share on other sites

Hi I can?t get my tags right.

I?m trying to insert the code for the extra fields in my product_info.php.

 

I can get it to display but I want the extra fields to be displayed like this:

 

Product Name------------------------------Product Price

Extra fields---------------------------------Product Image

Product Description---------------------------------------

 

I can?t get the extra fields to display left of my product picture.

Can anybody help me with the code. I have tried to make new <td>?s but I can?t seem to get it right.

 

My clean product info looks like this:

 

<?php
/*
 $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<?php
// HTC BEGIN
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
 require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?> 
 <title><?php echo TITLE; ?></title>
<?php
}
// HTC END
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
 if ($product_check['total'] < 1) {
?>
  <tr>
	<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php
 } else {
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
  $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}

if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
} else {
  $products_name = $product_info['products_name'];
}
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top"><h1><?php echo $products_name; ?></h1></td>
		<td align="right" valign="top"><h1><?php echo $products_price; ?></h1></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main">
<?php
if (tep_not_null($product_info['products_image'])) {
?>
	  <table border="0" cellspacing="0" cellpadding="2" align="right">
		<tr>
		  <td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
		  </td>
		</tr>
	  </table>
<?php
}
?>
	  <p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
$products_attributes = tep_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] > 0) {
?>
	  <table border="0" cellspacing="0" cellpadding="2">
		<tr>
		  <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
		</tr>
<?php
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
	$products_options_array = array();
	$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
	while ($products_options = tep_db_fetch_array($products_options_query)) {
	  $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
	  if ($products_options['options_values_price'] != '0') {
		$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
	  }
	}

	if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
	  $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
	} else {
	  $selected_attribute = false;
	}
?>
		<tr>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
		</tr>
<?php
  }
?>
	  </table>
<?php
}
?>
	</td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
$reviews = tep_db_fetch_array($reviews_query);
if ($reviews['count'] > 0) {
?>
  <tr>
	<td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}

if (tep_not_null($product_info['products_url'])) {
?>
  <tr>
	<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}

if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
  <tr>
	<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
  </tr>
<?php
} else {
?>
  <tr>
	<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
  </tr>
<?php
}
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
			<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td>
<?php
if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
} else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
 }
?>
	</td>
  </tr>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

And the part I?m trying to insert is:

 

<?php
	  // START: Extra Fields Contribution v2.0b - mintpeel display fix

				  $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=". (int) $products_id ." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."')
		ORDER BY products_extra_fields_order");

 while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
	if (! $extra_fields['status'])  // show only enabled extra field
	   continue;
	echo '<tr>
  <td>
  <table border="0" width="50%" cellspacing="0" cellpadding="2px"><tr>
  <td class="main" align="left" vallign="middle"><b><font size="1" color="#666666">'.$extra_fields['name'].': </b></font>';
	echo '<font size="1" color="#666666">' .$extra_fields['value'].'<BR></font> </tr>
  </table>
  </td>
  </tr>'; 
 }
   // END: Extra Fields Contribution - mintpeel display fix
?>

 

Hope anybody can help me with this. This shouldn?t be very hard but I can?t get it to display the way I want it. Oh, I have been trying to find a solution in this tread but still can?t get it to work.

Thanks in advance

/Per

Link to comment
Share on other sites

  • 3 weeks later...

QUOTE(dragon5 @ Dec 14 2005, 05:48 PM) *

 

First, EXCELLENT CONTRIBUTION! Thank You! I have one minor issue. OSC automatically adds the backslash character for any word with an apostrophe, yet the backslash is showing up in my products_extra fields on the product_info pg. ex. what\'s instead of what's Any help would be appreciated.

Thanks

Tom

 

posted the above back in Dec 05 and never received a reply. Anybody have any ideas? Very annoying as some of my 'extra_fields' have long descriptions in them and I am always running into this problem.

Thanks

 

I'm still having this problem. Is anyone else?

Link to comment
Share on other sites

  • 2 weeks later...

Hi, this is a great contrubution. Thanks for all coders working on it. I have a simple question.

Extra fields look like in like this in product detail page;

 

 

Extra Field1: Example

Extra: Example

Extrassss Field1: Example

 

Matrox G200 MMS

[MG200MMS] $299.99

 

Reinforcing its position as a multi-monitor trailblazer, Matrox Graphics Inc. has once again developed the most flexible and highly advanced solution in the industry. Introducing the new Matrox G200 Multi-Monitor Series; the first graphics card ever to support up to four DVI digital flat panel displays on a single 8" PCI board. Bla bla bla"

 

How can i change the looking of extra fields like this?

 

 

Matrox G200 MMS

[MG200MMS] $299.99

 

Reinforcing its position as a multi-monitor trailblazer, Matrox Graphics Inc. has once again developed the most flexible and highly advanced solution in the industry. Introducing the new Matrox G200 Multi-Monitor Series; the first graphics card ever to support up to four DVI digital flat panel displays on a single 8" PCI board. Bla bla bla

 

Extra Field1 : Example

Extra : Example

Extrassss Field1 : Example

 

I want to extra fields at the buttom of the details page all is this and

Link to comment
Share on other sites

  • 2 weeks later...

Is it possible to split the extra fields into 2 columns instead of one long list on the product info page ?

 

i think it's in here somewhere ?

 

// START: Extra Fields Contribution v2.0b - mintpeel display fix

		$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=". (int) $products_id ." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."')
		ORDER BY products_extra_fields_order");

	while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
	if (! $extra_fields['status'])  // show only enabled extra field
	continue;
	echo '<tr>
  <tr>
  <td class="main" align="left" vallign="middle"><b><font size="1" color="#FF9900">'.$extra_fields['name'].': </b></font>';
	echo '<b><font size="1" color="#000000">' .$extra_fields['value'].'<BR></b></font> </tr>
  </td>
  </tr>'; 
 }
// END: Extra Fields Contribution - mintpeel display fix

Edited by andytc
Link to comment
Share on other sites

  • 2 weeks later...

Regarding the multilanguage shop i don't understand why when you create a field , you can not give a translation for each language u got in the shop instead of creating a german field for instance and select only for german , and then create another field for englsih and then select only for english !

 

It would be rather logical to have a extra field allowed in all language and translated in all language and shown with the shop language choice for the visitor :blink:

MS2

Link to comment
Share on other sites

  • 2 weeks later...

hi everyone...

 

i am using Product Extra Fields which is a nice feature, but...

i would love to be able to set more options for each field, such as

* short text

* long text

* radio button

* select list

 

and not only shorttext as it is now.

 

do you know is anyone is working on this?

thanks

jacopo

Expresionario.com | Pura Sub-cultura!

Link to comment
Share on other sites

Hi, nice contri :D

 

Good work!

 

Works like a charm!

except for 1 thing, when i create a product i can fill the extra fields, it also shows up in the discription, but when edit the product, the extra field data is lost and i have to retype all the lost data in the extra fields. This will cause me a lot of extra work when i want to correct/update a product

 

Is there a way to fix this? or it just works like this?

 

thnxz in advance.

Link to comment
Share on other sites

hi everyone...

 

i am using Product Extra Fields which is a nice feature, but...

i would love to be able to set more options for each field, such as

* short text

* long text

* radio button

* select list

 

and not only shorttext as it is now.

 

do you know is anyone is working on this?

thanks

jacopo

 

you are using the wrong contibution for what you want to achieve.

 

This is what you need to install:

 

http://www.oscommerce.com/community/contributions,766/

Link to comment
Share on other sites

Hi, nice contri :D

 

Good work!

 

Works like a charm!

except for 1 thing, when i create a product i can fill the extra fields, it also shows up in the discription, but when edit the product, the extra field data is lost and i have to retype all the lost data in the extra fields. This will cause me a lot of extra work when i want to correct/update a product

 

Is there a way to fix this? or it just works like this?

 

thnxz in advance.

 

 

This behavior is not normal: when you edit a product, you should see the extra fields containing the stored values. (however, they are left blank when you DUPLICATE a product, which is I agree a little bit annoying).

 

Double check that you have installed the contribution corectly: there must be something missing in your admin/categories.php.

Link to comment
Share on other sites

  • 2 weeks later...

Hi

 

I am getting this when I go to admin, New Product , preview :

 

// START: Extra Fields Contribution (chapter 1.5) if ($HTTP_GET_VARS['read'] == 'only') { $products_extra_fields_query = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " WHERE products_id=" . (int)$HTTP_GET_VARS['pID']); while ($products_extra_fields = tep_db_fetch_array($products_extra_fields_query)) { $extra_fields_array[$products_extra_fields['products_extra_fields_id']] = $products_extra_fields['products_extra_fields_value']; } } else { $extra_fields_array = $HTTP_POST_VARS['extra_field']; } $extra_fields_names_query = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_EXTRA_FIELDS. " WHERE languages_id='0' or languages_id='".(int)$languages[$i]['id']."' ORDER BY products_extra_fields_order"); while ($extra_fields_names = tep_db_fetch_array($extra_fields_names_query)) { $extra_field_name[$extra_fields_names['products_extra_fields_id']] = $extra_fields_names['products_extra_fields_name']; echo ''.$extra_fields_names['products_extra_fields_name'].': '.stripslashes($extra_fields_array[$extra_fields_names['products_extra_fields_id']]).'
'."\n"; } // END: Extra Fields Contribution echo "
" . $pInfo->products_description; ?>

 

can you post how to sort this out

 

simon

Edited by West One Hosting
Link to comment
Share on other sites

  • 3 weeks later...

Has anyone had any success getting the extra fields to show up as drop-down option on the search page? I'd like to find a way to include them. I'd like for the system to query for each extra field and create a drop-down list of all the unique entries.

 

Anyone have any ideas on that?

 

Thanks,

con4mity

Link to comment
Share on other sites

Let me expand on that. I have added 4 extra fields. One for Author, Publisher, Series, and Artist. I'd like to creat an area that I can go to and get a listing or drop-down of all the unique entries in each field. This way I might be able to select a certain author, and get all the products associated with him? Yet if other search criteria is entered It could filter it down. for example Maybe I search for books added yesterday by this auther?

 

Is this hard to do?

 

Has anyone had any success getting the extra fields to show up as drop-down option on the search page? I'd like to find a way to include them. I'd like for the system to query for each extra field and create a drop-down list of all the unique entries.

 

Anyone have any ideas on that?

 

Thanks,

con4mity

Link to comment
Share on other sites

Let me expand on that. I have added 4 extra fields. One for Author, Publisher, Series, and Artist. I'd like to creat an area that I can go to and get a listing or drop-down of all the unique entries in each field. This way I might be able to select a certain author, and get all the products associated with him? Yet if other search criteria is entered It could filter it down. for example Maybe I search for books added yesterday by this auther?

 

Is this hard to do?

 

You are going the wrong way with products extra fields for what you are trying to achieve. You need to use the products attributes, which is already integrated function of oscommerce

Edited by pixclinic
Link to comment
Share on other sites

I don't think so. Attributes seem more like options the buyers select about a product. I don't have anything like that. It's not as if you go to my product page and can find a book and it has a choice of being done by this author or that author.

 

The extra field is really good for me, take a peak: http://www.ecorey.com Choose any product under the "Comic Book" category.

 

All I'm asking is how might I go about creating a page that would cycle through what extra fields I've created, and then put together drop-downs, like the manufacturer drop-down, for each extra field? This would make a great way for extra fields to be more useful. At least it seems that way for me.

 

How do you use extra fields if not this way? I mean it shows up on the product page so it must be useful to the buyer. I can understand that a search will pull that data but wouldn't you also like to pull your products based on the extra fields? Like (select * products where extra field="this") or something?

 

Also, one other thing. Sometimes my extra field data seems to just disappear. I look at the product and it's there, I look later and its not there anymore. Anyone else have that issue, or hear of it?

 

You are going the wrong way with products extra fields for what you are trying to achieve. You need to use the products attributes, which is already integrated function of oscommerce
Edited by con4mity
Link to comment
Share on other sites

Displaying information in a drop down is against user interface common logic: when people see a drop down, they intend to select something and make a choice. If your goal is to confuse people, then do this :-):

 

in product_info.php look for:

 

   <?php


		$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."')
		ORDER BY products_extra_fields_order");


 while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
	if (! $extra_fields['status'])  // show only enabled extra field
	   continue;
	print '<tr><td id="infottl" width="130"><b>'.$extra_fields['name'].': </b></td>';
	echo '<td> '. $extra_fields['value'].'</td></tr>'; 
 };
 ?>

and replace by:

 

	  

<select>
<?php


		$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."')
		ORDER BY products_extra_fields_order");


 while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
	if (! $extra_fields['status'])  // show only enabled extra field
	   continue;
	echo '<option>'.$extra_fields['name'].': ' .$extra_fields['value'].'</option>'; 

 };
 ?>

</select>

 

 

don't forget the select tags before and after the php section

But I maintain: it's a BAD IDEA: I don't even know why I gave you the code! :blink:

Edited by pixclinic
Link to comment
Share on other sites

Okay, maybe I'm being very clear. I have and extra field added for artist, and one artist, Alan Moore, is credited for 100 different products. People come to my site they want to see everything done by Alan Moore, wouldn't this be a way to accomodate that?

 

It seems you're unclear about my intention. I don't want to do anything to the product_info page. I'm trying to make a section that will simplify grouping my items.

 

As I said, I mostly want to take the Mfg box, and create another box or page that creates a drop down for each extra field and populates it with every unique entry in the system. Then when someone choose something in one of them they'll get a list of every product that has that value as an extra field.

 

The code you supplied makes it seem like I want to let visitors change the extra fields per product, and I'm not sure how that would even be near what I've discussed.

 

Ideally having these drop downs appear on the search page would be the better, and I do intend for people to select something, that's the whole point. I'm not sure how a drop down is against interface logic, every store that uses the MFG box has one, they can't all be un-logical... er anti-logical? (Or whatever) can they?

Link to comment
Share on other sites

Okay, maybe I'm being very clear. I have and extra field added for artist, and one artist, Alan Moore, is credited for 100 different products. People come to my site they want to see everything done by Alan Moore, wouldn't this be a way to accomodate that?

 

It seems you're unclear about my intention. I don't want to do anything to the product_info page. I'm trying to make a section that will simplify grouping my items.

 

As I said, I mostly want to take the Mfg box, and create another box or page that creates a drop down for each extra field and populates it with every unique entry in the system. Then when someone choose something in one of them they'll get a list of every product that has that value as an extra field.

 

The code you supplied makes it seem like I want to let visitors change the extra fields per product, and I'm not sure how that would even be near what I've discussed.

 

Ideally having these drop downs appear on the search page would be the better, and I do intend for people to select something, that's the whole point. I'm not sure how a drop down is against interface logic, every store that uses the MFG box has one, they can't all be un-logical... er anti-logical? (Or whatever) can they?

 

why don't you use links for each extra field value that lead to a page of results, instead of creating menus that will contain hundreds of items... and not even redirect the customer to anything (just a drop down menu?)

 

Actor: Robert de Niro

Genre: Thriller

Director: Martin Scorcese

 

For this, the extra field mod is not the easiest to work with. It would be better to create "real" fixed fields in your products table, and not in a related table, because you will be using - and also extending - the advanced search results link structure that searches in your products table extra fields.

Edited by pixclinic
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.

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...