Guest Posted August 25, 2007 Share Posted August 25, 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, Never mind. I realized the instructions weren't applicable to my highly modified store. I got it all figured out though. Thanks! Quote Link to comment Share on other sites More sharing options...
Guest Posted August 25, 2007 Share Posted August 25, 2007 (edited) hi everyone... i am using Product Extra Fields which is a nice feature, but... i would love to be able to set more options for each field, such as * short text * long text * radio button * select list and not only shorttext as it is now. do you know is anyone is working on this? thanks jacopo This would actually be an easy. Add an additonal column in products_extra_fields called products_extra_fields_type. The values in this field would reference a new table called products_extra_fields_types. then write a function in htmloutput.php that will display the appropriate type in categories.php based on the extra fields type. You could also add a column for parameters like width and height. Of course, you would then need to ad the UI in product_extra_fields.php. This should be an easy one. Too bad I have more pressing priorities at the moment. :) Edited August 25, 2007 by Bruin_03 Quote Link to comment Share on other sites More sharing options...
Benji_m Posted September 1, 2007 Share Posted September 1, 2007 First of all great contrib! Sorry if this is a stupid question but everything works fine in a normal store, but when NIMMIT Search engine friendly URL's are installed no extra fields are displayed. Does anyone have an idea why this is so and how to get around it? I saw something in the contribution updates but didn't work for me! Thanks in advance Quote Link to comment Share on other sites More sharing options...
Anatolij Posted September 3, 2007 Share Posted September 3, 2007 Are there any good free search for it? Something like demo Quote Link to comment Share on other sites More sharing options...
jnjn Posted September 5, 2007 Share Posted September 5, 2007 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 Hello all I don´t now if this is the solution, but in my case work perfect. I remix this contribution with another one category fields http://www.oscommerce.com/community/contributions,3173 after that in admin/category.php you need to make a filter to make dependent to the category. this way you can create a fild's for a particular category or category's, when you create a new product you only see this fild's not all like the original contribution. jn Quote Link to comment Share on other sites More sharing options...
Guest Posted September 7, 2007 Share Posted September 7, 2007 nobody that can do it Quote Link to comment Share on other sites More sharing options...
carpenoctem Posted September 29, 2007 Share Posted September 29, 2007 I have installed the extra fields contribution... you can see it in action at http://www.ir-usa.com/cat/product_info.php...;products_id=91 As you can see if you look at Compatible Machine Models, I have it so that I can enter more than one entry into an "extra" field, separate the things by a comma, and have the coding replace that comma with a linebreak. This is working amazing. There is one thing that I would like to add to this, that would save me A LOT of time.... and that is to also have the entries sorted alphabetically. As it is now, i input everything into a column in excel, alphabetize, and then format by hand. If it would alphabetically sort, it would make it easier to add new printers and save A LOT of time. Here is what my code looks like: <?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 ' <table border="0" width="100%" cellspacing="0" cellpadding="2px"> <tr> <td class="main" align="left" valign="top" width="45%"> <b><font size="1" color="#FF0000">'.$extra_fields['name'].': </b></font></td>'; { $extra_fields_va=str_replace(",", "<br>", $extra_fields['value']); $extra_fields_value=str_replace(" ", "+", $extra_fields['value']); echo '<td class="main" align="left" valign="top"><font size="1" color="#ffffff">' . $extra_fields_va . '</font></td></tr></table>'; } } // END: Extra Fields Contribution - mintpeel display fix ?> Any suggestions on how to alphabetize? Thanks in advance!!!! Quote Link to comment Share on other sites More sharing options...
Guest Posted September 29, 2007 Share Posted September 29, 2007 As it is now, i input everything into a column in excel, alphabetize, and then format by hand. If it would alphabetically sort, it would make it easier to add new printers and save A LOT of time. try to replace the code you posted by the following: <?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 '<table border="0" width="100%" cellspacing="0" cellpadding="2px"> <tr> <td class="main" align="left" valign="top" width="45%"> <b><font size="1" color="#FF0000">'.$extra_fields['name'].': </b></font></td> <td class="main" align="left" valign="top"><font size="1" color="#ffffff"> '; { $extra_fields_value=str_replace(" ", "+", $extra_fields['value']); $extra_fields_array = explode(',',$extra_fields['value']); $n = sizeof($extra_fields_array); sort($extra_fields_array); for($i=0; $i<$n; $i++) { echo '<td class="main" align="left" valign="top"> <font size="1" color="#ffffff">' .$extra_fields_array[$i] . . '</font></td></tr>'; } echo '</table>'; } } // END: Extra Fields Contribution - mintpeel display fix ?> Quote Link to comment Share on other sites More sharing options...
carpenoctem Posted September 29, 2007 Share Posted September 29, 2007 try to replace the code you posted by the following: <?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 '<table border="0" width="100%" cellspacing="0" cellpadding="2px"> <tr> <td class="main" align="left" valign="top" width="45%"> <b><font size="1" color="#FF0000">'.$extra_fields['name'].': </b></font></td> <td class="main" align="left" valign="top"><font size="1" color="#ffffff"> '; { $extra_fields_value=str_replace(" ", "+", $extra_fields['value']); $extra_fields_array = explode(',',$extra_fields['value']); $n = sizeof($extra_fields_array); sort($extra_fields_array); for($i=0; $i<$n; $i++) { echo '<td class="main" align="left" valign="top"> <font size="1" color="#ffffff">' .$extra_fields_array[$i] . . '</font></td></tr>'; } echo '</table>'; } } // END: Extra Fields Contribution - mintpeel display fix ?> I tried doing that, and nothing happened. if you look at http://www.ir-usa.com/cat/product_info1.ph...products_id=360 you will see that within the Cartridge Number Compatibility, and within the Compatible Machine Model fields that the entries are still out of order. is there anything else that you would recommend that I try? I appreciate your help!!! Thanks Mark Quote Link to comment Share on other sites More sharing options...
Guest Posted September 29, 2007 Share Posted September 29, 2007 I tried doing that, and nothing happened. if you look at http://www.ir-usa.com/cat/product_info1.ph...products_id=360 you will see that within the Cartridge Number Compatibility, and within the Compatible Machine Model fields that the entries are still out of order. is there anything else that you would recommend that I try? I appreciate your help!!! Thanks Mark try to replace: $extra_fields_array = explode(',',$extra_fields['value']); $n = sizeof($extra_fields_array); sort($extra_fields_array); for($i=0; $i<$n; $i++) { echo '<td class="main" align="left" valign="top"> <font size="1" color="#ffffff">' .$extra_fields_array[$i] . '</font></td></tr>'; } by $extra_fields_array = explode(',',$extra_fields['value']); $n = sizeof($extra_fields_array); sort($extra_fields_array); foreach ($extra_fields_array as $key => $val) { echo '<td class="main" align="left" valign="top"> <font size="1" color="#ffffff">'. $val . '</font></td></tr>'; } Quote Link to comment Share on other sites More sharing options...
carpenoctem Posted September 29, 2007 Share Posted September 29, 2007 try to replace: $extra_fields_array = explode(',',$extra_fields['value']); $n = sizeof($extra_fields_array); sort($extra_fields_array); for($i=0; $i<$n; $i++) { echo '<td class="main" align="left" valign="top"> <font size="1" color="#ffffff">' .$extra_fields_array[$i] . '</font></td></tr>'; } by $extra_fields_array = explode(',',$extra_fields['value']); $n = sizeof($extra_fields_array); sort($extra_fields_array); foreach ($extra_fields_array as $key => $val) { echo '<td class="main" align="left" valign="top"> <font size="1" color="#ffffff">'. $val . '</font></td></tr>'; } Even with that tidbit of change, it still does not sort what it in the extra fields.... take alook again at http://www.ir-usa.com/cat/product_info1.ph...products_id=360 you will see what I mean. is there perhaps a way to make it so that when the information is added to the fields, it is just stored in the mysql server in alphabetical order.... then when it is pulled from the database it will display correctly?? maybe that will solve the problem??? Do you want me to PM the entire product_info file to you?? I am sorry to be such a pain!!! Quote Link to comment Share on other sites More sharing options...
Guest Posted September 29, 2007 Share Posted September 29, 2007 (edited) Even with that tidbit of change, it still does not sort what it in the extra fields.... take alook again at http://www.ir-usa.com/cat/product_info1.ph...products_id=360 you will see what I mean. is there perhaps a way to make it so that when the information is added to the fields, it is just stored in the mysql server in alphabetical order.... then when it is pulled from the database it will display correctly?? maybe that will solve the problem??? Do you want me to PM the entire product_info file to you?? I am sorry to be such a pain!!! The way it works is not related to database sorting: the field is exploded in an array (the separator being the comma), and then the array is sorted with a php function. No mysql involved. If you want me to help you,please provide temporary FTP access to the server in a PM, just the product_info will not help me. Edited September 29, 2007 by pixclinic Quote Link to comment Share on other sites More sharing options...
Guest Posted September 29, 2007 Share Posted September 29, 2007 (edited) problem solved: the array was created by exploding a field, but elements were separated with ", " (comma AND SPACE after) they needed to be separated by one comma only between the elements, no space after the comma. Edited September 29, 2007 by pixclinic Quote Link to comment Share on other sites More sharing options...
Llangrannog Posted September 30, 2007 Share Posted September 30, 2007 Hello, I have just installed this contribution and get this error from admin Fatal error: Call to a member function add() on a non-object in /admin/extra_info_pages.php on line 39 Line 39 is this $breadcrumb->add($page_check[pages_title], tep_href_link('info_pages.php?pages_id=' . $infopageid)); Can anyonebody help with this? Thanks Quote Link to comment Share on other sites More sharing options...
mthierfelder Posted October 18, 2007 Share Posted October 18, 2007 I've searched throughout the forums and can't find the answer. Lots of posts requesting the feature to have the extra_fields value show up on the product_listing.php page but no help. If anybody has an idea of how to pass the extra_fields variable to other pages (besides just product_info.php) I'd be very interested. I'd like it to show up at least on the product_listing, possibly in the shopping_cart, and checkout confirmation pages as well. Quote Installed Modules: Dynamenu, InfoBox Admin, Master Products v.1.2, Header Tags Controller, Multiple Products Manager, Quick Edit in Admin, Secure Admin, Ultimate SEO URL's, EZ Secure Order, Easy Populate v.2.76d MS2, AuthorizeNet_AIM, ChangeFinal Breadcrumb Title, FedEx Labels, Fedex Direct 2.06, How Did you Hear 1.5, Login a la Amazon, UPS XML 1.2.4, USPS Labels, USPS Methods API MS2 Link to comment Share on other sites More sharing options...
E.S.Designs Posted October 19, 2007 Share Posted October 19, 2007 Hello, Have just added global register V1.5 - 5 Sept 2006 contribution http://www.oscommerce.com/community/contributions,2097 . I'm finding when the global registry is on extra product fields works great in the product page, but when off all the extra fields on the products pages are listed the same i.e. product 1 had the same information in the extra fields as products 2,3,4,.... Wondering if anyone has come across a fix or am I missing something in the install. Thanks in advanced. Quote Link to comment Share on other sites More sharing options...
decart2000ro Posted October 30, 2007 Share Posted October 30, 2007 Hello! Please help me!!!!!!!!!!!!! I want to use diferent color for each field-just 2 colors 1 Field-gray 1 Field white Enybody can help me? And if i can make tabs on product desription -Eg.Specification,Drivers,Contact_us,Delivery,(i try many contributin but don't work with extra fields)etc. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
dainbramaged05 Posted April 12, 2008 Share Posted April 12, 2008 (edited) is there a way to split the listings into more than one column? I have 9+ extra fields and it makes the page look funny. here is the code: list($products_id_clean) = split('{', $product_info['products_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"); 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>'; } Edited April 12, 2008 by dainbramaged05 Quote Link to comment Share on other sites More sharing options...
alba Posted April 28, 2008 Share Posted April 28, 2008 got a weird issue with the advanced_search.php functions to display the extra fields in the list of options to search for The code im using is: <?php $attributes_pef_query = tep_db_query("select * from " . TABLE_PRODUCTS_EXTRA_FIELDS . " where languages_id = '" . (int)$languages_id . "'"); while ($attributes_pef = tep_db_fetch_array($attributes_pef_query)) {?> <tr> <td class="fieldKey"><?php echo $attributes_pef["products_extra_fields_name"]; ?></td> <?php $option_values_pef_query = tep_db_query("select * from " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " p where p.products_extra_fields_id =" . $attributes_pef["products_extra_fields_id"] . " "); echo '<td class="fieldValue">'; echo '<select name="'.$attributes_pef["products_extra_fields_name"].'">'; echo '<option selected></option>'; while ($option_values_pef = tep_db_fetch_array($option_values_pef_query)) { echo '<option value="'.$option_values_pef["products_extra_fields_id"].'">'.$option_values_pef["products_extra_fields_value"].'</option>'; } echo '</select>'; ?> </td> </tr><?php } ?> It doesnt display them in the search page and for the life of me i cant see why.... i have the product attributes displaying as searchable options without any issues and the code is very similar anyone got working code for this part of the module? Quote Link to comment Share on other sites More sharing options...
Jol Posted May 23, 2008 Share Posted May 23, 2008 Hello! I have installed the contribution STSv4.5.2_and_PRODUCT_EXTRA_FIELDS. MY version of STS is STSv4.5.8 When I disable product info template in admin product extra field works but not with product info template enabled. I put the $pef$ tag in product_info.php.html template but there isn´t any extra fields showing up. In the instructions for the contribution STSv4.5.2_and_PRODUCT_EXTRA_FIELDS it says: b) And then in includes/column_left.php simply call: include(DIR_WS_MODULES . 'product_extra_fields.php'); Where shall i put this code? I have tried to place it just before the closing ?> tag of that script. But it still doesn´t work. Does this contribution work with my version of STS? Is there a fix to this problem in that case? Maiby another contribution? Quote Link to comment Share on other sites More sharing options...
maxemus Posted January 15, 2009 Share Posted January 15, 2009 Hello I installed extra_fields_v2_0j and now the extra field is in the where the name should be in the category list How do I get the product name back in there Quote Link to comment Share on other sites More sharing options...
kurjam Posted April 2, 2009 Share Posted April 2, 2009 Hello I installed extra_fields_v2_0j and now the extra field is in the where the name should be in the category list How do I get the product name back in there I do have same question. I were able to move extra fields on top of description, but it wouldn't blend with it. It look like this: And wanted solution is marked with black. Current product info looks like this: <?php /* $Id: product_info.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_check = tep_db_fetch_array($product_check_query); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <script language="javascript"><!-- function popupWindow(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le ft=150') } //--></script> <script type="text/javascript" src="lightbox/prototype.js"></script> <script type="text/javascript" src="lightbox/scriptaculous.js?load=effects"></script> <link rel="stylesheet" href="lightbox/lightbox.css" type="text/css" media="screen"> <script type="text/javascript" src="lightbox/builder.js"></script> <script type="text/javascript" src="lightbox/lightbox.js"></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <div id="nolap_container"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3" class="main_table"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> <?php if ($product_check['total'] < 1) { ?> <tr> <td class="infoBoxContents"><?php new contentBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } else { $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); if ($new_price = tep_get_products_special_price($product_info['products_id'])) { $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>'; } else { $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])); } if (tep_not_null($product_info['products_model'])) { $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>'; } else { $products_name = $product_info['products_name']; } ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading" valign="top"><?php echo $products_name; ?></td> <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <!--bof stock announcement--> <?php if ((STOCK_CHECK == 'true')&&($product_info['products_quantity'] < 1)) { ?> <tr> <td><span class="markProductOutOfStock"><?php echo TEXT_OUT_OF_STOCK; ?></span></td> <?php include(DIR_WS_BOXES . 'product_notifications.php'); ?> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } elseif ((STOCK_CHECK == 'true')&&($product_info['products_quantity'] > 0)) { ?> <tr> <td><span class="markProductOutOfStock"><?php echo TEXT_IN_STOCK; ?></span></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <!--eof stock announcement--> <?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)$HTTP_GET_VARS['products_id'] ." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".(int)$languages_id."') ORDER BY products_extra_fields_order"); echo '<tr> <td> <table border="0" width="50%" cellspacing="0" cellpadding="2px">'; while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { if (! $extra_fields['status']) // show only enabled extra field continue; echo'<tr><td class="main" align="left" valign="middle"><font size="1" color="#666666"><b>'.$extra_fields['name'].': </b>' . stripslashes($extra_fields['value']).'</font></td></tr>'; } echo' </table> </td> </tr>'; // END: Extra Fields Contribution - mintpeel display fix ?> <tr> <td class="main"> <?php if (tep_not_null($product_info['products_image'])) { ?> <table border="0" cellspacing="0" cellpadding="2" align="right"> <tr> <td align="center" class="smallText"> <script language="javascript"><!-- document.write('<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank" rel="lightbox" title="'.$product_info['products_name'].'" >' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>'); //--></script> <noscript> <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> </noscript> </td> </tr> </table> <?php } ?> <p><?php echo stripslashes($product_info['products_description']); ?></p> <?php $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { ?> <table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td> </tr> <?php $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; } ?> <tr> <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td> <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td> </tr> <?php } ?> </table> <?php } ?> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $reviews = tep_db_fetch_array($reviews_query); if ($reviews['count'] > 0) { ?> <tr> <td class="main"><?php //echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } if (tep_not_null($product_info['products_url'])) { ?> <tr> <td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) { ?> <tr> <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td> </tr> <?php } else { ?> <tr> <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td> </tr> <?php } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td align="center"><?php product_names(); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params()) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td> <td class="main"><?php //echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td> <!--bof remove add to cart button--> <td class="main" align="right"><?php if (((STOCK_CHECK == "true")&&($product_info['products_quantity'] > 0)) or (STOCK_CHECK == "false")) { echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); } else { echo tep_draw_separator('pixel_trans.gif', '1', '19'); } ?></td> <!--eof remove add to cart button--> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td> <?php if ((USE_CACHE == 'true') && empty($SID)) { echo tep_cache_also_purchased(3600); } else { include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); } } ?> </td> </tr> </table></form></td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </div> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Quote Link to comment Share on other sites More sharing options...
chrissmith Posted October 7, 2009 Share Posted October 7, 2009 Hello, i get an error on catalog side: Warning: Invalid Argument supplied for foreach() in.... on index.php and on product_listing.pgp What can be the reason? Thanks chrissmith Quote Link to comment Share on other sites More sharing options...
northshore Posted September 29, 2010 Share Posted September 29, 2010 Hi, I am trying to display the Extra Fields in the product_listing_tpl.php file, but the contribution only gives instructions for doing this in the product_listing.php. The suggested replace line does not exist in product_listing_tpl.php. Does anyone know how to accomplish this?? Any help is appeciated. 13. Extra Fields in product listing (optional) In catalog/includes/modules/product_listings.php FIND $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> '; } break; REPLACE WITH //PRODUCT EXTRA FIELDS IN PRODUCT LISTING - BEGINING //PRODUCT EXTRA FIELDS IN PRODUCT LISTING - BEGINING //$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . //$listing['products_name'] . '</a> '; // } // break; $extra_fields_text = ''; $extra_fields_query = tep_db_query(" SELECT pef.languages_id, 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) $listing[$x]['products_id'] ." and pef.languages_id=" . (int)$languages_id . " and ptf.products_extra_fields_value<>'' ORDER BY products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { if (! $extra_fields['status']) continue; $extra_fields_text = $extra_fields_text. '<font color="#000000">'.$extra_fields['name'].': </font>' . '<font color="#006600">' .$extra_fields['value'].'<BR></font>'; } $lc_text = ' <b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a></b><br> ' . $extra_fields_text . '<br>'; } break; // PRODUCT EXTRA FIELDS IN PRODUCT LISTING - END Quote Link to comment Share on other sites More sharing options...
Guest Posted July 20, 2012 Share Posted July 20, 2012 Hi All I just installed this on top of a very moded shop and was getting the error : Warning: Invalid argument supplied for foreach().... in template_top.php at line 34 after about 2 hours i found this error is caused by this code: foreach ($epf as $e) { $mt = ($e['uses_list'] && !$e['multi_select'] ? ($pname[$e['field']] == 0) : !tep_not_null($pname[$e['field']])); if ($e['keyword'] && !$mt) { if ($e['uses_list']) { if ($e['multi_select']) { $values = explode('|', trim($pname[$e['field']], '|')); foreach ($values as $val) { $keywords[] = tep_output_string(tep_get_extra_field_list_value($val)); } } else { $keywords[] = tep_output_string(str_replace(' | ', ', ', tep_get_extra_field_list_value($pname[$e['field']], $e['show_chain']))); } } else { $keywords[] = tep_output_string($pname[$e['field']]); } } } This is most likely because the foreach hates it when the returned data is not an data array. so the fix to get rid of that pesky warning while page loads is to replace said code with this... if(is_array($epf)) { foreach ($epf as $e) { $mt = ($e['uses_list'] && !$e['multi_select'] ? ($pname[$e['field']] == 0) : !tep_not_null($pname[$e['field']])); if ($e['keyword'] && !$mt) { if ($e['uses_list']) { if ($e['multi_select']) { $values = explode('|', trim($pname[$e['field']], '|')); foreach ($values as $val) { $keywords[] = tep_output_string(tep_get_extra_field_list_value($val)); } } else { $keywords[] = tep_output_string(str_replace(' | ', ', ', tep_get_extra_field_list_value($pname[$e['field']], $e['show_chain']))); } } else { $keywords[] = tep_output_string($pname[$e['field']]); } } } } Now the page loads with no errors, all this did was look to see if the data is an array before it loads the loop, if not than nothing so no error... I am in hopes this post saves some one some time... Thanks Adam 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.