Cart does not get empty after order creation?

  • Posts: 64
  • Thank you received: 0
11 years 7 months ago #129798

I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?

Thanks,

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

  • Posts: 12953
  • Thank you received: 1778
11 years 7 months ago #129811

Hi,

Can you give us more information about the issue that you're having, through some screenshots for example ? Note that It's maybe a cache issue, thansk to try to disable the Joomla cache, and clear it. You'll also have to disable it in the joomla config, and unpublish the cache plugin.

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

  • Posts: 64
  • Thank you received: 0
11 years 7 months ago #130098

The problem is once order is created all cart products should be removed.I have attached two snapshot.
Please have a look and let me know if not clear.

Thanks,

Attachments:

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

  • Posts: 83933
  • Thank you received: 13588
  • MODERATOR
11 years 7 months ago #130281

Please make sure that you configured the option "Clean cart when order is" of the configuration to "created".

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

  • Posts: 64
  • Thank you received: 0
11 years 7 months ago #130285

Yes,setting is exactly what you said.It works fine for other case but if product is added through entry fields then there is a problem.

Thanks,

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

  • Posts: 26251
  • Thank you received: 4040
  • MODERATOR
11 years 7 months ago #130458

Hi,

I created a ticket in our bug tracker.

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.

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

  • Posts: 64
  • Thank you received: 0
11 years 6 months ago #132322

Is there any solution that I can apply?

Thanks,

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

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #132377

Hi,

As temporary fix, you can probably create a plugin based on the function: onAfterOrderCreate(&$order,&$send_email)
And in this function use the code:

		$cartClass = hikashop_get('class.cart');
		$cartClass->resetCart();
This will force the reset of the cart when entering the order create function.

Here is some documentation about plugins:
www.hikashop.com/support/documentation/6...mentation.html#order

The following user(s) said Thank You: irfanhanfi

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

  • Posts: 64
  • Thank you received: 0
11 years 5 months ago #137742

It was seem to be working fine.But I noticed that it does not save entries if we reset the cart after order create.Could you please help me to solve this?

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

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #138690

Hi,

Thanks to explain with more details what you mean by "it does not save entries" ?

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

  • Posts: 64
  • Thank you received: 0
11 years 5 months ago #138717

For example if I have two fields in Entry form Name and Product Dropdown.It adds product as per drop down selection but does not save entries in Entry table(#__hikashop_entry).The reason is Entry inserted into table after onAfterOrderCreate Event.Is there any other way to empty cart?

I hope this is clear.

Thanks,

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

  • Posts: 13201
  • Thank you received: 2322
11 years 4 months ago #139198

Another way to clean the cart could be to jsut create a new cart for the current user.
Like it's done in the "newcart()" function in the frontend cart controller.

The content of the function is:

		$app = JFactory::getApplication();
		$cartClass = hikashop_get('class.cart');
		$cart_type = JRequest::getString('cart_type','cart');

		// set all the user carts cart_current to 0 in DB
		$result = $cartClass->setCurrent('0',$cart_type);

			// Create a new cart
			$session = JFactory::getSession();
			$curUser = hikashop_loadUser(true);
			$newCart = new stdClass();
			if($curUser == null)
				$newCart->user_id = 0;
			else
				$newCart->user_id = $curUser->user_cms_id;
			$newCart->session_id = $session->getId();
			$newCart->cart_modified = time();
			$newCart->cart_type = $cart_type;
			$newCart->cart_current = 1;
			$newCart->cart_share = 'nobody';
			$cartClass->save($newCart);
			// EO Create a new cart

			// set the current cart to 0 in session.
			$app->setUserState(HIKASHOP_COMPONENT.'.'.$cart_type.'_id', '0');
			// set the "new_cart" parameter in session
			$app->setUserState(HIKASHOP_COMPONENT.'.'.$cart_type.'_new', '1');
You need to adapt it for the plugin.

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

Time to create page: 0.096 seconds
Powered by Kunena Forum