Jump to content



Latest News: (loading..)

- - - - -

[Contribution] More_pics_6 v1.1 For osC 2.2 MS2


  • Please log in to reply
1575 replies to this topic

#1   surfalot

surfalot
  • Members
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 29 November 2005 - 06:00 AM

Abstract:
More Pics 6 allows you to add up to 6 additional pics to each product. The pics
can be different sizes and different types (jpg,gif,png,...). The image pop-up
will display forward and next buttons so the customer can page through each
larger image without needing to go back to the main product page. You will have
the ability to configure the number of rows and columns to display the products
in on the main products info page. If more images are defined then columns and
rows are defined the remaining images can be viewed in the pop-up. You will also
be able to configure whether the images show above the description, below the
description or on either side of the description.

Many thanks to all that have contributed to this contrib. All are credited.

Get it here:
http://www.oscommerce.com/community/contributions,1611

#2   spear

spear
  • Members
  • 30 posts
  • Real Name:spear

Posted 02 December 2005 - 09:50 AM

Thank you for this contribution surfalot !
I want to install it, but I can't, because I am with oscommerce template. In your readme file you say "use file compare program to see the difference", but in my case when I compare, for example, product_info.php all is completely different.
Do you have list with all additional code which I have to add to my already modified code?

#3   surfalot

surfalot
  • Members
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 02 December 2005 - 06:03 PM

How I would proceed in that case would be to compare the contrib file with the original file from a fresh download of osC2.2MS2. Then it will become obvious what parts changed and you can try to work out where it's suppose to go in your heavily modified file from that.

I marked the changes with "BOF: More Pics 6" and "EOF: More Pics".  there are only 4 changes.  All the line numbers are referencing the contrib's product_info.php.

1) lines 72-74: is simply adding
p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6,
to the line original line 72 that starts (placed after p.products_image,) :
$product_info_query = tep_db_query("select p.products_id...

2) Lines 90-133 are all new. Placed just before the end php code tag ( ?> ) that comes after the change above.

3) line 149: In the product_info.php of the contrib package I have commented out the original image code using /*  */ so it can remain for reference. I'm thinking of adding a switch to easily turn on and off the contrib completely which will use the code, so don't remove it, just comment it out like in line 149 of  product_info.php in the contrib. This is the original code
<?php
	if (tep_not_null($product_info['products_image'])) {
?>
		  <table border="0" cellspacing="0" cellpadding="2" align="right">
			<tr>
			  <td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
			  </td>
			</tr>
		  </table>
<?php
	}
Replace with
<?php /* BOF: More Pics 6
	if (tep_not_null($product_info['products_image'])) {
?>
		  <table border="0" cellspacing="0" cellpadding="2" align="right">
			<tr>
			  <td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
			  </td>
			</tr>
		  </table>
<?php
	}  */
	if (MOPICS_TABLE_LOCATION=='above') {
	  echo '		  <table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
			  <td align="center" class="smallText">'.$mopics_output.'</td>
			</tr>
		  </table>
		   <br>'."\n";
	} else if (MOPICS_TABLE_LOCATION=='sides') {
	  echo $mopics_output;
	}
// EOF: More Pics 6
?>

4) Add the code in Lines 216 to 225, all new.

Hope that helps.

#4   spear

spear
  • Members
  • 30 posts
  • Real Name:spear

Posted 02 December 2005 - 07:37 PM

Yes this helps me a lot. Thank you for your fast support !

#5   dainbramaged05

dainbramaged05
  • Members
  • 17 posts
  • Real Name:Cody

Posted 06 December 2005 - 10:10 PM

For some reason, the delete image won't work with my install? Does this happen to anyone else, I need to remove an image that I added but it won't remove.

#6   surfalot

surfalot
  • Members
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 06 December 2005 - 10:51 PM

View Postdainbramaged05, on Dec 6 2005, 05:10 PM, said:

For some reason, the delete image won't work with my install? Does this happen to anyone else, I need to remove an image that I added but it won't remove.
So you check the "delete image" checkbox and the image is not removed from the server?

#7   surfalot

surfalot
  • Members
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 07 December 2005 - 01:50 AM

I just loaded it on my test site and it's working for me.

If that is all that is going wrong, I would suggest that maybe the block code in lines 230-285 in /admin/categories.php of the package didn't get in your production file. If the code worked to setup and upload the image, then you have have the right permissions on the folder (should be: 666).

#8   dainbramaged05

dainbramaged05
  • Members
  • 17 posts
  • Real Name:Cody

Posted 07 December 2005 - 06:43 AM

I'll check the permissions on the folder, but I have the latest version of the script, just installed today, working fine, I can upload images and they show perfectly fine, but when I check the box to remove them they don't get removed from the item page or from the server.

#9   surfalot

surfalot
  • Members
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 07 December 2005 - 07:00 AM

If the physical file is not getting deleted AND the image name is not getting removed from the product entry, then it's probably the block of code I mensioned above didn't get inserted. Both of those things are done in that code block.

#10   dainbramaged05

dainbramaged05
  • Members
  • 17 posts
  • Real Name:Cody

Posted 07 December 2005 - 07:36 PM

// BOF: More Pics 6
		  if (isset($HTTP_POST_VARS['products_subimage1']) && tep_not_null($HTTP_POST_VARS['products_subimage1']) && ($HTTP_POST_VARS['products_subimage1'] != 'none')) {
			$sql_data_array['products_subimage1'] = tep_db_prepare_input($HTTP_POST_VARS['products_subimage1']);
		  }
		  //add delete image function
 			if ($HTTP_POST_VARS['delete_image_3'] == 'yes') {
				unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS[products_subimage1]);
				$sql_data_array['products_subimage1'] = tep_db_prepare_input($HTTP_POST_VARS['none']);
		  }
		  //end delete image function 
		  if (isset($HTTP_POST_VARS['products_subimage2']) && tep_not_null($HTTP_POST_VARS['products_subimage2']) && ($HTTP_POST_VARS['products_subimage1'] != 'none')) {
			$sql_data_array['products_subimage2'] = tep_db_prepare_input($HTTP_POST_VARS['products_subimage2']);
		  }
		  //add delete image function
 			if ($HTTP_POST_VARS['delete_image_5'] == 'yes') {
				unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS[products_subimage2]);
				$sql_data_array['products_subimage2'] = tep_db_prepare_input($HTTP_POST_VARS['none']);
		  }
		  //end delete image function
		  if (isset($HTTP_POST_VARS['products_subimage3']) && tep_not_null($HTTP_POST_VARS['products_subimage3']) && ($HTTP_POST_VARS['products_subimage3'] != 'none')) {
			$sql_data_array['products_subimage3'] = tep_db_prepare_input($HTTP_POST_VARS['products_subimage3']);
		  }
		  //add delete image function
 			if ($HTTP_POST_VARS['delete_image_7'] == 'yes') {
				unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS[products_subimage3]);
				$sql_data_array['products_subimage3'] = tep_db_prepare_input($HTTP_POST_VARS['none']);
		  }
		  //end delete image function
					if (isset($HTTP_POST_VARS['products_subimage4']) && tep_not_null($HTTP_POST_VARS['products_subimage4']) && ($HTTP_POST_VARS['products_subimage4'] != 'none')) {
			$sql_data_array['products_subimage4'] = tep_db_prepare_input($HTTP_POST_VARS['products_subimage4']);
		  }
		  //add delete image function
 			if ($HTTP_POST_VARS['delete_image_9'] == 'yes') {
				unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS[products_subimage4]);
				$sql_data_array['products_subimage4'] = tep_db_prepare_input($HTTP_POST_VARS['none']);
		  }
		  //end delete image function
					if (isset($HTTP_POST_VARS['products_subimage5']) && tep_not_null($HTTP_POST_VARS['products_subimage5']) && ($HTTP_POST_VARS['products_subimage5'] != 'none')) {
			$sql_data_array['products_subimage5'] = tep_db_prepare_input($HTTP_POST_VARS['products_subimage5']);
		  }
		  //add delete image function
 			if ($HTTP_POST_VARS['delete_image_11'] == 'yes') {
				unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS[products_subimage5]);
				$sql_data_array['products_subimage5'] = tep_db_prepare_input($HTTP_POST_VARS['none']);
		  }
		  //end delete image function
		  if (isset($HTTP_POST_VARS['products_subimage6']) && tep_not_null($HTTP_POST_VARS['products_subimage6']) && ($HTTP_POST_VARS['products_subimage6'] != 'none')) {
			$sql_data_array['products_subimage6'] = tep_db_prepare_input($HTTP_POST_VARS['products_subimage6']);
		  }
		  //add delete image function
 			if ($HTTP_POST_VARS['delete_image_13'] == 'yes') {
				unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS[products_subimage6]);
				$sql_data_array['products_subimage6'] = tep_db_prepare_input($HTTP_POST_VARS['none']);
		  }
		  //end delete image function
// EOF: More Pics 6

This code? When I change the permissions on the images folder, none of the images show up, just a red x.

Edited by dainbramaged05, 07 December 2005 - 07:38 PM.


#11   dainbramaged05

dainbramaged05
  • Members
  • 17 posts
  • Real Name:Cody

Posted 07 December 2005 - 07:59 PM

I got it. I think.

#12   surfalot

surfalot
  • Members
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 07 December 2005 - 08:06 PM

That looks like that's it. if that is lines 230-285 in /admin/categories.php. Make sure that got inserted in your production file.

change the permissions to the images folder back to 755 or whatever it was (should have been 755). that wasn't the problem.

Edited by surfalot, 07 December 2005 - 08:07 PM.


#13   thespazzers

thespazzers
  • Members
  • 11 posts
  • Real Name:Ted

Posted 10 December 2005 - 12:52 AM

I'm trying to load the More_pics module and find the 'database_additions.txt' file very confusing. I'm OK until I get to the 'configuration' value inserts.

Can anyone please give me some simple instructions?

Using MyPHPAdmin, I got to the 'configuration' part, click on insert and that's where I get lost. The instructions don't help much.

Thanks

#14   surfalot

surfalot
  • Members
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 10 December 2005 - 02:01 AM

in phpMyAdmin, click on the little "SQL" link image.  Copy all the text from the database_additions.txt file into the Run SQL query window, click go.  that's all there is to that.

#15   doctorstupid

doctorstupid
  • Members
  • 93 posts
  • Real Name:Tom Young

Posted 14 December 2005 - 02:30 AM

I'm almost done installing this, I've already modified my files as necessary, however when I attempt the INSERT SQL queries, it fails. This is what I come up with, the "MySQL Said" box is empty.

SQL query:

INSERT INTO configuration_group( configuration_group_id, configuration_group_title, configuration_group_description, sort_order, visible )
VALUES ( 6124, 'More Pics', 'Configuration Options for More Pics', 20, 1 )
MySQL said:




Little help please? I've tried pasting into the query box, and selecting a text file, same result both ways. MySQL5, phpmyadmin 2.6.4, php4.

#16   surfalot

surfalot
  • Members
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 14 December 2005 - 03:48 AM

Try this  line instead of the one you mentioned:
INSERT INTO `configuration_group` (`configuration_group_id`, `configuration_group_title`, `configuration_group_description`, `sort_order`, `visible`) VALUES (6124, 'More Pics', 'Configuration Options for More Pics', 20, 1);


#17   doctorstupid

doctorstupid
  • Members
  • 93 posts
  • Real Name:Tom Young

Posted 14 December 2005 - 05:58 AM

SQL query: 

INSERT INTO `configuration_group` ( `configuration_group_id` , `configuration_group_title` , `configuration_group_description` , `sort_order` , `visible` ) 
VALUES ( 6124, 'More Pics', 'Configuration Options for More Pics', 20, 1 ) 
MySQL said:  

#1062 - Duplicate entry '6124' for key 1
I don't recall ever having been successful, so I'm not sure why I would be seing a duplicate entry.

So I tried skipping that one, moved onto the following ones, same thing

SQL query: 

INSERT INTO `configuration` 
VALUES (

'', 'Show All MorePics on Product Info page', 'MOPICS_SHOW_ALL_ON_PRODUCT_INFO', 'true', 'Show All extra images from the MorePics contrib on Product Info page.', 6124, NULL , now( ) , now( ) , NULL , 'tep_cfg_select_option(array(''true'', ''false''),'
) 
MySQL said:
I think I got an out of range value error at some point. I'm totally lost here.

Edited by doctorstupid, 14 December 2005 - 05:58 AM.


#18   doctorstupid

doctorstupid
  • Members
  • 93 posts
  • Real Name:Tom Young

Posted 14 December 2005 - 06:00 AM

Oh, when I enter the queries one at a time I get the out of range error:

SQL query: 

INSERT INTO `configuration` 
VALUES (

'', 'Show All MorePics on Product Info page', 'MOPICS_SHOW_ALL_ON_PRODUCT_INFO', 'true', 'Show All extra images from the MorePics contrib on Product Info page.', 6124, NULL , now( ) , now( ) , NULL , 'tep_cfg_select_option(array(''true'', ''false''),'
) 
MySQL said:  

#1264 - Out of range value adjusted for column 'configuration_id' at row 1


#19   surfalot

surfalot
  • Members
  • 2,295 posts
  • Real Name:Todd Holforty
  • Gender:Male
  • Location:I'm right here!

Posted 14 December 2005 - 08:03 AM

try these (hopefully the board will keep this spaced right):
INSERT INTO `configuration` ( `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ( 'Show All MorePics on Product Info page', 'MOPICS_SHOW_ALL_ON_PRODUCT_INFO', 'true', 'Show All extra images from the MorePics contrib on Product Info page.', 6124, NULL, now(), now(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),');
INSERT INTO `configuration` ( `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ( 'Use SMALL_IMAGE_ Restrictions', 'MOPICS_RESTRICT_IMAGE_SIZE', 'true', 'Restrict product images to SMALL_IMAGE_WIDTH and SMALL_IMAGE_HEIGHT values.', 6124, NULL, now(), now(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),');
INSERT INTO `configuration` ( `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ( 'Table Alignment', 'MOPICS_TABLE_ALIGNMENT', 'right', 'Align Pics table to the left or to the right of the products description.', 6124, NULL, now(), now(), NULL, 'tep_cfg_select_option(array(''left'', ''right'', ''center''),');
INSERT INTO `configuration` ( `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ( 'Table Location', 'MOPICS_TABLE_LOCATION', 'sides', 'Align Pics table to the sides, above or below description.', 6124, NULL, now(), now(), NULL, 'tep_cfg_select_option(array(''sides'', ''above'', ''below''),');
INSERT INTO `configuration` ( `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ( 'Number of Columns', 'MOPICS_NUMBER_OF_COLS', '1', 'Number of columns to display.', 6124, NULL, now(), now(), NULL, NULL);
INSERT INTO `configuration` ( `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ( 'Number of Rows', 'MOPICS_NUMBER_OF_ROWS', '2', 'Number of rows to display.', 6124, NULL, now(), now(), NULL, NULL);


#20   doctorstupid

doctorstupid
  • Members
  • 93 posts
  • Real Name:Tom Young

Posted 14 December 2005 - 09:06 AM

That worked perfectly, thanks a million for the fast support :)