Hi everyone,
Sorry, I know there are other threads addressing how to show your additional product fields in the product listing page, but I can't seem to get it to work for me. And the other threads seem to be years old.
I've followed the instructions in post #79 on this thread
http://www.zen-cart.com/forum/showth...+fields&page=8
I understand a tiny bit of php so I can follow the instructions but I don't really know the logic or what these modifications do.
So to summarize, this is what I've done... (with the additional field being metal type)
1. I've defined the table heading in the language files
File -includes/languages/english/index.php
define('TABLE_HEADING_PRICE', 'Price');
define('TABLE_HEADING_WEIGHT', 'Weight');
define('TABLE_HEADING_METAL_TYPE', 'Metal Type');
2. Setting up the case for something...?
File -includes/modules/product_listing.php
case 'PRODUCT_LIST_MODEL':
$lc_text = TABLE_HEADING_MODEL;
$lc_align = '';
$zc_col_count_description++;
break;
case 'PRODUCT_LIST_METAL_TYPE':
$lc_text = TABLE_HEADING_METAL_TYPE;
$lc_align = '';
$zc_col_count_description++;
break;
and the same further down the same file...
case 'PRODUCT_LIST_QUANTITY':
$lc_align = 'right';
$lc_text = $listing->fields['products_quantity'];
break;
case 'PRODUCT_LIST_METAL_TYPE':
$lc_align = 'right';
$lc_text = $listing->fields['products_metal_type'];
break;
(where it says $listing->fields['products_metal_type'] is the products_metal_type supposed to be my field name that I set up in the database? because the actual field name is just 'metal_type' and I've tried it both ways but neither seems to work)
3. Adding the fields to the sql query
File - includes/index_filters/default_filter.php
$listing_sql = "select " . $select_column_list . " p.products_id, p.products_type, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status = 1,
s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping,
p.products_qty_box_status, p.products_metal_type
^ There are 4 blocks with that query in this file which I changed.
and then further down the same file
case 'PRODUCT_LIST_QUANTITY':
$listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_IMAGE':
$listing_sql .= "pd.products_name";
break;
case 'PRODUCT_LIST_METAL_TYPE':
$listing_sql .= "p.products_metal_type " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
4. Displaying the fields in the products listing page?
File - includes/modules/pages/index/main_template_vars.php
$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
'PRODUCT_LIST_METAL_TYPE' => PRODUCT_LIST_METAL_TYPE,
and further down same file...
case 'PRODUCT_LIST_MODEL':
$select_column_list .= 'p.products_model, ';
break;
case 'PRODUCT_LIST_NAME':
$select_column_list .= 'pd.products_name, ';
break;
case 'PRODUCT_LIST_MANUFACTURER':
$select_column_list .= 'm.manufacturers_name, ';
break;
case 'PRODUCT_LIST_QUANTITY':
$select_column_list .= 'p.products_quantity, ';
break;
case 'PRODUCT_LIST_IMAGE':
$select_column_list .= 'p.products_image, ';
break;
case 'PRODUCT_LIST_METAL_TYPE':
$select_column_list .= 'p.products_metal_type, ';
break;
Sorry I haven't used line numbers but my line numbers seemed to be different from those in the original post I followed.
So after I've modified all those files above, the field Metal Type still doesn't show up on my product listing page.
Is there something I'm missing?
As always any help or shove in the right direction would be helpful.
Thanks!
Bookmarks