- Posts: 18
- Thank you received: 2
Triggering javascript after add to cart ajax call
12 years 1 month ago #173440
by mj
Triggering javascript after add to cart ajax call was created by mj
-- url of the page with the problem -- :
69.28.90.77/~macautomation/index.php/onl...d06-detachable-chute
-- HikaShop version -- : 3.3.3
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.4.29
-- Browser(s) name and version -- : chrome
-- Error-message(debug-mod must be tuned on) -- : None - I want to add some code
I'm trying to add another javascript function after the add to cart ajax function completes. I can find the function in my browser debugger, but I can't find what's writing certain parts of it into the <head> tag of my pages.
Basically, after clicking add to cart on the product detail page, I would like to trigger my cart to display.
Here's the code I'd like to add:
jQuery("html, body").animate({ scrollTop: 0 }, "slow");
jQuery("#hikashop_cart_module").show();
Could you please let me know the file /line number which I could add this?
Thank you!
-- HikaShop version -- : 3.3.3
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.4.29
-- Browser(s) name and version -- : chrome
-- Error-message(debug-mod must be tuned on) -- : None - I want to add some code
I'm trying to add another javascript function after the add to cart ajax function completes. I can find the function in my browser debugger, but I can't find what's writing certain parts of it into the <head> tag of my pages.
Basically, after clicking add to cart on the product detail page, I would like to trigger my cart to display.
Here's the code I'd like to add:
jQuery("html, body").animate({ scrollTop: 0 }, "slow");
jQuery("#hikashop_cart_module").show();
Could you please let me know the file /line number which I could add this?
Thank you!
Please Log in or Create an account to join the conversation.
12 years 1 month ago #173460
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Triggering javascript after add to cart ajax call
Hi,
It is currently not possible unless you modify the HikaShop core.
We planned to rewrite the "add to cart" system and add some javascript events (triggers) in order to add new features and also let you (and the other users) implement your own javascript code using the events.
But for the moment, the best is to modify the HikaShop core to add your code.
regards,
It is currently not possible unless you modify the HikaShop core.
We planned to rewrite the "add to cart" system and add some javascript events (triggers) in order to add new features and also let you (and the other users) implement your own javascript code using the events.
But for the moment, the best is to modify the HikaShop core to add your code.
regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
12 years 1 month ago #173500
by mj
Replied by mj on topic Triggering javascript after add to cart ajax call
So which file would that be?
Please Log in or Create an account to join the conversation.
12 years 1 month ago #173518
by mj
Replied by mj on topic Triggering javascript after add to cart ajax call
Nevermind, I found it in /com_hikashop/helpers/cart.php.
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 7
- Thank you received: 0
4 years 10 months ago #338002
by mabdelaziz
Replied by mabdelaziz on topic Triggering javascript after add to cart ajax call
Hi,
If this feature is implemented, any reference or documentation there?
I mean " add to cart javascript events (triggers)"
If this feature is implemented, any reference or documentation there?
I mean " add to cart javascript events (triggers)"
Please Log in or Create an account to join the conversation.
4 years 10 months ago #338003
by nicolas
Replied by nicolas on topic Triggering javascript after add to cart ajax call
Hi,
This has been implemented yes.
We actually have plugins using that mechanism like the cart slide notification ( www.hikashop.com/marketplace/product/120-cartnotify_slide.html ) and the HikaShop cart notify plugin (pre installed with HikaShop).
That second plugin is responsible for displaying the add to cart notification box after the add to cart process is done.
It's basically done with this code:
You can see an example in the file plugins/hikashop/cartnotify/media/notify.js (for the HikaShop cart notify plugin)
This has been implemented yes.
We actually have plugins using that mechanism like the cart slide notification ( www.hikashop.com/marketplace/product/120-cartnotify_slide.html ) and the HikaShop cart notify plugin (pre installed with HikaShop).
That second plugin is responsible for displaying the add to cart notification box after the add to cart process is done.
It's basically done with this code:
Code:
if(window.Oby) {
window.Oby.registerAjax(["cart.updated","wishlist.updated"],function(params){
... your javascript code ...
}
}
The following user(s) said Thank You: mabdelaziz
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 7
- Thank you received: 0
4 years 10 months ago #338013
by mabdelaziz
Replied by mabdelaziz on topic Triggering javascript after add to cart ajax call
Thank you, I liked this feature too much.
It will be very helpful to have a page on your developer documentation section.
It will be very helpful to have a page on your developer documentation section.
Please Log in or Create an account to join the conversation.
4 years 10 months ago #338020
by nicolas
Replied by nicolas on topic Triggering javascript after add to cart ajax call
Hi,
It's a good idea. I've worked on that :
www.hikashop.com/support/documentation/6...ocumentation.html#js
It's a good idea. I've worked on that :
www.hikashop.com/support/documentation/6...ocumentation.html#js
The following user(s) said Thank You: ButterflyPixel, mabdelaziz
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 7
- Thank you received: 0
4 years 10 months ago #338029
by mabdelaziz
Replied by mabdelaziz on topic Triggering javascript after add to cart ajax call
Great!
Thank you for your fantastic work
Thank you for your fantastic work
Please Log in or Create an account to join the conversation.
Time to create page: 0.076 seconds