Show Basket Items Count on header

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
kartikbhat
Posts: 40
Joined: 02 Dec 2021, 17:18

Show Basket Items Count on header

Post by kartikbhat » 16 Apr 2022, 13:30

In my Laravel application I am using a common base.blade.php file which is then extended by all other blade files; I have a basket icon present on header part (it is present in that common base.blade.php file)
Now how can I show total number of items present in my basket as a badge of that basket icon ?
How Can I make that count is available for base.blade.php for all the time ?

TIA :)

User avatar
aimeos
Administrator
Posts: 8636
Joined: 01 Jan 1970, 00:00

Re: Show Basket Items Count on header

Post by aimeos » 18 Apr 2022, 07:54

The "basket/mini" component does that by default and you can adapt it to your needs:
- https://github.com/aimeos/aimeos-larave ... hp#L27-L41
- https://github.com/aimeos/ai-client-htm ... asket/mini
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

kartikbhat
Posts: 40
Joined: 02 Dec 2021, 17:18

Re: Show Basket Items Count on header

Post by kartikbhat » 18 Apr 2022, 16:35

I already tried this way of approach; but the basket icon with count is in common blade file, where I can call that "basket/mini" to get count to make it available all the time, with all pages (I have custom pages developed with reference to Laravel approach as well);

Tried calling this "basket/mini" method in AppServiceProvider and shared that count to view; but it is affecting "catelog list" page; showing all shop's products on any shop page;

Provide me any possible method to make this happen
TIA

User avatar
aimeos
Administrator
Posts: 8636
Joined: 01 Jan 1970, 00:00

Re: Show Basket Items Count on header

Post by aimeos » 20 Apr 2022, 10:04

You can also use the JSON API to fetch the basket content and count the number of products yourself:
- https://aimeos.org/docs/latest/frontend ... i/baskets/
- https://aimeos.org/docs/latest/frontend ... -products/
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply