Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Display of additional field in product_listing.php


Knocky

Recommended Posts

Hi!

 

I somehow managed do add some additional fields into my webshop without extensive php-knowledge.

To finish my work, I need one of these new fields do be displayed in the product_listing.php

 

The field is stored as "products_valid" in the table "products".

How do I call for these values?

 

You can see what I mean under:

http://www.reisebuero-bessler.de/catalog/index.php

 

In the column "Kataloge" I already have "Reisezeitraum" as the description displayed.

 

Thanks for your help!

 

Regards,

Knocky

Link to comment
Share on other sites

Hi!

 

I somehow managed do add some additional fields into my webshop without extensive php-knowledge.

To finish my work, I need one of these new fields do be displayed in the product_listing.php

 

The field is stored as "products_valid" in the table "products".

How do I call for these values?

 

You can see what I mean under:

http://www.reisebuero-bessler.de/catalog/index.php

 

In the column "Kataloge" I already have "Reisezeitraum" as the description displayed.

 

Thanks for your help!

 

Regards,

Knocky

Take a look inside your (catalog)/index.php first and find the part:

// show the products of a specified manufacturer
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
  } else {
// We show them all
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
  }
} else {
// show the products in a given categorie
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
  } else {
// We show them all
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
  }
}

With every query add the field(s) you want to be displayed later on in your product listing like:

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_valid, p.products_tax_class_id ...

 

After that go to your (catalog)/includes/modules/product_listing.php and edit it to your liking. You can now simply use $listing['products_valid'] to display the actual value for each product in your product listings.

 

HTH

Link to comment
Share on other sites

I may of missed something here, but what has this got to do with Core Development?

 

More importantly, why has someone on the 'osCommerce Team' replied to it when it is off topic?

Link to comment
Share on other sites

I may of missed something here, but what has this got to do with Core Development?

 

More importantly, why has someone on the 'osCommerce Team' replied to it when it is off topic?

By jove, in the wrong section indeed :P Can you imagine I do not always look carefully in which section a topic is when I reply... More importantly, I can not move it to the right section myself so I will ask someone who is allowed.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...