hikashop_currentURL()

  • Posts: 75
  • Thank you received: 1
9 years 9 months ago #164979

- HikaShop version -- : 2.3.2
- Joomla version -- : 2.5.22
- PHP version -- : 5.3
- Browser(s) name and version -- : All browsers

A few months back we have had issues with hikashop_currentURL() in the past and changing it to JURI::current() in ‘product/listing’ fixed that particular problem. www.hikashop.com/forum/install-update/86...rent-url-solved.html

But now we are working on new revision of this site and are experiencing the same problem again. We have replaced this code in a number of places and it has worked for example in ‘product / filter’ but we cannot seem to find where the “Add-to-Cart” code is at the product level. Some of the category level ‘Add-to-cart’ buttons work, for example the cart button on the homepage works but most others do not.

So I think its time we took a step back and tried to identify why this is happening, rather than constantly trying to modify your code.

We do make great use of SEF Url’s and this seems to be connected to the problem. We have the ability to configure the .htaccess files pretty well and make it secure but cannot see what might be causing this issue.

So my question is what in our configuration is causing hikashop_currentURL() to return the physical path of the server and as apposed to the logical path JURI::current() returns?

ie: It should return;
dev.ces-hire.com/sales/product/308-100mm-x-50m-duct-tape

But we get;
dev.ces-hire.com/live/ces/ces-b/sales/pr...00mm-x-50m-duct-tape

I hope you can assist with this as its driving me mad.
Tim

PS I have created a login for you should you need it.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 9 months ago #165000

Hi,

Do you have set a value in your Joomla configuration.php file for the entry "live_site" ?
It's maybe this entry which is not correct regarding your website, and that's maybe why the returned url is not correct.

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

  • Posts: 75
  • Thank you received: 1
9 years 9 months ago #165125

Hi,

The live_site is set to the site URL in configuration.php and this made no difference to the issues we experiencing. But we have left it in anyway.

To update you: we have got things working better now with the cart by setting Use AJAX when possible
for add to cart buttons
to "yes" in Hikashop: Configuration: Main: Advanced.
And replacing hikashop_currentURL(); with JURI::current(); in several of the of the views.

It would still be useful to know why hikashop_currentURL(); works differently to JURI::current(); so we can fix this issue at a higher level and not have to update so many modules when we upgrade Hikashop.

Thanks
Tj

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

  • Posts: 13201
  • Thank you received: 2322
9 years 9 months ago #165134

Hi,

Could you edit the file "administrator/components/com_hikashop/helpers/helper.php" and in the function "hikashop_currentURL()" add a var_dump() of the $_SERVER like:

var_dump( $_SERVER);
And give us the returned result ?

I don't heard anything about that for the other customers.. it's strange thing.

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

  • Posts: 75
  • Thank you received: 1
9 years 9 months ago #165245

array(59) { ["TMPDIR"]=> string(28) "/home/content/50/6963550/tmp" ["PHPRC"]=> string(30) "/home/content/50/6963550/html/" ["TEMP"]=> string(28) "/home/content/50/6963550/tmp" ["PHP_FCGI_CHILDREN"]=> string(1) "0" ["PATH"]=> string(29) "/sbin:/usr/sbin:/bin:/usr/bin" ["PWD"]=> string(12) "/web/cgi-bin" ["SHLVL"]=> string(1) "0" ["SPI"]=> string(4) "TRUE" ["TMP"]=> string(28) "/home/content/50/6963550/tmp" ["PHP_FCGI_MAX_REQUESTS"]=> string(6) "100000" ["FCGI_ROLE"]=> string(9) "RESPONDER" ["UNIQUE_ID"]=> string(24) "U9C9eLiomEwAAEad5zgAAACT" ["SCRIPT_URL"]=> string(1) "/" ["SCRIPT_URI"]=> string(25) "https://dev.ces-hire.com/" ["DOMAIN_NAME"]=> string(16) "dev.ces-hire.com" ["REAL_DOCUMENT_ROOT"]=> string(55) "/var/chroot/home/content/50/6963550/html/live/ces/ces-b" ["XID"]=> string(7) "6963550" ["REDIRECT302"]=> string(0) "" ["GD_ERROR_DOC"]=> string(1) "/" ["SUBDOMAIN_DOCUMENT_ROOT"]=> string(55) "/var/chroot/home/content/50/6963550/html/live/ces/ces-b" ["REAL_USERNAME"]=> string(7) "spotstv" ["userlimit_name"]=> string(7) "6963550" ["userlimit_limit"]=> string(0) "" ["GD_PHP_HANDLER"]=> string(14) "x-httpd-php5-3" ["PARENT_DOCUMENT_ROOT"]=> string(40) "/var/chroot/home/content/50/6963550/html" ["HTTP_AUTHORIZATION"]=> string(0) "" ["HTTPS"]=> string(2) "on" ["SSL_TLS_SNI"]=> string(16) "dev.ces-hire.com" ["HTTP_HOST"]=> string(16) "dev.ces-hire.com" ["HTTP_USER_AGENT"]=> string(81) "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Firefox/30.0" ["HTTP_ACCEPT"]=> string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" ["HTTP_ACCEPT_LANGUAGE"]=> string(14) "en-US,en;q=0.5" ["HTTP_ACCEPT_ENCODING"]=> string(13) "gzip, deflate" ["HTTP_REFERER"]=> string(45) "https://dev.ces-hire.com/contact-us?view=form" ["HTTP_COOKIE"]=> string(1001) "__utma=155837097.1279702328.1386772793.1405938394.1405946913.117; __utmz=155837097.1405577926.110.12.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); __utma=140057894.836752348.1396538622.1396545555.1403869583.3; __utmz=140057894.1396538622.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __atuvc=3%7C14; b808914abd5364100732e8658e7627ac=8486d6fd4cfd990ceae32130829ccac9; jpanesliders_panel-sliders=0; jpanesliders_menu-sliders-341=0; jpanesliders_category_panel_396=2; configuration=server; jpanesliders_permissions-sliders=0; jpanesliders_module-sliders=0; jpanesliders_menu-sliders-=4; jpanesliders_menu-sliders-608=0; jpanesliders_menu-sliders-609=4; jpanesliders_permissions-sliderscom_menus=0; jpanesliders_menu-sliders-338=6; jpanesliders_menu-sliders-594=0; jpanesliders_xmap-sliders-1=0; jpanesliders_permissions-sliderscom_hikashop=0; jpanesliders_database-sliders=0; 55963f186047f6e13236202234522691=72fc6b9c866dd2fdcb9e5d92bfc33f5a; jpanesliders_menu-sliders-593=0" ["HTTP_CONNECTION"]=> string(5) "close" ["LD_LIBRARY_PATH"]=> string(16) "/web/httpd24/lib" ["SERVER_SIGNATURE"]=> string(62) "
Apache Server at dev.ces-hire.com Port 443
" ["SERVER_SOFTWARE"]=> string(6) "Apache" ["SERVER_NAME"]=> string(16) "dev.ces-hire.com" ["SERVER_ADDR"]=> string(14) "184.168.42.174" ["SERVER_PORT"]=> string(3) "443" ["REMOTE_ADDR"]=> string(13) "2.103.211.202" ["DOCUMENT_ROOT"]=> string(40) "/var/chroot/home/content/50/6963550/html" ["REQUEST_SCHEME"]=> string(5) "https" ["CONTEXT_DOCUMENT_ROOT"]=> string(40) "/var/chroot/home/content/50/6963550/html" ["SERVER_ADMIN"]=> string(24) "support@secureserver.net" ["SCRIPT_FILENAME"]=> string(65) "/var/chroot/home/content/50/6963550/html/live/ces/ces-b/index.php" ["REMOTE_PORT"]=> string(5) "63582" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_METHOD"]=> string(3) "GET" ["QUERY_STRING"]=> string(0) "" ["REQUEST_URI"]=> string(1) "/" ["SCRIPT_NAME"]=> string(10) "/index.php" ["PHP_SELF"]=> string(10) "/index.php" ["REQUEST_TIME"]=> int(1406188920) ["argv"]=> array(0) { } ["argc"]=> int(0) } array(59) { ["TMPDIR"]=> string(28) "/home/content/50/6963550/tmp" ["PHPRC"]=> string(30) "/home/content/50/6963550/html/" ["TEMP"]=> string(28) "/home/content/50/6963550/tmp" ["PHP_FCGI_CHILDREN"]=> string(1) "0" ["PATH"]=> string(29) "/sbin:/usr/sbin:/bin:/usr/bin" ["PWD"]=> string(12) "/web/cgi-bin" ["SHLVL"]=> string(1) "0" ["SPI"]=> string(4) "TRUE" ["TMP"]=> string(28) "/home/content/50/6963550/tmp" ["PHP_FCGI_MAX_REQUESTS"]=> string(6) "100000" ["FCGI_ROLE"]=> string(9) "RESPONDER" ["UNIQUE_ID"]=> string(24) "U9C9eLiomEwAAEad5zgAAACT" ["SCRIPT_URL"]=> string(1) "/" ["SCRIPT_URI"]=> string(25) "https://dev.ces-hire.com/" ["DOMAIN_NAME"]=> string(16) "dev.ces-hire.com" ["REAL_DOCUMENT_ROOT"]=> string(55) "/var/chroot/home/content/50/6963550/html/live/ces/ces-b" ["XID"]=> string(7) "6963550" ["REDIRECT302"]=> string(0) "" ["GD_ERROR_DOC"]=> string(1) "/" ["SUBDOMAIN_DOCUMENT_ROOT"]=> string(55) "/var/chroot/home/content/50/6963550/html/live/ces/ces-b" ["REAL_USERNAME"]=> string(7) "spotstv" ["userlimit_name"]=> string(7) "6963550" ["userlimit_limit"]=> string(0) "" ["GD_PHP_HANDLER"]=> string(14) "x-httpd-php5-3" ["PARENT_DOCUMENT_ROOT"]=> string(40) "/var/chroot/home/content/50/6963550/html" ["HTTP_AUTHORIZATION"]=> string(0) "" ["HTTPS"]=> string(2) "on" ["SSL_TLS_SNI"]=> string(16) "dev.ces-hire.com" ["HTTP_HOST"]=> string(16) "dev.ces-hire.com" ["HTTP_USER_AGENT"]=> string(81) "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Firefox/30.0" ["HTTP_ACCEPT"]=> string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" ["HTTP_ACCEPT_LANGUAGE"]=> string(14) "en-US,en;q=0.5" ["HTTP_ACCEPT_ENCODING"]=> string(13) "gzip, deflate" ["HTTP_REFERER"]=> string(45) "https://dev.ces-hire.com/contact-us?view=form" ["HTTP_COOKIE"]=> string(1001) "__utma=155837097.1279702328.1386772793.1405938394.1405946913.117; __utmz=155837097.1405577926.110.12.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); __utma=140057894.836752348.1396538622.1396545555.1403869583.3; __utmz=140057894.1396538622.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __atuvc=3%7C14; b808914abd5364100732e8658e7627ac=8486d6fd4cfd990ceae32130829ccac9; jpanesliders_panel-sliders=0; jpanesliders_menu-sliders-341=0; jpanesliders_category_panel_396=2; configuration=server; jpanesliders_permissions-sliders=0; jpanesliders_module-sliders=0; jpanesliders_menu-sliders-=4; jpanesliders_menu-sliders-608=0; jpanesliders_menu-sliders-609=4; jpanesliders_permissions-sliderscom_menus=0; jpanesliders_menu-sliders-338=6; jpanesliders_menu-sliders-594=0; jpanesliders_xmap-sliders-1=0; jpanesliders_permissions-sliderscom_hikashop=0; jpanesliders_database-sliders=0; 55963f186047f6e13236202234522691=72fc6b9c866dd2fdcb9e5d92bfc33f5a; jpanesliders_menu-sliders-593=0" ["HTTP_CONNECTION"]=> string(5) "close" ["LD_LIBRARY_PATH"]=> string(16) "/web/httpd24/lib" ["SERVER_SIGNATURE"]=> string(62) "
Apache Server at dev.ces-hire.com Port 443
" ["SERVER_SOFTWARE"]=> string(6) "Apache" ["SERVER_NAME"]=> string(16) "dev.ces-hire.com" ["SERVER_ADDR"]=> string(14) "184.168.42.174" ["SERVER_PORT"]=> string(3) "443" ["REMOTE_ADDR"]=> string(13) "2.103.211.202" ["DOCUMENT_ROOT"]=> string(40) "/var/chroot/home/content/50/6963550/html" ["REQUEST_SCHEME"]=> string(5) "https" ["CONTEXT_DOCUMENT_ROOT"]=> string(40) "/var/chroot/home/content/50/6963550/html" ["SERVER_ADMIN"]=> string(24) "support@secureserver.net" ["SCRIPT_FILENAME"]=> string(65) "/var/chroot/home/content/50/6963550/html/live/ces/ces-b/index.php" ["REMOTE_PORT"]=> string(5) "63582" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_METHOD"]=> string(3) "GET" ["QUERY_STRING"]=> string(0) "" ["REQUEST_URI"]=> string(1) "/" ["SCRIPT_NAME"]=> string(10) "/index.php" ["PHP_SELF"]=> string(10) "/index.php" ["REQUEST_TIME"]=> int(1406188920) ["argv"]=> array(0) { } ["argc"]=> int(0) }

Last edit: 9 years 9 months ago by Xavier. Reason: Use of [code] tag

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

  • Posts: 13201
  • Thank you received: 2322
9 years 8 months ago #165663

Hi,

I don't understand why it is adding such things in your path.
Regarding the server data, the url should be "dev.ces-hire.com/"+the rest of the url without the "/live/ces...".
And the function hikashop_currentURL() should return the correct url.

In the HikaShop options, in the field for url to redirect after add to cart, to you have filled a value ?
One thing which could be potentially tried is to replace the content of our function in order to fit your needs.

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

  • Posts: 75
  • Thank you received: 1
9 years 8 months ago #165687

Hi Again,

I agree its very frustrating. Even hard coding hikashop_currentURL() function seems to have no effect which leads me to think the Vote link is getting the URL from another source. Unfortunately once you click on the vote star the page refreshes to a 404 error making it hard to see where the problem occurred.

So my thinking is now that the URL is generated not using hikashop_currentURL() in the vote page. Can you help clarify where vote gets the URL to refresh the page?

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

  • Posts: 13201
  • Thank you received: 2322
9 years 8 months ago #165694

Hi,

We checked again your server data, an regarding the function it should return the correct path.
What can cause this kind of error is, the live_site parameter in the Joomla config, but it seems to be correct, or it can be the canonical url, but it is correct too, in the votes, we use the function currentUrl too, so it should be working fine.

Another thing could be that you are using a SEF extension which potentially is adding alias to the url.
So if you have such extensions, thanks to disable it an try again.

Else thanks to provide us a backend and ftp access, you can send it via pm with the url of that topic.

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

  • Posts: 75
  • Thank you received: 1
9 years 8 months ago #165873

Thanks for the update. We have found a workaround at least for our purposes.

In helper.php (line 390) we replaced:
$result = (hikashop_isSSL() ? 'https://' : 'http://').$_SERVER["HTTP_HOST"].$requestUri;
with:
$result = (hikashop_isSSL() ? 'https://' : 'http://').$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];

As we found the $_SERVER["REQUEST_URI"] seems to be returning the correct url. But to be honest we have no ideas why.

Regards
Tim

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

Time to create page: 0.081 seconds
Powered by Kunena Forum