Jump to content
surfalot

[Contribution] More_pics_6 v1.1 For osC 2.2 MS2

Recommended Posts

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.

yeah, I've been screwing around with the server for a while, should be all solved.

 

I'll take a look in in products_info.php, thanks!

Share this post


Link to post
Share on other sites

Looks commented out from here:

<?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 I post the files, will that make it easier for you to troubleshoot?

Edited by doctorstupid

Share this post


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

 

Sorry for the cross-post... :blush:

 

Tonight I'll update the files to 1.1a, thank you very much for the quick reply!

Share this post


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

I updated the new file popup_image.php from version 1.1a, and also product_info.php, but unfortunately, it doesn't work..... May be there are other possible problems that cause this popup problem?

Share this post


Link to post
Share on other sites

I just found out that supertracker was causing an error on my site, and since it was set up to ignore my IP, i was the only person not seeing that error. Should be all fixed now.

Share this post


Link to post
Share on other sites

I ran into some other problems, and had to redo the changes to product_info.php (as it's already been modified quite a bit), works flawlessly now. Thanks anyway, looks great and works great!

Share this post


Link to post
Share on other sites

I have installed morepics and really find it to be quite excellent.

 

The only problem is that I cannot delete images. I select the check box next to the image and I hit preview but the image still shows on the next screen. So then I hit update and it does not change the product listing, the image is still shown on the product page. I checked my images directory on the server and the image is still there. My images directory is set to 777.

 

Thank you for the great contribution, if I could fix this it would be absolutely perfect.

 

BTW, I had morepics installed on another installation of OSC a few days ago and I could swear it was working fine then. I noticed when I downloaded that this file was newer than the previous one where it all worked.

 

Mike

Edited by docprego

Share this post


Link to post
Share on other sites

Sounds like you missed the same block of code as dainbramaged05 in post #5.

 

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.

Share this post


Link to post
Share on other sites
Sounds like you missed the same block of code as dainbramaged05 in post #5.

 

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.

 

 

I checked and the code is there, I will paste it here to make sure:

 

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

 

Thank you for your help, I would love to solve this.

Share this post


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

 

Do you have any idea for other possibilities to get it work? I updated the popup_image.php file to the latest version 1.1a (fixed img tags), but the popup images are still not working...

I really like MorePics in my shop, and I understood that the contrib Ultimate SEO works very well also for the results in the search engines, so that combination would be perfect

 

:)

 

Does 1.1a work in your shop, Surfalot?

Share this post


Link to post
Share on other sites
I checked and the code is there, I will paste it here to make sure:

keep looking in /admin/categories.php. you missed something.

Share this post


Link to post
Share on other sites
Does 1.1a work in your shop, Surfalot?

Yes, it does work on a couple of shops that have Ultimate SEO installed, but those shops are injecting the SID in to the URL which is correcting the problem. I see the problem when installing the two contribs on a virgin shop. This is in addition to the other ones I ran into.

 

find in product_info.php:

tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '&invis='.$mo_item

 

replace with:

tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'].'&invis='.$mo_item)

 

I'll post a corrected contrib file later.

Share this post


Link to post
Share on other sites
Yes, it does work on a couple of shops that have Ultimate SEO installed, but those shops are injecting the SID in to the URL which is correcting the problem. I see the problem when installing the two contribs on a virgin shop. This is in addition to the other ones I ran into.

 

find in product_info.php:

tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '&invis='.$mo_item

 

replace with:

tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'].'&invis='.$mo_item)

 

I'll post a corrected contrib file later.

 

Surfalot, what do you mean by "keep looking in /admin/categories.php. you missed something."?

 

What have I missed? I pasted the code exactly how it appears in my categories.php file. To be honest I love your contribution so much that I just delete the whole product listing now if I need to delete an image. It is a crude work around as I lose the entire product listing, but to be fair I have not had to do this but a couple of times.

 

Anyway if you could tell me what to look for I would like to correct it.

 

Thank you.

Edited by docprego

Share this post


Link to post
Share on other sites
Surfalot, what do you mean by "keep looking in /admin/categories.php. you missed something."?

I don't have the ability to see your code, so I can't tell you what was missed or misplaced. This has worked well on a default install of osCommerce and many other non-default installations, and by your admission, other sites you work on.

Anyway if you could tell me what to look for I would like to correct it.

The code I pointed out earlier is the code that facilitates the functionality your missing. You need to check and make sure it is in the correct position in your code. If your code is modified, it would not necessarily be the same line number. If you check the delete image box and save, and the image is still there, this is the code that does it.

 

When this works correctly, you will see the images you are trying to delete on the confirmation page. But once you submit the confirmation page, the block of code starting at line 230 will remove those images and the references in the database.

Edited by surfalot

Share this post


Link to post
Share on other sites
Yes, it does work on a couple of shops that have Ultimate SEO installed, but those shops are injecting the SID in to the URL which is correcting the problem. I see the problem when installing the two contribs on a virgin shop. This is in addition to the other ones I ran into.

 

find in product_info.php:

tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '&invis='.$mo_item

 

replace with:

tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'].'&invis='.$mo_item)

 

I'll post a corrected contrib file later.

 

It works! Perfect!

 

Thank you very much, Surfalot!

Share this post


Link to post
Share on other sites
I don't have the ability to see your code, so I can't tell you what was missed or misplaced. This has worked well on a default install of osCommerce and many other non-default installations, and by your admission, other sites you work on.

 

The code I pointed out earlier is the code that facilitates the functionality your missing. You need to check and make sure it is in the correct position in your code. If your code is modified, it would not necessarily be the same line number. If you check the delete image box and save, and the image is still there, this is the code that does it.

 

When this works correctly, you will see the images you are trying to delete on the confirmation page. But once you submit the confirmation page, the block of code starting at line 230 will remove those images and the references in the database.

 

Surfalot,

 

I think I owe you a huge apology, I was being premature in assuming that the images were not being deleted. As you said they show on the confirmation page but after clicking update they are in fact deleted with one exception. This does not work for the first image titled "Products Image" above "Products Image1". This file does not delete but can be replaced by selecting another image.

 

Another quirk I have come across is that if my image name contains the character ' then the image will not save properly and be displayed in my product page. In fact it turns out that on my server a file gets uploaded with a strange filename. For example if I try to upload King's.gif then the image does not work and what appears on the server is a file named King\'s.gif. this file cannot be deleted, renamed or moved. I have to go to my host control panel to delete it. Of course the simple fix is to rename the files before selecting them which is really not an issue.

 

Please remember I am not complaining, I am just letting you know about 2 quirks I have run across. Neither of which changes the fact that I could not have my site as I want it without your great piece of work.

 

Thank you.

Share this post


Link to post
Share on other sites
This does not work for the first image titled "Products Image" above "Products Image1". This file does not delete but can be replaced by selecting another image.

Now that's a genuine oversight.

 

 

here's the fix. Add this just above the code that starts on line 230 of admin/categories.php:

		  //add delete image function
		  if ($HTTP_POST_VARS['delete_image_1'] == 'yes') {
			unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS[products_image]);
			$sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['none']);
	  }
	  //end delete image function

 

Another quirk I have come across is that if my image name contains the character ' then the image will not save properly and be displayed in my product page.

That's not really an issue with MoPics specifically. The osC/html/php/MySQL necessitates converting quotes to backslash-quotes so the code doesn't break. You'd be best off avoiding any non-alphanumeric characters when naming files for web. The dash, underscore and period are the only non-alphanumeric chars that are legal in web urls and file names.

Share this post


Link to post
Share on other sites
Now that's a genuine oversight.

here's the fix. Add this just above the code that starts on line 230 of admin/categories.php:

		  //add delete image function
		  if ($HTTP_POST_VARS['delete_image_1'] == 'yes') {
			unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS[products_image]);
			$sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['none']);
	  }
	  //end delete image function

That's not really an issue with MoPics specifically. The osC/html/php/MySQL necessitates converting quotes to backslash-quotes so the code doesn't break. You'd be best off avoiding any non-alphanumeric characters when naming files for web. The dash, underscore and period are the only non-alphanumeric chars that are legal in web urls and file names.

 

Thaks Surfalot that perfectly fixed it! Now it is the ultimate! I do understand now that the other quirk is a OSC/HTML/PHP?SQL issue and not a morepics issue. So that fix makes the contribution perfect!

 

Thanks for the contribution and the incredible support.

Share this post


Link to post
Share on other sites

Nice contribution,Thanks.

 

With that said, I am finding a few things that may be a consideration of changing.

 

1.) It would be nice to be able to have the first image large and then the remaining as thumbnails.

Share this post


Link to post
Share on other sites
Now that's a genuine oversight.

here's the fix. Add this just above the code that starts on line 230 of admin/categories.php:

		  //add delete image function
		  if ($HTTP_POST_VARS['delete_image_1'] == 'yes') {
			unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS[products_image]);
			$sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['none']);
	  }
	  //end delete image function

 

 

Is this needed after downloading "more_pics_6_v1.1b" or is it already in that release (which I'll be putting in later tonight)?

 

Thanks,

BD

Share this post


Link to post
Share on other sites
Is this needed after downloading "more_pics_6_v1.1b" or is it already in that release

That fix is need for 1.1b. Should be the only one known at this time.

Edited by surfalot

Share this post


Link to post
Share on other sites

So,

It should be added above this:

 

// 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']);
	  }

etc. etc. etc.

 

Thank you,

BD

Share this post


Link to post
Share on other sites

immediately following the:

 

// BOF: More Pics 6

 

Should be at the top of that block of MorePics code.

Edited by surfalot

Share this post


Link to post
Share on other sites

hi there...

I am just setting up a store, and am *very* new to all of this...

 

I have Easy populate installed, seems to be okay - and I just installed More_pics_6 v1.1b for osC 2.2 MS2 today - though I seem to remember installing something called Extra Images last week - it is all beginning to be a blur...

 

I followed the directions - they are very clear!! The query in step 1 ran great - in step 2, I adjusted files into their proper directory (I think!) - the product_info was updated from another contrib, but I cant remember what it was - :o and it is overwritten -

 

Step 3 was a bit confusing, cuz I wasnt sure where in the /languages/english.php to put the little block of code, does it matter?

 

Step 4 as well, I didnt know where to put it, so I put the code in a section that started with TABLE, paying attention to the braces...{ }

 

Step 5 I dont know where I would find this in the popup_image.php file...?

 

Okay, so having all that done,

 

Where can I find how to access this in my osC admin table? I have the link in the table for Extra images, but I have about 300 or so artworks to upload, with a couple of images each, and I would like to use EP as well... would this be the v_products_mimage, v_products_bimage etc.. and what is the difference between all of those?

 

My apologies, I am not a programmer, but I would really appreciate any help you can give.

Hope I am making sense!

Thank you very much!

Julia Trops

Share this post


Link to post
Share on other sites

I don't think this contrib would be able to coexist with Extra Images. I have thought about extending this to handle SM-MD-LG images for each, but that is as far as it has gone. You need to be careful about which contribs you pic and do some forethought. Mixing contribs that target the same area of osC can be difficult to get working, if it can be done at all. Such as, More Pics and Extra Images.

 

the product_info was updated from another contrib, but I cant remember what it was

Extra Images maybe?

 

Step 3 was a bit confusing, cuz I wasnt sure where in the /languages/english.php to put the little block of code, does it matter?

anywhere is fine.

 

Step 4 as well, I didnt know where to put it, so I put the code in a section that started with TABLE, paying attention to the braces...{ }

Anywhere is fine, as long as you didn't put the block inside another set of braces already there.

 

Step 5 I dont know where I would find this in the popup_image.php file...?

You can find the collor to change by searching for #666666 in

catalog/popup_image.php. that line has the <hr> tag you can

modify the size="" (width of the line) and the color="#666666"

(color of the divider line)

 

Where can I find how to access this in my osC admin table?

Admin table? If you are looking for the few configure options they are in your osC administrator under Configuration -> More Pics

 

v_products_mimage, v_products_bimage etc.. and what is the difference between all of those?

v_products_mimage, v_products_bimage are part of Extra Images. More Pics does not utilize those entry fields.

 

 

I have about 300 or so artworks to upload, with a couple of images each, and I would like to use EP as well... would this be the v_products_mimage, v_products_bimage etc.. and what is the difference between all of those?

I have not programmed a patch for Easy Populate. At the moment you would have to populate the store with EP (only specifying v_products_image), then use the osC product editor to add any additional images. Since you overwrote the products_info.php anything you put in v_products_mimage, v_products_bimage will not show on the site when you are done. If you overwrote the catalog/admin/categories.php then likewise, the osC product editor would not have a place to add or change those images either (v_products_mimage, v_products_bimage).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×