diff --git a/AGENTS.md b/AGENTS.md index cfa45b3..d444844 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -12,7 +12,7 @@ Gdy użytkownik napisze `KONIEC PRACY`, wykonaj kolejno: - `docs/FORM_EDIT_SYSTEM.md` - `docs/CHANGELOG.md` - `docs/TESTING.md` -3. Przygotowanie aktualizacji (ZIP, plik z usuwanymi plikami, plik SQL jeśli wymagany). +3. Przygotowanie aktualizacji zgodnie z plikiem UPDATE_INSTRUCTIONS.md (ZIP, plik z usuwanymi plikami, plik SQL jeśli wymagany). 4. Commit. 5. Push. @@ -31,4 +31,4 @@ To ma pomóc zachować spójność zmian i dokumentacji. ## INNE -Przejdźmy teraz do refaktoringu wszystkiego co związane z https://shoppro.project-dc.pl/admin/shop_product/mass_edit/, nowe widoki, klasy (usuwanie starych), poprawa routingu, przeszukanie innych klas pod względem zależności. Zapisz plan i przedstaw mi go a po akceptacji realizuj krok po kroku w trybie Human In The Loop \ No newline at end of file +Przejdźmy teraz do refaktoringu wszystkiego co związane z https://shoppro.project-dc.pl/admin/shop_product/, nowe widoki, klasy (usuwanie starych), poprawa routingu, przeszukanie innych klas pod względem zależności. Zapisz plan i przedstaw mi go a po akceptacji realizuj krok po kroku w trybie Human In The Loop \ No newline at end of file diff --git a/admin/ajax.php b/admin/ajax.php index 601c666..dc4fdbb 100644 --- a/admin/ajax.php +++ b/admin/ajax.php @@ -39,5 +39,4 @@ $mdb = new medoo( [ require_once 'ajax/shop-category.php'; require_once 'ajax/users.php'; -require_once 'ajax/shop.php'; ?> diff --git a/admin/ajax/shop.php b/admin/ajax/shop.php deleted file mode 100644 index 48af10e..0000000 --- a/admin/ajax/shop.php +++ /dev/null @@ -1,60 +0,0 @@ - 'error', 'msg' => 'Podczas zapisywania kolejności kategorii wystąpił błąd. Proszę spróbować ponownie.' ]; - - $categoryRepository = new \Domain\Category\CategoryRepository( $mdb ); - - if ( $categoryRepository->saveCategoriesOrder( \S::get( 'categories' ) ) ) - $response = [ 'status' => 'ok' ]; - - echo json_encode( $response ); - exit; -} - -if ( $a == 'product_file_delete' ) -{ - $response = [ 'status' => 'error', 'msg' => 'Podczas usuwania załącznika wystąpił błąd. Proszę spróbować ponownie.' ]; - - if ( \admin\factory\ShopProduct::delete_file( \S::get( 'file_id' ) ) ) - $response = [ 'status' => 'ok' ]; - - echo json_encode( $response ); - exit; -} - -if ( $a == 'product_file_name_change' ) -{ - $response = [ 'status' => 'error', 'msg' => 'Podczas zmiany nazwy załącznika wystąpił błąd. Proszę spróbować ponownie.' ]; - - if ( \admin\factory\ShopProduct::file_name_change( \S::get( 'file_id' ), \S::get( 'file_name' ) ) ) - $response = [ 'status' => 'ok' ]; - - echo json_encode( $response ); - exit; -} - -if ( $a == 'product_image_delete' ) -{ - $response = [ 'status' => 'error', 'msg' => 'Podczas usuwania zdjecia wystąpił błąd. Proszę spróbować ponownie.' ]; - - if ( \admin\factory\ShopProduct::delete_img( \S::get( 'image_id' ) ) ) - $response = [ 'status' => 'ok' ]; - - echo json_encode( $response ); - exit; -} diff --git a/admin/index.php b/admin/index.php index f621ef0..acf5f5c 100644 --- a/admin/index.php +++ b/admin/index.php @@ -89,8 +89,8 @@ $mdb = new medoo( [ $user = \S::get_session( 'user', true ); -\admin\Site::update(); -\admin\Site::special_actions(); +\admin\App::update(); +\admin\App::special_actions(); $domain = preg_replace( '/^www\./', '', $_SERVER['SERVER_NAME'] ); $cookie_name = 'admin_remember_' . str_replace( '.', '-', $domain ); @@ -102,7 +102,7 @@ if ( isset( $_COOKIE[$cookie_name] ) && !isset( $_SESSION['user'] ) ) if ($payload !== false && strpos($payload, '.') !== false) { list($json, $sig) = explode('.', $payload, 2); - $expected_sig = hash_hmac('sha256', $json, \admin\Site::APP_SECRET_KEY); + $expected_sig = hash_hmac('sha256', $json, \admin\App::APP_SECRET_KEY); if (hash_equals($expected_sig, $sig)) { @@ -135,5 +135,5 @@ if ( isset( $_COOKIE[$cookie_name] ) && !isset( $_SESSION['user'] ) ) ]); } -echo \admin\view\Page::show(); +echo \admin\App::render(); ?> diff --git a/admin/templates/shop-order/order-details.php b/admin/templates/shop-order/order-details.php index 33ab856..116cca1 100644 --- a/admin/templates/shop-order/order-details.php +++ b/admin/templates/shop-order/order-details.php @@ -160,7 +160,7 @@ $orderId = (int)($this -> order['id'] ?? 0);
if ( is_array( $this -> order[ 'products' ] ) ): foreach ( $this -> order[ 'products' ] as $product ):?> - if ( $id = \admin\factory\ShopProduct::get_product_parent_id( $product['product_id'] ) ) + if ( $id = ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->getParentId( $product['product_id'] ) ) $product_id = $id; else $product_id = $product['product_id']; diff --git a/admin/templates/shop-product/mass-edit-custom-script.php b/admin/templates/shop-product/mass-edit-custom-script.php index fef108d..dd09b8d 100644 --- a/admin/templates/shop-product/mass-edit-custom-script.php +++ b/admin/templates/shop-product/mass-edit-custom-script.php @@ -68,8 +68,8 @@ $.ajax({ type: 'POST', cache: false, - url: '/admin/ajax.php', - data: { a: 'cookie_categories', category_id: category_id } + url: '/admin/shop_category/cookie_categories/', + data: { category_id: category_id } }); } }); diff --git a/admin/templates/shop-product/product-combination.php b/admin/templates/shop-product/product-combination.php index 7d10f12..b46be5e 100644 --- a/admin/templates/shop-product/product-combination.php +++ b/admin/templates/shop-product/product-combination.php @@ -1,7 +1,7 @@| Kombinacja | SKU | Stan magazynowy | Cena netto | -Zam. SM 0 | +Zam. przy braku | Opcje | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| + | |||||||||||
| $attributes = explode( '|', $product['permutation_hash'] ); @@ -38,19 +36,19 @@ ?> | - + | - + | - + | - onchange="$.ajax({ type: 'POST', cache: false, url: '/admin/shop_product/product_combination_stock_0_buy_save/', data: { product_id: = $product['id'];?>, stock_0_buy: $( this ).is( ':checked' ) } } );"> + > | - + | ||||||
| - = $i++;?> - | -
-
- if ( $product['images'][0]['src'] ):?>
-
-
- = \admin\factory\ShopProduct::product_categories( $product['id'] );?>
- SKU: = $product['sku'];?>, EAN: = $product['ean'];?>
-
- endif;?>
- |
- - - | -- - | -- = $product['promoted'] ? 'tak' : 'nie';?> - | -- = $product['status'] ? 'tak' : 'nie';?> - | -- = (int)\admin\factory\shopProduct::get_product_quantity_list( $product['id'] );?> - | - if ( $this -> apilo_enabled ):?> -
-
- if ( $product['apilo_product_name'] != "" ) {
- echo "" . mb_substr( $product['apilo_product_name'], 0, 25, "UTF-8" ) . "...";
- echo " "; - echo ""; - echo "usuń powiązanie"; - echo ""; - } else { - echo ""; - echo "nie przypisano "; - echo ""; - } - ?> - |
- endif;?>
- - '>kombinacje (= \admin\factory\shopProduct::count_product_combinations( $product['id'] );?>) - | -- '>edytuj - | -- ' class="product-delete">usuń - | -|
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
- |||||||||||
| # | -Nazwa | -Cena | -Cena promocyjna | -Promowany | -Aktywny | -Stan MG | - if ( $this -> apilo_enabled ):?> -Apilo | - endif;?> -Kombinacje | -Edytuj | -Archiwizuj | -|
|---|---|---|---|---|---|---|---|---|---|---|---|
| - | - - | -- | |||||||||
| - - | -|||||||||||
0
/0
-= $this->ver; ?>
= $this->new_ver; ?>
+