VirtueMart Forum

VirtueMart 2 + 3 + 4 => Installation, Migration & Upgrade => Topic started by: d0ublezer0 on November 06, 2018, 10:44:07 AM

Title: How to update Fancybox?
Post by: d0ublezer0 on November 06, 2018, 10:44:07 AM
JUI Jquery 3.1 override works well by template overriding
templates\my-template\js\jui\jquery.min.js
But VM fancybox is too old for new version of Jquery
how to update jquery.fancybox-1.3.4.pack.js ?
version 3 is already out: https://fancyapps.com/fancybox/3/
if i overwrite them with new version - it will be overwritten on next update
Title: Re: How to update Fancybox?
Post by: Ghost on November 06, 2018, 10:51:58 AM
Fancybox can be overriden too. Place overrides in:

templates/your_template/js/fancybox/jquery.fancybox-1.3.4.pack.js

and

templates/your_template/css/jquery.fancybox-1.3.4.css

Just be aware that new versions may not work properly with VM.
Title: Re: How to update Fancybox?
Post by: d0ublezer0 on November 06, 2018, 11:01:39 AM
i did.
will be overwritten on update
this add costs to supporting it
Title: Re: How to update Fancybox?
Post by: Jörgen on November 06, 2018, 11:09:00 AM
Did You try Ghost suggestion ? Should not be overwritten IMHO.

Jörgen @ Kreativ Fotografi
Title: Re: How to update Fancybox?
Post by: GJC Web Design on November 06, 2018, 11:10:08 AM
if its in your template and u don't update your template then no..

Can u report back if the v3 works with VM?
Title: Re: How to update Fancybox?
Post by: d0ublezer0 on November 06, 2018, 12:24:31 PM
Quote from: GJC Web Design on November 06, 2018, 11:10:08 AM
if its in your template and u don't update your template then no..

Can u report back if the v3 works with VM?
i cannot move scripts to my template because VM have older version built-in. only replacing will help me.

and, yes it works with minimal ajustments:
vmprices.js
comment this:
/*
    if (usefancy) {
        jQuery.fancybox.showActivity(); // it is deprecated and not used in v.3
    }
*/

and change this
if (usefancy) {
                jQuery.fancybox({
                        "titlePosition": "inside",
                        "transitionIn": "fade",
                        "transitionOut": "fade",
                        "changeFade": "fast",
                        "type": "html",
                        "autoCenter": true,
                        "closeBtn": false,
                        "closeClick": false,
                        "content": txt
                    }
                );
            }

to this
if (usefancy) {
                jQuery.fancybox.open(txt);
            }


Also fancybox v 3 supports ajax requests and data filtering: https://fancyapps.com/fancybox/3/docs/#ajax
Title: Re: How to update Fancybox?
Post by: GJC Web Design on November 06, 2018, 12:26:17 PM
Thanks for the feedback
Title: Re: How to update Fancybox?
Post by: d0ublezer0 on November 06, 2018, 12:27:12 PM
Quote from: Jörgen on November 06, 2018, 11:09:00 AM
Should not be overwritten IMHO.
Why do you think so? Obsolete files will come along with the installation kit and then they will be written over the modified ones.
Title: Re: How to update Fancybox?
Post by: Jörgen on November 06, 2018, 12:47:07 PM
You got to be kidding. Why would VM overrite them? The whole idea of overrides is that a normal installation uses the override files instead of the default ones, not trying to override the overrides.

QuoteWhy do you think so? Obsolete files will come along with the installation kit and then they will be written over the modified ones.

Jörgen @ Kreativ Fotografi
Title: Re: How to update Fancybox?
Post by: d0ublezer0 on November 06, 2018, 12:54:52 PM
Jörgen, you probably did not understand me.
Of course, the VM will not change the overrided files.
It will replace files in its component folder:
\components\com_virtuemart\assets\js\fancybox\jquery.fancybox-1.3.4.pack.js
and
\components\com_virtuemart\assets\css\jquery.fancybox-1.3.4.css
It can not be moved to the template overrides - inclusion of this file has built into the VM core.
so the only working solution is to replace its contents with a new version.
Title: Re: How to update Fancybox?
Post by: d0ublezer0 on November 06, 2018, 12:58:28 PM
also, you need some changes in default_images.php for images gallery in fancybox v3:
add 
data-fancybox="gallery" data-type="image"
to all images in this file
echo $this->product->images[0]->displayMediaThumb("", true, ' rel="vm-additional-images" data-fancybox="gallery" data-type="image" ', true, true, false, $width, $height);
Title: Re: How to update Fancybox?
Post by: d0ublezer0 on November 06, 2018, 14:28:46 PM
Found only one problem with rupostel OPC, cannot resolve this:
(https://image.prntscr.com/image/yZKx-5KFTxyJ_SPUz9g0XQ.png)
Title: Re: How to update Fancybox?
Post by: d0ublezer0 on November 06, 2018, 14:33:47 PM
The main reason why you need to update this outdated plugin: it does not work with the new version of jquery 3.1
to ensure compatibility of new and old scripts is very expensive. eg owl carousel
Title: Re: How to update Fancybox?
Post by: Ghost on November 07, 2018, 10:53:13 AM
Quote from: d0ublezer0 on November 06, 2018, 12:54:52 PM
Jörgen, you probably did not understand me.
Of course, the VM will not change the overrided files.
It will replace files in its component folder:
\components\com_virtuemart\assets\js\fancybox\jquery.fancybox-1.3.4.pack.js
and
\components\com_virtuemart\assets\css\jquery.fancybox-1.3.4.css
It can not be moved to the template overrides - inclusion of this file has built into the VM core.
so the only working solution is to replace its contents with a new version.
You make no sense. If you place new files in locations shown in first post, these files will override VM core files.
Title: Re: How to update Fancybox?
Post by: d0ublezer0 on November 07, 2018, 11:27:59 AM
Quote from: Ghost on November 07, 2018, 10:53:13 AM
You make no sense. If you place new files in locations shown in first post, these files will override VM core files.
oh, really?
override for any file, not only "views" templates?
so, can you try it by yourself?
\templates\your_template\com_virtuemart\assets\js\fancybox\jquery.fancybox-1.3.4.pack.js
not overriden
Title: Re: How to update Fancybox?
Post by: Ghost on November 07, 2018, 12:30:49 PM
You did not follow the instructions given in the first comment.

https://forum.virtuemart.net/index.php?topic=141412.msg498079#msg498079
Title: Re: How to update Fancybox?
Post by: d0ublezer0 on November 07, 2018, 13:14:42 PM
Quote from: Ghost on November 07, 2018, 12:30:49 PM
You did not follow the instructions given in the first comment.

https://forum.virtuemart.net/index.php?topic=141412.msg498079#msg498079
A A A A A
OMG  :o
My world will never be the same...

Thanks for this knowledge!

Jörgen, sorry for my carelessness.

P.S. vmprices.js override also works for me  ;D