Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


bumbarash

Recommended Posts

I think I found minor bug. Password reset doesn't work. I think pages are not available

 

Hello,

 

yes you are right there was a bug in the mobile password forgotten files.

They were in the old 2.3.1 version.

 

I just uploaded the fix for this.

 

Please download the latest version:

 

iOSC 5.2.rev2 Mobile Version for OSC 2.3.3.

http://addons.oscommerce.com/info/8629

 

and follow the update instructions.

 

Thank you for the report

 

Best regards

Rainer

Link to comment
Share on other sites

I am trying to sort out a redirect bug when using All-products SEO package.

 

I start on the mobile site like this

/mobile_all-products.php

 

Click on a letter, lets use H, resulting this:

/mobile_all-products.php?fl=H

 

Now switch to classic gives this:

/all-products.php-by-H.html?redirectCancelled=true

 

all is fine - redirects to classic are weird but ok...

 

 

Now if I am the classic side:

/all-products.php

 

Click on a letter, lets use H, resulting this:

/all-products.php-by-H.html

 

Now switch to mobile gives: it just loops back to same classic page...

 

Any suggestions?

-Dave

Link to comment
Share on other sites

I am trying to sort out a redirect bug when using All-products SEOpackage.

 

I start on the mobile site like this

/mobile_all-products.php

 

Click on a letter, lets use H, resulting this:

/mobile_all-products.php?fl=H

 

Now switch to classic gives this:

/all-products.php-by-H.html?redirectCancelled=true

 

all is fine - redirects to classic are weird but ok...

 

 

Now if I am the classic side:

/all-products.php

 

Click on a letter, lets use H, resulting this:

/all-products.php-by-H.html

 

Now switch to mobile gives: it just loops back to same classic page...

 

Any suggestions?

 

Hello,

 

First option:

you could use the workaround script which I posted first for the information pages and modify it for the all_products file

 

Second option:

open includes/classes/seo_classes.php

 

and add code for the all_products file using the information page like an example.

(several code snippets to add there)

 

Then you have to add the all_products.page also to the .htaccess file similar to the information page

 

regards

Rainer

Link to comment
Share on other sites

I think this is right for all-products seo

 

in seo.class.php, add these 3 bits at the appropriate spot

 

                                  if ( defined('FILENAME_MOBILE_ALLPRODS_SEO') ) $seo_pages[] = FILENAME_MOBILE_ALLPRODS_SEO;

 

                                          'fl_mobile' => '-mby-',

 

                                   break;
                       case ($page == FILENAME_MOBILE_ALLPRODS_SEO):
                        $url = $this->make_url($page, FILENAME_MOBILE_ALLPRODS_SEO, 'fl_mobile', $p2[1], '.html');

 

then add to .htaccess

 

RewriteRule ^(.*)-mby-(.*).html$ mobile_all-products.php?fl=$2&%{QUERY_STRING}

 

Does that look correct? Am I missing anything else? Much thanks!

Edited by Roaddoctor

-Dave

Link to comment
Share on other sites

Well I tried, but the above is not working as expected. I think this part needs changing but im not sure with what

 

					 case 'fl': //All Products SEO
				 switch(true){
				 case ($page == FILENAME_ALLPRODS_SEO):
					 $url = $this->make_url($page, FILENAME_ALLPRODS_SEO, $p2[0], $p2[1], '.html');
							 break;
				 case ($page == FILENAME_MOBILE_ALLPRODS_SEO):
					 $url = $this->make_url($page, FILENAME_MOBILE_ALLPRODS_SEO, 'fl_mobile', $p2[1], '.html');
							 break;
				 default:
					 $container[$p2[0]] = $p2[1];
					 break;
				 } # end switch
				 break;								

 

Does a new function need to be made in seo.class? i.e. get_allprods_name ?

Edited by Roaddoctor

-Dave

Link to comment
Share on other sites

forgot to change /mobile/includes/footer.php and mobile/includes/classes/header_title.php with

 

// $url_replace_from = array('mobile_', '-mp-', '-mc-', '-mpr-', '-mprw-', '-mm-', '-mi-');
// $url_replace_to = array('', '-p-', '-c-', '-pr-', '-pri-', '-m-', '-i-');
$url_replace_from = array('mobile_', '-mp-', '-mc-', '-mpr-', '-mprw-', '-mm-', '-mi-', '-mby-');
$url_replace_to = array('', '-p-', '-c-', '-pr-', '-pri-', '-m-', '-i-', '-by-');

 

I'm closer, but still something not right with clasic to mobile within all-products, both from all-products.php, and when a letter is chosen, - its missing the mobile_ in the link

Edited by Roaddoctor

-Dave

Link to comment
Share on other sites

one last bit

 

add to application top redirect script

 

 if ($url_basename == 'all-products.php') {
		 if (SEO_ENABLED == 'true'){
										 $mobile_site = str_replace('-by-', '-mby-', $_SERVER['REQUEST_URI']);
		 }	
 }	

 

Hello,

 

I just checked your shop and the bug is here:

 

if ($url_basename == 'all-products.php') {
		 if (SEO_ENABLED == 'true'){
				 $mobile_site = str_replace('all-products.php', 'mobile_all-products.php', $_SERVER['REQUEST_URI']);
				 $mobile_site = str_replace('-by-', '-mby-', $mobile_site);
						 }		
		 }		

 

It is needed to replace the filename "all_products.php" to "mobile_all_products.php" there, as it forms part of the seo url name.

 

All other mods seems o.k. as I could check.

 

It would be very nice if you could add this to the support package for SEO URLs_2.2._by_chemo when you checked all and everything works?

 

regards

Rainer

Edited by raiwa
Link to comment
Share on other sites

Rainer, I've been working on Header Tags Seo with iOSC. I've got it 95% working but need help getting the final tweaks. Here is what I have so far. If anyone else using HT SEO can test this that will be appreciated.

 

This assumes you already have HT SEO 3.2.9 installed and working on your classic side of the shop.

 

First Backup any file mentioned before proceeding

 

1. /mobile/includes/header.php

 

Make a duplicate copy of this file and Save As "header_with_htseo.php"

 

Now open /header_with_htseo.php and change the following (yours may be slightly different)

 

FIND

<?php if(isset($HTTP_GET_VARS['ajax']) == false) { ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=<?php echo CHARSET; ?>" />
<meta name="viewport"
content="width=width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;" />
<meta name="apple-mobile-web-app-capable"
 content="yes" />
<meta name="apple-mobile-web-app-status-bar-style"
 content="default" />
<style type="text/css" media="screen">
@[member='import'] "<?php echo DIR_WS_HTTP_CATALOG . DIR_MOBILE_INCLUDES; ?>iphone.css";
</style>
<title><?php echo TITLE; ?></title>
</head>
<body>
<div id="errorMsg">
<?php
if ($messageStack->size('header') > 0) {
echo $messageStack->output('header');
}
?>
</div>
<!-- header //-->
<div id="header">

 

REPLACE WITH

 

<?php if(isset($HTTP_GET_VARS['ajax']) == false) { ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
/*** Begin Header Tags SEO ***/
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" />
<title><?php echo TITLE; ?></title>
<?php
}
/*** End Header Tags SEO ***/
?>
<meta name="distribution" content="Global">
<meta name="rating" content="General">
<meta name="viewport"
content="width=width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;" />
<meta name="apple-mobile-web-app-capable"
 content="yes" />
<meta name="apple-mobile-web-app-status-bar-style"
 content="default" />
<style type="text/css" media="screen">
@[member='import'] "<?php echo DIR_WS_HTTP_CATALOG . DIR_MOBILE_INCLUDES; ?>iphone.css";
</style>
</head>
<body>
<div id="errorMsg">
<?php
if ($messageStack->size('header') > 0) {
echo $messageStack->output('header');
}
?>
</div>
<!-- header //-->
<div id="header">

 

Upload the new file for now; we will come back to this

 

2. Now some changes to Header Tags...

Open /admin/includes/functions/header_tags.php

 

FIND

$excludeFilesList = array();
$excludeFilesList[] = 'account.php';
$excludeFilesList[] = 'account_edit.php';
$excludeFilesList[] = 'account_history.php';
$excludeFilesList[] = 'account_history_info.php';
$excludeFilesList[] = 'account_newsletters.php';
$excludeFilesList[] = 'account_notifications.php';
$excludeFilesList[] = 'account_password.php';
$excludeFilesList[] = 'address_book.php';
$excludeFilesList[] = 'address_book_process.php';
$excludeFilesList[] = 'checkout_confirmation.php';
$excludeFilesList[] = 'checkout_payment.php';
$excludeFilesList[] = 'checkout_payment_address.php';
$excludeFilesList[] = 'checkout_process.php';
$excludeFilesList[] = 'checkout_shipping.php';
$excludeFilesList[] = 'checkout_shipping_address.php';
$excludeFilesList[] = 'checkout_success.php';
$excludeFilesList[] = 'create_account.php';
$excludeFilesList[] = 'create_account_success.php';
$excludeFilesList[] = 'headertags_seo_install.php';
$excludeFilesList[] = 'headertags_seo_uninstall.php';
$excludeFilesList[] = 'login.php';
$excludeFilesList[] = 'logoff.php';
$excludeFilesList[] = 'password_forgotten.php';
$excludeFilesList[] = 'popup_images.php';
$excludeFilesList[] = 'popup_search_help.php';
$excludeFilesList[] = 'product_reviews_info.php';
$excludeFilesList[] = 'ssl_check.php';

 

[ FIRST MODIFY TO SUIT YOUR STORE ] then REPLACE WITH

 

$excludeFilesList = array();
$excludeFilesList[] = 'account.php';
$excludeFilesList[] = 'account_edit.php';
$excludeFilesList[] = 'account_history.php';
$excludeFilesList[] = 'account_history_info.php';
$excludeFilesList[] = 'account_newsletters.php';
$excludeFilesList[] = 'account_notifications.php';
$excludeFilesList[] = 'account_password.php';
$excludeFilesList[] = 'address_book.php';
$excludeFilesList[] = 'address_book_process.php';
$excludeFilesList[] = 'address_edit_process.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'billing_address_edit_process.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'checkout_confirmation.php';
$excludeFilesList[] = 'checkout_payment.php';
$excludeFilesList[] = 'checkout_payment_address.php';
$excludeFilesList[] = 'checkout_process.php';
$excludeFilesList[] = 'checkout_shipping.php';
$excludeFilesList[] = 'checkout_shipping_address.php';
$excludeFilesList[] = 'checkout_success.php';
$excludeFilesList[] = 'create_account.php';
$excludeFilesList[] = 'create_account_success.php';
$excludeFilesList[] = 'download.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'ec_process.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'gc_return.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'googleSitemapManufacturers.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'headertags_seo_install.php';
$excludeFilesList[] = 'headertags_seo_uninstall.php';
$excludeFilesList[] = 'info_autologon.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'linkshare_commands.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'login.php';
$excludeFilesList[] = 'loginPO2.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'logoff.php';
// Begin iOSC Mobile
$excludeFilesList[] = 'mobile_account.php';
$excludeFilesList[] = 'mobile_account_edit.php';
$excludeFilesList[] = 'mobile_account_history.php';
$excludeFilesList[] = 'mobile_account_history_info.php';
$excludeFilesList[] = 'mobile_account_newsletters.php';
$excludeFilesList[] = 'mobile_account_notifications.php';
$excludeFilesList[] = 'mobile_account_password.php';
$excludeFilesList[] = 'mobile_address_book.php';
$excludeFilesList[] = 'mobile_address_book_process.php';
$excludeFilesList[] = 'mobile_checkout_confirmation.php';
$excludeFilesList[] = 'mobile_checkout_payment.php';
$excludeFilesList[] = 'mobile_checkout_payment_address.php';
$excludeFilesList[] = 'mobile_checkout_process.php';
$excludeFilesList[] = 'mobile_checkout_shipping.php';
$excludeFilesList[] = 'mobile_checkout_shipping_address.php';
$excludeFilesList[] = 'mobile_checkout_success.php';
$excludeFilesList[] = 'mobile_create_account.php';
$excludeFilesList[] = 'mobile_create_account_success.php';
$excludeFilesList[] = 'mobile_createPOaccount.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'mobile_create_poaccount_success.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'mobile_cvv2info.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'mobile_gc_return.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'mobile_login.php';
$excludeFilesList[] = 'mobile_logoff.php';
$excludeFilesList[] = 'mobile_password_forgotten.php';
$excludeFilesList[] = 'mobile_popup_image.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'mobile_popup_images.php';
$excludeFilesList[] = 'mobile_popup_search_help.php';
$excludeFilesList[] = 'mobile_popup_shipping.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'mobile_product_reviews_info.php';
$excludeFilesList[] = 'mobile_ssl_check.php';
// End iOSC Mobile
$excludeFilesList[] = 'oscthumb.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'password_forgotten.php';
$excludeFilesList[] = 'pdf_datasheet.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'popup_image.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'popup_images.php';
$excludeFilesList[] = 'popup_search_help.php';
$excludeFilesList[] = 'print_order.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'print_order2.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'product_reviews_info.php';
$excludeFilesList[] = 'redirect.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'rss.php'; // This can be deleted if you dont have this file in your shop
$excludeFilesList[] = 'ssl_check.php';
// Begin more exclusions - Any of these can be deleted if you dont have the file in your shop
$excludeFilesList[] = 'tell_a_friend.php';
$excludeFilesList[] = 'track_fedex.php';
$excludeFilesList[] = 'unsubscribe.php';
$excludeFilesList[] = 'unsubscribe_done.php';
$excludeFilesList[] = 'visitoremail.php';
$excludeFilesList[] = 'visitors_georss.php';
$excludeFilesList[] = 'vvc_display.php';
// End more exclusions

 

Continued more in next post...

-Dave

Link to comment
Share on other sites

3. Still in /admin/includes/functions/header_tags.php

 

FIND

 

function IsTemplate() //return if BTS or STS is enabled, or not
{

 

ADD BELOW

 

if (MOBILE_SITE=='True'){
 return true;
} // aaded for iOSC Mobile

 

Save, but DO NOT upload the file yet !! wait until we complete step 4.

 

4. /catalog/includes/header_tags.php

 

FIND

 

// Define specific settings per page:
switch (true) {

 

ADD BELOW

 

// MOBILE_CATALOGUE.PHP
case (basename($_SERVER['PHP_SELF']) === FILENAME_CATALOG):
$id = ($current_category_id ? 'c_' . (int)$current_category_id : (($_GET['manufacturers_id'] ? 'm_' . (int)$_GET['manufacturers_id'] : '')));
// $id = ($current_category_id ? 'mc_' . (int)$current_category_id : (($_GET['manufacturers_id'] ? 'm_' . (int)$_GET['manufacturers_id'] : '')));
if (! ReadCacheHeaderTags($header_tags_array, basename($_SERVER['PHP_SELF']), $id)) {
 $pageTags_query = tep_db_query("select * from " . TABLE_HEADERTAGS . " where page_name like '" . FILENAME_CATALOG . "' and language_id = '" . (int)$languages_id . "'");
 $pageTags = tep_db_fetch_array($pageTags_query);
 $catStr = "select categories_htc_title_tag as htc_title_tag, categories_htc_desc_tag as htc_desc_tag, categories_htc_keywords_tag as htc_keywords_tag from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "' limit 1";
 $manStr = '';
 if (isset($_GET['manufacturers_id']) && $category_depth == 'top')
	 $manStr = "select mi.manufacturers_htc_title_tag as htc_title_tag, mi.manufacturers_htc_desc_tag as htc_desc_tag, mi.manufacturers_htc_keywords_tag as htc_keywords_tag from " . TABLE_MANUFACTURERS . " m LEFT JOIN " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' and mi.languages_id = '" . (int)$languages_id . "' limit 1";
 if ($pageTags['append_root'] || $category_depth == 'top' && ! isset($_GET['manufacturers_id']) )
 {
	 $sortOrder['title'][$pageTags['sortorder_root']] = $pageTags['page_title'];
	 $sortOrder['description'][$pageTags['sortorder_root']] = $pageTags['page_description'];
	 $sortOrder['keywords'][$pageTags['sortorder_root']] = $pageTags['page_keywords'];
	 $sortOrder['logo'][$pageTags['sortorder_root']] = $pageTags['page_logo'];
	 $sortOrder['logo_1'][$pageTags['sortorder_root_1']] = $pageTags['page_logo_1'];
	 $sortOrder['logo_2'][$pageTags['sortorder_root_2']] = $pageTags['page_logo_2'];
	 $sortOrder['logo_3'][$pageTags['sortorder_root_3']] = $pageTags['page_logo_3'];
	 $sortOrder['logo_4'][$pageTags['sortorder_root_4']] = $pageTags['page_logo_4'];
 }
 $sortOrder = GetCategoryAndManufacturer($sortOrder, $pageTags, $defaultTags, $catStr, $manStr);
 if ($pageTags['append_default_title'] && tep_not_null($tmpTags['def_title'])) $sortOrder['title'][$pageTags['sortorder_title']] = $tmpTags['def_title'];
 if ($pageTags['append_default_description'] && tep_not_null($tmpTags['def_desc'])) $sortOrder['description'][$pageTags['sortorder_description']] = $tmpTags['def_desc'];
 if ($pageTags['append_default_keywords'] && tep_not_null($tmpTags['def_keywords'])) $sortOrder['keywords'][$pageTags['sortorder_keywords']] = $tmpTags['def_keywords'];
 if ($pageTags['append_default_logo'] && tep_not_null($tmpTags['def_logo_text'])) $sortOrder['logo'][$pageTags['sortorder_logo']] = $tmpTags['def_logo_text'];
 FillHeaderTagsArray($header_tags_array, $sortOrder);
 // Canonical URL add-on
 if (tep_not_null($cPath) || (isset($_GET['manufacturers_id']) && $category_depth == 'top'))
 {
	 $args = tep_get_all_get_params(array('action','currency', tep_session_name(),'sort','page'));
	 $canonical_url = StripSID(tep_href_link(FILENAME_CATALOG, $args, 'NONSSL', false) );
 }
 WriteCacheHeaderTags($header_tags_array, basename($_SERVER['PHP_SELF']), $id);
}
break;

 

Save and upload /catalog/includes/header_tags.php.

 

THEN upload the previous file /admin/includes/functions/header_tags.php

 

5. Go to your shops admininstration / Header Tags SEO / Page Control. You should now see every file that is available for placement of the header tags code.

 

6. Activating the Header Tags for a specific mobile page is now simple:

 

At a minimum place the htseo code in:

mobile_index.php

mobile_catalogue.php

 

For each mobile_ file you want Header tags code in:

 

FIND

 

require(DIR_MOBILE_INCLUDES . 'header.php');

 

REPLACE WITH

 

// require(DIR_MOBILE_INCLUDES . 'header.php');
require(DIR_MOBILE_INCLUDES . 'header_with_htseo.php');

 

7. Configure each page using Page Control.

 

PROBLEMS:

 

Mobile_Catalogue is not working perfectly yet.... categories without products but with sub categories only does not seem to be right.

 

It seems to be working everywhere else. Feedback appreciated

-Dave

Link to comment
Share on other sites

Found the problem. Header Tags is now working perfectly. Make this last change:

 

In /catalog/mobile_ catalogue.php

 

FIND

 if ($category_parent['total'] == 0) {
  $category_depth = 'nested'; // navigate through the categories

 

REPLACE WITH

 

//  if ($category_parent['total'] == 0) {
//   $category_depth = 'nested'; // navigate through the categories
  if ($category_parent['total'] > 0) {
    $category_depth = 'nested'; // navigate through the categories
  } else {
    $category_depth = 'products'; // category has no products, but display the 'no products' message

 

All is good.

-Dave

Link to comment
Share on other sites

Hello David,

 

thanks a lot for this contribution.

It would be great if you could add this to the contribution support package.

The last point in mobile_catalogue.php I'll add it as a general fix to the next iOSC update.

 

thanks again and regards

Rainer

Link to comment
Share on other sites

  • 2 weeks later...

Thank you for a great contribution!

I have been getting the following issue on my Android and 2nd Gen iPod (iTouch). (They also overlap on my PC after doing a quick check).

 

The shipping methods overlap on the shipping screen. I tried to put a link but it's not working, so sorry.

 

Any thoughts?

 

A second issue I am running into is my website now defaults to the mobile view on a PC as well.

 

Thanks again!

 

~Vid

Edited by videod
Link to comment
Share on other sites

Never mind I found the fix for the overlap issue buried in the thread. But didn't find a solution for the default mobile issue. Sorry for any interruption.

 

Cheers!

 

~Vid

Edited by videod
Link to comment
Share on other sites

Never mind I found the fix for the overlap issue buried in the thread. But didn't find a solution for the default mobile issue. Sorry for any interruption.

 

Cheers!

 

~Vid

 

Hello,

 

Please post the URL of your shop, impossible to figure out what's wrong without it, at least for me.

 

Regards

Rainer

Link to comment
Share on other sites

I went straight to mobile, on PC

 

what does your mobile/includes/classes/mobile_redirect.php file look like?

 

if not already done, edit line 7 like this and test again

 

 if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4)))

-Dave

Link to comment
Share on other sites

I tried that but for some reason it still defaults to mobile. Below is the full redirect file:

--------------------------------

 

<?php

// Le navigateur est-il un Smartphone ?

function smartphone()

{

$smartphone = false;

$useragent=$_SERVER['HTTP_USER_AGENT'];

if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4)))

header('Location: http://detectmobilebrowser.com/mobile');

{

$smartphone = true;

}

return $smartphone;

}

 

class mobileRedirect {

var $redirected;

var $mobileDir = "mobile_";

 

function mobileRedirect() {

$this->redirected = $this->needRedirect();

if($this->redirected)

$this->redirect();

}

 

function needRedirect() {

if($this->isCancelled())

return false;

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

return false;

if(smartphone() == true)

return true;

return false;

}

 

function isCancelled() {

if (tep_session_is_registered('redirectCancelled'))

return true;

if(isset($_GET['redirectCancelled']) && $_GET['redirectCancelled'] == 'true') {

tep_session_register('redirectCancelled');

return true;

}

return false;

}

 

function redirect() {

global $mobile_site;

if(isset($mobile_site)) {

$path = preg_split('/[: -]/', $mobile_site);

$file = $path[sizeof($path)-1];

} else {

$path = split("/" , $_SERVER['SCRIPT_NAME']);

$filename = $path[sizeof($path)-1];

$file = $this->mobileDir . $filename;

}

$qstring = $_SERVER['QUERY_STRING'];

$SSL = ($_SERVER['HTTPS']) ? "SSL" : "NONSSL";

tep_redirect(tep_href_link($file, $qstring, $SSL, false, false));

}

}

?>

 

-------------------------------------

 

~Vid

Link to comment
Share on other sites

Hello,

 

I took out this line:

 

header('Location: http://detectmobilebrowser.com/mobile');

 

Everything seems to be working now. Does that line need to be added? I think I threw that code there after reading about it in a thread. I will just leave it out.

 

Thanks again for your time and this awesome contribution!!!

 

~VId

Link to comment
Share on other sites

change split to explode

 

    function redirect() {
 global $mobile_site; 
  if(isset($mobile_site)) {
//    $path = split("/" ,$mobile_site);
   $path = explode("/" ,$mobile_site);
   $file = $path[sizeof($path)-1];
  } else {
//    $path = split("/" , $_SERVER['SCRIPT_NAME']);
   $path = explode("/" , $_SERVER['SCRIPT_NAME']);
   $filename = $path[sizeof($path)-1];
   $file = $this->mobileDir . $filename;
  }
  $qstring = $_SERVER['QUERY_STRING'];
  $SSL = ($_SERVER['HTTPS']) ? "SSL" : "NONSSL";
  tep_redirect(tep_href_link($file, $qstring, $SSL, false, false));

-Dave

Link to comment
Share on other sites

change split to explode

 

 function redirect() {
global $mobile_site;
if(isset($mobile_site)) {
// $path = split("/" ,$mobile_site);
$path = explode("/" ,$mobile_site);
$file = $path[sizeof($path)-1];
} else {
// $path = split("/" , $_SERVER['SCRIPT_NAME']);
$path = explode("/" , $_SERVER['SCRIPT_NAME']);
$filename = $path[sizeof($path)-1];
$file = $this->mobileDir . $filename;
}
$qstring = $_SERVER['QUERY_STRING'];
$SSL = ($_SERVER['HTTPS']) ? "SSL" : "NONSSL";
tep_redirect(tep_href_link($file, $qstring, $SSL, false, false));

Done and thanks again for your help. This is an awesome contribution. Can't wait to finalize and add to my store!

 

Cheers!

 

~VId

Link to comment
Share on other sites

Hi....

 

Thanks for the great contribution.....

 

I have an issue with the mobile_checkout_shipping.php. When I enable free shipping $75 through admin. I cannot pass the mobile_checkout_shipping.php screen... When I click continue, it brings me back to mobile_checkout_shipping.php and cannot move forward. When I remove the free shipping $75 thru admin. Everything works really well.

 

Please assist...

 

Kee

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...