Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

$cPath


Guest

Recommended Posts

Hi all,

 

I am playing with the site in order to better understand and customise it. I posted earlier about going straight to the categories page. Since then I have tried a few things. I found that if I modify the main index.php file like

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

$cPath=1;

 

// the following cPath references come from application_top.php

$category_depth = 'top';

if (isset($cPath) && tep_not_null($cPath)) {

 

then when i navigate to the page it displays the caregories as images in the main text area, which is exactly what i want. on the left hand side however in the category box the following errors are displayed.

 

Warning: Variable passed to reset() is not an array or object in c:\ibserver\www\oscommerce\catalog\includes\boxes\categories.php on line 95

 

Warning: Variable passed to each() is not an array or object in c:\ibserver\www\oscommerce\catalog\includes\boxes\categories.php on line 96

 

whilst ultimately I will remove this box i need to know if there will be any further ramifications. additionally i noticed that if i click on the category hardware the cPath id passed in the URL is 1. so how come the when i set it on the main index page it displays the actual top level categories whilst when passed by clicking on the hardware icon it takes us to the sub categories?

 

Hope someone can help me unravel this mystery

 

Thanks a lot

 

Ian

Link to comment
Share on other sites

Forcing cPath = 1 at this point will keep your store in category #1 forever. If you only have the one category this is fine, otherwise you have blocked access to all other categories (including subcategories). Even setting this as the default in application_top will likely cause problems.

 

If you only want to have this page as your start page, you could set up a .htaccess file so your default page is index.php?cPath=1. If that doesn't work for you, the best solution would be modifying the index.php page to show what you want it to. This page is complex so proceed with caution.

 

Regards

Jim

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

Link to comment
Share on other sites

Do it like this:

 

In index.php change:

 

$category_depth = 'top'

 

 

to:

 

 

$category_depth = 'nested'

 

 

around about line 87 change;

 

    if (isset($cPath) && strpos('_', $cPath)) {

 

to:

 

    if (isset($cPath) && ereg('_', $cPath)) {

 

 

Matti

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...