Forums / All Other Contributions/Addons / overLIB - HowTo?

overLIB - HowTo?

Locked

Started by missterx on 21 Jun 2006, 3:38 AM · Views: 4,405

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
21 Jun 2006, 3:38 AM
#1
missterx avatar

missterx

New Zenner

Join Date:
Feb 2006
Posts:
11
Plugin Contributions:
0

overLIB - HowTo?

Hi!

This one is per request.

How do you implement overLIB in Zen-Cart? This is how I did it...

Installation:

  1. Download the overLIB package from http://www.bosrup.com/web/overlib/?Download
  2. Extract the files and copy overlib.js to includes/templates/template_default/jscript/ directory
  3. IMPORTANT: Rename overlib.js to jscript_overlib.js
  4. IMPORTANT: Copy includes/templates/template_default/common/tpl_header.php to includes/templates/my_template/common/ directory
  5. Edit includes/templates/my_template/common/tpl_header.php
    5a) Find text: <!--bof-header logo and navigation display-->
    5b) On the next row (before start-php-tag) insert: <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
    5c) Save

Now, implemetation:
6) Choose a text, it might be the header of the sideboxes, the site's slogan, image or whatever as long as you can apply the anchor tag around it.
7a) Type before item selected in 6) <a href="javascript:void(0)" onMouseOver="return overlib('This text shows on mouseover');" onMouseOut="return nd();">
7b) Type after item selected in 6) </a>
7c) Save and test

NOTE: In 7a, the default action when clicking on a overLIBbed link is "no action". The text "javascript:void(0)" can (and sometimes is desired) to link to a page. That's OK - just replace it with your ULR and click it.

Common trap - try to avoid it:
Since it's a javascript function and you might want to insert the ' or the " qutoation character in the text 'This text shows on mouseover' it will generate a javascript-error.

Common trap solution:
Use javascript in appropriate place, i.e.

<script type="text/javascript"> var display_text = "This text shows on mouseover 'til I remove the mouse"; </script>

Replace the text 'This text shows on mouseover' (including the ') with display_text and you'r on the road again.

Customizing overLIB:
RTFM (Read The Fine Manual) @ http://www.bosrup.com/web/overlib/?Documentation

Regards

//
// God is real,
// unless declared integer.
//

21 Jun 2006, 8:12 PM
#2
kebeid avatar

kebeid

New Zenner

Join Date:
Mar 2006
Posts:
66
Plugin Contributions:
0

Re: overLIB - HowTo?

Hey Thanks MissterX that solved my overlib problem. It now works with all the options and stuff. :D

22 Jun 2006, 12:12 AM
#3
voltage avatar

voltage

Totally Zenned

Join Date:
Apr 2005
Location:
Houston, TX
Posts:
1,356
Plugin Contributions:
1

Re: overLIB - HowTo?

Hate to be a party pooper, but take into consideration that the javscript for this is 50+kb which is a pretty hefty price to pay for a little cool feature. I did a quick google for javascript tooltip and here is a much more simplized one that is about 2kb (if you just want the tooltip feature).

http://www.felgall.com/jstip18.htm

22 Jun 2006, 6:04 AM
#4
missterx avatar

missterx

New Zenner

Join Date:
Feb 2006
Posts:
11
Plugin Contributions:
0

Re: overLIB - HowTo?

voltage:

Hate to be a party pooper, but take into consideration that the javscript for this is 50+kb which is a pretty hefty price to pay for a little cool feature. I did a quick google for javascript tooltip and here is a much more simplized one that is about 2kb (if you just want the tooltip feature).

http://www.felgall.com/jstip18.htm

That's not the way I see it.

What you pointed out is another - allas smaller, without all the bells and wistles - version.

Thanks!

Regards

//
// God is real,
// unless declared integer.
//

22 Jun 2006, 6:24 AM
#5
missterx avatar

missterx

New Zenner

Join Date:
Feb 2006
Posts:
11
Plugin Contributions:
0

Re: overLIB - HowTo?

Over 7 minutes has gone on the coffe break...

MissterX:

...the way I see it.

What you pointed out is another - allas smaller, without all the bells and wistles - version.

One thing to take in consideration of overLIB - despit it's size - is the functionality: in IE you have to hide certain form elements to have the tooltip appear OVER the elements. IE bug #??? The tooltip you pointed out has not solved that - and other problems.

I'm not pro overLIB or Extended Tooltips. I just use the tool that solves my problem best, in this case it's overLIB - which I Zenned :)

Thanks!

Regards

//
// God is real,
// unless declared integer.
//

22 Jun 2006, 3:39 PM
#6
voltage avatar

voltage

Totally Zenned

Join Date:
Apr 2005
Location:
Houston, TX
Posts:
1,356
Plugin Contributions:
1

Re: overLIB - HowTo?

Yeah, it seems like if you want anything to work properly in IE it requires big code and lots of fixes :laugh: . My only point was with this and with other things like big, bloated javascript dhtml menus, make sure you can justify the large increase in size. If it is necessary for your site, and for some it is, then by all means use it. But if it is only for the cool effects, from a business standpoint, its worth reconsidering. Cool menus and effects have not been proven to make sales and $$$ (unless you are a webdesigner :)), but smaller, more accesible websites do.

Anyways, Good luck! :thumbsup:

18 Aug 2008, 5:23 PM
#7
dontknowwhatimdoing avatar

dontknowwhatimdoing

Zen Follower

Join Date:
Aug 2008
Posts:
131
Plugin Contributions:
0

Re: overLIB - HowTo?

I'm currently trying to find a function like Overlib to use on my product listing pages

I figure I'll need to edit:
this => tpl_modules_product_listing.php
& / or maybe this => product_listing.php (the sub-file)

I tried to customize the image swap function, but it's just too much for me. It doesn't do exactly what I want either.

The challenge here is to get something like Overlib to work on the product listing page--not the product info page. This way the user can preview many products, without the need to go to the product detail page in order to view the larger image.

I figure there may be other zen cart users out there that want to do this; however, I've searched & I can't find a mod for this.

I'm only going to use 2x images per SKU (there's thousands of SKUs in my case), so I think the code for the pop-up image can be generic, and I can probably just edit the string of the image name to insert _LRG before .jpg on each image preview javascript function (I will only use 2 images sizes, so to include the large image in a function, I only need to insert _LRG before the ".jpg".

Is there already an existing module to allow an image popup on mouseover? Or has anyone else implemented overlib on the product listing page to display previews of many/ multiple prodcuts?

5 Oct 2008, 8:28 PM
#9
dontknowwhatimdoing avatar

dontknowwhatimdoing

Zen Follower

Join Date:
Aug 2008
Posts:
131
Plugin Contributions:
0

Re: overLIB - HowTo?

dontknowwhatimdoing:

I'm currently trying to find a function like Overlib to use on my product listing pages

I figure I'll need to edit:
this => tpl_modules_product_listing.php
& / or maybe this => product_listing.php (the sub-file)

I tried to customize the image swap function, but it's just too much for me. It doesn't do exactly what I want either.

The challenge here is to get something like Overlib to work on the product listing page--not the product info page. This way the user can preview many products, without the need to go to the product detail page in order to view the larger image.

I figure there may be other zen cart users out there that want to do this; however, I've searched & I can't find a mod for this.

I'm only going to use 2x images per SKU (there's thousands of SKUs in my case), so I think the code for the pop-up image can be generic, and I can probably just edit the string of the image name to insert _LRG before .jpg on each image preview javascript function (I will only use 2 images sizes, so to include the large image in a function, I only need to insert _LRG before the ".jpg".

Is there already an existing module to allow an image popup on mouseover? Or has anyone else implemented overlib on the product listing page to display previews of many/ multiple prodcuts?

I wrote my own module to do this. It turns out Zen Cart had nothing like what I needed. My script is quite short/ concise, although unfortunately it added a significant amount of overhead since zen cart doesn't store image sizes.

6 Oct 2008, 2:26 PM
#10
dasha avatar

dasha

New Zenner

Join Date:
Mar 2008
Location:
Nashville, TN
Posts:
21
Plugin Contributions:
0

Re: overLIB - HowTo?

I really really appreciate you trying to help me - it is actually on my attributes page that we are wanting this (product details page...sort of) - we have tabbed browsing so it is a but confusing to explain unless you go to the page. Check it out for yourself if you don't mind - it will help you understand what my issue is -

http://www.planet3press.com/brochures.c.34/brochures.p.91

just "roll over" the question marks by the attributes. I am dynamically loading the content fine - just none of my styles are applying and it is showing up ALL crazy in different browsers.

7 Oct 2008, 4:02 AM
#11
dscott1966 avatar

dscott1966

Zen Follower

Join Date:
Apr 2005
Posts:
298
Plugin Contributions:
0

Re: overLIB - HowTo?

dontknowwhatimdoing:

I wrote my own module to do this. It turns out Zen Cart had nothing like what I needed. My script is quite short/ concise, although unfortunately it added a significant amount of overhead since zen cart doesn't store image sizes.

I'm looking for something like this can you share how you did it. I have been trying but just can't do it?

7 Oct 2008, 2:37 PM
#12
dasha avatar

dasha

New Zenner

Join Date:
Mar 2008
Location:
Nashville, TN
Posts:
21
Plugin Contributions:
0

Re: overLIB - HowTo?

Absolutely - i have no problem helping you with this at all.

For anyone else that is interested in having the tooltip - this is for those that are using the module Two Column Product Attribute Display. The code will still work but be slightly varied for those that arent using this.

If you aren't using the Two Column Product Attribute Display, go to:
http://www.zen-cart.com/forum/showthread.php?p=617345#post617345
It would be less confusing.

Onward...

STEP 0: BACKUP! BACKUP! BACKUP! (*i would do this always and forever before you ever touch anything in your store!)

Step 1:
Go here and install The Two Column Layout: http://www.zen-cart.com/forum/showthread.php?t=83814

Step 2:
Find Line 22 - 58 on tpl_modules_attributes.php:

<?php
    if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') {
        $output .= '<h3 class="attributesComments">'.$options_comment[$i].'</h3>';
    }

    $output .= '
        <div class="wrapperAttribsOptions">
        <h4 class="optionName back">'.$options_name[$i].':</h4>
        <br class="clearBoth" />
        <div class="back">' . $options_menu[$i].'</div>
        <br class="clearBoth" />
        </div>';

    if ($options_comment[$i] != '' and $options_comment_position[$i] == '1') {
        $output .= '<div class="ProductInfoComments">'.$options_comment[$i].'</div>';
    }

    if ($options_attributes_image[$i] != '') {
        $output .= $options_attributes_image[$i];
    }

    $output .= '<br class="clearBoth" />';

    if ($i%2) {
    if($i==0){
        $left_col .= $output;
    } else {
        $right_col .= $output;
    }
    } else {
        $left_col .= $output;
    } 
    $output ='';

}

?>

And replace it with:

<?php
    if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') {
        //$output .= '<h3 class="attributesComments">'.$options_comment[$i].'</h3>';
    }

    $output .= '
        <div class="wrapperAttribsOptions">
        <h4 class="optionName back">';
        if ($options_comment[$i] != '') {

            $output .=  "<a href=\"javascript:void(0)\" onMouseOver=\"Tip('$options_comment[$i]');\" onMouseOut=\"UnTip();\"><img src=\"../images/bt_help.gif\" border=\"0\" alt=\"tooltip\" align=\"top\" /></a> " . $options_name[$i];
        } else {
            $output .=  $options_name[$i];
        }
        
        $output .= '</h4><br class="clearBoth" />
        <div class="back">' . $options_menu[$i].'</div>
        <br class="clearBoth" />
        </div>';

    if ($options_comment[$i] != '' and $options_comment_position[$i] == '1') {
        $output .= '<div class="ProductInfoComments">'.$options_comment[$i].'</div>';
    }

    if ($options_attributes_image[$i] != '') {
        $output .= $options_attributes_image[$i];
    }

    $output .= '<br class="clearBoth" />';

    if ($i%2) {
    if($i==0){
        $left_col .= $output;
    } else {
        $right_col .= $output;
    }
    } else {
        $left_col .= $output;
    } 
    $output ='';

}

?>

Notice there is an image in there. The image is called: ../images/bt_help.gif - please be sure to create and place it in your template folder under images. You can change the image name to whatever you want but if you dont name it 'bt_help.gif' be sure to change it on line 32.

**Step 3: **
Save your new tpl_modules_attributes.php in your current template folder - not the default folder. (unless using the default template of course).

Step 4:
Now I had tried getting the regular OverLIB to work with zen cart and couldn't get any of the ones I had downloaded to work right. THIS ONE however worked great- all of my java properties were FINALLY being read by zen cart. You can download it here: http://www.walterzorn.com/tooltip/tooltip_e.htm

Step 5:
Go to: includes/templates/YOUR_TEMPLATE/jscript/ and add the 3 files to your server that you downloaded from Step 4.
**
Step 6:**
Go to: includes/templates/YOUR_TEMPLATE/common/tpl_footer.php and add this line to the very end of the file (After the last "?>"close php tag ):

<script type="text/javascript" src="../jscript/wz_tooltip.js"></script>

Just for informational purposes, I could only get mine to work by inputting a hard link - which would be instead of src="../jscript/wz_tooltip.js" I ended up putting src="http://www.yourdomain.com/includes/templates/YOUR_TEMPLATE/jscript/wz_tooltip.js"
(obviously replacing YOUR_TEMPLATE with the actual name of your template...same with https://www.yourdomain.com

Be sure that if you are going to include the other two .js files that come with the wz_tooltip that they go AFTER the code i just gave you in step 6. If you put them before that the module will not function properly.

Step 7:
Test your module by going to your admin and then going to "Option Name Manager". Under each option name when you click to edit you will see an area for comments. Add what you want the tooltip to say here. You can use HTML tags.

Keep in mind that comment space is originally limiting you to 64 characters. If you go to your SQL manager (in my case its phpMyAdmin) and find the table called "products_options" click on that. A new screen should load and give you other tables one of them being products_options_comment. You will notice by default this is set to varchar(64). This is where you would change it to however many characters you want to be able to type. In my case i changed it to 2000.

Also keep in mind that until you add a comment under your option Name Manager, nothing is going to show up. That's the beauty of this module! It only shows a tooltip when you add a comment! WONDERFUL! :)

That's it! Your tooltip should be working now!!

As far as questions go, I'm not the greatest php coder in the world i'm more of a crafty cut and paster that uses logic to screw around and figure things out when they dont work. I can try to answer questions but other than what I explained above am not sure how much more helpful I can be. HAPPY CODING!:clap: