- Posts: 129
- Thank you received: 0
IF HikaShop MiniCart was Empty or not
9 years 3 months ago #273071
by nic7071
IF HikaShop MiniCart was Empty or not was created by nic7071
-- 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
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 or Create an account to join the conversation.
9 years 3 months ago #273083
by nicolas
Replied by nicolas on topic IF HikaShop MiniCart was Empty or not
Hi,
You'll want to add your code in the file "cart" of the view "product" via the menu Display>Views.
The code to check if the cart is empty or not is quite easy:
You'll want to add your code in the file "cart" of the view "product" via the menu Display>Views.
The code to check if the cart is empty or not is quite easy:
Code:
<?php if(empty($this->rows)) echo 'EmptyCart'; ?>
Please Log in or Create an account to join the conversation.
9 years 3 months ago #273150
by nic7071
Replied by nic7071 on topic IF HikaShop MiniCart was Empty or not
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 ?
is it even possible with js ?
Please Log in or Create an account to join the conversation.
9 years 2 months ago #273152
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic IF HikaShop MiniCart was Empty or not
Hello,
What do you want to do with javascript exactly ?
I'm sorry but I'm not following you.
Regards,
What do you want to do with javascript exactly ?
I'm sorry but I'm not following you.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
9 years 2 months ago - 9 years 2 months ago #273417
by nic7071
Replied by nic7071 on topic IF HikaShop MiniCart was Empty or not
hi,
This is my HTML strustion:
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 !
This is my HTML strustion:
Code:
<div>
<div>Cart icon </div>
<div class="ContentWrapper">
<div>HikaShop Module in listing style</div>
<div>Some Menu Module</div>
</div>
</div>
Last edit: 9 years 2 months ago by nic7071.
Please Log in or Create an account to join the conversation.
9 years 2 months ago #273447
by nicolas
Replied by nicolas on topic IF HikaShop MiniCart was Empty or not
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
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
If you want to load the current cart data, you can use the code :
$cartClass = hikashop_get('class.cart');
$cart = $cartClass->loadFullCart();
The products in the cart will be available in the attribute as an array of product objects:
$cart->products
Please Log in or Create an account to join the conversation.
Time to create page: 0.170 seconds