Stay and display a popup notice 404 error

  • Posts: 31
  • Thank you received: 0
11 years 7 months ago #100291

Hi,
I tried a couple of options with regards to the "After a product is added to the cart" and finaly decided to use the "Stay and display a popup notice". But when I tried it recently there is a 404 error showing and it does not seem to work anymore. Any reason for this and how can I fix it?
In addition, the "notice popup display time" does not work either.

Regards,

Brian

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

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

Hi Brian,

Are you using any SEF module ? If yes, can you turn it off and try again ?

Thanks :).

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

  • Posts: 31
  • Thank you received: 0
11 years 7 months ago #100310

Hi Mohamed,
No I dont use any SEF I have JCH optimise and I turned that off but that did not solve the problem. The only changes I have made are Hikashop configurations. Do you have any other suggestions?

Regards,

Brian

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

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

Could you give me a link to your website ? it will probably help me to understand from where your problem is coming from ?

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

  • Posts: 31
  • Thank you received: 0
11 years 7 months ago #100323

Hi Mohamed,
Please see below, it also does the same thing with the "add to wishlist" too.

www.regenervite.com/shop-online

Regards,

Brian

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

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

Hi Brian,

I tested the add to cart popup through your website, and it seems like you are using a SEF module, so can you check it through your back end please ? :).

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

  • Posts: 31
  • Thank you received: 0
11 years 7 months ago #100335

Hi Mohamed,
Sorry did not realise you meant the SEF in global configs, thanks.

Brian

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

  • Posts: 31
  • Thank you received: 0
11 years 7 months ago #100336

Hi Mohamed,
Does that mean I cannot use SEF URL's at all?

Regards,

Brian

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

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

No, I just wanted to know if it was caused by your SEF module, so can you test it without any SEF ?

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

  • Posts: 31
  • Thank you received: 0
11 years 7 months ago #100433

Hi Mohamed,
Tested popup window function with SEF module off and it works, both add to cart and add to wishlist. So what is the solution to using the popup function in Hikashop and the SEF module in Joomla. Curiously, there was not conflict when I first selected the popup option and SEF already was on.

Regards,

Brian

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

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

Ok, so the problem must be coming from your cart module, Can you give me a temporary access to your back-end through Private Message ?

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

  • Posts: 31
  • Thank you received: 0
11 years 7 months ago #100586

Hi Mohamed,
Your login has been sent to you using private messaging.

Regards

Brian

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

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

Hi,

I don't have the Rights :
- to Enable/disable the SEF through your Joomla configuration
- to access to your Hikashop configuration

And I need it to understand how your website react with the SEF module putted ON and OFF.

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

  • Posts: 31
  • Thank you received: 0
11 years 7 months ago #101085

You now have super admin status
Brian

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
11 years 6 months ago #101494

I have just sent you an email regarding this issue.

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

  • Posts: 31
  • Thank you received: 0
11 years 6 months ago #101611

Hi Nicolas,
Unfortuneately, the upload did not work. The following events occurred:
Uploaded package
enabled SEF URL
tested ajax option worked a couple of time and then stopped.
When the failure occurs the item is still loaded into the cart but when I select add to wishlist I get the error message and no products gets added to the wishlist. In addition, when the popup window did work there was a problem whereby if I selected add to cart button the add to wishlistoptions appeared in the popup.

Regards,

Brian

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

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

Hi,

Had you edited the view "checkout / notice" before the update ?
If it is, can you save the content of this view in an external file, delete the customizations (clicking on the dustbin in the views listing), see if it's working fine, and put back your customizations on the new view.

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

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

Hi,

Thanks to disable the option "Use AJAX when possible for add to cart button" and replace the "updatecart()" function 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(hikashop_loadUser() != null || $cart_type != 'wishlist'){
				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');
					$stay = 0;
					$url = JRequest::getVar('return_url','');
					if(!empty($url)){
						$url=base64_decode(urldecode($url));
					}
					$url = str_replace('&popup=1','',$url);
				}else{
					$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: 31
  • Thank you received: 0
11 years 6 months ago #101950

Hi,
Added the code, turned on the ajax option again, worked for a while now works sometimes and not other. Shows "added to wishlist" when add to cart button is pressed. When no Ajax window appears products are still added to the cart and I remain on the page.

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

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

Hi,

So without Ajax, it's working fine ? The popup is displayed, products are added and you stay on the same page, right ?

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

Time to create page: 0.114 seconds
Powered by Kunena Forum