Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Index not working/directing as it should?


MandyMarieB

Recommended Posts

Good morning!

 

I am having an issue with my index on my OsCommerce GoDaddy shop. (Version 2.3.4). I just recently installed a theme onto the page, and while it seems to be working nice... the only issue is, it seems to have done something to the index. When you go to the url, it gives you the template of the website... with no content on the main page. But if you add index.php to the url, then you get the content. And that's going to be an issue, of course, because we want the url itself to get you to the main page. We don't want to have to say "Oh, and add index.php" to the end, you know? ;)

 

I asked GoDaddy for help, and they said it was an OsCommerce concern. So just wanted to see if anyone here could help me out so I can get the url straightened out. Thank you!

Link to comment
Share on other sites

What do you mean by "get the template of the website"? What exactly do you see? is it the source code (PHP), an HTML page without CSS, or something else? If someone inserted a bad .htaccess entry for DirectoryIndex (not including index.php), I think you usually get a 404 error, although with GoDaddy anything is possible. Anyway, check your .htaccess to see if someone added a DirectoryIndex command, and if they did, does it include index.php in the list? The next thing to look at would be the "template" causing a bad <base> tag or something similar, preventing CSS from being loaded. Finally, did the template add something to .htaccess that might be interfering with sending .php files to the PHP interpreter? That could be it if you are seeing raw PHP code.

Link to comment
Share on other sites

You can try following

 

In your file catalog/includes/application_top.php, find following line

  $PHP_SELF = substr($req['path'], ($request_type == 'NONSSL') ? strlen(DIR_WS_HTTP_CATALOG) : strlen(DIR_WS_HTTPS_CATALOG));

Add after it following lines

    if (($_SERVER['SCRIPT_NAME'] == '/') || ($_SERVER['PHP_SELF'] == '/')) {
      $PHP_SELF = 'index.php';
    }
Link to comment
Share on other sites

Did you mean the Modular Front Page addon? If so, open each of the modules and find this code:

      if ($PHP_SELF == 'index.php' && $cPath == '') {

and replace with this:

      if (($PHP_SELF == 'index.php' || $PHP_SELF == '') && $cPath == '') {

@@burt  No need to be rude. I could go around trash-talking your code also, but i don't feel that's appropriate for this forum.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

@@kymation

 

The addon that I am thinking of is poor it's the one that adds textboxes into the admin area to allow pages to be updated that way - if that is yours I'd be surprised. I think it's called "define main page" or somesuch.

 

And, feel free to trash my code - most of the bootstrap has gone that way, thanks to some who supported that project - my code gets trashed, we look at alternatives, new and better code is added.

Link to comment
Share on other sites

@@burt  Sorry, I overreacted to your comment. I had forgotten that addon, and thought you were talking about mine. I really should wake up before posting.

 

I will critique your code if I think I have a better way to do it, but I'll be polite about it. I usually try to offer alternative code when I do that. Feel free to do the same to me; I'm always up for learning something new. Or even a reminder of something that I've forgotten.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

@@MandyMarieB  I'm not able to duplicate the issue on my test site, so I'm working in the dark here. Do you have a redirect in your .htaccess file to redirect index.php to root (blank)? It should look something like this:

  Options +FollowSymLinks
  RewriteEngine on

  RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
  RewriteRule ^index\.php$ http://www.example.com/   

Of course you need to replace example.com with your site name.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

That add-in to the HTAccess file did not work either. I did check the application_top file though, and found this:

 

 

 

// check support for register_globals
  if (function_exists('ini_get') && (ini_get('register_globals') == false) && (PHP_VERSION < 4.3) ) {
    exit('Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory. Please use PHP 4.3+ if register_globals cannot be enabled on the server.');
  }

 

Is that it?

Link to comment
Share on other sites

Looks to me you have broken something by installing an addon I see on the index page where does that come from it is not standard??

<!-- Text Main BOF -->
  <div class="contentText">
<center>Life can be stressful! We need a bit of heaven to melt that stress away.<br>So how about enjoying your own Heaven in a Cup?</center>
  </div>
<!-- Text Main EOF -->

Try first replacing your index with an original then we can see further

 

Regards

Joli

To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

The addon works fine maybe you put  the code in the wrong place it is only a very small change (1 x  line of code)

 

I would suggest you remove first until the problem is sorted no point in complicating things and if you have not any other modifications in your store replace the index with an original at least we can rule that out as the problem.

 

Regards

Joli

To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

Can you check if in your applcation_top.php file the error reporting is enabled? And display_errors to true on line 17 and 18?

 

Like here https://github.com/osCommerce/oscommerce2/blob/master/catalog/includes/application_top.php

If you can't access the error log then find this line in ./admin/includes/application_top.php at the very top

 

error_reporting(E_ALL & ~E_NOTICE);

 

And change it, temporarily, to:

 

error_reporting(E_ALL);

ini_set('display_errors', '1');

To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

I did check the application_top file though, and found this:

 

That's normal (though somewhat obsolete) code. By any chance are you running on an ancient version of PHP? You ought to be running on at least PHP 5.3, though 5.4 is preferred.

 

 

is it because I have my store in the root, and not in a 'catalog' folder?

 

Well, running in /catalog is much preferred (so that installation of other applications won't step on each others' toes), but it is possible to run in /. If that's where you have it running now, it's probably easier just to leave it there, at least until after the holiday rush.

 

Was this originally a vanilla 2.3.4 installation, or was it upgraded from some earlier version? If you started out at osC 2.2-something, you should reinstall 2.3.4 and start from there (hopefully your database was properly migrated, but back up everything just in case). You should be able to cleanly upgrade from 2.3 or later. Then, are your theme and all add-ons stated to work with 2.3.4? Were they installed against an earlier version of osC, and then osC upgraded, or did you have a vanilla 2.3.4 and added to that?

Link to comment
Share on other sites

Please add this line of code into includes/application_top.php, just before the last ?>, and then load your front page in your browser.

print 'Self: ' .  $PHP_SELF;

You should see a line of text in the top left corner -- copy and paste that text here.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...