Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

php code logic help please!


tommy11011

Recommended Posts

Hello all,

 

I was wondering if someone could help me through a little bit of logic with the code. Basically, here is what I wish to do. I want to modify the code so the "new products" module only loads up on the home page. After the user clicks any link to get off the home page, the module should not be loaded for screen real estate reasons.

 

So the question is, what is a logical way to know when I am at the home page (code wise). I figure I could incorporate an if/else statement in there somewhere if I know what I'm looking for.

 

thanks.

Link to comment
Share on other sites

If you don't want it to show in a "home page" category page, then remove the code:

 

          <tr>
           <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>
         </tr>

 

About line 120 of index.php

 

If you had a Side Infobox which you only wanted to show in the home page, then:

 

if ((basename($PHP_SELF)) == FILENAME_DEFAULT) {
  your box goes here
}

 

Which you'd use in one of the side column files. Note, untested code - might work, might not.

Link to comment
Share on other sites

Well, hopefully you could elaborate a bit more. Here is the thing. I purchased a template for oscommerce.

 

both of new products links have been removed from index.php. The author chose to include new products by calling it from column_left.php

 

So far, I have unsucessfully been tinkering with $cPath variables. When it is on the home page, their is no value (not even 0). Any other link calls a cpath number of say 1, 2, etc..

 

I tried an if/else with NULL but no luck. Any help from any of you pro phpers would be great.

Link to comment
Share on other sites

In the first instance, you should ask the Template Vendor.

 

Sounds like you want to be checking the category depth using the $category_depth variable available in FILENAME_DEFAULT, and showing the box as appropriate.

 

Do you have a link to your site - it's diffcult to visualise exactly what you want...

Link to comment
Share on other sites

Well, I just solved my own problem. I don't know if this would be of help to anyone else, but I'll post the solution.

 

As I said, my new products is called from column_left.php

 

I added the following logic.

 

<?php

if ($cPath == null) {

include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);

}

 

Now my screen real estate is much bigger when shopping.

 

This probably won't be of much use to anyone because I have a unique template that displays new products vertically, next to the menu system unlike a default install.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...