Error in the backend of the module cart

  • Posts: 382
  • Thank you received: 77
6 years 2 months ago #297331

-- HikaShop version -- : 3.5.1
-- Joomla version -- : 3.8.12

Hi, Hikashop Team!

On the site the cart works perfectly.
But, in the settings of the cart module ih the backend, an error is displayed - You have to set at least one element to display in your module cart.


I'm using a mini cart. There should be no elements in it.

I suspect there is a logical error in the file \administrator\components\com_hikashop\views\cartmodules\view.html.php
if ($this->element['small_cart'] != 0) {
			$disaply_settings_array = array(
				'image_in_cart' => $this->element['image_in_cart'],
				'show_cart_quantity' => $this->element['show_cart_quantity'],
				'show_cart_delete' => $this->element['show_cart_delete'],
				'show_coupon' => $this->element['show_coupon'],
				'show_shipping' => $this->element['show_shipping'],
				'show_taxes' => @$this->element['show_taxes'],
				'print_cart' => @$this->element['print_cart'],
			);
			$error_message = '';
			$find= 0;
			foreach($disaply_settings_array as $k => $v) {
				if ($v == 1) {
					$find = 1;
					break;
				}
			}

			if (($this->element['show_cart_proceed'] == 1) && ($find == 0))
				$error_message = JText::_('HIKA_MOD_DISPLAY_ERROR_PROCEED');
			if (($this->element['show_cart_proceed'] == 0) && ($find == 0))
				$error_message = JText::_('HIKA_MOD_DISPLAY_ERROR');

			if ($error_message != '') {
				$app = JFactory::getApplication();
				$app->enqueueMessage($error_message, 'error');
			}
		}
	}
In my case $this->element = 1, look at the picture.


When I log some variables:
error_log('small_cart = '.$this->element['small_cart']);)
error_log('show_cart_proceed = '.$this->element['show_cart_proceed']);
I can see:
[Thu Aug 30 11:28:58.815880 2018] [:error] [pid 11384:tid 956] [client 127.0.0.1:49281] small_cart = 1, referer: http://site/administrator/index.php?option=com_modules&view=modules
[Thu Aug 30 11:28:58.816380 2018] [:error] [pid 11384:tid 956] [client 127.0.0.1:49281] show_cart_proceed = 0, referer: http://site/administrator/index.php?option=com_modules&view=modules

And HIKA_MOD_DISPLAY_ERROR is displayed:
if (($this->element == 0) && ($find == 0))
$error_message = JText::_('HIKA_MOD_DISPLAY_ERROR');

This is a bug?

Thank you
Best regards

Attachments:

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

  • Posts: 12953
  • Thank you received: 1778
6 years 2 months ago #297349

Hello,

We successfully reproduced that issue on our end and fixed it.

The solution will be to directly edit the following lines :

if(empty($this->element['small_cart']))

by :
if(empty($this->element['small_cart']) || $this->element['small_cart'] == 1)

Thank you for your feedback !
Kind regards,
Mohamed Thelji.

The following user(s) said Thank You: almika

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

  • Posts: 382
  • Thank you received: 77
6 years 2 months ago #297368

Thank you, Mohamed Thelji
Best regards,

Last edit: 6 years 2 months ago by almika.

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

Time to create page: 0.077 seconds
Powered by Kunena Forum