Home | Store | osCommerce Tutorials

PHP Custom Functions of osCommerce Site

We already discussed how PHP custom function works in previous tutorial. It's time to see some of the PHP custom functions using in osCommerce site. We will focus on how to use the custom functions rather than studying the codes structure in this tutorial series.

Where are osCommerce Function Saved?

osCommerce custom functions are usually saved in the catalog/includes/functions directory as shown below.

osCommerce custom function

How osCommerce Custom Functions are Classified?

The osCommerce PHP custom functions are classified into different files inside the functions directory. For example:

  • the MySQL database functions, e.g. tep_db_connect() function, tep_db_query() function, tep_db_perform() function, tep_db_fetch_array() function, tep_db_num_rows() function, etc... are saved in database.php.
  • Those related with html output, e.g. tep_href_link() function, tep_image() function, tep_draw_separator() function, etc... are saved in html_output.php.
  • Other general functions, e.g. tep_round() function, tep_get_path() function, tep_rand() function, etc... are saved in general.php.

When Custom Functions Are Loaded into osCommerce Shop?

The osC PHP custom functions are loaded into osCommerce system when called. That's why the require('includes/application_top.php'); is placed in the first line of all osCommerce visual pages. Actually the application_top.php will boot up everything required to run the osCommerce shop. It can be illustrated into the following diagram:

osCommerce application_top.php and custom function

We will study some of the osCommerce custom functions in next tutorials.