Re: How-To: Add new Properties to your Products
I've been following this thread in hopes that the question was answered on how to show the new product field on the product listing page. I have successfully gotten it to show up in the admin on the product page and on the site on the individual product pages but would like to also see it when you click on a category and it lists all of the products at once.
I'm using the product listing column mod so I'm not sure if that is why I can't get the extra fields to show up on that page.
Heres the website I'm working on:
http://www.tilvee.com
If anyone has figured this out, please let me know.
Just to further clarify, when your on this page of the website:
http://www.tilvee.com/index.php?main...index&cPath=65
I would like to be able to see my newly added field underneath the product name.
Thanks!
Re: How-To: Add new Properties to your Products
Hi,
I have successfully installed this mode and love it. It was just what I was looking for.
I would like to point out something that may help someone else that is having a problem with getting the information to show up on the catalog side.
I installed all the code exactly where everything was said to go. I did not get it to show up on my product page the first time. So, I got looking at all my files and recalled I am not using the default template I use cherry zen. Looking in the includes/templates/cherry_zen/templates/ there was the same file that was in the templates default folder called tpl_product info_display.php!
I made the changes to this file and it worked.
So, if you don't use the the main template that comes with zencart or overrides this may be your problem too.
As for adding it to the other product pages..slow down and look. It's easier than you think.
I am still new to php and learning every day..
Thanks for this great mode!!!!!:D
Mack32
Re: How-To: Add new Properties to your Products
can somebody please tell me how to do step 2? the DB manipulation?
i use hostgator so i loged into the admin cp, my sql, myphpadmin
found the table products, and i cant seem to figure out how to add a column to the table.
i need to add a column that will be called "car make" which will allow people to not only browse by categories and manufacturer, but also by their car make (its a car parts store)
any input will be appreciated as i am new to this.
thanks!
Re: How-To: Add new Properties to your Products
credenscel,
To add this field to the database without going through your phpmyadmin copy and paste the following into your admin section in your zencart. Click on tools and scroll down to install sql patches and click on that.
Read all below before you do anything.
copy and paste the correct code
If you did not add a prefix to your database when you installed zencart then you would use this code
ALTER TABLE `products` ADD `products_car_make` VARCHAR( 32 ) NOT NULL;
If you did use a prefix when you installed zencart change the word zencart below to the prefix you used.
ALTER TABLE `zencart_products` ADD `products_car_make` VARCHAR( 32 ) NOT NULL;
example if you used cattail for your prefix than this is what it would look like.
ALTER TABLE `cattail_products` ADD `products_car_make` VARCHAR( 32 ) NOT NULL;
Now copy and paste the code into you install sql patches area and click send.
Hope this helps
Mack32
Re: How-To: Add new Properties to your Products
thank you very much for the input!! it worked!!!! :clap:
Re: How-To: Add new Properties to your Products
Glad I could help. :smile:
Mack32
Re: How-To: Add new Properties to your Products
Alright, I've followed this step by step, with an additional step to define the text before the output.
My question is this:
I am using this as a rating/ranking area that will display a value between 1 and 5, right now it display the number just fine, but I need it to display an image.
So if I enter 1 in the ranking box in the admin, it will display image1.gif in the product info, if I enter 4 into the ranking box in the admin it will display image4.gif into the product info etc....
How do I get it to do this ???
Awesome thread and kudos for this, it is really helping me a lot.
Re: How-To: Add new Properties to your Products
Alright..... I managed to figure it out !!!!
Here's the result
Quote:
<!--bof Product Historical Rating -->
<?php if (!empty($product_info->fields['products_historic'])) echo TEXT_HISTORICAL . zen_image(DIR_WS_TEMPLATE_IMAGES . $product_info->fields['products_historic'] . '.gif'); ?>
<!--eof Product Historical Rating -->
What this will do is take the number you input into the admin field, and turn it into an image that is called from the templates image folder.... so if you input 4 into the admin field for the historical ranking, then it will display 4.gif
Now it's time for another redbull and some advil.....
Re: How-To: Add new Properties to your Products
Thanks for this post, this makes it easy to add new properties to a product. I am having an issue though about being able to search from the Catalog\Categories/Products page of the admin site.
I added a new property called products_UPC which contains a UPC code for each product. I want to be able to search for the UPC code. Currently if I put a UPC in the search box and press enter it doesn't return any results. I know the UPC wasn't mis-typed as I'm using a barcode scanner to fill in the search field. Also, I know the UPC is in the DB because it comes up on the product page. I've even tried copying/pasting from the product page with no successful searches. I've successfully made it where you can search using "Advanced Search" from the home page by UPC and that works, just can't search from the Admin page.
Can someone point me in the right direction for getting this to work from the admin page?
Thanks,
Keith
Re: How-To: Add new Properties to your Products
Thank you chris for your excellent instructions.
I was able to add the field in the DB and collect_info & preview_info and other files but always missed out on update_info.php. After reading through your instructions I redid everything again, and then realized that the update file was right under my nose but always missed it.
I also updated the general.php >> function >> includes >> admin since my additional field required a function.
Now its all sweet.
Just to let everyone know, if you wanna add a field something like product_description, which would need some textarea, I would suggest you to add the extra field at the end of TABLE_PRODUCTS_DESCRIPTION instead of TABLE_PRODUCTS. Also, go through each of the files listed in the instructions (post #1 of this thread) and search for the product_description field and then add your field along with the product_description.
Also, while doing this it is very important that the order of fields as in DB is followed when appending the php commands related to the new field in various sql queries in the files. for a better explaination, if say in the DB of TABLE_PRODUCTS_DESCRIPTION you have fields
product_id
language_id
product_description
product_url
product_viewed
product_XYZ <new field appended into the table>
Now when you modify sql queries, they may be already written as in any of the files mentioned by chris as in the preview_info.php near line 43
PHP Code:
if (isset($_GET['read']) && ($_GET['read'] == 'only')) {
$pInfo->products_name = zen_get_products_name($pInfo->products_id, $languages[$i]['id']);
$pInfo->products_description = zen_get_products_description($pInfo->products_id, $languages[$i]['id']);
$pInfo->products_url = zen_get_products_url($pInfo->products_id, $languages[$i]['id']);
//THIS IS WHERE THE NEW FIELD WILL GO SINCE IT WILL FOLLOW THE ORDER OF FIELDS FROM THE DB TABLE
$pInfo->products_XYZ = zen_get_products_XYZ($pInfo->products_id, $languages[$i]['id']);
} else {
$pInfo->products_name = zen_db_prepare_input($products_name[$languages[$i]['id']]);
$pInfo->products_description = zen_db_prepare_input($products_description[$languages[$i]['id']]);
$pInfo->products_url = zen_db_prepare_input($products_url[$languages[$i]['id']]);
//THIS IS WHERE THE NEW FIELD WILL GO SINCE IT WILL FOLLOW THE ORDER OF FIELDS FROM THE DB TABLE
$pInfo->products_XYZ = zen_db_prepare_input($products_XYZ[$languages[$i]['id']]);
}
Hope this helps someone. Thanks chris.