Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

replace/edit index.php


dr71

Recommended Posts

Alright i've spent two days searching topics and using trial and error but to no avail. If anyone could offer some insight it would be very much appreciated.

 

Here's what i'm trying to do:

 

My index.php currently has my most recently added products on it and i would like to get rid of the products and simply have some text.

 

Here is how i have gone abot it:

 

1. I took a simple text page on my site (conditions.php) and made a copy and saved it as home.php

2. I edited the newly created home.php to look how i want my new index.php page to look

2a. I changed "require (DIR.....FILENAME_CONDITIONS)" to "require (DIR.....FILENAME_HOME)" in this newly created home.php file

3. I created and new file called home.php in includes/languages/english and added the text that i wanted

4. I added "define('FILENAME_HOME', 'home.php');" to my filenames.php file

 

So, then i could goto "mydomain.com/home.php" and i had a page that looked exactly how i want my new index.php to look

 

From there i was thinking that i could simply rename my index.php file to index_orig.php (so I have a backup of the original) and rename home.php to index.php

 

When i do that it ALMOST works as planned. When i go to www.mydomain.com the newly created index.php comes up and looks good BUT...

 

Here is the problem: The links to my categories in the left column no longer work.

When i click on them and the url changes to "mydomain.com/index.php?cPath=3" (or whatever the cPath may be) but that page doesn't display the products in that perticular category, it still displays the text that i created for the new index.php page.

 

 

It appears to me that my method in going about changing the index.php page is either missing something or was just simply the wrong way of going about it.

 

I hope that i explained my issue in a clear and concise way. Any suggestions from the great minds of community would be very much appreciated!

Link to comment
Share on other sites

Hi, I am not sure why you are going through all this trouble to change files and such. I would suggest just going into your catalog/includes/languages/english/index.php and changing text there.

 

As far as the new products on the page I believe you need to delete or comment out the following code in the catalog/index.php:

 

include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);

 

It seems much easier to me.

 

Let us know how you make out.

Link to comment
Share on other sites

If you want to keep what you have done, I think you have to change the following code in catalog/includes/filename.php

 

define('FILENAME_DEFAULT', 'index.php');

 

You need to change index.php to your new name. That should fix the not going to the categories I think. I am not a programmer, but I did change my index to something else, but it has been a long time now and my memory is poor.

 

Hope this helps!

Link to comment
Share on other sites

Hi Leslie,

 

Thank you for the help!

 

I have made some progress per your suggestions and yes simply deleting "include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);" was much easier than what i was donig.

 

I am now able to have my text displayed on the index.php page instead of the new products AND the links to my categories are working now, howerer when i do goto the category links it does display the appropirate products in that category BUT the text that i added to the index.php page is also displayed above the products.

 

I am not really a programmer by any means but i'm thinking of maybe some type of code that can do the following "IF cPath=0 THEN display text ELSE do not display text"

 

I am not sure if something like that would work or if there may be another way. Do you know? Anyone else?

 

In the mean time i will start seaching for some similar code that might work.

Link to comment
Share on other sites

  • 1 year later...

Hi Leslie,

 

Thank you for the help!

 

I have made some progress per your suggestions and yes simply deleting "include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);" was much easier than what i was donig.

 

I am now able to have my text displayed on the index.php page instead of the new products AND the links to my categories are working now, howerer when i do goto the category links it does display the appropirate products in that category BUT the text that i added to the index.php page is also displayed above the products.

 

I am not really a programmer by any means but i'm thinking of maybe some type of code that can do the following "IF cPath=0 THEN display text ELSE do not display text"

 

I am not sure if something like that would work or if there may be another way. Do you know? Anyone else?

 

In the mean time i will start seaching for some similar code that might work.

 

Hey there,

 

I want to do the same thing that you are aiming for. Did you figure out a way to remove the text in your categories from the index.php?

Link to comment
Share on other sites

I think you guys are making this way too complicated. Here is a suggestion for you.

 

1. Create a plain old html file (preferably php file) that has the contents that you want in a table. Save it as /catalog/includes/welcome.php

2. Open your /catalog/index.php and find (near bottom):

 

 } else { // default page
?>
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_default.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="main"><?php echo tep_customer_greeting(); ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_MAIN; ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td><?php include(DIR_WS_MODULES . FILENAME_FEATURED); ?></td>
         </tr>
<?php
   include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);
?>
       </table></td>
     </tr>
   </table></td>
<?php
 }
?>
<!-- body_text_eof //-->

 

It takes a littl html knowledge but you can straighten out the table structure and replace parts of this with your new welcome.php file, for example:

 

 } else { // default page
?>
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td>

require('includes/welcome.php);

        </td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="main"><?php echo tep_customer_greeting(); ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_MAIN; ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td><?php include(DIR_WS_MODULES . FILENAME_FEATURED); ?></td>
         </tr>
<?php
   include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);
?>
       </table></td>
     </tr>
   </table></td>
<?php
 }
?>
<!-- body_text_eof //-->

 

I took out the HEADING_TITLE code and those cartoon characters which was in an entire nested table and replaced it with my welcome.php file. Right below that code is the greeting, which includes the login or create a new account link, so if you change that it might be advisable to provide a link to do those things elsewhere. Then below that is a Featured products box which I used in place of the What's new for... box that comes with the stock osC.

 

It's really not that hard to do these things, its just that the code needs to be straightened out some in an editor so you can keep all those wicked nested tables straight. Easy if you are doing it for a single language, a little more difficult when using multiple languages.

 

This mod only affects the front page of the store. Nothing else.

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

I think you guys are making this way too complicated. Here is a suggestion for you.

 

1. Create a plain old html file (preferably php file) that has the contents that you want in a table. Save it as /catalog/includes/welcome.php

2. Open your /catalog/index.php and find (near bottom):

 

 } else { // default page
?>
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_default.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="main"><?php echo tep_customer_greeting(); ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_MAIN; ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td><?php include(DIR_WS_MODULES . FILENAME_FEATURED); ?></td>
         </tr>
<?php
   include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);
?>
       </table></td>
     </tr>
   </table></td>
<?php
 }
?>
<!-- body_text_eof //-->

 

It takes a littl html knowledge but you can straighten out the table structure and replace parts of this with your new welcome.php file, for example:

 

 } else { // default page
?>
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td>

require('includes/welcome.php);

        </td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="main"><?php echo tep_customer_greeting(); ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_MAIN; ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td><?php include(DIR_WS_MODULES . FILENAME_FEATURED); ?></td>
         </tr>
<?php
   include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);
?>
       </table></td>
     </tr>
   </table></td>
<?php
 }
?>
<!-- body_text_eof //-->

 

I took out the HEADING_TITLE code and those cartoon characters which was in an entire nested table and replaced it with my welcome.php file. Right below that code is the greeting, which includes the login or create a new account link, so if you change that it might be advisable to provide a link to do those things elsewhere. Then below that is a Featured products box which I used in place of the What's new for... box that comes with the stock osC.

 

It's really not that hard to do these things, its just that the code needs to be straightened out some in an editor so you can keep all those wicked nested tables straight. Easy if you are doing it for a single language, a little more difficult when using multiple languages.

 

This mod only affects the front page of the store. Nothing else.

 

Great, thank you for your reply.

 

I will give this a try. Slowly I am learning the ways of the coding and how it all links together through trial and error.

 

Thank you again!

Link to comment
Share on other sites

  • 2 weeks later...

C'mon. Spill your beans. We can't help unless you tell us what the problem is.

 

Well I'v always wanted to change index.php to another name as Product_Page.php, but the cPaths are always going to index.php?cPath

 

as you may see the in the link

 

http://www.inbreathe.co.uk/ProImpressions/Product_Page.php

 

I have changed my index page as a the home page and the Product_Page as my shopping pages

Link to comment
Share on other sites

Change the filename of index.php to whatever.php

Likewise for it's language file.

 

Change the filename of product_info.php to Product_page.php

Likewise for it's language file.

 

Then amend the two entires for FILENAME_DEFAULT and FILENAME_PRODUCT_INFO in /includes/configure.php

 

Assuming you are not using a crappy template, that is the extent of the changes you need to make.

Link to comment
Share on other sites

  • 4 weeks later...

I am needing some help with this as well. I have some knowledge of coding (HTML, CSS, etc) but PHP is foreign to me. My sister purchased a template to use with her OSCommerce store and assumed it was going to be easy for me to edit it (before talking to me).

 

Soooooooooo, long story short, I am trying to make the index page look similar to the Privacy Policy page. I understand how to remove the NEW PRODUCTS and UPCOMING PRODUCTS sections. The problem I am having is replacing it with something like on the Privacy Page (a title + section for paragraph/text).

 

Home Page: http://www.smearedink.com

 

Privacy Policy: http://smearedink.com/privacy.php

 

 

I don't want to replace the index page with the privacy policy page, just make it identical. I tried saving the policy page as index.php (before reading this thread) and the menu of products stopped working.

 

So if someone could lend me a helping hand by giving me instructions on this process, it would be appreciated. I'm not sure what coding you would need to see but if you let me know I can post it ASAP.

Link to comment
Share on other sites

  • 3 months later...

Well I found a thread that deal with what I want to do! Step one - Complete!!

 

I have one of the dreaded templates. I want to replace the "products" with a "welcome" message or even just a large .png or .jpg image.

 

I just cant find for the life of me where to remove/edit the php code in the index.php file. I have tried to follow the instructions from mdtaylorlrim above only to get fatal errors etc...

 

I will gladly post the index.php file if necessary.

 

Any help would be great. Please go easy on me! :'(

He who sits in jelly, has ass in jam.

Link to comment
Share on other sites

  • 8 months later...

Can someone please look at this and tell me what the #@$% I'm doing wrong:

1. Goto www.omgtoyz.com

2. Click on CAT - Body Jewelry

3. How do I remove the word Catagories and the big white space under it and move What's New up?

 

I have searched and have done lots of editing in the index.php and all I can do is remove the sub-cat images and sub-cat text. Please tell me how to remove the area all that used.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...