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

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

Link to comment
Share on other sites

  • Replies 1.6k
  • Created
  • Last Reply

Top Posters In This Topic

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

// 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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

I also have thumbnails on the fly installed and working, found here http://www.oscommerce.com/community/contributions,2226 , and I can't get more than one image to show up at a time. I'm assuming this is an issue between the two contributions, any suggestions on where to look to get it working properly?

 

Here's an example that I'll leave up for a while, the store's not live yet:

http://www.mattmasonms.com/catalog/product...&products_id=74

 

I have the morepics config set to 2 rows, 3 columns, centered, show all thumbnails, and it simply won't show up as it should no mater where I try to place or arrange it. That particular product has two images.

 

Any tips or pointers you can offer are very much appreciated, I'd be happy to post any files you would need to look at :)

Edited by doctorstupid
Link to comment
Share on other sites

Last week, I installed the MorePics_6 1.1 contribution, and it works very nice. Today, I added the Ultimate SEO 2.1d contribution, but now the images do not appear in the popup boxes....

 

(I also posted this question in the SEO thread, I'm not sure if this is allowded, if not please forgive me!)

 

Does anyone recognize this? And is there a solution for it, besides turning of the SEO feature in the Admin?

 

Thanks for your help!

Link to comment
Share on other sites

And as you can see here, even products with only one image are displaying the same image twice in the product info

http://www.mattmasonms.com/catalog/product...&products_id=57

 

Sorry, only seeing a supertracker error at the moment. I don't know much about thumbnails on the fly. I did try to use all the appropriate tep_ functions when coding this so it *should* be compatible with other properly coded contribs. If I get some time this weekend, I'll look at thumbnails on the fly and see where they overlap.

 

If you are having duplicate images you probably didn't comment out the original image display code starting at line 149 of the contribution file products_info.php.

Link to comment
Share on other sites

I added the Ultimate SEO 2.1d contribution, but now the images do not appear in the popup boxes....

Yeah, cross-post is a no-no.

 

I ran into this problem also. I had left the old hard coded img tags in the popup_image.php from the original MoPics. I meant to update that. I just posted a fixed popup_image.php file in the latest 1.1a. Try the new file.

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