News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

[for developers] Partially fixed facebox

Started by man.of.earth, March 20, 2023, 19:36:15 PM

Previous topic - Next topic

man.of.earth

Hello developers,

Facebox has become unusable in the current version of VM.
In order to make it functional again, it is necessary to:

1. define the facebox function in /administrator/components/com_virtuemart/helpers/vmjsapi.php (it can be added right after the fancybox function, or at the end):

static function facebox(){
vmJsApi::addJScript( 'facebox',false,false,false,false,'1.3');
vmJsApi::css('facebox');
}


2. in /components/com_virtuemart/assets/js/vmprices.js, change

jQuery.facebox(txt, 'my-groovy-style');

for

jQuery.facebox(txt,'');

The original file can be overridden by placing the modified file in /templates/[template_name]/js/vmprices.js

3. Put the files in the following places, in order to override the existing ones (unpack the .zip archives first, as the forum settings do not allow attachment of .css and .js files):
- the .css file in /[template_name]/css
and
- the javascript file in /[template_name]/js


It still has a bug unsolved. Maybe some of you can give help in resolving it.
After pressing ,,Recommend to a friend", then ,,Add to cart", the following errors appear:


On J4, after pressing add to cart button, there is the following message:

jquery.min.js?3.6.0:2 Set-Cookie header is ignored in response from url: https://4.proxima-mundi.ro/index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json&lang=ro&Itemid=164. The combined size of the name and value must be less than or equal to 4096 characters.
send @ jquery.min.js?3.6.0:2
ajax @ jquery.min.js?3.6.0:2
Virtuemart.cartEffect @ vmprices.js?vmver=7749bb17:98
Virtuemart.sendtocart @ vmprices.js?vmver=7749bb17:83
Virtuemart.addtocart @ vmprices.js?vmver=7749bb17:223
dispatch @ jquery.min.js?3.6.0:2
v.handle @ jquery.min.js?3.6.0:2


then, if I press ,,recommend to a friend", there is the following error:

Uncaught SyntaxError: Identifier 'uriAttributes' has already been declared
    at b (jquery.min.js?3.6.0:2:866)
    at Function.globalEval (jquery.min.js?3.6.0:2:2905)
    at Object.dataFilter (jquery.min.js?3.6.0:2:80720)
    at jquery.min.js?3.6.0:2:79185
    at l (jquery.min.js?3.6.0:2:79587)
    at XMLHttpRequest.<anonymous> (jquery.min.js?3.6.0:2:82355)
    at Object.send (jquery.min.js?3.6.0:2:82714)
    at Function.ajax (jquery.min.js?3.6.0:2:78291)
    at S._evalUrl (jquery.min.js?3.6.0:2:80586)
    at He (jquery.min.js?3.6.0:2:48314)
b @ jquery.min.js?3.6.0:2
globalEval @ jquery.min.js?3.6.0:2
dataFilter @ jquery.min.js?3.6.0:2
(anonymous) @ jquery.min.js?3.6.0:2
l @ jquery.min.js?3.6.0:2
(anonymous) @ jquery.min.js?3.6.0:2
send @ jquery.min.js?3.6.0:2
ajax @ jquery.min.js?3.6.0:2
S._evalUrl @ jquery.min.js?3.6.0:2
He @ jquery.min.js?3.6.0:2
append @ jquery.min.js?3.6.0:2
reveal @ facebox.js?vmver=7749bb17:115
(anonymous) @ facebox.js?vmver=7749bb17:221
c @ jquery.min.js?3.6.0:2
fireWith @ jquery.min.js?3.6.0:2
l @ jquery.min.js?3.6.0:2
(anonymous) @ jquery.min.js?3.6.0:2
load (async)
send @ jquery.min.js?3.6.0:2
ajax @ jquery.min.js?3.6.0:2
S._evalUrl @ jquery.min.js?3.6.0:2
He @ jquery.min.js?3.6.0:2
append @ jquery.min.js?3.6.0:2
reveal @ facebox.js?vmver=7749bb17:115
(anonymous) @ facebox.js?vmver=7749bb17:221
c @ jquery.min.js?3.6.0:2
fireWith @ jquery.min.js?3.6.0:2
l @ jquery.min.js?3.6.0:2
(anonymous) @ jquery.min.js?3.6.0:2
load (async)
send @ jquery.min.js?3.6.0:2
ajax @ jquery.min.js?3.6.0:2
S.<computed> @ jquery.min.js?3.6.0:2
fillFaceboxFromAjax @ facebox.js?vmver=7749bb17:221
$.facebox @ facebox.js?vmver=7749bb17:71
(anonymous) @ integrarea-sufletului:1906
dispatch @ jquery.min.js?3.6.0:2
v.handle @ jquery.min.js?3.6.0:2


then, if I press ,,ask a question about this product", I get the following error:

integrarea-sufletului:1906 Uncaught TypeError: jQuery.facebox is not a function
    at HTMLAnchorElement.<anonymous> (integrarea-sufletului:1906:9)
    at HTMLAnchorElement.dispatch (jquery.min.js?3.6.0:2:43064)
    at v.handle (jquery.min.js?3.6.0:2:41048)



On J3.10.x, if I press add to cart, then recommend to a friend, then again add to cart, I get the following error:

vmprices.js?vmver=75ad989b:135 Uncaught TypeError: jQuery.facebox is not a function
    at Object.<anonymous> (vmprices.js?vmver=75ad989b:135:12)
    at u (eval at <anonymous> (jquery.min.js?8264f0dd3075a7f3e6e2c4d56c623815:2:2825), <anonymous>:2:27579)
    at Object.fireWith [as resolveWith] (eval at <anonymous> (jquery.min.js?8264f0dd3075a7f3e6e2c4d56c623815:2:2825), <anonymous>:2:28337)
    at C (eval at <anonymous> (jquery.min.js?8264f0dd3075a7f3e6e2c4d56c623815:2:2825), <anonymous>:2:86318)
    at XMLHttpRequest.n (eval at <anonymous> (jquery.min.js?8264f0dd3075a7f3e6e2c4d56c623815:2:2825), <anonymous>:2:90579)