emarsico Posted July 5, 2006 Posted July 5, 2006 Can anyone tell me how to add only one of the extra fields to a page. Does anyone know the code for this. Right know i have it setup where all of the products have about six extra fields and i want to show only one of the extra fields on certin pages can someone help.
Guest Posted July 5, 2006 Posted July 5, 2006 I think the way the extra fields work is they show only if they are populated. (at least the categories extra fields module).
emarsico Posted July 5, 2006 Author Posted July 5, 2006 I think the way the extra fields work is they show only if they are populated. (at least the categories extra fields module). I think I am saying what i need done wrong. I need to get one or two of the product extra fields on the product listing page. Then on the product info page will have all of the extra fields. For example when you click on a category a list of images come up in that list i want to show not only the name and price, but also the product size which is a extra field. Then when you click on details you are sent to the product info page you will see all of the product extra fields on that page. Is it possible to break apart the product extra fields so that you could show only some of the product extra fields on another page?
Guest Posted July 5, 2006 Posted July 5, 2006 I see, you have to change the catalog\index.php it is where the sql queries are setup to retrieve the product details from the database. You will see in that file lines like this: $listing_sql = "select " . $select_column_list . " p.products_id, Now I am not sure how you have named the size extra fields but lets say "size" so the first query will change from this: $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'] . "'"; to this: $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, pef.products_extra_fields_name, p2pef.products_extra_fields_value from ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef LEFT JOIN ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." p2pef ON(p2pef.products_extra_fields_id=pef.products_extra_fields_id) left join " . TABLE_PRODUCTS . " p on (p.products_id=p2pef.products_id) 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 pef.products_extra_fields_name='size' and 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'] . "'"; Similarly the rest of the queries. Then in the catalog\includes\modules\product_listing.php you could append the extra fields name/value. The array fields are ready to retrieve sp you could add them beneath the name lets say so you change this: $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>'; to this: $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br>' . $listing['products_extra_fields_name'] . ' <b>' . $listing['products_extra_fields_value'] . '</b>'; Now haven't tested anything so backup your files before experimenting. And you need to change the rest of the queries in the same manner as well as the extra case for the products list name.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.