Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Logoff and categories


colo

Recommended Posts

Posted

Hello

 

I would like to have something:

When I am login in user/customer of my shop I can shopping. When I would like to log off of my shop I get this screen logoff.php there is some text "Now you are logged off..."

and under the text is button Continnue.

The source of this button is like here

<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

and it is ok this link redirect to the main page of the shop but I would like to redirect to the first category of my shop eg. cPath=21.

How can I do this?

Posted

You need to create a method to identify the category to redirect. If you know the categories name then you coud execute a query to retrieve the categories_id and use it for the redirect. The button code itself in the checkout_success.php will be almost the same. Like

<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

 

The only difference is the cPath argument appended. So you need the cPath. That will also be easy to do it by creating a function. So here is a sample:

 

function tep_get_category_id($categories_name) {
global $languages_id;
$result = 0;
$categories_query = tep_db_query("select cd.categories_id from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.categories_name='" . $categories_name . "' and cd.language_id = '" . (int)$languages_id . "' limit 1");
if ($categories = tep_db_fetch_array($categories_query)) {
   $result = $categories['categories_id'];
}
return $result;
 }

 

and pass the categories name to it. The problem with this is that you do not get the parent categories. So you need to add recursion to get the full path.

 

It is not tested so backup your files before experimenting.

Archived

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

×
×
  • Create New...