Greybox MOD (same as LightBox and ThickBox)

Good night…



We have Thickbox and Lightbox , and now we can have another one… Greybox Mod. :smiley:



Just to get it…



Follow these steps… (similar to thickbox and lightbox)…

Official page is [URL=“http://orangoo.com/labs/GreyBox/”]http://orangoo.com/labs/GreyBox/[/URL]



Installation Instructions on [URL=“http://orangoo.com/labs/greybox/installation.html”]http://orangoo.com/labs/greybox/installation.html[/URL]



you need to download a zip file from [URL=“http://orangoo.com/labs/uploads/GreyBox_v5_53.zip”]http://orangoo.com/labs/uploads/GreyBox_v5_53.zip[/URL]

then uncompress it.



Copy a folder called “Greybox” into CS-cart directory. In my case for example, is in /var/www/tienda2/ where “tienda2” is cs-cart directory.



then edit index.tpl (cs-cart directory/skins/xxxx/customer/) and add these lines between header

[quote]



{include file="meta.tpl"}

[I][COLOR="Red"]{* new Greybox MOD*}
{if $content == "product_details" || $content == "products"} {* thanks to Snorocket & Zardos, avoid checkout issue *}





{/if}
{* END MOD *}
[/COLOR][/I]
{strip}

{if $page_title}
{$page_title}
{else}

[/quote]

In product_pages/product_options.tpl add this code:
[quote]
{foreach from=$product.option_image_pairs item="imag" name="ii" key="_key"}
pr_i[{$id}][{$smarty.foreach.ii.iteration}-1] = {$ldelim}
'image_id': '{$imag.image_id}',
'detailed_id': '{$imag.detailed_id}',
[I][COLOR="Red"]'detailed_id2': '{$imag.detailed.image_path}',[/COLOR][/I]
'options': '{$imag.options}'
{$rdelim};
[/quote]
In classes/scripts/exceptions.js add the code in red:
Under **************images**************

[Quote]
new_ref[id] = "javascript:fn_open_popup_image('"+image_index+"?o bject_type=detailed&image_id="+pr_i[id][row]['detailed_id']+"&window=popup', "+pr_i[id][row]['detailed']['image_x']+", "+pr_i[id][row]['detailed']['image_y']+"+ 30);"
[/Quote]
With
[Quote]
function fn_change_image(id, row)
{
if (pr_i[id][row]['detailed_id'] != '' && pr_i[id][row]['detailed_id'] != '0') {
[I][COLOR="Red"]new_ref[id] = ""+pr_i[id][row]['detailed2']+""[/COLOR][/I]
if (document.getElementById('detailed_box_' + id)) {
document.getElementById('detailed_box_' + id).style.display = "block";
}
if (document.getElementById('detailed_href1_' + id)) {
document.getElementById('detailed_href1_' + id).href = new_ref[id];
[/Quote]


In common_templates/images.tpl this is the full file if you want to use it, or sort the bits in red:

[Quote]
{* $Id: image.tpl 4188 2007-10-08 08:01:09Z imac $ *}
{strip}

{if $settings.Addons.seo == 'Y'}
{assign var="image_location" value="$current_location/"}
{/if}
{if $show_detailed_link && $images.detailed_id}

[I][COLOR="Red"]{if $settings.General.images_location == "database"}
{assign var="detailed_href" value="$image_index?object_type=detailed&image_id= `$images.detailed_id`"}
{else}
{assign var="detailed_href" value="`$images.detailed.image_path`"}
{/if}
[/COLOR][/I]
{/if}

{if !$image_width}
{if $images.icon.image_x}
{assign var="image_width" value=$images.icon.image_x}
{/if}
{if $images.icon.image_y}
{assign var="image_height" value=$images.icon.image_y}
{/if}
{else}
{if $images.icon.image_x && $images.icon.image_y}
{math equation="new_x * y / x" new_x=$image_width x=$images.icon.image_x y=$images.icon.image_y format="%d" assign="image_height"}
{/if}
{/if}

{if $show_thumbnail == 'Y' && $image_width && $images.image_id}
{assign var='object_type' value=$object_type|default:'product'}
{assign var='icon_image_path' value="$image_index?$mode_name=show_thumbnail&imag e_id=`$images.image_id`&object_type=$object_type&w idth=$image_width"}
{else}
{assign var='icon_image_path' value=$images.icon.image_path}
{/if}

{if $images.icon.image_type != 'application/x-shockwave-flash'}
{if $detailed_href}
[I][COLOR="Red"]
{/if}[/COLOR][/I]

{if $obj_id && !$no_ids}


{/if}
{$images.icon.alt|escape:html}
{if $detailed_href}

{/if}
{else}





{if $flash_vars}

{/if}


{/if}

{if $show_detailed_link}


[I][COLOR="Red"]
{* we can leave original line or modified line *}
{* Original Line *}
{$lang.view_larger_image}

{* Modified line *}
{$lang.view_large_image}
[/COLOR][/I]
[B][COLOR="Red"]{* there is no space in $lang.view_large_image *}[/COLOR][/B]
{* end mod *}


{/if}

{/strip}

{if $obj_id && !$no_ids}

{/if}

[/Quote]

Verify that {$lang.view_larger_image} doesn't have any spaces on it... don't know why it appears an space... I have rechecked and has no spaces but when I publish it appears :confused:

How it works...
If you want just to show one image, you need to call it as "rel=gb_image[]" but if you want to show group of images ( i think is the case for everybody) you need to use "rel=gb_imageset[]".
Notice that on code I put "gb_imageset[XX]" and "gb_imageset[123]", what I noticed is if I put same or nothing inside brackets, will appear duplicate images... don't know why...

Here you have the results....

see image_greybox.jpg

(again i set a censore to avoid any offense :rolleyes: )

I also have checked css style but don't find why number of pages between <> appears on black instead white colour... any ideas?

thanks again

Jmonk

image_Greybox.jpg

Hi Jmonk



Nice mods, been using Greybox for a few months now and love it.


[quote]I also have checked css style but don’t find why number of pages between <> appears on black instead white colour… any ideas?

[/quote]Here is the fix, add this to your gb_styles.css


.GB_navStatus {
font-size: 12px;
color: #FFF;
}
```php [I][COLOR=Red]

[COLOR=Green] {if $target == ‘products’}[/COLOR] {* thanks to Snorocket, putting these we avoid an error on checkout process *}





[COLOR=Green] {/if}[/COLOR][/COLOR][/I] ```Try this one.

```php [COLOR=DarkGreen]{if $content == "product_details" || $content == "products"}[/COLOR]
[COLOR=Black] [/COLOR]
[COLOR=Black] [/COLOR]
[COLOR=RoyalBlue]{**}[/COLOR]
[COLOR=Black]
[/COLOR]
[COLOR=DarkGreen]{/if}[/COLOR] ```

The third edit in image.tpl you shouldn't need to alter, i use the original line and it works perfect.

```php {$lang.view_larger_image} ```

Hi Zardos,


[quote name=‘zardos’]



Here is the fix, add this to your gb_styles.css



.GB_navStatus {

font-size: 12px;

color: #FFF;

} ```

[/quote]



GReat!!! I have tested and works!! thanks a lot…




[quote name=‘zardos’]


```php [COLOR=DarkGreen]{if $content == “product_details” || $content == “products”}[/COLOR]

[COLOR=Black] [/COLOR]

[COLOR=Black] [/COLOR]

[COLOR=RoyalBlue]{}[/COLOR]

[COLOR=Black]

[/COLOR]
[COLOR=DarkGreen]{/if}[/COLOR] ```
[/quote]

Modified!!... but why did you take out the AJS_fx.js, I have already tried the same but it seems there is no change...

[quote name='zardos']
The third edit in image.tpl you shouldn't need to alter, i use the original line and it works perfect.

```php {$lang.view_larger_image} ```[/QUOTE]

thanks again for your help...


Jmonk

Hi Jmonk



Your welcome.


[QUOTE]Modified!!.. but why did you take out the AJS_fx.js, I have already tried the same but it seems there is no change…[/QUOTE]



It does not use that JS for standard imageset

Thanks JMonk - nice work indeed.



I prefer this mod to the Lightbox mod, as for some reason that doesn’t work with the Add to Cart on the product page and also I was unable to view the links to the Previous /Next images.



This mod works without flaw!

Thank you for your hard work on this mod. It adds a very nice touch.



I am having one problem with it, however.



I am completely in the dark concerning making modifications to the source code, but was able to follow your instructions without any real trouble after realizing that the folder that’s supposed to be uploaded to the root directory is a subfolder called “greybox” and not the entire unzipped file. :oops:



The greybox mod works great when I click on the actual thumbnail picture of a product. When I click on the link “view larger image” it opens the picture in a new window/tab without the greybox. I have no idea where I went wrong.



I’m using 1.35 sp2.



edit Hmm, that’s weird. After following my link, it appears the greybox still never works when I click on the “view larger image” link, and it occasionally doesn’t work when clicking on the thumbnail. I’m using firefox and same thing with explorer…

[quote name=‘muharram’]Thank you for your hard work on this mod. It adds a very nice touch.



I am having one problem with it, however.



I am completely in the dark concerning making modifications to the source code, but was able to follow your instructions without any real trouble after realizing that the folder that’s supposed to be uploaded to the root directory is a subfolder called “greybox” and not the entire unzipped file. :oops:



The greybox mod works great when I click on the actual thumbnail picture of a product. When I click on the link “view larger image” it opens the picture in a new window/tab without the greybox. I have no idea where I went wrong.



I’m using 1.35 sp2.

Here’s a link to my store where you can see the problem



edit Hmm, that’s weird. After following my link, it appears the greybox still never works when I click on the “view larger image” link, and it occasionally doesn’t work when clicking on the thumbnail. I’m using firefox and same thing with explorer…[/QUOTE]



Hi Muharram,

I took a look to your page and it is working fine except ‘view_large_image’ side…

on the code, you should put one of both… perhaps you left both of them…

put original code:

[quote]

{* Original Line }

{$lang.view_larger_image}



or

{
Modified line *}

{$lang.view_large_image}

[/quote]

and verify that $lang.view_large_image doesn’t contain any space…



also add this to you gb_styles.css sheet,

[quote]

[COLOR=“Red”].GB_navStatus {

font-size: 12px;

color: #FFF;

}

[/COLOR]
[/quote]



then you will have on white color pages number between <> :wink:



hope this helps



Jmonk

^^^

That did it. Working like a champ. Thanks!





Just to expand a bit in case anyone else is as dense as me (possible but not likely)…



I had both the original and modified line in image.tpl. You just need one, and the modified line removes the “view larger image” link.



and to change the text color between the <> buttons just paste

.GB_navStatus {
font-size: 12px;
color: #FFF;
}


anywhere in gb_styles.css, which is located in the folder you uploaded to the root cs-cart folder in step 1. (if this is not done the text color is a dark grey)



Thanks again for this great mod!

I installed this mod on my website. I noticed it doens’t load the greybox until the page is fully loaded. Anyone have any tips for this?

Hi, anybody can tell me how to use this on 1.3.4sp3 ? thanks.

Is there a way to get greybox to work by ckicking on the image and/or clicking on view larger image?



Would this affect the images in the recently viewed sidebox? It doesn’t seem to be generating the thumbnails for it.



It looks like the no image availible graphic doesn’t work now. Does anyone know where it is and where it needs to be moved to so it shows up again?

Doesn’t work until page has finished loading.

the lightbox one works alot better…

tested in 1.3.5 sp2



works fine for me

I’m also using 1.3.5 sp2. Lightbox is nice, but not as nice as the greybox mod.