Edit Cart Username

  • Posts: 127
  • Thank you received: 6
8 years 7 months ago #234709

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.8

Hi
When I try to change the user name for a cart (at the back end) the user I select is replaced with a random user.

I have checked the database and cleared all cache but the problem remains.

It is a useful method for us when we want to create an order for a customer. We load a cart logged in as a Test-User and then, when we are happy, go to the back-end and change the user for that cart. But at the moment we cannot select the user we want. We can see the user we want, but on confirm a different user is selected.

Help would be much appreciated.
Kind regards, Bob

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

  • Posts: 127
  • Thank you received: 6
8 years 7 months ago #234727

Update: Updated to latest version 2.6.1 but still have this problem.

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

  • Posts: 13201
  • Thank you received: 2322
8 years 7 months ago #234747

Hi,

I just tried on my local and I don't have this issue. Do you have overrides for the backend cart views ?
Are the customers existing and with the correct ID in database ?

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

  • Posts: 127
  • Thank you received: 6
8 years 7 months ago #234804

No backend overrides Xavier. Not sure how to tell if the correct ID is set. I simply choose the user from the list presented, but a different user populates the form instead.
Would you be willing to register at the site for me to set you admin rights?

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

  • Posts: 13201
  • Thank you received: 2322
8 years 7 months ago #234820

Hi,

You can directly create an account for us and send us the informations via our contact form with a link to this topic in your message.
www.hikashop.com/support/contact-us.html

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

  • Posts: 127
  • Thank you received: 6
8 years 7 months ago #234887

Thanks Xavier - contact form sent with login details.

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

  • Posts: 13201
  • Thank you received: 2322
8 years 7 months ago #234895

Hi,

The given account does not allow me to reach the backend and so see the issue.
Could you grant the access for this account ?

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

  • Posts: 127
  • Thank you received: 6
8 years 7 months ago #234970

Sorry - now sorted the back end access for the user on the contact form - thanks for your patience.

Last edit: 8 years 7 months ago by Bobwales.

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

  • Posts: 13201
  • Thank you received: 2322
8 years 7 months ago #234982

Hi,

I am not able to reproduce the issue. When I add a customer to the cart, the correct customer is added.
Even when I add a customer form the third page of the list, no problems.

ps: after a second attempt it seems that if you select a customer, then another one it is not working as expected. So in this case you have to close the cart edition page (go back on the listing) and open again the cart page and set the customer.

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

  • Posts: 127
  • Thank you received: 6
8 years 7 months ago #235084

Yes - that's exactly what we experience too.

What we want to do is create a cart using one of our own staff accounts, with the same ACL (determined by User Group) as the customer, from the front end. Then assign that cart to the customer, ready for when they login.

But when we switch from one of our Staff Accounts (often we use Testdealer for our wholesale customers) and try to select one customer, another is chosen instead. It seems like the relationship between User Group and Customer isn't working correctly.

A good example is Testdealer (ID80, used to create the cart) then assign it to one wholesale customer, Nickb (ID632). When we select Nickb, who is also a member of the ACL Group Dealers (ID10) a seemingly random user is selected instead.

Last edit: 8 years 7 months ago by Bobwales. Reason: Further explanation

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

  • Posts: 193
  • Thank you received: 76
8 years 7 months ago #235121

Xavier wrote: Hi,
ps: after a second attempt it seems that if you select a customer, then another one it is not working as expected. So in this case you have to close the cart edition page (go back on the listing) and open again the cart page and set the customer.


if I understand this issue correctly, it is the same issue I had in the past.
When you select customer for the cart, there is a race condition.
Click on the button fire 2 requests: submit form and parent window reload
<button onclick="hikashop.submitform('customer_save', 'hikashop_form'); window.parent.location.reload();" >..</button>
if form submit is faster, everything is ok. Otherwise you have to reopen the cart.
In case you saved cart before, parent reload will replay post request and if form submit is faster, then previous customer is saved again.

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

  • Posts: 13201
  • Thank you received: 2322
8 years 7 months ago #235197

Hi,

So please try to replace the code:

window.parent.location.reload();
[code]
By:
[code]
setTimeout(function(){
    window.parent.location.reload();
},1500);

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

  • Posts: 127
  • Thank you received: 6
8 years 7 months ago #235210

Thanks Xavier. But I'm not sure if this code is for me or Korso, and where it needs to go...

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

  • Posts: 193
  • Thank you received: 76
8 years 7 months ago #235217

Xavier wrote: Hi,

So please try to replace the code:

window.parent.location.reload();
[code]
By:
[code]
setTimeout(function(){
    window.parent.location.reload();
},1500);


This will not work as form submission will cancel setTimeout before it could execute. It should work with value 200-500, but again, if you saved cart before, it will reload last post request and save again old value.
I spent a lot of time with this and ended up with solution:
1. Hide customer part if $this->cart->cart_id is not set
2. In parent window add js function to redirect to cart form and call it from iframe

Last edit: 8 years 7 months ago by korzo.

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

  • Posts: 13201
  • Thank you received: 2322
8 years 7 months ago #235224

Hi,

You're right, my code could not be working fine.
Please edit the file "administrator/components/com_hikashop/controllers/cart.php" and replace the function "customer_save()" by:

	public function customer_save() {
		$class = hikashop_get('class.cart');
		if( $class === null )
			return false;

		$cart = new stdClass();
		$cart->cart_id = JRequest::getVar('cart_id','0');
		$cart->user_id = JRequest::getVar('user_id','0');
		$cart->session_id = JRequest::getVar('session_id','0');
		$cart->cart_type = JRequest::getVar('cart_type','cart');
		$status = $class->save($cart);
		if($status){
			JRequest::setVar('cid',$status);
			$js = 'parent.window.location.href=\''.hikashop_completeLink('cart&task=edit&cart_type='.$cart->cart_type.'&cid[]='.@$status,false,true).'\';';
		}else{
			$js = 'parent.window.location.reload();';
		}
		if(!headers_sent()){
			header( 'Cache-Control: no-store, no-cache, must-revalidate' );
			header( 'Cache-Control: post-check=0, pre-check=0', false );
			header( 'Pragma: no-cache' );
		}
		echo '<html><head><script type="text/javascript">'.$js.'</script></head><body></body></html>';
		exit;
	}

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

  • Posts: 127
  • Thank you received: 6
8 years 7 months ago #235258

Sorry Xavier - that doesn't seem to have effected any change with my original issue. The same strange behaviour remains - spurious customer saved instead of the one I chose from the list.

Last edit: 8 years 7 months ago by Bobwales.

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

  • Posts: 13201
  • Thank you received: 2322
8 years 7 months ago #235266

Hi,

Please provide a ftp access via our contact form. (with url to this topic in the message)
I will debug this on your end directly.

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

  • Posts: 127
  • Thank you received: 6
8 years 7 months ago #235374

Thanks Xavier. FTP Access details via form sent to you.

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

  • Posts: 13201
  • Thank you received: 2322
8 years 7 months ago #235436

Hi,

I am not able to connect to your FTP. Could you check this ?

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

  • Posts: 127
  • Thank you received: 6
8 years 7 months ago #235463

Just checked and sent corrected details via form - sorry Xavier, all thumbs today!

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

Time to create page: 0.119 seconds
Powered by Kunena Forum