[Skip to main content](#vessel-content)

#   Tutorial show cart quanity in custom module

##

- **[mindgem](/forum/user/49449-mindgem "View mindgem's Profile")**
- [![mindgem's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/49449-mindgem "View mindgem's Profile") Topic Author
- [ Offline](/forum/user/49449-mindgem)

Less More

- Posts: 17
- Thank you received: 0
-
-

9 years 7 months ago -  9 years 7 months ago [\#267143](#267143) by [mindgem](/forum/user/49449-mindgem "View mindgem's Profile")  *[Tutorial show cart quanity in custom module](/forum/31-development/889771-tutorial-show-cart-quanity-in-custom-module#267143 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 7.0.10  So I've been playing around with Hikashop the past few days and really like some of the ideas here:  Is there any sort of tutorial for adding the cart product count into a custom module and have it refresh by AJAX on events? Have been toying now with:  Update runs also on delete from cart so still need to correct that, but was wondering if there isn't a build in and more robust solution which I haven't found yet.  After this, next would be to make the cart module in a UIkit modal ;)")* was created by *[mindgem](/forum/user/49449-mindgem "View mindgem's Profile")*

-- HikaShop version -- : 3.0.1
-- Joomla version -- : 3.6.5
-- PHP version -- : 7.0.10

So I've been playing around with Hikashop the past few days and really like some of the ideas here:

[ ](https://www.virgowebdesign.com/blog/5-awesome-enhancements-you-can-apply-to-your-hikashop-e-commerce-store)[ www.virgowebdesign.com/blog/5-awesome-en...hop-e-commerce-store](https://www.virgowebdesign.com/blog/5-awesome-enhancements-you-can-apply-to-your-hikashop-e-commerce-store)

Is there any sort of tutorial for adding the cart product count into a custom module and have it refresh by AJAX on events? Have been toying now with:
Code:

if(window.Oby) { window.Oby.registerAjax(["cart.updated","wishlist.updated"],function(params){ var cart = (params.type == "cart"), p = window.cartNotifyParams, text = p.text, class_name = "success", class_icon = "check"; var userCart = document.getElementById('user-console-cart-count'); var productCount = userCart.innerHTML; productCount++; userCart.innerHTML = productCount; if(params.notify === false) return; if(params.resp.ret == 0) { class_name = "warning", class_icon = "close", text = p.err_text; } if(params.resp.message) text = params.resp.message; UIkit.notify("&lt;i class='uk-icon-" +class_icon+ "'&gt;&lt;/i&gt; " + text, {status:class_name}); return true; }); }

Update runs also on delete from cart so still need to correct that, but was wondering if there isn't a build in and more robust solution which I haven't found yet.

After this, next would be to make the cart module in a UIkit modal ![;)](/media/kunena/emoticons/24.png ";)")

Last edit: 9 years 7 months ago by [mindgem](/forum/user/49449-mindgem "View mindgem's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4OTc3MS10dXRvcmlhbC1zaG93LWNhcnQtcXVhbml0eS1pbi1jdXN0b20tbW9kdWxlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

9 years 7 months ago [\#267146](#267146) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Tutorial show cart quanity in custom module](/forum/31-development/889771-tutorial-show-cart-quanity-in-custom-module#267146 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 7.0.10  So I've been playing around with Hikashop the past few days and really like some of the ideas here:  Is there any sort of tutorial for adding the cart product count into a custom module and have it refresh by AJAX on events? Have been toying now with:  Update runs also on delete from cart so still need to correct that, but was wondering if there isn't a build in and more robust solution which I haven't found yet.  After this, next would be to make the cart module in a UIkit modal ;)")*

Hi,

Yes, these were indeed very good ideas, which is why all the points there have been implemented or fixed:
1. There is now a setting in the HikaShop cart module in order to get a dropdown display of the cart module.
2. Just create an instance of the HikaShop cart module via the Joomla modules manager with the "mini cart" mode activated and change the translation key used (with a translation override) to only have the quantity counter displayed by the cart module. That way, since it will be a standard cart module, it will be refreshed automatically when a product is added to the cart.
3. There is a "height consistency" setting in the listings in order to handle that.
4. There was already a tutorial for that as mentioned there.
5. The checkout has been completely rewritten to be fully AJAX to have a true one page checkout.

So do point 2 and you'll be able to have that without coding anything.

The following user(s) said Thank You: [mindgem](/forum/user/49449-mindgem "View mindgem's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4OTc3MS10dXRvcmlhbC1zaG93LWNhcnQtcXVhbml0eS1pbi1jdXN0b20tbW9kdWxlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mindgem](/forum/user/49449-mindgem "View mindgem's Profile")**
- [![mindgem's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/49449-mindgem "View mindgem's Profile") Topic Author
- [ Offline](/forum/user/49449-mindgem)

Less More

- Posts: 17
- Thank you received: 0
-
-

9 years 7 months ago [\#267206](#267206) by [mindgem](/forum/user/49449-mindgem "View mindgem's Profile")  Replied by *[mindgem](/forum/user/49449-mindgem "View mindgem's Profile")* on topic *[Tutorial show cart quanity in custom module](/forum/31-development/889771-tutorial-show-cart-quanity-in-custom-module#267206 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 7.0.10  So I've been playing around with Hikashop the past few days and really like some of the ideas here:  Is there any sort of tutorial for adding the cart product count into a custom module and have it refresh by AJAX on events? Have been toying now with:  Update runs also on delete from cart so still need to correct that, but was wondering if there isn't a build in and more robust solution which I haven't found yet.  After this, next would be to make the cart module in a UIkit modal ;)")*

About 2. Is it expected behavior when using the minicart with dropdown as the only instance to be redirected to checkout? As I set it up in my user console bar to have the mini cart and get a link only with 2 items ... but it also redirects me to checkout when adding to cart.

What defines the redirect?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4OTc3MS10dXRvcmlhbC1zaG93LWNhcnQtcXVhbml0eS1pbi1jdXN0b20tbW9kdWxlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26400
- Thank you received: 4079
-
- [](http://obsi.dev)
-

9 years 7 months ago [\#267215](#267215) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Tutorial show cart quanity in custom module](/forum/31-development/889771-tutorial-show-cart-quanity-in-custom-module#267215 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 7.0.10  So I've been playing around with Hikashop the past few days and really like some of the ideas here:  Is there any sort of tutorial for adding the cart product count into a custom module and have it refresh by AJAX on events? Have been toying now with:  Update runs also on delete from cart so still need to correct that, but was wondering if there isn't a build in and more robust solution which I haven't found yet.  After this, next would be to make the cart module in a UIkit modal ;)")*

Hello,

The cart modules are not stopping the customer redirection because we can't be sure that the user can see a notification than his product has been added to the cart.

In the "cart notify" you can see a "return true" at the end, it indicates to HikaShop JS core that the event has been handled and the fallback system is not required.
If the event is not handle, the fallback is called ; as explained in the other thread :
[ www.hikashop.com/forum/development/88976...n-plugin.html#267108](https://www.hikashop.com/forum/development/889763-alternative-hikashop-add-to-cart-notification-plugin.html#267108)

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4OTc3MS10dXRvcmlhbC1zaG93LWNhcnQtcXVhbml0eS1pbi1jdXN0b20tbW9kdWxlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.057 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
