Jump to content
bumbarash

[Contribution] iOSC - mobile version of OSC on your iPhone

Recommended Posts

Oops... actually it isn't defined at all. MOBILE_SESSION is undefined too

 

Hello Nick @@papalevies,

 

 

For mobile_redirect ($this->mobileFile) > 0):

 

This is left over from the older versions before Mobile Osc6 when the mobile files were placed in the root directory and had different filenames (mobile_index.php etc.)

This part can just be removed it is not necessary any more, in mobile_redirect_subdomain.php it is already removed.

However it doesn't affect the functionality of the redirect function.

Just remove it:

    if(strpos('/' . $_SERVER['SCRIPT_NAME'],$this->mobileDir) > 0)

I'll correct this in the next update.

 

 

For ht_alternate.php:

 

Yes, $PHP_SELF should be added to the global list:

  global $oscTemplate, $mobile_url, $PHP_SELF;

I'll upload a fixed version.

 

For MOBILE_SESSION:

 

MOBILE_SESSION is defined in catalog/mobile/includes/application_top.php.

So it is only defined when the mobile site is loaded. This is used with the "if (defined('MOBILE_SESSION'))" or "(defined('MOBILE_SESSION')?" statements in common files like , language files, funtion files, class files, modules etc. to produce different output formatting if a mobile page is viewed.

You can see it for example in catalog/includes/classes/order_total.php. See also "Add-On Support.doc" Point 10.

 

 

Thank you for the reports and kind regards

Rainer

Share this post


Link to post
Share on other sites

For ht_alternate:

 

Sorry I didn't catch the idea. Yes MOBILE_SESSION should be removed:

if (MOBILE_SITE == 'True' && MOBILE_SESSION != 'True') {

 

regards

Rainer

Share this post


Link to post
Share on other sites

Hi Rainer @@raiwa

 

I am encountering a problem with the search results… When I click on a result and then on the products page use the "back" button or use the browser's back button I only get a blank page and it loads indefinitely (at least on the iPhone)…

 

Then when I refresh the blank page I get the message:

 

Error!

Unable to determine the page link!

 

 

Do you know of this issue? Is it related to the ajax page load?

 

regards

Raphael

Share this post


Link to post
Share on other sites

Hi Rainer @@raiwa

 

I am encountering a problem with the search results… When I click on a result and then on the products page use the "back" button or use the browser's back button I only get a blank page and it loads indefinitely (at least on the iPhone)…

 

Then when I refresh the blank page I get the message:

 

Error!

Unable to determine the page link!

 

 

Do you know of this issue? Is it related to the ajax page load?

 

regards

Raphael

 

Hello Raphael@@rafhun,

 

I have no i phone and can't recreate the error. In the normal browsers it works correct. Try to switch off ajax page load. If this works then exclude ajax page load for the search page in the mobile header.

You can also try to add data-ajax="false" to the back button.

However I'm preparing a change to the back button in product_info for the next update which should resolve this.

 

regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

I also noticed you use $HTTP_GET_VARS which is depricated. Please replace them with $_GET and sanitize them (and pretty much all variables starting with "$HTTP_"). Then again, all of osCommerce needs to do that.

Edited by papalevies

Share this post


Link to post
Share on other sites

I also noticed you use $HTTP_GET_VARS which is depricated. Please replace them with $_GET and sanitize them (and pretty much all variables starting with "$HTTP_"). Then again, all of osCommerce needs to do that.

 

Hello Nick @@papalevies,

 

The canonical fix is uploaded.

For the deprecated $HTTP_:

This is done in: catalog/includes/functions/compatibility.php:

 if (PHP_VERSION >= 4.1) {
   $HTTP_GET_VARS =& $_GET;
   $HTTP_POST_VARS =& $_POST;
   $HTTP_COOKIE_VARS =& $_COOKIE;
   $HTTP_SESSION_VARS =& $_SESSION;
   $HTTP_POST_FILES =& $_FILES;
   $HTTP_SERVER_VARS =& $_SERVER;
 } else {
   if (!is_array($HTTP_GET_VARS)) $HTTP_GET_VARS = array();
   if (!is_array($HTTP_POST_VARS)) $HTTP_POST_VARS = array();
   if (!is_array($HTTP_COOKIE_VARS)) $HTTP_COOKIE_VARS = array();
 }

 

So there is no need to change this in the files.

 

 

Thank you for the reports

Rainer

Share this post


Link to post
Share on other sites

Then again, all of osCommerce needs to do that.

 

Compatibility Layer takes care of this. In the next "big" release (ie, not a point release) the core will probably change to $_* rather than $HTTP_*_VARS, but it's not important to do asap.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

@@raiwa

 

I'm running version 2.3.3 and when I switch to mobile, I get the following error:

Warning: require(DIR_FS_MOBILEincludes/classes/mobile_redirect.php) [function.require]: failed to open stream: No such file or directory in /home/elgxvqtc/public_html/includes/application_top.php on line 577
Warning: require(DIR_FS_MOBILEincludes/classes/mobile_redirect.php) [function.require]: failed to open stream: No such file or directory in /home/elgxvqtc/public_html/includes/application_top.php on line 577
Fatal error: require() [function.require]: Failed opening required 'DIR_FS_MOBILEincludes/classes/mobile_redirect.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/elgxvqtc/public_html/includes/application_top.php on line 577

 

I have 'Enable Mobile Site?' set to true in admin. When set to false everything works fine.

 

Thanks

Share this post


Link to post
Share on other sites

@@raiwa

 

I'm running version 2.3.3 and when I switch to mobile, I get the following error:

Warning: require(DIR_FS_MOBILEincludes/classes/mobile_redirect.php) [function.require]: failed to open stream: No such file or directory in /home/elgxvqtc/public_html/includes/application_top.php on line 577
Warning: require(DIR_FS_MOBILEincludes/classes/mobile_redirect.php) [function.require]: failed to open stream: No such file or directory in /home/elgxvqtc/public_html/includes/application_top.php on line 577
Fatal error: require() [function.require]: Failed opening required 'DIR_FS_MOBILEincludes/classes/mobile_redirect.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/elgxvqtc/public_html/includes/application_top.php on line 577

 

I have 'Enable Mobile Site?' set to true in admin. When set to false everything works fine.

 

Thanks

 

Hello Lecart @@discxpress,

 

Please check if DIR_FS_MOBILE is correct defined in includes/configure.php

 

regards

Rainer

Share this post


Link to post
Share on other sites

Hello @@raiwa

 

Here's my includes/configure.php:

<?php
 define('HTTP_SERVER', 'http://mysite.com');
 define('HTTPS_SERVER', 'https://mysite.com');
 define('ENABLE_SSL', true); // secure webserver for checkout procedure?
 define('HTTP_COOKIE_DOMAIN', '.mysite.com');
 define('HTTPS_COOKIE_DOMAIN', '.mysite.com');
 define('HTTP_COOKIE_PATH', '/');
 define('HTTPS_COOKIE_PATH', '/');
 define('DIR_WS_HTTP_CATALOG', '/');
 define('DIR_WS_HTTPS_CATALOG', '/');
// define('DIR_WS_IMAGES', 'images/');
// define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
// define('DIR_WS_INCLUDES', 'includes/');
//BOF Mobile
 define('HTTP_MOBILE_SERVER', HTTP_SERVER);
 define('HTTPS_MOBILE_SERVER', HTTPS_SERVER);
 define('DIR_WS_HTTP_MOBILE', DIR_WS_HTTP_CATALOG . 'mobile/');
 define('DIR_WS_HTTPS_MOBILE', DIR_WS_HTTPS_CATALOG . 'mobile/');
 (defined('MOBILE_SESSION') ? define('DIR_WS_IMAGES', HTTP_SERVER . DIR_WS_HTTP_CATALOG . 'images/') : define('DIR_WS_IMAGES', 'images/'));
 define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
 (defined('MOBILE_SESSION') ? define('DIR_WS_INCLUDES', '../includes/') : define('DIR_WS_INCLUDES', 'includes/'));
//EOF Mobile
 define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
 define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
 define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
 define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
 define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
//BOF Mobile
 define('DIR_MOBILE_IMAGES', 'images/');
 define('DIR_MOBILE_INCLUDES','includes/');
 define('DIR_MOBILE_MODULES', DIR_MOBILE_INCLUDES . 'modules/');
 define('DIR_MOBILE_CLASSES', DIR_MOBILE_INCLUDES . 'classes/');
 define('DIR_MOBILE_HEADERS', DIR_MOBILE_INCLUDES . 'headers/');
 define('DIR_MOBILE_LANGUAGES', DIR_MOBILE_INCLUDES . 'languages/');
//EOF Mobile
//  define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
//BOF Mobile
 (defined('MOBILE_SESSION') ? define('DIR_WS_DOWNLOAD_PUBLIC', HTTP_SERVER . DIR_WS_HTTP_CATALOG . 'pub/') : define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/')); 
//EOF Mobile
 //BOF Mobile
 define('DIR_FS_MOBILE', DIR_FS_CATALOG . 'mobile/');
//EOF Mobile
 define('DIR_FS_CATALOG', '/home/elgxvqtc/public_html/');
 define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . '/download/');
 define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

Also, please note that I installed the mobile directory from the common files folder.

 

Thanks for quick reply.

Share this post


Link to post
Share on other sites

Hello @@raiwa

 

Here's my includes/configure.php:


//BOF Mobile
define('DIR_FS_MOBILE', DIR_FS_CATALOG . 'mobile/');
//EOF Mobile
define('DIR_FS_CATALOG', '/home/elgxvqtc/public_html/');

 

Also, please note that I installed the mobile directory from the common files folder.

 

Thanks for quick reply.

 

Hello Lecarl @@discxpress,

 

DIR_FS_CATALOG must be defined before DIR_FS_MOBILE,as it is used in the DIR_FS_MOBILE definition:

define('DIR_FS_CATALOG', '/home/elgxvqtc/public_html/'); //BOF Mobile
define('DIR_FS_MOBILE', DIR_FS_CATALOG . 'mobile/');

 

regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

I also noticed you use $HTTP_GET_VARS which is depricated. Please replace them with $_GET and sanitize them (and pretty much all variables starting with "$HTTP_"). Then again, all of osCommerce needs to do that.

 

Hello Nick @@papalevies,,

 

I had a closer look now to mobile_redirect.php and got the idea about $HTTP_GET_VARS. There is a mix of the deprecated $HTTP_GET_VARS and the new $GET. THis is because the upper part was coded and placed before in the core application_top.php and recently moved to the mobile redirect class for easier installation/less modification in application_top.php. So when I coded this I copied some snippets from the core application_top where $HTTP_GET_VARS still is in use.

So ok it is confusing to use both versions in one and the same file and I'll change this in the next update.

Regarding sanitize: do you mean to sanitize the $GET variables or to sanitize other variables. Could you give me an example what you mean?

 

Thanks and kind regards

Rainer

Share this post


Link to post
Share on other sites

Hello Nick @@papalevies,,

 

I had a closer look now to mobile_redirect.php and got the idea about $HTTP_GET_VARS. There is a mix of the deprecated $HTTP_GET_VARS and the new $GET. THis is because the upper part was coded and placed before in the core application_top.php and recently moved to the mobile redirect class for easier installation/less modification in application_top.php. So when I coded this I copied some snippets from the core application_top where $HTTP_GET_VARS still is in use.

So ok it is confusing to use both versions in one and the same file and I'll change this in the next update.

Regarding sanitize: do you mean to sanitize the $GET variables or to sanitize other variables. Could you give me an example what you mean?

 

Thanks and kind regards

Rainer

 

forget for the first part, messed it up. The sanitize question , yes would appreciate some clearance.

Share this post


Link to post
Share on other sites

@@raiwa

 

Thanks for the reply. I made the switch and it's working better. However, when I switch to mobile site it goes to a page where all the files are listed. When you have time, please go to http://btownmedia.com and switch to the mobile site yourself. The link is at the bottom near the GoDaddy badge.

 

Thanks again.

Share this post


Link to post
Share on other sites

@@raiwa

 

Thanks for the reply. I made the switch and it's working better. However, when I switch to mobile site it goes to a page where all the files are listed. When you have time, please go to http://btownmedia.com and switch to the mobile site yourself. The link is at the bottom near the GoDaddy badge.

 

Thanks again.

 

Hello @@discxpress,

did you add the SEO URL support included in the contribution support package?. If yes, please recheck the installation and if you can't find the error and it still doesn't work post me your configure file with the real urls at the top in a private message.

Just to be sure: it's not a subdomain where you installed the mobile files?

Another question, you say:

"Also, please note that I installed the mobile directory from the common files folder."

But then you added the other files from the "for_OsC_2.3.3_2.3.3.2" folder?

 

regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa

 

No, I didn't add the SEO URL support. Actually, I have the latest SEO Url by Chemo installed. So i need to add that part in? I did use the files in "for_OsC_2.3.3_2.3.3.2" folder" and the files in the common files folder. I just realized what I've done

 

Thanks for your continued support.

Share this post


Link to post
Share on other sites

@@raiwa

 

I've made some changes and now I'm receiving this error:

Warning: require_once(includes/application_top.php) [function.require-once]: failed to open stream: No such file or directory in /home/elgxvqtc/public_html/mobile/index.php on line 2
Fatal error: require_once() [function.require]: Failed opening required 'includes/application_top.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/elgxvqtc/public_html/mobile/index.php on line 2

 

Thanks

Share this post


Link to post
Share on other sites

@@discxpress,

 

1. As you do not say what you changed, i can only guess that it is the includes directory definition which should be as it was like you posted.

2. There is no need to do any additional changes, just follow the installation instructions.

3. I you wants more help I should know the following:

"did you add the SEO URL support included in the contribution support package?. If yes, please recheck the installation and if you can't find the error and it still doesn't work post me your configure file with the real urls at the top in a private message.

Just to be sure: it's not a subdomain where you installed the mobile files?"

 

Start_here.doc:

IMPORTANT NOTE:

For installation in subdirectory “mobile/”, finish “Install_osc_2_2.doc” or Install_osc_2_3.doc” before testing the mobile files.

For installation under subdomain finish also “Configure_ subdomain.doc” before testing the mobile files.

If you are using SEO URL, finish also “SEO URL” support installation included in the Add-On support package before testing the mobile redirects.

If you are using an image thumbnail add-on, finish also “image thumbnail” add-on support installation included in the Add-On support package before testing the mobile images.

 

 

 

regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

Hello @@raiwa

 

The changes I've made are:

 

1. I added the SEO Url support to includes/functions/html_output.php

 

2. I used the mobile directory for 2.3.3 shop and placed at the root where the image directory is located.

 

I'm PM you the configure file as requested.

 

Thanks

Share this post


Link to post
Share on other sites

Hello everyone!

 

If you have Header Handler Status v1.0 by @@Jack_mcs installed, this contribution is compatible. All you have to do is apply the installation instructions to the appropriate files in the "mobile" directory.

 

@@Jack_mcs and @@raiwa please confirm and/or add details to avoid any confusion or complications.

 

Thanks

Edited by discxpress

Share this post


Link to post
Share on other sites

Hi Rainer @@raiwa

 

in my shop I am encountering the problem that I cannot put multiple products into the cart. Whenever I add a new product to the cart it replaces the existing contents instead of "appending" it to the list… Do you know of this problem? If you have the time you could quickly check it out for yourself in this shop: http://mobile.profimusic.it/mobile

 

Just use the banners on the index page to find products and try adding them to the cart.

 

Another problem I have found in the store is with the category links in the category box. When switching back and forth between mobile and classic view on my browser (I know, not a lot of people will have the idea to do this, but still…) while having Caching turned on leads to wrong category links. Meaning I get a mixture of links to the mobile shop and the classic shop, instead of the correct links… So when I'm looking at the category tree in my classic view I see some subcategories with links that start with mobile.profimusic… Turning Caching off solves the problem for customers but of course is not yet optimal… You will probably be able to recreate the bug with the shop mentioned above… I have Caching turned on there, so if you have the time, please give it a try. It's especially problematic for relatively deep subcategories…

 

Do you know of these bugs or did my added programming cause them?

 

Regards

Raphael

Share this post


Link to post
Share on other sites

Hi Rainer @@raiwa

 

in my shop I am encountering the problem that I cannot put multiple products into the cart. Whenever I add a new product to the cart it replaces the existing contents instead of "appending" it to the list… Do you know of this problem? If you have the time you could quickly check it out for yourself in this shop: http://mobile.profimusic.it/mobile

 

Just use the banners on the index page to find products and try adding them to the cart.

 

Another problem I have found in the store is with the category links in the category box. When switching back and forth between mobile and classic view on my browser (I know, not a lot of people will have the idea to do this, but still…) while having Caching turned on leads to wrong category links. Meaning I get a mixture of links to the mobile shop and the classic shop, instead of the correct links… So when I'm looking at the category tree in my classic view I see some subcategories with links that start with mobile.profimusic… Turning Caching off solves the problem for customers but of course is not yet optimal… You will probably be able to recreate the bug with the shop mentioned above… I have Caching turned on there, so if you have the time, please give it a try. It's especially problematic for relatively deep subcategories…

 

Do you know of these bugs or did my added programming cause them?

 

Regards

Raphael

 

Hello Raphael @@rafhun,

 

For the shopping cart problem, I checked this and found that it only happens when you use the banners on the index page to go to the products.

If you add products on the "normal" way through the categories everything works.

So it should be related to how the product page is accessed via the banner links. Try to modify the banner links to use direct links instead of the redirect function and/or modify the links and add data-ajax="false" or rel="external".

 

For the wrong category links when toggling between mobile and classic site, I couldn't recreate this error and have no explication for this. The tep_cache_categories_box function is not used on the mobile site at all.

 

regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

Hi Rainer @@raiwa

 

thanks for your reply. So I figured out that the session ID was lost in the banner link or rather just not added which probably started a new session?

 

Thing is that the banners are managed through the internal banner manager and are the same as in the classic shop. I tweaked the index page a little to automatically display banners of the group which corresponds to the current category ID. This makes it very easy to show fitting banners below the categories… That's why I cannot alter the links too much.

However I found a solution by tweaking the redirect page (mobile/redirect.php, l16) some more:

 

case 'banner':
 $banner_query = tep_db_query("select banners_url from " . TABLE_BANNERS . " where banners_id = '" . (int)$HTTP_GET_VARS['goto'] . "'");
 if (tep_db_num_rows($banner_query)) {
 $banner = tep_db_fetch_array($banner_query);
 tep_update_banner_click_count($HTTP_GET_VARS['goto']);
 if (tep_not_null($SID)) {
 $_sid = $SID;
 } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
 if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
	 $_sid = tep_session_name() . '=' . tep_session_id();
 }
 }

 tep_redirect(str_replace('profimusic.it/catalog', 'mobile.profimusic.it/mobile', $banner['banners_url']).'&'.$_sid);
 }
 break;

 

I borrowed the obtaining of the $SID from the tep_href_link function. The string replace automatically converts my banner links to mobile links and now that the session ID is appended the shopping cart problem is solved :)

 

regards Raphael

Share this post


Link to post
Share on other sites

Hi Rainer @@raiwa

 

thanks for your reply. So I figured out that the session ID was lost in the banner link or rather just not added which probably started a new session?

 

Thing is that the banners are managed through the internal banner manager and are the same as in the classic shop. I tweaked the index page a little to automatically display banners of the group which corresponds to the current category ID. This makes it very easy to show fitting banners below the categories… That's why I cannot alter the links too much.

However I found a solution by tweaking the redirect page (mobile/redirect.php, l16) some more:

 

case 'banner':
 $banner_query = tep_db_query("select banners_url from " . TABLE_BANNERS . " where banners_id = '" . (int)$HTTP_GET_VARS['goto'] . "'");
 if (tep_db_num_rows($banner_query)) {
 $banner = tep_db_fetch_array($banner_query);
 tep_update_banner_click_count($HTTP_GET_VARS['goto']);
 if (tep_not_null($SID)) {
 $_sid = $SID;
 } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
 if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
	 $_sid = tep_session_name() . '=' . tep_session_id();
 }
 }

 tep_redirect(str_replace('profimusic.it/catalog', 'mobile.profimusic.it/mobile', $banner['banners_url']).'&'.$_sid);
 }
 break;

 

I borrowed the obtaining of the $SID from the tep_href_link function. The string replace automatically converts my banner links to mobile links and now that the session ID is appended the shopping cart problem is solved :)

 

regards Raphael

 

Great, I'll have a look for the next update to solve this, but as the banners are normally used for external links your solution can't be used as a generic modification.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×