Forums / Setting Up Categories, Products, Attributes / How-To: Add new Properties to your Products

How-To: Add new Properties to your Products

Views: 144,143

Results 61 to 80 of 272
29 Jan 2008, 3:27 PM
#61
27b_stroke_6 avatar

27b_stroke_6

New Zenner

Join Date:
Nov 2007
Posts:
8
Plugin Contributions:
0

How-To: Add new Properties to your Products

Hi all. I have a quick question on this procedure if someone would be kind enough to help me out.

I've followed this procedure exactly as outlined in the first post, and have successfully added six custom properties to my general products. THANKS SO MUCH crazy_chris!!!

I decided it would be nice to add similar custom properties for the Document - General "product" type as well. I set up the custom fields in the products table exactly as before, and made the same modifications to collect_info and preview_info, EXCEPT...

...in admin/modules/document_general
instead of admin/modules/product

The input fields are there, just as expected, when I go to create or update a Document - General product.

However, looking at the newly-created product in the database (via PHPAdmin) the values entered into the custom fields aren't being inserted into the database.

There's only one update_product file for all product types, and I did add the new custom properties to the SQL array right below where I added the previous ones.

I do notice that a little farther down in the update_product code, there are two sections:

  ///////////////////////////////////////////////////////
  //// INSERT PRODUCT-TYPE-SPECIFIC *INSERTS* HERE //////


  ////    *END OF PRODUCT-TYPE-SPECIFIC INSERTS* ////////
  ///////////////////////////////////////////////////////

  ///////////////////////////////////////////////////////
  //// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////


  ////    *END OF PRODUCT-TYPE-SPECIFIC UPDATES* ////////
  ///////////////////////////////////////////////////////

...but if I need to put something there, what needs to be put there unfortunately is a bit over my head.

Anybody care to share some thoughts on what I'm missing to insert these values?

29 Jan 2008, 4:39 PM
#62
27b_stroke_6 avatar

27b_stroke_6

New Zenner

Join Date:
Nov 2007
Posts:
8
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Update: I have manually populated the new fields through PHPAdmin, and:

  1. tpl_document_general_info_display shows the custom properties just fine

  2. document_general/collect_info pre-populates the fields with the new, manually-entered info when I view the product in ZC admin.

I haven't yet tried to "update" the product through ZC admin, because I'm afraid it'll reset the fields in the database to NULL :)

Seems everything works great except the insert. I really think it has something to do with product-type being 3 (Document - General) in update_product. But for the life of me, I can't seem to figure out why.

26 Feb 2008, 1:39 AM
#63
untitled10101 avatar

untitled10101

New Zenner

Join Date:
Jan 2008
Posts:
21
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Hello,

I have two question:

firstly, I went through all the steps, but I cannot see the textboxes to put my information in from the New Product admin control.

Secondly, is it possible to have a checklist of things: I have a car dealership. I would like to check off all of the features that the car has. Is that possible?

Thanks!

1 Mar 2008, 3:30 AM
#64
molywerks avatar

molywerks

Zen Follower

Join Date:
Aug 2006
Posts:
136
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Wish I could help someone out here cuz I am stumped with my problem.

This install how-to worked great for me! But for some reason the 20+ new fields are not getting searched. Anybody else having this problem? Did I miss something?

I've inserted hoobajonesfieldname in each new field of a test product (where fieldname is substituted by the, uh, field name), so I know the data is there, but when I search for each variation, no luck.

Ahhh, troubleshooting on a Friday night.

1 Mar 2008, 6:56 AM
#65
molywerks avatar

molywerks

Zen Follower

Join Date:
Aug 2006
Posts:
136
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Three and a half hours later less dinner and a dog walk, here is an answer to enhanced custom search.

1 Mar 2008, 9:54 PM
#66
janekbar5 avatar

janekbar5

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Hi
I follow this post and managed to add 2 extra fields (Size A and size B). But on the product overview they can't be sortable (like quantity or weight). Is anybody know wher the problem can be?. The example is on :
http://www.zancart137.may.com.pl/index.php?main_page=index&cPath=3_10

Thanks in advance.

1 Mar 2008, 10:37 PM
#67
molywerks avatar

molywerks

Zen Follower

Join Date:
Aug 2006
Posts:
136
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Open includes\index_filters\default_filter.php and includes\modules\pages\advanced_search_result\header_php.php.

Look at the areas surrounding the following fields and see how it is coded.

PRODUCT_LIST_MODEL
PRODUCT_LIST_MANUFACTURER
PRODUCT_LIST_QUANTITY
PRODUCT_LIST_IMAGE
PRODUCT_LIST_WEIGHT

I imagine if you follow the established code and do some cut-n-paste to add your fields in the same format that it ought to work or at least get you on the right track. That'd be my guess since I just edited those two files to handle the search for 20+ custom fields. And in the code notes, it mentions setting "the default sort order" before the fields I listed above.

1 Mar 2008, 11:07 PM
#68
janekbar5 avatar

janekbar5

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Many Many Thanks didn't expect it will be so easy

1 Mar 2008, 11:20 PM
#69
janekbar5 avatar

janekbar5

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

I got another question regarding product extra fields. Let say we got extra sizes A, B, C, D ...

Products in category 1 got sizes A, B, C
Products in category 2 got only sizes A, C

How to make if you leave blank size B for category 2 that is automaticly no visible
in product overview for category 2 so only sizes A and C are visible and there is no
empty space between them.

thanks in advance

2 Mar 2008, 1:32 AM
#70
molywerks avatar

molywerks

Zen Follower

Join Date:
Aug 2006
Posts:
136
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

<?php if (!empty($product_info->fields['custom1_planets'])) echo '<tr><td class="custom-head">Planetary Body:</td><td class="custom-body">' . $product_info->fields['products_custom1'] . '</td></tr>'; ?>

When the custom1_planets field has an entry, e.g. Saturn, then the above snippet of code will display (depending upon CSS, of course):

Planetary Body: Saturn

If the custom1_planets field is empty, then nothing is displayed, including the "Planetary Body:" portion. Mind your spaces, periods and single quotes.

2 Mar 2008, 4:58 PM
#71
janekbar5 avatar

janekbar5

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Many thanks for help.

But not sure where to place that code and which line. I that gonne be default_filter.php or maybe other?

3 Mar 2008, 9:57 AM
#72
molywerks avatar

molywerks

Zen Follower

Join Date:
Aug 2006
Posts:
136
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

tpl_product_info_display.php would be where I'd start. or try the product_listings file (forget its proper name). of course it depends upon on how you're setting up you're store. regardless, this piece of code goes in an html section.

5 Mar 2008, 9:43 PM
#73
oddep avatar

oddep

New Zenner

Join Date:
Mar 2008
Posts:
3
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

please help me

26 Mar 2008, 9:12 PM
#74
zep avatar

zep

New Zenner

Join Date:
Feb 2008
Posts:
29
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

I got this great mod going without a hitch, took about an hour to get right. I do have one question tho:

How can I display my custom fields in the product listing pages such as featured products, and categories? I also need to be able to sort by these custom settings.

Any help would be appreciated, and my hat's off to crazy for such a well described mod!:bigups:

27 Mar 2008, 3:27 AM
#75
molywerks avatar

molywerks

Zen Follower

Join Date:
Aug 2006
Posts:
136
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Zep, look at the last post of page 7 of this thread and mimic that code snippet (or wherever in this thread the echo statement is discussed. The feature product listing page is:

\includes\templates\template_default\templates\tpl_featured_products_default.php.

Not sure about categories but I think works off of product_listing file in the same directory or tpl_modules_product_listing.php. I forget.

If you need search capability, there's a link in another post of mine on page 7. Let me know if that's incomplete because I've got pretty comprehensive instructions for the admin side of things, too. I just haven't made the time to "anonymize" them.

I am assuming that by sort you mean, "Filter By:" which is what I want to eventually add to all my product listing pages. The default_filter.php file in includes\index_filters\ may affect sort, too. But it'll be awhile before I get to it myself.

27 Mar 2008, 2:49 PM
#76
janekbar5 avatar

janekbar5

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Hi Zep
Have you managed to display extra fields in product detail view?
If yes I will tell you how to display them in product list, but displaing fields in detail view is a first step to display them in list.

27 Mar 2008, 3:11 PM
#77
zep avatar

zep

New Zenner

Join Date:
Feb 2008
Posts:
29
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Thanks for the tips, but this issue is confusing me...

I change tpl_modules_featured_products.php, and my text displays fine. But the new fields do not display. do I need to include one of the other php files? I tried putting the info into variables, then placing them after the price, that does not work either :frusty:

the code I am using is something like this:

$case =$product_info->fields['products_case'];
$indiv = $product_info->fields['products_indiv'];

then echoing like this:

<div class="p_left"><br style="line-height:9px;"/>Case Price: <a href="'.$href.'">'.$price.$case.$indiv.' </a>

Please help!

27 Mar 2008, 3:57 PM
#78
zep avatar

zep

New Zenner

Join Date:
Feb 2008
Posts:
29
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Thank you janekbar5 and cartguin, I really appreciate all the help.

I have successfully displayed the information in the single item view (product_info), but want to be able to display the info if someone goes to browse featured products, or a category as well.

I will also be making a drop down box to sort (my custom fields are numbers) from low to high, and vise versa - but I have not done my due diligence on that yet, I'm focusing on getting them displayed first:smile:baby steps...

Thanks in advance for pointing me in the right direction!

27 Mar 2008, 8:51 PM
#79
janekbar5 avatar

janekbar5

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

Hi
in my case I wanted to add about 20 extra fields to each product. I follow this post and with help of the guys I managed to do it. Fields are visible in product details. Then I wanted to to make them visible in category overview (products listing) and make them also sortable like other fields(weight, price, manufacturer...) I managed to achive that. so if you managed to display those
extra fields in product details you are in half way. Now if you want do show those fields in product listing you must modify those files:
-includes/languages/english/index.php
standard fields:
define('TABLE_HEADING_QUANTITY', 'Quantity');
define('TABLE_HEADING_PRICE', 'Price');
define('TABLE_HEADING_WEIGHT', 'Weight');
define('TABLE_HEADING_BUY_NOW', 'Buy Now');
my new fields
define('TABLE_HEADING_NORMDIN', 'Norm DIN');
define('TABLE_HEADING_THREADSIZE', 'Thread size');
define('TABLE_HEADING_SIZEA', 'A mm');
define('TABLE_HEADING_SIZEB', 'B mm');
define('TABLE_HEADING_SIZEC', 'C mm');
define('TABLE_HEADING_SIZED', 'D mm');
-includes/modules/product_listing.php
you have to include your extra fields
similar to those standard
line about 20
case 'PRODUCT_LIST_MODEL':
$lc_text = TABLE_HEADING_MODEL;
$lc_align = '';
$zc_col_count_description++;
break;
case 'PRODUCT_LIST_NAME':
$lc_text = TABLE_HEADING_PRODUCTS;
$lc_align = '';
$zc_col_count_description++;
break;

and the same in line about 580
case 'PRODUCT_LIST_QUANTITY':
$lc_align = 'right';
$lc_text = $listing->fields['products_quantity'];
break;
case 'PRODUCT_LIST_WEIGHT':
$lc_align = 'right';
$lc_text = $listing->fields['products_weight'];
break;

    case 'PRODUCT_LIST_NORMDIN':
    if ($listing->fields['products_normdin']==0) {
    //hide image column
    $lc_text = '';
    $lc_align = '';
    }  else {
     //show image column
    $lc_align = 'right';
    $lc_text = $listing->fields['products_normdin'];
    }
    break;
          
    
    case 'PRODUCT_LIST_THREADSIZE':
    if ($listing->fields['products_threadsize']==0) {
    //hide image column
    $lc_text = '';
    $lc_align = '';
    }  else {
     //show image column
    $lc_align = 'right';
    $lc_text = $listing->fields['products_threadsize'];
    }
    break;

I got here extra condition if field is =0 field is not visible

includes/index_filters/default_filter.php

to add extra fields to sql querry like I did:

$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_normdin, p.products_threadsize, p.products_sizeA, p.products_sizeB, p.products_sizeC, p.products_sizeD,
p.products_sizeD1, p.products_sizeD2, p.products_sizeE, p.products_sizeE1, p.products_sizeF, p.products_sizeG, p.products_sizeH, p.products_sizeW, p.products_sizeX, p.products_sizeQG, p.products_sizeQX, p.products_peld, p.products_pelld, p.products_pehd, p.products_pa66, p.products_tpe,
p.products_peeva, p.products_pvc, p.products_pelldwasher, p.products_pa66oring, p.products_pelduvtreatment, p.products_injectedhole,
p.products_pa66washer, p.products_pehdwasher, p.products_pipethread, p.products_oldrefrence

there are 4 blocks with that querry in this file line from 28 to 105

and line 136
you can see standard fields and my new:
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_WEIGHT':
$listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;

    case 'PRODUCT_LIST_NORMDIN':
      $listing_sql .= "p.products_normdin " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
      break;          
    case 'PRODUCT_LIST_THREADSIZE':
      $listing_sql .= "p.products_threadsize " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
      break;          

last file is:
includes/modules/pages/index/main_template_vars.php
line 138
$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_NORMDIN' => PRODUCT_LIST_NORMDIN,
'PRODUCT_LIST_THREADSIZE' => PRODUCT_LIST_THREADSIZE,
'PRODUCT_LIST_SIZEA' => PRODUCT_LIST_SIZEA,
'PRODUCT_LIST_SIZEB' => PRODUCT_LIST_SIZEB,
'PRODUCT_LIST_SIZEC' => PRODUCT_LIST_SIZEC,
'PRODUCT_LIST_SIZED' => PRODUCT_LIST_SIZED,
'PRODUCT_LIST_SIZED1' => PRODUCT_LIST_SIZED1,
'PRODUCT_LIST_SIZED2' => PRODUCT_LIST_SIZED2,
'PRODUCT_LIST_SIZEE' => PRODUCT_LIST_SIZEE,
'PRODUCT_LIST_SIZEE1' => PRODUCT_LIST_SIZEE1,
'PRODUCT_LIST_SIZEF' => PRODUCT_LIST_SIZEF,
'PRODUCT_LIST_SIZEG' => PRODUCT_LIST_SIZEG,
'PRODUCT_LIST_SIZEH' => PRODUCT_LIST_SIZEH,
'PRODUCT_LIST_UVTREAT' => PRODUCT_LIST_UVTREAT,
'PRODUCT_LIST_INJECT' => PRODUCT_LIST_INJECT,
'PRODUCT_LIST_PA66WASH' => PRODUCT_LIST_PA66WASH,
'PRODUCT_LIST_PEHDWASH' => PRODUCT_LIST_PEHDWASH,
'PRODUCT_LIST_PIPETHREAD' => PRODUCT_LIST_PIPETHREAD,
'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);

and line 190
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_NORMDIN':
$select_column_list .= 'p.products_normdin, ';
break;
case 'PRODUCT_LIST_THREADSIZE':
$select_column_list .= 'p.products_threadsize, ';
break;
case 'PRODUCT_LIST_SIZEA':
$select_column_list .= 'p.products_sizeA, ';
break;
case 'PRODUCT_LIST_SIZEB':
$select_column_list .= 'p.products_sizeB, ';
break;
case 'PRODUCT_LIST_SIZEC':
$select_column_list .= 'p.products_sizeC, ';
break;
case 'PRODUCT_LIST_SIZED':
$select_column_list .= 'p.products_sizeD, ';
break;

once you take a closer look you gonne now how to do it

27 Mar 2008, 9:03 PM
#80
zep avatar

zep

New Zenner

Join Date:
Feb 2008
Posts:
29
Plugin Contributions:
0

Re: How-To: Add new Properties to your Products

I will try it out tomorrow, janekbar5 - I am eternally in your debt, thank you:wink: