Zen Cart: How to add new column to product list
To add new product list columns to Zen Cart, for example, 2 new columns: size, application
1, Add new columns to products table.
2, Add the following lines to include/languages/english/index.php
define('TABLE_HEADING_SIZE', 'Size');
define(’TABLE_HEADING_APPLICATION’, ‘Application’);
3, Add the following lines to include/modules/pages/index/main_template_vars.php in the create column list section:
'TABLE_HEADING_APPLICATION' => TABLE_HEADING_APPLICATION,
‘PRODUCT_LIST_SIZE’ => PRODUCT_LIST_SIZE,
in the switch section:
case 'PRODUCT_LIST_SIZE':$select_column_list .= 'p.size, ';
break;
case ‘PRODUCT_LIST_APPLICATION’:
$select_column_list .= ‘p.application, ‘;
break;
4, Add the following lines to includes/modules/excellgen/product_listing.php
switch ($column_list[$col]) {
…
case 'PRODUCT_LIST_SIZE':
$lc_text = TABLE_HEADING_SIZE;
$lc_align = ‘left’;
$zc_col_count_description++;
break;
case ‘PRODUCT_LIST_APPLICATION’:
$lc_text = TABLE_HEADING_APPLICATION;
$lc_align = ‘left’;
$zc_col_count_description++;
break;
...
for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
$lc_align = ”;
switch ($column_list[$col]) {…
case 'PRODUCT_LIST_SIZE':
$lc_align = ‘left’;
$lc_text = ‘ ’.$listing->fields['size'];
break;
case ‘PRODUCT_LIST_APPLICATION’:
$lc_align = ‘left’;
$lc_text = ‘ ’.$listing->fields['application'];
break;….
5, Remove sorting of these two columns, by editing includes/modules/excellgen/product_listing.php:
if ( ($column_list[$col] != ‘PRODUCT_LIST_IMAGE’)
&& $column_list[$col] != ‘PRODUCT_LIST_SIZE’
&& $column_list[$col] != ‘PRODUCT_LIST_APPLICATION’)
{
$lc_text = zen_create_sort_heading($_GET['sort'], $col+1, $lc_text);
}
6, Change alignment:
includes/modules/excellgen/product_listing.php:
$lc_align = 'left';
includes/templates/excellgen/css
.productListing-data
{
font-size:12px;
text-align:left;
}
7, Run SQL to add values to configuration table:
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description,
configuration_group_id, sort_order, date_added ) values (
‘Display Product Size’, ‘PRODUCT_LIST_SIZE’, ‘4′, ‘Do you want to display the Product Size?’, 8, 5, now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description,
configuration_group_id, sort_order, date_added ) values (
‘Display Product Application’, ‘PRODUCT_LIST_APPLICATION’, ‘3′,'Do you want to display the Product Application?', 8, 5, now());
8, Check if you can edit these columns:
Admin-->Configuration-->Product Listing
Popularity: 2%



















































vipulk said,
November 28, 2008 @ 3:30 pm
i was able to create the new fields and they are visible through Admin–>Configuration–>Product Listing
But when I go to \”Add New Product\” option, i can\’t see the new fields there…
please help
Vorbis said,
December 18, 2008 @ 1:27 pm
Hello, exact same issue for me. Can see in Product Listing but not when adding a new product.
Help needed urgently please,
Thank you,
Nick