Jump to content
bumbarash

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

Recommended Posts

Does not work either. But it is not a css problem

 

Go to http://www.shoptuin.nl/mobile and press on the account button. The page goed blank. and the url is http://www.shoptuin.nl/mobile_account.php

 

I think the problem is that it needs to check if you logged in or not. If you are not logged in it needs to redirect you to the login page and this does not happen.

 

Same problem when you go directly to the login page and try to login. The page goed blank aswell. but if I refresh the page after the login attempt everthing works well. Even If I press on account.

 

So as far as I can tell. The problem is this function or something related with it. Maybe in application top

 

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

tep_redirect(tep_mobile_link(FILENAME_LOGIN, '', 'SSL'));

}

 

the server is running on

PHP Version 5.3.10

 

Hello,

 

If you like, you can send me the relevant files:

 

mobile_account.php

mobile_login.php

mobile/includes/application_top.php

mobile/includes/header.php

 

here:

info@sarplataygemas.com

 

I'll see what I can do

 

regards

Rainer

Share this post


Link to post
Share on other sites

Hi, I've found other people in this topic with my problem but haven't found a solution.

 

Basically, I use paypal express and with iOSC, after payment is taken it returns the customer to the full checkout_confimation.php page, not the mobile version. Does anybody have any idea how I can fix this?

 

Cheers

Share this post


Link to post
Share on other sites

Does not work either. But it is not a css problem

 

Go to http://www.shoptuin.nl/mobile and press on the account button. The page goed blank. and the url is http://www.shoptuin.nl/mobile_account.php

 

I think the problem is that it needs to check if you logged in or not. If you are not logged in it needs to redirect you to the login page and this does not happen.

 

Same problem when you go directly to the login page and try to login. The page goed blank aswell. but if I refresh the page after the login attempt everthing works well. Even If I press on account.

 

So as far as I can tell. The problem is this function or something related with it. Maybe in application top

 

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

tep_redirect(tep_mobile_link(FILENAME_LOGIN, '', 'SSL'));

}

 

the server is running on

PHP Version 5.3.10

 

Hello,

 

I found now this problem in a test store and could get it resolved:

remove this line from:

mobile/includes/application_top.php

 

<style type="text/css" media="screen">
@[member='import'] "<?php echo DIR_WS_HTTP_CATALOG . DIR_MOBILE_INCLUDES; ?>iphone.css";
</style>

 

and paste it in:

 

mobile/includes/header.php

 

just before the <head> tag.

 

Then I had only the problem that the color of the footer text didn't load correct and had to add color definitions to the text styles used in the mobile footer:

In: iphone.css change:

 

td.footer{
font-size: 10px;
}

 

to:

 

td.footer{
font-size: 10px;
color: #000000;
}

 

and all other styles used in the footer.

 

 

Another bug is that in the file:

 

mobile/includes/classes/redirect.php

 

the function:

 function redirect() {
global $mobile_site;
if(isset($mobile_site)) {
$path = 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));
}

 

 

still uses the function: "split" which is deprecated since php 5.3.0

 

replace with "explode"

 

so it should look like this:

 

 function redirect() {
global $mobile_site;
if(isset($mobile_site)) {
$path = explode("/" ,$mobile_site);
$file = $path[sizeof($path)-1];
} else {
$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));
}

 

and it will work fine.

 

 

hope this helps

 

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

Hello,

 

I found now this problem in a test store and could get it resolved:

remove this line from:

mobile/includes/application_top.php

 

<style type="text/css" media="screen">
@[member='import'] "<?php echo DIR_WS_HTTP_CATALOG . DIR_MOBILE_INCLUDES; ?>iphone.css";
</style>

 

and paste it in:

 

mobile/includes/header.php

 

just before the <head> tag.

 

Then I had only the problem that the color of the footer text didn't load correct and had to add color definitions to the text styles used in the mobile footer:

In: iphone.css change:

 

td.footer{
font-size: 10px;
}

 

to:

 

td.footer{
font-size: 10px;
color: #000000;
}

 

and all other styles used in the footer.

 

 

Another bug is that in the file:

 

mobile/includes/classes/redirect.php

 

the function:

 function redirect() {
global $mobile_site;
if(isset($mobile_site)) {
$path = 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));
}

 

 

still uses the function: "split" which is deprecated since php 5.3.0

 

replace with "explode"

 

so it should look like this:

 

 function redirect() {
global $mobile_site;
if(isset($mobile_site)) {
$path = explode("/" ,$mobile_site);
$file = $path[sizeof($path)-1];
} else {
$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));
}

 

and it will work fine.

 

 

hope this helps

 

Rainer

 

sorry the line:

 

<style type="text/css" media="screen">
@[member='import'] "<?php echo DIR_WS_HTTP_CATALOG . DIR_MOBILE_INCLUDES; ?>iphone.css";
</style>

 

should be pasted before the </head> tag

not the <head> tag.

 

so no corrections in iphone.css should be necessary to show the text in mobile footer correct.

 

sorry

 

Rainer

Share this post


Link to post
Share on other sites

sorry the line:

 

<style type="text/css" media="screen">
@[member='import'] "<?php echo DIR_WS_HTTP_CATALOG . DIR_MOBILE_INCLUDES; ?>iphone.css";
</style>

 

should be pasted before the </head> tag

not the <head> tag.

 

so no corrections in iphone.css should be necessary to show the text in mobile footer correct.

 

sorry

 

Rainer

 

Hey,

 

i have the same problem on my site aktiv-spielen.de/mobile/ (mobile_checkout_shipping.php redirect to a blank site). Do you have any ideas how i can fix the problem?

 

Lukas

Share this post


Link to post
Share on other sites

Hey,

 

i have the same problem on my site aktiv-spielen.de/mobile/ (mobile_checkout_shipping.php redirect to a blank site). Do you have any ideas how i can fix the problem?

 

Lukas

 

this happens sometimes just when you upload a new or modified file.

Try this: delete your browsers cache, close the browser and open again.

 

Best regards

Rainer

Share this post


Link to post
Share on other sites

sorry the line:

 

<style type="text/css" media="screen">
@[member='import'] "<?php echo DIR_WS_HTTP_CATALOG . DIR_MOBILE_INCLUDES; ?>iphone.css";
</style>

 

should be pasted before the </head> tag

not the <head> tag.

 

so no corrections in iphone.css should be necessary to show the text in mobile footer correct.

 

sorry

 

Rainer

 

Still nog working. I will send you the files

Share this post


Link to post
Share on other sites

this happens sometimes just when you upload a new or modified file.

Try this: delete your browsers cache, close the browser and open again.

 

Best regards

Rainer

 

Thanks for your help! I cleared everything, but still have the same problem.. I tried it on my iPhone, FF and with IE..

Share this post


Link to post
Share on other sites

Still nog working. I will send you the files

 

Hello,

 

In another shop I could resolve it pasting the

<style type="text/css" media="screen">
@[member='import'] "<?php echo DIR_WS_HTTP_CATALOG . DIR_MOBILE_INCLUDES; ?>iphone.css";
</style>

 

Code just before the <head> tag in mobile/includes/header.php.

 

So just oposite I posted before.

 

regards

Rainer

Share this post


Link to post
Share on other sites

OK, I got it to work with the main site still using Chemos seo URLs 2.2d.

 

You have to rename mobile_product_info.php to something different like mobile_producto_inform.php. Then give it a filename in includes/filenames.php like this

 

define('FILENAME_MPRODUCT_INFO', 'mobile_producto_inform.php');

 

 

Then in mobile/includes/modules/products.php change FILENAME_PRODUCT_INFO to FILENAME_MPRODUCT_INFO

 

do the same in catalog/mobile_shopping_cart.php

 

and only the second one in the file now called catalog/mobile_producto_inform.php (NOT THE REQUIRES STATEMENT AT THE TOP)

 

Iwas - Thank you for this! has this worked out well? any negative effects?

 

Raiwa - is this above solution suggested?

 

FYI - simply adding " define ('SEO_ENABLED', 'false'); " to mobile/includes/configure.php is the opposite solution to easily disable rewrites in the mobile shop.

 

I've just begun installing this and have noticed a few minor issues so far

 

- in new products and specials, A product that is present in more than one category is appearing multiple times, once for each category.

- the footer contents are jammed to the left like there is a blank td to the right of it. Nothing in the code would indicate such.

- I have some sort of product image issue to sort - images on product info are not being contained to the defined size. I use Oscthumb (phpthumb). Is there a change to make?

 

A fix for SPPC users: Be sure to add the following to:

mobile_advanced search result.php

mobile_catalogue.php

mobile_products_new.php

mobile_specials.php

and possibly others

 

Add above the first: $listing_sql =

// BOF Separate Price Per Customer
// global variable (session): $sppc_customers_group_id -> local variable $customer_group_id
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
} else {
$customer_group_id = $sppc_customer_group_id;
}
// EOF SPPC

 

and add to the query

and s.customers_group_id = " . (int)$customer_group_id .

 

so it looks something like

$listing_sql .= " and s.customers_group_id = " . (int)$customer_group_id . " order by pd.products_name"; // SPPC

 

For fedexwebservices.php shipping module users, the following is likely needed in mobile_checkout_shipping.php

 

find: // load all enabled shipping modules

Add above:

// BOF changes for adding class packing
if (defined('SHIPPING_DIMENSIONS_SUPPORT') && SHIPPING_DIMENSIONS_SUPPORT == 'Ready-to-ship only') {
$dimensions_support = 1;
} elseif (defined('SHIPPING_DIMENSIONS_SUPPORT') && SHIPPING_DIMENSIONS_SUPPORT == 'With product dimensions') {
$dimensions_support = 2;
} else {
$dimensions_support = 0;
}

if ($dimensions_support > 0) {
require(DIR_WS_CLASSES . 'packing.php');
$packing = new packing;
}
// EOF changes for adding class packing

 

Could anyone who uses Dynamo Effects' Paypal WPP and has enabled Express Checkout please post the code changes they made?

Same for Google Checkout 1.5 code changes...

 

Awesome contribution! Thanks for the help!


-Dave

Share this post


Link to post
Share on other sites

Iwas - Thank you for this! has this worked out well? any negative effects?

 

Raiwa - is this above solution suggested?

 

FYI - simply adding " define ('SEO_ENABLED', 'false'); " to mobile/includes/configure.php is the opposite solution to easily disable rewrites in the mobile shop.

 

I've just begun installing this and have noticed a few minor issues so far

 

- in new products and specials, A product that is present in more than one category is appearing multiple times, once for each category.

- the footer contents are jammed to the left like there is a blank td to the right of it. Nothing in the code would indicate such.

- I have some sort of product image issue to sort - images on product info are not being contained to the defined size. I use Oscthumb (phpthumb). Is there a change to make?

 

A fix for SPPC users: Be sure to add the following to:

mobile_advanced search result.php

mobile_catalogue.php

mobile_products_new.php

mobile_specials.php

and possibly others

 

Add above the first: $listing_sql =

// BOF Separate Price Per Customer
// global variable (session): $sppc_customers_group_id -> local variable $customer_group_id
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
} else {
$customer_group_id = $sppc_customer_group_id;
}
// EOF SPPC

 

and add to the query

and s.customers_group_id = " . (int)$customer_group_id .

 

so it looks something like

$listing_sql .= " and s.customers_group_id = " . (int)$customer_group_id . " order by pd.products_name"; // SPPC

 

For fedexwebservices.php shipping module users, the following is likely needed in mobile_checkout_shipping.php

 

find: // load all enabled shipping modules

Add above:

// BOF changes for adding class packing
if (defined('SHIPPING_DIMENSIONS_SUPPORT') && SHIPPING_DIMENSIONS_SUPPORT == 'Ready-to-ship only') {
$dimensions_support = 1;
} elseif (defined('SHIPPING_DIMENSIONS_SUPPORT') && SHIPPING_DIMENSIONS_SUPPORT == 'With product dimensions') {
$dimensions_support = 2;
} else {
$dimensions_support = 0;
}

if ($dimensions_support > 0) {
require(DIR_WS_CLASSES . 'packing.php');
$packing = new packing;
}
// EOF changes for adding class packing

 

Could anyone who uses Dynamo Effects' Paypal WPP and has enabled Express Checkout please post the code changes they made?

Same for Google Checkout 1.5 code changes...

 

Awesome contribution! Thanks for the help!

 

Hello,

 

For the duplicated products in specials and new product listing the solution is to add a "distinct" command to the database queries.

 

In mobile_products_new.php and mobile_specials.php (same changes for both files):

 

Line 11 should show like this:

   $listing_sql =  "select distinct p.products_id, 

 

 

I will include this fix in the next revision upload.

 

Thanks and regards

Rainer

Share this post


Link to post
Share on other sites

OK, I got it to work with the main site still using Chemos seo URLs 2.2d.

 

You have to rename mobile_product_info.php to something different like mobile_producto_inform.php. Then give it a filename in includes/filenames.php like this

 

define('FILENAME_MPRODUCT_INFO', 'mobile_producto_inform.php');

 

 

Then in mobile/includes/modules/products.php change FILENAME_PRODUCT_INFO to FILENAME_MPRODUCT_INFO

 

do the same in catalog/mobile_shopping_cart.php

 

and only the second one in the file now called catalog/mobile_producto_inform.php (NOT THE REQUIRES STATEMENT AT THE TOP)

 

IWAS,

 

I have done the steps above, everything still works but the product url's are still default.

I did set define ('SEO_ENABLED', 'true'); in /mobile /ncludes/configure

Am I missing something? Do the rewrite lines in .htaccess need a new line? something else?

 

As a side perk, making the above change did sort out my image issues, I believe by somehow negating the php/oscThumb processing from the process.. This is good.

 

*******************

For GoogleCheckout users - heres what I have done to maintain the checkout flow within mobile_

 

Copy /googlecheckout/gcheckout.php and rename to gcheckout_mobile.php

 

In gcheckout_mobile.php

 

FIND

$digital_url = str_replace("&", "&",
						 tep_href_link('checkout_success.php'));

 

REPLACE WITH

$digital_url = str_replace("&", "&",
						 tep_mobile_link('mobile_checkout_success.php'));

 

FIND

// TODO(eddavisson): Use OSC's tep_href_link().
$continue_shopping_url = ($googlepayment->continue_url=='gc_return.php')?
				 $googlepayment->continue_url . '?products_id=' .
				 implode(',', explode(';', !empty($product_list)?
				 trim($product_list,';'):'-1')):$googlepayment->continue_url;
$Gcart->SetEditCartUrl(tep_href_link('shopping_cart.php'));
$Gcart->SetContinueShoppingUrl(tep_href_link($continue_shopping_url));
$Gcart->SetRequestBuyerPhone('true');

 

REPLACE WITH

// TODO(eddavisson): Use OSC's tep_href_link().
$continue_shopping_url = ($googlepayment->continue_url=='mobile_gc_return.php')?
				 $googlepayment->continue_url . '?products_id=' .
				 implode(',', explode(';', !empty($product_list)?
				 trim($product_list,';'):'-1')):$googlepayment->continue_url;
$Gcart->SetEditCartUrl(tep_mobile_link('mobile_shopping_cart.php'));
$Gcart->SetContinueShoppingUrl(tep_mobile_link($continue_shopping_url));
$Gcart->SetRequestBuyerPhone('true');

 

Copy /catalog/gc_return.php and rename it mobile_gc_return.php. Modify the file to be mobile friendly

 

In /mobile_shopping_cart.php

 

FIND

// ** GOOGLE CHECKOUT **
// Checks if the Google Checkout payment module has been enabled and if so
// includes gcheckout.php to add the Checkout button to the page
if (defined('MODULE_PAYMENT_GOOGLECHECKOUT_STATUS') && MODULE_PAYMENT_GOOGLECHECKOUT_STATUS == 'True') {
 include_once('googlecheckout/gcheckout.php');
}
// ** END GOOGLE CHECKOUT **

 

REPLACE WITH

// ** GOOGLE CHECKOUT **
// Checks if the Google Checkout payment module has been enabled and if so
// includes gcheckout.php to add the Checkout button to the page
if (defined('MODULE_PAYMENT_GOOGLECHECKOUT_STATUS') && MODULE_PAYMENT_GOOGLECHECKOUT_STATUS == 'True') {
 include_once('googlecheckout/gcheckout_mobile.php');
}
// ** END GOOGLE CHECKOUT **

 

That should be it... very lightly tested so any feedback appreciated.

 

I need help getting paypal_wpp Express Checkout worrking... any help please ????


-Dave

Share this post


Link to post
Share on other sites

OK, I got it to work with the main site still using Chemos seo URLs 2.2d.

 

You have to rename mobile_product_info.php to something different like mobile_producto_inform.php. Then give it a filename in includes/filenames.php like this

 

define('FILENAME_MPRODUCT_INFO', 'mobile_producto_inform.php');

 

 

Then in mobile/includes/modules/products.php change FILENAME_PRODUCT_INFO to FILENAME_MPRODUCT_INFO

 

do the same in catalog/mobile_shopping_cart.php

 

and only the second one in the file now called catalog/mobile_producto_inform.php (NOT THE REQUIRES STATEMENT AT THE TOP)

 

This turns out to be not such a good idea - did not work right and caused more problems than it fixed. Not advised.

 

I did solve the header and footer icons not showing issue - after lots of head banging it turns out easy

 

If your icons will not show, its likely due to the tep_image wrapper of your image thumbnailer (such as phpthumb or oscthumb) not being able to manage small images properly. This fix can also be used to fix product_info images if yours are messed up like mine were.

 

The fix is to restore the original OSC tep_image function IF missing from your shop. Then use this original default image wrapper to call your icons.

 

Backup and look at /catalog/includes/functions/html_output.php

 

If exists, FIND this section (which is likely commented out or missing if you are using a thumbnailer)

////
// The HTML image wrapper function (2.2rc2a original)
function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
 return false;
}
// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
$image = '<img src="' . tep_output_string($src) . '" alt="' . tep_output_string($alt) . '"';
if (tep_not_null($alt)) {
 $image .= ' title=" ' . tep_output_string($alt) . ' "';
}
if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
 if ($image_size = @getimagesize($src)) {
 if (empty($width) && tep_not_null($height)) {
	 $ratio = $height / $image_size[1];
	 $width = intval($image_size[0] * $ratio);
 } elseif (tep_not_null($width) && empty($height)) {
	 $ratio = $width / $image_size[0];
	 $height = intval($image_size[1] * $ratio);
 } elseif (empty($width) && empty($height)) {
	 $width = $image_size[0];
	 $height = $image_size[1];
 }
 } elseif (IMAGE_REQUIRED == 'false') {
 return false;
 }
}
if (tep_not_null($width) && tep_not_null($height)) {
 $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
}
if (tep_not_null($parameters)) $image .= ' ' . $parameters;
$image .= '>';
return $image;
}

 

ADD the original (Github updated) function back like this, named: tep_image_original

 

////
// The HTML image wrapper function (2.2rc2a original)
// function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
function tep_image_original($src, $alt = '', $width = '', $height = '', $parameters = '') {
if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
 return false;
}
// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
$image = '<img src="' . tep_output_string($src) . '" alt="' . tep_output_string($alt) . '"'; // github 11/29/12
if (tep_not_null($alt)) {
 $image .= ' title="' . tep_output_string($alt) . '"'; // github 11/29/12
}
if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
 if ($image_size = @getimagesize($src)) {
 if (empty($width) && tep_not_null($height)) {
	 $ratio = $height / $image_size[1];
	 $width = intval($image_size[0] * $ratio);
 } elseif (tep_not_null($width) && empty($height)) {
	 $ratio = $width / $image_size[0];
	 $height = intval($image_size[1] * $ratio);
 } elseif (empty($width) && empty($height)) {
	 $width = $image_size[0];
	 $height = $image_size[1];
 }
 } elseif (IMAGE_REQUIRED == 'false') {
 return false;
 }
}
if (tep_not_null($width) && tep_not_null($height)) {
 $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
}
if (tep_not_null($parameters)) $image .= ' ' . $parameters;
$image .= '>';
return $image;
}

 

Now go to /catalog/mobile/includes/header.php (also /footer.php) and change tep_image to tep_image_orginal like this

<div id="headerLogo"><?php echo '<a href="' . tep_mobile_link(FILENAME_DEFAULT) . '">' . tep_image_original(DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . 'pixel_trans.gif', STORE_NAME, 0,30) . '</a>';?></div>
<!--<div id="headerLogo"><?php // echo '<a href="' . tep_mobile_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . 'baner_sar_mobile.jpg', STORE_NAME, 0,30) . '</a>';?></div> -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="headerNavigation">
<tr class="headerNavigation">
<td class="headerNavigation"><a href="<?php echo tep_mobile_link(FILENAME_DEFAULT);?>"> <?php echo tep_image_original(DIR_WS_HTTP_CATALOG . DIR_MOBILE_IMAGES. "home.png") . "<br>" . TEXT_HOME; ?></a></td>
<td class="headerNavigation"><a href="<?php echo tep_mobile_link(FILENAME_CATALOG);?>"><?php echo tep_image_original(DIR_WS_HTTP_CATALOG . DIR_MOBILE_IMAGES. "boutique.png") . "<br>" . TEXT_SHOP; ?></a></td>
<td class="headerNavigation"><a href="<?php echo tep_mobile_link(FILENAME_MOBILE_ACCOUNT);?>"><?php echo tep_image_original(DIR_WS_HTTP_CATALOG . DIR_MOBILE_IMAGES. "compte.png") . "<br>" . TEXT_ACCOUNT; ?></a></td>
<td class="headerNavigation"><a href="<?php echo tep_mobile_link(FILENAME_SEARCH);?>"><?php echo tep_image_original(DIR_WS_HTTP_CATALOG . DIR_MOBILE_IMAGES. "search2.png") . "<br>" . IMAGE_BUTTON_SEARCH; ?></a></td>
<td class="headerNavigation"><a href="<?php echo tep_mobile_link(FILENAME_MOBILE_ABOUT);?>"><?php echo tep_image_original(DIR_WS_HTTP_CATALOG . DIR_MOBILE_IMAGES. "help.png") . "<br>" . TEXT_ABOUT; ?></a></td>

 

Bam! - icons now show. You can make the same change to /mobile/footer.php and any other tep_image call giving you grief.

 

So that leave me todo:

 

- fix for Chemos URL 2.2d original

- I still need help getting paypal_wpp Express Checkout worrking... any help please ????


-Dave

Share this post


Link to post
Share on other sites

This turns out to be not such a good idea - did not work right and caused more problems than it fixed. Not advised.

 

I did solve the header and footer icons not showing issue - after lots of head banging it turns out easy

 

If your icons will not show, its likely due to the tep_image wrapper of your image thumbnailer (such as phpthumb or oscthumb) not being able to manage small images properly. This fix can also be used to fix product_info images if yours are messed up like mine were.

 

The fix is to restore the original OSC tep_image function IF missing from your shop. Then use this original default image wrapper to call your icons.

 

Backup and look at /catalog/includes/functions/html_output.php

 

If exists, FIND this section (which is likely commented out or missing if you are using a thumbnailer)

////
// The HTML image wrapper function (2.2rc2a original)
function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
 return false;
}
// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
$image = '<img src="' . tep_output_string($src) . '" alt="' . tep_output_string($alt) . '"';
if (tep_not_null($alt)) {
 $image .= ' title=" ' . tep_output_string($alt) . ' "';
}
if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
 if ($image_size = @getimagesize($src)) {
 if (empty($width) && tep_not_null($height)) {
	 $ratio = $height / $image_size[1];
	 $width = intval($image_size[0] * $ratio);
 } elseif (tep_not_null($width) && empty($height)) {
	 $ratio = $width / $image_size[0];
	 $height = intval($image_size[1] * $ratio);
 } elseif (empty($width) && empty($height)) {
	 $width = $image_size[0];
	 $height = $image_size[1];
 }
 } elseif (IMAGE_REQUIRED == 'false') {
 return false;
 }
}
if (tep_not_null($width) && tep_not_null($height)) {
 $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
}
if (tep_not_null($parameters)) $image .= ' ' . $parameters;
$image .= '>';
return $image;
}

 

ADD the original (Github updated) function back like this, named: tep_image_original

 

////
// The HTML image wrapper function (2.2rc2a original)
// function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
function tep_image_original($src, $alt = '', $width = '', $height = '', $parameters = '') {
if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
 return false;
}
// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
$image = '<img src="' . tep_output_string($src) . '" alt="' . tep_output_string($alt) . '"'; // github 11/29/12
if (tep_not_null($alt)) {
 $image .= ' title="' . tep_output_string($alt) . '"'; // github 11/29/12
}
if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
 if ($image_size = @getimagesize($src)) {
 if (empty($width) && tep_not_null($height)) {
	 $ratio = $height / $image_size[1];
	 $width = intval($image_size[0] * $ratio);
 } elseif (tep_not_null($width) && empty($height)) {
	 $ratio = $width / $image_size[0];
	 $height = intval($image_size[1] * $ratio);
 } elseif (empty($width) && empty($height)) {
	 $width = $image_size[0];
	 $height = $image_size[1];
 }
 } elseif (IMAGE_REQUIRED == 'false') {
 return false;
 }
}
if (tep_not_null($width) && tep_not_null($height)) {
 $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
}
if (tep_not_null($parameters)) $image .= ' ' . $parameters;
$image .= '>';
return $image;
}

 

Now go to /catalog/mobile/includes/header.php (also /footer.php) and change tep_image to tep_image_orginal like this

<div id="headerLogo"><?php echo '<a href="' . tep_mobile_link(FILENAME_DEFAULT) . '">' . tep_image_original(DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . 'pixel_trans.gif', STORE_NAME, 0,30) . '</a>';?></div>
<!--<div id="headerLogo"><?php // echo '<a href="' . tep_mobile_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . 'baner_sar_mobile.jpg', STORE_NAME, 0,30) . '</a>';?></div> -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="headerNavigation">
<tr class="headerNavigation">
<td class="headerNavigation"><a href="<?php echo tep_mobile_link(FILENAME_DEFAULT);?>"> <?php echo tep_image_original(DIR_WS_HTTP_CATALOG . DIR_MOBILE_IMAGES. "home.png") . "<br>" . TEXT_HOME; ?></a></td>
<td class="headerNavigation"><a href="<?php echo tep_mobile_link(FILENAME_CATALOG);?>"><?php echo tep_image_original(DIR_WS_HTTP_CATALOG . DIR_MOBILE_IMAGES. "boutique.png") . "<br>" . TEXT_SHOP; ?></a></td>
<td class="headerNavigation"><a href="<?php echo tep_mobile_link(FILENAME_MOBILE_ACCOUNT);?>"><?php echo tep_image_original(DIR_WS_HTTP_CATALOG . DIR_MOBILE_IMAGES. "compte.png") . "<br>" . TEXT_ACCOUNT; ?></a></td>
<td class="headerNavigation"><a href="<?php echo tep_mobile_link(FILENAME_SEARCH);?>"><?php echo tep_image_original(DIR_WS_HTTP_CATALOG . DIR_MOBILE_IMAGES. "search2.png") . "<br>" . IMAGE_BUTTON_SEARCH; ?></a></td>
<td class="headerNavigation"><a href="<?php echo tep_mobile_link(FILENAME_MOBILE_ABOUT);?>"><?php echo tep_image_original(DIR_WS_HTTP_CATALOG . DIR_MOBILE_IMAGES. "help.png") . "<br>" . TEXT_ABOUT; ?></a></td>

 

Bam! - icons now show. You can make the same change to /mobile/footer.php and any other tep_image call giving you grief.

 

So that leave me todo:

 

- fix for Chemos URL 2.2d original

- I still need help getting paypal_wpp Express Checkout worrking... any help please ????

 

Hello,

 

for the images you can also try to change the absolute path to the relative path to your image folder:

 

tep_image(DIR_MOBILE_IMAGES. "home.png")

or:

 

tep_image('/'. DIR_MOBILE_IMAGES. "home.png")

 

instead of:

 

tep_image(DIR_WS_HTTP_CATALOG . DIR_MOBILE_IMAGES. "home.png")

 

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

Rainer,

Again thanks for this fantastic module. I've got it working well. I have a question on links in the content and redirection. For the time being, on my mobile product info pages I have used strip_tags to remove all links. Is there a way to not strip tags but perhaps use preg_replace to to add mobile_ within the links, that would then point to existing mobile pages? If possible, what about links to pages that dont have a moble equivalent? just trying to grasp this.

 

Also, in a simpler form, for example, on my login page in the New Customer Information box, I have a link to my privacy policy, that as it is now, sends the customer to the classic site... How should this be fixed?

 

Thank you


-Dave

Share this post


Link to post
Share on other sites

Seems I have an issue with this code - since im using rewriter URL2.2d, when the Mobile link is clicked from any page on the Classic side where the url rewritten (such as any product page), the redirect fails and loops back to the same Classic page.

 

How woudl I sort this?

 

As a temporary hack, Is there a way this code be rewritten to send the person to mobile_catalogue.php when the rewrite wont work, or the page does not exist in the mobile version.... If thats not possible, can you provide a code snippet that simply always sends the customer to mobile_catalogue?

 

<!-- BOF show mobile link //-->
<?php
// if (MOBILE_SITE=='True'){
if (MOBILE_SITE=='False'){ //temporary till porblem fixed BFD
?>
<td class="smalltext" align="center">
<?php
if ((substr(basename($PHP_SELF), 0, 8) != 'checkout') and (MOBILE_SITE == 'True')) {
global $mobile_url;
if (!isset($lng) || (isset($lng) && !is_object($lng))) {
$mobile_url .= (strpos($mobile_url,'language=') > 0) ? '' : ((strpos($mobile_url,'?') > 0) ? '&language=' . $current_lang_key : '?language=' . $current_lang_key ) ;
}
echo TEXT_SHOW_VIEW_1 . TEXT_CLASSIC_VIEW . ' - ' . '<a href="' . $mobile_url . '">' . TEXT_MOBILE_VIEW . '</a>' . TEXT_SHOW_VIEW_2;
}
?>
</td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<?php
} // if (MOBILE_SITE=='True')
?>
<!-- EOF show mobile link //-->


-Dave

Share this post


Link to post
Share on other sites

Seems I have an issue with this code - since im using rewriter URL2.2d, when the Mobile link is clicked from any page on the Classic side where the url rewritten (such as any product page), the redirect fails and loops back to the same Classic page.

 

How woudl I sort this?

 

As a temporary hack, Is there a way this code be rewritten to send the person to mobile_catalogue.php when the rewrite wont work, or the page does not exist in the mobile version.... If thats not possible, can you provide a code snippet that simply always sends the customer to mobile_catalogue?

 

<!-- BOF show mobile link //-->
<?php
// if (MOBILE_SITE=='True'){
if (MOBILE_SITE=='False'){ //temporary till porblem fixed BFD
?>
<td class="smalltext" align="center">
<?php
if ((substr(basename($PHP_SELF), 0, 8) != 'checkout') and (MOBILE_SITE == 'True')) {
global $mobile_url;
if (!isset($lng) || (isset($lng) && !is_object($lng))) {
$mobile_url .= (strpos($mobile_url,'language=') > 0) ? '' : ((strpos($mobile_url,'?') > 0) ? '&language=' . $current_lang_key : '?language=' . $current_lang_key ) ;
}
echo TEXT_SHOW_VIEW_1 . TEXT_CLASSIC_VIEW . ' - ' . '<a href="' . $mobile_url . '">' . TEXT_MOBILE_VIEW . '</a>' . TEXT_SHOW_VIEW_2;
}
?>
</td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<?php
} // if (MOBILE_SITE=='True')
?>
<!-- EOF show mobile link //-->

 

Hello Dave,

 

For the SEO URL issue:

 

To switch off the SEO URL rewrite for the mobile site you have to add this to mobile/includes/configure.php:

define('SEO_ENABLED', 'false');

not "true".

 

I wrote a modified MOBILE iOSC REDIRECT_SCRIPT for URL2.2d by CHEMO which converts the SEO URLs of the "classic" site to "normal" URLs for the mobile site.

Replace the complete MOBILE iOSC REDIRECT_SCRIPT in includes/application_top.php with this one:

//BEGIN : MOBILE iOSC REDIRECT_SCRIPT
if (MOBILE_SITE=='True'){
	 $url_basename = basename($PHP_SELF);
	 if ($url_basename == 'index.php') {
		 if (SEO_ENABLED == 'true'){
			 if (strpos($_SERVER['REQUEST_URI'], '-c-') == TRUE) {
				 $info_box_replace = array('?infoBox=0', '?infoBox=1', '?infoBox=2', '?infoBox=3', '?infoBox=4', '?infoBox=5', '?infoBox=6', '?infoBox=7', '?infoBox=8', '?infoBox=9');
				 $url = str_replace($info_box_replace, '', ($_SERVER['REQUEST_URI']));
				 $url_category_ids = str_replace('-', '', strrchr (basename($_SERVER['REQUEST_URI']) , '-c-'));
				 $url_category_id = str_replace('_', '', strrchr (basename($_SERVER['REQUEST_URI']) , '_'));
				 if (!empty($url_category_id)) {
						 $url = str_replace($url_category_ids, '', $url);
				 $mobile_site = 'mobile_catalogue.php?cPath=' . $url_category_id;
				 } else {
				 $mobile_site = 'mobile_catalogue.php?cPath=' . $url_category_ids;
				 }
			 } elseif (strpos($_SERVER['REQUEST_URI'], '-m-') == TRUE) {
				 $mobile_site = 'mobile_catalogue.php';
			 } else {
				 $mobile_url = $_SERVER['REQUEST_URI'];
				 $url_pagename = basename($PHP_SELF);
				 $mobile_site = str_replace($url_pagename, 'mobile_' . $url_pagename, $mobile_url);
			 }
		 } else {
			 if (strpos($_SERVER['REQUEST_URI'], 'cPath=') == FALSE) {
				 $mobile_site = 'mobile_index.php';
			 } else {
				 $info_box_replace = array('infoBox=0&', 'infoBox=1&', 'infoBox=2&', 'infoBox=3&', 'infoBox=4&', 'infoBox=5&', 'infoBox=6&', 'infoBox=7&', 'infoBox=8&', 'infoBox=9&');
				 $url = str_replace($info_box_replace, '', $_SERVER['REQUEST_URI']);
				 $url_category_ids = str_replace('cPath=', '', strrchr ($_SERVER['REQUEST_URI'] , 'cPath='));
				 $url_category_id = (strpos($url_category_ids,'_') > 0) ? str_replace('_', '', strrchr ($_SERVER['REQUEST_URI'] , '_')) : str_replace('cPath=', '', strrchr ($_SERVER['REQUEST_URI'] , 'cPath='));
				 $url = str_replace($url_category_ids, '', $url);
				 $mobile_site = str_replace('index.php', 'mobile_catalogue.php', $url) . $url_category_id;
			 }
		 }
		 if ($mobile_site == DIR_WS_HTTP_CATALOG){
			 $mobile_site .= 'mobile_index.php';
		 }				
	 }

	 if (SEO_ENABLED == 'true') {
			 if (strpos($_SERVER['REQUEST_URI'], '-p-') == TRUE) {
				 $url_category_ids = str_replace('-', '', strrchr (basename($_SERVER['REQUEST_URI']) , '-p-'));
				 $mobile_site = 'mobile_product_info.php?products_id=' . $url_category_ids;
			 } elseif (strpos($_SERVER['REQUEST_URI'], '-pr-') == TRUE) {
				 $url_category_ids = str_replace('-', '', strrchr (basename($_SERVER['REQUEST_URI']) , '-pr-'));
				 $mobile_site = 'mobile_product_reviews.php?products_id=' . $url_category_ids;
		 }
}
if ($url_basename == 'featured_products.php') {
		 $mobile_site = str_replace('featured_products.php', 'mobile_index.php', $_SERVER['REQUEST_URI']);
}
if ($url_basename == 'recently_viewed.php') {
		 $mobile_site = str_replace('recently_viewed.php', 'mobile_index.php', $_SERVER['REQUEST_URI']);
}
if(isset($mobile_site)) {
$mobile_url = $mobile_site;
} else {
$mobile_url = $_SERVER['REQUEST_URI'];
$url_pagename = basename($PHP_SELF);
$mobile_url = str_replace($url_pagename, 'mobile_' . $url_pagename, $mobile_url);
}
define(DIR_MOBILE_CLASSES , 'mobile/includes/classes/');
require(DIR_MOBILE_CLASSES . 'mobile_redirect.php');
$mobileRedirect = new mobileRedirect;
}
//END : MOBILE iOSC REDIRECT_SCRIPT

 

Please give me feedback if this works, then I'll include this as a "workaround" for URL2.2d by CHEMO to the contribution support package.

 

 

For the text link in your login page:

 

You should use the "mobile session function".

Make shure you added the function as described in the install file step 4 to catalog/includes/functions/general.php

 

Then your text in the includes/languages/english/mobile_login.php language file(s) should show like this:

 

Please review our Privacy Policy.<a href="' . ((mobile_session() == true) ?FILENAME_MOBILE_PRIVACY: FILENAME_PRIVACY . '?redirectCancelled=true') . '"><u>Privacy Policy</u></a>.

 

For redirect links from classic pages which don't exist on the mobile site, there are examples in the MOBILE iOSC REDIRECT_SCRIPT in includes/application_top.php:

if ($url_basename == 'featured_products.php') {
		 $mobile_site = str_replace('featured_products.php', 'mobile_index.php', $_SERVER['REQUEST_URI']);
}

 

Just duplicate this code and replace "featured_products.php" with the page of your "classic" site and "mobile_index.php" with the page where you wants to link to in the mobile site.

 

Allthough the best solution would be to create the equivalent mobile pages.

 

For the information pages it is also possible to write a similar redirect code like for the product_info pages.

 

If you need further (commercial) help to integrate the mobile site, you can contact me here:

 

info@sarplataygemas.com

 

regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

Rainer,

You are awesome. That is all.

 

That redirect script works good so far. I'll work on the information pages today. Thank you very much!!


-Dave

Share this post


Link to post
Share on other sites

Rainer,

I'm finding some inconsistent products redirect results ... havent figured it out yet,

 

I'm seeing links like

 

/product_info.php?products_id=46.html&redirectCancelled=true&redirectCancelled=true

 

/mobile_product_info.php?products_id=46.html&redirectCancelled=true&redirectCancelled=true

 

/product_info.php?products_id=46.html&redirectCancelled=true&redirectCancelled=true&redirectCancelled=true

 

/mobile_product_info.php?products_id=46.html&redirectCancelled=true&redirectCancelled=true&redirectCancelled=true

 

with each consecutive click it grows.


-Dave

Share this post


Link to post
Share on other sites

Rainer,

I'm finding some inconsistent products redirect results ... havent figured it out yet,

 

I'm seeing links like

 

/product_info.php?products_id=46.html&redirectCancelled=true&redirectCancelled=true

 

/mobile_product_info.php?products_id=46.html&redirectCancelled=true&redirectCancelled=true

 

/product_info.php?products_id=46.html&redirectCancelled=true&redirectCancelled=true&redirectCancelled=true

 

/mobile_product_info.php?products_id=46.html&redirectCancelled=true&redirectCancelled=true&redirectCancelled=true

 

with each consecutive click it grows.

 

I know, I'll try to arrange this for the next update.

Even it is more a estetic than a functional problem.

I also supposed that a real customer would not toggle more than once between classic and mobile site.

Share this post


Link to post
Share on other sites

ok thank you for the good works..

 

Just uploaded the new contribution support which includes:

Ultimate SEO 2-2.2d-12 - by chemo

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

 

Hope it works good

 

regards

Rainer

Share this post


Link to post
Share on other sites

Just uploaded the new contribution support which includes:

Ultimate SEO 2-2.2d-12 - by chemo

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

 

Hope it works good

 

regards

Rainer

 

Rainer, Installed this today and everything seems to be workng well except for information.php.

 

Information pages in the infobox on the Classic side are redirecting to the Mobile side with links like:

http://www.domain.com/how-to-instructions-mi-2.html

 

I placed a link to an information page on the mobile side like this (is this correct way?)

echo tep_mobile_selection(tep_mobile_link(FILENAME_MOBILE_INFORMATION, 'info_id=2'), array(TEXT_INFOPAGE_INSTRUCTIONS)).'<div class="fleche"><img src="' . DIR_WS_HTTP_CATALOG . DIR_MOBILE_IMAGES . 'arrow_select.png" /></div>';

 

and the result are broken links, looking like:

http://www.domain.com/how-to-instructions2.html

 

Here is the site if you wish to check it out. Have I done something incorrectly? or is it a bug?

 

If I set SEO_ENABLED back to false, the informatiom pages on the mobile side work again, but the information links on the classic side are still broken. This would point to the seo_class file?

 

Thanks for any suggestions.

Edited by Roaddoctor

-Dave

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

×