Forums / Setting Up Categories, Products, Attributes / How To Add New Product Fields?

How To Add New Product Fields?

Views: 83,922

Results 101 to 120 of 159
6 Oct 2010, 2:18 AM
#101
gormant avatar

gormant

New Zenner

Join Date:
Oct 2010
Posts:
1
Plugin Contributions:
0

How To Add New Product Fields?

Thanks for the great post! It worked perfectly.

One question, in Step 8 of the original post, it showed how to display the data in a single product listing. That worked perfectly. **How would one display the same new product field data in the All Products listing? **

I've been wracking my brain all day. My PHP skills are a little lacking for this one. Any help would be appreciated.

11 Oct 2010, 4:58 AM
#102
lazaros avatar

lazaros

New Zenner

Join Date:
Oct 2010
Posts:
2
Plugin Contributions:
0

Re: How To Add New Product Fields?

gormant:

Thanks for the great post! It worked perfectly.

One question, in Step 8 of the original post, it showed how to display the data in a single product listing. That worked perfectly. **How would one display the same new product field data in the All Products listing? **

I've been wracking my brain all day. My PHP skills are a little lacking for this one. Any help would be appreciated.

Hello everyone,
I am facing exactly the same problem. I want the new field to appear
in the search results. I have made a few modifications in header.php
(the select and where parts of the search query and manually added the new field in $define_list) but I can't quite
locate the exact lines of code that are responsible for field selection
during proudct listing.

Lazaros.

13 Oct 2010, 5:36 AM
#103
lazaros avatar

lazaros

New Zenner

Join Date:
Oct 2010
Posts:
2
Plugin Contributions:
0

Re: How To Add New Product Fields?

To answer my own question in case someone else is looking for the same piece of info..:smile:

The file under question is
/includes/modules/product_listing.php

Lazaros

1 Nov 2010, 1:31 PM
#104
bookwise avatar

bookwise

New Zenner

Join Date:
Jun 2008
Posts:
23
Plugin Contributions:
0

Re: How To Add New Product Fields?

Would someone please take a look at this code and help me identify the problem. I get the following error:

1054 Unknown column 'pdex.products_year' in 'field list'
in:

[select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_quantity, p.products_weight, p.products_priced_by_attribute, p.product_is_free, p.products_qty_box_status, p.products_quantity_order_max, p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter, pdex.products_year from zen_products p, zen_products_description pd, zen_product_extra_fields pdex where p.products_status = '1' and p.products_id = '3' and pd.products_id = p.products_id and p.products_id = pdex.products_id and pd.language_id = '1']

This is what I have done on a fresh install of v1.3.9g

  1. New table PRODUCT_EXTRA_FIELDS

  2. includes/database_tables.php

define('TABLE_PRODUCT_EXTRA_FIELDS', DB_PREFIX . 'product_extra_fields');

  1. admin/includes/modules/product/preview_info.php

p.products_sort_order, pdex.products_year
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_EXTRA_FIELDS . " pdex
where p.products_id = pd.products_id and p.products_id = pdex.products_id

  1. admin/includes/modules/product/collect_info.php

$parameters = array('products_name' => '',
'products_description' => '',
…
'master_categories_id' => '',
'products_year' => ''
);

                                  p.products_price_sorter, p.master_categories_id, pdex.products_year

                          from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " .
                           TABLE_PRODUCT_EXTRA_FIELDS . " pdex
                          where p.products_id = '" . (int)$_GET['pID'] . "'

                          and p.products_id = pd.products_id and p.products_id = pdex.products_id

                          and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
  1. still in collect_info.php
<!-- BOF - Additional field added --> <tr> <td class="main"><?php echo 'Year of Release: '; ?></td> <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '13') . ' ' . zen_draw_input_field('products_year', $pInfo->products_year, zen_set_field_length(TABLE_PRODUCT_EXTRA_FIELDS, 'products_year')); ?></td> </tr> <!-- EOF - Additional field added -->
  1. admin/includes/modules/update_product.php

(line 106)
////////////// MY ADDED FIELDS ////////////////////
$sql_data_array = array('products_year' => zen_db_prepare_input($_POST['products_year']));

if ($action == 'insert_product') {
$insert_sql_data = array('products_id' => $products_id);

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

zen_db_perform(TABLE_PRODUCT_EXTRA_FIELDS, $sql_data_array);
} elseif ($action == 'update_product') {
zen_db_perform(TABLE_PRODUCT_EXTRA_FIELDS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
}
/////////////////////////////////////////////

  1. includes/modules/pages/product_info/main_template_vars.php

p.products_price_sorter, pdex.products_year

       from   " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_EXTRA_FIELDS . " pdex

       where  p.products_status = '1'

       and    p.products_id = '" . (int)$_GET['products_id'] . "'

       and    pd.products_id = p.products_id and p.products_id = pdex.products_id

       and    pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";

$products_year = $product_info->fields['products_year'];

  1. **includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php **
<!--bof Product Year --> <?php if ($products_year != '') { ?> <div id="productYear" class="productGeneral"><strong>Year: </strong><?php echo $products_year; ?></div> <?php } ?> <!--eof Product Year -->
8 Nov 2010, 3:49 PM
#105
steveyork136 avatar

steveyork136

New Zenner

Join Date:
Nov 2005
Posts:
84
Plugin Contributions:
0

Re: How To Add New Product Fields?

are you getting this error on the admin or public site?

What are you doing when the error appears, adding, editing product etc...

9 Nov 2010, 3:58 PM
#106
friedrich72 avatar

friedrich72

New Zenner

Join Date:
May 2009
Location:
Kansas
Posts:
39
Plugin Contributions:
0

Re: How To Add New Product Fields?

Have a question for the Easy Populate gurus-

When using Easy Populate, duplicating a product to a new category creates the product - but without any product info.
Nothing shows including the product name, model,...and including the new fields that were added.

I have tried to modify "easypopulate.php" with the new field info including the "PRODUCTS_EXTRA_STUFF" table but run into errors when processing.

However, I am able to "copy" one product to another category successfully with all info being populated in the duplicate product when not using easy populate.

I was hoping that someone might be able to show how to alter "easypopulate.php" for the new table info "PRODUCTS_EXTRA_STUFF" .

Otherwise this mod has worked great. Thank you to webego and all for their input.

6 Mar 2011, 8:36 PM
#107
mrbeads avatar

mrbeads

New Zenner

Join Date:
Feb 2011
Posts:
3
Plugin Contributions:
0

Re: How To Add New Product Fields?

okay so I'm at the point of adding my new field the reports section.

I have this in my database_tables.php file
define('TABLE_PRODUCTS_EXTRA_STUFF', DB_PREFIX . 'products_extra_stuff');

my new field is called pdex.reorder_code I do not know how to define it in this report so it will be echo right now no value for the new field is being displayed.

can any see whats going on here

here is my code

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> <script language="javascript" src="includes/menu.js"></script> <script language="javascript" src="includes/general.js"></script> <script type="text/javascript"> <!-- function init() { cssjsmenu('navbar'); if (document.getElementById) { var kill = document.getElementById('hoverJS'); kill.disabled = true; } } // --> </script> </head> <body onload="init()"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NUMBER; ?></td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_VIEWED; ?> </td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_reorder_code; ?></td> <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_product_image; ?></td> </tr> <?php if (isset($_GET['page']) && ($_GET['page'] > 1)) $rows = $_GET['page'] * MAX_DISPLAY_SEARCH_RESULTS_REPORTS - MAX_DISPLAY_SEARCH_RESULTS_REPORTS; $rows = 0; $products_query_raw = "select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_type from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id='" . $_SESSION['languages_id'] . "' order by p.products_quantity, pd.products_name"; $products_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $products_query_raw, $products_query_numrows); $products = $db->Execute($products_query_raw); while (!$products->EOF) {

// only show low stock on products that can be added to the cart
if ($zc_products->get_allow_add_to_cart($products->fields['products_id']) == 'Y') {

  $rows++;

  if (strlen($rows) < 2) {
    $rows = '0' . $rows;
  }

  $type_handler = $zc_products->get_admin_handler($products->fields['products_type']);

  $cPath = zen_get_product_path($products->fields['products_id']);

?>
<tr class="dataTableRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="document.location.href='<?php echo zen_href_link($type_handler, '&product_type=' . $products->fields['products_type'] . '&cPath=' . $cPath . '&pID=' . $products->fields['products_id'] . '&action=new_product'); ?>'">
<td class="dataTableContent" align="right"><?php echo $products->fields['products_id']; ?>  </td>
<td class="dataTableContent"><?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products->fields['products_id']) . '">' . $products->fields['products_name'] . '</a>'; ?></td>
<td class="dataTableContent" align="center"><?php echo $products->fields['products_quantity']; ?> </td>
<td class="dataTableContent" align="center"><?php echo $products->fields['pdex.reorder_code']; ?></td>
<td class="dataTableContent" align="center"><?php echo $products->fields['products_image']; ?> </td>
</tr>
<?php } $products->MoveNext(); } ?>
</table></td>
</tr>
<tr>
<td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="smallText" valign="top"><?php echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>

<!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //-->
29 Jul 2011, 4:37 PM
#108
patf avatar

patf

Zen Follower

Join Date:
May 2008
Posts:
200
Plugin Contributions:
0

Re: How To Add New Product Fields?

Thanks for getting this going webego it helps me a lot, hopefully I can give a little back.

This was working fine for me until I tried to copy a product but I reliased that copying a product doesn't add an extra row in the added fields table for the newly copied product. As I use copy product alot I though I'd try to code a fix. So here goes.

I've continued the original example using product_colour as the added field.

I would be pleased if someone from the zen team can cast their eye over this to see if the code is ok, it works but there may be a better way of doing it.

As always backup and test before you try this.

Open admin/includes/modules/copy_to_confirm.php

find (line 35 for me)

replace with

$product = $db->Execute("select p.products_type, p.products_quantity, p.products_model, p.products_image,
p.products_price, p.products_virtual, p.products_date_available, p.products_weight,
p.products_tax_class_id, p.manufacturers_id,
p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
p.product_is_free, p.product_is_call, p.products_quantity_mixed,
p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max, p.products_sort_order,
p.products_price_sorter, p.master_categories_id,
pdex.products_colour,
from " . TABLE_PRODUCTS . " p, " . TABLE_ADDED_FIELDS." pdex
where p.products_id = '" . (int)$products_id . "'
and pdex.products_id = '" . (int)$products_id . "'");[/QUOTE

Then after (line 109)

add

// added fields////////
$db->Execute("insert into " . TABLE_ADDED_FIELDS . "
(products_id, products_colour )
values ('" . (int)$dup_products_id ."', '" . zen_db_input($product->fields['products_colour']) . "' )");
// added fields////////

Sorry I can't seem to add source tag only quote, but you get my meaning :oops:

I found 2 issues with this which I figured I would share with the community for the benefit of others coming across the thread: ...

Firstly the first statment above gave me a sql syntax error - the cause being the , at the end of pdex.products_colour in

p.products_price_sorter, p.master_categories_id,
pdex.products_colour,
from " . TABLE_PRODUCTS . " p, " . TABLE_ADDED_FIELDS."

remove the, to sort this out.

p.products_price_sorter, p.master_categories_id,
pdex.products_colour
from " . TABLE_PRODUCTS . " p, " . TABLE_ADDED_FIELDS."

is how it should look.

The other one to watch out for is both mentions of TABLE_ADDED_FIELDS - If you have been following the original coding webego used TABLE_PRODUCTS_EXTRA_STUFF (products_extra_stuff being the database field used) Just make sure that you have used the same database field name.

19 Aug 2011, 10:23 PM
#109
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

Re: How To Add New Product Fields?

HELP:

getting this error:

#1136 - Column count doesn't match value count at row 1

19 Aug 2011, 10:26 PM
#110
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

Re: How To Add New Product Fields?

jagall:

HELP:

getting this error:

#1136 - Column count doesn't match value count at row 1

sorry in MYSQL when I put in the following code:
INSERT zen_products_extra_stuff (products_id, products_count, products_rrp) SELECT products_id, '' FROM zen_products

none of records appearing in admin, i have install alot of mods since starting zen cart could this have something to do with this?:unsure:

20 Aug 2011, 12:00 AM
#111
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

Re: How To Add New Product Fields?

jagall:

sorry in MYSQL when I put in the following code:
INSERT zen_products_extra_stuff (products_id, products_count, products_rrp) SELECT products_id, '' FROM zen_products

none of records appearing in admin, i have install alot of mods since starting zen cart could this have something to do with this?:unsure:

TG got it working, had to have three fields from the products database named!!!!!!!!!!!!!!! not good on sql but done and working yipeeeee

21 Aug 2011, 10:41 AM
#112
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

Re: How To Add New Product Fields?

anap:

HJ Lubbe, I believe I know your problem with the duplicate entry error, b/c I ran into the same error. Because the error was on the products_extra_stuff table, it means you've tried to insert multiple entries using the same product_id.

I'm guessing you added more than one custom field. In Step 6, you probably pasted the entire block of code for each extra field. In fact, you only need to do this once and modify the array below, as this gets inserted into the table all at once:

i.e. if you have a 2nd field called "dimensions" you would change the array to:

Thanks webego for putting this together. It is very frustrating digging through long forum threads to find step by step instructions as clear as yours. I hope 2.0 has this feature built-in!

thank you, thank you, thank you, thank you, thank you, thank you, thank you, it has been driving me mad . . .. . thank you, again

22 Aug 2011, 9:03 AM
#113
kelvinhk avatar

kelvinhk

New Zenner

Join Date:
Aug 2011
Posts:
1
Plugin Contributions:
0

Re: How To Add New Product Fields?

I got the the following error after the modification of adding the field, “products_cbm” :

before the change of file, main_template_vars.php
the product screen:

after changing the file, main_template_vars.php

the product screen:

below is my .sql file of adding the extra database.

DROP TABLE IF EXISTS products_extra_fields;
CREATE TABLE products_extra_fields (
products_id int(11) NOT NULL default '0',
products_cbm double(5,2) NOT NULL default '0.00',
PRIMARY KEY (products_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT products_extra_fields (products_id, products_cbm)
SELECT products_id, '1' FROM products


below is the file, main_template_vars.php


$tpl_page_body = '/tpl_product_info_display.php';

$sql = "update " . TABLE_PRODUCTS_DESCRIPTION . "
        set        products_viewed = products_viewed+1
        where      products_id = '" . (int)$_GET['products_id'] . "'
        and        language_id = '" . (int)$_SESSION['languages_id'] . "'";

$res = $db->Execute($sql);

$sql = "select p.products_id, pd.products_name,
              pd.products_description, p.products_model,
              p.products_quantity, p.products_image,
              pd.products_url, p.products_price,
              p.products_tax_class_id, p.products_date_added,
              p.products_date_available, p.manufacturers_id, p.products_quantity,
              p.products_weight, p.products_priced_by_attribute, p.product_is_free,
              p.products_qty_box_status,
              p.products_quantity_order_max,

p.products_discount_type, p.products_discount_type_from, p.products_sort_order,
p.products_price_sorter, pdex.products_cbm
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_EXTRA_FIELDS . " pdex
where p.products_status = '1'
and p.products_id = '" . (int)$_GET['products_id'] . "'
and pd.products_id = p.products_id and p.products_id = pdex.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";

$product_info = $db->Execute($sql);

$products_price_sorter = $product_info->fields['products_price_sorter'];

$products_price = $currencies->display_price($product_info->fields['products_price'],
                  zen_get_tax_rate($product_info->fields['products_tax_class_id']));

can anyone help.

thanks

22 Aug 2011, 6:42 PM
#114
stsung avatar

stsung

New Zenner

Join Date:
Aug 2011
Posts:
21
Plugin Contributions:
0

Re: How To Add New Product Fields?

hello again,

this topic deals with extra fields that show on product listing page. so I was wondering if the following is possible.

is it possible to take all the extra fields with few others Name and Price for example and have them all show up on the category listing page? there is one more condition though...I only need this displayed on the row listings. (I have two different kinds of listings in the shop.)

seems that this is defined in product_listing.php but I don't see a way how to implement this right away. could anyone help?

you can check the shop out at http://outcast.cz so you have a better idea.

what I need more precisely is that if you click on singles -> magic 2012 for example you would end up with a listing that would show

<tr><td>Name<TD>Color<TD>Casting Cost<TD>type<TD>edition<TD>price<TD>[quantity + add to cart] <tr><td>[Name of the card]<TD>[Color]<TD>[Casting Cost]<TD>[type]<TD>[edition]<TD>[price]<TD>quantity + add to cart button

hope you understand me...

the shop I'm working on now...
http://outcast.cz/

29 Aug 2011, 10:42 PM
#115
apogeerockets avatar

apogeerockets

Zen Follower

Join Date:
Aug 2011
Posts:
104
Plugin Contributions:
0

Re: How To Add New Product Fields?

love the mod - got it working with several fields. now i'd like to be able to have the mod work with and write to two tables - product_extra & product_motors, for example. it seems to be freaking out at the pdex. area, though.

i originally wrote this:

$product = $db->Execute("select p.products_id, pd.language_id, pd.products_name,
                                      pd.products_description, pd.products_url, p.products_quantity,
                                      p.products_model, p.products_image, p.products_price, p.products_virtual,
                                      p.products_weight, p.products_date_added, p.products_last_modified,
                                      p.products_date_available, p.products_status, p.manufacturers_id,
                                      p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
                                      p.product_is_free, p.product_is_call, p.products_quantity_mixed,
                                      p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max, p.products_sort_order, 
									  pdex.products_length, pdex.products_itemweight, pdex.products_motor_size, pdex.products_diameter, 
									  pdex.products_recovery, pdex.products_skill_level, pdex.products_quip, pdex.products_shortdesc, 
									  pdex.motors_lo_weight, pdex.motors_shortname, pdex.motors_size, pdex.motors_burntime, 
									  pdex.motors_impulse, pdex.motors_length, pdex.motors_thrust, pdex.motors_mass, pdex.motors_propmass, 
									  pdex.motors_color, pdex.motors_type, pdex.motor_restrict
                               from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_EXTRA . " pdex, " . TABLE_PRODUCTS_MOTORS . " pdex 
                               where p.products_id = pd.products_id and p.products_id = pdex.products_id and p.products_id = pdex.products_id
                               and p.products_id = '" . (int)$_GET['pID'] . "'");

just adding the extra table as per instructions after my previously inserted table. got the following error:

1066 Not unique table/alias: 'pdex'
in:
[select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_quantity, p.products_weight, p.products_priced_by_attribute, p.product_is_free, p.products_qty_box_status, p.products_quantity_order_max, p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter, pdex.products_length, pdex.products_itemweight, pdex.products_motor_size, pdex.products_diameter, pdex.products_recovery, pdex.products_skill_level, pdex.products_quip, pdex.products_shortdesc, pdex.motors_lo_weight, pdex.motors_shortname, pdex.motors_size, pdex.motors_burntime, pdex.motors_impulse, pdex.motors_length, pdex.motors_thrust, pdex.motors_mass, pdex.motors_propmass, pdex.motors_color, pdex.motors_type, pdex.motor_restrict from products p, products_description pd, products_extra pdex, products_motors pdex where p.products_id = pd.products_id and p.products_id = pdex.products_id where p.products_status = '1' and p.products_id = '11' and pd.products_id = p.products_id and p.products_id = pdex.products_id and pd.language_id = '1']

So i changed pdex for the 2nd added table to pdex1 on the pages.

"select p.products_id, pd.language_id, pd.products_name,
                                      pd.products_description, pd.products_url, p.products_quantity,
                                      p.products_model, p.products_image, p.products_price, p.products_virtual,
                                      p.products_weight, p.products_date_added, p.products_last_modified,
                                      p.products_date_available, p.products_status, p.manufacturers_id,
                                      p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
                                      p.product_is_free, p.product_is_call, p.products_quantity_mixed,
                                      p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max, p.products_sort_order, 
									  pdex.products_length, pdex.products_itemweight, pdex.products_motor_size, pdex.products_diameter, 
									  pdex.products_recovery, pdex.products_skill_level, pdex.products_quip, pdex.products_shortdesc, 
									  pdex1.motors_lo_weight, pdex1.motors_shortname, pdex1.motors_size, pdex1.motors_burntime, 
									  pdex1.motors_impulse, pdex1.motors_length, pdex1.motors_thrust, pdex1.motors_mass, pdex1.motors_propmass, 
									  pdex1.motors_color, pdex1.motors_type, pdex1.motor_restrict
                               from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_EXTRA . " pdex, " . TABLE_PRODUCTS_MOTORS . " pdex1 
                               where p.products_id = pd.products_id and p.products_id = pdex.products_id and p.products_id = pdex.products_id and p.products_id = pdex1.products_id
                               and p.products_id = '" . (int)$_GET['pID'] . "'");

that first error went away, to be replaced by the following one:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where p.products_status = '1' and p.products_id = '11' and pd.product' at line 16
in:
[select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_virtual, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id, p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute, p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max, p.products_sort_order, pdex.products_length, pdex.products_itemweight, pdex.products_motor_size, pdex.products_diameter, pdex.products_recovery, pdex.products_skill_level, pdex.products_quip, pdex.products_shortdesc, pdex1.motors_lo_weight, pdex1.motors_shortname, pdex1.motors_size, pdex1.motors_burntime, pdex1.motors_impulse, pdex1.motors_length, pdex1.motors_thrust, pdex1.motors_mass, pdex1.motors_propmass, pdex1.motors_color, pdex1.motors_type, pdex1.motor_restrict from products p, products_description pd, products_extra pdex, products_motors pdex1 where p.products_id = pd.products_id and p.products_id = pdex.products_id and p.products_id = pdex1.products_i where p.products_status = '1' and p.products_id = '11' and pd.products_id = p.products_id and p.products_id = pdex.products_id and pd.language_id = '1']

So yeah. I'm appending something wrong, obviously, but I don't know what the correct way is to at this point. :( Any suggestions?

1 Sep 2011, 3:04 PM
#116
idc1 avatar

idc1

Zen Follower

Join Date:
Jul 2011
Posts:
139
Plugin Contributions:
0

Re: How To Add New Product Fields?

This hasn't been clearly addressed in this forum yet so here is my question: What needs to be done to include the new field in the product listing page (I'm referring to when you click the lowest subcategory and then you get all of the products available under that category)?

I thought I could work backwards and figure it out after successfully following post #1 in this forum...but I can't. I feel one file that should be editted is /includes/modules/YOUR_TEMPLATE/product_listing.php another user commented that the header.php needed to be updated but I still don't know .php well enough to follow the logic.

Anyone able to offer some guidance? Thanks in advance.

ZC 1.5.5
Add ons: - Column/Grid 1.3.8 - Dual pricing 1.7 - ImageHandler3

7 Sep 2011, 8:04 PM
#117
idc1 avatar

idc1

Zen Follower

Join Date:
Jul 2011
Posts:
139
Plugin Contributions:
0

Re: How To Add New Product Fields?

idc1:

This hasn't been clearly addressed in this forum yet so here is my question: What needs to be done to include the new field in the product listing page (I'm referring to when you click the lowest subcategory and then you get all of the products available under that category)?

I thought I could work backwards and figure it out after successfully following post #1 in this forum...but I can't. I feel one file that should be editted is /includes/modules/YOUR_TEMPLATE/product_listing.php another user commented that the header.php needed to be updated but I still don't know .php well enough to follow the logic.

Anyone able to offer some guidance? Thanks in advance.

Any suggestions/pointers out there?

ZC 1.5.5
Add ons: - Column/Grid 1.3.8 - Dual pricing 1.7 - ImageHandler3

25 Oct 2011, 4:47 PM
#119
sappster avatar

sappster

New Zenner

Join Date:
Jul 2011
Posts:
13
Plugin Contributions:
0

Re: How To Add New Product Fields?

Not sure if this is still open or not but I am getting an error and need help. I have looked over my code for hours and cannot figure it out!

On the public side I can see the new field just fine for my products. On the admin side when I create a new product I see the text box with the new field. However, when I click on an existing product I get this error. Note** I have also gone into phpmyadmin and added values to my existing products using INSERT products_extra_info (products_id, products_colorcode)
SELECT products_id, '' FROM products

1146 Table 'eStore.products_extra_info' doesn't exist
in:
[select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_price_1, p.products_price_2, p.products_price_3, p.products_price_4, p.products_price_5, p.products_price_6, p.products_price_7, p.products_price_8, p.products_virtual, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id, p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute, p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max, p.products_sort_order, p.products_discount_type, p.products_discount_type_from, p.products_price_sorter, p.master_categories_id, pdex.products_colorcode from products p, products_description pd, products_extra_info pdex where p.products_id = '2' and p.products_id = pd.products_id and p.products_id = pdex.products_id and pd.language_id = '1']
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

10 Nov 2011, 6:28 AM
#120
jonathanbee avatar

jonathanbee

New Zenner

Join Date:
Oct 2007
Posts:
19
Plugin Contributions:
0

Re: How To Add New Product Fields?

Hi, I followed these directions and successfully added a field.

It works great, but after a couple weeks I noticed that when I copy a product, and then proceed to edit that product, I get:

Warning: reset() [function.reset]: Passed variable is not an array or object in /includes/classes/object_info.php on line 29

Warning: Variable passed to each() is not an array or object in /includes/classes/object_info.php on line 30

And all product fields are blank. I can add a new product, just copying doesn't work. Anybody know why the copy product would stop working?