- Posts: 116
- Thank you received: 7
Cart Items Count with product options
- stratacorps
-
Topic Author
- Offline
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.4.30
-- Browser(s) name and version -- : any
-- Error-message(debug-mod must be tuned on) -- : none
Is there any way to correct for the number of items in the Cart module...it is counting the product's options as well as the product. Example: a product has an option to engrave. When that option is selected two items are actually added to the cart.
even though we have Group options as one item, the cart count reflects all of the parts and pieces.
While we're at trying to combine or group product options, is there a global php or session variable that has the Item count? We would like to hide the shopping cart module if the cart is empty and we don't like the workaround in changing the language string to a null because then we get messages without any text in them elsewhere in the cart.
If we could do something like "return $cart->items > 0" to show the module in NoNumber Advance Module manager, that would be awesome!
Please Log in or Create an account to join the conversation.
I just did a test with the latest version of HikaShop on our demo website and it's not counting the options for the number of items in the cart module. You can try yourself by just turning on the mini cart option of the cart module there.
So if that's not the case on your website, it means that the "cart" file of the view "product" has been modified. You can go in the menu Display>Views and check for any customization and revert to the current code of the cart module and you should then get the proper number of items.
There is no global PHP or session variable where the items count is stored. It is calculated dynamically by the cart module.
If you want to calculate it yourself, you can use such code:
Please Log in or Create an account to join the conversation.
- stratacorps
-
Topic Author
- Offline
- Posts: 116
- Thank you received: 7
EDIT: is there a way to directly refer to the function class hikashop_get ... when its not on a Hikashop page it errors out.
And, as I speak my number of items count problem isn't happening. I have screen shots, but since it won't do you any good because all it says is "2 Items" and not the detail. I turned on to show the detail in the mod_cart, but then the count is correct. It doesn't matter...I can hide my cart!! Weird how small things can mean so much to you!
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- stratacorps
-
Topic Author
- Offline
- Posts: 116
- Thank you received: 7
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Sure, with the ajax system of HikaShop 3.x it's possible !
www.hikashop.com/home/blog/357-hikashop-3-0-beta.html
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
But it will be nice if you can tell me what i have to do with that code:
It will be nice, if someone can help me here.
my Store:
www.picknstick.de and the Count is on the right top !
Styled with uikit.
Please Log in or Create an account to join the conversation.
- stratacorps
-
Topic Author
- Offline
- Posts: 116
- Thank you received: 7
Can you look at www2.breedsofcattle.net/shop and interact with he HS 3.1 store there to see if this is what you are trying to do?
This installation makes use of the optional popup display plugin which can be disabled. However in the upper righthand corner there is a shopping cart icon and “badge” counter. The icon is generated via the standard HS cart module using a language override that contains a font awesome cart icon and html code. Along with some simple css for placement. Whenever an item is added to the cart the icon is updated by the cart module via ajax (without refreshing the page).
Note that the site also uses a popup to display the cart contents if you click on the cart count icon, but that is also optional and uses a 3rd part element handler and another instance of the HS cart module.
Please Log in or Create an account to join the conversation.
I'm not sure to understand what you're trying to do.
The HikaShop cart module is already compatible with the Ajax system and that module already have a "mini cart" mode which allow to display only minimal information.
So I don't see why you're trying to do some custom code while the feature is already there, as presented in the page I linked previously.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.

just change: lagnuage ini
nice work !
Please Log in or Create an account to join the conversation.
- stratacorps
-
Topic Author
- Offline
- Posts: 116
- Thank you received: 7
This is what I am using, but I am using font-awesome for the icon...but its just html either way...
It would be nice if HS had a mini-cart option for the cart icon/badge count display. Its a common thing, and this work-around took me awhile to figure it out
EDIT: also note that if the cart is empty, this string will be hidden. I wish there was a better way so it would show a "0" (zero) instead of just hiding it.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- stratacorps
-
Topic Author
- Offline
- Posts: 116
- Thank you received: 7
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- stratacorps
-
Topic Author
- Offline
- Posts: 116
- Thank you received: 7
Okay, I felt like I may have hijacked the thread from before.spotstv wrote: Yeah, that's the bit I was looking at, You seem to have a pretty simple solution.
The hikashop cart module can be placed anywhere you want the icon/badge to show up. On my projects I place it at the top right corner. In fact I create a special module position for it now.
In the module, I create a custom class suffix to help control the positioning and layout and make it float right.
For the Hikashop module settings I have:
Data display: mini cart = yes, product quantities = yes, and hide if empty = custom ("0") --all other options No.
Price data display: display price = no
Display: all set to yes, but can be anything ... I like it showing up all of the time
Then change the language strings as mentioned before to control what is displayed by the module. If you don't use font awesome for the cart icon, you'll need to change this to include the image you plan on using.
I create a second instance of the Hikashop cart module and place it in a hidden position and then use a pop-up to control the display of the cart's contents itself (I use Engage box). That way when you click on the cart icon, the user gets a pop-up of the cart contents and the ability to proceed to checkout. You could do this with any javascript/onclick action.
here is the css customization I use. This creates the cart item count as a badge to the cart icon. So in the cart icon module, I use a module suffix of top-cart-badge, so my css looks like:
Please Log in or Create an account to join the conversation.