Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I change the index.php page from showing "New Products" to a catagory


dabbuhl

Recommended Posts

Posted

I see in the index.php file has the following code:

 

// needed for the new products module shown below

$new_products_category_id = $current_category_id;

?>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

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

</tr>

</table></td>

</tr>

</table></td>

<?php

 

 

Is there a way to change the .FILENAME_NEW_PRODUCTS

to the catagory you want to show in place of the new products?

Posted

you can change

$current_category_id

to any category number you wish.

the category number you can find in the url ?cpath=21_88

in this case the current category is 88 and the parent category it 21

if the ?cpath=.. only shows you one figure there is no parent category and the shown number is the category you then want to use.

 

do mind to end the line with a ;

Posted
you can change
$current_category_id

to any category number you wish.

the category number you can find in the url ?cpath=21_88

in this case the current category is 88 and the parent category it 21

if the ?cpath=.. only shows you one figure there is no parent category and the shown number is the category you then want to use.

 

do mind to end the line with a ;

 

 

I brought up my store and the Christmas path on the browser is:

 

http://flagsdirect.net/index.php?cPath=22&...3b62769b46a71df

 

so would this be

?cpath=22

 

how would the html text be?

 

Please help

Posted

change

// needed for the new products module shown below
$new_products_category_id = $current_category_id;
?>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>
</tr>
</table></td>
</tr>
</table></td>
<?php

to

// needed for the new products module shown below
$new_products_category_id = 22;
?>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>
</tr>
</table></td>
</tr>
</table></td>
<?php

that's all folks

Posted
to
// needed for the new products module shown below
$new_products_category_id = 22;
?>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>
</tr>
</table></td>
</tr>
</table></td>
<?php

that's all folks

 

 

I tried this but there was no difference. Do you have to change

 

<?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?>

Posted

first I would read this post. Might contain a few tips for your site :-"

 

secondly that alteration changes your new products to the new products as shown here

 

if you want to show the categories of the cristmas categorie instead you will then want to edit a different part, in fact this would change the entire default page to be the christmas categorie page, and add a few lines for the welcome page just for this instance:

  if (isset($cPath) && tep_not_null($cPath)) {
$categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

$cateqories_products = tep_db_fetch_array($categories_products_query);
if ($cateqories_products['total'] > 0) {
  $category_depth = 'products'; // display products
} else {
  $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
  $category_parent = tep_db_fetch_array($category_parent_query);
  if ($category_parent['total'] > 0) {
	$category_depth = 'nested'; // navigate through the categories
  } else {
	$category_depth = 'products'; // category has no products, but display the 'no products' message
  }
}
 }

to

  if (isset($cPath) && tep_not_null($cPath)) {
$categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

$cateqories_products = tep_db_fetch_array($categories_products_query);
if ($cateqories_products['total'] > 0) {
  $category_depth = 'products'; // display products
} else {
  $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
  $category_parent = tep_db_fetch_array($category_parent_query);
  if ($category_parent['total'] > 0) {
	$category_depth = 'nested'; // navigate through the categories
  } else {
	$category_depth = 'products'; // category has no products, but display the 'no products' message
  }
}
 } else {
	$cPath = 22;
	$category_depth = 'nested'; // navigate through the categories
	$current_category_id = 22;
	$defaultpage = 'True';
}

now we also have to add a few lines for in case our welcome page is to be served:

change

<?php
 if ($category_depth == 'nested') {

to

<?php
if($defaultpage = 'True'){
echo HEADING_TITLE . '<BR /><BR /><BR />' .  tep_customer_greeting(); 
}
 if ($category_depth == 'nested') {

 

this would be a hunch, could give a bug or two, have not tried it out, so do make a BACKUP

Posted

without any errors even, wow (I surprise myself sometimes :D )

but still the positioning of

if($defaultpage = 'True'){
echo HEADING_TITLE . '<BR /><BR /><BR />' .  tep_customer_greeting();
}

requires some attention, as well as the "HEADING_TITLE" being replaced by something a litle more apropriente (a bit less neat written, since now it will be fixed and not multilangual):

if($defaultpage = 'True'){
echo 'YOUR NEW WELCOME MESAGE HERE<BR /><BR /><BR />' .  tep_customer_greeting();
}

Posted

You can set the store to open at the category level by adding the cPath into /includes/application_top.php. Find this and enter the cPath number into the bolded bit:

 

// calculate category path

if (isset($HTTP_GET_VARS['cPath'])) {

$cPath = $HTTP_GET_VARS['cPath'];

} elseif (isset($HTTP_GET_VARS['products_id']) && !isset($HTTP_GET_VARS['manufacturers_id'])) {

$cPath = tep_get_product_path($HTTP_GET_VARS['products_id']);

} else {

$cPath = '';

}

Archived

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

×
×
  • Create New...