Jump to content
Latest News: (loading..)
KiLLaH

[Contribution] Extra Fields

Recommended Posts

Do you have another idea, perhaps?

Nope, sorry I have no idea... my knowledge if far from being good enough to understand what your problem is... You have updated your sql database have you? I had that problem once or twice du to Phpmyadmin problems... Had to update it with the data a couple of times before it would admit that it had done the changes (sounds crazy I know, it was probably just me going wrong)...

Share this post


Link to post
Share on other sites

OK Thanks anyway for your help.

 

I checked the database. Everything has been added correctly.

 

Perhaps someone else reading this post knows who to solve the problem.

Share this post


Link to post
Share on other sites

It seems that a previous modification (master products?) eats the $products_id variable. Look at the SQL query:

 

WHERE ptf.products_id= and ptf.products_extra_fields_value<>''

 

There is no product ID after ptf.products_id=

 

Extra fields won't work without this ID.

Share this post


Link to post
Share on other sites

thanks Butch for your comment.

 

The problem was in the code.

 

This is the correct code, updated by Christophe Buchi:

 

// 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
           [B]WHERE ptf.products_id=".(int)$products_id." and [/B]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 don`t have any error message in my product_info.php which is good. But

somehow the extra text option won`t show up in product_info. I also tested this

with original MS2 file (unmodified).

 

On the admin side this contribution works fine with Master Products.

 

I`m sure this will work with Master Products on the catalog side. I`ll post this question in the master products forum.

 

Thanks again!

Share this post


Link to post
Share on other sites
Im trying to figure out myself but rather lost right now.. :)

 

Has anyone any solution to this? I installed the 2.0b version and it seems otherwise to work fine, but any data entered on product update page doesn't get in the database. They are shown on the preview page though. :(

 

In the instructions the chapter 1.2 and 1.6 seems to be similar though, should on or other be put somewhere else?

Share this post


Link to post
Share on other sites

Hi all - has this been resolved anywhere?

 

The extra fields contrib seems to work perfectly - but the data is not being displayed on the product info page.

 

I can't get it to work with STS or without? Spent hours sloggin through the forum trying to find an answer... but I can't.

 

Help... Please

Share this post


Link to post
Share on other sites

Hey everyone,

I have just tried to install the "Product Extra Fields" contrib, and everything went smoothly, BUT here is my problem!

I have the "Product Extra Fields" section show up in the admin...but when i go to a product to add something under it, there is nothing there! the ONLY thing i see that shows that ive installed it is in the page to add new extra fields! This seems to work well, too! it adds it fine, i have clicked the activate button, but other than that, its as if nothing has been installed!

I also dont get any errors at all!

PLEAAAASE help me!

Thanks in advance!!

 

P.S. Sorry for the posts in two forums, i didnt realize the other one wasnt being used for support any longer.

Thanks again!

Share this post


Link to post
Share on other sites

Hello. Excellent Contribution! Works great. I have several formating questions:

 

1. How and where would I change the extra fields I added:

 

Description: A Cowboys Dream!

Starring: Bobby Blake, Dennis Lincoln, Ricky Parker, Little Blundt, and Zabbbbbbbbbbbbbbbb

Run Time: 2 hours

Features: Interactive Menus, Chapter Index, Jump to Your Favorite Scenes,

 

to always format like: (except, without all the ........ )

 

Description:.....A Cowboys Dream!

 

Starring:..........Bobby Blake, Dennis Lincoln, Ricky Parker,

.......................Little Blundt, and Zabbbbbbbbbbbbbbb

 

Run Time:........2 hours

 

Features:.........Interactive Menus, Chapter Index, Jump to

........................Your Favorite Scenes,

 

Neater & easier for the customer to read.

 

2. Where do I change the font and color for the fields and their corresponding text?

 

Thanks

Tom

Share this post


Link to post
Share on other sites

Figured it out. Add html to this section of catalog/product_info:

 

<b><?php echo $extra_fields['name']; ?>:</font></b>

<?php echo $extra_fields['value']; ?><br />

 

Example:

 

<FONT style="font-size:9pt" face="arial bold" color="#333399">

<b><?php echo $extra_fields['name']; ?>:</font></b>

<?php echo $extra_fields['value']; ?><br />

 

Will change the font style for the 'name' field.

 

Hate it when folks don't supply their solutions. :)

Tom

Share this post


Link to post
Share on other sites

After I added a product w/ attributes to cart and I clicked on product name in the shopping cart, I got

 

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 '{4}3 and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.la' at line 5

SELECT pef.products_extra_fields_status as status, 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=2{4}3 and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='1') ORDER BY products_extra_fields_order

[TEP STOP]

 

The link of the product w/ attributes in the shopping cart

eg. http://www.domain.com/catalog/product_info...oducts_id=2{4}3

Notice the {4}3 at the end.

If I delete the end and make it look like

http://www.domain.com/catalog/product_info.php?products_id=2

It will works.

The products without attributes don't have those {#}# at the end.

 

 

I have Master Product, but I don't think that's the cause because I tried w/ non-modded product_info.php and had the same result. I'm not sure tho.

 

Anyone please help out?

 

Thank you

Share this post


Link to post
Share on other sites

this extre this can i have it added inside product_listing.php instead of inside product_info.php.

 

meaning when user key in the product quantity they can key in the extra field without going into product_info.php page to key in extra field.

Share this post


Link to post
Share on other sites
After I added a product w/ attributes to cart and I clicked on product name in the shopping cart, I got

 

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 '{4}3 and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.la' at line 5

SELECT pef.products_extra_fields_status as status, 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=2{4}3 and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='1') ORDER BY products_extra_fields_order

[TEP STOP]

 

The link of the product w/ attributes in the shopping cart

eg. http://www.domain.com/catalog/product_info...oducts_id=2{4}3

Notice the {4}3 at the end.

If I delete the end and make it look like

http://www.domain.com/catalog/product_info.php?products_id=2

It will works.

The products without attributes don't have those {#}# at the end.

I have Master Product, but I don't think that's the cause because I tried w/ non-modded product_info.php and had the same result. I'm not sure tho.

 

Anyone please help out?

 

Thank you

 

 

 

In the product_info.php, I basically change the query to the following and it seem to works fine:

 

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='".$languages_id."')

ORDER BY products_extra_fields_order");

Share this post


Link to post
Share on other sites

Anyone know how to add the extra-fields to the orders also?

 

Currently, the Extra Fields contribution works great, but I would like to see the extra fields show up in the shopping cart also. Also I would like to add it to the orders. For example have an Orders_Products_ExtraFields table like the orders_products_attributes to record the products/extrafields for each order. Any idea how to do this?

 

Thanks!

Share this post


Link to post
Share on other sites

Hi everybody,

First off - thanks for a great mod.

 

I have a question about duplicating/linking products. Product extra fields are not copied when I duplicate a product. This is something i really need. Is there a solution for this anywhere? I've searched the forum with no luck... :)

 

I'm using v 2.0b

Share this post


Link to post
Share on other sites

First, EXCELLENT CONTRIBUTION! Thank You! I have one minor issue. OSC is automatically adding the backslash character for any word with an apostrophe, yet the backslash is showing up in my products_extra field on the product_info pg. ex. what\'s instead of what's Any help would be appreciated.

Thanks

Tom

Share this post


Link to post
Share on other sites

Quote from long Contribution Announcement Threat:

Do anyone know how to grab a value from " Products Extra Fields with language support " and put it in the Product_listing and Products_new page.

 

I don't need the name just the value. And I just want one of the added extra fields values to be visible in the product_listing.

 

I guess that I have to do some kind of database query, but my mysql skills very limited, so i would appreciate any help I can get.

 

Thanks

 

//Fredric

It seems more people would like to show the PEF information in the product_listing.

I've also asked this in this thread but I think the question belongs here.

Could anybody help me to get this done PLZ :huh:

 

TIA

Share this post


Link to post
Share on other sites

HELP wanted;

Instead of "Sort: Paperback | Year: 2005" I would like to show just "Paperback | 2005" in the productlisting.

 

:huh:

Share this post


Link to post
Share on other sites
HELP wanted;

Instead of "Sort: Paperback | Year: 2005" I would like to show just "Paperback | 2005" in the productlisting.

 

:huh:

 

So you just want to hide the field name in your display?

 

I think you could just remove or comment out:

echo '<b>'.$extra_fields['name'].': </b>';

from the following bit in product_info.php:

 

while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
	echo '<b>'.$extra_fields['name'].': </b>';
	echo $extra_fields['value'].'<BR>';

 

Alane

Share this post


Link to post
Share on other sites

Hello all

 

My installation went on well. I can add fields to products and the database is being updated correctly.

I however have a number of others mod on the product_infor.php page I believe are conflicting with the code, and the extra fields are not showing on that page.

 

Can someone help merge these scripts so that I can get it to work? The extra fields can show up under the images, or in the description. Here is my product infor page. Thank you for your assistance.

 

<?php

 

/*

 

$Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

 

Modified by ManMachine for osPlayer v2 module.

osCommerce, Open Source E-Commerce Solutions

 

http://www.oscommerce.com

 

Copyright © 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; ?>">

 

<?php require(DIR_WS_INCLUDES . 'meta_tags.php'); ?>

<title><?php echo META_TAG_TITLE; ?></title>

<meta name="description" content="<?php echo META_TAG_DESCRIPTION; ?>">

<meta name="keywords" content="<?php echo META_TAG_KEYWORDS; ?>">

 

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

 

<link rel="stylesheet" type="text/css" href="<? echo THEMA_STYLE;?>">

 

<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')

}

// osPlayer v2 start

function popupWindowPlayer(url) {

window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res

izable=no,copyhistory=no,width=193,height=265,screenX=0,screenY=0,top=300,left=45

0')

}

// osPlayer v2 end

//--></script>

 

</head>

 

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

 

<!-- header //-->

 

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

 

<!-- header_eof //-->

 

<!-- body //-->

 

<table border="0" width="860" cellspacing="3" cellpadding="3">

 

<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><?php new infoBox(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 {

 

// BOF: More Pics 6 Added: , p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6

 

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, pd.products_spec, p.products_model, p.products_quantity, p.products_image, p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6, 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 . "'");

 

// EOF: More Pics 6

 

$product_info = tep_db_fetch_array($product_info_query);

 

/// osplayer v2 start

$product_mp3['folder'] = tep_get_mp3_folder($product_info['products_id']) ;

/// osplayer v2 end

 

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'];

}

 

//DISPLAY PRODUCT WAS ADDED TO WISHLIST IF WISHLIST REDIRECT IS ENABLED

 

if(tep_session_is_registered('wishlist_id')) { ?>

 

<tr> <td class="messageStackSuccess"><?php echo PRODUCT_ADDED_TO_WISHLIST; ?></td>

 

</tr>

 

<?php

 

tep_session_unregister('wishlist_id');

 

}

 

// BOF: More Pics 6

 

$mopics_image_width = (MOPICS_RESTRICT_IMAGE_SIZE=='true'?SMALL_IMAGE_WIDTH:'*2');

 

$mopics_image_height = (MOPICS_RESTRICT_IMAGE_SIZE=='true'?SMALL_IMAGE_HEIGHT:'*2');

 

if (MOPICS_SHOW_ALL_ON_PRODUCT_INFO=='true') {

 

$mopics_output = '';

 

$mo_row = 1;

 

$mo_col = 1;

 

$mopics_images = array();

 

if (tep_not_null($product_info['products_image'])) { $mopics_images[] = $product_info['products_image']; }

 

for ( $mo_item=1; $mo_item<7; $mo_item++ ) {

 

if (tep_not_null($product_info['products_subimage'.$mo_item])) { $mopics_images[] = $product_info['products_subimage'.$mo_item]; }

 

}

 

$mopics_count = sizeof($mopics_images);

 

if (tep_not_null($product_info['products_image'])) { $mopics_output .= '<table border="0" cellspacing="0" cellpadding="6" align="'.MOPICS_TABLE_ALIGNMENT.'">'."\n"; }

 

for ( $mo_item=0; $mo_item<$mopics_count; $mo_item++ ) {

 

if ($mo_row<(MOPICS_NUMBER_OF_ROWS+1)) {

 

if ($mo_col==1) {$mopics_output.='<tr>';}

 

$mopics_output .= ' <td align="center" class="smallText"><script language="javascript"><!--

 

document.write(\'<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'].'&invis='.$mo_item).'\\\')">' . tep_image(DIR_WS_IMAGES . $mopics_images[$mo_item], addslashes($product_info['products_name']), $mopics_image_width, $mopics_image_height, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>\');

 

//--></script><noscript>

 

<a href="' . tep_href_link(DIR_WS_IMAGES . $mopics_images[$mo_item]) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $mopics_images[$mo_item], $product_info['products_name'], $mopics_image_width, $mopics_image_height, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>

 

</noscript></td>'."\n";

 

if ($mo_col==MOPICS_NUMBER_OF_COLS) { $mo_col=1; $mo_row++; $mopics_output.='</tr>'."\n"; } else { $mo_col++; }

 

}

 

}

 

if ($mo_col!=1){ while (($mo_col++)<(MOPICS_NUMBER_OF_COLS+1)) { $mopics_output.='<td> </td>'."\n"; } }

 

if (tep_not_null($product_info['products_image'])) { $mopics_output .= '</table>'."\n"; }

 

}

 

// EOF: More Pics 6

 

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<?php

// BOF: WebMakers.com Added: Show Category and Image

if (SHOW_CATEGORIES=='1') {

?>

<tr><td colspan="2"><table align="right">

<tr>

<td class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . tep_get_categories_image(tep_get_products_catagory_id($product_info_values['products_id']))); ?></td>

</tr>

<tr>

<td class="main" align="center"><?php echo tep_get_categories_name(tep_get_products_catagory_id($product_info_values['products_id'])); ?></td>

</tr>

</table></td></tr>

<?php

}

// EOF: WebMakers.com Added: Show Category and Image

?>

<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>

 

<tr>

 

<td class="main">

<!-- osPlayer v2 Start -->

<?php

if( (tep_not_null($product_mp3['folder'])) && (ENTRY_OSCP_POPUP == 'false') && (file_exists(DIR_FS_CATALOG_MP3 . $product_mp3['folder'])) && (is_dir(DIR_FS_CATALOG_MP3 . $product_mp3['folder']))) {

?>

<table border="0" width="200" cellspacing="0" cellpadding="0" align="right">

<tr>

<td><?php echo '<object type="application/x-shockwave-flash" data="osc_player.swf?mp3id=' . $HTTP_GET_VARS['products_id'] .'&autoplay=' . ENTRY_OSCP_PLAY . '" width="193" height="265"><param name="scale" value="exactfit" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="movie" value="osc_player.swf?mp3id=' . $HTTP_GET_VARS['products_id'] . '&autoplay=' . ENTRY_OSCP_PLAY . '"/><a href=http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash target="blank"><img src="images/icons/noflash.gif" width="88" height="31" vspace="5" hspace="50" alt="install flash player plugin"/></a></object>' ;?></td>

</tr>

</table>

 

<?php

}

?>

<!-- osPlayer v2 End -->

<?php /* BOF: More Pics 6

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="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($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*2, SMALL_IMAGE_HEIGHT*2, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>

 

</noscript>

 

<br><br>

 

<?php

 

//affiliate build a link begin

 

if (tep_session_is_registered('affiliate_id')) {

 

?>

 

<?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_BANNERS_BUILD, 'individual_banner_id=' . $product_info['products_id']) .'" target="_self">' . tep_image('includes/languages/english/images/buttons/button_affiliate_build_a_link.gif', 'Make a link') . ' </a>'; ?><?php

//affiliate build a link begin

}

<?php

// START: Extra Fields Contribution v2.0b

$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=".$HTTP_GET_VARS['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 '<b>'.$extra_fields['name'].': </b>';

echo $extra_fields['value'].'<BR>';

}

// END: Extra Fields Contribution

?>

?>

</td>

 

</tr>

</table>

 

<?php

} */

 

if (MOPICS_TABLE_LOCATION=='above') {

 

echo ' <table width="100%" border="0" cellspacing="0" cellpadding="0">

 

<tr>

 

<td align="center" class="smallText">'.$mopics_output.'</td>

 

</tr>

 

</table>

 

 <br>'."\n";

 

} else if (MOPICS_TABLE_LOCATION=='sides') {

 

echo $mopics_output;

 

}

 

// EOF: More Pics 6

 

?>

 

<!-- mod to show or hide tabbed panes if no advanced spec Steve Makin -->

<?php

if ($product_info['products_spec'] > '') {

include(DIR_WS_INCLUDES . 'tab_desc_and_spec.php');

} else {

include(DIR_WS_INCLUDES . 'tab_desc_no_spec.php');

}

?>

<!-- End mod to show or hide tabbed panes if no advanced spec Steve Makin -->

 

<?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();

// BOF: WebMakers.com Added: Attributes Copy and Sort

if ( PRODUCTS_OPTIONS_SORT_BY_PRICE !='1' ) {

$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 . "'" . " order by pa.products_options_sort_order, pov.products_options_values_name");

} else {

$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 . "'" . " order by pa.products_options_sort_order, pa.options_values_price");

}

// EOF: WebMakers.com Added: Attributes Copy and Sort

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

 

}

 

// BOF: More Pics 6

 

if (MOPICS_TABLE_LOCATION=='below') {

 

echo ' <br>

 

<table width="100%" border="0" cellspacing="0" cellpadding="0">

 

<tr>

 

<td align="center" class="smallText">'.$mopics_output.'</td>

 

</tr>

 

</table>'."\n";

 

}

 

// EOF: More Pics 6

 

?>

 

</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><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>

 

<!--osPlayer v2 start -->

<td valign="center">

<?php if( (tep_not_null($product_mp3['folder'])) && (ENTRY_OSCP_POPUP == 'true') && (file_exists(DIR_FS_CATALOG_MP3 . $product_mp3['folder'])) && (is_dir(DIR_FS_CATALOG_MP3 . $product_mp3['folder']))) {

echo '<a href="java script:popupWindowPlayer(\'' . 'popup_oscplayer.php?product_id=' . $HTTP_GET_VARS['products_id'] . '&autoplay=' . ENTRY_OSCP_PLAY . '\')">' . tep_image_button('button_preview_mp3.gif', IMAGE_BUTTON_MP3) . '</a>';

} ?>

</td>

<!--osPlayer v2 end -->

 

<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>

 

<td align="center"><?php echo tep_image_submit('button_wishlist.gif', 'Add to Wishlist', 'name="wishlist" value="wishlist"'); ?></td>

<?php

$back = sizeof($navigation->path)-2;

if (isset($navigation->path[$back])) {

?>

<td class="main" align="center"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>

<?php

}

?>

 

<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

 

<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 //-->

 

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

 

<!-- right_navigation //-->

 

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

 

<!-- right_navigation_eof //-->

 

</table></td>

 

</tr>

 

</table>

 

<!-- body_eof //-->

 

<!-- footer //-->

 

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

 

<!-- footer_eof //-->

 

<br>

 

</body>

 

</html>

 

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites
Hey everyone,

I have just tried to install the "Product Extra Fields" contrib, and everything went smoothly, BUT here is my problem!

I have the "Product Extra Fields" section show up in the admin...but when i go to a product to add something under it, there is nothing there! the ONLY thing i see that shows that ive installed it is in the page to add new extra fields! This seems to work well, too! it adds it fine, i have clicked the activate button, but other than that, its as if nothing has been installed!

I also dont get any errors at all!

PLEAAAASE help me!

Thanks in advance!!

 

P.S. Sorry for the posts in two forums, i didnt realize the other one wasnt being used for support any longer.

Thanks again!

 

I have exactly the same problem! What did I miss? Any help would be greatly appreciated.

This contribution is just what I was looking for! Thanks!


I repeat myself when under stress, I repeat myself when under stress, I repeat myself...

 

--King Crimson (“Discipline”)

Share this post


Link to post
Share on other sites

Hello!

 

I have instaled new version of contribution and recived this error message:

 

1066 - Not unique table/alias: 'pd'

 

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 on m.manufacturers_id=p.manufacturers_id, products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c, 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 '%dualhead%' or p.products_model like '%dualhead%' or m.manufacturers_name like '%dualhead%' or p2pef.products_extra_fields_value like '%dualhead%' or pd.products_description like '%dualhead%') )

 

I don't now what i'm doing wrong. Please help me.

http://www.czekoladki.com

Share this post


Link to post
Share on other sites
I have exactly the same problem! What did I miss? Any help would be greatly appreciated.

This contribution is just what I was looking for! Thanks!

 

 

And me the same!

Via PHPMyadmin I can fill the table products_to_products_extra_fields than I see the fields in the productpages. Via the admin of OScommerce this is not possible.

Probably there is a better, simple way.

Please let me know.

Share this post


Link to post
Share on other sites
Hello!

 

I have instaled new version of contribution and recived this error message:

 

1066 - Not unique table/alias: 'pd'

 

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 on m.manufacturers_id=p.manufacturers_id, products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c, 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 '%dualhead%' or p.products_model like '%dualhead%' or m.manufacturers_name like '%dualhead%' or p2pef.products_extra_fields_value like '%dualhead%' or pd.products_description like '%dualhead%') )

 

I don't now what i'm doing wrong. Please help me.

http://www.czekoladki.com

 

I had the same problem. Comparing the old and new advanced_search_result.php files, there is an extra line which is not needed. If you remove this, it works. Here is how to find it:

 

Open the advanced_search_result.php file from the contribution.

 

Search for the following text:

 

// START: Extra Fields Contribution

// $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

$from_str = "from (" . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " p2pef on p.products_id=p2pef.products_id) left join " . TABLE_MANUFACTURERS . " m on m.manufacturers_id=p.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

// END: Extra Fields Contribution

 

 

 

if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {

if (!tep_session_is_registered('customer_country_id')) {

$customer_country_id = STORE_COUNTRY;

$customer_zone_id = STORE_ZONE;

}

$from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";

}

 

$from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 

The very last line adds tables to $from_str that are already there, so you can safely remove it. That is, erase the following:

 

$from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 

And resave. It should then work.

Share this post


Link to post
Share on other sites

The admin search query (in admin/categories.php) should probably have something like this (it's somewhere around line 912)..

 

$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " p2pef using(products_id) where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and (pd.products_name like '%" . tep_db_input($search) . "%' or (p2pef.products_extra_fields_value like '%" . tep_db_input($search) . "%')) order by pd.products_name");

 

I've used the extra fields for barcodes, salescodes, price bands etc, and it's important for the admins to find a product based on barcode.

 

The installation of this contribution was a bit messy (a .diff file for patch would be nice), but it seems to work.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×