Understand the Storefront Entrypoint (catalog/index.php)
masterThe catalog/index.php file serves as the primary entrypoint for the customer-facing storefront. It handles routing for different types of content based on the request state:
- Site Pages: If
OSCOM::hasSitePage()returns true, the system fetches a specific page file viaOSCOM::getSitePageFile()and renders it within the site template (top and bottom). - Category Navigation: If a category path (
$cPath) is provided, the system determines thecategory_depth:nested: The category contains sub-categories. The system renders the category name, description, and uses theindex_nestedtemplate content.products: The category contains products. The system builds a dynamic SQL query to list products based on configured columns (e.g.,PRODUCT_LIST_NAME,PRODUCT_LIST_PRICE) and renders theproduct_listing.phpcontent.
- Manufacturer Views: If
manufacturers_idis present in the GET parameters, the system displays products associated with that manufacturer. - Default Home Page: If no specific page or category is matched, it renders the default index content using the
indextemplate content.
Key Components Involved:
OSCOM: Core static methods for site page detection, configuration, and link generation.$oscTemplate: Handles template file retrieval (template_top.php,template_bottom.php) and content injection (getContent()).$OSCOM_Db: Used for prepared statements to fetch categories, products, and manufacturers.$OSCOM_Language: Manages language IDs and definition loading.$messageStack: Handles displaying user messages (e.g.,product_action).