Skip to main content

Get the cart quantity

More
12 years 6 months ago #148082 by mcruip
Get the cart quantity was created by mcruip
Hi,

We need to implement a small button that links to the checkout area. The button is a simple cart with the current cart total items next to it. How can this be achieved in a module?

Thanks
M

Hika Business

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #148103 by Mohamed Thelji
Hi,
Regarding the button, a simple Custom HTML module with the link to your checkout process will do the job but can you give me more information about that part :

The button is a simple cart with the current cart total items next to it.

The following user(s) said Thank You: mcruip

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #148215 by mcruip
Replied by mcruip on topic Get the cart quantity
Yes, a custom html like module is what we thought, but we need to add the user current car total next to it. Example:
Your cart: 5
In which 5 is the current total items currently in the cart.
The question is where do we get the cart object or cart quantity value.

Thanks!
M

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #148221 by Xavier
Replied by Xavier on topic Get the cart quantity
Hi,

To get the cart data, you can see how we get it in the file "components/com_hikashop/views/product/view.html.php" in the "cart()" function:
Code:
$class = hikashop_get('class.cart'); $cart_type = 'cart'; $cart_id =$app->getUserState( HIKASHOP_COMPONENT.'.'.$cart_type.'_id', 0, 'int' ); $class->get($cart_id,true,$cart_type); $full = $class->loadFullCart(true,true,true); $rows = $full->products;
Thanks to this code you will have the cart object in $full and the products in $rows.
The following user(s) said Thank You: mcruip

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #148344 by mcruip
Replied by mcruip on topic Get the cart quantity
Thanks Xavier for the very useful guidance. That's the object we need to get the data and not break any other functionality.
Thank you
M

Please Log in or Create an account to join the conversation.

Time to create page: 0.214 seconds
Powered by Kunena Forum