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

Usually by looking at the records you kept of which addons you installed. Yes, I realize that people sometimes inherit someone else's mistakes, so:

  • Classic More Pics adds six new fields to the products table, named products_subimage1, products_subimage2, etc.
  • Advanced adds a new table named products_images to the database.

If you have both, it's likely that someone upgraded from Classic to Advanced at some time. Or they were very confused.

 

The exact version is probably not all that important for what you are doing.

 

Regards

Jim

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

Link to comment
Share on other sites

First make a backup of your database. Then copy the following script to a new file on your server. View this file in your browser. After you get the success message, delete the file. Do not run this file more than once.

<?php
/*
 $Id: upgrade_to_2.3.php, v1.0 20101124 Kymation Exp $
 $Loc: catalog/ $

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

 Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

 require_once ('includes/application_top.php');

 // Create the new images table
 tep_db_query ("
   CREATE TABLE IF NOT EXISTS products_images (
     id int NOT NULL auto_increment,
     products_id int NOT NULL,
     image varchar(64),
     htmlcontent text,
     sort_order int NOT NULL,
     PRIMARY KEY (id),
     KEY products_images_prodid (products_id)
   );
 ");

 // Get the image data from the products table
 $products_image_query_raw = "
   select
     products_subimage1,
     products_subimage2,
     products_subimage3,
     products_subimage4,
     products_subimage5,
     products_subimage6,
     products_id
   from " . TABLE_PRODUCTS . "
 ";
 $products_image_query = tep_db_query ($products_image_query_raw);

 // Step through all of the products and copy the image data to the new table where it exists
 $products_count = 0;
 while ($products_image = tep_db_fetch_array ($products_image_query) ) {
   if ($products_image['products_subimage1'] != '') {
     tep_db_query ("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
                    SET image = '" . $products_image['products_subimage1'] . "',
                        products_id = '" . (int) $products_image['products_id'] . "',
                        sort_order = '1'
                 ");
     $products_count++;
   } // if ($products_image

   if ($products_image['products_subimage2'] != '') {
     tep_db_query ("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
                    SET image = '" . $products_image['products_subimage2'] . "',
                        products_id = '" . (int) $products_image['products_id'] . "',
                        sort_order = '2'
                 ");
     $products_count++;
   } // if ($products_image

   if ($products_image['products_subimage3'] != '') {
     tep_db_query ("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
                    SET image = '" . $products_image['products_subimage3'] . "',
                        products_id = '" . (int) $products_image['products_id'] . "',
                        sort_order = '3'
                 ");
     $products_count++;
   } // if ($products_image

   if ($products_image['products_subimage4'] != '') {
     tep_db_query ("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
                    SET image = '" . $products_image['products_subimage4'] . "',
                        products_id = '" . (int) $products_image['products_id'] . "',
                        sort_order = '4'
                 ");
     $products_count++;
   } // if ($products_image

   if ($products_image['products_subimage5'] != '') {
     tep_db_query ("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
                    SET image = '" . $products_image['products_subimage5'] . "',
                        products_id = '" . (int) $products_image['products_id'] . "',
                        sort_order = '5'
                 ");
     $products_count++;
   } // if ($products_image

   if ($products_image['products_subimage6'] != '') {
     tep_db_query ("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
                    SET image = '" . $products_image['products_subimage6'] . "',
                        products_id = '" . (int) $products_image['products_id'] . "',
                        sort_order = '6'
                 ");
     $products_count++;
   } // if ($products_image
 } // while ($products_image


?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
 <title>More Pictures Image Copy - Upgrade Version</title>
 <meta name="robots" content="noindex,nofollow">
 <link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>

<body>
 <div>
   <div style="float: right; padding-top: 20px; padding-right: 15px; color: #000000; font-weight: bold;"><a href="http://www.oscommerce.com" target="_blank">osCommerce Website</a>  |  <a href="http://www.oscommerce.com/support" target="_blank">Support</a>  |  <a href="http://www.oscommerce.info" target="_blank">Documentation</a></div>
     <a href="index.php"><img src="images/oscommerce_silver-22.jpg" border="0" width="250" height="50" title="osCommerce Online Merchant v2.2" style="margin: 10px 10px 0px 10px;" /></a>
 </div>

 <div style="padding-top: 60px; color: #1000FF">
   Your database hase been updated. <?php echo $products_count; ?> images were copied.
 </div>

 <h1 color=red>Do NOT reload this page!</h1>In fact, go delete this file Right Now!

 <div style="padding-top: 40px; padding-left: 15px;">
   Copyright © 2008 <a href="http://www.oscommerce.com" target="_blank">osCommerce</a> (<a href="http://www.oscommerce.com/about/copyright" target="_blank">Copyright Policy</a>, <a href="http://www.oscommerce.com/about/trademark" target="_blank">Trademark Policy</a>)<br />osCommerce provides no warranty and is redistributable under the <a href="http://www.fsf.org/licenses/gpl.txt" target="_blank">GNU General Public License</a>
 </div>
</body>
</html>

Once you have verified that everything is working correctly in 2.3.x you can delete the fields products_subimage1, products_subimage2, etc. from your products table.

 

I haven't tested this, so please report any bugs here.

 

Regards

Jim

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

Link to comment
Share on other sites

First make a backup of your database. Then copy the following script to a new file on your server. View this file in your browser. After you get the success message, delete the file. Do not run this file more than once.

<?php
/*
 $Id: upgrade_to_2.3.php, v1.0 20101124 Kymation Exp $
 $Loc: catalog/ $

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

 Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

 require_once ('includes/application_top.php');

 // Create the new images table
 tep_db_query ("
   CREATE TABLE IF NOT EXISTS products_images (
     id int NOT NULL auto_increment,
     products_id int NOT NULL,
     image varchar(64),
     htmlcontent text,
     sort_order int NOT NULL,
     PRIMARY KEY (id),
     KEY products_images_prodid (products_id)
   );
 ");

 // Get the image data from the products table
 $products_image_query_raw = "
   select
     products_subimage1,
     products_subimage2,
     products_subimage3,
     products_subimage4,
     products_subimage5,
     products_subimage6,
     products_id
   from " . TABLE_PRODUCTS . "
 ";
 $products_image_query = tep_db_query ($products_image_query_raw);

 // Step through all of the products and copy the image data to the new table where it exists
 $products_count = 0;
 while ($products_image = tep_db_fetch_array ($products_image_query) ) {
   if ($products_image['products_subimage1'] != '') {
     tep_db_query ("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
                    SET image = '" . $products_image['products_subimage1'] . "',
                        products_id = '" . (int) $products_image['products_id'] . "',
                        sort_order = '1'
                 ");
     $products_count++;
   } // if ($products_image

   if ($products_image['products_subimage2'] != '') {
     tep_db_query ("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
                    SET image = '" . $products_image['products_subimage2'] . "',
                        products_id = '" . (int) $products_image['products_id'] . "',
                        sort_order = '2'
                 ");
     $products_count++;
   } // if ($products_image

   if ($products_image['products_subimage3'] != '') {
     tep_db_query ("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
                    SET image = '" . $products_image['products_subimage3'] . "',
                        products_id = '" . (int) $products_image['products_id'] . "',
                        sort_order = '3'
                 ");
     $products_count++;
   } // if ($products_image

   if ($products_image['products_subimage4'] != '') {
     tep_db_query ("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
                    SET image = '" . $products_image['products_subimage4'] . "',
                        products_id = '" . (int) $products_image['products_id'] . "',
                        sort_order = '4'
                 ");
     $products_count++;
   } // if ($products_image

   if ($products_image['products_subimage5'] != '') {
     tep_db_query ("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
                    SET image = '" . $products_image['products_subimage5'] . "',
                        products_id = '" . (int) $products_image['products_id'] . "',
                        sort_order = '5'
                 ");
     $products_count++;
   } // if ($products_image

   if ($products_image['products_subimage6'] != '') {
     tep_db_query ("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "
                    SET image = '" . $products_image['products_subimage6'] . "',
                        products_id = '" . (int) $products_image['products_id'] . "',
                        sort_order = '6'
                 ");
     $products_count++;
   } // if ($products_image
 } // while ($products_image


?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
 <title>More Pictures Image Copy - Upgrade Version</title>
 <meta name="robots" content="noindex,nofollow">
 <link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>

<body>
 <div>
   <div style="float: right; padding-top: 20px; padding-right: 15px; color: #000000; font-weight: bold;"><a href="http://www.oscommerce.com" target="_blank">osCommerce Website</a>  |  <a href="http://www.oscommerce.com/support" target="_blank">Support</a>  |  <a href="http://www.oscommerce.info" target="_blank">Documentation</a></div>
     <a href="index.php"><img src="images/oscommerce_silver-22.jpg" border="0" width="250" height="50" title="osCommerce Online Merchant v2.2" style="margin: 10px 10px 0px 10px;" /></a>
 </div>

 <div style="padding-top: 60px; color: #1000FF">
   Your database hase been updated. <?php echo $products_count; ?> images were copied.
 </div>

 <h1 color=red>Do NOT reload this page!</h1>In fact, go delete this file Right Now!

 <div style="padding-top: 40px; padding-left: 15px;">
   Copyright © 2008 <a href="http://www.oscommerce.com" target="_blank">osCommerce</a> (<a href="http://www.oscommerce.com/about/copyright" target="_blank">Copyright Policy</a>, <a href="http://www.oscommerce.com/about/trademark" target="_blank">Trademark Policy</a>)<br />osCommerce provides no warranty and is redistributable under the <a href="http://www.fsf.org/licenses/gpl.txt" target="_blank">GNU General Public License</a>
 </div>
</body>
</html>

Once you have verified that everything is working correctly in 2.3.x you can delete the fields products_subimage1, products_subimage2, etc. from your products table.

 

I haven't tested this, so please report any bugs here.

 

Regards

Jim

 

It worked :D just a small issue, the main image does not show now when you click on a item just second and third image?

 

http://www.koolkatjazz.com/oscommerce-2.3.1/catalog/index.php

 

Any idea

Link to comment
Share on other sites

The main image is in the same place in 2.3.x as it is in 2.2x. I can't think of any reason those should not work. Check your products table in the database -- are the image names there?

 

Regards

Jim

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

Link to comment
Share on other sites

The main image is in the same place in 2.3.x as it is in 2.2x. I can't think of any reason those should not work. Check your products table in the database -- are the image names there?

 

Regards

Jim

 

Jim,

 

If you click on any of these products you will see that the main image does not show up, The page I sent earlier I did manually add the mail images.

 

http://www.koolkatjazz.com/oscommerce-2.3.1/catalog/index.php/wild-guitars-c-67?

 

The main images was there before the transfer of the extra images, but very large and not re-sized.

 

Happy Turkey Day

Link to comment
Share on other sites

The main images are showing on the page that you linked. They don't show on the individual product pages because osC 2.3 is coded to show only the large images if they exist. You'll need to add your original images as large images for them to show on the product page.

 

Regards

Jim

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

Link to comment
Share on other sites

The main images are showing on the page that you linked. They don't show on the individual product pages because osC 2.3 is coded to show only the large images if they exist. You'll need to add your original images as large images for them to show on the product page.

 

Regards

Jim

 

Jim, that is over 1200 images, any chance you could write a script like the last one to do this? Please

 

Cheers

Link to comment
Share on other sites

''If you want your images in a grid (columns and rows) change your Admin > Configuration > More Pics > Use CSS Format to false. You can then set the number of rows and columns that you want to see''

But I lost my big images. Just the thumbnails is showing. Is not good for me. I want my big image and the thumbnails in many columns and rows below my big image. Someone know?

see exemple!

http://aircraftcollection.com/product_info.php?products_id=152

 

Thank you

Edited by Helhe
Link to comment
Share on other sites

You have an idea how to do? I do not want to change the file for error more_pics.php. you can direct me?

 

// Set up the table containing the small images

$small_images_string .= '<table border="0" cellspacing="0" cellpadding="2">' . "\n";

// Single row if Top or Bottom, so start that here

if (MORE_PICS_IMAGE_LOCATION == 'Top' || MORE_PICS_IMAGE_LOCATION == 'Bottom') {

$small_images_string .= ' <tr>' . "\n";

}

 

I do not know how ?

Thank

Link to comment
Share on other sites

Sorry, I don't have the time to design this for you. It shouldn't be that hard to set up a loop to count the images and add a '</td><td>' after every n images.

 

Regards

Jim

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

Link to comment
Share on other sites

Sorry, I don't have the time to design this for you. It shouldn't be that hard to set up a loop to count the images and add a '</td><td>' after every n images.

 

Regards

Jim

thank you for your support Jim, '</ Td> <td>' is a clue? ...I'll do some research and try to I get there.

I will work hard because the php is not my field, I believe that anything is possible. .. I appreciate your reponse.

 

Thank you again

Link to comment
Share on other sites

I really have trouble. how to write:

''LIMIT 0,5 in the first row and gives me LIMIT 6,12 in the second rows. I'll always have about 12 pictures for each model

Is it possible to place it in the code file in more_pics.php? or do I really put '</td><td>' after every n images?

 

Thank you

Link to comment
Share on other sites

Hello, someone can help me? I just can not seem to make a loop to count 5 pictures and add a '</ td> <td> to have 2 or 3 rows of 5 pictures in the file more_pics.php. I just try and read around on the Net, I'm not good enough in this program.

I'd greatly appreciate your help

Thank you

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

Hello! I Installed more pics classic to my oscommerce. It works fine, but my only problem is that i cant see product pictures in catalog. Theres only empty space. I think that is my configure.php wrong:

<?php
 define('HTTP_SERVER', 'http://www.mydomain.com');
 define('HTTPS_SERVER', 'http://www.mydomain.com.com');
 define('ENABLE_SSL', false);
 define('HTTP_COOKIE_DOMAIN', 'www.mydomain.com');
 define('HTTPS_COOKIE_DOMAIN', 'www.mydomain.com');
 define('HTTP_COOKIE_PATH', '/');
 define('HTTPS_COOKIE_PATH', '/');
 define('DIR_WS_HTTP_CATALOG', '/');
 define('DIR_WS_HTTPS_CATALOG', '/');
 define('DIR_WS_IMAGES', 'images/');
 define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
 define('DIR_WS_INCLUDES', 'includes/');
 define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
 define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
 define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
 define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
 define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
 define('DIR_FS_CATALOG', '/homez/myuser/www/mystore/');
 define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
 define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 define('DB_SERVER', 'x');
 define('DB_SERVER_USERNAME', 'x');
 define('DB_SERVER_PASSWORD', 'x');
 define('DB_DATABASE', 'x');
 define('USE_PCONNECT', 'false');
 define('STORE_SESSIONS', 'mysql');
?>

Link to comment
Share on other sites

Your configure.php looks fine. More Pics doesn't make any changes there in any case. You have probably made a mistake in your installation. Start with the changes to catalog/product_info.php. I would use a file comparison program to compare the file in the distribution with yours.

 

Regards

Jim

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

Link to comment
Share on other sites

Your configure.php looks fine. More Pics doesn't make any changes there in any case. You have probably made a mistake in your installation. Start with the changes to catalog/product_info.php. I would use a file comparison program to compare the file in the distribution with yours.

 

Regards

Jim

Ok thanks. I believe too that my product_info.php is messing. My product_info was a littlebit different than normal because it included a layout. I posted my product_info.php into pastebin, could you watch it if something is wrong. Heres my modified product_info.php: http://pastebin.com/mUBjNym1

 

Appreciating yours help very mych,

jAmesson.

Link to comment
Share on other sites

I've never seen the "layout" you are using. I can't tell if that's correct because the format is so different. Sorry, you're going to have to debug this one yourself.

 

Regards

Jim

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

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...

Hi,

 

I have been using Advanced More Pics and like it very much but I have moved to 2.3.1 and that one includes multiple images but how do I transfer in all the extra images I have?

 

I find on forum How upgrade for Classic version of More Pics but I can't find information for Advanced.

 

Can you help me?

 

Thank you

Link to comment
Share on other sites

It depends on which version of More Pics and whether you are using Classic or Advanced.

 

Regards

Jim

Hello, I have been using Advanced More Pics, can you to explain for me How I can upgrade Advanced version?

Thank you

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