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

Fire javascript when the page is refreshed with ajax by the generic child varian

Started by Kuubs, December 19, 2018, 14:03:39 PM

Previous topic - Next topic

Kuubs

Hello,

I want to fire some javascript when the view gets updated by ajax via javascript when you are in the product details view. I have it in my generic file but that does not fire each time the page gets updated. Where can I find this Ajax javascript, so I can put my code in that place to let it fire with an update.

Thanks.

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Kuubs

Quote from: GJC Web Design on December 19, 2018, 14:13:27 PM
components\com_virtuemart\assets\js\cvfind.js

OK awesome, do you have an idea in how to do what I want without touching the core? Do I need to override? Or is there another way to add some code into the functionality?

GJC Web Design

I think you can simply over ride this js file in your template assets js folder  -- maybe someone here remembers better?

although prob add to the code in the default template and trigger there

if(VmConfig::get ('jdynupdate', TRUE)){

   /** GALT
    * Notice for Template Developers!
    * Templates must set a Virtuemart.container variable as it takes part in
    * dynamic content update.
    * This variable points to a topmost element that holds other content.
    */
   $j = "Virtuemart.container = jQuery('.productdetails-view');
Virtuemart.containerSelector = '.productdetails-view';
//Virtuemart.recalculate = true;   //Activate this line to recalculate your product after ajax
";

   vmJsApi::addJScript('ajaxContent',$j);

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Kuubs

Quote from: GJC Web Design on December 19, 2018, 16:04:20 PM
I think you can simply over ride this js file in your template assets js folder  -- maybe someone here remembers better?

although prob add to the code in the default template and trigger there

if(VmConfig::get ('jdynupdate', TRUE)){

   /** GALT
    * Notice for Template Developers!
    * Templates must set a Virtuemart.container variable as it takes part in
    * dynamic content update.
    * This variable points to a topmost element that holds other content.
    */
   $j = "Virtuemart.container = jQuery('.productdetails-view');
Virtuemart.containerSelector = '.productdetails-view';
//Virtuemart.recalculate = true;   //Activate this line to recalculate your product after ajax
";

   vmJsApi::addJScript('ajaxContent',$j);

Thanks, i tried this also, but because the page got reloaded it din't have use for my case.

So I added the javascript code to the template product details page and the start of the product container, now it gets fired everytime the new product gets loaded.