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

#   Display number of items in cart

##

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

Less More

- Posts: 68
- Thank you received: 8
-
-

12 years 2 weeks ago [\#176837](#176837) by [MumsHealth](/forum/user/21338-mumshealth "View MumsHealth's Profile")  *[Display number of items in cart](/forum/31-development/872569-display-number-of-items-in-cart#176837 "-- url of the page with the problem -- : NA -- HikaShop version -- : 2.3.3 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4 -- Browser(s) name and version -- : NA  I'm trying to create a menu item that displays the number of items in the cart and when clicked reveals a full hikashop cart via javascript. How can you display the number of items in the cart? I've check out this   www.hikashop.com/forum/4-how-to/12498-mi...l?limitstart=0#13328  and it doesnt seem to work anymore.  I cannot use a minicart because I want to use a full cart on the same page and that creates errors with AJAX add to cart.  Regards, Nathan")* was created by *[MumsHealth](/forum/user/21338-mumshealth "View MumsHealth's Profile")*

-- url of the page with the problem -- : NA
-- HikaShop version -- : 2.3.3
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.4
-- Browser(s) name and version -- : NA

I'm trying to create a menu item that displays the number of items in the cart and when clicked reveals a full hikashop cart via javascript. How can you display the number of items in the cart? I've check out this [ www.hikashop.com/forum/4-how-to/12498-mi...l?limitstart=0#13328](http://www.hikashop.com/forum/4-how-to/12498-mini-cart-module-modification.html?limitstart=0#13328) and it doesnt seem to work anymore.

I cannot use a minicart because I want to use a full cart on the same page and that creates errors with AJAX add to cart.

Regards,
Nathan

[ ![Screen&#95;Shot&#95;2014-10-24&#95;at&#95;2&#95;59&#95;01&#95;PM.png](/forum/attachment/20316) ](/forum/attachment/20316 "...2&#95;59&#95;01&#95;PM.png")

- [ ![Screen&#95;Shot&#95;2014-10-24&#95;at&#95;2&#95;59&#95;01&#95;PM.png](/forum/attachment/20316) ](/forum/attachment/20316 "...2&#95;59&#95;01&#95;PM.png") [ ](/forum/attachment/20316?download=1 "...2&#95;59&#95;01&#95;PM.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3MjU2OS1kaXNwbGF5LW51bWJlci1vZi1pdGVtcy1pbi1jYXJ0P3RtcGw9bWFya2Rvd24=) 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
-
-

12 years 2 weeks ago [\#176863](#176863) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Display number of items in cart](/forum/31-development/872569-display-number-of-items-in-cart#176863 "-- url of the page with the problem -- : NA -- HikaShop version -- : 2.3.3 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4 -- Browser(s) name and version -- : NA  I'm trying to create a menu item that displays the number of items in the cart and when clicked reveals a full hikashop cart via javascript. How can you display the number of items in the cart? I've check out this   www.hikashop.com/forum/4-how-to/12498-mi...l?limitstart=0#13328  and it doesnt seem to work anymore.  I cannot use a minicart because I want to use a full cart on the same page and that creates errors with AJAX add to cart.  Regards, Nathan")*

Hi,

The solution of that post is still valid with the current version of HikaShop.
Do you get an error when using it ?

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

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

Less More

- Posts: 68
- Thank you received: 8
-
-

12 years 2 weeks ago [\#176882](#176882) by [MumsHealth](/forum/user/21338-mumshealth "View MumsHealth's Profile")  Replied by *[MumsHealth](/forum/user/21338-mumshealth "View MumsHealth's Profile")* on topic *[Display number of items in cart](/forum/31-development/872569-display-number-of-items-in-cart#176882 "-- url of the page with the problem -- : NA -- HikaShop version -- : 2.3.3 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4 -- Browser(s) name and version -- : NA  I'm trying to create a menu item that displays the number of items in the cart and when clicked reveals a full hikashop cart via javascript. How can you display the number of items in the cart? I've check out this   www.hikashop.com/forum/4-how-to/12498-mi...l?limitstart=0#13328  and it doesnt seem to work anymore.  I cannot use a minicart because I want to use a full cart on the same page and that creates errors with AJAX add to cart.  Regards, Nathan")*

The error is as follows, perhaps I have not inserted it in the proper file.

Fatal error: Class 'hikashop' not found in /var/www/vhosts/sitename.com/httpdocs/templates/template_name/index.php on line 26

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3MjU2OS1kaXNwbGF5LW51bWJlci1vZi1pdGVtcy1pbi1jYXJ0P3RtcGw9bWFya2Rvd24=) 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
-
-

12 years 2 weeks ago [\#176904](#176904) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Display number of items in cart](/forum/31-development/872569-display-number-of-items-in-cart#176904 "-- url of the page with the problem -- : NA -- HikaShop version -- : 2.3.3 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4 -- Browser(s) name and version -- : NA  I'm trying to create a menu item that displays the number of items in the cart and when clicked reveals a full hikashop cart via javascript. How can you display the number of items in the cart? I've check out this   www.hikashop.com/forum/4-how-to/12498-mi...l?limitstart=0#13328  and it doesnt seem to work anymore.  I cannot use a minicart because I want to use a full cart on the same page and that creates errors with AJAX add to cart.  Regards, Nathan")*

You probably didn't initialize the HikaShop helper before your code: Code:

if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR); if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true;

Without it loaded in memory, no HikaShop function can be used.

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

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

Less More

- Posts: 68
- Thank you received: 8
-
-

12 years 6 days ago [\#178743](#178743) by [MumsHealth](/forum/user/21338-mumshealth "View MumsHealth's Profile")  Replied by *[MumsHealth](/forum/user/21338-mumshealth "View MumsHealth's Profile")* on topic *[Display number of items in cart](/forum/31-development/872569-display-number-of-items-in-cart#178743 "-- url of the page with the problem -- : NA -- HikaShop version -- : 2.3.3 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4 -- Browser(s) name and version -- : NA  I'm trying to create a menu item that displays the number of items in the cart and when clicked reveals a full hikashop cart via javascript. How can you display the number of items in the cart? I've check out this   www.hikashop.com/forum/4-how-to/12498-mi...l?limitstart=0#13328  and it doesnt seem to work anymore.  I cannot use a minicart because I want to use a full cart on the same page and that creates errors with AJAX add to cart.  Regards, Nathan")*

Thanks, that seems to work but because I'm using ajax add to cart the value doesn't update until you refresh the page. I guess the best way to fix this is to create a plugin that refreshes the php file when something is added to the cart.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3MjU2OS1kaXNwbGF5LW51bWJlci1vZi1pdGVtcy1pbi1jYXJ0P3RtcGw9bWFya2Rvd24=) 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
-
-

12 years 5 days ago [\#178791](#178791) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Display number of items in cart](/forum/31-development/872569-display-number-of-items-in-cart#178791 "-- url of the page with the problem -- : NA -- HikaShop version -- : 2.3.3 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4 -- Browser(s) name and version -- : NA  I'm trying to create a menu item that displays the number of items in the cart and when clicked reveals a full hikashop cart via javascript. How can you display the number of items in the cart? I've check out this   www.hikashop.com/forum/4-how-to/12498-mi...l?limitstart=0#13328  and it doesnt seem to work anymore.  I cannot use a minicart because I want to use a full cart on the same page and that creates errors with AJAX add to cart.  Regards, Nathan")*

Hi,

You can override the JS of the AJAX add to cart to add the refresh of that number.
You'll need to implement the hikashop_cart_js_render function in a hikashop_button.php file in the folder templates/MY_TEMPLATE/html basing yourself on the code in administrator/components/com_hikashop/helpers/cart.php

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3MjU2OS1kaXNwbGF5LW51bWJlci1vZi1pdGVtcy1pbi1jYXJ0P3RtcGw9bWFya2Rvd24=) 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.054 seconds

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