Could PHP in CGI mode causes problem with cart?

  • Posts: 597
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
11 years 1 month ago #161221

-- url of the page with the problem -- : acceptatie.anniesloaneurope.com/index.ph...product/48-old-white
-- HikaShop version -- : 2.3.1
-- Joomla version -- : 3.3
-- PHP version -- : 5.4.4-byte1.16
-- Browser(s) name and version -- : FireFox 29.0.1
-- Error-message(debug-mod must be tuned on) -- : No Error

Adding the second time the same article bring me to homepage. First time adding to cart works perfect. It give a nice pop-up. But when I chose to continue shopping and triad to add more of the same product the pop-up doesn't show up and I'll directly removed from the web shop and taken to the homepage.

When I turned off the setting "Use URL rewriting" in the Global Configuration the problem is over.

We like to use the URL rewriting and we also have the .htaccess in use with the standaard Joomla settings.

We don't have an external sef manager.

Question: What is the difference between the first and the second time putting the same product to the shopping cart? Because the first time it goes perfect without any problems.

After some testing we think it is a server specific problem. Because I did a test with a clean Joomla install without any other extension.

The server where the problem exists, belongs to a very reputable hosting company. The greatest Joomla hoster of the Netherlands. Very expensive but also very fast and gives very high quality. The companyname is: www.byte.com
But for some reason they interact differently with url_rewriting which is used in Hikashop as URL rewriting for Joomla is turned on.
See: new.anniesloaneurope.com/hikashop-menu-f...sting/product/1-verf

When I made a copy of this website and put it to another server by another hoster everything works fine.
See: test2.kinabukasan.nl/hikashop-menu-for-c...sting/product/1-verf

The hoster Byte runs PHP in CGI mode. Maybe it is useful to know

I also made a new fresh installation on both servers. And the problem exists only on the server from the Hoster Byte where php runs in CGI mode.

I hope this will help you by finding a solution for this problem.

Attached our configuration of Joomla and Hikashop

We hope that you can help us.

With Kind Regards,
Lumiga


Kind regards,
Lumiga

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

  • Posts: 84218
  • Thank you received: 13670
  • MODERATOR
11 years 1 month ago #161234

Hi,

The issue is that HikaShop is not able to get the correct current URL when there is in the ?popup=1 parameter in the URL of the page on your byte server.
HikaShop does that in the function hikashop_currentURL in the file administrator/components/com_hikashop/helpers/helper.php by looking into the $_SERVER super global variable.
So the fact that it works on our server and not on the other means that they provide different data in the $_SERVER variable and that on your byte server, HikaShop is not able to find the correct variables when there is a parameter in the URL.
Is that linked to the fact that it is a PHP in CGI mode ? I don't know.

To solve the issue without looking deeper into it, turning on the AJAX add to cart option in the advanced area of the configuration will solve the problem (as there won't be the ?popup=1 parameter in the URLs anymore).

But it would be great if you could provide a dump of the $_SERVER variable from inside that hikashop_currentURL function on the page with the ?popup=1 page. That way, we would be able to analyze what is the problem with the data inside that variable.

We've had a lot of trouble with different servers to be able to tap into the $_SERVER variable as each server is providing different things in different variables. But that's the best way to get the current URL of the page unfortunately...

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

  • Posts: 597
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
11 years 1 month ago #161650

Hi Nicolas,

Thankyou for your anwser. Turning AJAX on did solve the problem.

But you asked us:

it would be great if you could provide a dump of the $_SERVER variable from inside that hikashop_currentURL function on the page with the ?popup=1 page. That way, we would be able to analyze what is the problem with the data inside that variable.

How can I provide this to you? Sorry, but your question is a little too technical for me. :blush:

Kind regards,
Lumiga


Kind regards,
Lumiga

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

  • Posts: 84218
  • Thank you received: 13670
  • MODERATOR
11 years 1 month ago #161669

Hi,

Edit the file administrator/components/com_hikashop/helpers/helper.php and after the line:
function hikashop_currentURL(...){

add the line:
var_dump($_SERVER);

Then, go on the page with the ?popup=1 parameter in the URL and you'll get big blocks of ugly text which is actually the content of the $_SERVER variable. Just copy/paste it to us.

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

  • Posts: 597
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
11 years 1 month ago #163773

Hi Nicolas,

Here the dump of the $_SERVER variable from inside that hikashop_currentURL function on the page with the ?popup=1 page.

Regards,
Lumiga



File Attachment:

File Name: ha0e1e00.txt
File Size:9 KB


Kind regards,
Lumiga
Attachments:

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

  • Posts: 84218
  • Thank you received: 13670
  • MODERATOR
11 years 1 month ago #163782

Change the whole hikashop_currentURL function code to the code below in administrator/components/com_hikashop/helpers/helper.php and that should fix the problem:

function hikashop_currentURL($checkInRequest='',$safe=true){
	if(!empty($checkInRequest)){
		$url = JRequest::getVar($checkInRequest,'');
		if(!empty($url)){
			if(strpos($url,'http')!==0&&strpos($url,'/')!==0){
				if($checkInRequest=='return_url'){
					$url = base64_decode(urldecode($url));
				}elseif($checkInRequest=='url'){
					$url = urldecode($url);
				}
			}
			if($safe){
				$url = str_replace(array('"',"'",'<','>',';'),array('%22','%27','%3C','%3E','%3B'),$url);
			}
			return $url;
		}
	}
	if(!empty($_SERVER["REDIRECT_URL"]) && preg_match('#.*index\.php$#',$_SERVER["REDIRECT_URL"]) && empty($_SERVER['QUERY_STRING'])&&(empty($_SERVER['REDIRECT_QUERY_STRING']) || strpos($_SERVER['REDIRECT_QUERY_STRING'],'&')===false) && !empty($_SERVER["REQUEST_URI"])){
		$requestUri = $_SERVER["REQUEST_URI"];
		if (!empty($_SERVER['REDIRECT_QUERY_STRING'])) $requestUri = rtrim($requestUri,'/').'?'.$_SERVER['REDIRECT_QUERY_STRING'];
	}elseif(!empty($_SERVER["REDIRECT_URL"]) && (isset($_SERVER['QUERY_STRING'])||isset($_SERVER['REDIRECT_QUERY_STRING']))){
		$requestUri = $_SERVER["REDIRECT_URL"];
		if (!empty($_SERVER['REDIRECT_QUERY_STRING'])) $requestUri = rtrim($requestUri,'/').'?'.$_SERVER['REDIRECT_QUERY_STRING'];
		elseif (!empty($_SERVER['QUERY_STRING'])) $requestUri = rtrim($requestUri,'/').'?'.$_SERVER['QUERY_STRING'];
	}elseif(isset($_SERVER["REQUEST_URI"])){
		$requestUri = $_SERVER["REQUEST_URI"];
	}else{
		$requestUri = $_SERVER['PHP_SELF'];
		if (!empty($_SERVER['QUERY_STRING'])) $requestUri = rtrim($requestUri,'/').'?'.$_SERVER['QUERY_STRING'];
	}
	$result = (hikashop_isSSL() ? 'https://' : 'http://').$_SERVER["HTTP_HOST"].$requestUri;
	if($safe){
		$result = str_replace(array('"',"'",'<','>',';'),array('%22','%27','%3C','%3E','%3B'),$result);
	}
	return $result;
}

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

Time to create page: 0.193 seconds
Powered by Kunena Forum