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 81 to 100 of 272
28 Mar 2008, 1:30 AM
#81
molywerks avatar

molywerks

Zen Follower

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

How-To: Add new Properties to your Products

Thanks jane! I am going to add that tomorrow afternoon.

This is somewhat related and since I'm not sure how to go about it, maybe someone has already combined new fields to auto-generate a global field.

More specifically, how do I combine several of my new product detail fields (along with the mfr ID field) so that zen_products_description . products_name is created automatically? Essentially what is happening is that the products_name field is made up of several other fields. There is no need for it to be typed. IOW, the product name is controlled and consistent across the site.

Excusing the code, let's say the combined field protocol for products_name is:

$manufacturers_id . ' » ' . $details_model_name . $details_style . ' » ' $details_size . $details_orientation . ' » ' . $details_color

For example, when displayed, the products names would look like:

  • ACME » Medallion Trampoline » 18' round » blue and black
  • SILLY » Trampoline » 9'x12'
  • AVD » Slide » 12' high curlicue » clear painted aluminum

So, all the data is pulled from fields in the zen_products table (plus using the text conversion of manufacturer_id) based upon a conditional (the right angle brackets are only included if the following field contains something) and needs to be written into the products_name field in the zen_products_description table.

I've tried searching but my keywords are too general to get anywhere. Anybody have an idea of what PHP code is needed to do this?

28 Mar 2008, 4:43 PM
#82
zep avatar

zep

New Zenner

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

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

Jane,

I have modified the files, and Im sorry for such a questions, but....

I am having issues displaying the info in tpl_moduals_featured_products.php

I'm calling calling $case = $product_info->fields['products_case'];

and also tried $case = $featured_products>fields['products_case'];

Im then putting the var into this statement :

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

When I echo, I'm getting no output, so the variable I put it into is empty. Im sorry to seem so needy, but could you lend a tip?

Thanks

29 Mar 2008, 1:05 PM
#83
janekbar5 avatar

janekbar5

New Zenner

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

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

Hi
Your case may be bit diffrent than mine but if you send my your email I can send you all files which i modified so you can have look. mail me if you intredted.
Regards
Janek

30 Mar 2008, 4:12 AM
#84
zep avatar

zep

New Zenner

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

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

swne (at) sbcglobal.net....THANKS!!

18 Apr 2008, 5:16 PM
#85
greggshort avatar

greggshort

New Zenner

Join Date:
Apr 2007
Posts:
21
Plugin Contributions:
0

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

I've got everything working on the search results/ product listing including the sort for my custom field. Problem is that it always displays on the right, after the built in fields. Where is this order set in the code? (I know it's sent in admin-> product listing for the existing fields)

Thanks,

Gregg Short
GShort.com Web Marketing & Design

7 May 2008, 2:13 PM
#86
ipuce avatar

ipuce

New Zenner

Join Date:
Mar 2008
Location:
Canada
Posts:
1
Plugin Contributions:
0

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

Thanks for this tutorial!

But...

I don't know why, but my new Properties is not working correctly.

First of all, the value that I put on the admin page for a product is not put in the DB

Other problem: the new field not appear in the description in the store (client)

Can you help me?

I am a newbie and I don't "speak" PHP for the moment.

my email is ipuce [at] videotron.ca

Thank you!

8 May 2008, 3:06 AM
#87
svakanda avatar

svakanda

New Zenner

Join Date:
Apr 2008
Location:
Missoula, MT
Posts:
58
Plugin Contributions:
0

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

hey...I just implemented a product 'volume' property in my shopping cart by following the directions on the front page of this string. I wanted to say THANKYOU!!!! Your instructions have guided me exactly where I needed to go and it has taken a lot of stress off of my shoulders. Thankyou so Much! I even feel a slight bit confident now in mucking around with deep zencart. Sweet dreams! You've given me mine =)

15 May 2008, 3:02 AM
#88
silentshadow avatar

silentshadow

New Zenner

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

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

I have my new property showing up but it does not show the name of it. I am wanting to add an Item Number field to my products. I have everything showing up just fine in the admin area but its just showing the number on my actual store. here is an example http://silentshadow.oxyhost.com/index.php?main_page=product_info&cPath=1&products_id=123

As you can see it just shows "111" and thats it. It does not have the Item Number: in front of it. Any suggestions?

15 May 2008, 4:40 AM
#89
molywerks avatar

molywerks

Zen Follower

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

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

Try...

<?php if (!empty($product_info->fields['custom_item_number'])) echo '<li>Item Number: ' . $product_info->fields['custom_item_number'] . '</li>'; ?>

...where custom_item_number is the data field you added to the products table in the database.

15 May 2008, 5:45 AM
#90
silentshadow avatar

silentshadow

New Zenner

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

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

cartguin:

Try...

<?php if (!empty($product_info->fields['custom_item_number'])) echo '<li>Item Number: ' . $product_info->fields['custom_item_number'] . '</li>'; ?>
> 
> ...where custom_item_number is the data field you added to the products table in the database.

THANK YOU!!! I had to edit it just a little to get it to work but it works. thanks so much!
27 May 2008, 10:53 PM
#91
accyjohn avatar

accyjohn

New Zenner

Join Date:
Mar 2007
Posts:
21
Plugin Contributions:
0

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

Hi
Can you please help. I want to add a new property to the 'extras' fields for product type music. I think its table product_music and I want to add the field 'format'
These additional music fields are maintained via the admin screen 'extra's menu choice.

Thanks for any guidance.

John

2 Jun 2008, 6:20 PM
#92
gsto avatar

gsto

New Zenner

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

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

I am having a problem with this setup. I added the extra fields, and I can update them & have them show up just fine. I am having trouble getting them to show up on the listings page, where there are multiple products.

I found where the descriptions go (in product_listing.php) but whenever I try to execute a line like this, right before the description, it is always turning up null, even when data is there:

$c_height = $product_info->fields['products_height']

maybe $product_info can't be accessed from this page, is that the problem? it seems all the other data is getting from an array called $listings. do I need to edit another file to make sure that array can get to the new fields. if so, what file is it, and where do I find it?

6 Jun 2008, 7:08 PM
#93
illusionguy avatar

illusionguy

Zen Follower

Join Date:
May 2007
Posts:
136
Plugin Contributions:
0

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

zep:

Jane,

I have modified the files, and Im sorry for such a questions, but....

I am having issues displaying the info in tpl_moduals_featured_products.php

I'm calling calling $case = $product_info->fields['products_case'];

and also tried $case = $featured_products>fields['products_case'];

Im then putting the var into this statement :

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

When I echo, I'm getting no output, so the variable I put it into is empty. Im sorry to seem so needy, but could you lend a tip?

Thanks

Hey Zep, did you get this working, I'm trying to get my custom field to show up in the products_all page and I'm getting the same outcome it's like the field is empty...

This is the code I'm trying to use in the tpl_modules_products_all_listing.php, but it's only showing 0

if ($product_info->fields['products_on_order']){$products_on_order = $product_info->fields['products_on_order'];}else{$products_on_order = "0";}
     echo '<td align="left" width="18%">'.$product_info->fields['products_on_order'].' Units On Order: '.$products_on_order.'</td>';

Any help would be great thanks guys :smile:

9 Jun 2008, 2:13 PM
#94
zep avatar

zep

New Zenner

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

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

Yes I did get this working, I actually combined a different post to use the same template for all the listings (Note: search requires a different template)

http://www.zen-cart.com/forum/showthread.php?t=84174&highlight=single+listing

Its pretty strait forward, then and by adding the new fields to your MySQL queries for the particular display you are calling (new, featured,product), you can include them in your product info array, thus when they are called the information will actually be there:wink:

good luck, if you need another hint, shoot an email

also I used $case = $featured_products>fields['products_case'] the $featured_products query is where you need to add your new fields (use the developers toolkit)

9 Jun 2008, 2:21 PM
#95
zep avatar

zep

New Zenner

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

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

GSto: yes you are correct $product_info is the array that the SQL statement creates for the product info page, see above for the changes you must make for each view you wish to alter.

11 Jun 2008, 2:26 PM
#96
gsto avatar

gsto

New Zenner

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

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

zep:

GSto: yes you are correct $product_info is the array that the SQL statement creates for the product info page, see above for the changes you must make for each view you wish to alter.

Awesome, thanks. yeah, I finally got it working. About to try editing the search engine so that it can search by the new attributes.

And thanks to everyone else in this thread that posted lots of helpful information. The boss loved the new look!

24 Jun 2008, 3:32 PM
#97
jpauthement avatar

jpauthement

New Zenner

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

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

I'm having an issue with this mod. I followed all of the beginning steps. I was able to successfully add the custom fields to the database and admin section and have them display for each product.

But I'm wanting to do something like janekbar5 posted in post #66.
http://www.zancart137.may.com.pl/index.php?main_page=index&cPath=3_67_74

I would like my custom fields to show up on the categories page. I also followed this post http://www.zen-cart.com/forum/showthread.php?t=84174&highlight=single+listing like was suggested by zep on post 94. But that didn't accomplish what i wanted.

Are there any other resources that can point me in the direction to get the categories page to display the products in a list with the custom fields like this?
http://www.zancart137.may.com.pl/index.php?main_page=index&cPath=3_67_74

24 Jun 2008, 7:20 PM
#98
thebigkrumm avatar

thebigkrumm

New Zenner

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

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

This may be the most helpful post ever.

26 Jun 2008, 4:00 PM
#99
twdhosting avatar

twdhosting

Zen Follower

Join Date:
Mar 2005
Posts:
119
Plugin Contributions:
0

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

Okay - I'm trying to add a new DB property to the new products box on the index page...

I have created the DB field and followed all the instructions, and I know it works because I can call my new info from my new table 'products_itemprice' in the main product info.

BUT...

I cannot seem to find out how to replace the standard PRICE displayed in the new products listing on the front page!

I have edited the file /modules/new_products.php to include the relevent DB query here:

<code> if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_itemprice, p.products_price, p.products_date_added, p.products_qty_box_status, product_is_call, products_quantity from " . TABLE_PRODUCTS . " p where p.products_status = 1 " . $display_limit; } else { $new_products_query = "select distinct p.products_id, p.products_image, p.products_itemprice, p.products_tax_class_id, p.products_date_added, p.products_qty_box_status, product_is_call, products_quantity, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = 1 " . $display_limit; </code>

I now need to replace the price lookup with my new DB field info - so I tried changing:

<code> $products_price = zen_get_products_display_price($new_products->fields['products_id']); </code>

with this

<code> $products_price = $products->fields['products_itemprice']; </code>

But obviously my SQL query is pants :(

Any help please?

5 Jul 2008, 4:32 PM
#100
rstar23 avatar

rstar23

New Zenner

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

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

First many thanks to crazy_chris. After following the instructions, I have my new fields in the products table and am able to add data to them via the admin products panel.

My problem comes when I try to display the new fields in the product_info display.
I have followed the instructions re: adding the field in main_template_vars and tpl_product_info_display.php. I have verified that my additions are correct (no errors being thrown). Yet none of the data from new fields is showing.

I have the main_template_vars in an override directory but have also tried without the override.

The tpl_product_info_display.php is in an override for my custom template.

I have gone through this thread, and some others, but am not finding any answers that explain why my sql queries are not returning data for the new fields (at least this would certainly seem to be the problem). Maybe I am overlooking something obvious.

I am using 1.3.8a

Any advice would be deeply appreciated.


"He called you a cowboy. What are you?"
 "Just a humble bounty hunter, ma'am"