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

#   IF HikaShop MiniCart was Empty or not

##

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

Less More

- Posts: 129
- Thank you received: 0
-
-

9 years 5 months ago [\#273071](#273071) by [nic7071](/forum/user/42433-nic7071 "View nic7071's Profile")  *[IF HikaShop MiniCart was Empty or not](/forum/27-checkout/890953-if-hikashop-minicart-was-empty-or-not#273071 "-- HikaShop version -- : 3.1.1  Hi, I need to change a class of div that begins and end before HikaShop mini cart div begins based on the mini cart is empty or not.  for example, if HikaShop Mini Cart has items inside the class of the div above toggle to &quot;EmptyCart&quot;!  can i get the if condition code or any hint to link it to change the class of the above div?  Thanks")* was created by *[nic7071](/forum/user/42433-nic7071 "View nic7071's Profile")*

-- HikaShop version -- : 3.1.1

Hi,
I need to change a class of div that begins and end before HikaShop mini cart div begins based on the mini cart is empty or not.

for example, if HikaShop Mini Cart has items inside the class of the div above toggle to "EmptyCart"!

can i get the if condition code or any hint to link it to change the class of the above div?

Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MDk1My1pZi1oaWthc2hvcC1taW5pY2FydC13YXMtZW1wdHktb3Itbm90P3RtcGw9bWFya2Rvd24=) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

9 years 5 months ago [\#273083](#273083) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[IF HikaShop MiniCart was Empty or not](/forum/27-checkout/890953-if-hikashop-minicart-was-empty-or-not#273083 "-- HikaShop version -- : 3.1.1  Hi, I need to change a class of div that begins and end before HikaShop mini cart div begins based on the mini cart is empty or not.  for example, if HikaShop Mini Cart has items inside the class of the div above toggle to &quot;EmptyCart&quot;!  can i get the if condition code or any hint to link it to change the class of the above div?  Thanks")*

Hi,

You'll want to add your code in the file "cart" of the view "product" via the menu Display&gt;Views.
The code to check if the cart is empty or not is quite easy: Code:

&lt;?php if(empty($this-&gt;rows)) echo 'EmptyCart'; ?&gt;

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

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

Less More

- Posts: 129
- Thank you received: 0
-
-

9 years 4 months ago [\#273150](#273150) by [nic7071](/forum/user/42433-nic7071 "View nic7071's Profile")  Replied by *[nic7071](/forum/user/42433-nic7071 "View nic7071's Profile")* on topic *[IF HikaShop MiniCart was Empty or not](/forum/27-checkout/890953-if-hikashop-minicart-was-empty-or-not#273150 "-- HikaShop version -- : 3.1.1  Hi, I need to change a class of div that begins and end before HikaShop mini cart div begins based on the mini cart is empty or not.  for example, if HikaShop Mini Cart has items inside the class of the div above toggle to &quot;EmptyCart&quot;!  can i get the if condition code or any hint to link it to change the class of the above div?  Thanks")*

the problem is that i have to change the class of a div that is started and ended before hika shop cart module div started.
is it even possible with js ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MDk1My1pZi1oaWthc2hvcC1taW5pY2FydC13YXMtZW1wdHktb3Itbm90P3RtcGw9bWFya2Rvd24=) 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: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

9 years 4 months ago [\#273152](#273152) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[IF HikaShop MiniCart was Empty or not](/forum/27-checkout/890953-if-hikashop-minicart-was-empty-or-not#273152 "-- HikaShop version -- : 3.1.1  Hi, I need to change a class of div that begins and end before HikaShop mini cart div begins based on the mini cart is empty or not.  for example, if HikaShop Mini Cart has items inside the class of the div above toggle to &quot;EmptyCart&quot;!  can i get the if condition code or any hint to link it to change the class of the above div?  Thanks")*

Hello,

What do you want to do with javascript exactly ?
I'm sorry but I'm not following you.

Regards,

---

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

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

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

Less More

- Posts: 129
- Thank you received: 0
-
-

9 years 4 months ago -  9 years 4 months ago [\#273417](#273417) by [nic7071](/forum/user/42433-nic7071 "View nic7071's Profile")  Replied by *[nic7071](/forum/user/42433-nic7071 "View nic7071's Profile")* on topic *[IF HikaShop MiniCart was Empty or not](/forum/27-checkout/890953-if-hikashop-minicart-was-empty-or-not#273417 "-- HikaShop version -- : 3.1.1  Hi, I need to change a class of div that begins and end before HikaShop mini cart div begins based on the mini cart is empty or not.  for example, if HikaShop Mini Cart has items inside the class of the div above toggle to &quot;EmptyCart&quot;!  can i get the if condition code or any hint to link it to change the class of the above div?  Thanks")*

hi,
This is my HTML strustion: Code:

&lt;div&gt; &lt;div&gt;Cart icon &lt;/div&gt; &lt;div class="ContentWrapper"&gt; &lt;div&gt;HikaShop Module in listing style&lt;/div&gt; &lt;div&gt;Some Menu Module&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;

when i click on cart icon the content wrapper appears now, i want to change the class of cart icon div when hikashop cart has item inside and when its empty !

Last edit: 9 years 4 months ago by [nic7071](/forum/user/42433-nic7071 "View nic7071's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MDk1My1pZi1oaWthc2hvcC1taW5pY2FydC13YXMtZW1wdHktb3Itbm90P3RtcGw9bWFya2Rvd24=) 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")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

9 years 4 months ago [\#273447](#273447) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[IF HikaShop MiniCart was Empty or not](/forum/27-checkout/890953-if-hikashop-minicart-was-empty-or-not#273447 "-- HikaShop version -- : 3.1.1  Hi, I need to change a class of div that begins and end before HikaShop mini cart div begins based on the mini cart is empty or not.  for example, if HikaShop Mini Cart has items inside the class of the div above toggle to &quot;EmptyCart&quot;!  can i get the if condition code or any hint to link it to change the class of the above div?  Thanks")*

Hi,

Then you want to load the cart in your code and do the check on it.
It's really easy...
Or developer documentation already explains how to load the cart products:
[ www.hikashop.com/support/documentation/6...umentation.html#code](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#code)

> If you want to load the current cart data, you can use the code :
>
> $cartClass = hikashop\_get('class.cart');
>
> $cart = $cartClass-&gt;loadFullCart();
>
> The products in the cart will be available in the attribute as an array of product objects:
>
> $cart-&gt;products

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

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