Hika cart module not hidden when empty

  • Posts: 26
  • Thank you received: 1
  • Hikashop Business
3 months 2 weeks ago #313975

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.13
-- PHP version -- : 7.2.25
-- Browser(s) name and version -- : every browser
-- Error-message(debug-mod must be tuned on) -- : no error message

No error message, but the Hikashop Cart Module ("Winkelmandje") is not hidden, even when I set the "hide when emtpy" option in the module.

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

  • Posts: 68480
  • Thank you received: 10205
  • MODERATOR
3 months 2 weeks ago #313980

Hi,

The "the cart is empty" message is removed.
However, you still need the area with the HTML of the cart module so that when you add something to the cart, the ajax process can dynamically update the area with the content of the cart.
Also, the text "Winkelmandje" is the title of the module which is displayed by the template, not HikaShop. If you don't want the the title of the module when the cart is empty, you should turn off the display of the title in the settings of the module, and instead edit the file "cart" of the view "product" via the menu Display>Views and add the title there, before the code:

<?php

echo $this->notice_html;
if(!empty($this->element->messages)) {
	foreach($this->element->messages as $msg) {
		if(empty($msg['type']))
			$msg['type'] = 'success';
		hikashop_display($msg['msg'], $msg['type']);
	}
}

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

  • Posts: 26
  • Thank you received: 1
  • Hikashop Business
3 months 1 week ago #314098

Hi Nicolas,

Thanks, this works. One more thing: the function $this->countModules( 'moduleposition' ) in my template always return true, even if the cart is empty. But I suppose there needs to be some code in order to add a product dynamicaly via Ajax.

Regards,
Peter

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

  • Posts: 12334
  • Thank you received: 1697
  • MODERATOR
3 months 1 week ago #314107

Hello Peter,

Even if your cart is empty, if you have published your cart module on that position, then that method should return "true" or >1 regardless of the number of products in your cart.

Kind regards,
Mohamed.

The following user(s) said Thank You: sandvalley2019

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

Time to create page: 0.059 seconds
Powered by Kunena Forum