Jump to content
Parikesit

[Contribution] OPI: OsC Product Image Module

Recommended Posts

When preparing to upload an image I have a problem creating a new directory using a string that contains an underbar ('_') or dash ('-'). For some reason the RegExp test for alphanumeric in jquery.oscProductImage.js (unmodified) returns true and I get the 'error_create_alphanumeric' message. Everything works fine if only use a-Z. This is running on Linux 2.6.9-103.ELsmp

 

Anybody have a clue?

Edited by DrGlitch

Share this post


Link to post
Share on other sites
Second problem is opi_thumbnails.php is not reacting to any changes in configuration. I change this and that, but the thumbnails and the main images stay the same.

 

I encountered the same problem and discovered that this is because the images are cached in the thumbnails directory ("catalog/images/_thumbnail_"). They do not get regenerated if they already exist.

 

Either delete the contents of the thumbnails directory manually or in the Administration Tool:

 

1. Go to Configuration>Images

2. Edit "OPI: Cleanup Thumbnail" and set it to "true"

3. Go to Categories>Products

4. Edit any product.

5. Reload the page (no need to save). This causes the cleanup to occur and OPI: Cleanup Thumbnail gets reset back to "false".

 

Subsequently reloading or displaying a product causes thumbnails to be regenerated using the new settings in opi_thumbnails.php.

Edited by DrGlitch

Share this post


Link to post
Share on other sites

I have two web stores that are identical, both use the smae exact code.

 

For some reason on one of the stores the "NEW DIRECTORY " button has stopped showing....

 

What would be the cause of this. Everything else is working just fine.

 

Just a pointer would help. Thank you.

Share this post


Link to post
Share on other sites

I have two web stores that are identical, both use the smae exact code.

 

For some reason on one of the stores the "NEW DIRECTORY " button has stopped showing....

 

What would be the cause of this. Everything else is working just fine.

 

Just a pointer would help. Thank you.

 

After some successful head scrathing the issue is solved.

 

For reason only known to OSC the copied site, identical contained an issue. This issue was the "Aministation table" in the SQL SERVER. I simply updated this table and all went back to normal!

Share this post


Link to post
Share on other sites

Hello Parikesit,

 

Thank you for writting such a wonderful module. I really love it and got almost all of it to work for me. That is why I am writting, sorry it is not all about how thankful I am (there should be more posts like those).

 

I was able to add three images for one product and the preview slider works great. I have only one module installed which is:

 

Product Cycle Slideshow Box for 2.3.1

 

http://addons.oscommerce.com/info/6238

 

The instruccions are these:

 

SQL: Just this:

ALTER TABLE `configuration` CHANGE `set_function` `set_function` VARCHAR( 700 );

 

The other sql alterations are executed when the box is installed.

 

----------------------------

Upload the contents of catalog to your store

 

upload the new files:

catalog/ext/jquery/jquery.cycle.all.min.js

catalog/ext/jquery/jquery.easing.1.3.js

catalog/includes/modules/boxes/bm_product_cycle_slideshow.php

catalog/includes/languages/english/modules/boxes/bm_product_cycle_slideshow.php

catalog/includes/languages/espanol/modules/boxes/bm_product_cycle_slideshow.php

catalog/includes/languages/german/modules/boxes/bm_product_cycle_slideshow.php

 

Edit these files:

 

catalog/includes/template_top.php

 

Add before </head>

 

<!-- BOF Product Cycle Slideshow -->

<script type="text/javascript" src="ext/jquery/jquery.cycle.all.min.js"></script>

<script type="text/javascript" src="ext/jquery/jquery.easing.1.3.js"></script>

<script type="text/javascript">

 

function onPCS1Before() {

$('#PCS1Output').animate({

opacity: 0.0

}, 1000 );

}

function onPCS1After() {

$('#PCS1Output').html($(this).attr("title"));

$('#PCS1Output').animate({

opacity: 1.0

}, 500 );

}

 

$(document).ready(function(){

// Inizialize ProductsCycleSlideshow

$('#PCS1').cycle({

fx: '<?php echo PCS_FX?>',<?php echo PCS_EASING != 'None' ? "\n easing: '".PCS_EASING."',\n" : ''?>

sync: <?php echo PCS_SYNC == 'true' ? '1' : '0' ?>,

speed: <?php echo PCS_SPEED?>,

timeout: <?php echo PCS_TIMEOUT?>,

pause: <?php echo PCS_PAUSE == 'true' ? '1' : '0' ?>,

random: <?php echo PCS_RANDOM == 'true' ? '1' : '0' ?>,

// pager: '#PCS1Pager', //comment out this line to remove the numbered boxes under the title

before: onPCS1Before,

after: onPCS1After

});

 

});

</script>

 

<!-- EOF Product Cycle Slideshow -->

 

 

catalog/stylesheet.css

 

Add the following to the end

 

/* Special Price */

span.productSpecialPrice {

color:rgb(255,0,0);

}

 

/*Products Cycle Slideshow*/

.ProductsCycleSlideshowWrapper { height:160px; padding:0; margin:0; overflow: hidden; text-align:center;}

.ProductsCycleSlideshow { height: 90px; width:97%; padding:0; margin:0; overflow: hidden; border: 2px solid #bbc3d3; background-color:#fff;}

.PCSChild {height:90px; width:100%; text-align:center; top:0; left:0 }

.PCSChild a { text-decoration: none; color:000;}

.PCSChild a img { border: none; border-width:0px;}

.PCSOutput { text-align:center; font-size:11px;}

.PCSOutput a { text-decoration: none; color:#000; }

.PCSPager { margin:7px; }

.PCSPager a { border: 1px solid #bbc3d3; background: #fff; color:#bbc3d3; text-decoration: none; margin: 0 5px; padding: 3px 5px; font-size:12px;}

.PCSPager a.activeSlide { border: 1px solid #000; background: #bbc3d3; color:#000;}

.PCSPager a:focus { outline: none; }

 

 

End of editing files.

 

------------------------

 

go to Admin --> Modules --> Boxes --> Install Module

 

Now select the module Produc Cycle Slideshow and install it.

 

That's all!!

 

What happens to me is that it all works except somehow all the thumbnails seem to load on top of each other like the image I am attaching. When I hover of the one thumbnail below or above they seem to flicker between one and the next image - clicking on the bottom image does nothing. When I click on the top thumbnail it loads the preview and it works great going form one image to the next. I tried disabling the other module (which is the only module I have installed form a default installation) and removing the code from template_top.php but I still got the error.

 

What would you suggest I try?

 

Best regards...

post-313954-0-20235000-1343431064_thumb.jpg

Share this post


Link to post
Share on other sites

Hallo,

 

Can someone help me with a problem I have.

Everything working ok except the renaming of images.

The images are not renamed even is checked in the upload form.

I see that $_POST['opi_auto_rename'] from the form is empty in productImageHandler.php.

I'm using osCommerce Online Merchant v2.3.3.4

 

thanks in advance

Share this post


Link to post
Share on other sites

New Version OPI 2.1 uploaded:

http://addons.oscommerce.com/info/8139

 

New Features:
------------
- New mode "prop", resizing like auto, keep required thumbnail size and proportion by adding white background.
- New configuration constant (OPI_DISABLE_UPSIZE) If original image is smaller than required thumbnail, white background will be added to reach requested size and image will be centered.
- Added store configuration support for developer: (includes/local/configure.php').
- Instructions and file for OsC 2.3.4 added
- 2.3.4 BS tested

Share this post


Link to post
Share on other sites

Hello everybody,
 
All is working fine on v2.1 except  a little problem with product_info.php (on osc234 fresh install) :
 
images display in prodcut_info.php come from table products_images, not from table products->products_images !
 
 

Since we don't need another query to table TABLE_PRODUCTS_IMAGE, remove line related to it, and replace with following code
 

<?php
    
if (tep_not_null($product_info['products_image'])) {
     $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");

 

 

Don't know how to update product_indo.php !

I'm not a coder, can someone help me ?

Thanks in advance.

 

Share this post


Link to post
Share on other sites

Hello @@guinzou,

 

 Since we don't need another query to table TABLE_PRODUCTS_IMAGE, remove line related to it, and replace with following code

Where did you find these instructions?

 

The only 2 changes you need to do in product_info.php are:

Line 102:

            echo tep_image(DIR_WS_IMAGES . 'thumbs/def/display/' . $pi['image'], '', '', '', 'id="piGalImg_' . $pi_counter . '"');

Line 116:

      <?php echo tep_image(DIR_WS_IMAGES . 'thumbs/def/display/' . $product_info['products_image'], addslashes($product_info['products_name'])); ?>

NOTE: ". 'thumbs/def/display/' .  " needs to be added after  "DIR_WS_IMAGES . ". Use the thumb size and mode you need instead of "display"

Please compare to the included product_info.php

 

regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

Thanks,

Line 102 and 116 has been changed few day ago, work fine ; (my pb is that after update field products_images via easypopulate, i always see old images from TABLE_PRODUCTS_IMAGES when i go to product_info.php - main image is ok, but not other images for a product - problem can't be reproduce if you have only one image per product)

 

In product_info.php, line 73 call to TABLE_PRODUCTS_IMAGES :

$pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");

earlier in this topic, Parikesit wrote a patch for correct this (about 28/09/2011) for OPI v2.0, but since the last version of oscommerce 234, product_info.php has changed and i don't know how to integrate this patch !

 

Am i right or wrong ?

regards

Oliv

Share this post


Link to post
Share on other sites

@@guinzou,

 

THis patch seems not to be needed for 2.3.4. The additional images are found in that query:

$pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");

Maybe you just need to reset the OPI cache: In  : Admin : Configuration : Images : OPI: Cleanup Thumbnail : set to "true"

Then open Admin : Catalog

 

If this doesn't help, try to delete manually the updated thumbnails in images/_thumbnail_/"the thumb size used on product_info"

This usually happens if you replace the original images using the same image names.

 

regards

Rainer

 

PS: I never used easypopulate, so I can not give you more specific help for it.

Share this post


Link to post
Share on other sites

@@raiwa,

 

Yes, additional images are found in that query, but this query doesn't read the field products_images, new field introduce by this contribution in products table ;   you can read in the doc of this contrib (readme.html -> Features ) that :

 

"... Less table (no need products_images table) ..."

 

So i confirm that if i add a new product, with several images, additionnal images are saved in products table (field products_images), not in products_images table, so they are not display by this query in product_info.php ! (only main image). (Except additionnal image, all is working fine : cache, thumbnails,...).

 

Can you confirm this (no need easypop for that) ?

 

Regards,

Oliv

Share this post


Link to post
Share on other sites

@@raiwa,

 

Yes, additional images are found in that query, but this query doesn't read the field products_images, new field introduce by this contribution in products table ;   you can read in the doc of this contrib (readme.html -> Features ) that :

 

"... Less table (no need products_images table) ..."

 

So i confirm that if i add a new product, with several images, additionnal images are saved in products table (field products_images), not in products_images table, so they are not display by this query in product_info.php ! (only main image). (Except additionnal image, all is working fine : cache, thumbnails,...).

 

Can you confirm this (no need easypop for that) ?

 

Regards,

Oliv

 

@@guinzou,

 Then you should contact the author of that contribution or post in it's thread. It's not a OPI related issue. The only necessary modification for OPI to work is to add

. 'thumbs/def/display/' .  to the image paths.

 

I apologize not to be able to help further, I never used that contribution.

 

regards

Rainer

Share this post


Link to post
Share on other sites

@@raiwa

 

I've been trying to get OPI to work on the mobile version front end for days now. It seems you may have uploaded the wrong product_info.php for the mobile directory. It still references template_top, template_bottom rather than header and footer and as @quinzou mentioned, the products_images table is not needed for the opi mobile version. Contrary to your statement and included instructions, there are currently many edits to be made in products_info.php not mentioned in the docs.

 

My intentions where to make these edits and repackage all the necessary front end changes as a new update but I got to situate this image display issue first.

 

I cant seem to get any of the images on the mobile front end to show up for the life of me on my 2.3.3.3 store. Had a feeling changing my images handler would be much more pain than it was worth. 

Edited by breakbred101

Share this post


Link to post
Share on other sites

@@raiwa

 

I've been trying to get OPI to work on the mobile version front end for days now. It seems you may have uploaded the wrong product_info.php for the mobile directory. It still references template_top, template_bottom rather than header and footer and as @quinzou mentioned, the products_images table is not needed for the opi mobile version. Contrary to your statement and included instructions, there are currently many edits to be made in products_info.php not mentioned in the docs.

 

My intentions where to make these edits and repackage all the necessary front end changes as a new update but I got to situate this image display issue first.

 

I cant seem to get any of the images on the mobile front end to show up for the life of me on my 2.3.3.3 store. Had a feeling changing my images handler would be much more pain than it was worth. 

Dear Eric @@breakbred101,

 

I think there may be some confusion. All mentioned to @quinzou is not related to mobile, only to classic store.

The OPI package:

OPI 2.1:

http://addons.oscommerce.com/info/8139

and the included product_info.php files are for classic (standard) store frontend only.

 

Instructions for mobile support are included in the contripution mobile support package:

http://addons.oscommerce.com/info/8578

There is no modified product_info.php included in that package.

The instructions there for the mobile product_info.php are valid for OsC until 2.3.3.4.

However as mentioned: the only necessary changes are to add: . 'thumbs/def/display/' .  to the image paths.

			$pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");

Is also needed in mobile product_info.php for the additional (big) images.

 

I copy this post to the iosc mobile thread where is it's place.

 

hope this helps and kindest regards

Rainer

Share this post


Link to post
Share on other sites

Hola @@raiwa,

 

I couldn't find in the instructions how to change product_info.php. Changed both references you mentioned on previous posts, but now colorbox is not working and I have just one image.

 

Don't know why, but I found this adddon doesn't use the new table for product images and uses a neww field on products table instead; so oscommerce finds only one image. I have to dig on it and see why.

 

Also there are no explicit instructions on how to use it on other pages; I figure how it works from inspecting the code but it's not straight.

Share this post


Link to post
Share on other sites

Hola @@raiwa,

 

I couldn't find in the instructions how to change product_info.php. Changed both references you mentioned on previous posts, but now colorbox is not working and I have just one image.

 

Don't know why, but I found this adddon doesn't use the new table for product images and uses a neww field on products table instead; so oscommerce finds only one image. I have to dig on it and see why.

 

Also there are no explicit instructions on how to use it on other pages; I figure how it works from inspecting the code but it's not straight.

@@piernas,

 

The only modification you need on all pages where images are called, is to add: ". 'thumbs/def/display/' .  " to the image paths, between "DIR_WS_IMAGES . " and the image subdirectory/name. Use the thumb size and mode you need instead of "display".

 

See Installation Point 6.

Share this post


Link to post
Share on other sites

Thanks Rainer for updating this contribution to 2.3.4. Thumbs are created everywhere. One small problem. The image width and image height is not showing on the index.php  image when i inspect element. Alt txt is showing. trying to speed up site with 8k products so on speed test I receive- The following image(s) are missing width and/or height attributes for all the product images on index. Thanks for looking.Server is windows 2012 with rewrite set to true and rewrites added. And yes there is a template overlay which does not change core files. The only core file changed was replacing categories.php with categories-opi.php.

 

Share this post


Link to post
Share on other sites

 

Thanks Rainer for updating this contribution to 2.3.4. Thumbs are created everywhere. One small problem. The image width and image height is not showing on the index.php  image when i inspect element. Alt txt is showing. trying to speed up site with 8k products so on speed test I receive- The following image(s) are missing width and/or height attributes for all the product images on index. Thanks for looking.Server is windows 2012 with rewrite set to true and rewrites added. And yes there is a template overlay which does not change core files. The only core file changed was replacing categories.php with categories-opi.php.

 

 

Dear Bo @@badbo,

 

This has nothing to do with OPI. OPI modifications and script do not interfere in the image size information. Otherwise everything related to your image thumbnail problems has been pointed out in the kissIT thread.

 

Kindest regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

Dear Bo @@badbo,

 

This has nothing to do with OPI. OPI modifications and script do not interfere in the image size information. Otherwise everything related to your image thumbnail problems has been pointed out in the kissIT thread.

 

Kindest regards

Rainer

Thanks maybe I have a setting wrong somewhere.

Share this post


Link to post
Share on other sites

I'm tired of wasting hours on this. So I did a fresh install of OSC 2.3.3.3 and overwrote everything with this module and this module only. Modrewrite does not work and it does not create thumbnails in a  virtual anything. FYI for anyone else!!! USELESS waist of time.

Share this post


Link to post
Share on other sites

I'm tired of wasting hours on this. So I did a fresh install of OSC 2.3.3.3 and overwrote everything with this module and this module only. Modrewrite does not work and it does not create thumbnails in a  virtual anything. FYI for anyone else!!! USELESS waist of time.

Dear Eric @@breakbred101,

 

I have this add-on working on several stores, classic and mobile version, without any problems.

You should post details and errors and code snippets, just saying it doesn't work will not help neither you neither other users.

 

Kindest regards

Rainer

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

×