Jump to content
Sign in to follow this  
Arnoud

Product extra fields -product list

Recommended Posts

Hello everybody

 

I have installed the contribution Product extra fields

 

It works great, but I can't let the extra fields show in the product_list. Does anyone realised this with succes? Can anyone help me on the right way?

 

Thanks a lot

---------------

Arnoud

Share this post


Link to post
Share on other sites

Not sure if Arnoud is still looking for the answer but I am!

Actually I want to display the data of a few fields from PEF not the field name.

Instead of "Sort: Paperback | Year: 2005" I would like to show just "Paperback | 2005" in the productlisting.

 

I think many people would like to display this information in the productlisting!

Help is welcome...

Share this post


Link to post
Share on other sites
Not sure if Arnoud is still looking for the answer but I am!

Actually I want to display the data of a few fields from PEF not the field name.

Instead of "Sort: Paperback | Year: 2005" I would like to show just "Paperback | 2005" in the productlisting.

 

I think many people would like to display this information in the productlisting!

Help is welcome...

 

After I installed this and had same problem I noticed red green dot in the extra fields manager in Admin clicked the green dot to switch them on and they now show in product listing although not where I want them to be.

 

Does your search work ok

Share this post


Link to post
Share on other sites

i got the attributes to appear in the product description but I want it to appear in the product listing also.

Any ideas on how I do that?

Share this post


Link to post
Share on other sites
i got the attributes to appear in the product description but I want it to appear in the product listing also.

Any ideas on how I do that?

 

hello

can you please help and tell me how can I show the product extra fields in product listing? or at least which file do I have to edit? (is it he same product_info.php that appears in the list?)

Share this post


Link to post
Share on other sites
hello

can you please help and tell me how can I show the product extra fields in product listing? or at least which file do I have to edit? (is it he same product_info.php that appears in the list?)

 

for products listings you will have to edit the includes/modules/products_listings.php file. But also note that you will have appropriately change the query from wherever the product listing is called in.. or in the product listing check if the extra field is present and then only show up ( similar to the product info page code ).

 

Hope that helped.

 

Cheers

Hari

Share this post


Link to post
Share on other sites
for products listings you will have to edit the includes/modules/products_listings.php file. But also note that you will have appropriately change the query from wherever the product listing is called in.. or in the product listing check if the extra field is present and then only show up ( similar to the product info page code ).

 

Hope that helped.

 

Cheers

Hari

 

thank you very much! already did that and uploaded my little contribution there :D

so check it out : Product Extra Fields in product listing

Share this post


Link to post
Share on other sites
It seems you contribution is not working.

 

yes I got a pm from someone saying id did not work

it seems that I worked on another version of oscommerce.. RC1 I think (I also added the product extra features in my store manually.. ). So if someone has the latest version of oscommerce.. and a little knowledge of php... maybe can help us update exactly the files. (my contribution works if you know where to put the code fragments in the latest RC2 version.)

Share this post


Link to post
Share on other sites
It seems you contribution is not working.

 

 

can you please send the details as to where it fails.. for me it works very fine.. !!

 

Hari

Share this post


Link to post
Share on other sites
@xavkick What seems to be the problem? can you elaborate more? maybe me or Hari could help !

 

 

The problem is that i use product_lisitng_col and i can not set it nice

Share this post


Link to post
Share on other sites

it doesnt work because there places you instruct to place the code in the instructions dont exsist. i have an original unmodified product_listing.php file from OSC 2.2 so i know its not that thats wrong. if yours is from rc1 does anybody have an updated version they can post?

Share this post


Link to post
Share on other sites
It seems you contribution is not working.

 

This will fix your headache, I also added it to the contribution page

 

Enjoy

 

includes/modules/product_listings.php

 

FIND

 

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';

}

break;

 

 

 

 

REPLACE WITH

//PRODUCT EXTRA FIELDS IN PRODUCT LISTING - BEGINING

 

//PRODUCT EXTRA FIELDS IN PRODUCT LISTING - BEGINING

 

//$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . //$listing['products_name'] . '</a> ';

 

// }

// break;

 

$extra_fields_text = '';

$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) $listing['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'])

continue;

$extra_fields_text = $extra_fields_text.

'<font color="#000000">'.$extra_fields['name'].': </font>' .

'<font color="#006600">' .$extra_fields['value'].'<BR></font>';

 

}

 

$lc_text = '<b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $fldname . '</a></b> <br>' . $extra_fields_text . '<br>';

 

}

break;

 

// PRODUCT EXTRA FIELDS IN PRODUCT LISTING - END

Share this post


Link to post
Share on other sites

I'm new to the whole osC system and have a fresh install of 2.2 RC2a with only STS 4.5.8 added on. I've tried both the "Product Extra Fields in Product Listing Works with RC2.2" and the "STSv4.5.2_and_PRODUCT_EXTRA_FIELD" versions of PEF and can't seem to get it to show up in the cart admin. What am I doing wrong?

Share this post


Link to post
Share on other sites
I'm new to the whole osC system and have a fresh install of 2.2 RC2a with only STS 4.5.8 added on. I've tried both the "Product Extra Fields in Product Listing Works with RC2.2" and the "STSv4.5.2_and_PRODUCT_EXTRA_FIELD" versions of PEF and can't seem to get it to show up in the cart admin. What am I doing wrong?

 

Ok, so I suppose installing an actual version of PEF might have been helpful in the first place. Sorry. :-"

Share this post


Link to post
Share on other sites

Can anyone please tell me how to display and extra field value in the invoice and packing slip?

 

eg. I have various extra fields like author, isbn , publisher etc. and i want the author field to be displayed besides the product name in the invoice.

 

Any help would be appreciated :rolleyes:

Share this post


Link to post
Share on other sites

:'( G'Day All,

 

I've had a red hot go at installing this contrib but just can't make it happen. I'm getting this error

 

1054 - Unknown column 'pef.languages_id' in 'where clause'

 

SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM products_extra_fields pef LEFT JOIN products_to_products_extra_fields ptf ON ptf.products_extra_fields_id=pef.products_extra_fields_id WHERE ptf.products_id=33 and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='1') ORDER BY products_extra_fields_order

 

[TEP STOP]

 

We're running 2.2rc2a.

 

Any help gladly received.


Ausmaniac (AKA John)

"A man's' ambition must be small, to write his name on a toilet wall"

Share this post


Link to post
Share on other sites

hi... i was able to finally remove the PEF details from the product name in the product list.. HOWEVER, now in the product name column, it is duplicating the product picture...

 

http://chargercards.com/index.php?cPath=21...ecb322f2b8955e4

 

here is my code in product_listing.php I must have duplicated the code somewhere.. please help!

 

<?php

/*

 $Id: product_listing.php 1739 2007-12-20 00:52:16Z hpdl $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/



 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');



 if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {

?>

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

 <tr>

<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

 </tr>

</table>

<?php

 }



 $list_box_contents = array();



 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

switch ($column_list[$col]) {

  case 'PRODUCT_LIST_MODEL':

	$lc_text = TABLE_HEADING_MODEL;

	$lc_align = '';

	break;

  case 'PRODUCT_LIST_NAME':

	$lc_text = TABLE_HEADING_PRODUCTS;

	$lc_align = '';

	break;

  case 'PRODUCT_LIST_MANUFACTURER':

	$lc_text = TABLE_HEADING_MANUFACTURER;

	$lc_align = '';

	break;

  case 'PRODUCT_LIST_PRICE':

	$lc_text = TABLE_HEADING_PRICE;

	$lc_align = 'right';

	break;

  case 'PRODUCT_LIST_QUANTITY':

	$lc_text = TABLE_HEADING_QUANTITY;

	$lc_align = 'right';

	break;

  case 'PRODUCT_LIST_WEIGHT':

	$lc_text = TABLE_HEADING_WEIGHT;

	$lc_align = 'right';

	break;

  case 'PRODUCT_LIST_IMAGE':

	$lc_text = TABLE_HEADING_IMAGE;

	$lc_align = 'center';

	break;

  case 'PRODUCT_LIST_BUY_NOW':

	$lc_text = TABLE_HEADING_BUY_NOW;

	$lc_align = 'center';

	break;

}



if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {

  $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);

}



$list_box_contents[0][] = array('align' => $lc_align,

								'params' => 'class="productListing-heading"',

								'text' => ' ' . $lc_text . ' ');

 }



 if ($listing_split->number_of_rows > 0) {

$rows = 0;

$listing_query = tep_db_query($listing_split->sql_query);

while ($listing = tep_db_fetch_array($listing_query)) {

  $rows++;



  if (($rows/2) == floor($rows/2)) {

	$list_box_contents[] = array('params' => 'class="productListing-even"');

  } else {

	$list_box_contents[] = array('params' => 'class="productListing-odd"');

  }



  $cur_row = sizeof($list_box_contents) - 1;



  for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

	$lc_align = '';



	switch ($column_list[$col]) {

	  case 'PRODUCT_LIST_MODEL':

		$lc_align = '';

		$lc_text = ' ' . $listing['products_model'] . ' ';

		break;

	  case 'PRODUCT_LIST_NAME':

		$lc_align = '';

		if (isset($HTTP_GET_VARS['manufacturers_id'])) {


//PRODUCT EXTRA FIELDS IN PRODUCT LISTING - BEGINING

//$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . //$listing['products_name'] . '</a> ';

//			}
//			break;

$extra_fields_text = '';
			  $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) $listing['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'])
	   continue;
	   $extra_fields_text = $extra_fields_text.
	'<font color="#000000">'.$extra_fields['name'].': </font>' . 
	'<font color="#006600">' .$extra_fields['value'].'<BR></font>'; 

 }		

		  $lc_text = '<b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $fldname . '</a></b> <br>' . $extra_fields_text . '<br>';

		}
		break;

// PRODUCT EXTRA FIELDS IN PRODUCT LISTING - END



	  case 'PRODUCT_LIST_MANUFACTURER':

		$lc_align = '';

		$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';

		break;

	  case 'PRODUCT_LIST_PRICE':

		$lc_align = 'right';

		if (tep_not_null($listing['specials_new_products_price'])) {

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

		} else {

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

		}

		break;

	  case 'PRODUCT_LIST_QUANTITY':

		$lc_align = 'right';

		$lc_text = ' ' . $listing['products_quantity'] . ' ';

		break;

	  case 'PRODUCT_LIST_WEIGHT':

		$lc_align = 'right';

		$lc_text = ' ' . $listing['products_weight'] . ' ';

		break;

	  case 'PRODUCT_LIST_IMAGE':

		$lc_align = 'center';

		if (isset($HTTP_GET_VARS['manufacturers_id'])) {

		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

		} else {

		  $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

		}

		break;

	  case 'PRODUCT_LIST_BUY_NOW':

		$lc_align = 'center';

		$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

		break;

	}



	$list_box_contents[$cur_row][] = array('align' => $lc_align,

										   'params' => 'class="productListing-data"',

										   'text'  => $lc_text);

  }

}



new productListingBox($list_box_contents);

 } else {

$list_box_contents = array();



$list_box_contents[0] = array('params' => 'class="productListing-odd"');

$list_box_contents[0][] = array('params' => 'class="productListing-data"',

							   'text' => TEXT_NO_PRODUCTS);



new productListingBox($list_box_contents);

 }



 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {

?>

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

 <tr>

<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

 </tr>

</table>

<?php

 }

?>

Share this post


Link to post
Share on other sites

update - i reverted back to the default product_listing.php file, because when i installed AZRESTA's contribution, my extra fields appeared INSIDE the product name column......

 

anyone have that problem? how did you fix it?

Share this post


Link to post
Share on other sites

Hi,

 

Can someone help me with this contribution?

 

I am trying to get the Product extra fields to show-up in the product listing. But i'm using the product_listing_tpl.php file

instead of the product_listing.php file and this mod doesn't work. I don't have a code line matching what is suggested in the instructions to replace?? If anyone knows what line I should replace with the provided code I would apprec. it. working on this for hours:

 

13. Extra Fields in product listing (optional)
In catalog/includes/modules/product_listings.php

FIND

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
           }
           break;




REPLACE WITH
//PRODUCT EXTRA FIELDS IN PRODUCT LISTING - BEGINING

//PRODUCT EXTRA FIELDS IN PRODUCT LISTING - BEGINING

//$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . //$listing['products_name'] . '</a> ';

//            }
//            break;

$extra_fields_text = '';
                 $extra_fields_query = tep_db_query("
				SELECT pef.languages_id, 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) $listing[$x]['products_id'] ." and pef.languages_id=" . (int)$languages_id . " and ptf.products_extra_fields_value<>''
				ORDER BY products_extra_fields_order");

while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
if (! $extra_fields['status'])
continue;
$extra_fields_text = $extra_fields_text.
'<font color="#000000">'.$extra_fields['name'].': </font>' .
'<font color="#006600">' .$extra_fields['value'].'<BR></font>';

}

$lc_text = ' <b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a></b><br>  ' . $extra_fields_text . '<br>';

}
break;

// PRODUCT EXTRA FIELDS IN PRODUCT LISTING - END

Edited by northshore

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×