VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: maegras on December 26, 2011, 02:31:21 AM

Title: Get N of product in cart
Post by: maegras on December 26, 2011, 02:31:21 AM
Hi everyone,

I'd like to have into the homepage, a box (not the cart module) displaying the current number of products in cart.

Eg:
1x product_a
3x product_b
---------------
Products on cart = 4

How can I do that?
Title: Re: Get N of product in cart
Post by: Stephen Roberts on December 26, 2011, 20:18:06 PM
Sounds to me like you might need to develop a module for this. Couldn't you override the template for the cart module to get the output you want?
Title: Re: Get N of product in cart
Post by: maegras on December 27, 2011, 04:09:29 AM
thank for you great idea :)
I've modified the default mod_virtuemart_cart such to obtain output I wish :)

Title: Re: Get N of product in cart
Post by: Stephen Roberts on December 27, 2011, 04:20:57 AM
Cool. You do understand how to do template overrides work right? You shouldn't modify the module itself, but override the template instead.
Title: Re: Get N of product in cart
Post by: maegras on December 27, 2011, 13:05:13 PM
I couldn't override because I need also the original cart module. So I created a new module called `product-number` starting from the original cart module. I've modified this module such to obtain output I need.

:)