hibmem10 Posted March 23, 2007 Share Posted March 23, 2007 Hi Everyone, First of all i would like to thank you everyone for this great contribution. I installed the latest version, 2.0j .. everything works great. I question though How can i add the extra field to show in the admin/packingslip.php Or the admin/orders.php page? i try using the "products extra fields in emails" to use for the packingslip but i got an error i added this code on the top of packingslip.php // START: Add products extra fields to order email $products_ordered_extra_fields = ''; $extra_fields_query = tep_db_query(" SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef LEFT JOIN ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf ON ptf.products_extra_fields_id = pef.products_extra_fields_id WHERE ptf.products_id = " . tep_get_prid($order->products[$i]['id']) . " AND ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."') ORDER BY products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { $products_ordered_extra_fields .= "\n\t" . $extra_fields['name'] . ': ' . $extra_fields['value']; } // END: Add products extra fields to order email and i got the following 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 'AND ptf.products_extra_fields_value<>'' and (pef.languages_id=' SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM products_extra_fields pef LEFT JOIN products_to_products_extra_fields ptf ON ptf.products_extra_fields_id = pef.products_extra_fields_id WHERE ptf.products_id = AND ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='1') ORDER BY products_extra_fields_order [TEP STOP] please help me, i would really appreciate some help. Quote Link to comment Share on other sites More sharing options...
nadelo Posted April 18, 2007 Share Posted April 18, 2007 (edited) I would really like this functionality as well...anyone pull it off? Without Extra field contribution, you can do it with simples modifications. Here is a solution on the french community forum : http://www.oscommerce-fr.info/forum/index....showtopic=45038 Sorry, i have no time to translate ... Edited April 18, 2007 by nadelo Quote Link to comment Share on other sites More sharing options...
partsace Posted April 26, 2007 Share Posted April 26, 2007 Has anyone successfully added Extra Fields to includes/modules/product_listing.php? I have tried everything I know and have been working on it for 10 hours straight and still no success. I have tried the below code, but nothing shows up: // START: Extra Fields Contribution v2.0a $extra_fields_query = tep_db_query(" SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef LEFT JOIN ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf ON ptf.products_extra_fields_id=pef.products_extra_fields_id WHERE ptf.products_id=".(int)$products_id." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."') ORDER BY products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { echo '<b>'.$extra_fields['name'].': </b>'; echo $extra_fields['value'].'<BR>'; } // END: Extra Fields Contribution I would love some insight to this one. Thanks, Scott Quote Link to comment Share on other sites More sharing options...
Clau123 Posted May 14, 2007 Share Posted May 14, 2007 This week my provider changed some things. He was allready working with PHP5, but het changed a few things. one of the problems i have since than was: 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 'AND ptf.products_extra_fields_value<>'' and (pef.languages_id=' SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM products_extra_fields pef LEFT JOIN products_to_products_extra_fields ptf ON ptf.products_extra_fields_id = pef.products_extra_fields_id WHERE ptf.products_id = AND ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='1') ORDER BY products_extra_fields_order [TEP STOP] I tried a lot af things, and finally I changed a few things in catalog/product_info.php // START: Extra Fields Contribution v2.0i with fix for php 5 list($products_id_clean) = split('{', $product_info['products_id']); $extra_fields_query = tep_db_query(" SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef LEFT JOIN ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf ON ptf.products_extra_fields_id=pef.products_extra_fields_id WHERE ptf.products_id='".$products_id_clean."' and ptf.products_extra_fields_value<>'' and ptf.products_extra_fields_id = pef.products_extra_fields_id and (pef.languages_id='0' or pef.languages_id='".$languages_id."') ORDER BY products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { if (! $extra_fields['status']) // show only enabled extra field continue; echo '<tr> <td> <table border="0" width="50%" cellspacing="0" cellpadding="2px"><tr> <td class="main" align="left" vallign="middle"><b><font size="1" color="#666666">'.$extra_fields['name'].': </b></font>'; echo '<font size="1" color="#666666">' .$extra_fields['value'].'<BR></font> </tr> </table> </td> </tr>'; } // END: Extra Fields Contribution This is what I made of it and now the extra fields are working fine again. I changed this part: WHERE ptf.products_id='".$products_id_clean."' and ptf.products_extra_fields_value<>'' and ptf.products_extra_fields_id = pef.products_extra_fields_id and (pef.languages_id='0' or pef.languages_id='".$languages_id."') I hope this will solve the problems for some people. greetings Claudia Quote Link to comment Share on other sites More sharing options...
Guest Posted May 23, 2007 Share Posted May 23, 2007 Hi all, I've got a problem getting Products Extra Fields to work at all. New install, using ACA module. I have uploaded both product_extra_fields.php files, and the images. I have imported the sql file, and the tables are showing fine in phpMyAdmin. I am getting the following error on launching the admin/product_extra_fields.php page: 1146 - Table 'intrapump1.TABLE_PRODUCTS_EXTRA_FIELDS' doesn't exist SELECT * FROM TABLE_PRODUCTS_EXTRA_FIELDS ORDER BY products_extra_fields_order [TEP STOP] If I try and add a field, I get: The requested URL /shop/admin/FILENAME_PRODUCTS_EXTRA_FIELDS was not found on this server. I'm sure it's something daft, any answers? Nick. Quote Link to comment Share on other sites More sharing options...
carmelos Posted June 11, 2007 Share Posted June 11, 2007 I just got a Apostrophe FIX, that works pretty neat... here what you need to do: in admin/categories.php: find: if ($HTTP_POST_VARS['extra_field']) { // Check to see if there are any need to update extra fields. foreach ($HTTP_POST_VARS['extra_field'] as $key=>$val) { if (isset($extra_product_entry[$key])) { // an entry exists if ($val == '') tep_db_query("DELETE FROM " . products_to_products_extra_fields . " where products_id = " . (int)$products_id . " AND products_extra_fields_id = " . $key); else tep_db_query("UPDATE " . products_to_products_extra_fields . " SET products_extra_fields_value = '" . tep_db_prepare_input($val) . "' WHERE products_id = " . (int)$products_id . " AND products_extra_fields_id = " . $key); } else { // an entry does not exist if ($val != '') tep_db_query("INSERT INTO " . products_to_products_extra_fields . " (products_id, products_extra_fields_id, products_extra_fields_value) VALUES ('" . (int)$products_id . "', '" . $key . "', '" . tep_db_prepare_input($val) . "')"); } } } and replace with: if ($HTTP_POST_VARS['extra_field']) { // Check to see if there are any need to update extra fields. foreach ($HTTP_POST_VARS['extra_field'] as $key=>$val) { if (isset($extra_product_entry[$key])) { // an entry exists if ($val == '') tep_db_query("DELETE FROM " . products_to_products_extra_fields . " where products_id = " . (int)$products_id . " AND products_extra_fields_id = " . $key); else tep_db_query("UPDATE " . products_to_products_extra_fields . " SET products_extra_fields_value = '" . tep_db_input($val) . "' WHERE products_id = " . (int)$products_id . " AND products_extra_fields_id = " . $key); } else { // an entry does not exist if ($val != '') tep_db_query("INSERT INTO " . products_to_products_extra_fields . " (products_id, products_extra_fields_id, products_extra_fields_value) VALUES ('" . (int)$products_id . "', '" . $key . "', '" . tep_db_input($val) . "')"); } } } (I replaced tep_db_prepare_input($val) to tep_db_input($val)) And then in catalog/product_info.php find: $extra_fields['value'] and replace with: stripslashes($extra_fields['value']) -the last one is needed to get rid of the slashes, that your data are stored with in the database. (this also a fix for 1064 error, which I was getting when trying to add some data with slashes). Should work fine... :) Quote Link to comment Share on other sites More sharing options...
Guest Posted June 13, 2007 Share Posted June 13, 2007 like doing checkbox with extra fields in advanced_search and advanced_search_result. something thus, extra fields=aire in advanced search checkbox for aire example: http://www.carone.com.ar/carone-0km.php Quote Link to comment Share on other sites More sharing options...
Lule Posted June 14, 2007 Share Posted June 14, 2007 Hi @ all. I installed the Product-Extra fields contrib 2.0j. But now I have a problem: Every time when i create a product and write into my new fields, in the catalog will be displayed nothing. In the preview it works. Also when I edit the product the fields are empty? What i did wrong? I executed the SQL Code etc... Help, Thx Quote Link to comment Share on other sites More sharing options...
Lule Posted June 15, 2007 Share Posted June 15, 2007 i read the topic ca. twice and found now answer to this problematic! It seems like this problem isn't solved yet - isn't it? Is there any other contrib with which i can make such fields to be displayed in the products page? Thank you! Quote Link to comment Share on other sites More sharing options...
carpenoctem Posted June 22, 2007 Share Posted June 22, 2007 Actually there are some typos in that. This produces the desire looking link, but doesn produce the results. It's close I think there's a capsulation issue here. It's closer, can you see my problem, I don't quite understand the . escape($extra_field_value) . that you used, or how to apply it in my code. How would you do it here: // Added 021107 while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { if (! $extra_fields['status']) // show only enabled extra field continue; echo '<tr> <td width=30></td><td> <table border="0" width="400" cellspacing="0" cellpadding="2px"><tr> <td class="main" align="left" vallign="middle"><b><font size="1" color="#666666">'.$extra_fields['name'].': </b></font>'; echo '<font size="1" color="#666666"><a href="advanced_search_result.php?keywords="'. $extra_fields['value'].' ">'; echo $extra_fields['value']; echo'</a><BR></font> </tr></table></td></tr>'; } something like: // Added 021107 while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { if (! $extra_fields['status']) // show only enabled extra field continue; echo '<tr> <td width=30></td><td> <table border="0" width="400" cellspacing="0" cellpadding="2px"><tr> <td class="main" align="left" vallign="middle"><b><font size="1" color="#666666">'.$extra_fields['name'].': </b></font>'; echo '<font size="1" color="#666666"><a href="advanced_search_result.php?keywords='. $extra_fields['value'].'">'; echo $extra_fields['value']; echo'</a><BR></font> </tr></table></td></tr>'; } Which Seems to work real nice! Gonna run with that for a bit! WOW..... You have done some amazing work here... and it is nearly working for me.!!!! There is one little addition that I have been trying to figure out, and just not getting. Take a look at http://www.ir-usa.com/cat/product_info.php...;products_id=30 As you can see, I have several DIFFERENT options in the fields... and I would like each separate one to be searchable on the site. So How do I split it up from the database..... or can i??? Talk to you soon. Mark Quote Link to comment Share on other sites More sharing options...
carpenoctem Posted June 24, 2007 Share Posted June 24, 2007 One more thing.... how can I sort alphabetically the actual values that are set in the the "extra_fields_value" field. the site i am working on is going to always be adding more and more to some of the extra fields. Is there a way for me to be able to sort the values alphabetically... so i can just add the values at the end rather than having to alphabetize them myself.... with over 1500 products, alphabetizing takes a long time... especially when there are 3 fields for each product that need to be alphabetized. Thanks. Mark Quote Link to comment Share on other sites More sharing options...
carpenoctem Posted June 24, 2007 Share Posted June 24, 2007 One more thing.... how can I sort alphabetically the actual values that are set in the the "extra_fields_value" field. the site i am working on is going to always be adding more and more to some of the extra fields. Is there a way for me to be able to sort the values alphabetically... so i can just add the values at the end rather than having to alphabetize them myself.... with over 1500 products, alphabetizing takes a long time... especially when there are 3 fields for each product that need to be alphabetized. Thanks. Mark Quote Link to comment Share on other sites More sharing options...
Vassag0 Posted June 28, 2007 Share Posted June 28, 2007 hello, I'm trying to use the extra fields in the account_history_info.php file. I use the same codec that in checkout_confirmation.php, like this: // START: Extra Fields Contribution v2.0i with fix list($products_id_clean) = split('{', $products[$i]['id']); $extra_fields_query = tep_db_query(" SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value ,pef.products_extra_fields_status as status FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef LEFT JOIN ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf ON ptf.products_extra_fields_id=pef.products_extra_fields_id WHERE ptf.products_id=".$products_id_clean." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."') ORDER BY products_extra_fields_order"); $extra_fields = tep_db_fetch_array($extra_fields_query); // END: Extra Fields Contribution but the account_history_info.php show me this error: 1064 - You have an error in your SQL syntax near 'and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languag' at line 6 SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value ,pef.products_extra_fields_status as status FROM products_extra_fields pef LEFT JOIN products_to_products_extra_fields ptf ON ptf.products_extra_fields_id=pef.products_extra_fields_id WHERE ptf.products_id= and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='3') ORDER BY products_extra_fields_order anybody can help me to put extra field in account_history_info.php? Thanks Regards. p.d.: sorry for my bad english. Quote Link to comment Share on other sites More sharing options...
xiric Posted August 8, 2007 Share Posted August 8, 2007 Hi @ all. I installed the Product-Extra fields contrib 2.0j. But now I have a problem: Every time when i create a product and write into my new fields, in the catalog will be displayed nothing. In the preview it works. Also when I edit the product the fields are empty? What i did wrong? I executed the SQL Code etc... Help, Thx i have the same problem! pls help Quote Link to comment Share on other sites More sharing options...
xiric Posted August 8, 2007 Share Posted August 8, 2007 found it! forgot chapter 1.2 of the installation its working now now i must figure out how to get it working with STS Quote Link to comment Share on other sites More sharing options...
Guest Posted August 10, 2007 Share Posted August 10, 2007 Antonimo, I was wondering if you worked out how to fix this? I too am having the same problem, after I installed Product Extra Fields. Please let me know if you worked out how to correct this. Cheers, John. 1054 - Unknown column 'p2pef.manufacturers_id' in 'on clause' I have a clean and successful installation using oscommerce-2.2ms2-051113 with the UK Based osCommerce 2.2 contribution. No other changes made before installing extra_fields_v2_0j. Now, when I do a search, I receive the error: select count(distinct p.products_id) as total from (products p left join products_to_products_extra_fields p2pef on p.products_id=p2pef.products_id) left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%test%' or p.products_model like '%test%' or m.manufacturers_name like '%test%' or p2pef.products_extra_fields_value like '%test%') ) Is anybody able to suggest a fix for this? I have seen many posts in the forum, but I have not found one that can solve the problem. My MySQL version is 3.23 Quote Link to comment Share on other sites More sharing options...
xiric Posted August 16, 2007 Share Posted August 16, 2007 dod someone manage to get this working with latest version of STS ? Quote Link to comment Share on other sites More sharing options...
orosanto Posted August 20, 2007 Share Posted August 20, 2007 Has anyone come with a fix to get the extra field contrib to work when duplicating an item using the Copy To in admin? I tried a few down and dirty things (like copying the extra fields code block under case update_product to under case copy_to_confirm in category.php) to no avail. Quote Link to comment Share on other sites More sharing options...
orosanto Posted August 20, 2007 Share Posted August 20, 2007 Has anyone come with a fix to get the extra field contrib to work when duplicating an item using the Copy To in admin? I tried a few down and dirty things (like copying the extra fields code block under case update_product to under case copy_to_confirm in category.php) to no avail. Never mind. I just found Maureens post. Quote Link to comment Share on other sites More sharing options...
orosanto Posted August 20, 2007 Share Posted August 20, 2007 Never mind. I just found Maureens post. ..... and Claudia's Quote Link to comment Share on other sites More sharing options...
jnjn Posted August 21, 2007 Share Posted August 21, 2007 Hello all This is my first post (sorry in advance for my Inglish) I have one sugestion for the PHP master's and one solution (I think) for all who wont make work this contribution with the STS. link:http://www.oscommerce.com/community/contributions,2202/category,all/search,extra tell me if this work for you Sugestion: why not make extra filds to depend to category list this way when we enter in the products only have the filds they mach with the category and not all I trie to code but my php :blink: I think one way is to make one interface like optional_related_products contribution or when we add new fild in the products_extra_filds add a dropdown category list. and add a fild to the categories in products_to_products_extra_fields I'm wrong about this??? Thanks Quote Link to comment Share on other sites More sharing options...
Couch Fort Tim Posted August 21, 2007 Share Posted August 21, 2007 Hi @ all. I installed the Product-Extra fields contrib 2.0j. But now I have a problem: Every time when i create a product and write into my new fields, in the catalog will be displayed nothing. In the preview it works. Also when I edit the product the fields are empty? What i did wrong? I executed the SQL Code etc... Help, Thx I, also am having this problem. On the admin page, the extra fields and values show for my test item, but on the live site, they are not there. I looked at Xiric's "Oh I did 1.2 in the instructions and it worked" post and saw that my catalog\admin\categories.php already had this code in (from the 1.2 instructions), so I don't understand what is going on. Quote Link to comment Share on other sites More sharing options...
vanpuffelen Posted August 23, 2007 Share Posted August 23, 2007 Could somebody please put a url here where we can see thsi contrib in action and maybe ad a screenshot of the admin area in the contrib folder? Quote Link to comment Share on other sites More sharing options...
jimmygreaves Posted August 24, 2007 Share Posted August 24, 2007 (edited) Is it possible to edit this code <?php // START: Extra Fields Contribution v2.0b - mintpeel display fix $extra_fields_query = tep_db_query(" SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef LEFT JOIN ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf ON ptf.products_extra_fields_id=pef.products_extra_fields_id WHERE ptf.products_id=". (int) $products_id ." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."') ORDER BY products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { if (! $extra_fields['status']) // show only enabled extra field continue; echo '<tr> <td> <table border="0" width="440" cellspacing="0" cellpadding="2px"><tr> <td class="bodyCopy" align="left" vallign="middle"><b>'.$extra_fields['name'].': </b>'; echo '' .$extra_fields['value'].'<BR> </tr> </table> </td> </tr> <tr>'; } // END: Extra Fields Contribution - mintpeel display fix ?> So that only a particular "extra field" is displayed. This displays all the extra fields and lists them one after the other and it's not what I need in this instance. I have created several extra fields using this contribution but I only want the extra field titled "specification" displayed on my product info page. It's products_extra_fields_id on the database is "2" can I use that to call it from the code?????? HELP ME PLEASE!!!!!!!!!!! :D Edited August 24, 2007 by jimmygreaves Quote Link to comment Share on other sites More sharing options...
Guest Posted August 24, 2007 Share Posted August 24, 2007 Are there any step by step instructions for this module? I can't seem to find any in the most recent version - extra_fields_v2_0j. I need to weigh whether I should use this contribution or just edit the code and database manually. Thanks, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.