News:

Support the VirtueMart project and become a member

Main Menu

add to cart popup [SOLVED]

Started by guardiano78, March 09, 2017, 12:53:25 PM

Previous topic - Next topic

guardiano78

Hello,
i need to solve this issue....by clicking on add to cart button, the website redirect directly in the cart.
In virtuemart configuration the option for popup is activated.
What's wrong in my source code?
I attach page source code.
Thanks.

kishoreonwork

this type of issue only occur due to javascript conflict. Please provide a link to website where the issue, else looking at source code will not serve any purpose

Thanks
Kishore
I am available for paid joomla and virtuemart consulting.
http://www.kishoreweblabs.com/
skype kishore2607


jenkinhill

You are not loading the required VirtueMart JavaScript files on that page. Compare the header source for the product list page abd product details page, where quantity change & popup work OK.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

kishoreonwork

i can see below JS files  are not included in the template

/components/com_virtuemart/assets/js/vmsite.js?vmver=9293
   /components/com_virtuemart/assets/js/dynupdate.js?vmver=9293
   /components/com_virtuemart/assets/js/fancybox/jquery.fancybox-1.3.4.pack.js?vmver=9293
   /components/com_virtuemart/assets/js/vmprices.js?vmver=9293
I am available for paid joomla and virtuemart consulting.
http://www.kishoreweblabs.com/
skype kishore2607

guardiano78

Hi,
i added this:

$document->addScript('/components/com_virtuemart/assets/js/vmsite.js?vmver=9293');
$document->addScript('/components/com_virtuemart/assets/js/dynupdate.js?vmver=9293');
$document->addScript('/components/com_virtuemart/assets/js/fancybox/jquery.fancybox-1.3.4.pack.js?vmver=9293');
$document->addScript('/components/com_virtuemart/assets/js/vmprices.js?vmver=9293');

but it does not works yet.
Firefox debugger has displayed this errors for all added scripts: ReferenceError: jQuery is not defined

jenkinhill

#6
You are loading jQuery after the VM files........

When loading a library (such as jQuery), make sure it is loaded before you access library variables, such as "$". Put the <script> tag that loads the library before your code that uses it.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

AH

The name of the js is incorrect

But you should not need to add this stuff manually Vm will add it.

$document->addScript('/components/com_virtuemart/assets/js/vmsite.js

You do not need anything after the .js
Regards
A

Joomla 3.10.11
php 8.0

guardiano78

Hi,
this is the new situation:

$document = JFactory::getDocument();
$document->addStyleDeclaration($css);
$document->addScript('media/jui/js/jquery.min.js');
$document->addScript('media/jui/js/jquery-migrate.min.js');
$document->addScript('media/jui/js/jquery-noconflict.js');
$document->addScript('components/com_virtuemart/assets/js/vmsite.js?vmver=9293');
$document->addScript('components/com_virtuemart/assets/js/dynupdate.js?vmver=9293');
$document->addScript('components/com_virtuemart/assets/js/fancybox/jquery.fancybox-1.3.4.pack.js?vmver=9293');
$document->addScript('components/com_virtuemart/assets/js/vmprices.js?vmver=9293');

Firefox Console do not produce errors, but "add to cart popup" doesn't works yet :-(

Please...any idea?
thanks!!

guardiano78

Hello,
i have good news :-)
The problem was into my template index.php
i added and hidden the source code for minicart module:

<div style="display:none;"> <jdoc:include type="modules" name="cart" style="none" /> </div>

and now it works!!
I think that js code included in minicart has solved the issue.

Thank you all for help.