Home | Store | osCommerce Tutorials

osCommerce tep_get_path() Function

The osCommerce tep_get_path() function seems mainly used to append "cPath=" to the beginning of categories_id.

Let's play around osCommerce tep_get_path() function with some examples.

osCommerce tep_get_path() function example 1:

<?php

require('includes/application_top.php');

$categories_id = "1"; // Hardware

echo 'The path is: ' . tep_get_path ($categories_id);

?>

Save the file as tep_get_path_function_1.php.

Upload to the home directory (catalog folder) of osCommerce shop.

Access the URL of this file.

The output of the above typical PHP example should look like:

The path is: cPath=1

As you can see the "cPath=" is append before the categories_id.

osCommerce tep_get_path() function example 2:

<?php

require('includes/application_top.php');

$categories_id = "1_17"; // CDROM Drives

echo 'The path is: ' . tep_get_path ($categories_id);

?>

Save the file as tep_get_path_function_2.php.

Upload to the home directory (catalog folder) of osCommerce shop.

Access the URL of this file.

The output of the above typical PHP example should look like:

The path is: cPath=1_17

Same as example 1, the "cPath=" is also append before the categories_id.

You may wonder why the "cPath=" is append before the categories_id at this moment. We will discuss the osCommerce cPath in details in coming tutorials when study the codes tructure of osCommerce shop.