-- 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.