Convert cart to wishlist

  • Posts: 6
  • Thank you received: 0
9 years 1 month ago #190413

-- HikaShop version -- : 2.3.3
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.3.28
-- Browser(s) name and version -- : LinuxMint 17.1 FireFox 35.0.1

I want have function will convert alll products in cart to wishlist.
Current, I only can convert wishlist to cart.

when order, I see have the button call "Convert cart in wishlist", but when I click on it, it show blank page, dont have any products in this page.



I try fix this error and I see this code (components/com_hikashop/controllers/cart.php):
function convert(){
	$app = JFactory::getApplication();
	$cart_type = JRequest::getString('cart_type','cart');
	$cart_id = JRequest::getInt('cart_id','0');
	$cartClass = hikashop_get('class.cart');
	$cartInfo = $cartClass->loadCart($cart_id);
	$currUser = hikashop_loadUser(true);
	if($cartInfo != null && $currUser->user_cms_id == $cartInfo->user_id){
		$app->setUserState(HIKASHOP_COMPONENT.'.'.$cart_type.'_id', 0);
		$cartClass->convert($cart_id, $cart_type);
		if($cart_type != 'wishlist'){
			JRequest::setVar('cart_type','wishlist');
		}
	}
	JRequest::setVar('cart_id',$cart_id);
	JRequest::setVar('layout', 'showcart');
	return parent::display();
}
When I change
$app->setUserState(HIKASHOP_COMPONENT.'.'.$cart_type.'_id', 0);
to
$app->setUserState(HIKASHOP_COMPONENT.'.'.$cart_type.'_id', $cart_id);

it's work, it will convert all product in cart to wishlist. and set empty cart.
but will have problem when I upgrade. Please let me know other solution, add all products in cart to wishlist but not empty cart.

Thanks.

Attachments:
Last edit: 9 years 1 month ago by Ducnb.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 1 month ago #190433

Hi,

Please try to update to HikaShop 2.3.5, few changes have been made on the cart and wishlist.
If it is still not working on the latest version, you can apply your patch, and keep us informed in order to do deeper check.

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

  • Posts: 6
  • Thank you received: 0
8 years 11 months ago #197071

-- HikaShop version -- : 2.3.5 Business
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.3.29
-- Browser(s) name and version -- : 41.0.2272.101 m

I am having a similar problem but when I click on "convert cart in wishlist" the page shows "you are not authorized to see this page" even though I am registered and logged in during checkout. I have to click on "display my carts" button to see the item added. Is there a way that the page displays correctly, instead of showing "you are not authorized to see this page"?

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

  • Posts: 13201
  • Thank you received: 2322
8 years 11 months ago #197083

Hi,

There is fixes done in the latest version of HikaShop for that kind of issues, so please download and install the latest version.

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

  • Posts: 6
  • Thank you received: 0
8 years 11 months ago #197731

My order was made on 2015-01-09 is there a more recent version than this?

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

  • Posts: 13201
  • Thank you received: 2322
8 years 11 months ago #197735

Hi,

The current version is the 2.4.0

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

  • Posts: 6
  • Thank you received: 0
8 years 11 months ago #198071

I updated to the latest version 2.4.0, but the "You are not authorized to see this resource" still remains.

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

  • Posts: 13201
  • Thank you received: 2322
8 years 11 months ago #198335

Hi,

I don't have the message displayed when testing on you website.
Do you have edited anything ?

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

  • Posts: 6
  • Thank you received: 0
8 years 11 months ago #198502

No I haven't edited anything. I am wondering would it have something to do with caching?

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

  • Posts: 13201
  • Thank you received: 2322
8 years 11 months ago #198505

Hi,

Yes indeed, I forgot to ask you that. If you have any cache, please disable it (Joomla settings, Joomla plugin, template cache...)

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

Time to create page: 0.092 seconds
Powered by Kunena Forum