Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Different boxes on index and catalog pages


Guest

Recommended Posts

Posted

I am requiring different boxes to appear in the left column on different pages when being viewed.

 

Have created 2 more column_left files, naming them column_left_index and column_left_catagories.

 

What I am hoping to do is to have a unique box in the left column when the index page is viewed, a different unique box showing when the products pages are being viewed, and the other pages having the usual column_left options on the other pages.

 

No problem in creating a new box, nor is there a problem in getting the index.php file recognising the different column_left_index.php file.

 

My problem seems to be that the layout of the pages the products being viewed on is being dictated by the index.php file.

 

Is there a way to be able to separate the look of the categories pages from the index file.

 

Hope that is clear enough.

Posted

I think what you are asking is to display different things on the specific product info pages.

 

If this is so, look for the code

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

 

This controls what is displayed on your left column!!

Posted

If you put

 

if (substr(basename($PHP_SELF), 0, 12) != 'product_info') {

include(DIR_WS_BOXES . 'filename.php');

}

 

if (substr(basename($PHP_SELF), 0, 5) != 'index') {

include(DIR_WS_BOXES . 'filename.php');

}

 

Then it will check the name of the file referring it.

 

Top one is when you are actually viewing a product. The other is the main index page.

 

Putting that and any relevant filenames of boxes to call, will then show those boxes when if tha tpage is being viewed.

 

Or...

 

if (substr(basename($PHP_SELF), 0, 5) != 'index') {

include(DIR_WS_BOXES . 'filename1.php');

} else {

include(DIR_WS_BOXES . 'filename2.php');

include(DIR_WS_BOXES . 'filename3.php');

include(DIR_WS_BOXES . 'filename4.php');

}

 

 

will show filename1 on the index page and filename2,3 and 4 if it is not the index page.

Posted

Thanks for the replies guys.

 

Cudd1es,

 

I have tried both ways with no success.

 

I have placed the following in the column_left file:

 

if (substr(basename($PHP_SELF), 0, 12) != 'product_info') {
include(DIR_WS_BOXES . 'prices_summary.php');
}

if (substr(basename($PHP_SELF), 0, 5) != 'index') {
include(DIR_WS_BOXES . 'merchandisers.php');
}

and have tried:

 

if (substr(basename($PHP_SELF), 0, 5) != 'index') {
include(DIR_WS_BOXES . 'merchandisers.php');
} else {
include(DIR_WS_BOXES . 'prices_summary.php');
}

 

On both occasions, the Prices Summary box appears on the index page as well as the categories pages, and it is ignoring the merchandisers.php file. None of the public files have been renamed.

 

Is it me?

 

Thanks again for your responses.

Posted

Oops.

 

Sorry, I think I have confused myself for a moment.

 

First of all, the != means not equal.

 

So to display a page for equal to index, you need the ==

 

What the code does is the check the page name that you are on. So if you are on the index, it does one thing, if you are on a Product_info page, it does another.

 

Of course, it will depend on the specific page you are on and want to get to.

 

ie. Check the address bar. if it is index..... then it will show the index option. If it is something else, it will show the other option.

 

Not sure what you mean when you say none of the public files have been changed, are you running off your own server locally?

Posted

Yep, I am running test scripts and changes on localhost before uploading.

 

What I meant by no public files have been changed is that I have not renamed any default files.

 

I will give the alterations a go now.

 

Thanks. I didn't pick that error either.

Posted

Looks like Vger was right.

 

The categories are still shown on index.php with a different osCsid.

 

Product info and the others show the alternate box, but I do want it to show up when the categories/products are first viewed.

 

Will have to have a think about this.

 

Thanks mate

 

Edit. This has been a great help for another change I wanted to make.

Posted

So think along the next stage.

 

You obviously cannot use the basename any more, but then the osCsid is a variable.

 

eg. I have MS2.2

 

When I click on a category, I get the cPath (Category path) Come up.

 

So do a search for the variable.

 

if ($cPath == '') {

include(DIR_WS_BOXES . 'prices_summary.php');

} else {

include(DIR_WS_BOXES . 'merchandisers.php');

}

 

Is cPath has no content, ie, you are in the main index page, display prices.

If you have clicked on a category, show merchandisers...

 

(Changed the != to == this time...)

Posted

Perfect.

 

That was it.

 

I was trying to figure it out as well. Thought that was what had to be done. Was looking up how.

 

Thank you so much Jon.

Posted

No problems.

 

Still waiting for an answer to my problem.

 

Half wonders if it may be a feature in MS3 and wonders if someone would let me Beta test it....

Archived

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

×
×
  • Create New...