diff --git a/assets/php/functions/functions.php b/assets/php/functions/functions.php index b8a1e94..bc4e03a 100644 --- a/assets/php/functions/functions.php +++ b/assets/php/functions/functions.php @@ -861,11 +861,19 @@ function loadPage(string $pathToFile) function load404Page() { - $dir = "../NFSFU-ECOMM\page-not-found.php"; + $dir = "page-not-found.php"; loadPage($dir); } +function loadProductNotFoundPage() +{ + $dir = 'product-not-found.php'; + loadPage($dir); + exit; +} + + function getContentsFromAFile( string $filePath ) { diff --git a/category.php b/category.php index cebc73a..c2285cf 100644 --- a/category.php +++ b/category.php @@ -19,8 +19,7 @@ if ( $checkIfRecordExist != 1 ) { - $dir = '../NFSFU-ECOMM/product-not-found.php'; - loadPage($dir); + loadProductNotFoundPage(); exit; } @@ -37,8 +36,7 @@ if ( $count === 0 ) { - $dir = '../NFSFU-ECOMM/product-not-found.php'; - loadPage($dir); + loadProductNotFoundPage(); exit; } diff --git a/product-details-page.php b/product-details-page.php index 8cf792d..b6b1b07 100644 --- a/product-details-page.php +++ b/product-details-page.php @@ -49,8 +49,7 @@ if ( $checkIfRecordExist != 1 ) { - $dir = '../NFSFU-ECOMM/product-not-found.php'; - loadPage($dir); + loadProductNotFoundPage(); exit; } @@ -74,8 +73,7 @@ ) { - $dir = '../NFSFU-ECOMM/product-not-found.php'; - loadPage($dir); + loadProductNotFoundPage(); exit; }