Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


bumbarash

Recommended Posts

@@whoolieshop, yes sure it's required.

To clear this a little bit up:

- the database modifications for mobile will add a configuration group and configuration sttings for mobile. They will not interfere with your existing store configuration and setup.

- However , as always before modifying the database, you should do a backup of your database before applying any modifications.

 

regards

Rainer

Edited by raiwa
Link to comment
Share on other sites

@@raiwa  Thanks, yes that changed things a lot and the store seems to have picked up the theme..

 

New question, I am able to create a new account via mobile but not login via mobile.

the buttons, text fields etc all show up under create account but they do not when you click account or sign in.

The only options visible on sign in are the classic view button and the main navigation.

 

http://whoolie.com/mobile/login.php

 

 

Also some product images are not showing up when on product_info.php, all images seem to appear when

For Example:

http://whoolie.com/mobile/product_info.php?products_id=43   <-- No photo

http://whoolie.com/mobile/product_info.php?products_id=80  <-- Works

 

All three of these are in the same category.

http://whoolie.com/mobile/product_info.php?products_id=96  <- Works

http://whoolie.com/mobile/product_info.php?products_id=101 <- No Photo

http://whoolie.com/mobile/product_info.php?products_id=104 <- Works 

 

No HTML is used for the product photos in the catalog, all products have at least two photos, one photo being common through most of them.

 

All photos show up as thumbnails in products.php properly.  Occasionally ill get a spinning wait icon in the center of the site which does not seem to go away unless I reload the page then select the product again.   Once I reload and select the product it pulls up the product info page, these seem to almost never load the product photo...   Is this a resize failure?

Link to comment
Share on other sites

Hello @@whoolieshop,

 

It seems you installed the wrong mobile version. On mobile you used the files for OsC 2.3.4 with jquery1.11 and colorbox :

<script src="ext/jquery/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="http://whoolie.com/ext/photoset-grid/jquery.photoset-grid.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://whoolie.com/ext/colorbox/colorbox.css" />
<script type="text/javascript" src="http://whoolie.com/ext/colorbox/jquery.colorbox-min.js"></script>

Your main store seems to be an older 2.3 version which uses jquery 1.8 and fancybox image box:

<link rel="stylesheet" type="text/css" href="ext/jquery/ui/redmond/jquery-ui-1.8.22.css" />
<script type="text/javascript" src="ext/jquery/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="ext/jquery/ui/jquery-ui-1.8.22.min.js"></script>

<script type="text/javascript">
// fix jQuery 1.8.0 and jQuery UI 1.8.22 bug with dialog buttons; http://bugs.jqueryui.com/ticket/8484
if ( $.attrFn ) { $.attrFn.text = true; }
</script>


<script type="text/javascript" src="ext/jquery/bxGallery/jquery.bxGallery.1.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="ext/jquery/fancybox/jquery.fancybox-1.3.4.css" />
<script type="text/javascript" src="ext/jquery/fancybox/jquery.fancybox-1.3.4.pack.js"></script>

That explains both problems:

The mobile login page uses the content modules included in OsC 2.3.4. If your main store is not 2.3.4 it doesn't use content modules.

The mobile 2.3.4 image box needs the correspondent version present in the main store. If your main version is older, you need the colorbox scripts to be added to mobile and another mobile header with the correct path to them.

 

Please use the mobile files and installation instructions for your exact main store version.

 

regards

Rainer

Edited by raiwa
Link to comment
Share on other sites

@@raiwa you are a wizard.   Thanks so much for helping me get this sorted out.

I think I have one final question.

 

I use auth . net for payment processing, is there something that needs to be updated in the payment module to send the user to the correct referrer/return url for the mobile site?  I don't see a place to set that under the admin panel, but like several of these problems perhaps I just missed something!

 

I am currently getting the following error:

(14) The referrer, relay response or receipt link URL is invalid.

 

I have logged into authorize.net and added the following urls as valid response/return urls.

 

http://whoolie.com/mobile_checkout_process.php     http://whoolie.com/mobile_checkout_success.php             http://www.whoolie.com/mobile_checkout_process.php     http://www.whoolie.com/mobile_checkout_success.php

 

Link to comment
Share on other sites

 

@@raiwa you are a wizard.   Thanks so much for helping me get this sorted out.

I think I have one final question.

 

I use auth . net for payment processing, is there something that needs to be updated in the payment module to send the user to the correct referrer/return url for the mobile site?  I don't see a place to set that under the admin panel, but like several of these problems perhaps I just missed something!

 

I am currently getting the following error:

(14) The referrer, relay response or receipt link URL is invalid.

 

I have logged into authorize.net and added the following urls as valid response/return urls.

 

http://whoolie.com/mobile_checkout_process.php     http://whoolie.com/mobile_checkout_success.php             http://www.whoolie.com/mobile_checkout_process.php     http://www.whoolie.com/mobile_checkout_success.php

 

@@whoolieshop, which exact module and version do you use?

Link to comment
Share on other sites

@@raiwa

 

Authorize.net Server Integration Method (SIM)

Version: 2.0

API Version: 3.1

 

The desktop side is working fine and accepting payments, the mobile site gives the error 14

Hello @@whoolieshop,

 

I do not use that payment module myself , do not have an account and no possibility to research it.

 

So I can only guess by coding:

 

1. In the payment module: catalog/includes/modules/payment/authorizenet_cc_sim.php, line 108 and 130, the "x_relay_url" and "x_cancel_url" is defined with the tep_href_link function, this means it should be correct defined for mobile url.

'x_relay_url' => tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false),
'x_cancel_url' => tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL'),
Make sure you did the modification of that function in: catalog/includes/functions/html_output.php. Installation instructions point 4.

 

2. Is there a response/return url added in your authorizenet account for the main store?

If yes, the correct mobile URL would be the same, just adding mobile/ to the URL.

If there is no URL defined there for the main store, you shouldn't need to define one neither for mobile.

 

For the URLs you added:

They are incorrect (old mobile version, not in use any more):

http://www.whoolie.com/mobile_checkout_success.php

http://www.whoolie.com/mobile_checkout_process.php

It should be:

http://www.whoolie.com/mobile/checkout_success.php

http://www.whoolie.com/mobile/checkout_process.php

or maybe only:

http://www.whoolie.com/mobile/

 

See also:

https://support.authorize.net/authkb/index?page=content&id=A601

 

regards

Rainer

Edited by raiwa
Link to comment
Share on other sites

@@raiwa  

 

The problem seemed to be that I used the old versions on my authorize.net allowed url's page.

adding

http://whoolie.com/mobile/checkout_success.php

http://whoolie.com/mobile/checkout_process.php

 

seems to have resolved the error.

 

http://www.whoolie.com/mobile/checkout_success.php

http://www.whoolie.com/mobile/checkout_process.php

alone were not enough i had to add both so anyone else who is looking to use this module should add BOTH to their authorize.net configuration.   I will run a test sale through it in a bit to confirm 100% that it is working.

Link to comment
Share on other sites

@@whoolieshop,

 

O.K., thank you. Please confirm and I'll add it to the instructions in the next update.

 

regards

Rainer

Link to comment
Share on other sites

@@raiwa

Okay just to confirm,   Authorize.net's SIM module seems to work just fine with the mobile version with no config changes or code modifications on the OSC side.

 

You will have to add the following urls to your response/relay url page on your authorize.net control panel to allow the customer to check out via the mobile site.

http://<yourstore.url>/mobile/checkout_process.php

http://<yourstore.url>/mobile/checkout_success.php

 

it is also advised (by authorize.net) to add the same url with the www. ahead of it but my particular configuration would not work with the www before the domain name alone, i had to add the domain without the www before it would stop giving the error.

 

Thanks for your help getting this set up, now just to get the mobile site looking the way I want!

 

*Edit*

 

On another note, what files can i safely delete from my server that were installed from the old version?  is everything now in the /mobile/ directory?    can I get rid of all the mobile_somefile.php in the root ?

Edited by whoolieshop
Link to comment
Share on other sites

@@raiwa

Okay just to confirm,   Authorize.net's SIM module seems to work just fine with the mobile version with no config changes or code modifications on the OSC side.

 

You will have to add the following urls to your response/relay url page on your authorize.net control panel to allow the customer to check out via the mobile site.

http://<yourstore.url>/mobile/checkout_process.php

http://<yourstore.url>/mobile/checkout_success.php

 

it is also advised (by authorize.net) to add the same url with the www. ahead of it but my particular configuration would not work with the www before the domain name alone, i had to add the domain without the www before it would stop giving the error.

 

Thanks for your help getting this set up, now just to get the mobile site looking the way I want!

 

*Edit*

 

On another note, what files can i safely delete from my server that were installed from the old version?  is everything now in the /mobile/ directory?    can I get rid of all the mobile_somefile.php in the root ?

@@whoolieshop,

 

yes, all actual mobile files are inside the "mobile/" directory.

 

There may be also some obsolete files in:

mobile/includes/classes/

mobile/includes/functions/

mobile/includes/modules/

mobile/includes/

 

Please compare with the original directories.

 

regards

Rainer

Link to comment
Share on other sites

I installed the cache modul for my regular shop and for the mobile version. For both shop and mobile the KISS contrib. It works well for my regular shop but for the mobile one it shows a path like this here... "../includes/modules/image_thumbnailer/thumbs/80x80_no_image_available_150_150.gif"

I don't know why there is a 'modules' in the link and either when I drop the modules the path is not valid. I just followed the instruction of the contrib.

 

KISS image thumbnailer

Link to comment
Share on other sites

I installed the cache modul for my regular shop and for the mobile version. For both shop and mobile the KISS contrib. It works well for my regular shop but for the mobile one it shows a path like this here... "../includes/modules/image_thumbnailer/thumbs/80x80_no_image_available_150_150.gif"

I don't know why there is a 'modules' in the link and either when I drop the modules the path is not valid. I just followed the instruction of the contrib.

 

KISS image thumbnailer

Kira @@Andromeda100,

 

Please read the Add-On Support.doc, Point 3.

 

Kiss thumbnailer may not work with mobile, I warmly recommend OPI image thumbnailer instead.

 

regards

Rainer

Link to comment
Share on other sites

For three hours now I have been trying to handle this redirect loop issue, now im throwing in the towel. If I Enable the Use of the mobile set I get a redirect loop despite what device I try to access it from. From each computer/device the url will read /?MredirectCancelled=true/ I'm working on OSC 2.3.3.3 and Mobile OSC 7.5.7.  I have cleared cookies, cache, forced reload and reinstalled from scratch twice. I cant decipher this one and could really use some assistance please @raiwa

Edited by breakbred101
Link to comment
Share on other sites

I figured out the redirect loop... Debugging can be so frustrating sometimes. Simple, easily overlooked syntax error. :

In. includes/application_top.php

 

change:

//BEGIN : MOBILE REDIRECT_SCRIPT    
	require(DIR_FS_MOBILE . 'includes/functions/devicelist.php');
	if ( MOBILE_SITE=='True'&& !defined('MOBILE_SESSION') ) {
	  require(DIR_FS_MOBILE . 'includes/classes/mobile_redirect.php');
	    if ( !strpos($_SERVER['REQUEST_URI'], 'checkout') )
			$mobileRedirect = new mobileRedirect;
	} elseif ( !strpos($_SERVER['REQUEST_URI'], 'checkout') ) {
	  require(DIR_FS_MOBILE . 'includes/classes/classic_redirect.php');
	  $mobileRedirect = new classicRedirect;
	}
//END : MOBILE REDIRECT_SCRIPT

TO:

//BEGIN : MOBILE REDIRECT_SCRIPT    
	require(DIR_FS_MOBILE . 'includes/functions/devicelist.php');
	if ( MOBILE_SITE=='true'&& !defined('MOBILE_SESSION') ) {
	  require(DIR_FS_MOBILE . 'includes/classes/mobile_redirect.php');
	    if ( !strpos($_SERVER['REQUEST_URI'], 'checkout') )
			$mobileRedirect = new mobileRedirect;
	} elseif ( !strpos($_SERVER['REQUEST_URI'], 'checkout') ) {
	  require(DIR_FS_MOBILE . 'includes/classes/classic_redirect.php');
	  $mobileRedirect = new classicRedirect;
	}
//END : MOBILE REDIRECT_SCRIPT

The specific mix up is "if ( MOBILE_SITE=='true'&& !defined('MOBILE_SESSION') ) {" with the capitalized T in "True", needs to be all lowercase.

 

@@raiwa

Link to comment
Share on other sites

I figured out the redirect loop... Debugging can be so frustrating sometimes. Simple, easily overlooked syntax error. :

In. includes/application_top.php

 

change:

//BEGIN : MOBILE REDIRECT_SCRIPT    
	require(DIR_FS_MOBILE . 'includes/functions/devicelist.php');
	if ( MOBILE_SITE=='True'&& !defined('MOBILE_SESSION') ) {
	  require(DIR_FS_MOBILE . 'includes/classes/mobile_redirect.php');
	    if ( !strpos($_SERVER['REQUEST_URI'], 'checkout') )
			$mobileRedirect = new mobileRedirect;
	} elseif ( !strpos($_SERVER['REQUEST_URI'], 'checkout') ) {
	  require(DIR_FS_MOBILE . 'includes/classes/classic_redirect.php');
	  $mobileRedirect = new classicRedirect;
	}
//END : MOBILE REDIRECT_SCRIPT

TO:

//BEGIN : MOBILE REDIRECT_SCRIPT    
	require(DIR_FS_MOBILE . 'includes/functions/devicelist.php');
	if ( MOBILE_SITE=='true'&& !defined('MOBILE_SESSION') ) {
	  require(DIR_FS_MOBILE . 'includes/classes/mobile_redirect.php');
	    if ( !strpos($_SERVER['REQUEST_URI'], 'checkout') )
			$mobileRedirect = new mobileRedirect;
	} elseif ( !strpos($_SERVER['REQUEST_URI'], 'checkout') ) {
	  require(DIR_FS_MOBILE . 'includes/classes/classic_redirect.php');
	  $mobileRedirect = new classicRedirect;
	}
//END : MOBILE REDIRECT_SCRIPT

The specific mix up is "if ( MOBILE_SITE=='true'&& !defined('MOBILE_SESSION') ) {" with the capitalized T in "True", needs to be all lowercase.

 

@@raiwa

@@breakbred101,

 

I'm sorry, I discovered this and thought I fixed it in the last mobile_db_setup_v4.php.

There was always used the capitalized version, the error is in the sql option function:

tep_cfg_select_option(array(\'true\', \'false\'),')

should be:

tep_cfg_select_option(array(\'True\', \'False\'),')

I know there is a bit a mix in these settings due to historic development. I didn't want to touch it for to unify.

I'll upload the fix, thank you.

Link to comment
Share on other sites

@@breakbred101,

 

New vesion 7.5.7r1 with mobile_db_setup_v4r1.php is uploaded. Run the new setup, it will fix the sql function. Please leave it in application_top.php set to "True", it's used in other places I believe.

Link to comment
Share on other sites

@@raiwa,

 

I know that an auto thumbnailer is addressed in the contributions documentation but how about this one. http://addons.oscommerce.com/info/8104

 

I'm getting an error of Warning: Division by zero in /.....com/includes/functions/html_output.php on line 130 when instantiating any tep_image function. The entire site wont display any image and automatically resorts to the allocated no_image.jpg even though the $src variable is correct.

// The HTML image wrapper function
// "On the Fly" Auto Thumbnailer using GD Library, servercaching and browsercaching
// Scales product images dynamically, resulting in smaller file sizes, and keeps
// proper image ratio. Used in conjunction with product_thumb.php t/n generator.
function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '', $zc='') {
  if ( (empty($src) || ($src == DIR_WS_IMAGES))  && (IMAGE_REQUIRED == 'false') ) {
      return false;
    }
  // if no file exists display the 'no image' file
  if (!is_file($src)) {
  $src = "images/no_image.jpg";
  
  }

    // Set default image variable and code 
    $image = '<img src="' . $src . '"';

    // Don't calculate if the image is set to a "%" width
    if (strstr($width,'%') == false || strstr($height,'%') == false) { 
        $dont_calculate = 0; 
    } else {
        $dont_calculate = 1;    
    }

    // Dont calculate if a pixel image is being passed (hope you dont have pixels for sale)
    if (!strstr($image, 'pixel')) {
        $dont_calculate = 0;
    } else {
        $dont_calculate = 1;
    }

    // Do we calculate the image size?
    if (CONFIG_CALCULATE_IMAGE_SIZE == "true" && !$dont_calculate) {

        // Get the image's information
        if ($image_size = @getimagesize($src)) { 

            $ratio = $image_size[1] / $image_size[0];

            // Set the width and height to the proper ratio
        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]; 
            }

            // Scale the image if not the original size
            if ($image_size[0] != $width || $image_size[1] != $height) {
                $rx = $image_size[0] / $width;
                $ry = $image_size[1] / $height;

                if ($rx < $ry) {
                    $width = intval($height / $ratio);
                } else {
                    $height = intval($width * $ratio);
                }

               $image = '<img src="' . tep_href_link('product_thumb.php', 'src=' . tep_output_string($src) . '&h='.$height.'&w='.$width) . '"';
            }

        } elseif (IMAGE_REQUIRED == 'false') { 
                return '';
        }
    }

    // Add remaining image parameters if they exist
    if ($width) {
        $image .= ' width="' . tep_output_string($width) . '"'; 
    } 

    if ($height) { 
        $image .= ' height="' . tep_output_string($height) . '"'; 
    } 
    
    if (tep_not_null($parameters)) $image .= ' ' . $parameters;

    $image .= ' border="0" alt="' . tep_output_string($alt) . '"';

    if (tep_not_null($alt)) {
        $image .= ' title="' . tep_output_string($alt) . '"';
    }

    $image .= '/>';   

    return $image; 
}

Link to comment
Share on other sites

@@breakbred101,

 

Please read the Add-On Support doc:

Chapter B 6. If there are hardcoded directories, example:

includes/classes/add_on_class.php

Change to:

DIR_WS_CLASSES . 'add_on_class.php'

Same for: DIR_WS_INCLUDES etc

 

In the case of the tep_image modification you should replace this:

.

 $src = "images/no_image.jpg";

with:

 $src = DIR_WS_IMAGES . "no_image.jpg";

Then check in the other involved files for the same issue.

 

regards

Rainer

 

PS: Why do you think you need that image thumbnailer?

Link to comment
Share on other sites

@@raiwa I hope all is well. It would seem I'm still having an issue with the stock google analytics header tag module (includes/modules/header_tags/ht_google_analytics.php)  on my mobile site.

 

The analytics code present when I look at the source of the classic site but NOT at the mobile site - that said.... I checked your 2.3.4 site and see the same issue.

 

In my header I have

<?php 
  $oscTemplate->buildBlocks();
?>

and

  echo $oscTemplate->getBlocks('header_tags');
?>
</head>

And then in my footer I have

<?php echo $oscTemplate->getBlocks('footer_scripts'); ?>
Link to comment
Share on other sites

 

@@raiwa I hope all is well. It would seem I'm still having an issue with the stock google analytics header tag module (includes/modules/header_tags/ht_google_analytics.php)  on my mobile site.

 

The analytics code present when I look at the source of the classic site but NOT at the mobile site - that said.... I checked your 2.3.4 site and see the same issue.

 

Hello Scott @@greasemonkey,

 

Thanks a lot. Yes, it is an important bug.

I had to modify the osc_template class for the new content modules introduced in 2.3.4 and that modification breaks the header tags for mobile.

Please do this change in includes/classes/osc_template.php:

Find line 94-97:

                if ( file_exists(((defined('MOBILE_SESSION')) ? DIR_MOBILE_MODULES : DIR_WS_MODULES) . $group . '/' . $class . '.php') ) {
                  include(((defined('MOBILE_SESSION')) ? DIR_MOBILE_MODULES : DIR_WS_MODULES) . $group . '/' . $class . '.php');
                }
              }

Change to:

                if ( file_exists(((defined('MOBILE_SESSION')) ? DIR_MOBILE_MODULES : DIR_WS_MODULES) . $group . '/' . $class . '.php') ) {
                  include(((defined('MOBILE_SESSION')) ? DIR_MOBILE_MODULES : DIR_WS_MODULES) . $group . '/' . $class . '.php');
                } else {
                  if ( file_exists(DIR_WS_MODULES . $group . '/' . $class . '.php') ) {
                    include(DIR_WS_MODULES . $group . '/' . $class . '.php');
                  }
                }
              }

Please confirm.

 

best regards

Rainer

Link to comment
Share on other sites

@@raiwa Hey Rainer, just one more small issue... since I was looking so closely at the page source.

 

It would seem my pinterest script is loading twice on mobile only. Any clue? I've done a search/fine of my entire file base for assets.pinterest and only fined the one instance (modified for mobile) in includes/module/social_bookmarks/sb_pinterest.php

<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-********-*']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>

<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script></body>
</html>
Edited by greasemonkey
Link to comment
Share on other sites

Scott @@greasemonkey,

 

Yes, I was thinking about.

Then we'll do something more simple:

Keep the old osc_template.php:

                if ( file_exists(((defined('MOBILE_SESSION')) ? DIR_MOBILE_MODULES : DIR_WS_MODULES) . $group . '/' . $class . '.php') ) {
                  include(((defined('MOBILE_SESSION')) ? DIR_MOBILE_MODULES : DIR_WS_MODULES) . $group . '/' . $class . '.php');
                }
              }

and place a copy of the header tags folder, with all header tags: includes/modules/header_tags/...

into: mobile/includes/modules/

 

that should do it.

 

Thank you

Rainer

Edited by raiwa
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...