Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] More_pics_6 v1.1 For osC 2.2 MS2


surfalot

Recommended Posts

  • Replies 1.6k
  • Created
  • Last Reply

Top Posters In This Topic

Okay, another noobie question dealing with this contribution.

 

This is my situation. One of the products I sell is camo wraps for off-road vehicles, boats, window film, etc. They have 15 different prints. I want to list all 15 pics with this contribution so in the color description in products attribute, they will know what color to choose.

 

My question is this: If I have 10 different products and want to list all 15 images for each product.... will my database have to carry the same 15 images for each product list, or do I have the option to point to the images already uploaded on the server?

 

Thanks again.

Link to comment
Share on other sites

If the images have the same name, there will only be one copy saved on your server, and the database will point to that copy for each place you specify that image. So there will be one image and multiple database entries.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Okay. Next problem. I feel that I installed as instructed... triple checked everything. When I open up a sample product to add images as a test. The stock image is broken... I see how it is looking for the image in catalog/images , and not catalog/images/dvd/ (I was editing a dvd)... so I figured it was no big deal. I opened up the OSC on my desktop and selected the image from the stock dvd folder. It loaded up fine and showed in the side window.

 

When I went to select the green button to include the images in the three choices... I get this message:

 

Fatal error: Call to undefined function tep_set_image_page() in /home/content/t/x/n/txngent/html/xxxxxxxx/catalog/admin/images.php on line 33

 

 

Any Ideas?

 

Thanks again.

Link to comment
Share on other sites

It looks like you missed a file change: tep_set_image_page() was added to the bottom of catalog/admin/includes/functions/general.php.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I've got a problem. I installed more pics 6 and it's works fine but then I installed also Related Products. And now there are no thumbnails in the Related Products on product_info.php.

Is there anyone who can help me with this, I tried several times to change the optinal_related_products.php but no success.

 

Thanks a lot.

 

Lieke

Link to comment
Share on other sites

Hi there,

 

I'm having a problem with the thumbnails. I've tried (almost) every combination of settings in the admin panel but can not correct the problem.

 

All my thumbnails are appearing squashed, regardless of the small image settings, both in the category display, infoboxes and product info screens.

 

Can anyone help?

 

View: http://www.priorycarsworle.co.uk/catalog/p...;products_id=28

hor-i-zon

Link to comment
Share on other sites

Lieke: Related Products will need to be modified to get its images from the the new images table. The code should be similar to the More Pics version of the boxes in catalog/includes/boxes/. If you can't figure it out, post the SQL from Related Products and we'll figure it out.

 

Andrew: In your Admin > Configuration > More Pics, set either Small Image Width or Small Image Height, and leave the other blank. If you set both, your images can be distorted.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi Jim,

 

I tried to make some changes in the includes\modules\optional_related_products.php but no success. Herewith I send you the code from admin\sql_setup_related_products.php.

 

thank you so much for looking at it.

 

Lieke

 

<?php
/*
 sql_setup_related_products.php
 SQL Setup Utility For Optional Related Products, Ver 4.0

 Copyright © 2007 Anita Cross (http://www.callofthewildphoto.com/)

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 $contrib = 'Related Products';
 $filename = FILENAME_RELATED_PRODUCTS;

 function install_ORP_to_sql($gid = 0) {
   $old_table_name = tep_db_fetch_array(tep_db_query("SHOW TABLES LIKE 'products_options_products'"));
   if (tep_not_null($old_table_name)) {
     tep_db_query("RENAME TABLE products_options_products TO products_related_products");
   }
   $insert_relationship_table = "CREATE TABLE IF NOT EXISTS `products_related_products` (
     `pop_id` int(11) NOT NULL auto_increment,
     `pop_products_id_master` int(11) NOT NULL default '0',
     `pop_products_id_slave` int(11) NOT NULL default '0',
     `pop_order_id` smallint(6) NOT NULL default '0',
     PRIMARY KEY  (`pop_id`)
   ) TYPE=MyISAM;";
   tep_db_query($insert_relationship_table);
   if (!$gid) {
     tep_db_query("INSERT INTO `configuration_group` VALUES ( '', 'Related Products', 'Optional Related Products module', '999', '1' )");
     $set_group_id = tep_db_insert_id();
   } else {
     $set_group_id = $gid;
   }
   tep_db_query("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.', " . $set_group_id . ", '0', NULL, now(), NULL , 'tep_version_readonly('),
                        ('', 'Display Thumbnail Images', 'RELATED_PRODUCTS_SHOW_THUMBS', 'True', 'Show Product Image', " . $set_group_id . ", '1', NULL, now(), NULL , 'tep_cfg_select_option(array(\'True\', \'False\'),'),
                        ('', 'Display Product Name', 'RELATED_PRODUCTS_SHOW_NAME', 'True', 'Show Product Name', " . $set_group_id . ", 2, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),'),
                        ('', 'Display Product Model', 'RELATED_PRODUCTS_SHOW_MODEL', 'False', 'Show Product Model', " . $set_group_id . ", 3, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),'),
                        ('', 'Display Price', 'RELATED_PRODUCTS_SHOW_PRICE', 'True', 'Show Product Price', " . $set_group_id . ", 4, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),'),
                        ('', 'Display Quantity Available', 'RELATED_PRODUCTS_SHOW_QUANTITY', 'False', 'Show Product Quantity', " . $set_group_id . ", 5, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),'),
                        ('', 'Display Buy Now Button', 'RELATED_PRODUCTS_SHOW_BUY_NOW', 'False', 'Show Buy Now Button', " . $set_group_id . ", 6, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),'),
                        ('', 'Split Display Into Rows','RELATED_PRODUCTS_USE_ROWS','False','Set this option to True to display Related Products in multiple rows.'," . $set_group_id . ", 7,NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),'),
                        ('', '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.'," . $set_group_id . ", 8,NULL, now(),NULL,''),
                        ('', 'Define Number of Items to Display', 'RELATED_PRODUCTS_MAX_DISP', '0', 'Maximum number of Related Products to display. 0 is unlimited.', " . $set_group_id . ", 9, NULL, now(),NULL,''),
                        ('', 'Use Random Display Order', 'RELATED_PRODUCTS_RANDOMIZE', 'False', 'Adds random sort order to products displayed. Recommended if maximum number of products is set.', " . $set_group_id . ", 10, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),'),
                        ('', 'Admin Display: Maximum Rows', 'RELATED_PRODUCTS_MAX_ROW_LISTS_OPTIONS', '10', 'Sets the maximum number of rows to display per page.', " . $set_group_id . ", 11, NULL, now(),NULL,''),
                        ('', 'Admin Display: Drop-Down List Maximum Length', 'RELATED_PRODUCTS_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.', " . $set_group_id . ", 12, NULL, now(),NULL,''),
                        ('', 'Admin Display: Display List Maximum Length', 'RELATED_PRODUCTS_MAX_DISPLAY_LENGTH', '0', 'Sets the maximum length (in characters) of product name displayed in list. Enter \'0\' to set this option to false.', " . $set_group_id . ", 13, NULL, now(),NULL,''),
                        ('', 'Admin Display: Use Product Model', 'RELATED_PRODUCTS_ADMIN_USE_MODEL', 'False', 'Uses Product Model in lists. When Product Name is also selected, Product Model is displayed first.', " . $set_group_id . ", 14, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),'),
                        ('', 'Admin Display: Use Product Name', 'RELATED_PRODUCTS_ADMIN_USE_NAME', 'True', 'Uses Product Name in lists. When Product Model is also selected, Product Model is displayed first.', " . $set_group_id . ", 15, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),'),
                        ('', 'Admin Display: Combine Model and Name separator', 'RELATED_PRODUCTS_ADMIN_MODEL_SEPARATOR', ': ', 'Enter the characters you would like to separate Model from Name, when using both. Leave empty if only using Model.', " . $set_group_id . ", 16, NULL, now(),NULL,''),
                        ('', 'Admin Function: Use Delete Confirmation', 'RELATED_PRODUCTS_CONFIRM_DELETE', 'True', 'When set to True, a confirmation box will pop-up when deleting an association. Set to False to Delete without confirmation.', " . $set_group_id . ", 17, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),'),
                        ('', 'Admin Function: Combine Insert with Inherit', 'RELATED_PRODUCTS_INSERT_AND_INHERIT', 'True', 'When set to True, clicking on Inherit will also Insert the product association. When False, Inherit works as before.', " . $set_group_id . ", 18, NULL, now(),NULL,'tep_cfg_select_option(array(\'True\', \'False\'),')
                       ");
 }

 function get_group_id($config_title) {
   $group_id_array = tep_db_fetch_array(tep_db_query("SELECT configuration_group_id FROM " . TABLE_CONFIGURATION_GROUP . " WHERE configuration_group_title like '". $config_title . "'"));
   if (sizeof($group_id_array <= 1)) {
     return $group_id_array['configuration_group_id'];
   }
   remove_group_id($contrib);
   return 0;
 }

 function remove_keys($gid) {
   if (tep_not_null($gid)) {
     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_group_id = '" . (int)$gid . "'");
   } else {
     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", keys()) . "')");
   }
 }

 function remove_group_id($title) {
     tep_db_query("delete from " . TABLE_CONFIGURATION_GROUP . " WHERE configuration_group_title = '" . $title . "'");
 }

 function remove_table() {
     tep_db_query("DROP TABLE IF EXISTS `products_related_products`");
 }

 function keys() {
   $keys = array();
   $keys[] = 'RELATED_PRODUCTS_VERSION_INSTALLED';
   $keys[] = 'MODULE_RELATED_PRODUCTS_SHOW_THUMBS';
   $keys[] = 'RELATED_PRODUCTS_SHOW_THUMBS';
   $keys[] = 'RELATED_PRODUCTS_SHOW_NAME';
   $keys[] = 'RELATED_PRODUCTS_SHOW_MODEL';
   $keys[] = 'RELATED_PRODUCTS_SHOW_PRICE';
   $keys[] = 'RELATED_PRODUCTS_SHOW_QUANTITY';
   $keys[] = 'RELATED_PRODUCTS_SHOW_BUY_NOW';
   $keys[] = 'RELATED_PRODUCTS_USE_ROWS';
   $keys[] = 'RELATED_PRODUCTS_PER_ROW';
   $keys[] = 'RELATED_PRODUCTS_MAX_DISP';
   $keys[] = 'RELATED_PRODUCTS_RANDOMIZE';
   $keys[] = 'RELATED_PRODUCTS_MAX_ROW_LISTS_OPTIONS';
   $keys[] = 'RELATED_PRODUCTS_MAX_NAME_LENGTH';
   $keys[] = 'RELATED_PRODUCTS_MAX_DISPLAY_LENGTH';
   $keys[] = 'RELATED_PRODUCTS_ADMIN_USE_MODEL';
   $keys[] = 'RELATED_PRODUCTS_ADMIN_USE_NAME';
   $keys[] = 'RELATED_PRODUCTS_ADMIN_MODEL_SEPARATOR';
   $keys[] = 'RELATED_PRODUCTS_CONFIRM_DELETE';
   $keys[] = 'RELATED_PRODUCTS_INSERT_AND_INHERIT';
   return $keys;
 }

 switch ($HTTP_GET_VARS['install']) {
   case ('new'):
     install_ORP_to_sql();
     tep_redirect(tep_href_link($filename));
     break;
   case ('remove'):
     $group_id = get_group_id($contrib);
     remove_keys($group_id);
     remove_group_id($contrib);
     remove_table();
     tep_redirect(tep_href_link($filename));
     break;
   case ('upgrade'):
     $group_id = get_group_id($contrib);
     remove_keys($group_id);
     install_ORP_to_sql($group_id);
     tep_redirect(tep_href_link($filename));
     break;
 }
?>
<!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>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<style>
.intro_section {padding:20px 20px 0px 20px;}
.intro_section p {width:590px;}
.intro_section b {font-size:.8em;font-weight:bold;color:#900;}
.setup_section {width:600px;border:solid 1px black;margin:10px;padding:3px 3px 10px 3px;}
.setup_section p {margin:10px;padding:3px}
</style>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<?php require(DIR_WS_INCLUDES . 'header.php'); /* header */?>
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<?php require(DIR_WS_INCLUDES . 'column_left.php'); /* left_navigation */?>
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
           <tr>
             <td class="pageHeading"> <?php echo HEADING_TITLE_ORP; ?> </td>
           </tr>
           <tr>
             <td class="intro_section">
               <p><?php echo TEXT_ORP_INTRODUCTION; ?></p>
               <p><b><?php echo TEXT_ORP_WARNING; ?></b></p>
             </td>
           </tr>
         </table>
       </td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td><form name="new_install" action="<?php echo tep_href_link('sql_setup_related_products.php'); ?>" method="get">
             <div class="setup_section"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td class="pageHeading"> <?php echo SECTION_TITLE_NEW_INSTALL; ?> </td>
             </tr>
             <tr>
               <td><p><?php echo SECTION_DESCRIPTION_NEW_INSTALL; ?></p>
               </td>
             </tr>
             <tr>
               <td>
               <p><?php echo tep_draw_hidden_field('install', 'new') . tep_image_submit('button_new_install_sql.gif', IMAGE_BUTTON_NEW_INSTALL_SQL); ?></p>
               </td>
             </tr>
           </table></div>
           </form></td>
         </tr>
         <tr>
           <td><form name="update_install" action="<?php echo tep_href_link('sql_setup_related_products.php'); ?>" method="get">
             <div class="setup_section"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td class="pageHeading"> <?php echo SECTION_TITLE_UPGRADE; ?> </td>
             </tr>
             <tr>
               <td><p><?php echo SECTION_DESCRIPTION_UPGRADE; ?></p>
               </td>
             </tr>
             <tr>
               <td>
               <p><?php echo tep_draw_hidden_field('install', 'upgrade') . tep_image_submit('button_upgrade_sql.gif', IMAGE_BUTTON_UPGRADE_SQL); ?></p>
               </td>
             </tr>
           </table></div>
           </form></td>
         </tr>
         <tr>
           <td><form name="update_install" action="<?php echo tep_href_link('sql_setup_related_products.php'); ?>" method="get">
             <div class="setup_section"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td class="pageHeading"> <?php echo SECTION_TITLE_REMOVE; ?> </td>
             </tr>
             <tr>
               <td><p><?php echo SECTION_DESCRIPTION_REMOVE; ?></p>
               </td>
             </tr>
             <tr>
               <td>
               <p><?php $param = 'onclick="var x=confirm(\''. TEXT_CONFIRM_REMOVE_SQL . '\')"';
                         echo tep_draw_hidden_field('install', 'remove')
                            . tep_image_submit('button_remove_sql.gif', IMAGE_BUTTON_REMOVE_SQL, $param); ?></p>
               </td>
             </tr>
           </table></div>
           </form></td>
         </tr>
       </table>
       </td>
     </tr>
   </table></td>
 </tr>
</table>
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


 

Lieke: Related Products will need to be modified to get its images from the the new images table. The code should be similar to the More Pics version of the boxes in catalog/includes/boxes/. If you can't figure it out, post the SQL from Related Products and we'll figure it out.

 

Andrew: In your Admin > Configuration > More Pics, set either Small Image Width or Small Image Height, and leave the other blank. If you set both, your images can be distorted.

 

Regards

Jim

Link to comment
Share on other sites

Jim,

 

I wanted to thank you for the work you have provided on this contribution. I installed it (along with the fix for the admin area) and it works great.

 

I have a suggestion for the next release of the catalog/includes/modules/more_pics.php code. It would be good to add the addslashes($images['image_filename']) in the javascript section around line 76.

 

I know it is not good practice, but my wife has used apostrophes in the image name. I don't know of any problem with adding this and it would help others with similar filenaming naming conventions.

 

Thanks again,

Bill

 

document.write(\'<a href="java script:popupWindow(\\\'' . tep_href_link (FILENAME_POPUP_IMAGE, 'pID=' . 
$product_info['products_id'] . '&display=' . $image_no) . '\\\')">' . tep_image (DIR_WS_IMAGES . 
addslashes($images['image_filename']), addslashes ($product_info['products_name']), $mopics_image_width, 
$mopics_image_height, 'hspace="5" vspace="5"') . '<br>' . tep_image (DIR_WS_IMAGES . 'zoom.gif') . '</a>\');

Link to comment
Share on other sites

Yes, that will work, but it's still an illegal URI. The only allowed characters are alphanumerics, dot (period), and dash. Underscores are illegal but tolerated. Everything else is encoded, resulting in an ugly but (hopefully) usable address. Some browsers still have problems with certain characters in the string. The best practice is still to avoid the use of illegal characters.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I'm trying to get this to work with STS, but the instructions in the download only account for STS 4.2, and obviously haven't been updated in awhile (Since the code additions still reference subimage1, subimage2, etc...)

 

Can you help me get this working with the latest STS? Right now, neither tag is working on product_info.php

 

You can see what I'm talking about: http://tinyurl.com/atgdu2

 

The $product_popup$ isn't printing anything, and the $mopics_output$ isn't being parsed at all.

 

Any help you can offer is very appreciated.

 

Thanks,

Kevin

Link to comment
Share on other sites

I don't have a copy of STS set up, and I don't have time to learn it right now. You can probably figure it out by comparing stock osCommerce pages to the modified More Pics version of the same page. If you can't figure it out, post the SQL that STS uses to retrieve the images and I'll give it a try.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I don't have a copy of STS set up, and I don't have time to learn it right now. You can probably figure it out by comparing stock osCommerce pages to the modified More Pics version of the same page. If you can't figure it out, post the SQL that STS uses to retrieve the images and I'll give it a try.

 

Regards

Jim

 

If I simply let STS do its thing and give product_info the same layout as the rest of the pages, the extra images show up fine. The problem lies in the fact that our product info layout needs to be fairly different. Because of this, we had set up a custom content page in STS for product_info, which, according to the instructions suplied with the More Images mod, should work on STS 4.2 (Unfortunately, that version was released some 3 years ago)

 

Perhaps since More Images is working when I don't define a custom content page for product_info, I'll simply make the changes to the PHP instead of using a template for it...

Link to comment
Share on other sites

This is one of the reasons I dislike templates -- It may make your site easier to set up at first, but you lose out when you try to add other Contributions.

 

It sounds like your custom template is missing some of the More Pics code that the standard STS is handling. Maybe a comparison between the two templates will yield some insight. Or maybe it's just faster to mod the code as you said.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Jim,

 

I made some progress, I'm almost there but need some input.

 

I changed the code in the catalog\includes\modules\optional_related_products.php:

 

from:

// show thumb image if Enabled

if (RELATED_PRODUCTS_SHOW_THUMBS == 'True') {

echo '<a href="' products_image. tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">' . "\n"

. tep_image(DIR_WS_IMAGES . $attributes_values['products_image'], $attributes_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"').'</a><br>' . "\n";

}

 

to:

// show thumb image if Enabled

if (RELATED_PRODUCTS_SHOW_THUMBS == 'True') {

echo '<a href="' . tep_href_link (FILENAME_PRODUCT_INFO, tep_get_all_get_params() . '#morepics') . '">' . tep_image (DIR_WS_IMAGES . $products_main_image, $product_info['products_name'], (MORE_PICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_WIDTH), (MORE_PICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br></a>';

 

And now the frontend shows a thumbnail but of course from the orginal image and not from the related product.

 

I have to put somewhere the $products_id_slave?

 

}

 

Thanks in advance

Link to comment
Share on other sites

I'm not familiar with the way the template changes the products page, but you should probably leave that 'products_id=' . $products_id_slave alone.

 

Did you copy over the code that defines $products_main_image?

	$product_images_query = tep_db_query ("select image_filename
									   from " . TABLE_PRODUCTS_IMAGES . " 
									   where products_id = '" . (int) $_GET['products_id'] . "'
										 and product_page = '1'
									");
$product_images = tep_db_fetch_array ($product_images_query);
$products_main_image = $product_images['image_filename'];

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Jim,

 

I think I'm not clear. More pics is working just fine. But I installed Related Products and thats nog compatible with more pics. Now the products info.php shows the thumbnail and the images of the product and then the Related Products: and then their should be thumbnails of the product_slave but now its shows the thumbnail of the main product. See the image. So I've to tell that the thumbnail must be the one from the product_slave but how?

 

Lieke

 

voorbeeld.gif

 

 

 

 

 

 

I'm not familiar with the way the template changes the products page, but you should probably leave that 'products_id=' . $products_id_slave alone.

 

Did you copy over the code that defines $products_main_image?

	$product_images_query = tep_db_query ("select image_filename
									   from " . TABLE_PRODUCTS_IMAGES . " 
									   where products_id = '" . (int) $_GET['products_id'] . "'
										 and product_page = '1'
									");
$product_images = tep_db_fetch_array ($product_images_query);
$products_main_image = $product_images['image_filename'];

 

Regards

Jim

Link to comment
Share on other sites

In that case, you need to add similar code to get your slave image. The following should work:

	$slave_images_query = tep_db_query ("select image_filename
									 from " . TABLE_PRODUCTS_IMAGES . "
									 where products_id = '" . (int) $products_id_slave . "'
									   and product_page = '1'
								  ");
$slave_images = tep_db_fetch_array ($slave_images_query);
$products_slave_image = $slave_images['image_filename'];

Use $products_slave_image as the image name in the Related Products box.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Jim,

 

I appreciate your input very very much but I'm not getting there. It's driving me crazy.

With the changes you send me I get the filename of the related product but not the thumbnail. And I think it's a very small change but don't no what grrrrrrr.

 

The code of the product_info.php is now:

<?php
/*
 $Id: product_info.php 1739 2007-12-20 00:52:16Z hpdl $
 $Loc: catalog/ $
 $Mod: 20081216 More Pics 2.0 kymation $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 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=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></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="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  Removed images
   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, 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);

   tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

   if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
     $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
   } else {
     $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
   }

   if (tep_not_null($product_info['products_model'])) {
     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
     $products_name = $product_info['products_name'];
   }
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
           <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td class="main">
       <?php
If (($product_info['products_quantity']<>0) and ($product_info['products_price']>0)) {
   echo '' . tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/in_stock.gif', IMAGE_BUTTON_IN_STOCK). '<br><br>';
}
else
{
echo '' . tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/out_stock.gif', IMAGE_BUTTON_OUT_STOCK) . '<br><br>';
}
?>
<?php 
   // BOF: More Pics
   if (MORE_PICS_TABLE_LOCATION == 'above' || MORE_PICS_TABLE_LOCATION == 'sides') {
     include (DIR_WS_MODULES . FILENAME_MORE_PICS);
   }

   $product_images_query = tep_db_query ("select image_filename
                                          from " . TABLE_PRODUCTS_IMAGES . " 
                                          where products_id = '" . (int) $_GET['products_id'] . "'
                                            and product_page = '1'
                                       ");
   $product_images = tep_db_fetch_array ($product_images_query);
   $products_main_image = $product_images['image_filename'];



   if (tep_not_null ($products_main_image) && MORE_PICS_SHOW_ORIG_ON_PRODUCT_INFO == 'true') {
?>
         <table border="0" cellspacing="0" cellpadding="2" align="right">
           <tr>
             <td align="center" class="smallText">
<?php 
   if (MORE_PICS_LINK_CSS_IMAGES == 'true') {
     echo '<a href="' . tep_href_link (FILENAME_PRODUCT_INFO, tep_get_all_get_params() . '#morepics') . '">' . tep_image (DIR_WS_IMAGES . $products_main_image, $product_info['products_name'], (MORE_PICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_WIDTH), (MORE_PICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br></a>'; 
   } else {
?>
<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 . $products_main_image, addslashes($product_info['products_name']), (MORE_PICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_WIDTH), (MORE_PICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br><img border=0 src=images/zoom.gif></a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link (DIR_WS_IMAGES . $products_main_image) . '" target="_blank">' . tep_image (DIR_WS_IMAGES . $products_main_image, $product_info['products_name'], (MORE_PICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_WIDTH), (MORE_PICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br><img border=0 src=images/zoom.gif></a>'; ?>
</noscript>
<br>
<?php
If (($product_info['products_quantity']<>0) and ($product_info['products_price']>0)) {
   echo '<br>' . tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/in_stock.gif', IMAGE_BUTTON_IN_STOCK). '<br><br>';
}
else
{
echo '<br>' . tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/out_stock.gif', IMAGE_BUTTON_OUT_STOCK). '<br><br>';
}
?>
<?php 
   } // if (MORE_PICS_LINK_CSS_IMAGES ... else ...
// EOF: More Pics
?>
             </td>
           </tr>
         </table>
<?php
   }
// Points/Rewards system V2.1rc2a BOF
   if ((USE_POINTS_SYSTEM == 'true') && (DISPLAY_POINTS_INFO == 'true')) {
    if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
	    $products_price_points = tep_display_points($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
    } else {
	    $products_price_points = tep_display_points($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
    }
    $products_points = tep_calc_products_price_points($products_price_points);
    $products_points_value = tep_calc_price_pvalue($products_points);
    if ((USE_POINTS_FOR_SPECIALS == 'true') || $new_price == false) {
	    echo '<p>' . sprintf(TEXT_PRODUCT_POINTS , number_format($products_points,POINTS_DECIMAL_PLACES), $currencies->format($products_points_value)) . '</p>';
    }
   }
// Points/Rewards system V2.1rc2a EOF
?>
         <p><?php echo stripslashes($product_info['products_description']);  ?></p>
<?php
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
?>
         <table border="0" cellspacing="0" cellpadding="2">
           <tr>
             <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
           </tr>
<?php
     $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
       $products_options_array = array();
       $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
       while ($products_options = tep_db_fetch_array($products_options_query)) {
         $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
         if ($products_options['options_values_price'] != '0') {
           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
         }
       }

       if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
         $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
       } else {
         $selected_attribute = false;
       }
?>
           <tr>
             <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
             <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
           </tr>
<?php
     }
?>
         </table>
<?php
   }
// BOF: More Pics 6
  if (MORE_PICS_TABLE_LOCATION == 'below') {
     include (DIR_WS_MODULES . FILENAME_MORE_PICS);
  }
// 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>
               <td class="main"> </td>
               <td class="main" align="right"><?php If (($product_info['products_quantity']<>0) and ($product_info['products_price']>0)) {
   echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); 
}else{
   echo tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/button_out_stock.gif', IMAGE_BUTTON_OUT_STOCK); 

} ?></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>
<?php
 if (MORE_PICS_TABLE_LOCATION == 'bottom') {
?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td align="center" class="smallText"><?php include_once (DIR_WS_MODULES . FILENAME_MORE_PICS); ?></td>
     </tr>
<?php
 }
?> <?php include(DIR_WS_MODULES . FILENAME_RELATED_PRODUCTS);
$slave_images_query = tep_db_query ("select image_filename
                                        from " . TABLE_PRODUCTS_IMAGES . "
                                        where products_id = '" . (int) $products_id_slave . "'
                                          and product_page = '1'
                                     ");
   $slave_images = tep_db_fetch_array ($slave_images_query);
   $products_slave_image = $slave_images['image_filename']; ?>    </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'); ?>

 

 

 

And from the related_products.php:

 

<?php

/*
 $Id: optional_related_products.php, ver 1.0 02/05/2007 Exp $

 Part of Contribution: Optional Related Products Ver 4.0

 Based on code from Optional Relate Products, ver 2.0 05/01/2005
 Copyright © 2004-2005 Daniel Bahna ([email protected])

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Released under the GNU General Public License
*/

 $orderBy = 'ORDER BY ';
 $orderBy .= (RELATED_PRODUCTS_RANDOMIZE)?'rand()':'pop_order_id, pop_id';
 $orderBy .= (RELATED_PRODUCTS_MAX_DISP)?' limit ' . RELATED_PRODUCTS_MAX_DISP:'';
 $attributes = "
        SELECT
        pop_products_id_slave,
        products_name,
        products_model,
        products_price,
        products_quantity,
        products_tax_class_id,
        products_image
        FROM " .
        TABLE_PRODUCTS_RELATED_PRODUCTS . ", " .
        TABLE_PRODUCTS_DESCRIPTION . " pa, ".
        TABLE_PRODUCTS . " pb
        WHERE pop_products_id_slave = pa.products_id
        AND pa.products_id = pb.products_id
        AND language_id = '" . (int)$languages_id . "'
        AND pop_products_id_master = '".$HTTP_GET_VARS['products_id']."'
        AND products_status='1' " . $orderBy;
 $attribute_query = tep_db_query($attributes);

 if (mysql_num_rows($attribute_query)>0) {
 $count = 0;
?>
<tr>
 <td>
   <table class="productlisting" border="0" cellspacing="0" cellpadding="2" width="100%">
   <tr>
     <td align="center" class="productListing-heading"> <?php echo TEXT_RELATED_PRODUCTS ?> </td>
   </tr><tr>
     <td align="center" class="productListing-data">
       <table border="0" cellspacing="0" cellpadding="2" width="100%" align="center">
       <tr>
<?php
   while ($attributes_values = tep_db_fetch_array($attribute_query)) {
     $products_name_slave = ($attributes_values['products_name']);
     $products_model_slave = ($attributes_values['products_model']);
     $products_qty_slave = ($attributes_values['products_quantity']);
     $products_id_slave = ($attributes_values['pop_products_id_slave']);
     if ($new_price = tep_get_products_special_price($products_id_slave)) {
       $products_price_slave = $currencies->display_price($new_price, tep_get_tax_rate($attributes_values['products_tax_class_id']));
     } else {
       $products_price_slave = $currencies->display_price($attributes_values['products_price'], tep_get_tax_rate($attributes_values['products_tax_class_id']));
     }
     echo '<td class="productListing-data" align="center">' . "\n";
     // show thumb image if Enabled
     if (RELATED_PRODUCTS_SHOW_THUMBS == 'True') {
       echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">' . "\n"
            . tep_image(DIR_WS_IMAGES . $attributes_values['products_slave_image'], $attributes_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"').'</a><br>' . "\n";
     }
     $caption = '';
     if (RELATED_PRODUCTS_SHOW_NAME == 'True') {
       $caption .= '<p>' . $products_name_slave;
       if (RELATED_PRODUCTS_SHOW_MODEL == 'True') {
         $caption .= sprintf(RELATED_PRODUCTS_MODEL_COMBO, $products_model_slave);
       }
       $caption .= '</p>' . "\n";
     } elseif (RELATED_PRODUCTS_SHOW_MODEL == 'True') {
       $caption .=  '<p>' . $products_model_slave . '</p>' . "\n";
     }
     if (RELATED_PRODUCTS_SHOW_PRICE == 'True') {
       $caption .= '<p>' . sprintf(RELATED_PRODUCTS_PRICE_TEXT, $products_price_slave) . '</p>' . "\n";
     }
     if (RELATED_PRODUCTS_SHOW_QUANTITY == 'True') {
       $caption .= '<p>' . sprintf(RELATED_PRODUCTS_QUANTITY_TEXT, $products_qty_slave) . '</p>' . "\n";
     }
     echo '<a href="'
					. tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">'
					. $caption . '</a>' . "\n";
     if (RELATED_PRODUCTS_SHOW_BUY_NOW== 'True') {
       echo '<a href="'
					. tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))
					. 'action=rp_buy_now&rp_products_id=' . $products_id_slave) . '">'
					. tep_image_button('button_rp_buy_now.gif', IMAGE_BUTTON_RP_BUY_NOW) . '</a>';
     }
     echo '</td>' . "\n";
     $count++;
     if ((RELATED_PRODUCTS_USE_ROWS == 'True') && ($count%RELATED_PRODUCTS_PER_ROW == 0)) {
       echo '</tr><tr>' . "\n";
     }
   }
?>
       </tr></table>
     </td>
   </tr></table>
 </td>
</tr>
<?php
}
?>

 

and this is the result:

 

voorbeeld.gif

 

Best regards

 

Lieke

 

In that case, you need to add similar code to get your slave image. The following should work:

	$slave_images_query = tep_db_query ("select image_filename
									 from " . TABLE_PRODUCTS_IMAGES . "
									 where products_id = '" . (int) $products_id_slave . "'
									   and product_page = '1'
								  ");
$slave_images = tep_db_fetch_array ($slave_images_query);
$products_slave_image = $slave_images['image_filename'];

Use $products_slave_image as the image name in the Related Products box.

 

Regards

Jim

Link to comment
Share on other sites

Hi Jim,

Newbie here

First I'd like to thank you for this contribution.

 

I downloaded your More Pics 2.0.5

Followed the instruction in Read_me.txt and saw "Copy all the text from the

database_additions.txt file"

I couldn't find that txt file anywhere in the extracted folder

I went ahead and installed the package anyway

The link "More Pics" showed up under Configuration; however there was no "Product Images" as shown in the included screencapture picture.

I did upload some pictures to the /images folder but only one picture showed up for each product.

Is this because I'm missing database_additions.txt?

Thanks in advanced for your help, Jim.

Link to comment
Share on other sites

<snipped>

Lieke

Try this (Not tested, so may contain typos):

<?php
/*
$Id: optional_related_products.php, ver 1.0 02/05/2007 Exp $

Part of Contribution: Optional Related Products Ver 4.0

Based on code from Optional Relate Products, ver 2.0 05/01/2005
Copyright © 2004-2005 Daniel Bahna ([email protected])

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

Released under the GNU General Public License
*/

$orderBy = 'ORDER BY ';
$orderBy .= (RELATED_PRODUCTS_RANDOMIZE) ? 'rand()' : 'pop_order_id, pop_id';
$orderBy .= (RELATED_PRODUCTS_MAX_DISP) ? ' limit ' . RELATED_PRODUCTS_MAX_DISP : '';
$attributes = "SELECT prp.pop_products_id_slave,
				  pa.products_name,
				  pb.products_model,
				  pb.products_price,
				  pb.products_quantity,
				  pb.products_tax_class_id,
				  pi.image_filename
		   FROM " . TABLE_PRODUCTS_RELATED_PRODUCTS . " prp, 
				" . TABLE_PRODUCTS_DESCRIPTION . " pa, 
				" . TABLE_PRODUCTS . " pb
			 left join " . TABLE_PRODUCTS_IMAGES . " pi 
			   on pb.products_id = pi.products_id 
				 and pi.category_page = '1',
		   WHERE prp.pop_products_id_slave = pa.products_id
			 AND pa.products_id = pb.products_id
			 AND pa.language_id = '" . (int) $languages_id . "'
			 AND prp.pop_products_id_master = '" . $HTTP_GET_VARS['products_id'] . "'
			 AND products_status = '1' " . $orderBy;
$attribute_query = tep_db_query($attributes);

if (mysql_num_rows($attribute_query) > 0) {
 $count = 0;
?>
<tr>
 <td><table class="productlisting" border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
  <td align="center" class="productListing-heading"> <?php echo TEXT_RELATED_PRODUCTS ?> </td>
</tr>
<tr>
  <td align="center" class="productListing-data"><table border="0" cellspacing="0" cellpadding="2" width="100%" align="center">
	<tr>
<?php

 while ($attributes_values = tep_db_fetch_array($attribute_query)) {
$products_name_slave = ($attributes_values['products_name']);
$products_model_slave = ($attributes_values['products_model']);
$products_qty_slave = ($attributes_values['products_quantity']);
$products_id_slave = ($attributes_values['pop_products_id_slave']);
if ($new_price = tep_get_products_special_price($products_id_slave)) {
  $products_price_slave = $currencies->display_price($new_price, tep_get_tax_rate($attributes_values['products_tax_class_id']));
} else {
  $products_price_slave = $currencies->display_price($attributes_values['products_price'], tep_get_tax_rate($attributes_values['products_tax_class_id']));
}
echo '<td class="productListing-data" align="center">' . "\n";
// show thumb image if Enabled
if (RELATED_PRODUCTS_SHOW_THUMBS == 'True') {
  echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">' . "\n" . tep_image(DIR_WS_IMAGES . $attributes_values['image_filename'], $attributes_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a><br>' . "\n";
}
$caption = '';
if (RELATED_PRODUCTS_SHOW_NAME == 'True') {
  $caption .= '<p>' . $products_name_slave;
  if (RELATED_PRODUCTS_SHOW_MODEL == 'True') {
	$caption .= sprintf(RELATED_PRODUCTS_MODEL_COMBO, $products_model_slave);
  }
  $caption .= '</p>' . "\n";
}
elseif (RELATED_PRODUCTS_SHOW_MODEL == 'True') {
  $caption .= '<p>' . $products_model_slave . '</p>' . "\n";
}
if (RELATED_PRODUCTS_SHOW_PRICE == 'True') {
  $caption .= '<p>' . sprintf(RELATED_PRODUCTS_PRICE_TEXT, $products_price_slave) . '</p>' . "\n";
}
if (RELATED_PRODUCTS_SHOW_QUANTITY == 'True') {
  $caption .= '<p>' . sprintf(RELATED_PRODUCTS_QUANTITY_TEXT, $products_qty_slave) . '</p>' . "\n";
}
echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">' . $caption . '</a>' . "\n";
if (RELATED_PRODUCTS_SHOW_BUY_NOW == 'True') {
  echo '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array (
	'action'
  )) . 'action=rp_buy_now&rp_products_id=' . $products_id_slave) . '">' . tep_image_button('button_rp_buy_now.gif', IMAGE_BUTTON_RP_BUY_NOW) . '</a>';
}
echo '</td>' . "\n";
$count++;
if ((RELATED_PRODUCTS_USE_ROWS == 'True') && ($count % RELATED_PRODUCTS_PER_ROW == 0)) {
  echo '</tr><tr>' . "\n";
}
 }
?>
	</tr>
  </table></td>
</tr>
 </table></td>
</tr>
<?php
}
?>

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

<snipped>

Is this because I'm missing database_additions.txt?

Thanks in advanced for your help, Jim.

Yes, that's an error in the instructions. The file is database.sql, and it's essential. I'll fix the error in the next release. Thanks for pointing it out.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Yes, that's an error in the instructions. The file is database.sql, and it's essential. I'll fix the error in the next release. Thanks for pointing it out.

 

Regards

Jim

Could you temporary post the instruction as how to fix the error? :blush:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...