Re: How-To: Add new Properties to your Products
I have posted a mix of the OP solution on this thread and the one by zskiman (mid thread) plus my own additions which allows the creation of new product fields, held in a separate table and declared so they can be inserted into the page in the same manner as existing fields.
http://www.zen-cart.com/forum/showthread.php?t=120523
Hopefully of use to someone.
G
Re: How-To: Add new Properties to your Products
Does anybody know how to add an additional IMAGE field to the product table?
I need this to display a special image at a place other than main image or additional images.
I managed to add various fields which all show up fine both in admin and catalog but the newly created image field isn't shown nor is the file-name in the database as it should be. I simply copied some parts from the main image for this new image field. It is displayed on the preview_info.php but gets lost on its way to be stored.
Can someone give a hint on this issue? Thanks in advance!
Re: How-To: Add new Properties to your Products
I've added without problems many new fileds in my products page like this:
hhttp://www.dvdmart.it/shop/007-il-m...a-p-91410.html
now i'm trying to add many of these fiels in products_all listing, featured, new etc.
my work:
includes/modules/product_listing.php
near line 30:
case 'PRODUCT_LIST_NAME':
$lc_text = TABLE_HEADING_PRODUCTS;
$lc_align = '';
$zc_col_count_description++;
break;
case 'PRODUCT_LIST_MYFIELD':
$lc_text = TABLE_HEADING_MYFIELD;
$lc_align = '';
$zc_col_count_description++;
break;
near line 100:
case 'PRODUCT_LIST_MODEL':
$lc_align = '';
$lc_text = $listing->fields['products_model'];
break;
case 'PRODUCT_LIST_MYFIELD':
$lc_align = '';
$lc_text = $listing->fields['products_myfieldsqlname'];
break;
includes/modules/pages/index/main_template_vars.php
near line 136:
// create column list
$define_list = array(
'PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
'PRODUCT_LIST_MYFIELD' => PRODUCT_LIST_MYFIELD,
near line 163:
switch ($column_list[$i])
{
case 'PRODUCT_LIST_MODEL':
$select_column_list .= 'p.products_model, ';
break;
case 'PRODUCT_LIST_MYFIELD':
$select_column_list .= 'products_myfieldsqlname, ';
break;
includes/index_filters/default_filter.php
near line 28, 43, 58, 73:
$listing_sql = "select " . $select_column_list . " p.products_id, p.products_myfieldsqlname,
near line 117:
case 'PRODUCT_LIST_NAME':
$listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
break;
case 'PRODUCT_LIST_MANUFACTURER':
$listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_MYFIELD':
$listing_sql .= "p.products_myfieldsqlname" . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
near line 122:
case 'PRODUCT_LIST_MANUFACTURER':
$listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_MYFIELD':
$listing_sql .= "p.products_myfieldsqlname" . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
includes/modules/template/MYTEMPLATE/template/tpl_modules_products_all_listing.php
near line 42:
if (PRODUCT_ALL_LIST_MODEL != '0' and zen_get_show_product_switch($products_all->fields['products_id'], 'model')) {
$display_products_model = '<b>' . TEXT_PRODUCTS_MODEL . '</b>' . $products_all->fields['products_model'] . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_MODEL, 3, 1));
} else {
$display_products_model = '';
}
if (PRODUCT_ALL_LIST_MYFIELD != '0' and zen_get_show_product_switch($products_all->fields['products_myfieldsqlname'], 'myfield')) {
$display_products_myfield = '<b>' . TEXT_PRODUCTS_MYFIELD . '</b>' . $products_all->fields['products_myfieldsqlname'] . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_MYFIELD, 3, 1));
} else {
$display_products_myfield = '';
}
near line 141:
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_MYFIELD') {
echo $display_products_model;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_MYFIELD') {
echo $display_products_myfield;
}
near line 177:
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_MODEL') {
echo $display_products_model;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_MYFIELD') {
echo $display_products_myfield;
}
includes/languages/MYTEMPLATE/english etc
define('TEXT_PRODUCTS_MYFIELD', 'My extra products field');
in my database i've added:
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (1200, 'Show my myfield', 'PRODUCT_ALL_LIST_MYFIELD', '2506', 'bla bla bla', 21, 13, NULL, '2006-07-05 13:59:40', NULL, NULL);
Nothing appear here:
http://www.dvdmart.it/shop/products_all.html
whats wrong?
Thanks!
Re: How-To: Add new Properties to your Products
i can't modify my last post, on
near line 141:
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_MYFIELD') {
echo $display_products_model;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_MYFIELD') {
echo $display_products_myfield;
}
right is
near line 141:
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_MODEL') {
echo $display_products_model;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_MYFIELD') {
echo $display_products_myfield;
}
thanks! :P
Re: How-To: Add new Properties to your Products
Resolved, ALONE. :dontgetit
Re: How-To: Add new Properties to your Products
Hi shen,
I have made a modified version of the steps from this thread here which has worked for many. Note I have also added a bit here to ensure the extra product data is deleted when deleting a product.
G
Re: How-To: Add new Properties to your Products
I installed a new text field and got it right the first time. Woo Hoo! :clap::clap::clap:
One trivial question... on the admin side, when I fill out the information, my new text field shows up at the bottom of my product listing page. Where do I need to go to move it up, right under my title?
I already moved it up on my product info page that people can see, but on the admin side it would be nice to have the subtitle field I just created go directly under the title field.
Thanks!
KD
Re: How-To: Add new Properties to your Products
Hi
Look at the 1 page of this post it will be in
edit 'collect_info.php' (in /admin/includes/modules/product/),
edit 'preview_info.php' (in /admin/includes/modules/product/) or
edit 'update_product.php' (in /admin/includes/modules/)
don't remember now.
Re: How-To: Add new Properties to your Products
It doesn't say specifically which file controls where the text field appears on the admin side when filling out product details. With 3 different files and 5-6 different edits, I don't want to mess this up before I start. Anyone else have an idea of which file it would be, and where I would look to re-order the fields?
Thanks,
KD :smile: