problem adding to cart

  • Posts: 171
  • Thank you received: 4
10 years 3 months ago #202134

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 2.5.28
-- PHP version -- : 5.5.37
-- Browser(s) name and version -- : any
-- Error-message(debug-mod must be tuned on) -- : Notice: Trying to get property of non-object in administrator/components/com_hikashop/classes/cart.php on line 317

Hi,

i have a big problem on the site. When i go to there and add to cart, i have to add items 3 times to cart, before they get into for first item.

only error i see when doing debuging is
Notice: Trying to get property of non-object in administrator/components/com_hikashop/classes/cart.php on line 317

i have tried both with our custom template and the default beez20 template, and it does the same.

i have removed all other errors i was seeing on page, so no idea what is causing it.

any suggestions or help on how to fix this problem would be good

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

  • Posts: 13201
  • Thank you received: 2322
10 years 3 months ago #202147

Hi,

Please give us the corresponding lines arround the one given in the php error message.
Do you have any cache enabled on your website ?

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

  • Posts: 171
  • Thank you received: 4
10 years 3 months ago #202412

from line 310

		JRequest::setVar('new_'.$cart_id,$cart->cart_id);
		JPluginHelper::importPlugin( 'hikashop' );
		$dispatcher = JDispatcher::getInstance();
		$do = true;
		$dispatcher->trigger( 'onBeforeCartUpdate', array(&$this, &$cart, &$product_id, &$quantity, &$add, &$type,&$resetCartWhenUpdate,&$force,&$do) );
		if (!$do) return false;
		if(!$app->isAdmin() && $cart->cart_id){
			$app->setUserState(HIKASHOP_COMPONENT.'.'.$cart_id, $this->cart->cart_id);
		}

317 is $app->setUserState(HIKASHOP_COMPONENT.'.'.$cart_id, $this->cart->cart_id);

$cart_id = $this->cart_type.'_id'; is defined in 278

if i look in the source of the lastest version from the site, it is the same as in that file.


i normaly do have cache on, but have turned off and cleared out the site to test if it was that, but still makes same error

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

  • Posts: 13201
  • Thank you received: 2322
10 years 3 months ago #202415

Hi,

Ecommerce systems are not compatible with cache, so cache must be disabled in Joomla settings, Joomla cache plugin and potentially cache option in template.

Please send us backend and FTP access to your website via our contact form in order to debug that issue direclty on your website. Don't forget to give the url to that topic in the message.

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

  • Posts: 171
  • Thank you received: 4
10 years 3 months ago #202527

I have sendt you the info on the contact form

you know, that Joomla has flags you can set, that disable cache for one page/module ? so if you just set this info on everything that is dynmic of your parts, cache can be working fine.

And i have several other pages i help with their Joomla sites wiht Hikashop which runs cache on without any problems, so it really not a cache problems also showed by cache being disabled and the problem still persist

Last edit: 10 years 3 months ago by jesper.

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

  • Posts: 13201
  • Thank you received: 2322
10 years 3 months ago #202535

Hi,

The cart is correctly updated, but after we press F5 to refresh the whole page.

Without a backend access we can't see your settings, are you using the Ajax functionality to refresh the cart ?
(in Configuration > Main > Advanced settings)
If not, you maybe have a third extension which avoid the page refresh to update the cart informations.

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

  • Posts: 171
  • Thank you received: 4
10 years 3 months ago #203215

I have resubmitted the backend login information by the contact form.

problem is still not solved

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 3 months ago #203297

Hi,

I got backend access but I do not have FTP access like Xavier asked.

Please send us backend and FTP access to your website via our contact form in order to debug that issue direclty on your website. Don't forget to give the url to that topic in the message.


But about your issue, can you please modify the line 317 from
$app->setUserState(HIKASHOP_COMPONENT.'.'.$cart_id, $this->cart->cart_id);
into
$app->setUserState(HIKASHOP_COMPONENT.'.'.$cart_id, $cart->cart_id);
It should fix the warning problem and I hope, the rest of your issue.

If not, please provide us the FTP access so we will be able to see and perform directly some tests.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: jesper

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

  • Posts: 171
  • Thank you received: 4
10 years 3 months ago #204851

I have been testing alot on this and found out it was a plugin special for this page that does the problem.

the code that gives the error is

$cartClass = hikashop_get('class.cart');
$cart = $cartClass->loadFullCart();

when i remove that code, everything works fine.

The code for this have been found on www.hikashop.com/support/documentation/6...r-documentation.html

what this plugin does is prevent items from different categories to be added to cart at the same time.

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

  • Posts: 171
  • Thank you received: 4
10 years 2 months ago #205120

Jerome any idea on this ?

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

  • Posts: 13201
  • Thank you received: 2322
10 years 2 months ago #205123

Hi,

Do you now which plugin is causing that issue ? Please give us more details on this.
If you don't know which of them is causing this, please try to disable them one by one.

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

  • Posts: 171
  • Thank you received: 4
10 years 2 months ago #205240

Hi Xaviar,

yes as i wrote its a custom plugin to prevent items from selected main categories not to be added in cart as same time as from the other main categories.

the code is as following

function onBeforeCartUpdate(&$a, &$cart, $product_id, $quantity, $add, $type,$resetCartWhenUpdate,$force,&$do) {
		if ($cart->cart_id && $quantity > 0) {
            JFactory::getSession()->set('bbhika', "");
			$pluginsClass = hikashop_get('class.plugins');
			$plugin = $pluginsClass->getByName('hikashop','bedrebad');
			$state = false;
			$mainkat = explode(",",$plugin->params['mainkat']);
			$productClass = hikashop_get('class.product');
			$product=$productClass->get($product_id);
			$inkat = $this->maincat($product_id,$mainkat);
			$cartClass = hikashop_get('class.cart');
			$cc = $cartClass->loadFullCart();
			foreach($cc as $aa ) {
				$v_kat = $this->maincat($aa->product_id,$mainkat);
				if ($v_kat !== $inkat) $state = true;
			}
			if ($state) {
				$do = false; //Stop for at ligge varer i kurven
				JFactory::getApplication()->enqueueMessage(JText::_('HIKASHOP_BEDREBAD_ERROR'),'error');
				JFactory::getSession()->set('bbhika', "error");
			}

		}
	}

	function maincat($pid,$parrent) {
		$state = false;
		$database = JFactory::getDBO();
		$database->setQuery('SELECT category_id FROM '.hikashop_table('product_category').' WHERE product_id = '.$pid.'');
		$ret = $database->loadObjectList();
		foreach ($ret as $r) $id[] = $r->category_id;
		foreach ($id as $i)
		do {
			if (in_array($i,$parrent)) {
				$state = true;
				break;
			}
			$database->setQuery('SELECT category_parent_id FROM '.hikashop_table('category').' WHERE category_id = '.$i.'');
			$ret2 = $database->loadObject();
			if (in_array($ret2->category_parent_id,$parrent)) {
				$state = true;
				break;
			}
			$i = $ret2->category_parent_id;
		} while ($ret2->category_parent_id != 0);
		return $state;
	}

and the lines that give the problems are
$cartClass = hikashop_get('class.cart');
			$cc = $cartClass->loadFullCart();

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

  • Posts: 171
  • Thank you received: 4
10 years 2 months ago #205671

So Xavier any help you can give me ?

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

  • Posts: 12953
  • Thank you received: 1778
10 years 2 months ago #205714

Hello,
Can you give us :
- A temporary FTP access to your website so that we can directly check your code
- Your custom plugin name (file location)
- Step by step instructions of how to reproduce your issue

Through our contact form so that we can directly test and fix it : www.hikashop.com/support/contact-us.html

Thanks.

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

  • Posts: 171
  • Thank you received: 4
10 years 2 months ago #205833

Hi Mohamed,

information has been send to you.

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

  • Posts: 13201
  • Thank you received: 2322
10 years 2 months ago #205969

Hi,

I can see in the plugin that you changed from loadFullCart() function to the get() one, does that solve the issue ?
In frontend when adding a product it is correctly added to the cart, there is just the page to refresh so maybe you will have to disable the option to use ajax on add to cart buttons, or you have some cache enabled.

ps: I was not able to connect to backend, I tried the two passwords (old and new one) and I've been banned ;)

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

  • Posts: 171
  • Thank you received: 4
10 years 2 months ago #205975

no it doesn't matter if i use the one or the other, gives same problem.

the plugin was disabled, thats why it worked... i have reenabled it and i have removed your ban from the firewall

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

  • Posts: 13201
  • Thank you received: 2322
10 years 2 months ago #205995

Hi,

I still have issues to reach the backend:
take.ms/97M1U

But as you said that you reenabled the plugin I tried again and it seems to be working pretty fine.
If you disabled it, please check the backend access in order to help you.

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

  • Posts: 171
  • Thank you received: 4
10 years 2 months ago #206127

if you just press the button you should get to the control panel without problems... i will look why it gives that error though.

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

  • Posts: 13201
  • Thank you received: 2322
10 years 2 months ago #206173

Hi,

When clicking on the button, I get redirected to the login page.
I just tried again, and I can definitively not reach your backend. The password seems to be no more working so autobanned a second time.

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

Time to create page: 0.101 seconds
Powered by Kunena Forum