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

How To Add New Product Fields?

Views: 83,922

Results 61 to 80 of 159
29 Oct 2009, 5:31 PM
#61
zahid_hussain avatar

zahid_hussain

New Zenner

Join Date:
Sep 2009
Posts:
54
Plugin Contributions:
0

How To Add New Product Fields?

yes i want to check your exact steps, then i think to change to my own filed,

the problem for me is comming in the file name collect_info. when i upload defaulte code file collect_info.php
then it ok,

i check that code with some one else but the query is perfect,

When i add a new product , and done insert then it give an error like
**
1054 Unknown column 'products_colour' in 'field list'
in:
[insert into products_box (products_colour, products_id) values ('5.5', '506')]
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.**

where 5.5 is color which i take a float and 506 i think is product_id

now plz told me what i do next,

Thanks
Zahid

29 Oct 2009, 5:48 PM
#62
webego avatar

webego

New Zenner

Join Date:
Oct 2008
Posts:
36
Plugin Contributions:
0

Re: How To Add New Product Fields?

You still have a reference to products_colour rather than your field products_box_size

29 Oct 2009, 5:52 PM
#63
zahid_hussain avatar

zahid_hussain

New Zenner

Join Date:
Sep 2009
Posts:
54
Plugin Contributions:
0

Re: How To Add New Product Fields?

Fisrt i want to add field then I will change according to my own filed,

please give me a way, i am very confused now.:frusty:

29 Oct 2009, 5:57 PM
#64
webego avatar

webego

New Zenner

Join Date:
Oct 2008
Posts:
36
Plugin Contributions:
0

Re: How To Add New Product Fields?

If you want to start with just my code then your new database table and new field name in mysql must be identical to the instructions.

30 Oct 2009, 5:20 PM
#65
zahid_hussain avatar

zahid_hussain

New Zenner

Join Date:
Sep 2009
Posts:
54
Plugin Contributions:
0

Re: How To Add New Product Fields?

Hi webego,

all the error are now removed, now the description is not showing on the product info page, please help me what i do now?
i just add the code like in product_info_display.php

<!--bof Product Colour --> <?php if ($products_colour != '') { ?> <div id="productColour" class="productGeneral"><strong>Colour: </strong><?php echo $products_colour; ?></div> <?php } ?> <!--eof Product Colour -->

what you say now, if any thinge else i left.

Thanks
Zahid:lamo:

30 Oct 2009, 5:39 PM
#66
webego avatar

webego

New Zenner

Join Date:
Oct 2008
Posts:
36
Plugin Contributions:
0

Re: How To Add New Product Fields?

Hi,

Which file did you edit? Make sure you have edited your own template override version of the file:

**includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php
**
Also, check you have done everything in step 7 including:

(line 101 for me amongst products name, model and description)
$products_colour = $product_info->fields['products_colour'];

30 Oct 2009, 6:31 PM
#68
webego avatar

webego

New Zenner

Join Date:
Oct 2008
Posts:
36
Plugin Contributions:
0

Re: How To Add New Product Fields?

Firstly I notice that you are missing a " at the end of your style declaration in your breadcrumb:

<!--content_center--> <!-- bof breadcrumb --> <div id="navBreadCrumb" style="background:#FFFFFF>

Should be:

<!--content_center--> <!-- bof breadcrumb --> <div id="navBreadCrumb" style="background:#FFFFFF"> This may have caused some problems.

As for the rest, in order to help further can you post the path and filename of exactly which file you edited and give a copy of the edited code for EVERY step of the script.

Can you also tell me the name of your new table and all fieldnames within it.

Hopefully we can find out what is missing.

30 Oct 2009, 6:52 PM
#69
zahid_hussain avatar

zahid_hussain

New Zenner

Join Date:
Sep 2009
Posts:
54
Plugin Contributions:
0

Re: How To Add New Product Fields?

Thank you, for your so cooperation!!!!

In which file I will check these code plz give me path.

<!--content_center--> <!-- bof breadcrumb --> <div id="navBreadCrumb" style="background:#FFFFFF">

now I going to past my path and file name.

  1. includes/database_tables.php file name == database_tables

  2. /var/www/dev01/zadhnanr/bestlaminate.net/admin/includes/modules/product
    file name==preview_info and collect_info

  3. /var/www/dev01/zadhnanr/bestlaminate.net/admin/includes/modules
    file name = =update_product

  4. /var/www/dev01/zadhnanr/bestlaminate.net/includes/modules/pages/product_info
    file name = =main_template_vars

  5. /var/www/dev01/zadhnanr/bestlaminate.net/includes/templates/theme006/templates
    file name = = tpl_product_info_display

I think with me , that main problem occure at according to your step 7. file name main_template_vars
And my edited code for this file is

p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter, pdex.products_colour
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_EXTRA_STUFF . " 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

at 101 line
$products_colour = $product_info->fields['products_colour'];

my table name is = = products_extra_stuff
with fileds are products_id and products_colour

Thanks

Zahid

30 Oct 2009, 7:37 PM
#70
zahid_hussain avatar

zahid_hussain

New Zenner

Join Date:
Sep 2009
Posts:
54
Plugin Contributions:
0

Re: How To Add New Product Fields?

Thanks Alot, it working now,
every thing is fine now.

:clap::clap::clap::clap::clap::clap::clap:

30 Oct 2009, 7:41 PM
#71
webego avatar

webego

New Zenner

Join Date:
Oct 2008
Posts:
36
Plugin Contributions:
0

Re: How To Add New Product Fields?

I really need to see all of the edited code to check over. I will PM you my email address and if you wish you can send me a copy of the edited files for me to look at.

With regard to the missing " in your breadcrumb, you can use the Developers Toolkit in your zencart admin which you will find under the Tools menu. The search at the bottom of this page is the most thorough.

30 Oct 2009, 7:42 PM
#72
webego avatar

webego

New Zenner

Join Date:
Oct 2008
Posts:
36
Plugin Contributions:
0

Re: How To Add New Product Fields?

Crossed posts with your success LOL. Glad to hear you have it sorted. What was the problem?

30 Oct 2009, 7:48 PM
#73
zahid_hussain avatar

zahid_hussain

New Zenner

Join Date:
Sep 2009
Posts:
54
Plugin Contributions:
0

Re: How To Add New Product Fields?

As i mention you, problem with file main_template_vars.php
and now i also used your query like

INSERT products_extra_stuff (products_id, products_colour)
SELECT products_id, 'YOUR_DEFAULT_VALUE_HERE' FROM products

where in my 'YOUR_DEFAULT_VALUE_HERE' =20 but at the user end it showing me,
Box Size == 3.3 for every product plz check the link

http://www.bestlaminate.net/index.php?main_page=product_info&cPath=106_108_134&products_id=380

now what u say Dear???????

30 Oct 2009, 7:59 PM
#74
webego avatar

webego

New Zenner

Join Date:
Oct 2008
Posts:
36
Plugin Contributions:
0

Re: How To Add New Product Fields?

I was just going to say make sure that in addition to the steps in the first post of this thread that you also perform the steps from the following posts later in the thread:

To delete from extra table when deleting a product:
http://www.zen-cart.com/forum/showpost.php?p=758231&postcount=31

To set a default value for existing products (if you had any before making these mods)
http://www.zen-cart.com/forum/showpost.php?p=783005&postcount=43

With that last step above, you would in your case have something like:

INSERT products_extra_stuff (products_id, products_colour)
SELECT products_id, '20' FROM products

or if you want to set the default as an empty string (different from NULL):

INSERT products_extra_stuff (products_id, products_colour)
SELECT products_id, '' FROM products

Check your new table in phpmyadmin to see if the defaults have been set for each of your products. There should be one record in this table for every product you have.

Any idea where 3.3 comes from? Did you set this as the default previously?

30 Oct 2009, 8:03 PM
#75
zahid_hussain avatar

zahid_hussain

New Zenner

Join Date:
Sep 2009
Posts:
54
Plugin Contributions:
0

Re: How To Add New Product Fields?

Thanks alot, your are very cooprative to me and also for every one, it working fine now.:clap:
plz stay online for some days , as i am working for client, if i found any problem? , then let you know.

Thanks
Zahid

4 Nov 2009, 11:26 AM
#76
zahid_hussain avatar

zahid_hussain

New Zenner

Join Date:
Sep 2009
Posts:
54
Plugin Contributions:
0

Re: How To Add New Product Fields?

Hi every one!!!
I add an extra field for the product, table with me field name is the box size, it working fine now, but now I have a problem , I want some calculation on the product filed, and after give some value by the user it done some calculation ,that give me a new price for that product, now I want that zencart will accept my this new calculated price and passed to add to cart.

Please help me here: http://www.zen-cart.com/forum/showthread.php?t=140939

4 Nov 2009, 5:46 PM
#77
llynix avatar

llynix

Zen Follower

Join Date:
Jul 2009
Location:
Texas
Posts:
210
Plugin Contributions:
0

Re: How To Add New Product Fields?

Using this thread I successfully added a "Condition" field to my products. Now all my products are marked as New, Refurbished or UNKNOWN (which I'll manually fix later)

A few notes:

The instructions webego has in post 1 are critical. I followed them exactly except I change products_colour to products_description.

http://www.zen-cart.com/forum/showthread.php?t=120523

Then the followup by webego is also critical:

http://www.zen-cart.com/forum/showpost.php?p=800718&postcount=74

I wanted a dropdown instead of a textbox so I followed the instructions from this post:

http://www.zen-cart.com/forum/showpost.php?p=729468&postcount=8

However I modified it slightly. I didn't want to use a database to store my option values and instead hardcoded them in. Here was the code I ended up with:

<!-- BOF - Additional field added -->
<?php
  $condition_array = array(array('id' => '', 'text' => TEXT_NONE));
  $condition_array[] = array('id' => 'New', 'text' => 'New');
  $condition_array[] = array('id' => 'Refurbished', 'text' => 'Refurbished');
?>

<tr>
<td class="main"><?php echo 'Condition: '; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '13') . ' ' .
zen_draw_pull_down_menu('products_condition',$condition_array, $pInfo->products_condition); ?></td>
</tr>
<!-- EOF - Additional field added -->

This replaces Step 5 in the original post.

Finally I was able to intelligently set my values because my product names 'mostly' started with New or Refurbished. So I came up with this SQL query to populate my table.

INSERT cart1_products_extra_stuff (products_id, products_condition)
SELECT products_id, IF( LOWER( LEFT( products_name, 3 ) ) = 'new', 'New', IF( LOWER( LEFT( products_name, 3 ) ) = 'ref', 'Refurbished', 'UNKNOWN' ) )
FROM cart1_products_description

Which probably isn't of much help to anyone but I wanted to show off :)

Anthony Taylor
Webmaster
http://buydentalequipment.com

DentalPlanet Designed/Administrated by Falls Geek

4 Nov 2009, 7:06 PM
#78
autoace avatar

autoace

Totally Zenned

Join Date:
Jun 2009
Posts:
618
Plugin Contributions:
0

Re: How To Add New Product Fields?

ALiepinieks:

it won't break it, it simply ignores any fields that are not defined in the easypopulate.php file located under admin/includes.
to define these additional/custom fields, you could simply do a search for a similar type field in the aforementioned file, and then add the extra code (where relevant) after you've added your database fields of course. you need to ue a bit of common sense, but it worked for me making all the changes required (to easypopulate) in under 10min.

andrejs

BTW, I am using the EZ Populate version from modhole.com - are you? Just asking because I do not want to take on this project without all the relevant info. Thanks for your help

Thank you,
autoace

4 Nov 2009, 11:03 PM
#79
aliepinieks avatar

aliepinieks

Zen Follower

Join Date:
Jun 2009
Location:
Brisbane, QLD AUS
Posts:
209
Plugin Contributions:
0

Re: How To Add New Product Fields?

i got my version from the "Free Software Add-ons" section here. Below is the start of the readme.txt...

*-------------------------------------------------
Easy Populate v1.2.5.5

Last updated: December 1, 2006
Author: see history.txt (has a long and bloody history...)*

...and below is the end of the history.txt...

*Modified by Adam S (phazei) phazei (at) gmail.com
Jan 8, 2009

v 1.2.5.5.csv

  • added normal csv support
  • removed split files, it wasn't needed I don't belive
  • added meta tags for products only on a 'full'/complete download
  • rewrote lots of bad code and added 'LIMIT 1' to many sql calls.
  • changed date function to 'strtotime()'
  • inserted new manufacturers into the MANUFACTURERS_INFO db as well
  • changed default temp directory to tempEP*

hope this helps.

6 Nov 2009, 5:06 PM
#80
stitchnkitty avatar

stitchnkitty

Totally Zenned

Join Date:
Jun 2009
Location:
Des Moines, Iowa USA
Posts:
618
Plugin Contributions:
0

Re: How To Add New Product Fields?

Delia - I have been looking for your mod as I have not been able to complete the conversions