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); order[ 'products' ] ) ): foreach ( $this -> order[ 'products' ] as $product ):?> 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 @@
- Kobinacje produktu: product['languages'][ $this -> default_language ]['name'];?> + Kombinacje produktu: product['languages'][ $this -> default_language ]['name'];?>
Wstecz @@ -13,19 +13,17 @@ - - + product_permutations ) ): foreach ( $this -> product_permutations as $product ):?> - - + @@ -65,6 +63,7 @@
default_language ]['name'];?> +
    @@ -92,10 +91,90 @@ radioClass: 'iradio_minimal-blue' }); + // "Zaznacz wszystkie" per atrybut + $( '.select-all-attr' ).on( 'ifChanged', function() + { + var checked = $( this ).is( ':checked' ); + $( this ).closest( '.combination-attribute' ).find( '.g-checkbox' ).each( function() + { + $( this ).iCheck( checked ? 'check' : 'uncheck' ); + }); + }); + + // Inline save — SKU, ilość, cena + var fieldUrlMap = { + 'sku': '/admin/shop_product/product_combination_sku_save/', + 'quantity': '/admin/shop_product/product_combination_quantity_save/', + 'price': '/admin/shop_product/product_combination_price_save/' + }; + + $( 'body' ).on( 'change', '.combination-field', function() + { + var $input = $( this ); + var field = $input.data( 'field' ); + var data = { product_id: $input.data( 'product-id' ) }; + data[ field ] = $input.val(); + + $.ajax({ + type: 'POST', + cache: false, + url: fieldUrlMap[ field ], + data: data, + beforeSend: function() { + $( '#overlay' ).show(); + }, + success: function( data ) { + $( '#overlay' ).hide(); + var response = jQuery.parseJSON( data ); + if ( response.status === 'ok' ) { + $input.css( 'border-color', '#1cbb8c' ); + setTimeout( function() { $input.css( 'border-color', '' ); }, 1500 ); + } else { + $input.css( 'border-color', '#ff3d60' ); + setTimeout( function() { $input.css( 'border-color', '' ); }, 1500 ); + if ( response.msg ) create_error( response.msg ); + } + }, + error: function() { + $( '#overlay' ).hide(); + $input.css( 'border-color', '#ff3d60' ); + setTimeout( function() { $input.css( 'border-color', '' ); }, 1500 ); + } + }); + }); + + // Inline save — checkbox stock_0_buy (iCheck event) + $( 'body' ).on( 'ifChanged', '.combination-checkbox', function() + { + var $cb = $( this ); + + $.ajax({ + type: 'POST', + cache: false, + url: '/admin/shop_product/product_combination_stock_0_buy_save/', + data: { product_id: $cb.data( 'product-id' ), stock_0_buy: $cb.is( ':checked' ) }, + beforeSend: function() { + $( '#overlay' ).show(); + }, + success: function( data ) { + $( '#overlay' ).hide(); + var response = jQuery.parseJSON( data ); + if ( response.status !== 'ok' && response.msg ) { + create_error( response.msg ); + } + }, + error: function() { + $( '#overlay' ).hide(); + } + }); + }); + + // Usuwanie kombinacji — AJAX $( 'body' ).on( 'click', '.btn-delete-permutation', function(e) { e.preventDefault(); - var href = $( this ).attr( 'href' ); + var combinationId = $( this ).data( 'combination-id' ); + var $row = $( this ).closest( 'tr' ); $.alert( { @@ -119,14 +198,33 @@ text: 'Tak', btnClass: 'btn-danger', keys: ['enter'], - action: function() { - document.location.href = href; + action: function() + { + $.ajax({ + type: 'POST', + cache: false, + url: '/admin/shop_product/delete_combination_ajax/', + data: { combination_id: combinationId }, + beforeSend: function() { + $( '#overlay' ).show(); + }, + success: function( data ) { + $( '#overlay' ).hide(); + var response = jQuery.parseJSON( data ); + if ( response.status === 'ok' ) { + $row.fadeOut( 300, function() { $( this ).remove(); } ); + } else { + if ( response.msg ) create_error( response.msg ); + } + }, + error: function() { + $( '#overlay' ).hide(); + } + }); } } } }); - - return false; }); }); diff --git a/admin/templates/shop-product/product-edit-custom-script.php b/admin/templates/shop-product/product-edit-custom-script.php new file mode 100644 index 0000000..12a47f5 --- /dev/null +++ b/admin/templates/shop-product/product-edit-custom-script.php @@ -0,0 +1,631 @@ +product ?? null) ? $this->product : []; +$productId = (int)($product['id'] ?? 0); +$userId = (int)($this->user['id'] ?? 0); +$imagesCount = is_array($product['images'] ?? null) ? count($product['images']) : 0; +$filesCount = is_array($product['files'] ?? null) ? count($product['files']) : 0; + +$imageMaxPx = 1920; +if (isset($GLOBALS['settings']['image_px']) && (int)$GLOBALS['settings']['image_px'] > 0) { + $imageMaxPx = (int)$GLOBALS['settings']['image_px']; +} + +$uploadToken = bin2hex(random_bytes(24)); +if (!isset($_SESSION['upload_tokens']) || !is_array($_SESSION['upload_tokens'])) { + $_SESSION['upload_tokens'] = []; +} +$_SESSION['upload_tokens'][$uploadToken] = [ + 'user_id' => $userId, + 'expires' => time() + 60 * 20, +]; + +$cookieCategories = []; +if (!empty($_COOKIE['cookie_categories'])) { + $decoded = @unserialize($_COOKIE['cookie_categories']); + if (is_array($decoded)) { + $cookieCategories = $decoded; + } +} +?> + + + + + + + + + + + + + + + + + + diff --git a/admin/templates/shop-product/product-edit.php b/admin/templates/shop-product/product-edit.php index 8d1519c..30a07cc 100644 --- a/admin/templates/shop-product/product-edit.php +++ b/admin/templates/shop-product/product-edit.php @@ -1,1348 +1,6 @@ - - - - $this -> user['id'], - 'expires' => time() + 60*20 -]; - -$_SESSION['rfm_akey'] = bin2hex(random_bytes(16)); -$_SESSION['rfm_akey_expires'] = time() + 20*60; -$_SESSION['can_use_rfm'] = true; -$rfmAkeyJS = $_SESSION['rfm_akey']; - -ob_start(); -?> - -
    -
      -
    • Opis
    • -
    • Zakładki
    • -
    • Cena
    • -
    • Magazyn
    • -
    • Ustawienia
    • -
    • SEO
    • -
    • Wyświetlanie
    • -
    • Galeria
    • -
    • Załączniki
    • -
    • Produkty powiązane
    • -
    • XML
    • -
    • Dodatkowe pola
    • -
    • GPSR
    • -
    -
    -
    -
    -
      - languages)) : foreach ($this->languages as $lg) : ?> - -
    • '; ?>
    • - - -
    -
    - languages)) : foreach ($this->languages as $lg) : ?> - languages)) - foreach ($this->languages as $lg_tmp) - { - if ($lg_tmp['id'] != $lg['id']) - $languages[$lg_tmp['id']] = $lg_tmp['name']; - } - ?> - -
    - 'Wyświetlaj treść z wersji', - 'name' => 'copy_from[' . $lg['id'] . ']', - 'values' => $languages, - 'value' => $this->product['languages'][$lg['id']]['copy_from'], - ) - ); - ?> - 'Nazwa', - 'name' => 'name[' . $lg['id'] . ']', - 'id' => 'name_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['name'], - 'inline' => true - ) - ); - ?> - 'Komunikat gdy stan magazynowy równy 0', - 'name' => 'warehouse_message_zero[' . $lg['id'] . ']', - 'id' => 'warehouse_message_zero_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['warehouse_message_zero'], - 'inline' => true - ) - ); - ?> - 'Komunikat gdy stan magazynowy większy niż 0', - 'name' => 'warehouse_message_nonzero[' . $lg['id'] . ']', - 'id' => 'warehouse_message_nonzero_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['warehouse_message_nonzero'], - 'inline' => true - ) - ); - ?> - 'Krótki opis', - 'name' => 'short_description[' . $lg['id'] . ']', - 'id' => 'short_description_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['short_description'], - 'inline' => true - ) - ); - ?> - 'Opis', - 'name' => 'description[' . $lg['id'] . ']', - 'id' => 'description_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['description'], - 'inline' => true - ) - ); - ?> - -
    - - -
    -
    -
    -
    -
    -
    -
      - languages)) : foreach ($this->languages as $lg) : ?> - -
    • '; ?>
    • - - -
    -
    - languages)) : foreach ($this->languages as $lg) : ?> - languages)) - foreach ($this->languages as $lg_tmp) - { - if ($lg_tmp['id'] != $lg['id']) - $languages[$lg_tmp['id']] = $lg_tmp['name']; - } - ?> - -
    - 'Nazwa zakładki (1)', - 'name' => 'tab_name_1[' . $lg['id'] . ']', - 'id' => 'tab_name_1_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['tab_name_1'], - 'inline' => true - ) - ); - ?> - 'Zawartość zakładki (1)', - 'name' => 'tab_description_1[' . $lg['id'] . ']', - 'id' => 'tab_description_1_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['tab_description_1'], - 'inline' => true - ) - ); - ?> - 'Nazwa zakładki (2)', - 'name' => 'tab_name_2[' . $lg['id'] . ']', - 'id' => 'tab_name_2_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['tab_name_2'], - 'inline' => true - ) - ); - ?> - 'Zawartość zakładki (2)', - 'name' => 'tab_description_2[' . $lg['id'] . ']', - 'id' => 'tab_description_2_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['tab_description_2'], - 'inline' => true - ) - ); - ?> - -
    - - -
    -
    -
    -
    -
    - 'VAT (%)', - 'name' => 'vat', - 'id' => 'vat', - 'class' => 'int-format', - 'value' => $this->product['id'] ? $this->product['vat'] : 23, - 'onchange' => 'calculate_price_brutto(); return false;' - ) - ); - ?> - 'Cena netto (PLN)', - 'name' => 'price_netto', - 'id' => 'price_netto', - 'class' => 'number-format', - 'value' => $this->product['price_netto'], - 'onchange' => 'calculate_price_brutto(); return false;' - ) - ); - ?> - 'Cena brutto (PLN)', - 'name' => 'price_brutto', - 'id' => 'price_brutto', - 'class' => 'number-format', - 'value' => $this->product['price_brutto'], - 'onchange' => 'calculate_price_netto(); return false;' - ) - ); - ?> - 'Promocyjna cena netto (PLN)', - 'name' => 'price_netto_promo', - 'id' => 'price_netto_promo', - 'class' => 'number-format', - 'value' => $this->product['price_netto_promo'], - 'onchange' => 'calculate_price_brutto_promo(); return false;' - ) - ); - ?> - 'Promocyjna cena brutto (PLN)', - 'name' => 'price_brutto_promo', - 'id' => 'price_brutto_promo', - 'class' => 'number-format', - 'value' => $this->product['price_brutto_promo'], - 'onchange' => 'calculate_price_netto_promo(); return false;' - ) - ); - ?> - - units as $unit) - $units[$unit['id']] = $unit['text']; - ?> - 'Jednostka miary', - 'name' => 'product_unit', - 'id' => 'product_unit', - 'values' => $units, - 'value' => $this->product['product_unit_id'] - ]); ?> - 'Waga/pojemność', - 'name' => 'weight', - 'id' => 'weight', - 'class' => 'number-format', - 'value' => $this->product['weight'] - ]); ?> -
    -
    - 'Stan magazynowy', - 'name' => 'quantity', - 'id' => 'quantity', - 'class' => 'int-format', - 'value' => $this->product['quantity'] - ]); - ?> - 'Pozwól zamawiać gdy stan 0', - 'name' => 'stock_0_buy', - 'checked' => $this->product['stock_0_buy'] == 1 ? true : false - ]); - ?> - 'Współczynnik WP', - 'name' => 'wp', - 'id' => 'wp', - 'class' => 'number-format', - 'value' => $this->product['wp'] - ]); - ?> - 'Kod SKU', - 'name' => 'sku', - 'id' => 'sku', - 'value' => $this->product['sku'], - 'icon_content' => 'generuj', - 'icon_js' => 'generate_sku_code( ' . (int)$this->product['id'] . ' );' - ]); ?> - 'EAN', - 'name' => 'ean', - 'id' => 'ean', - 'value' => $this->product['ean'] - ]); ?> -
    -
    - 'Widoczny', - 'name' => 'status', - 'checked' => $this->product['status'] == 1 or !$this->product['id'] ? true : false - ]); - ?> - 'Promowany', - 'name' => 'promoted', - 'checked' => $this->product['promoted'] == 1 ? true : false - ]); - ?> - 'Nowość do dnia', - 'name' => 'new_to_date', - 'id' => 'new_to_date', - 'class' => 'date', - 'value' => $this->product['new_to_date'] - ]); - ?> - 'Wyświetlaj pole na dodatkową wiadomość', - 'name' => 'additional_message', - 'checked' => $this->product['additional_message'] == 1 ? true : false - ]); - ?> - 'Dodatkowa wiadomość jest wymagana', - 'name' => 'additional_message_required', - 'checked' => $this->product['additional_message_required'] == 1 ? true : false - ]); - ?> - 'Dodatkowa wiadomość (treść komunikatu)', - 'name' => 'additional_message_text', - 'id' => 'additional_message_text', - 'value' => $this->product['additional_message_text'] - ]); - ?> -
    -
    -
    -
      - languages)) : foreach ($this->languages as $lg) : ?> - -
    • '; ?>
    • - - -
    -
    - languages)) : foreach ($this->languages as $lg) : ?> - -
    - 'Link SEO', - 'name' => 'seo_link[' . $lg['id'] . ']', - 'id' => 'seo_link_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['seo_link'], - 'icon_content' => 'generuj', - 'icon_js' => 'generate_seo_links( "' . $lg['id'] . '", $( "#name_' . $lg['id'] . '" ).val(), ' . (int)$this->product['id'] . ' );' - ) - ); - ?> - 'Meta title', - 'name' => 'meta_title[' . $lg['id'] . ']', - 'id' => 'meta_title_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['meta_title'] - ]); ?> - 'Meta description', - 'name' => 'meta_description[' . $lg['id'] . ']', - 'id' => 'meta_description_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['meta_description'] - ) - ); - ?> - 'Meta keywords', - 'name' => 'meta_keywords[' . $lg['id'] . ']', - 'id' => 'meta_keywords_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['meta_keywords'] - ) - ); - ?> - 'Canonical', - 'name' => 'canonical[' . $lg['id'] . ']', - 'id' => 'canonical_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['canonical'] - ]); ?> -
    - - -
    -
    -
    -
    -
    - layouts)) : foreach ($this->layouts as $layout) : - $layouts[$layout['id']] = $layout['name']; - endforeach; - endif; - ?> - 'Szablon', - 'name' => 'layout_id', - 'id' => 'layout_id', - 'values' => $layouts, - 'value' => $this->product['layout_id'] - ]); - ?> -
    - -
    - -
    -
    -
    -
    -
    -
      - product['images'])) : foreach ($this->product['images'] as $img) : - ?> -
    • - - - - - -
    • - -
    -
    You browser doesn't have Flash installed.
    -
    -
    -
      - product['files'])) : foreach ($this->product['files'] as $file) : - - if ($file['name']) - $name = $file['name']; - else - { - $name = explode('/', $file['src']); - $name = $name[count($name) - 1]; - } - ?> -
    • -
      - - - - -
      -
    • - -
    -
    You browser doesn't have Flash installed.
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - - languages)) : foreach ($this->languages as $lg) : ?> - -
    - -
    - -
    -
    - - -
    -
    - 'Custom label 0', - 'name' => 'custom_label_0', - 'id' => 'custom_label_0', - 'value' => $this->product['custom_label_0'] - ]); - ?> - 'Custom label 1', - 'name' => 'custom_label_1', - 'id' => 'custom_label_1', - 'value' => $this->product['custom_label_1'] - ]); - ?> - 'Custom label 2', - 'name' => 'custom_label_2', - 'id' => 'custom_label_2', - 'value' => $this->product['custom_label_2'] - ]); - ?> - 'Custom label 3', - 'name' => 'custom_label_3', - 'id' => 'custom_label_3', - 'value' => $this->product['custom_label_3'] - ]); - ?> - 'Custom label 4', - 'name' => 'custom_label_4', - 'id' => 'custom_label_4', - 'value' => $this->product['custom_label_4'] - ]); - ?> -
    -
    - dodaj niestandardowe pole -
    - product['custom_fields'] ) ) : foreach ( $this->product['custom_fields'] as $field ):?> - -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - usuń -
    -
    -
    - -
    -
    -
    - producers as $producer) - $producers[$producer['id']] = $producer['name']; - ?> - 'Producent', - 'name' => 'producer_id', - 'id' => 'producer_id', - 'values' => $producers, - 'value' => $this->product['producer_id'] - ]); ?> -
    -
      - languages ) ): foreach ( $this -> languages as $lg ):?> - -
    • '; ?>
    • - - -
    -
    - languages ) ): foreach ( $this -> languages as $lg ):?> - -
    - 'Informacje o bezpieczeństwie ('.$lg['name'].')', - 'name' => 'security_information[' . $lg['id'] . ']', - 'id' => 'security_information_' . $lg['id'], - 'value' => $this->product['languages'][$lg['id']]['security_information'] - ] );?> -
    - - - -
    -
    -
    -
    -
    -
    -id = 'product-edit'; -$grid->gdb_opt = $gdb; -$grid->include_plugins = true; -$grid->title = $this->product['id'] ? 'Edycja produktu: ' . $this->product['languages'][\front\factory\Languages::default_language()]['name'] . '' : 'Edycja produktu'; -$grid->fields = [ - [ - 'db' => 'id', - 'type' => 'hidden', - 'value' => $this->product['id'] - ] -]; -$grid->actions = [ - 'save' => ['url' => '/admin/shop_product/save/', 'back_url' => '/admin/shop_product/view_list/'], - 'cancel' => ['url' => '/admin/shop_product/view_list/'] -]; -$grid->buttons = [ - [ - 'label' => 'Podgląd', - 'id' => 'product-preview', - 'url' => '#', - 'icon' => 'fa-search', - 'class' => 'btn-primary' - ] -]; -$grid->external_code = $out; -$grid->persist_edit = true; -$grid->id_param = 'id'; - -echo $grid->draw(); -?> - - - - - - - - - - - - - - - - - - + $this->form]); ?> + $this->product, + 'user' => $this->user, + 'languages' => $this->form->languages ?? [] +]); ?> diff --git a/admin/templates/shop-product/products-list-custom-script.php b/admin/templates/shop-product/products-list-custom-script.php new file mode 100644 index 0000000..7830c84 --- /dev/null +++ b/admin/templates/shop-product/products-list-custom-script.php @@ -0,0 +1,302 @@ + shoppro_enabled ):?> + + + + + + diff --git a/admin/templates/shop-product/products-list-table.php b/admin/templates/shop-product/products-list-table.php deleted file mode 100644 index a30306d..0000000 --- a/admin/templates/shop-product/products-list-table.php +++ /dev/null @@ -1,101 +0,0 @@ - current_page - 1 ) * 10 + 1;?> - products as $product ):?> -
- - - - - - - - apilo_enabled ):?> - - - - - - - show_xml_data ):?> - - - - - \ No newline at end of file diff --git a/admin/templates/shop-product/products-list.php b/admin/templates/shop-product/products-list.php index 4fabb32..db59fe1 100644 --- a/admin/templates/shop-product/products-list.php +++ b/admin/templates/shop-product/products-list.php @@ -1,603 +1,9 @@ -
-
- Dodaj produkt - - show_xml_data ):?> - Pokaż dane z XML - - Ukryj dane z XML - - shoppro_enabled ):?> - Pobierz produkt z shopPRO - -
-
-
-
Kombinacja SKU Stan magazynowy Cena nettoZam. SM 0Zam. przy braku Opcje
- + - + - + - onchange="$.ajax({ type: 'POST', cache: false, url: '/admin/shop_product/product_combination_stock_0_buy_save/', data: { product_id: , stock_0_buy: $( this ).is( ':checked' ) } } );"> + > - +
- - -
- - <?= $product['images'][0]['alt'];?> - - Brak zdjęcia - -
- - - SKU: , EAN: -
- - - - - tak' : 'nie';?> - - nie';?> - - - - " . mb_substr( $product['apilo_product_name'], 0, 25, "UTF-8" ) . "..."; - echo "
"; - echo ""; - echo "usuń powiązanie"; - echo ""; - } else { - echo ""; - echo "nie przypisano "; - echo ""; - } - ?> -
- '>kombinacje () - - '>edytuj - - ' class="product-delete">usuń -
-
- - - -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
-
-
- - - - - - - - - - apilo_enabled ):?> - - - - - - - - - - - - - + $this->viewModel]); ?> - - - - - - -
#NazwaCenaCena promocyjnaPromowanyAktywnyStan MGApiloKombinacjeEdytujArchiwizuj
- -
- -
-
-
-
- \ No newline at end of file +viewModel->customScriptView)): ?> + viewModel->customScriptView, [ + 'list' => $this->viewModel, + 'apilo_enabled' => $this->apilo_enabled, + 'shoppro_enabled' => $this->shoppro_enabled, + ]); ?> + diff --git a/admin/templates/shop-product/stock.php b/admin/templates/shop-product/stock.php deleted file mode 100644 index 20b974a..0000000 --- a/admin/templates/shop-product/stock.php +++ /dev/null @@ -1,70 +0,0 @@ - - - product -> permutations ) ) - { - foreach ( $this -> product -> permutations as $permutation ) - { - ?> -
- '; - echo '
'; - echo ''; - echo '
'; - echo '
'; - } - } - else - { - echo '
'; - echo ' '; - echo '
'; - echo ''; - echo '
'; - echo '
'; - } -?> - - id = 'stock'; -$grid -> gdb_opt = $gdb; -$grid -> include_plugins = true; -$grid -> title = 'Stany magazynowe: '.$this -> product -> language['name'].''; -$grid -> fields = [ - [ - 'db' => 'id', - 'type' => 'hidden', - 'value' => $this -> product -> id, - ], -]; -$grid -> actions = [ - 'save' => ['url' => '/admin/shop_product/stock_save/', 'back_url' => '/admin/shop_product/view_list/'], - 'cancel' => ['url' => '/admin/shop_product/view_list/'], - ]; -$grid -> external_code = $out; -$grid -> persist_edit = true; -$grid -> id_param = 'id'; - -echo $grid -> draw(); -?> - diff --git a/admin/templates/update/main-view.php b/admin/templates/update/main-view.php index d22a1db..a6a8a76 100644 --- a/admin/templates/update/main-view.php +++ b/admin/templates/update/main-view.php @@ -1,176 +1,129 @@ - - 'Twoja wersja systemu', - 'id' => 'ver', - 'text' => $this -> ver - ) - );?> - 'Aktualna wersja systemu', - 'text' => $this -> new_ver, - 'id' => 'new_ver' - ) - );?> - new_ver - $this -> ver ) * 1000; -?> -