Jump to content
Skittles

Optional Related Products, Version 4.0

Recommended Posts

Yes. I'd like to take a look at it.

 

Also, do you have other contributions on the site? I'd like to figure out what caused the error. If it has to do with blending two or more contributions, it would be good to include information in a troubleshooting guide.

 

And if there is a mistake in the file, I would think you'd want to fix that before it interferes with any other contributions you'd like to add.

 

Your wife must be a talented seamstress to create such beautiful lingerie. So much detail work! I know a bit about sewing, so I know she's put a lot of work into her products. I'll bookmark the site, and when my diet and exercise get me back into a size 10, I'll be sure and buy myself a treat from her site! A much better way to celebrate than, say, a chili burger. (Which would be my husband's first choice!) (w00t)

 

Here's to prosperity!

-Anita

 

No chili burgers for you then! ;)

<?php
/*
 $Id: catalog.php,v 1.21 2003/07/09 01:18:53 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- catalog //-->
	  <tr>
		<td>
<?php
 $heading = array();
 $contents = array();

 $heading[] = array('text'  => BOX_HEADING_CATALOG,
				 'link'  => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog'));

 if ($selected_box == 'catalog') {
$contents[] = array('text'  => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_MANUFACTURERS . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_REVIEWS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_REVIEWS . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'.
	/* Optional Related Products (ORP) */
	'<a href="' . tep_href_link(FILENAME_RELATED_PRODUCTS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_RELATED_PRODUCTS . '</a>');
	//ORP:end
	/* Optional Related Products (ORP) */
	  tep_db_query("delete from " . TABLE_PRODUCTS_RELATED_PRODUCTS . " where pop_products_id_master = '" . (int)$product_id . "'");
	  tep_db_query("delete from " . TABLE_PRODUCTS_RELATED_PRODUCTS . " where pop_products_id_slave = '" . (int)$product_id . "'");
	//ORP: end
 }

 $box = new box;
 echo $box->menuBox($heading, $contents);
?>
		</td>
	  </tr>
<!-- catalog_eof //-->

The only contribution that may have to do with this is option_type_feature_v1.71

The other are shipping and payment modules such as CORREOS_P_AZUL, payment_modules_3.0, SEUR EuroPack, SEUR nacional, Ship_Spain_Paqueteria_Urgente

Later I want to install tinymce_2_0_8, extra_images_v1-5 or more_pics_6_v2_1_2 and one I thought I down loaded but can't find it now that it's for leting people subscribe to the newsletter w/o registering

 

(taste the raindow ;) )

Share this post


Link to post
Share on other sites
Margaret,

 

I'm stumped.

 

I don't see how the changes to the database could affect the layout of your page like that. There must be some conflict between this contribution and and one of the other contributions you already have installed. But without access to the files and the database, I can't do any more tonight.

 

I would be interested in knowing what contributions (and which versions) you have installed, so I can download the files and look for potential conflicts. And if you'd like, I'm willing to look over the files that need to be modified for this mod; look for any places where this contribution and another need to modify the same lines of code.

 

When you uninstalled this contribution before, did you remove the code from the files, as well as run the sql uninstall? Or just run the uninstall from the sql utility? (The error I was receiving after you uninstalled would suggest the include statement was still in product_info.php)

 

It may take a couple of days, what with posting back and forth, but I'm willing to help you make this work with your site.

 

Time to call it a day. Talk to you tomorrow.

-Anita

 

I have to check the versions for the contributions that are installed but just to give you an idea: sitemonitor, supertracker, linkpoint api, upsxml, ccgv trad (uninstalled but I still have some stuff of it around) and the one that enables more than one image I have to check the name, because I paid a programmer to install it.

 

When I uninstalled I just run the sql uninstall from the utility then I checked my website and everything was normal, so I didn't remove the code from the pages.

 

Today and tomorrow I have to go to work so I just can check back late. I appreciate yr help, thanks a lot.

 

Margaret

Share this post


Link to post
Share on other sites
Awesome skin Margaret, great job :D

 

 

Thanks, I bought the template and then I changed (the hardest work I've done in my life) a little bit.

Share this post


Link to post
Share on other sites
No chili burgers for you then! ;)

 

The only contribution that may have to do with this is option_type_feature_v1.71

The other are shipping and payment modules such as CORREOS_P_AZUL, payment_modules_3.0, SEUR EuroPack, SEUR nacional, Ship_Spain_Paqueteria_Urgente

Later I want to install tinymce_2_0_8, extra_images_v1-5 or more_pics_6_v2_1_2 and one I thought I down loaded but can't find it now that it's for leting people subscribe to the newsletter w/o registering

 

(taste the raindow ;) )

Emiliano,

 

Okay. I found the problem.

 

  if ($selected_box == 'catalog') {
$contents[] = array('text'  => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_MANUFACTURERS . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_REVIEWS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_REVIEWS . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'.
	/* Optional Related Products (ORP) */
	'<a href="' . tep_href_link(FILENAME_RELATED_PRODUCTS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_RELATED_PRODUCTS . '</a>');
	//ORP:end
	/* Optional Related Products (ORP) */
	  tep_db_query("delete from " . TABLE_PRODUCTS_RELATED_PRODUCTS . " where pop_products_id_master = '" . (int)$product_id . "'");
	  tep_db_query("delete from " . TABLE_PRODUCTS_RELATED_PRODUCTS . " where pop_products_id_slave = '" . (int)$product_id . "'");
	//ORP: end
 }

 

There is code in this file that should be in categories.php:

 

Remove these lines from the catalog.php file:

		/* Optional Related Products (ORP) */
	  tep_db_query("delete from " . TABLE_PRODUCTS_RELATED_PRODUCTS . " where pop_products_id_master = '" . (int)$product_id . "'");
	  tep_db_query("delete from " . TABLE_PRODUCTS_RELATED_PRODUCTS . " where pop_products_id_slave = '" . (int)$product_id . "'");
	//ORP: end

Then double-check and make sure you completed Step 2 for a new install:

 

2) Add code to [catalog/]admin/categories.php, case 'delete_product_confirm':
  to remove all Related Product entries containing the removed product.
  Find, on or around line 154:
	  if ($product_categories['total'] == '0') {
		tep_remove_product($product_id);
	  }
	}

  Replace with:
	  if ($product_categories['total'] == '0') {
		tep_remove_product($product_id);
	  }
	/* Optional Related Products (ORP) */
	  tep_db_query("delete from " . TABLE_PRODUCTS_RELATED_PRODUCTS . " where pop_products_id_master = '" . (int)$product_id . "'");
	  tep_db_query("delete from " . TABLE_PRODUCTS_RELATED_PRODUCTS . " where pop_products_id_slave = '" . (int)$product_id . "'");
	//ORP: end
	}

 

Adding this code to the categories.php file causes the program to delete any records for a specific product if and when you delete that product. It has the potential of saving you a ton of work if your products change regularly (which is probably a real concern for your wife's site.)

 

By the way, don't use that subscription contribution. It's very poorly written, full of bugs, and doesn't handle the sql properly leaving your site wide open to sql injection attacks! (I read every page of the support thread. Scary stuff.) I've spent the past two weeks rewriting it from the ground up to use it on a client's site. When I'm finished, I'll let you know. (Could be another two weeks or more, the way things are going...) You will still need to find a good newsletter contribution, though, because I'm only rewriting the Subscription end of it. I'll be releasing it under a different name, too, as it will be a completely different contribution!

 

-Anita

Share this post


Link to post
Share on other sites
By the way, don't use that subscription contribution. It's very poorly written, full of bugs, and doesn't handle the sql properly leaving your site wide open to sql injection attacks! (I read every page of the support thread. Scary stuff.) I've spent the past two weeks rewriting it from the ground up to use it on a client's site. When I'm finished, I'll let you know. (Could be another two weeks or more, the way things are going...) You will still need to find a good newsletter contribution, though, because I'm only rewriting the Subscription end of it. I'll be releasing it under a different name, too, as it will be a completely different contribution!

 

I had the categories file ok, I don't know how I came up with that code at catalog file. Sorry about that :blush:

Are you talking about 'Newsletter & Subscribers' I don't need it right now, as a matter of fact my wife prefers to send mails from her mail client. Thanks for the advise, a was trying to convice her... ^_^

Share this post


Link to post
Share on other sites
I had the categories file ok, I don't know how I came up with that code at catalog file. Sorry about that :blush:

Are you talking about 'Newsletter & Subscribers' I don't need it right now, as a matter of fact my wife prefers to send mails from her mail client. Thanks for the advise, a was trying to convice her... ^_^

Don't worry about it. The only thing that's important is we found it and removed it.

 

I tried to make this contribution as easy to install as possible. But with almost any contribution, there are so many little changes here and there, it is really easy to skip a step or put code in the wrong file, or the wrong place in a file. It's the nature of the beast. That's why we have support threads in the forum. :)

 

And yes, I am talking about 'Newsletter & Subscribers'.

 

The premise is good. If someone likes the site and what you have to offer but aren't ready to make a purchase, they 'might' bookmark your site. They aren't going to create an account, though, just to get a newsletter. But if you can get them to sign up for your newsletter with just their name and email address, you can keep your products and your site on their mind with regular mailings. And they may eventually become regular customers.

 

The problem is in the execution of the premise. I don't want to disrespect the original contributor. However, there are a multitude of problems with the contribution, many people on the support thread just gave up trying to get it to work, and several posters pointed out the SQL injection attack vulnerability.

 

And from what I can tell, your wife probably has a lot more control over the look of her emails from her current email client than from the Admin of osCommerce, regardless of which Newsletter contribution you use...

 

Anyway, I'll PM you when the new contribution is ready.

 

Take care,

-Anita

Share this post


Link to post
Share on other sites
I have to check the versions for the contributions that are installed but just to give you an idea: sitemonitor, supertracker, linkpoint api, upsxml, ccgv trad (uninstalled but I still have some stuff of it around) and the one that enables more than one image I have to check the name, because I paid a programmer to install it.

 

When I uninstalled I just run the sql uninstall from the utility then I checked my website and everything was normal, so I didn't remove the code from the pages.

 

Today and tomorrow I have to go to work so I just can check back late. I appreciate yr help, thanks a lot.

 

Margaret

Margaret,

 

At your earliest convenience, run the sql utility to uninstall the sql stuff. That way, your site can look right while we figure this out.

 

Let me know when you are back from work. In the meantime, I'll checkout the contributions you listed.

 

-Anita

Share this post


Link to post
Share on other sites

Well, maybe too late but I'm back from work. I'll check all the contirbutions that I have.

Share this post


Link to post
Share on other sites

Hi Anita,

 

This is a copy of my catalog/product_info.php before I changed. When I was in the step 9 making the changes for new install I found the code that needed to be changed but it was like unavailable as you can see below, so I added the new code and removed the /* and */. Maybe is here the problem?

 

Margarete

 

 

<?php

 

/*

 

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

 

 

 

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

 

<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=yes,re

sizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,l

eft=150')

 

}

 

//--></script>

<script language="javascript"><!--

function MM_swapImgRestore() { //v3.0

var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

 

function MM_findObj(n, d) { //v4.01

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

if(!x && d.getElementById) x=d.getElementById(n); return x;

}

 

function MM_swapImage() { //v3.0

var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//--></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="100%" cellspacing="0" cellpadding="0">

 

<tr>

 

<!-- 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 cellspacing=0 cellpadding=0 width=100%><tr><td align=left>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<?php

 

if ($product_check['total'] < 1) {

 

?>

 

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

 

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

 

</table>

 

<?php

 

} else {

 

//BOF UltraPics

//BOF Original

/*

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

*/

//EOF Original

$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, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, 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 UltraPics

 

$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 pr_price style="color:#777777; font-size:11px">' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class=ch8>' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

 

} else {

 

$products_price ='<span pr_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'];

 

}

 

?>

 

<table cellspacing=0 cellpadding=0>

 

<tr><td width=485 valign=top>

 

<table width="485" cellpadding=0 cellspacing=0>

 

<tr><td width="490"><img src=images/m27.gif width=490 height=8></td>

</tr>

 

<tr><td class=ch8 valign=top>

 

<table width="485" cellpadding=0 cellspacing=0>

 

<tr><td height=8></td></tr>

 

<tr><td class=ml5 style="padding-left: 7px"><?=$products_name?></td></tr>

 

<tr><td height=8></td></tr>

 

<tr><td COLSPAN=2 style="padding-left: 5px">

 

<table width=470 height="1" cellpadding=0 cellspacing=0>

 

<tr><td bgcolor=#A6C279 height=1></td></tr>

</table>

 

</td></tr>

 

<tr valign="middle"><td width="60%" align="left">

 

 

 

 

 

 

 

 

 

<!-- display image -->

 

<?php

 

if (tep_not_null($product_info['products_image'])) {

 

?>

 

<table cellspacing="0" cellpadding="0" align="left" width="100%">

 

<tr valign="middle">

 

<td align="center" class="smallText" width="100%">

 

<!--BOF UltraPics-->

<?php

if ($product_info['products_image_med']!='') {

$new_image = $product_info['products_image_med'];

$image_width = MEDIUM_IMAGE_WIDTH;

$image_height = MEDIUM_IMAGE_HEIGHT;

} else {

$new_image = $product_info['products_image'];

$image_width = LARGE_IMAGE_WIDTH;

$image_height = LARGE_IMAGE_HEIGHT;

}

 

?>

<!--EOF UltraPics-->

 

<script language="javascript"><!--

 

//BOF UltraPics

//BOF Original

/*

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']), LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT, 'hspace="5" vspace="5" name="Image" align="middle"' ) . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

*/

//EOF Original

document.write('<?php echo tep_image(DIR_WS_IMAGES . $new_image, addslashes($product_info['products_name']), $image_width, $image_height, 'hspace="5" vspace="5" name="Image" align="left"'); ?>');

//EOF UltraPics

 

//--></script>

 

<noscript>

 

<!--BOF UltraPics-->

<!--BOF Original--><!--

<?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'], LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT, 'hspace="5" vspace="5" name="Image" align="middle"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>

--><!--EOF Original-->

<?php echo tep_image(DIR_WS_IMAGES . $new_image . 'ℑ=0', addslashes($product_info['products_name']), $image_width, $image_height, 'hspace="5" vspace="5" name="Image" align="left"'); ?>

<!--EOF UltraPics-->

</noscript> </td>

</tr>

</table>

 

<?php

 

}

 

?>

 

<!--end display image -->

 

 

 

</td>

<td width="20%" align="left">

<table width=100% cellspacing="0" cellpadding="0" align="left">

 

<!--BOF UltraPics-->

<?php

if (ULTIMATE_ADDITIONAL_IMAGES == 'enable') {

include(DIR_WS_MODULES . 'additional_images.php');

}

?>

<!--EOF UltraPics-->

</table>

</td>

 

</tr>

 

<tr>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<td width=282 valign=top>

 

<table width="336" border=0 cellpadding=0 cellspacing=0 style="padding-left:9px">

 

<!--<tr><td height=6></td></tr>-->

 

<!--<tr><td height=12></td></tr>-->

 

<tr><td width=300 valign=top>

 

<table cellspacing=2 cellpadding=2>

 

<!--<<tr><td class=ml6>

 

<?

 

if ($product_info['products_date_available'] > date('Y-m-d H:i:s'))

 

echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available']));

 

else

 

//echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added']));

 

?>

 

 

 

</td></tr>-->

 

<!--<tr><td height=4></td></tr> -->

 

<!--<tr><td><a style="text-decoration:underline" class=pr_descr href=<?=tep_href_link(FILENAME_TELL_A_FRIEND, tep_get_all_get_params())?>>Tell a Friend</a></td></tr>-->

 

 

 

<!--<tr><td height=16></td></tr> -->

 

<tr><td class=ch10>only: <?=$products_price?></td></tr>

 

<tr><td height=10></td></tr>

</table>

 

</td></tr>

 

<tr><td colspan=2 style="padding-left: 13px"><a href=<?=tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS)?></a><span style="padding-left: 5px"></span><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_BUY_NOW); ?></td></tr>

 

<tr><td height=8></td></tr>

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

 

<tr><td height=20></td></tr>

 

<tr><td colspan=3 align=center>

 

<table cellspacing=0 cellpadding=0 width=484>

 

<tr><td style="padding-left:7px">

 

<?php echo stripslashes($product_info['products_description']); ?>

 

</td></tr>

 

<tr><td style="padding-left:7px" height=17></td></tr>

</table>

 

</td></tr>

 

<tr><td height=2></td></tr>

</table>

 

</td></tr>

 

<tr><td><img src=images/m28.gif width=490 height=7></td></tr>

</table>

 

</td>

</tr>

</table>

 

 

 

 

 

 

 

 

 

<!----------------------- Not editable part -------------------------------->

 

 

 

<tr><td>

 

 

 

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

 

}

 

 

 

?>

 

<!--

 

<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_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>

 

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

 

</tr>

 

</table>

 

<!-- body_eof //-->

 

 

 

<!-- footer //-->

 

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

 

<!-- footer_eof //-->

 

</body>

 

</html>

 

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

Share this post


Link to post
Share on other sites

I think these are all the contributions that I have,

 

Anti Spambot Contact

SEO URLs

Easy Discount

Sitemonitor

Supertracker v3.2b

CCGV trad (uninstalled)

Linkpoint api

UPSXML v1.2.3.1

Customer Birthday Reminder

Fancier Invoice

Tracking Number

Ultra Pics v1.0

Share this post


Link to post
Share on other sites
I think these are all the contributions that I have,

 

Anti Spambot Contact

SEO URLs

Easy Discount

Sitemonitor

Supertracker v3.2b

CCGV trad (uninstalled)

Linkpoint api

UPSXML v1.2.3.1

Customer Birthday Reminder

Fancier Invoice

Tracking Number

Ultra Pics v1.0

Margaret,

 

I took a look at the contributions you listed earlier, but I didn't see anything obvious.

 

I think at this point we should try implementing the sql changes manually, one line at a time. Do you have access to phpMyAdmin, or similar program?

 

If so, run the following statements one by one, testing the product_info page after each change. Let's see if we can identify which change is causing the page to "shift" to the right.

 

 

INSERT INTO `configuration_group` VALUES ( '', 'Related Products', 'Optional Related Products module', '999', '1' );

Take note of the assigned group_id because you need to add it to the rest of the statements that follow. In each of the next statements, replace '@groupID' with the new group_id. Remember to test the product page after each statement has been added to the database.

 

INSERT INTO `configuration` VALUES ('', 'Current Version', 'RELATED_PRODUCTS_VERSION_INSTALLED', '4.0', 'This key is used by the SQL install to automatically update your database during upgrades. It is read only.', @groupID, '0', NULL, now(), NULL , 'tep_version_readonly(');

 

INSERT INTO `configuration` VALUES ('', 'Display Thumbnail Images', 'RELATED_PRODUCTS_SHOW_THUMBS', 'True', 'Show Product Image', @groupID, '1', NULL, now(), NULL , 'tep_cfg_select_option(array(\'True\', \'False\'),');

INSERT INTO `configuration` VALUES ('', 'Display Product Name', 'RELATED_PRODUCTS_SHOW_NAME', 'True', 'Show Product Name', @groupID, 2, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),');

INSERT INTO `configuration` VALUES ('', 'Display Product Model', 'RELATED_PRODUCTS_SHOW_MODEL', 'False', 'Show Product Model', @groupID, 3, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),');

INSERT INTO `configuration` VALUES ('', 'Display Price', 'RELATED_PRODUCTS_SHOW_PRICE', 'True', 'Show Product Price', @groupID, 4, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),');

INSERT INTO `configuration` VALUES ('', 'Display Quantity Available', 'RELATED_PRODUCTS_SHOW_QUANTITY', 'False', 'Show Product Quantity', @groupID, 5, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),');

INSERT INTO `configuration` VALUES ('', 'Display Buy Now Button', 'RELATED_PRODUCTS_SHOW_BUY_NOW', 'False', 'Show Buy Now Button', @groupID, 6, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),');

INSERT INTO `configuration` VALUES ('', 'Split Display Into Rows','RELATED_PRODUCTS_USE_ROWS','False','Set this option to True to display Related Products in multiple rows.',@groupID, 7,NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),');

INSERT INTO `configuration` VALUES ('', 'Define Number of Items Per Row','RELATED_PRODUCTS_PER_ROW','3','Maximum number of items to display per row when Split Display Into Rows is set to True.',@groupID, 8,NULL, now(),NULL,'');

INSERT INTO `configuration` VALUES ('', 'Define Number of Items to Display', 'RELATED_PRODUCTS_MAX_DISP', '0', 'Maximum number of Related Products to display. 0 is unlimited.', @groupID, 9, NULL, now(),NULL,'');

INSERT INTO `configuration` VALUES ('', 'Use Random Display Order', 'RELATED_PRODUCTS_RANDOMIZE', 'False', 'Adds random sort order to products displayed. Recommended if maximum number of products is set.', @groupID, 10, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),');

INSERT INTO `configuration` VALUES ('', 'Admin Display: Maximum Rows', 'MAX_ROW_LISTS_OPTIONS', '10', 'Sets the maximum number of rows to display per page.', @groupID, 11, NULL, now(),NULL,'');

INSERT INTO `configuration` VALUES ('', 'Admin Display: Drop-Down List Maximum Length', 'MAX_NAME_LENGTH', '25', 'Sets the maximum length (in characters) of product name displayed in drop-down lists. Enter \'0\' to set this option to false.', @groupID, 12, NULL, now(),NULL,'');

INSERT INTO `configuration` VALUES ('', 'Admin Display: Display List Maximum Length', 'MAX_DISPLAY_LENGTH', '0', 'Sets the maximum length (in characters) of product name displayed in list. Enter \'0\' to set this option to false.', @groupID, 13, NULL, now(),NULL,'');

INSERT INTO `configuration` VALUES ('', 'Admin Display: Use Product Model', 'ADMIN_USE_MODEL', 'False', 'Uses Product Model in lists. When Product Name is also selected, Product Model is displayed first.', @groupID, 14, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),');

INSERT INTO `configuration` VALUES ('', 'Admin Display: Use Product Name', 'ADMIN_USE_NAME', 'True', 'Uses Product Name in lists. When Product Model is also selected, Product Model is displayed first.', @groupID, 15, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),');

INSERT INTO `configuration` VALUES ('', 'Admin Display: Combine Model and Name separator', 'ADMIN_MODEL_SEPARATOR', ': ', 'Enter the characters you would like to separate Model from Name, when using both. Leave empty if only using Model.', @groupID, 16, NULL, now(),NULL,'');

INSERT INTO `configuration` VALUES ('', 'Admin Function: Use Delete Confirmation', 'CONFIRM_DELETE', 'True', 'When set to True, a confirmation box will pop-up when deleting an association. Set to False to Delete without confirmation.', @groupID, 18, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),');

INSERT INTO `configuration` VALUES ('', 'Admin Function: Combine Insert with Inherit', 'INSERT_AND_INHERIT', 'True', 'When set to True, clicking on Inherit will also Insert the product association. When False, Inherit works as before.', @groupID, 19, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),');

 

If one key causes the problem, write down the name of the key(i.e. RELATED_PRODUCTS_SHOW_THUMBS). Then using the following statement with the configuration key added, remove that key. Keep going and try each of the keys. Let's find out if the problem is with one key or several. (Or none of the keys. It could be the new table!)

 

DELETE FROM `configuration` WHERE configuration_key = 'CONFIGURATION_KEY_GOES_HERE';

 

While I wait for you to complete your testing, I'll look closely at the product_info.php file you posted.

 

-Anita

Share this post


Link to post
Share on other sites

Margaret,

 

After dissecting your product info code, I found it was missing a couple of end tags just before going into the product specifics, which is the part of the page that is shifting to the right. The tags are '</td></tr>'. Here's the fix:

 

Look for:

<!----------------------- Not editable part -------------------------------->
  <tr><td>
<?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 . "'");

 

And replace it with:

	  </td></tr>
<!----------------------- Not editable part -------------------------------->
  <tr><td>
<?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 . "'");

 

Also, by the location of the sql error, I can see where you placed the code for this contribution. In that location, the related products will display before the product, not a good idea. I believe I have figured out where to put the line so that the related products will display after the product. Try this:

 

Look for:

<?php
 }
?>
</table>
</form>
 </td>
<!-- body_text_eof //-->

 

And replace it with:

<?php
 }
?>
<?php include(DIR_WS_MODULES . FILENAME_RELATED_PRODUCTS); ?>
</table>
</form>
 </td>
<!-- body_text_eof //-->

 

This will put your related products under the product details, instead of above them.

 

And I now suspect that the location of the include statement, along with the missing end tags was the real reason for the shift, not the sql changes.

 

I hope you'll try these changes before doing the tedious chore of trying running each sql statement separately. If this doesn't fix it, then we can go back to trying each statement one by one.

 

-Anita

Share this post


Link to post
Share on other sites

Margarete,

 

So good to get your PM that your site is up and running with ORP. And equally glad we didn't have to wade through all those sql statements! So for those of you reading this thread, the problem was the missing end tags mentioned in my last post.

 

You can see it in action here: A very nice sterling silver Amethyst Lariat necklace. For now, that's the only product she's got set up with the related products.

 

Woo Hoo! :thumbsup:

 

(Okay. So I'm a little wound up. Been watching the UO Ducks play basketball in the college national tournament...)

 

:D

 

-Anita

Share this post


Link to post
Share on other sites

I should say the same WOO HOO!!!! I can't stop playing with this contribution, I've already added a lot of products.

 

Anita, thank you very much, your support to this contribution is great. I'm really gratefull for your help, the contribution is very good and works perfectly.

 

Margarete

Share this post


Link to post
Share on other sites
I should say the same WOO HOO!!!! I can't stop playing with this contribution, I've already added a lot of products.

 

Anita, thank you very much, your support to this contribution is great. I'm really gratefull for your help, the contribution is very good and works perfectly.

 

Margarete

Margarete,

 

I'm glad you're having so much fun! And I'm glad it's working "perfectly". (That was the goal...)

 

Have a great weekend.

 

-Anita

Share this post


Link to post
Share on other sites
Hi all!

 

If you are familiar with Optional Related Products Ver. 3.3, you know that I have stepped up to support and continue development of this useful contribution. There have been numerous requests for features, and I have tried to incorporate them in what is about to be a new release.

 

I've made some serious changes to Optional Related Products for Version 4.0! There are changes in the Admin and how it works, giving you more control over the looks and function; There are display options reminiscent of the product listing options, where you can decide what details to display on the page. The Optional Related Products code is now a module called by an include statement in products_info.html.

 

I am currently looking for a few beta testers! I need a couple of shop owners that have never installed the contribution, as well as one or two who would be upgrading. If you consider yourself a newbie to osCommerce, you're feed back could be invaluable in creating an installation guide that takes some of the pain out of the installation process. Don't be shy.

 

I'm looking for feedback on the installation procedure: Were the instructions easy to follow? Was everything there, etc.

 

The 'package' you'll receive is complete, except for a 'User's Guide" which I've just recently decided to create. (The user's guide is not needed to install the contribution. It will only explain what the various options are, how and why/when to use them.)

 

If you are interested in beta testing Version 4.0, please leave a post in this thread, and I'll PM you with further information.

 

I am hoping to release Version 4.0 no later than next Friday (02/23/2007).

 

Thanks in advance for your time.

-Skittles

 

I just finished installing it. I'm not a PHP expert by any means. Installation of this (like any other contribution) requires backing up of your files and database. Then, it requires paying close attention to detail, but it is a GREAT contribution, easy to understand, and all of the instructions were written clearly.

 

The only thing I want to do now is to change the gray color of the related products box, but I will find that and change it one of these days.

Thanks Again!

Share this post


Link to post
Share on other sites
I just finished installing it. I'm not a PHP expert by any means. Installation of this (like any other contribution) requires backing up of your files and database. Then, it requires paying close attention to detail, but it is a GREAT contribution, easy to understand, and all of the instructions were written clearly.

 

The only thing I want to do now is to change the gray color of the related products box, but I will find that and change it one of these days.

Thanks Again!

tjsocorrista,

 

Thank you. I'm glad you found it easy to understand. Hats off to the beta testers who helped me fine tune the installation guide!

 

The module is written so that the resulting box uses the same styles used for creating product listings on the catalog pages. In most case, this allows the resulting box to blend in with the site's existing design.

 

These styles are "productlisting", "productListing-heading", and "productListing-data". They are defined in the stylesheet.css file.

 

To change the look of the Related Products box, either edit these definitions, or use new styles.

 

I recommend using new styles IF you created new styles for your site design. Then if you make a change to the new style definitions, it will change the Related Products module at the same time.

 

To change from one style to another (i.e. "productlisting" to "new_productlisting") open the module file ([catalog/]includes/modules/optional_related_products.php) in your favorite text editor. Look for all instances of: class="productlisting" and change it to: class="new_productlisting". Very easy to do with the editor's Find and Replace function. Do this for each of the styles you are changing. Save and test.

 

As always, make a backup before making any changes.

 

Good Luck. And enjoy.

-Skittles

Share this post


Link to post
Share on other sites

Hi,

 

Firstly thank you for this contribution - I spent time looking into it and the feedback on the support was very good hence deciding to go for it, I thought it was easy to install and after playing around looks like it does the job very nicely........I have one inevitable question/problem!

 

I read the guide and saw that the 'sort order' should automatically be entered when using the inhibit function I think (following the example), anyway my 'sort order' field for all products whatever i do is always 0 - I can change them manually but they do not appear automatically - is this an issue or meant to be like this.

 

Also even with 'random' turned off in admin the related products keep moving around on refresh. Even when the sort order is 0 I read they shoul dbe listed alphabetically?

 

The spacing between the products in the 'related' box under product info is not consistant, it changes on refresh as the products move around but they are very rarely equally spaced - I don't know if this is normal or something I have done!

 

Thanks in advance :)

 

Becki

Share this post


Link to post
Share on other sites
1146 - Table 'databasename.TABLE_PRODUCTS_RELATED_PRODUCTS' doesn't exist

 

SELECT pop_products_id_slave, products_name, products_model, products_price, products_quantity, products_tax_class_id, products_image FROM TABLE_PRODUCTS_RELATED_PRODUCTS, products_description pa, products pb WHERE pop_products_id_slave = pa.products_id AND pa.products_id = pb.products_id AND language_id = '1' AND pop_products_id_master = '95' AND products_status='1' ORDER BY rand()

I get that at the bottom of my page. I installed everything and ran the sql setup utility... Any help?

Share this post


Link to post
Share on other sites
Hi,

 

Firstly thank you for this contribution - I spent time looking into it and the feedback on the support was very good hence deciding to go for it, I thought it was easy to install and after playing around looks like it does the job very nicely........I have one inevitable question/problem!

 

I read the guide and saw that the 'sort order' should automatically be entered when using the inhibit function I think (following the example), anyway my 'sort order' field for all products whatever i do is always 0 - I can change them manually but they do not appear automatically - is this an issue or meant to be like this.

 

Also even with 'random' turned off in admin the related products keep moving around on refresh. Even when the sort order is 0 I read they shoul dbe listed alphabetically?

 

The spacing between the products in the 'related' box under product info is not consistant, it changes on refresh as the products move around but they are very rarely equally spaced - I don't know if this is normal or something I have done!

 

Thanks in advance :)

 

Becki

Becki,

 

Thank you. I'm glad you like the contribution.

 

The sort order is a pain, in my opinion, but it was part of the contribution when I got involved. Sort order is not automatically entered. When you create a relationship, you must enter the sort order before performing the operation or it will be given a value of 0 (zero). if you enter a sort order for an Inherit operation, all of the resulting records will have the same sort order. So if you enter a 6 in the sort order and then Inherit three products, all three records will have a sort order of 6.

 

 

It seems I made a mistake in my User's Guide. If Random is not used, the products will first display in the sort order, then display in the order the records were created. If you prefer to have them sorted alphabetically, you can change the code in [catalog/]includes/modules/optional_related_products.php:

 

Around line 20, look for:

  $orderBy .= (RELATED_PRODUCTS_RANDOMIZE)?'rand()':'pop_order_id, pop_id';

Replace it with:

  $orderBy .= (RELATED_PRODUCTS_RANDOMIZE)?'rand()':'pop_order_id, products_name';

 

The spacing is actually a function of the length of the product name. The table cells adjust to accommodate the contents. If you would like to force the cells to be an equal width, you can make the following changes to the code in [catalog/]includes/modules/optional_related_products.php:

 

Around line 65, look for:

	  echo '<td class="productListing-data" align="center">' . "\n";
  // show thumb image if Enabled

And replace it with:

	  echo '<td class="productListing-data" align="center" valign="top" width="'. 100/RELATED_PRODUCTS_PER_ROW . '">' . "\n";
  // show thumb image if Enabled

 

As for the products 'moving around' on refresh, I'm not sure I know what you mean. My first thought was they continue to be displayed randomly. My second thought was it might be the spacing issue you brought up in the next paragraph.

 

Let me know if products are being displayed randomly even though the Random option is set to false and we'll troubleshoot from there.

 

In the meantime, I need to go make a correction to my User's Guide! :blush:

 

-Skittles

Share this post


Link to post
Share on other sites
1146 - Table 'databasename.TABLE_PRODUCTS_RELATED_PRODUCTS' doesn't exist

SELECT pop_products_id_slave, products_name, products_model, products_price, products_quantity, products_tax_class_id, products_image FROM TABLE_PRODUCTS_RELATED_PRODUCTS, products_description pa, products pb WHERE pop_products_id_slave = pa.products_id AND pa.products_id = pb.products_id AND language_id = '1' AND pop_products_id_master = '95' AND products_status='1' ORDER BY rand()

I get that at the bottom of my page. I installed everything and ran the sql setup utility... Any help?

macatticus,

 

Any time you see "TABLE_NAME_OF_TABLE_HERE" in an error message, it means the table wasn't defined in the database_table.php file.

 

The tables need to be defined for both the Admin and the Catalog. Because the files have identical names, and are both in the 'includes' directory, it is very easy to modify one file and then think you've completed that step. So open both [catalog/]includes/database_tables.php and [catalog/]admin/includes/database_tables.php and make sure they both have the following entry:

define('TABLE_PRODUCTS_RELATED_PRODUCTS', 'products_related_products');

Save the changes, and try again.

 

By the way, this is a very common installation blooper. I've seen variations of this question in virtually every support thread I've read for contributions that add a new database table.

 

-Skittles

Share this post


Link to post
Share on other sites
Becki,

 

As for the products 'moving around' on refresh, I'm not sure I know what you mean. My first thought was they continue to be displayed randomly. My second thought was it might be the spacing issue you brought up in the next paragraph.

 

Let me know if products are being displayed randomly even though the Random option is set to false and we'll troubleshoot from there.

 

In the meantime, I need to go make a correction to my User's Guide! :blush:

 

-Skittles

 

Thanks for the quick reply and answers! I want to force the width to be equal so that should do the job nicely :) I only have the internet at work at the moment so I will implement the changes tonight and report back!

 

As for the moving around I did mean that the products seems to display randomly even when random is off in the configuration. I suppose the two cases are linked as when the products move randomly the spacing obviously changes as as you say they are sized on product name but hopefully I will change that tonight. Have you got any ideas on this random behaviour?

 

Thanks

Becki

Share this post


Link to post
Share on other sites

Thank you so much, that worked like a charm... However I have one more question, is there any way to make it automatically relate products in a category? I have quite a few items and I don't want to go in manually and assign each one to other items. Any help is appreciated!

Share this post


Link to post
Share on other sites
Thanks for the quick reply and answers! I want to force the width to be equal so that should do the job nicely :) I only have the internet at work at the moment so I will implement the changes tonight and report back!

 

As for the moving around I did mean that the products seems to display randomly even when random is off in the configuration. I suppose the two cases are linked as when the products move randomly the spacing obviously changes as as you say they are sized on product name but hopefully I will change that tonight. Have you got any ideas on this random behaviour?

 

Thanks

Becki

Becki,

 

First and foremost, apply the changes to force the table cells to have equal widths. Then see if you still have the "Random" behavior. If so, try changing another option and see if that change is ignored, too. If all option changes are being ignored, we need to take a look at the database.

 

When you installed the sql, did you ever run the utility more than once? I've seen behavior like this with other contributions, where the option was set one way but the program acted like it was set the other. If there is more than one instance of the same configuration_key, the program will use the first one it encounters and ignore the rest.

 

So the first place I would have you look is in your configuration table. If you have access to phpMyAdmin or similar program, export just the configuration and configuration_group tables. If not, do a backup of the database from the Admin->Tools menu and download the backup file. Then find the two tables and copy them into a new file, (because it's usually easier to work with a smaller file!). In a text editor, use the "find" feature to locate 'RELATED_PRODUCTS_RANDOMIZE' and note the line number, then use "find again". If you find a second instance of the key, then that is the source of the problem.

 

Also check the configuration_group table for multiple entries for this contribution. If there are, you will see multiple entries for 'Related Products' in the left navigation in the Configuration menu. (You didn't mention this, so I'm assuming for now that you only have one listed in the menu.)

 

If you find multiple records for any or all of the configuration keys, you have some options for fixing it. Be sure you backup the database before making any changes, just to be on the safe side.

  1. Use the SQL Utility to make your changes to the database. (I ran the install a second time on my development site, and then the uninstall. It removed all records for Related Products from both tables in a single operation.)
    • Use the uninstall feature to remove all the sql statements for this contribution. (This will remove the new table, too.)
    • Using the same procedure you used to access the two tables, verify the data has been removed. If data records for only one group_id were removed, but records for one or more other group_ids remain, run the uninstall again. Then check the tables. If for some reason the data is removed for only one group_id at a time, you may need to repeat this instruction until all records for Related Products have been removed.
    • Once all the data records for Related Products have been removed from both the configuration table and the configuration_group table, run the New Install procedure from the SQL Utility.
    • Once again, access the two tables and verify there is only one instance of each record in both tables.
    • If using the SQL Utility doesn't remove the records, you will have to use one of the two manual methods below.

[*]Manually remove all the records for this contribution. Remove all records from the configuration table where configuration_key begins with 'RELATED_PRODUCTS_' and remove all records from the configuration_group table where configuration_group_title is 'Related Products'. Run the SQL Utility, using the "Upgrade Install" procedure. (This will preserve your new table and all the data in it.)

 

[*]Manually remove the duplicate records. If you do this, make sure the records that remain have the same configuration_group_id as the corresponding record in the configuration_group table. (This will preserve your new table and all the data in it.)

If you use the Uninstall procedure from the SQL Utility, you will need to restore the data to your products_related_products table if you don't want to start all over again. In the database backup file, locate the products_related_products table and copy all the 'INSERT INTO `products_related_products`' statements immediately following the table. Using phpMyAdmin or similar program, paste the copied lines into the SQL editor and click on "go" (may be 'run' or something like that if not using phpMyAdmin.) This should insert the data back into the table.

 

Let me know if you don't have direct access, but need to put the data back, and I'll create a little script that will do it for you. (I'll need those 'INSERT INTO `products_related_products`' statements, but don't post them. If it comes to that, I'll PM you with an email address and you can send them to me directly.)

 

Home is my place of business, so I'm usually available. (Though I was headed to bed about the same time as your last post, about 1:30 am here in Oregon. What time zone are you in?)

 

Talk to you soon,

-Skittles

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

×