Refactor product loading logic and update URL routing

- Refactored the product loading logic in the ShopProduct class to improve performance and readability.
- Updated the URL routing in the index.php file to handle redirects and routes based on the request URI.
- Added a new method in the S class to check if adding a redirect will create a cycle in the redirect map.
- Updated the S class to use the new method for adding redirects and generating URL routes.
- Removed unnecessary code related to generating .htaccess rules.
This commit is contained in:
2024-10-26 18:18:55 +02:00
parent faeb2e52e8
commit 7d0749d692
5 changed files with 167 additions and 744 deletions

View File

@@ -276,8 +276,7 @@ class ShopProduct
$response = [ 'status' => 'error', 'msg' => 'Podczas ładowania produktów wystąpił błąd. Proszę spróbować ponownie.' ];
\S::set_session( 'products_list_current_page', \S::get( 'current_page' ) );
if ( \S::get( 'query' ) )
\S::set_session( 'products_list_query', \S::get( 'query' ) );
\S::set_session( 'products_list_query', \S::get( 'query' ) );
if ( $products = \admin\factory\ShopProduct::ajax_products_list( \S::get_session( 'products_list_current_page' ), \S::get_session( 'products_list_query' ) ) ) {
$response = [
@@ -313,12 +312,9 @@ class ShopProduct
parse_str( $query, $query_array );
}
if ( \S::get( 'show_xml_data' ) === 'true' )
{
if ( \S::get( 'show_xml_data' ) === 'true' ) {
\S::set_session( 'show_xml_data', true );
}
else if ( \S::get( 'show_xml_data' ) === 'false' )
{
} else if ( \S::get( 'show_xml_data' ) === 'false' ) {
\S::set_session( 'show_xml_data', false );
}