Wrong popup when item deleted from mini cart

  • Posts: 43
  • Thank you received: 1
11 years 6 months ago #101190

When I am on a product page and add a product to the cart it shows up as I want it to in the mini cart I have placed at the top of each page and there is a popup saying product successfully added to cart (with continue shopping and proceed to cart buttons). However, if I stay on the product page and delete the item from the mini cart (as a customer might who has changed their mind) I get the same popup saying successfully added to cart. Obviously it hasn't been - it has been deleted.

This doesn't happen if, after adding the product to the cart, I navigate away from the product page then delete the item in the mini cart (then mini cart then says it is empty). How can I stop the wrong popup message please?

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

  • Posts: 82760
  • Thank you received: 13346
  • MODERATOR
11 years 6 months ago #101195

That has been fixed on our end.

Download again the latest version of HikaShop on our website and install it on yours and that will fix it.

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

  • Posts: 43
  • Thank you received: 1
11 years 6 months ago #101198

OK will do thanks, though I did update just the other day. Is this new?

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

  • Posts: 43
  • Thank you received: 1
11 years 6 months ago #101199

Sorry, Nicolas, I downloaded and reinstalled but it's still doing it. In fact I've discovered that the popup also appears if you just refresh the product page (with an item in the cart).

Last edit: 11 years 6 months ago by mhunter. Reason: clarification

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

  • Posts: 82760
  • Thank you received: 13346
  • MODERATOR
11 years 6 months ago #101432

We cannot reproduce the problem.

Please provide a link to a product page with the problem.

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

  • Posts: 43
  • Thank you received: 1
11 years 6 months ago #101684

Thanks, I'm just waiting for my domain to propagate then you can see the site live ( www.personalised-garters.co.uk ) - hopefully tomorrow.

I've tested with a temporary web address and I do sometimes (but not always) see the continue shopping/checkout popup on the live site, so it's perhaps acting differently than on my local machine.

However, there is a new problem - once I add a product to the cart the product image, description etc disappears completely, so I'm left with a silly looking page with just the top and bottom information and blank in between. All my products have unlimited stock as they are made to order, and 'Display out of stock products' is set to yes in configuration, so I don't want the product to go away.

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

  • Posts: 43
  • Thank you received: 1
11 years 6 months ago #101792

UPDATE
Site is now live ( www.personalised-garters.co.uk ) and the opposite of my last post is now happening! So product details now stay showing if I delete the added product from the mini cart without navigating away (which is good), but the original problem is now happening, ie I get the popup saying "product successfully added to cart" when I delete it from the mini cart. Any ideas Nicolas?

Updated to say that the popup is being triggered whenever I do anything while still on the product page, such as using the currency switcher.

Last edit: 11 years 6 months ago by mhunter. Reason: more info

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

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

Hi,

Can you try to replace the function "updatecart()" in "administrator/components/com_hikashop/controllers/product.php" by:

	function updatecart(){
		$app = JFactory::getApplication();
		$product_id = (int)JRequest::getCmd('product_id',0);
		$module_id = (int)JRequest::getCmd('module_id',0);

		$cart_type = JRequest::getString('hikashop_cart_type_'.$product_id.'_'.$module_id,'null');

		if($cart_type == 'null')
			$cart_type = JRequest::getString('cart_type','cart');
		$cart_type_id = $cart_type.'_id';

// Sometimes >> getUserState / getInt
		if(JRequest::getInt('cart_id',0,'GET') != 0){
			$cart_id = JRequest::getInt('cart_id',0,'GET');
		}else{
			$cart_id = $app->getUserState(HIKASHOP_COMPONENT.'.'.$cart_type_id,0);
		}

		//if "add to" from the cart or wishlist
		$addTo = JRequest::getString('add_to','');
		if($addTo != ''){
			$from_id = $cart_id;
			if($addTo == 'cart')
				JRequest::setVar('from_id',$cart_id);
			$cart_id = $app->getUserState(HIKASHOP_COMPONENT.'.'.$addTo.'_id',0);
			$cart_type_id = $addTo.'_id';
			JRequest::setVar('cart_type', $addTo);
		}else{
			JRequest::setVar('cart_type', $cart_type);
		}
		//JRequest::setVar('wishlist_id',JRequest::getInt('wishlist_id','0'));
		JRequest::setVar($cart_type_id, $cart_id);


		$char = JRequest::getString('characteristic','');
		if(!empty($char)){
			return $this->show();
		}else{
			$tmpl = JRequest::getCmd('tmpl','index');
			$add = JRequest::getCmd('add','');
			if(!empty($add)){
				$add=1;
			}else{
				$add=0;
			}


			if(empty($product_id)){
				$product_id = JRequest::getCmd('cid',0);
			}
			$cart_product_id = JRequest::getCmd('cart_product_id',0);
			$quantity = JRequest::getInt('quantity',1);
			$class = hikashop_get('class.cart');
			if(!empty($product_id)){
				$type = JRequest::getWord('type','product');
				if($type=='product'){
					$product_id=(int)$product_id;
				}
				$status = $class->update($product_id,$quantity,$add,$type);
			}elseif(!empty($cart_product_id)){
				$status = $class->update($cart_product_id,$quantity,$add,'item');
			}else{
				$formData = JRequest::getVar( 'item', array(), '', 'array' );
				if(!empty($formData)){
					$class->update($formData,0,$add,'item');
				}else{
					$formData = JRequest::getVar( 'data', array(), '', 'array' );
					if(!empty($formData)){

						$class->update($formData,0,$add);
					}
				}
			}

			$app->setUserState(HIKASHOP_COMPONENT.'.'.$cart_type.'_new', '1');
			if(@$class->errors && $tmpl!='component'){
				if(!empty($_SERVER['HTTP_REFERER'])){
					if(strpos($_SERVER['HTTP_REFERER'],HIKASHOP_LIVE)===false && preg_match('#^https?://.*#',$_SERVER['HTTP_REFERER'])) return false;
					$app->redirect($_SERVER['HTTP_REFERER']);
				}else{
					echo '<html><head><script type="text/javascript">history.back();</script></head><body></body></html>';
					exit;
				}
			}

			$app->setUserState( HIKASHOP_COMPONENT.'.shipping_method','');
			$app->setUserState( HIKASHOP_COMPONENT.'.shipping_id','');
			$app->setUserState( HIKASHOP_COMPONENT.'.shipping_data','');
			$app->setUserState( HIKASHOP_COMPONENT.'.payment_method','');
			$app->setUserState( HIKASHOP_COMPONENT.'.payment_id','');
			$app->setUserState( HIKASHOP_COMPONENT.'.payment_data','');
			$config =& hikashop_config();
			$checkout = JRequest::getString('checkout','');
			if(!empty($checkout)){
				global $Itemid;
				$url = 'checkout';
				if(!empty($Itemid)){
					$url.='&Itemid='.$Itemid;
				}
				$url = hikashop_completeLink($url,false,true);
				$this->setRedirect($url);
			}
			else if($cart_type == 'wishlist'){
				if(hikashop_loadUser() == null){
					$app->enqueueMessage('LOGIN_REQUIRED_FOR_WISHLISTS');
				}
				$redirectConfig = $config->get('redirect_url_after_add_cart','stay_if_cart');
				$url='';
				$stay = 0;
				switch($redirectConfig){
					case 'ask_user':
						$url = JRequest::getVar('return_url','');
						if(!empty($url)){
							$url=base64_decode(urldecode($url));
						}
						$url = str_replace('&popup=1','',$url);
						if(JRequest::getInt('popup',0) || JRequest::getInt('quantity',0)){
							if(strpos($url,'?')){
								$url.='&';
							}else{
								$url.='?';
							}
							$url.='popup=1';
						}
						JRequest::setVar('cart_type','wishlist');
						$app->setUserState( HIKASHOP_COMPONENT.'.popup_cart_type','wishlist');
						break;
					case 'stay':
						$stay = 1;
						break; //$stay = 1; && $url ='';
					case 'checkout':
						break; //$stay = 0; && $url ='';
					case 'stay_if_cart':
						$module = JModuleHelper::getModule('hikashop_cart',false);
						if($module != null){
							$stay = 1;
						}
						break;
					default:
						break;
				}
				if(empty($url)){
					global $Itemid;
					if(isset($from_id))$cart_id = $from_id;
					if(JRequest::getInt('new_'.$cart_type.'_id',0)!= 0 && JRequest::getInt('delete',0) == 0)$cart_id = JRequest::getInt('new_'.$cart_type.'_id',0);
					$cart = $class->get($cart_id,false,$cart_type);
					if(!empty($cart) && (int)$cart_id != 0){
						$url = 'cart&task=showcart&cart_type=wishlist&cart_id='.$cart_id.'&Itemid='.$Itemid;
					}else{
						$url = 'cart&task=showcarts&cart_type=wishlist&Itemid='.$Itemid;
					}
					$url = hikashop_completeLink($url,false,true);
				}

				if($stay == 0){
					if(strpos($url,HIKASHOP_LIVE)===false && preg_match('#^https?://.*#',$url)) return false;
					$this->setRedirect($url);
				}else{
					echo '<html><head><script type="text/javascript">history.back();</script></head><body></body></html>';
					exit;
				}
			}else{
				$url = JRequest::getVar('return_url','');
				if(empty($url)){
					$url = JRequest::getVar('url','');
					$url = urldecode($url);
				}else{
					$url = base64_decode(urldecode($url));
				}
				$url = str_replace('&popup=1','',$url);

				if(empty($url)){
					global $Itemid;
					$url = 'checkout';
					if(!empty($Itemid)){
						$url.='&Itemid='.$Itemid;
					}
					$url = hikashop_completeLink($url,false,true);
				}
				if($tmpl=='component'){
					//display cart module content
					$js ='';
					jimport('joomla.application.module.helper');
					global $Itemid;
					if(isset($Itemid) && empty($Itemid)){
						$Itemid=null;
						JRequest::setVar('Itemid',null);
					}
					$module = JModuleHelper::getModule('hikashop_cart',false);
					$config =& hikashop_config();
					$params = new HikaParameter( @$module->params );
					if(!empty($module)){
						$module_options = $config->get('params_'.$module->id);
					}
					if(empty($module_options)){
						$module_options = $config->get('default_params');
					}
					foreach($module_options as $key => $optionElement){
						$params->set($key,$optionElement);
					}
					if(!empty($module)){
						foreach(get_object_vars($module) as $k => $v){
							if(!is_object($v)){
								$params->set($k,$v);
							}
						}
						$params->set('from','module');
					}
					$params->set('return_url',$url);
					hikashop_getLayout('product','cart',$params,$js);
					return true;
				}else{
					$config =& hikashop_config();
					if(JRequest::getInt('popup',0) || (@JRequest::getInt('quantity',0) && $config->get('redirect_url_after_add_cart','stay_if_cart') == 'ask_user')){
						if(strpos($url,'?')){
							$url.='&';
						}else{
							$url.='?';
						}
						$url.='popup=1';
					}
					if(strpos($url,HIKASHOP_LIVE)===false && preg_match('#^https?://.*#',$url)) return false;
					$this->setRedirect($url);
					return false;
				}
			}
		}
	}

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

  • Posts: 43
  • Thank you received: 1
11 years 6 months ago #101941

Thanks, I tried but it doesn't make any difference.

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

  • Posts: 43
  • Thank you received: 1
11 years 6 months ago #101959

I've changed the configuration settings to not use popups (because as well as above problems they were also coming up blank in Internet Explorer 8), so I've changed it to stay on same page instead and that works OK for me.

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

  • Posts: 82760
  • Thank you received: 13346
  • MODERATOR
11 years 6 months ago #102181

Yes, you can circumvent the problem like that.

We've actually just published a new version of HikaShop which should definitely fix these popup issues so you could potentially update HikaShop and see if that helps if you still want to try to use popups.

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

Time to create page: 0.083 seconds
Powered by Kunena Forum