-
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.
-
Re: How-To: Add new Properties to your Products
Hi,
I've carefully read this thread - I want to tailor Zencart to fit my needs better: not just the catalog but also the Admin side of things, as more than just I will be admin-ing the store.
Early on in the thread there was a post about adding a table to the database that would contain the fields being added - this as opposed to simply adding fields to existing tables. I'm trying to determine the risks involved in these two approaches:
1. if the file structure of the database is ever updated, will new (non-standard to Zen) tables be a. erased? b. ignored? c. updated?
2. in the scenario above except instead of a new table, fields have been added to existing tables, will the new fields (non-standard to Zen) be a. erased? b. ignored? c. updated?
On the php pages side of things, I *think* I've finally got my head around using templates. Let's say I have a template called 'roses', for which there is a folder called roses in the
/store/includes/templates
folder. Then, if I change a file anywhere in the store, I simply add a folder called roses and place my modded file in it. For example, in the
/store/includes/languages/english/
I modified index,php. I added a folder called roses:
/store/includes/languages/english/roses/
into which I placed my modded index.php
This seems to work right the way round the shop... and from what I've read, will keep updates from overwriting your mods. My question is: will this same approach work for modded product_x.php files, i.e., pages that reference new fields and tables?
I hope that last question wasn't too obscure... can't think of a different, clearer way of asking it...
Thanks to all that reply...
-
Re: How-To: Add new Properties to your Products
Never mind, think I might have found the answers here...
-
Re: How-To: Add new Properties to your Products
Hi, I have read this thread and its great stuff.
I am choosing to create a new DB table called "product_recess_attr" it will contant products_id to link it to products
I've added into the query TABLE_PRODUCT_RECESS_ATTR(IN RED), but I get the following error:
1146 Table 'zencart.TABLE_PRODUCT_RECESS_ATTR' doesn't exist
Do I need to define this table elsewhere in zencart?
Thankyou in advance.
if (isset($_GET['pID']) && empty($_POST)) {
$product = $db->Execute("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_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,
pra.products_min_hole
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_RECESS_ATTR . " pra
where p.products_id = '" . (int)$_GET['pID'] . "'
and pra.products_id = '" . (int)$_GET['pID'] . "'
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
dukie6675
Hi, I have read this thread and its great stuff.
I am choosing to create a new DB table called "product_recess_attr" it will contant products_id to link it to products
I've added into the query TABLE_PRODUCT_RECESS_ATTR(IN RED), but I get the following error:
1146 Table 'zencart.TABLE_PRODUCT_RECESS_ATTR' doesn't exist
Do I need to define this table elsewhere in zencart?
Thankyou in advance.
if (isset($_GET['pID']) && empty($_POST)) {
$product = $db->Execute("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_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,
pra.products_min_hole
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_RECESS_ATTR . " pra
where p.products_id = '" . (int)$_GET['pID'] . "'
and pra.products_id = '" . (int)$_GET['pID'] . "'
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
I figured out how to define the database table in the: database_tables.php file, now I get this error:
Warning: reset() [function.reset]: Passed variable is not an array or object in /web/zen-cart/admin/includes/classes/object_info.php on line 29
Warning: Variable passed to each() is not an array or object in /web/zen-cart/admin/includes/classes/object_info.php on line 30
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
dukie6675
I figured out how to define the database table in the: database_tables.php file, now I get this error:
Warning: reset() [function.reset]: Passed variable is not an array or object in /web/zen-cart/admin/includes/classes/object_info.php on line 29
Warning: Variable passed to each() is not an array or object in /web/zen-cart/admin/includes/classes/object_info.php on line 30
HTML Code:
if (isset($_GET['pID']) && empty($_POST)) {
$product = $db->Execute("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_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,
pra.products_min_hole
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_RECESS_ATTR . " pra
where p.products_id = '" . (int)$_GET['pID'] . "'
and p.products_id = pd.products_id
and p.products_id = pra.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
it looked like you where trying to get the id twice. the only id you need to get is p.products_id and link all others.
not sure if this will even work with out allot of other files being edited.
adding your own tables is a great idea but to edit the core files dose not make it easy when they change or up date the programing you should try to place your files in an overrides folder when you can. you should link the table where needed and make all the files you edited into a override file so you can keep your changes. otherwise you should just add the fields to your products table if you not going to do this to keep your information.
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
poolprorich
HTML Code:
if (isset($_GET['pID']) && empty($_POST)) {
$product = $db->Execute("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_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,
pra.products_min_hole
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_RECESS_ATTR . " pra
where p.products_id = '" . (int)$_GET['pID'] . "'
and p.products_id = pd.products_id
and p.products_id = pra.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
it looked like you where trying to get the id twice. the only id you need to get is p.products_id and link all others.
not sure if this will even work with out allot of other files being edited.
adding your own tables is a great idea but to edit the core files dose not make it easy when they change or up date the programing you should try to place your files in an overrides folder when you can. you should link the table where needed and make all the files you edited into a override file so you can keep your changes. otherwise you should just add the fields to your products table if you not going to do this to keep your information.
Does my pra.products need to be defined elsewhere? I get an error that it doesnt like passing a variable.
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
callingrohit
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.
I would also like to add to my message something i just forgot to write earlier...
it is very important to also update the file copy_to_confirm.php so as to transfer all the fields appropriately over to the duplicate product.
Otherwise if you don't update this file with the new fields, the data within the fields will not be carried over to the duplicate product.
have fun !!!
-
Re: How-To: Add new Properties to your Products
Great thread but wondering if this is the way to go for what I need. I sell digital books which have a book #, author, publisher and published date info. I would like the products page to show all these info and be linkable (eg. author is linked to other books of same author) and also be able to search by author and publisher.
Is it better and easier to use this mod or use attributes? If I use attributes, it may seem that I will be creating a LOT of Option Values since there are thousands of authors and publishers but at least they will be uniform - no chance of duplicate authors and pubs. Then there is the issue of zen product updates losing my data or making it not compatible using this mod - there will eventually be over 100,000 products! :wacko:
As for the book #, I can use the Products Model field. For the published date, I can just put that in the product description.
Thanks!
-
Re: How-To: Add new Properties to your Products
First off all great thread !! Helped me a lot.Managed to add new field to my product description.
Added 1 new field - "products_fit" (same as "product_description") to TABLE_PRODUCTS_DESCRIPTION ,
and 1 new field - "product_fiton" (true or false ) to TABLE_PRODUCTS_DESCRIPTION to check if to display "product_fit" to the products info display page, as i dont need this feature to all of my products.
Every thing work fine and displays OK until i want to check "products_fiton" if to display additional description on product.
This is the code that i used:
PHP Code:
<!--eof Product description -->
<!--bof Product fit -->
<h2 id="productPrices" class="productGeneral"></h2>
<?php $products_check = $db->Execute("select * from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '$products_id'");
if ($products_check->fields['products_fiton'] != "0") {
} else {
?>
<div id="productDescription">
<a href="javascript:animatedcollapse.toggle('jason')"><h1 id="productName" class="productGeneral">Show all vehicles which match</h1></a>
<div id="jason" style="background: #FFFFCC; display:none">
<?php if (!empty($product_info->fields['products_fit'])) echo $product_info->fields['products_fit']; ?></div>
<?php } ?>
<!---eof Product fit -->
For the check feature display true or false i have edited only tpl_product_info_display.php
I got inspired from the Dual Pricing Addon.
this way it does not display enyting from the additional description.Maybe some one can give a hint here to look for the mistake...
Also i am preparing a post with the steps that i used to make the additional fields: they are editable over the Admin with prewiew, multilanguage suport and work with Easypopulate.
Best regards Zoli.
-
Re: How-To: Add new Properties to your Products
Hi crazy_chris, I have been able to apply this and it works. So I was able to add other properties like format, publisher, author, etc to my bookshop. However, I tried to add things like Sample page, Table of contents but it would not work because, the text boxes seem to only accept one line of text. So for any bulleted information such as Table of Contents, it would only place the first line when I try to paste copied article in it only the first line would paste. Is there a way to make it look like the product description text box so it can accept multiple lines of texts even in pasting?
Again is there a way to make it linked texts such that I can type "Table of Contents" and create a hyperlink to a place where it would show the Table of Contents in a page of its own?
I would really appreciate any support on this.
Uche (vastcollection.com)
-
Re: How-To: Add new Properties to your Products
I had some time today and i managed to solve my problem:
not to show on all my products the new field that i have added to products_description table.I managed that by checking another new field from table products_description, if set to 0 not to show new field and if set to 1 show the new field on product info display page.
this is the code i used
PHP Code:
<!--bof Product fit-->
<?php if ($product_info->fields['products_fiton'] != "1") {
} else { ?>
<div id="productDescription">
<a href="javascript:animatedcollapse.toggle('jason')"><h1 id="productName" class="productGeneral">Arata toate modelele la care se potriveste</h1></a>
<div id="jason" style="background: #FFFFCC; display:none">
<?php if (!empty($product_info->fields['products_fit'])) echo $product_info->fields['products_fit']; ?>
</div>
<?php } ?>
<!--eof Product fit -->
Best regards Zoli
-
Re: How-To: Add new Properties to your Products
Greetings,
I have followed the direction over and over and over and still can't get it to work..
Everything works, except it dosnt show the value on the product view on the site, in Admin everything is working fine, the vaules even come up in PHPAdmin and i can change them in Admin as much as i want, it just won't show the vaule on the product view.
Here is what i am talking about;
http://www.agelessartifacts.com/stor...&products_id=1
Here is a copy of the coding, it is combine with the Austpost shipping model.
http://www.agelessartifacts.com/private/catalog.rar
-
Re: How-To: Add new Properties to your Products
Anyone have any ideas on how to add the new field to product listing. I have added delivery info to my product info. What I need is for my customers to be able to see this in my product list also. I have successfully added it to product info page but still puzzling away trying to get it in product listing. Any ideas anyone?
-
Re: How-To: Add new Properties to your Products
Just wondering if anyone has managed to get this working using google maps on a product info page.
As far as I see you could add as instructed in this thread and then, possibly, use the relevant co-ordinates to produce the map - in theory anyway!
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
janekbar5
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/ind...dex&cPath=3_10
Thanks in advance.
Hi janekbar5, thanks for the great information that you provided, i tried everything, but i can't seem to some the added information on the product listing page.
i went through every single posting on this thread, there is something missing i can find it, i checked this website that you posted http://www.zancart137.may.com.pl/ind...&cPath=3_67_71
it's exactly what i'm looking for, if you can help me i would realy appreciate it.
thanks
-
Re: How-To: Add new Properties to your Products
This has really been a great post and has helped a tons, so let me start by saying thanks !!
i have figured out how to get my new fields to a new table and have also gotten my products_model to write to multiple tables, but the big problem im having is getting the Products_name to write to my `products` table as well as the `product_description` table?? i have gotten it to write, but when i check, the field only shows 'Array' any suggestions would be greatly appreciated. also if anyone is still looking for help on how to write to a new table, let me know and ill try to help.
-
Re: How-To: Add new Properties to your Products
janekbar5, i really want to know how you did that table view with the extra fields.
thanks.
-
Re: How-To: Add new Properties to your Products
ok heres what i did
created a new table called zen_bisac, then added the table in the includes/database_tables.php
define('TABLE_BISAC', DB_PREFIX . 'bisac');
on both collect_info.php and preview_info.php i added the following
################################################################################################################################################################
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
################################################################################################################################################################ __
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_BISAC . " bs
i also added my extra fields above that
################################################################################################################################################################ ___
$product = $db->Execute("select pd.products_name, pd.products_description, pd.products_url,
################################################################################################################################################################ ___
$product = $db->Execute("select pd.products_name, pd.products_description, pd.products_url,bs.products_model,bs.pages,bs.month,bs.year,bs.dewey,
on collect info i made sure to add the datafields that will display on page
<tr>
<td class="main"><?php echo 'Pages '; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '13') . ' ' . zen_draw_input_field('pages', $pInfo->pages, zen_set_field_length(TABLE_BISAC, 'pages')); ?></td>
</tr>
<tr>
<td class="main"><?php echo 'Pub Month '; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '13') . ' ' . zen_draw_input_field('month', $pInfo->month, zen_set_field_length(TABLE_BISAC, 'month')); ?></td>
</tr>
<tr>
<td class="main"><?php echo 'Pub Year '; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '13') . ' ' . zen_draw_input_field('year', $pInfo->year, zen_set_field_length(TABLE_BISAC, 'year')); ?></td>
</tr>
<tr>
<td class="main"><?php echo 'Dewey '; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '13') . ' ' . zen_draw_input_field('dewey', $pInfo->dewey, zen_set_field_length(TABLE_BISAC, 'dewey')); ?></td>
</tr>
on collect_info.php i added the following lines
$tmp_value = zen_db_prepare_input($_POST['pages']);
$pages = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['month']);
$month = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['year']);
$year = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['dewey']);
$dewey = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['products_model']);
around line 100 or so add the query
$db->Execute("insert into " . TABLE_BISAC . "
(products_id, products_model, pages, month,year,dewey)
values ('" . (int)$products_id . "', '" . $_POST['products_model'] . "', '" . $pages . "', '" . $month . "', '" . $year . "', '" . $dewey . "')");
that should pretty much do it !!!!
-
Re: How-To: Add new Properties to your Products
Hi zskiman,
i followed your posting step by step, everything worked fine, the new fields show on the admin area when adding a new product, but it doesn't show on the product description and product listing pages, is there something i'm missing here, can you please help.
thank you.
-
Re: How-To: Add new Properties to your Products
this may not be the best way, or there may be a better way to query from zen, but this is how i add to tpl_products_display.php
at the top of page
############################################################
// ***SQL Statement***:
$prod_run= "SELECT * FROM zen_bisac WHERE products_model='$products_model'";
$query_result = mysql_query($prod_run) or die(mysql_error());
while($row = mysql_fetch_assoc($query_result)) {
$month = $row[month];
$year = $row[year];
$dewey = $row[dewey];
$pages = $row[pages];
};
########################################################################################################################
then wherever you want to display the variables just echo them
echo 'Publication Date: ' . $month . '/' . $year . '<br>';
and so on...
you can also use some if statements to make sure they dont show if they are empty!!
if ($month != ''){
echo 'Publication Date: ' . $month . '/' . $year . '<br>';
};
-
Re: How-To: Add new Properties to your Products
didn't work.
i'm trying to do exactly like this website http://www.zancart137.may.com.pl/ind...&cPath=3_67_71
-
Re: How-To: Add new Properties to your Products
I'm still reading over all of the posts here, but I need to go to church (please God forgive me for the words that pass thru my lips as I work on PHP code :censored:) and hoping someone might be able to answer my questions so I can finish this up tonight when I get home.
I have followed the steps to add fields. I added 5.
All went well, and I can see them when adding or editing a product... BUT ... after preview (which doesn't show the info) I update or insert and the info disappears from Admin and never does show from the customer's view.
Is this happening because I installed EP this morning? Does this work at all with EP? I'm only up to page 7 of the thread here and what I've seen so far says it doesn't work with EP (which I didn't know until after the fact), but now I'm hoping that in the million posts to follow it was decided that it could work with it! That is my MAIN FOCUS ... to take a exported file of comics from a website that I have some of my comics loaded into and with a bit of reworking the file, I can then use to EP the site....we have over 30,000 comics, so we NEED easy :lookaroun.
Any hope?:unsure:
Thanks!
-
Re: How-To: Add new Properties to your Products
Would just like to add that I found a post in this thread that mentioned to add the correct tpl_product_info_display.php edits to the one in your custom template for it to work...so I edited the file in
/includes/templates/darkness/templates because I'm using the darkness template.
Still doesn't work :no:.
I can see the fields in Admin add/edit a product.
I can enter info into the fields.
Once I click on Update/Insert it all disappears and nothing EVER shows in the customer view :cry:
HELP!!!! :Flush:
-
Re: How-To: Add new Properties to your Products
i had the same problem, when i added the extra fields on the admin area, and when i enter some info there it is showing on the product info page, but not on the product listing page where it shows all the products under one sub-category.
so i donno if anyone found a solution for this, i'v been asking about hints for a long time, but no one seems to know or care i guess.
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
hovsepations
i had the same problem, when i added the extra fields on the admin area, and when i enter some info there it is showing on the product info page, but not on the product listing page where it shows all the products under one sub-category.
so i donno if anyone found a solution for this, i'v been asking about hints for a long time, but no one seems to know or care i guess.
Well, I can't seem to get it to show anywhere! It won't stick in the fields.
PLEASE somebody help!!!!!
I have tried to work my site without it, but I need this info!
Is it because of EP? Can adding fields work with EP? Is there another thread that lets you add fields to EP AND to Admin?
PLEASE PLEASE PLEASE... someone let us know how to get this to work or where we've made errors that are causing the info to not stick! I sitll have 5 more stores to finish :wacko:
-
Re: How-To: Add new Properties to your Products
i have followed this to a T, but im getting this error
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 'condition = 'new', products_image = '11275698.jpg', products_last_modified = now' at line 1
in:
[update products set products_quantity = '95', products_type = '1', products_model = '', products_price = '69.9900', products_price_w = '0', products_date_available = null, products_weight = '2', products_status = '1', products_virtual = '0', products_tax_class_id = '1', manufacturers_id = '0', products_quantity_order_min = '1', products_quantity_order_units = '1', products_priced_by_attribute = '0', product_is_free = '0', product_is_call = '0', products_quantity_mixed = '1', product_is_always_free_shipping = '0', products_qty_box_status = '1', products_quantity_order_max = '0', products_sort_order = '0', products_discount_type = '0', products_discount_type_from = '0', products_price_sorter = '69.9900', manufacturer_country = 'usa', condition = 'new', products_image = '11275698.jpg', products_last_modified = now(), master_categories_id = '113' where products_id = '204']
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.
any ideas what this could be?
-
Re: How-To: Add new Properties to your Products
I am receiving the same exact "1064 You have an error in your SQL syntax" message. I followed the same instructions as well but when I try to insert, or update, a product, I get the error. I have NO idea where to begin to try and resolve this...
-
Re: How-To: Add new Properties to your Products
I believe I have found the solution to the "1064...error". When I added my new fields to the products table I used "pattern_style, condition, mark".
I kept getting the 1064 error regardless of what I tried...including uninstalling, reinstalling, manually installing, and on, and on, and on...
I ended up changing my new fields to "products_pattern_style, products_condition, products_mark", and of course made the same changes to the php files that were referenced on the 1st page and that was it. No more 1064 error! Hopefully this will help someone else out. I'm still not sure why I needed the prefix "products_" in the table and am curious to know why. So if you know why...please fill me in!
-
Re: How-To: Add new Properties to your Products
Firstly, Thanks for this - The step by step guide was great. But I did fond one or two things that might need adding to it, and may be the reason why others are having problems
Here is one quick example:
Quote:
p.products_price_sorter, p.master_categories_id,
p.products_lining
from "
Notice the "," after p.master_categories_id - You need to put that "," in there if your putting the new line of code after. p.master_caterories_id was the last line so it didnt need the "," at the end, but now it is not last and you need to add the ","
Other than that - I was wondering if there is a way to add the field to an EP file.
Any ideas, or even where to go looking.
I will have a search around to see if firstly, its possible and secondly, how to do it. But if anyone does know can they post it here or pm me. Ill drop by again later..
Cheers, and thanks again for this step by step guide :)
Its made things so much simplier for me - I hate using atribute so this is perfect.
Chow for now
DB
-
Re: How-To: Add new Properties to your Products
Try to use the info in that thread but nothing works...:frusty:I was able to add my fields in the data base but can't seem to display them...:frusty:Can someone tell which file to modify to change the products display when listing a category?Many Thanks
-
Re: How-To: Add new Properties to your Products
The step by step guide by the OP is very clear. There must be something you may have done wrong without realising.
Best thing to do is double check you have entered everything properly. for example...
The OP wrote
Quote:
db manipulation
open the table "products" in your zencart-database and insert new rows at the end of the table called "products_guarantee" and "products_color"
ALTER TABLE `zencart_products` ADD `products_guarantee` INT NOT NULL , ADD `products_color` VARCHAR( 32 ) NOT NULL;
did you change the table names to suit your database, ie: ALTER TABLE `zen_products`............
Did you do as I said in my previous post.. adding the comma ","
In collect_info.php and preview_info.php, when you add the lines p.products_guarantee, p.products_color (or what ever you called them for your database) you need to make sure to add a comma at the end of the last line before you add the above lines.
I know, very simple things, but easy to miss too.
Im not great at explaining things, but hope it helps
DB
-
Re: How-To: Add new Properties to your Products
is there anyone who did this whole thing and worked for them???
because what i'm trying to do is to
1-add extra fields in my products table (which i was able to do)
2-add them to the admin section (which i was able to do)
3-show them on the product details page (worked too)
4-show them on the product listing page, that's when you click on a category name and lists all the products (can't do it yet) (HELP NEEDED!!!)
if anyone can find a solution for this or find a solution already please post it here, i'll be thankful.
thanks a lot.
-
Re: How-To: Add new Properties to your Products
Hi hovsepations,
I could actually do with something similar so I am going to have a go at it tonight, if I get it to work I will post here for you.
regards
DB
-
Re: How-To: Add new Properties to your Products
Could not figure it out, sorry.
-
Re: How-To: Add new Properties to your Products
Ok, so I finally managed to display my new field 'products_botanical' that I added with the routine of crasy_chris. Thanks by the way!
But in order to show it in products_listing, I had to replace 'PRODUCT_LIST_BOTANICAL' by 8 in $define_list in main_template_vars. If I echo the size of column_list it returns only the 4 that are supposed to be displayed set in the admin section.
1- How can I change/add a column to column_list?
2- Where is 'PRODUCT_LIST_BOTANICAL' defined?
3- How can I change where that column would display?
Also, the sort through that column doesn't work, and now I am really lost...:frusty:
you can see my site at
practitioners.springwind.com
Thanks for any input on how to fix the issues.
Fred
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
yakbuttertea
Ok, so I finally managed to display my new field 'products_botanical' that I added with the routine of crasy_chris. Thanks by the way!
But in order to show it in products_listing, I had to replace 'PRODUCT_LIST_BOTANICAL' by 8 in $define_list in main_template_vars. If I echo the size of column_list it returns only the 4 that are supposed to be displayed set in the admin section.
1- How can I change/add a column to column_list?
2- Where is 'PRODUCT_LIST_BOTANICAL' defined?
3- How can I change where that column would display?
Also, the sort through that column doesn't work, and now I am really lost...:frusty:
you can see my site at
practitioners.springwind.com
Thanks for any input on how to fix the issues.
Fred
Ok, so maybe that will help someone like me that was having issues displaying their new fields:
- If you follw the step describe around page 6-7-8 (don't remember sorrywhich page exactly) everything will be in place but not displaying. Don't panic, you have to define the constant PRODUCT_LIST_BOTANICAL somewhere and that is defined in the admin section. It tells the program that that column is the number 'x' to be displayed at the 'x' position. So once you define it it will magically appear... Well the way I did it is define it on /includes/module/pages/index/main_template_vars.php instead of putting 'PRODUCT_LIST_BOTANICAL' => PRODUCT_LIST_BOTANICAL, I did 'PRODUCT_LIST_BOTANICAL' => 8 and it worked. :happy:
- Now I have an other question, how can we have the alpha filter working on the new field?
Thanks!
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
hovsepations
is there anyone who did this whole thing and worked for them???
because what i'm trying to do is to
1-add extra fields in my products table (which i was able to do)
2-add them to the admin section (which i was able to do)
3-show them on the product details page (worked too)
4-show them on the product listing page, that's when you click on a category name and lists all the products (can't do it yet) (HELP NEEDED!!!)
if anyone can find a solution for this or find a solution already please post it here, i'll be thankful.
thanks a lot.
Look at my posting maybe that is your answer...
-
Re: How-To: Add new Properties to your Products
thanks yakbuttertea,
i'm gonna try it and see how it works for me.
i'll let you know:clap:
-
Re: How-To: Add new Properties to your Products
I'm selling computer equipment, which has very many different properties (for instance size, how much ram, cpu etc.), so I almost need to add 50 different ones that only show when filled in admin console.
But before I begin I wondered if it’s smart to do it this way, if not what do you advice?
-
Re: How-To: Add new Properties to your Products
Does someone know how to work with alpha filter?I am trying to have my new field sorted by the alpha filter. So far, the filter sort only by the Item column.How can we add an other filter or choose which column the filter will work on?
-
Re: How-To: Add new Properties to your Products
I have posted a mix of the OP solution on this thread and the one by zskiman (mid thread) plus my own additions which allows the creation of new product fields, held in a separate table and declared so they can be inserted into the page in the same manner as existing fields.
http://www.zen-cart.com/forum/showthread.php?t=120523
Hopefully of use to someone.
G
-
Re: How-To: Add new Properties to your Products
Does anybody know how to add an additional IMAGE field to the product table?
I need this to display a special image at a place other than main image or additional images.
I managed to add various fields which all show up fine both in admin and catalog but the newly created image field isn't shown nor is the file-name in the database as it should be. I simply copied some parts from the main image for this new image field. It is displayed on the preview_info.php but gets lost on its way to be stored.
Can someone give a hint on this issue? Thanks in advance!
-
Re: How-To: Add new Properties to your Products
I've added without problems many new fileds in my products page like this:
hhttp://www.dvdmart.it/shop/007-il-m...a-p-91410.html
now i'm trying to add many of these fiels in products_all listing, featured, new etc.
my work:
includes/modules/product_listing.php
near line 30:
case 'PRODUCT_LIST_NAME':
$lc_text = TABLE_HEADING_PRODUCTS;
$lc_align = '';
$zc_col_count_description++;
break;
case 'PRODUCT_LIST_MYFIELD':
$lc_text = TABLE_HEADING_MYFIELD;
$lc_align = '';
$zc_col_count_description++;
break;
near line 100:
case 'PRODUCT_LIST_MODEL':
$lc_align = '';
$lc_text = $listing->fields['products_model'];
break;
case 'PRODUCT_LIST_MYFIELD':
$lc_align = '';
$lc_text = $listing->fields['products_myfieldsqlname'];
break;
includes/modules/pages/index/main_template_vars.php
near line 136:
// create column list
$define_list = array(
'PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
'PRODUCT_LIST_MYFIELD' => PRODUCT_LIST_MYFIELD,
near line 163:
switch ($column_list[$i])
{
case 'PRODUCT_LIST_MODEL':
$select_column_list .= 'p.products_model, ';
break;
case 'PRODUCT_LIST_MYFIELD':
$select_column_list .= 'products_myfieldsqlname, ';
break;
includes/index_filters/default_filter.php
near line 28, 43, 58, 73:
$listing_sql = "select " . $select_column_list . " p.products_id, p.products_myfieldsqlname,
near line 117:
case 'PRODUCT_LIST_NAME':
$listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
break;
case 'PRODUCT_LIST_MANUFACTURER':
$listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_MYFIELD':
$listing_sql .= "p.products_myfieldsqlname" . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
near line 122:
case 'PRODUCT_LIST_MANUFACTURER':
$listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_MYFIELD':
$listing_sql .= "p.products_myfieldsqlname" . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
includes/modules/template/MYTEMPLATE/template/tpl_modules_products_all_listing.php
near line 42:
if (PRODUCT_ALL_LIST_MODEL != '0' and zen_get_show_product_switch($products_all->fields['products_id'], 'model')) {
$display_products_model = '<b>' . TEXT_PRODUCTS_MODEL . '</b>' . $products_all->fields['products_model'] . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_LIST_MODEL, 3, 1));
} else {
$display_products_model = '';
}
if (PRODUCT_ALL_LIST_MYFIELD != '0' and zen_get_show_product_switch($products_all->fields['products_myfieldsqlname'], 'myfield')) {
$display_products_myfield = '<b>' . TEXT_PRODUCTS_MYFIELD . '</b>' . $products_all->fields['products_myfieldsqlname'] . str_repeat('<br clear="all" />', substr(PRODUCT_ALL_MYFIELD, 3, 1));
} else {
$display_products_myfield = '';
}
near line 141:
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_MYFIELD') {
echo $display_products_model;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_MYFIELD') {
echo $display_products_myfield;
}
near line 177:
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_MODEL') {
echo $display_products_model;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_MYFIELD') {
echo $display_products_myfield;
}
includes/languages/MYTEMPLATE/english etc
define('TEXT_PRODUCTS_MYFIELD', 'My extra products field');
in my database i've added:
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (1200, 'Show my myfield', 'PRODUCT_ALL_LIST_MYFIELD', '2506', 'bla bla bla', 21, 13, NULL, '2006-07-05 13:59:40', NULL, NULL);
Nothing appear here:
http://www.dvdmart.it/shop/products_all.html
whats wrong?
Thanks!
-
Re: How-To: Add new Properties to your Products
i can't modify my last post, on
near line 141:
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_MYFIELD') {
echo $display_products_model;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_MYFIELD') {
echo $display_products_myfield;
}
right is
near line 141:
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_MODEL') {
echo $display_products_model;
}
if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_ALL_LIST_MYFIELD') {
echo $display_products_myfield;
}
thanks! :P
-
Re: How-To: Add new Properties to your Products
Resolved, ALONE. :dontgetit
-
Errors with this how-to
I tried using this but didn't get the desired results. On further delving I believe the original how-to is mistaken, and I'm not sure why it works for so many others.
I'm not a professional coder but I was able to fix it by replicating the way products_weight is handled. (I am adding height, length and width properties.)
I'm not sure if all the following additions are necessary, but they worked for me. The main problem is that copy_to_confirm.php was not modified in this how-to. All additions based on a property product_height.
1) update_product.php (in /admin/includes/modules/)
a) around line 30, ADD:
Code:
$tmp_value = zen_db_prepare_input($_POST['products_height']);
$products_height = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
b) around line 40 ($sql_data_array = ....), ADD:
Code:
'products_height' => $products_height,
2) copy_to_confirm.php (in /admin/includes/modules/)
a) around line 37 ($product = $db->Execute...) ADD:
b) around line 52 ADD:
Code:
$tmp_value = zen_db_input($product->fields['products_height']);
$products_height = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
c) around line 62 ($db->Execute("insert into " . TABLE_PRODUCTS . "....) ADD:
d) around line 79 (continuation of last statement) ADD
Code:
'" . $products_height . "',
I'm pretty sure these last two need to have the fields in the correct order that they appear in the table.
OK! Now I can enter the new properties and they actually get entered into the database!!! :clap:
-
Re: How-To: Add new Properties to your Products
Hi shen,
I have made a modified version of the steps from this thread here which has worked for many. Note I have also added a bit here to ensure the extra product data is deleted when deleting a product.
G
-
Re: How-To: Add new Properties to your Products
I installed a new text field and got it right the first time. Woo Hoo! :clap::clap::clap:
One trivial question... on the admin side, when I fill out the information, my new text field shows up at the bottom of my product listing page. Where do I need to go to move it up, right under my title?
I already moved it up on my product info page that people can see, but on the admin side it would be nice to have the subtitle field I just created go directly under the title field.
Thanks!
KD
-
Re: How-To: Add new Properties to your Products
Hi
Look at the 1 page of this post it will be in
edit 'collect_info.php' (in /admin/includes/modules/product/),
edit 'preview_info.php' (in /admin/includes/modules/product/) or
edit 'update_product.php' (in /admin/includes/modules/)
don't remember now.
-
Re: How-To: Add new Properties to your Products
It doesn't say specifically which file controls where the text field appears on the admin side when filling out product details. With 3 different files and 5-6 different edits, I don't want to mess this up before I start. Anyone else have an idea of which file it would be, and where I would look to re-order the fields?
Thanks,
KD :smile:
-
Re: How-To: Add new Properties to your Products
It was in the collect info.php file. Thank you! :smile:
-
Re: How-To: Add new Properties to your Products
Hello Everyone!
I've searched the thread and just can't seem to find the solution here. Does anyone know how to implement what Crazy Chris showed us here with Easy Populate. I've done all the steps in the first post and uploaded the files where everything appears successful but the new information I was hoping to see is not showing up. Thanks to you all for such a great thread!
http://makemyhousegreen.com/index.ph...oducts_id=9364
Thats a link to one of my products which should display the new information
Thanks again everyone
-
Re: How-To: Add new Properties to your Products
Ok - I think I am almost there -
but I niow have this errors mess in my products table
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampplite\htdocs\snfcart\admin\includes\modules\product\collect_info.php on line 47
here is my line in that file:
if (isset($_GET['pID']) && empty($_POST)) {
$product = $db->Execute("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_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_skilltype'
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd,".
TABLE_PRODUCTS_SKILLTYPE . " 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'] . "'");
Ideas please?
-
Re: How-To: Add new Properties to your Products
Hi with regard to this - it is very useful - thank you. However I am using tabbed products, I actually want these added fields showing up on the details tab. I have tried playing around with the tpl_products_info_display but can't get it to work.
Website is www.bike-force.co.uk which I have been working on for a couple of weeks - first time using zen cart. Also My lite box has stopped working.... Any help would be appreciated - thanks.
You will see I have done a basic if statement that displays item delivery time if out of stock taking this value from the newly created field. It will display "standard delivery time" if it is in stock. But I would like to place this data next to the stock field - but can not do this simply by placing code next to it in product_info_display.
-
Re: How-To: Add new Properties to your Products
Hi,
i have read the thread and couldnt't find anything about language support. Is it also possible to add properties for different languages as with attributes? And if how?
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
Bikeforce
Hi with regard to this - it is very useful - thank you. However I am using tabbed products, I actually want these added fields showing up on the details tab. I have tried playing around with the tpl_products_info_display but can't get it to work.
Did you ever get this to work. I'm trying to do the same thing.
-
Re: How-To: Add new Properties to your Products
Code:
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_guarantee', $pInfo->products_guarantee, zen_set_field_length(TABLE_PRODUCTS, 'products_guarantee')); ?></td>
I need multi lines, how to do?
-
Re: How-To: Add new Properties to your Products
Can somebody explain how technicaly to"open the table "products" in your zencart-database"?
Where "table products" is located and what editor have to be used?
Thanks
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
Bikeforce
Hi with regard to this - it is very useful - thank you. However I am using tabbed products, I actually want these added fields showing up on the details tab. I have tried playing around with the tpl_products_info_display but can't get it to work.
Bikeforce,
I'm pretty certain your question should really be directed at the author of the tabbed mod since this is something funky with how that mod works.
I use the tabbed mod as well and just gave up on trying to get the details in a tab.
-lindasdd
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
yisou
Code:
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_guarantee', $pInfo->products_guarantee, zen_set_field_length(TABLE_PRODUCTS, 'products_guarantee')); ?></td>
I need multi lines, how to do?
You may want to repost your question. I don't think anyone knows what you are asking. What are multilines?
-lindasdd
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
idtags
Can somebody explain how technicaly to"open the table "products" in your zencart-database"?
Where "table products" is located and what editor have to be used?
Thanks
idtags,
You do this in your database tables. Probably in your hosting account via MySQL controls.
If you have no idea what any of that means you should probably contact your web host for assistance. I would hate to provide instructions because when dealing directly with the table you can really fudge things up.
-lindasdd
-
Re: How-To: Add new Properties to your Products
Anyone think they can make this work so different product details appear on the product listing page(in columns) based on category?
-lindasdd
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
yisou
Code:
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_guarantee', $pInfo->products_guarantee, zen_set_field_length(TABLE_PRODUCTS, 'products_guarantee')); ?></td>
I need multi lines, how to do?
No I ended up taking the turning that tab off and just using css -
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
smoke133
Did you ever get this to work. I'm trying to do the same thing.
sorry it quoted the wrong thing! No I turned the details tabs off and used CSS
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
lindasdd
Anyone think they can make this work so different product details appear on the product listing page(in columns) based on category?
-lindasdd
Quote:
Originally Posted by
lindasdd
Bikeforce,
I'm pretty certain your question should really be directed at the author of the tabbed mod since this is something funky with how that mod works.
I use the tabbed mod as well and just gave up on trying to get the details in a tab.
-lindasdd
Quite chirpy on this thread arent you Linda! Yes but the question related to this thread also as the newly created custom fields werent showing up in the details tabbs when the originals were - never mind I just settled with taking them out of the tabs.
With your second question I remember dabbling around with the product_listing.php in the modules folder of your template I added some custom fields to be displayed (displaying text related to stock quantity) but I think you want the next step and create a whole column - I think you just need to mimic the code that is there not entirely certian and i havent had time to test it but think you would need to add a new case statement:
case 'PRODUCT_LIST_PRICE':
$lc_text = TABLE_HEADING_PRICE;
like that and go through copying the format in a similar way to the beggining of this threads method - so do control f for price and work out whats happening for that column etc......some of the code is a bit funky so good luck - that's all I can tell you!
-
Re: How-To: Add new Properties to your Products
I have managed to add new peoprties to my products using the ideas in this thread ... thank you all sooooo much! And the field now appears in the product info page.
Now, I would like to take this a step further and add a title or heading to the field where it appears in the product info page.
Field Title: field value
so that it is more obvious to the customer what it is (e.g. Height: 50cm).
I used a version of this snippet of code .... to ensure it doesn't appear if there is nothing in the table for that field.
<?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>'; ?>
but do I need to add some code elsewhere ... the field value is working but how do I get the Field Title to appear (in a colour and as a heading)?
Thanks
Gillian
-
Re: How-To: Add new Properties to your Products
once you are done, can you share the total steps and the code, because i couldn't get to show the extra fields in the product listing page, i was able to show it in the admin area and the product info page only.
thanks.
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
Techiescot
...but do I need to add some code elsewhere ... the field value is working but how do I get the Field Title to appear (in a colour and as a heading)?
Gillian,
Unless you're querying one data field and supplying data from another field, then you have a mismatch between $product_info->fields['custom1_planets'] and $product_info->fields['products_custom1'].
Also, if "Planetary Body" is not the field title, which requires CSS for for color and heading specification, then I'm not sure what you are asking.
-
Re: How-To: Add new Properties to your Products
Hi
Thanks ...
I have used the following code to have the new product additional fields appear when they are filled in and disappear when there is no value for it ... but it isn't working.
Help!
The FIELD TITLE is still appearing whether there is a value for it or not.
Also, can someone help me to format the FIELD TITLES in Bold but not the values. I would like it to look like this ...
Measurements: 30 x 50
Materials: Glass and Aluminium
Maintenance: No Maintenance required
I am getting there slowly .... a case of trial and error ... but if someone could speed things up for me, I would be most grateful.
THANKS
Gillian
<!--bof Product New Properties -->
<div class="productaddfields">
<?php if(isset($products_measurements)) {
echo TEXT_PRODUCTS_MEASUREMENTS .$products_measurements ; }?><br />
<?php if(isset($products_materials)) {
echo TEXT_PRODUCTS_MATERIALS .$products_materials ; }?><br />
<?php if(isset($products_maintenance)) {
echo TEXT_PRODUCTS_MAINTENANCE .$products_maintenance ; }?><br />
</div>
<!--eof Product New Properties -->
-
Re: How-To: Add new Properties to your Products
Gillian -
My custom data is now running through Tabbed Products Pro, but from an old tpl_product_info_display.php file I found this line of code which shows the title in bold and the data in plain via my CSS file:
[FONT="Courier New"]
<?php if (!empty($product_info->fields['init_upc'])) echo '<tr><td class="detail-head">UPC » </td><td class="detail-copy">' . $product_info->fields['init_upc'] . '</td></tr>'; ?>[/FONT]
where init_upc is my custom data field, and I am 99% positive this did not show UPC » when there was no data value.
FWIW, in TPP, I have the following bit of PHP, which definitely does not show the title when there is no data value:
[FONT="Courier New"]
$fmtDOT .= (($flag_show_product_info_init_upc == 1 and !empty($init_upc)) ? '<li style="list-style:none;margin-left:-2.25em"><strong>upc</strong> ' . $init_upc . '</li>' : '') . "\n";[/FONT]
In the above example, like too many bits of hard-coded style values on my site, I have not yet converted it into CSS.
-
Re: How-To: Add new Properties to your Products
Hi
I actually got mine to work - trial and error again - but thank you for your comments and code.
Here is the code I am using:
<?php
if ($products_measurements != '') {
?>
<div id="productmeasurements" class="productGeneral"><strong>Measurements (in cm): </strong><?php echo $products_measurements; ?></div>
<?php
}
?>
<?php
if ($products_materials != '') {
?>
<div id="productmaterials" class="productGeneral"><strong>Materials: </strong><?php echo $products_materials; ?></div>
<?php
}
?>
<?php
if ($products_maintenance != '') {
?>
<div id="productmaintenance" class="productGeneral"><strong>Maintenance: </strong><?php echo $products_maintenance; ?></div>
<?php
}
?>
Now what I am wondering is whether I could put the data from the Measurements into a table ... so it looks like this:
http://www.gardenfurniturescotland.c...mentstable.jpg
Hope someone can help me .... you are all brilliant!
Gillian
-
Re: How-To: Add new Properties to your Products
My table HTML/CSS is awful -- I always have to look at examples -- but my guess is to run two IF statements for each set of data, one IF to write the title and another IF to write the value. Since no titles will be written for empty values and no values written for empty values, the table will shrink and expand appropriately.
Substitute/use the bits below into/with proper table HTML/CSS and you should be golden.
TITLES
<?php
if ($products_measurements != '') {
?>
<strong>Measurements (in cm): </strong>
<?php
}
?>
<?php
if ($products_materials != '') {
?>
<strong>Materials: </strong></div>
<?php
}
?>
<?php
if ($products_maintenance != '') {
?>
<strong>Maintenance: </strong>
<?php
}
?>
VALUES
<?php
if ($products_measurements != '') {
?>
<?php echo $products_measurements; ?>
<?php
}
?>
<?php
if ($products_materials != '') {
?>
<?php echo $products_materials; ?>
<?php
}
?>
<?php
if ($products_maintenance != '') {
?>
<?php echo $products_maintenance; ?>
<?php
}
?>
-
Filtering on the new fields?
Thanks to this thread I have successfully added fields to my product file and can maintain and display them.
But I need to be able to filter on them too.
By copying the manufacturers box I have added a sidebox for a search on my new colour field which seems to work ok but it never finds any products.
When I click on one of the colours in the sidebox I get the following url;
.../index.php?main_page=index&filter_id=colour_id&colour_id=1
I have a colour_id_filter.php module in /includes/index_filters/ but I'm not sure it is being included.
Does someone have a checklist for adding a new filter? I am sure I have missed some basic step in the process.
Any hints from someone who has been down this path before would be very welcome.
Thanks - Mark :dontgetit
-
Re: Filtering on the new fields?
Hi All,
I hope I'm not hijacking this thread...
I am working on a new jewelry site (categories: earrings, bracelets, rings, necklaces) for which I want to to specify some custom product attributes which are not choosable by the customer. I want to use these attributes to search and sort the products.
Let me explain with an example: Some pieces are gold, some are silver, some are plain, some have stones. None of the attributes are mutually exclusive. So, any piece of jewelry could have the attributes <gold, silver, plain, stone>. I want the user to be able to search and/or click on an attribute and display a list of all the products with that attribute. (i.e., "show me all the jewelry with stones" returns a list of all the necklaces, rings, earrings and bracelets with stones). I'm still shaking my head trying to figure out why this isn't a default feature in Zen Cart.
After looking at all the posts in this thread, I'm considering attacking the problem from a totally different angle:
1. Install the hidden categories mod (or some version of it). This step may not be entirely necessary.
2. Create a hidden category called "attributes". (or not hidden if step 1 is skipped).
3. Create sub-categories for all the attributes <gold>, <silver>, <plain>, <stones>, <animals>
4. Modify the <new product> page (collect_info.php?) to have a check-box list of these "attributes" sub-categories, checking these sub-categories will automatically link the product into the appropriate sub-categories.
5. Create a sidebar box to display the "attributes" sub-categories, or just make the "attributes" visible and use the regular side-bar. Voila! Clickable, dynamic, sortable, searchable attributes.
My thinking in this regard is that it will be:
a) potentially easier or as easy to implement as the database change methods from post #1
b) more flexible for my client to add and change attributes on-the-fly
c) easy to use the category browser to find out which products have which attributes, or which attributes have which products.
d) easy to search and display the items in these linked categories
Does anyone think this method might work or not work? I'm new to Zen Cart and don't want to spend a week barking up the wrong tree....
It sounds like the only real step in all of this is making a "category linker" on the product page.
I'd appreciate any tips in advance.
Thanks,
Damon
-
Re: How-To: Add new Properties to your Products
lunomad, I agree, ZC's attributes feature is less than it should be or is designed more for companies that do not (need or want to) control inventory tightly.
Ideally, a customer makes a product selection and then chooses attributes, and then the resulting choice has a unique model number that can be used again for that some combination. Back when I setup ZC, I generated model numbers myself for all the combinations but still couldn't get ZC to serve the correct model number given the choice of attributes. Instead, I went with a heavy cross-categorization organizational model that is not for the faint of heart. FWIW, I wanted to use the HiddenCats mod, but I couldn't get it to work in the way at the time (when I knew much less about ZC and hacking its and any mods' PHP files). Not sure even now that I could get ZC attributes to function the way I'd like them to work. Need way more experience for that and will hold out hope for ZC 3.0.
Good luck in finding something to work for you! And please do let us know of your solution.
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
crazy_chris
hi folks,
this is a little howto add new properties to general products
(like guarantee time, color, oem-number, compatible models, whatsoever)
- think
decide which new properties you want to add to your products
(in this example we take guarantee-time (in months) and color)
. - db manipulation
open the table "products" in your zencart-database and insert new rows at the end of the table called "products_guarantee" and "products_color"
ALTER TABLE `zencart_products` ADD `products_guarantee` INT NOT NULL , ADD `products_color` VARCHAR( 32 ) NOT NULL;
.
- edit 'collect_info.php' (in /admin/includes/modules/product/)
- at the very beginning there is the variable $parameters set. add your row-names to the end:
'products_guarantee' => '0', 'products_color' => '' );
. - just below there is the db-query set [$product = $db->Execute("...]
add your rows with a 'p.' in front (before the "from ..." part)
select ......., p.products_guarantee, p.products_color from ....
. - now you can add the input fields in the product-mask (lets say somewhere around line 450 or so):
<tr>
<td class="main">Guarantee Time (in months)</td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_guarantee', $pInfo->products_guarantee, zen_set_field_length(TABLE_PRODUCTS, 'products_guarantee')); ?></td>
</tr><tr>
<td class="main">Color</td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_color', $pInfo->products_color, zen_set_field_length(TABLE_PRODUCTS, 'products_color')); ?></td>
</tr>
.
- edit 'preview_info.php' (in /admin/includes/modules/product/)
somewhere around line 10 is the variable $product set. like in step 3.2 add the new rows with a 'p.' in front just before the 'from'
select ......., p.products_guarantee, p.products_color from ....
. - finally, edit 'update_product.php' (in /admin/includes/modules/)
around line 20 is the $sql_data_array set. add to the last lines before ');' the new rownames.
$sql_data_array = .......... 'products_guarantee' => zen_db_prepare_input($_POST['products_guarantee']), 'products_color' => zen_db_prepare_input($_POST['products_color']) );
. - Setup All Done!
.
.:D
.
.Of course, now we want to display our cool new properties .
.
- edit 'main_template_vars.php' (in /includes/modules/pages/product_info/)
around line 46 you find the variable $sql set. like in step 3.2 add the new rows with a 'p.' in front just before the 'from'
select ......., p.products_guarantee, p.products_color from ....
. - last step: display the new infos
edit 'tpl_product_info_display.php' (in /includes/templates/template_default/templates/)
now, wherever you want, you can add to the html:
<?php echo $product_info->fields['products_guarantee']; ?> and <?php echo $product_info->fields['products_color']; ?>
enjoy!
ps: now i'm feeling really ############ up : P
:blink::blink::blink:
written by chris at
linuxuser.at
Great and very simple tutorial! I have just add few new fields for short time following your instructions from post above. Thanks man :bigups::bigups:
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
lindasdd
Anyone think they can make this work so different product details appear on the product listing page(in columns) based on category?
-lindasdd
In case anyone is wondering I figured out how to do this. The scenario is - you added a new product field and you added a new column to the product listing page so you can see and sort by that new filed. But, you only want that field to appear based on certain categories.
So open includes/modules/pages/index/main_template_vars.php (if you can figure out a way to do this with overrides instead I recommend it)
Find this section:
Code:
"$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_IMAGE' => PRODUCT_LIST_IMAGE);
"
Right before it add your starting if statement, then right after it add your else and then right after that add your new column list.
So basically it looks like:
If category = X, show columns ABC, otherwise, show columns ABCD.
In my case I have:
Code:
if ($current_category_id =='92' ){
$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_IMAGE' => PRODUCT_LIST_IMAGE);
} else{
$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_IMAGE' => PRODUCT_LIST_IMAGE,
'PRODUCT_LIST_CUSTOMCOLUMN' => 8,
}
-
Re: How-To: Add new Properties to your Products
I would like to use this with the intention of adding new, used or refurbished so that it can be picked up by Google feeder.
Now I create a Google upload and have to change the condition for each item.
Will this work to accomplish this goal?
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
janekbar5
Hi
in my case I wanted to add about 20 .....
once you take a closer look you gonne now how to do it
This is exactly what I need but for some reason its not working for me......
Post #79
-
Re: How-To: Add new Properties to your Products
worked it out with the help of #153 and #145
Although this is slightly different...
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (1201, 'Show My Field', 'PRODUCT_LIST_MYFIELD', '1', 'MYFIELD', 8, 13, NULL, '2006-07-05 13:59:40', NULL, NULL);
you will need to change the configuration_id for each one
This was missing. it basically turns your new PRODUCT_LIST_MYFIELD on so you can see it. That is why it wasnt showing up before because it had no configuarion value. Good Helpful thred pointed me in the right direction good to see people sharing information.
even puts a box in the admin product listing so you can turn it off!
-
Re: How-To: Add new Properties to your Products
It would be good if anyone knew a way of putting quantity discounts on collect info page...
I have got it to display 10 by choice but posting it back is prooving difficult
-
Re: How-To: Add new Properties to your Products
Quote:
Originally Posted by
Bikeforce
worked it out with the help of #153 and #145
Although this is slightly different...
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (1201, 'Show My Field', 'PRODUCT_LIST_MYFIELD', '1', 'MYFIELD', 8, 13, NULL, '2006-07-05 13:59:40', NULL, NULL);
you will need to change the configuration_id for each one
This was missing. it basically turns your new PRODUCT_LIST_MYFIELD on so you can see it. That is why it wasnt showing up before because it had no configuarion value. Good Helpful thred pointed me in the right direction good to see people sharing information.
even puts a box in the admin product listing so you can turn it off!
Thanks so much for this - I figured this is why it wasn't showing but no one else bothered to stop over many different threads and give specific instructions and I was too lazy to try it myself!
One note however, replace the 1201 with '' and the field will automatically choose the next id number like this:
('', 'Show My Field', 'PRODUCT_LIST_MYFIELD', '1', 'MYFIELD', 8, 13, NULL, '2006-07-05 13:59:40', NULL, NULL);
The 4th field that has the number 1 in it will sort the display - leaving a 1 there makes the display sort by the number and then alphabetically but you can resort in the admin to get the display to work.
-
Re: How-To: Add new Properties to your Products
Hello everyone,
I don't know if anyone has referenced this page throughout this epic thread, but I thought that this webpage describing how to add new fields to products might be of use to someone somewhere sometime...
http://www.cornerpiecewebdesign.co.u...product-fields
The author referenced this particular thread as his starting point. I've followed his instructions carefully, and whilst it's not a quick method, it definitely works.
I hope it helps someone.
-
Re: How-To: Add new Properties to your Products
please help, I am trying to add new properties via a new DB table. The second post or so suggests doing it this way but I haven't found anyone posting on how to actually doing it this way. I don't want to mess anything up in the process and would greatly appreciate any response on how to do do. I am relatively new to PHP but learn quickly. Setting up the DB table is no problem at all but getting zen and Easy populate to link to it properly is where the problem lies. I have ideas of how to do it but again I want to get it right.
-
Re: How-To: Add new Properties to your Products
I am trying to add a couple of properties to the music product style. I have followed the instructions as specified at the beginning of this post but I made the changes to the files in /admin/includes/modules/update_products and /admin/includes/modules/products_music/collect_info and preview info . The two new properties appear on the product_info.php page.
THe database is updated each time I hit the update button but the database does not record what I enter for the new properties added.
I am not sure what I am doing wrong.
Should the code/ logic be any different for the music style verses product-general?
ANy ideas what would prevent the database from updating. TIA TOM :cool:
-
Re: How-To: Add new Properties to your Products
Ok...... I found a couple of typos and correct them.
Now I am receiving this error when I enter regular product.
1054 Unknown column 'products_sitchguide' in 'field list'
in:
[update products set products_quantity = '1', products_type = '1', products_model = 'SB', products_price = '34.0000', products_date_available = null, products_weight = '1', products_status = '1', products_virtual = '0', products_tax_class_id = '1', manufacturers_id = '1', products_quantity_order_min = '1', products_quantity_order_units = '1', products_priced_by_attribute = '0', product_is_free = '0', product_is_call = '0', products_quantity_mixed = '1', product_is_always_free_shipping = '0', products_qty_box_status = '1', products_quantity_order_max = '0', products_sort_order = '0', products_discount_type = '0', products_discount_type_from = '0', products_price_sorter = '34.0000', products_sitchguide = '', products_embellishment = '', products_image = 'categories/cat_symphony_bulky.png', products_last_modified = now(), master_categories_id = '26' where products_id = '168']
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.
It appears that the two fields I entered....... products_embellishment = '', products_embellishment = '' are not recognized.
When I do an insert of a music product, the two new fields are not recognized.
Since the fields I entered are NOT NULL, I receive and nothing is entered into those fields, there is an error message that the fields are blank
Any ideas on how I should progress. TIA TOM
-
Re: How-To: Add new Properties to your Products
Hello
First of all, I haven't read the whole thread since it is too long... So please excuse me if someone else has already commented this issue. Some time ago i applied the hack to add extra fields to the products. Everything was working fine... But yesterday a client warned me that these extra fields' contents were not getting copied when duplicating products in admin.
For those who want their extra fields to get duplicated, I share my solution (sorry, no line numbers, my code is too edited):
- Open file "admin/includes/modules/copy_to_confirm.php". Make a backup copy.
- If your new fields are in the "zen_products" table, find the select statement that says
Code:
$product = $db->Execute("select products_type, products_quantity, products_model, products_image,
etc. and add there your new fields names. Then find the statement that goes
Code:
$db->Execute("insert into " . TABLE_PRODUCTS . "
etc. and edit it to include your new fields values (in the fields names list as well as in the values list).
- If your new fields are inside the zen_products_description table, follow the same procedure, but editing, instead of the previous blocks of code, those beginning with
Code:
$description = $db->Execute("select language_id, products_name, products_description,
and with
Code:
$db->Execute("insert into " . TABLE_PRODUCTS_DESCRIPTION . "
.
Save, upload and that's it, your new fields will be duplicated when you duplicate a product.
As a side matter, I also noticed that products meta tags don't get duplicated either when duplicating a product. To solve this, you can add
Code:
$metas = $db->Execute("select language_id, metatags_title, metatags_keywords,
metatags_description
from " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . "
where products_id = '" . (int)$products_id . "'");
while (!$metas->EOF) {
$db->Execute("insert into " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . "
(products_id, language_id, metatags_title, metatags_keywords,
metatags_description)
values ('" . (int)$dup_products_id . "',
'" . (int)$metas->fields['language_id'] . "',
'" . zen_db_input($metas->fields['metatags_title']) . "',
'" . zen_db_input($metas->fields['metatags_keywords']) . "',
'" . zen_db_input($metas->fields['metatags_description']) . "'
)");
$metas->MoveNext();
}
someplace after
Code:
$description->MoveNext();
}
I hope this helps some people.
Oh, and sorry for my bad English (and the lack of line numbers).
Yako
-
Re: How-To: Add new Properties to your Products
Hi
I created some additional product fields using product_weight as the staring point ... and it all worked very well. However, I have upgraded to 1.3.9h and now the additional fields (measurements, materials, maintenance etc) will only show up if I have something in the product_weight fields. Has anyone got any idea of how this has happened - or, more importantly, how I get it to show something in any of the fields if they are filled in but leave the individual field (and title) blank if there is no data in that field.
Alos, I cannot get these fields to update via the Admin. The only way to update these fields is by filling in the fields directly into the database. This is not so good if I am checking for errors and spot a typo etc and just want to quickly change it.
Many many thanks, from very snowy Scotland
-
Re: How-To: Add new Properties to your Products
If you mean on the Catalog ... check your template for the Product _info and see if it is because you added your new product info in the IF statement:
Code:
<!--bof Product details list -->
<?php if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name))) ) { ?>
as this is setup to only show this section based 1 or more fields existing ... if your new data is inside that IF, but not one of the data components being tested, then it is turned off ...
-
Re: How-To: Add new Properties to your Products
Hi
Thanks a million. That is great - I managed to fix that problem.
Now, the next prolem I have is this... I have added 3 fields all based on the product_weight which are Measurements, Materials and Technical Details. The additional fields are fine if I populate them through the database but if I try to add something in the Admin > Catalogue > Product section, it doesn't seem to write it to the database for one of the fields (Technical - products_technical) but all the other new fields work. Which file do i need to look at? Is it the update product file?
In the update_product file I have the following code:
$sql_data_array = array('products_quantity' => $products_quantity,
'products_type' => zen_db_prepare_input($_GET['product_type']),
'products_model' => zen_db_prepare_input($_POST['products_model']),
'products_price' => $products_price,
'products_date_available' => $products_date_available,
'products_weight' => zen_db_prepare_input($_POST['products_weight']),
'products_measurements' => zen_db_prepare_input($_POST['products_measurements']),
'products_materials' => zen_db_prepare_input($_POST['products_materials']),
'products_technical' => zen_db_prepare_input($_POST['products_technical']),
'products_maintenance' => zen_db_prepare_input($_POST['products_maintenance']),
The extra fields I have created all update from the Admin product Info page, except for "technical" which just returns to blank after I press update. Any ideas why that might be?
Many many thanks
Gillian