Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 562495f120 | |||
| 9de4afec9a | |||
| 3a3c2adb47 | |||
| db7c881d36 | |||
| 1fc36e4403 | |||
| c0cdaaf638 | |||
| f2b2629d49 |
@@ -11,7 +11,10 @@ Gdy użytkownik napisze `KONIEC PRACY`, wykonaj kolejno:
|
||||
- `docs/FORM_EDIT_SYSTEM.md`
|
||||
- `docs/CHANGELOG.md`
|
||||
- `docs/TESTING.md`
|
||||
3. Przygotowanie aktualizacji zgodnie z plikiem docs/UPDATE_INSTRUCTIONS.md (ZIP, plik z usuwanymi plikami, plik SQL jeśli wymagany).
|
||||
3. Migracje SQL (jeśli były zmiany w bazie danych):
|
||||
- Plik: `migrations/{version}.sql` (np. `migrations/0.304.sql`)
|
||||
- **NIE** w `updates/` — build script sam wczyta z `migrations/`
|
||||
- Sprawdź czy plik istnieje i jest poprawnie nazwany przed commitem
|
||||
4. Commit.
|
||||
5. Push.
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ composer test
|
||||
|
||||
PHPUnit 9.6 via `phpunit.phar`. Bootstrap: `tests/bootstrap.php`. Config: `phpunit.xml`.
|
||||
|
||||
Current suite: **687 tests, 1971 assertions**.
|
||||
Current suite: **734 tests, 2080 assertions**.
|
||||
|
||||
### Creating Updates
|
||||
See `docs/UPDATE_INSTRUCTIONS.md` for the full procedure. Updates are ZIP packages in `updates/0.XX/`. Never include `*.md` files, `updates/changelog.php`, or root `.htaccess` in update ZIPs.
|
||||
@@ -208,7 +208,7 @@ $controller = new \admin\Controllers\ExampleController($repo);
|
||||
When user says **"KONIEC PRACY"**, execute in order:
|
||||
1. Run tests
|
||||
2. Update documentation if needed: `docs/DATABASE_STRUCTURE.md`, `docs/PROJECT_STRUCTURE.md`, `docs/FORM_EDIT_SYSTEM.md`, `docs/CHANGELOG.md`, `docs/TESTING.md`
|
||||
3. Prepare update package per `docs/UPDATE_INSTRUCTIONS.md`
|
||||
3. SQL migrations (if DB changes): place in `migrations/{version}.sql` (e.g. `migrations/0.304.sql`). **NOT** in `updates/` — build script reads from `migrations/` automatically
|
||||
4. Commit
|
||||
5. Push
|
||||
|
||||
|
||||
229
admin/layout/style-css/order-details-mobile.css
Normal file
229
admin/layout/style-css/order-details-mobile.css
Normal file
@@ -0,0 +1,229 @@
|
||||
/* ==========================================================================
|
||||
Order Details — Mobile Responsive
|
||||
Scoped to .od-actions and .order-details
|
||||
All rules inside @media (max-width: 767px) — desktop layout untouched
|
||||
========================================================================== */
|
||||
|
||||
@media (max-width: 767px) {
|
||||
|
||||
/* --- 1. Action buttons bar --- */
|
||||
|
||||
.od-actions {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.od-actions .btn {
|
||||
flex-shrink: 0;
|
||||
font-size: 12px;
|
||||
padding: 6px 10px;
|
||||
margin-right: 0 !important;
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
/* Hide button labels on small screens — show only icons */
|
||||
.od-actions .od-actions-label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Integrations dropdown — push to end, cancel float */
|
||||
.od-actions .pull-right,
|
||||
.od-actions .dropdown.pull-right {
|
||||
float: none !important;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
/* Dropdown menu must not clip inside scroll container */
|
||||
.od-actions .dropdown {
|
||||
position: static;
|
||||
}
|
||||
|
||||
.od-actions + .order-details .dropdown-menu,
|
||||
#integrationsDropdownMenu.show {
|
||||
position: fixed;
|
||||
top: auto;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
border-radius: 12px 12px 0 0;
|
||||
box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
|
||||
z-index: 1060;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
#integrationsDropdownMenu.show .dropdown-item {
|
||||
padding: 12px 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* --- 2. Full-width columns stacking --- */
|
||||
|
||||
.order-details .col-sm-6,
|
||||
.order-details .col-lg-8,
|
||||
.order-details .col-lg-4,
|
||||
.order-details .col-xl-5,
|
||||
.order-details .col-xl-7 {
|
||||
width: 100%;
|
||||
flex: 0 0 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Spacing between stacked sections */
|
||||
.order-details .col-sm-6 {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
/* "Resend confirmation" button — allow text to wrap */
|
||||
.order-details .resend_order_confirmation_email .btn {
|
||||
font-size: 12px;
|
||||
white-space: normal;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* --- 3. Status section --- */
|
||||
|
||||
.order-details .status_select #order-status {
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.order-details .buttons {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.order-details .buttons .btn {
|
||||
width: 100%;
|
||||
white-space: normal;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.order-details .order-status {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.order-details .order-history {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* --- 4. Products table — compact list --- */
|
||||
|
||||
.order-details table thead {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.order-details table {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.order-details table tbody {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.order-details table tr.order-product-details {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
padding: 12px 0;
|
||||
border-bottom: 1px solid #eee;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.order-details table tr.order-product-details:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* Image cell */
|
||||
.order-details table td.product-image {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
flex-shrink: 0;
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin-right: 10px;
|
||||
float: none;
|
||||
}
|
||||
|
||||
.order-details table td.product-image img {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
/* Name cell — takes remaining space next to image */
|
||||
.order-details table tr.order-product-details td:nth-child(2) {
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
border: none;
|
||||
padding: 0;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.order-details table tr.order-product-details td:nth-child(2) a {
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
display: block;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
/* Hide quantity, price, discounted-price, total columns on mobile */
|
||||
.order-details table tr.order-product-details td.tab-center,
|
||||
.order-details table tr.order-product-details td.tab-right {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Show mobile price summary line */
|
||||
.od-mobile-price-line {
|
||||
display: block !important;
|
||||
margin-top: 4px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #2a3042;
|
||||
}
|
||||
|
||||
/* --- 5. Notes --- */
|
||||
|
||||
.order-details #notes {
|
||||
font-size: 14px;
|
||||
min-height: 120px;
|
||||
}
|
||||
|
||||
/* --- 6. Order summary panel --- */
|
||||
|
||||
.order-details .panel .panel-body {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* --- 7. Paid status --- */
|
||||
|
||||
.order-details .paid-status .panel-body a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
/* --- 8. Message section — hide empty spacer columns --- */
|
||||
|
||||
.order-details .d-none.d-lg-block {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* --- Desktop: action bar spacing (replaces mr5 class) --- */
|
||||
.od-actions .btn + .btn,
|
||||
.od-actions .btn + .dropdown {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
/* Mobile price line — hidden on desktop */
|
||||
.od-mobile-price-line {
|
||||
display: none;
|
||||
}
|
||||
@@ -57,6 +57,36 @@
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
/* --- Filter toggle --- */
|
||||
|
||||
.table-filters-wrapper {
|
||||
display: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-filters-wrapper.open {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.js-filter-toggle-btn.active {
|
||||
background-color: #e8e8e8;
|
||||
border-color: #adadad;
|
||||
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
|
||||
}
|
||||
|
||||
.table-filter-badge {
|
||||
display: inline-block;
|
||||
min-width: 16px;
|
||||
padding: 2px 5px;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
background-color: #337ab7;
|
||||
border-radius: 10px;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
/* --- Column visibility toggle --- */
|
||||
|
||||
.table-list-header-actions {
|
||||
|
||||
@@ -61,6 +61,10 @@ $_SESSION['can_use_rfm'] = true;
|
||||
<a href="<?= htmlspecialchars($action->url) ?>" class="btn btn-dark btn-sm" id="g-edit-cancel">
|
||||
<i class="fa fa-reply mr5"></i>Wstecz
|
||||
</a>
|
||||
<?php elseif ($action->name === 'preview'): ?>
|
||||
<a href="<?= htmlspecialchars($action->url) ?>" class="btn btn-info btn-sm" target="_blank">
|
||||
<i class="fa fa-eye mr5"></i><?= htmlspecialchars($action->label) ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a href="<?= htmlspecialchars($action->url) ?>" class="btn <?= htmlspecialchars($action->cssClass) ?> btn-sm">
|
||||
<?= htmlspecialchars($action->label) ?>
|
||||
|
||||
@@ -19,6 +19,14 @@ $totalPages = max(1, (int)($list->pagination['total_pages'] ?? 1));
|
||||
$total = (int)($list->pagination['total'] ?? 0);
|
||||
$perPage = (int)($list->pagination['per_page'] ?? 15);
|
||||
|
||||
$hasActiveFilters = false;
|
||||
foreach ($list->filters as $filter) {
|
||||
if (isset($filter['value']) && (string)$filter['value'] !== '') {
|
||||
$hasActiveFilters = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$isCompactColumn = function(array $column): bool {
|
||||
$key = strtolower(trim((string)($column['key'] ?? '')));
|
||||
$label = strtolower(trim((string)($column['label'] ?? '')));
|
||||
@@ -48,6 +56,14 @@ $isCompactColumn = function(array $column): bool {
|
||||
<div class="col-sm-4 text-right">
|
||||
<div class="table-list-header-actions">
|
||||
<span class="text-muted">Wyników: <?= $total; ?></span>
|
||||
<?php if (!empty($list->filters)): ?>
|
||||
<button type="button" class="btn btn-default btn-sm js-filter-toggle-btn<?= $hasActiveFilters ? ' active' : ''; ?>" title="Filtry">
|
||||
<i class="fa fa-filter"></i>
|
||||
<?php if ($hasActiveFilters): ?>
|
||||
<span class="badge badge-primary table-filter-badge"><?= count(array_filter($list->filters, function($f) { return isset($f['value']) && (string)$f['value'] !== ''; })); ?></span>
|
||||
<?php endif; ?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<div class="table-col-toggle-wrapper">
|
||||
<button type="button" class="btn btn-default btn-sm js-col-toggle-btn" title="Widoczność kolumn">
|
||||
<i class="fa fa-columns"></i>
|
||||
@@ -75,6 +91,7 @@ $isCompactColumn = function(array $column): bool {
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="js-table-filters-wrapper table-filters-wrapper<?= $hasActiveFilters ? ' open' : ''; ?>">
|
||||
<form method="get" action="<?= htmlspecialchars($list->basePath, ENT_QUOTES, 'UTF-8'); ?>" class="row mb15 js-table-filters-form">
|
||||
<?php foreach ($list->filters as $filter): ?>
|
||||
<?php
|
||||
@@ -148,6 +165,7 @@ $isCompactColumn = function(array $column): bool {
|
||||
<a href="<?= htmlspecialchars($list->basePath, ENT_QUOTES, 'UTF-8'); ?>" class="btn btn-default btn-sm">Wyczyść</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-striped table-bordered mbn table-list-table">
|
||||
@@ -469,5 +487,47 @@ $isCompactColumn = function(array $column): bool {
|
||||
saveHiddenCols([]);
|
||||
applyColumnVisibility([]);
|
||||
});
|
||||
|
||||
// --- Filter toggle ---
|
||||
var filterStorageKey = 'tableListFilters_' + <?= json_encode($list->basePath); ?>;
|
||||
|
||||
function isFilterVisible() {
|
||||
try {
|
||||
return localStorage.getItem(filterStorageKey) === '1';
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
function saveFilterState(visible) {
|
||||
try {
|
||||
localStorage.setItem(filterStorageKey, visible ? '1' : '0');
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
var $filterWrapper = $('.js-table-filters-wrapper');
|
||||
var $filterBtn = $('.js-filter-toggle-btn');
|
||||
var hasActiveFilters = $filterWrapper.hasClass('open');
|
||||
|
||||
if (!hasActiveFilters && isFilterVisible()) {
|
||||
$filterWrapper.addClass('open');
|
||||
$filterBtn.addClass('active');
|
||||
}
|
||||
|
||||
$(document).off('click.filterToggle', '.js-filter-toggle-btn');
|
||||
$(document).on('click.filterToggle', '.js-filter-toggle-btn', function() {
|
||||
var $wrapper = $('.js-table-filters-wrapper');
|
||||
var $btn = $(this);
|
||||
var isOpen = $wrapper.hasClass('open');
|
||||
|
||||
if (isOpen) {
|
||||
$wrapper.removeClass('open');
|
||||
$btn.removeClass('active');
|
||||
saveFilterState(false);
|
||||
} else {
|
||||
$wrapper.addClass('open');
|
||||
$btn.addClass('active');
|
||||
saveFilterState(true);
|
||||
}
|
||||
});
|
||||
})(window.jQuery);
|
||||
</script>
|
||||
|
||||
@@ -4,23 +4,23 @@ $orderId = (int)($this -> order['id'] ?? 0);
|
||||
|
||||
<div class="site-title">Szczegóły zamówienia: <?= htmlspecialchars((string)($this -> order['number'] ?? ''), ENT_QUOTES, 'UTF-8');?></div>
|
||||
|
||||
<div class="mb15">
|
||||
<a href="/admin/shop_order/list/" class="btn btn-dark btn-sm mr5">
|
||||
<i class="fa fa-reply"></i> Wstecz
|
||||
<div class="od-actions mb15">
|
||||
<a href="/admin/shop_order/list/" class="btn btn-dark btn-sm">
|
||||
<i class="fa fa-reply"></i> <span class="od-actions-label">Wstecz</span>
|
||||
</a>
|
||||
<a href="/admin/shop_order/order_edit/order_id=<?= $orderId;?>" class="btn btn-danger btn-sm mr5">
|
||||
<i class="fa fa-pencil"></i> Edytuj zamówienie
|
||||
<a href="/admin/shop_order/order_edit/order_id=<?= $orderId;?>" class="btn btn-danger btn-sm">
|
||||
<i class="fa fa-pencil"></i> <span class="od-actions-label">Edytuj</span>
|
||||
</a>
|
||||
|
||||
<? if ( $this -> prev_order_id ):?>
|
||||
<a href="/admin/shop_order/order_details/order_id=<?= (int)$this -> prev_order_id;?>" class="btn btn-success btn-sm mr5">
|
||||
<i class="fa fa-arrow-left"></i> Poprzednie zamówienie
|
||||
<a href="/admin/shop_order/order_details/order_id=<?= (int)$this -> prev_order_id;?>" class="btn btn-success btn-sm">
|
||||
<i class="fa fa-arrow-left"></i> <span class="od-actions-label">Poprzednie</span>
|
||||
</a>
|
||||
<? endif;?>
|
||||
|
||||
<? if ( $this -> next_order_id ):?>
|
||||
<a href="/admin/shop_order/order_details/order_id=<?= (int)$this -> next_order_id;?>" class="btn btn-success btn-sm mr5">
|
||||
<i class="fa fa-arrow-right"></i> Następne zamówienie
|
||||
<a href="/admin/shop_order/order_details/order_id=<?= (int)$this -> next_order_id;?>" class="btn btn-success btn-sm">
|
||||
<i class="fa fa-arrow-right"></i> <span class="od-actions-label">Następne</span>
|
||||
</a>
|
||||
<? endif;?>
|
||||
|
||||
@@ -183,6 +183,9 @@ $orderId = (int)($this -> order['id'] ?? 0);
|
||||
<div class="product-message">
|
||||
<?= $product[ 'message' ] != '' ? '<strong>Wiadomość:</strong> ' . $product['message'] : '';?>
|
||||
</div>
|
||||
<div class="od-mobile-price-line">
|
||||
<?= (int)$product['quantity'];?> × <?= \Shared\Helpers\Helpers::decimal( $product['price_brutto_promo'] );?> = <?= \Shared\Helpers\Helpers::decimal( $product['price_brutto_promo'] * $product['quantity'] );?> zł
|
||||
</div>
|
||||
</td>
|
||||
<td class="tab-center"><?= $product[ 'quantity' ];?></td>
|
||||
<td class="tab-right"><?= \Shared\Helpers\Helpers::decimal( $product[ 'price_brutto' ] );?> zł</td>
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<script type="text/javascript" src="/admin/js/functions.js"></script>
|
||||
<link rel="stylesheet" href="/admin/layout/style-css/style.css" />
|
||||
<link rel="stylesheet" href="/admin/layout/style-css/table-list.css" />
|
||||
<link rel="stylesheet" href="/admin/layout/style-css/order-details-mobile.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="admin-page">
|
||||
|
||||
@@ -534,6 +534,127 @@ class AttributeRepository
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Zwraca aktywne atrybuty z wartościami i wielojęzycznymi nazwami dla REST API.
|
||||
*
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
public function listForApi(): array
|
||||
{
|
||||
// 1. Get all active attribute IDs (1 query)
|
||||
$rows = $this->db->select('pp_shop_attributes', ['id', 'type', 'status'], [
|
||||
'status' => 1,
|
||||
'ORDER' => ['o' => 'ASC'],
|
||||
]);
|
||||
if (!is_array($rows) || empty($rows)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$attrIds = [];
|
||||
foreach ($rows as $row) {
|
||||
$id = (int)($row['id'] ?? 0);
|
||||
if ($id > 0) {
|
||||
$attrIds[] = $id;
|
||||
}
|
||||
}
|
||||
if (empty($attrIds)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// 2. Batch load ALL attribute translations (1 query)
|
||||
$allAttrTranslations = $this->db->select(
|
||||
'pp_shop_attributes_langs',
|
||||
['attribute_id', 'lang_id', 'name'],
|
||||
['attribute_id' => $attrIds]
|
||||
);
|
||||
$attrNamesMap = [];
|
||||
if (is_array($allAttrTranslations)) {
|
||||
foreach ($allAttrTranslations as $t) {
|
||||
$aId = (int)($t['attribute_id'] ?? 0);
|
||||
$langId = (string)($t['lang_id'] ?? '');
|
||||
if ($aId > 0 && $langId !== '') {
|
||||
$attrNamesMap[$aId][$langId] = (string)($t['name'] ?? '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Batch load ALL values for those attribute IDs (1 query)
|
||||
$allValueRows = $this->db->select(
|
||||
'pp_shop_attributes_values',
|
||||
['id', 'attribute_id', 'is_default', 'impact_on_the_price'],
|
||||
[
|
||||
'attribute_id' => $attrIds,
|
||||
'ORDER' => ['id' => 'ASC'],
|
||||
]
|
||||
);
|
||||
$valuesByAttr = [];
|
||||
$allValueIds = [];
|
||||
if (is_array($allValueRows)) {
|
||||
foreach ($allValueRows as $vRow) {
|
||||
$valueId = (int)($vRow['id'] ?? 0);
|
||||
$attrId = (int)($vRow['attribute_id'] ?? 0);
|
||||
if ($valueId > 0 && $attrId > 0) {
|
||||
$valuesByAttr[$attrId][] = $vRow;
|
||||
$allValueIds[] = $valueId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Batch load ALL value translations (1 query)
|
||||
$valueNamesMap = [];
|
||||
if (!empty($allValueIds)) {
|
||||
$allValueTranslations = $this->db->select(
|
||||
'pp_shop_attributes_values_langs',
|
||||
['value_id', 'lang_id', 'name'],
|
||||
['value_id' => $allValueIds]
|
||||
);
|
||||
if (is_array($allValueTranslations)) {
|
||||
foreach ($allValueTranslations as $vt) {
|
||||
$vId = (int)($vt['value_id'] ?? 0);
|
||||
$langId = (string)($vt['lang_id'] ?? '');
|
||||
if ($vId > 0 && $langId !== '') {
|
||||
$valueNamesMap[$vId][$langId] = (string)($vt['name'] ?? '');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Assemble result in-memory
|
||||
$result = [];
|
||||
foreach ($rows as $row) {
|
||||
$attributeId = (int)($row['id'] ?? 0);
|
||||
if ($attributeId <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$names = isset($attrNamesMap[$attributeId]) ? $attrNamesMap[$attributeId] : [];
|
||||
|
||||
$values = [];
|
||||
if (isset($valuesByAttr[$attributeId])) {
|
||||
foreach ($valuesByAttr[$attributeId] as $vRow) {
|
||||
$valueId = (int)$vRow['id'];
|
||||
$impact = $vRow['impact_on_the_price'];
|
||||
$values[] = [
|
||||
'id' => $valueId,
|
||||
'names' => isset($valueNamesMap[$valueId]) ? $valueNamesMap[$valueId] : [],
|
||||
'is_default' => (int)($vRow['is_default'] ?? 0),
|
||||
'impact_on_the_price' => ($impact !== null && $impact !== '') ? (float)$impact : null,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$result[] = [
|
||||
'id' => $attributeId,
|
||||
'type' => (int)($row['type'] ?? 0),
|
||||
'status' => (int)($row['status'] ?? 0),
|
||||
'names' => $names,
|
||||
'values' => $values,
|
||||
];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{sql: string, params: array<string, mixed>}
|
||||
*/
|
||||
|
||||
@@ -120,10 +120,16 @@ class PaymentMethodRepository
|
||||
'description' => trim((string)($data['description'] ?? '')),
|
||||
'status' => $this->toSwitchValue($data['status'] ?? 0),
|
||||
'apilo_payment_type_id' => $this->normalizeApiloPaymentTypeId($data['apilo_payment_type_id'] ?? null),
|
||||
'min_order_amount' => $this->normalizeDecimalOrNull($data['min_order_amount'] ?? null),
|
||||
'max_order_amount' => $this->normalizeDecimalOrNull($data['max_order_amount'] ?? null),
|
||||
];
|
||||
|
||||
$this->db->update('pp_shop_payment_methods', $row, ['id' => $paymentMethodId]);
|
||||
|
||||
$cacheHandler = new \Shared\Cache\CacheHandler();
|
||||
$cacheHandler->deletePattern('payment_method*');
|
||||
$cacheHandler->deletePattern('payment_methods*');
|
||||
|
||||
return $paymentMethodId;
|
||||
}
|
||||
|
||||
@@ -232,7 +238,9 @@ class PaymentMethodRepository
|
||||
spm.name,
|
||||
spm.description,
|
||||
spm.status,
|
||||
spm.apilo_payment_type_id
|
||||
spm.apilo_payment_type_id,
|
||||
spm.min_order_amount,
|
||||
spm.max_order_amount
|
||||
FROM pp_shop_payment_methods AS spm
|
||||
INNER JOIN pp_shop_transport_payment_methods AS stpm
|
||||
ON stpm.id_payment_method = spm.id
|
||||
@@ -325,6 +333,8 @@ class PaymentMethodRepository
|
||||
$row['description'] = (string)($row['description'] ?? '');
|
||||
$row['status'] = $this->toSwitchValue($row['status'] ?? 0);
|
||||
$row['apilo_payment_type_id'] = $this->normalizeApiloPaymentTypeId($row['apilo_payment_type_id'] ?? null);
|
||||
$row['min_order_amount'] = $this->normalizeDecimalOrNull($row['min_order_amount'] ?? null);
|
||||
$row['max_order_amount'] = $this->normalizeDecimalOrNull($row['max_order_amount'] ?? null);
|
||||
|
||||
return $row;
|
||||
}
|
||||
@@ -350,6 +360,23 @@ class PaymentMethodRepository
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
*/
|
||||
private function normalizeDecimalOrNull($value)
|
||||
{
|
||||
if ($value === null || $value === false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$text = trim((string)$value);
|
||||
if ($text === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (float)$text;
|
||||
}
|
||||
|
||||
private function toSwitchValue($value): int
|
||||
{
|
||||
if (is_bool($value)) {
|
||||
|
||||
@@ -508,6 +508,31 @@ class ProductRepository
|
||||
$params[':promoted'] = (int)$promotedFilter;
|
||||
}
|
||||
|
||||
// Attribute filters: attribute_{id} = {value_id}
|
||||
$attrFilters = isset($filters['attributes']) && is_array($filters['attributes']) ? $filters['attributes'] : [];
|
||||
$attrIdx = 0;
|
||||
foreach ($attrFilters as $attrId => $valueId) {
|
||||
$attrId = (int)$attrId;
|
||||
$valueId = (int)$valueId;
|
||||
if ($attrId <= 0 || $valueId <= 0) {
|
||||
continue;
|
||||
}
|
||||
$paramAttr = ':attr_id_' . $attrIdx;
|
||||
$paramVal = ':attr_val_' . $attrIdx;
|
||||
$where[] = "EXISTS (
|
||||
SELECT 1
|
||||
FROM pp_shop_products AS psp_var{$attrIdx}
|
||||
INNER JOIN pp_shop_products_attributes AS pspa{$attrIdx}
|
||||
ON pspa{$attrIdx}.product_id = psp_var{$attrIdx}.id
|
||||
WHERE psp_var{$attrIdx}.parent_id = psp.id
|
||||
AND pspa{$attrIdx}.attribute_id = {$paramAttr}
|
||||
AND pspa{$attrIdx}.value_id = {$paramVal}
|
||||
)";
|
||||
$params[$paramAttr] = $attrId;
|
||||
$params[$paramVal] = $valueId;
|
||||
$attrIdx++;
|
||||
}
|
||||
|
||||
$whereSql = implode(' AND ', $where);
|
||||
|
||||
$sqlCount = "
|
||||
@@ -681,18 +706,413 @@ class ProductRepository
|
||||
}
|
||||
}
|
||||
|
||||
// Attributes
|
||||
// Attributes (enriched with names) — batch-loaded
|
||||
$attributes = $this->db->select('pp_shop_products_attributes', ['attribute_id', 'value_id'], ['product_id' => $id]);
|
||||
$result['attributes'] = [];
|
||||
if (is_array($attributes)) {
|
||||
if (is_array($attributes) && !empty($attributes)) {
|
||||
$attrIds = [];
|
||||
$valueIds = [];
|
||||
foreach ($attributes as $attr) {
|
||||
$attrIds[] = (int)$attr['attribute_id'];
|
||||
$valueIds[] = (int)$attr['value_id'];
|
||||
}
|
||||
$attrNamesMap = $this->batchLoadAttributeNames($attrIds);
|
||||
$valueNamesMap = $this->batchLoadValueNames($valueIds);
|
||||
$attrTypesMap = $this->batchLoadAttributeTypes($attrIds);
|
||||
|
||||
foreach ($attributes as $attr) {
|
||||
$attrId = (int)$attr['attribute_id'];
|
||||
$valId = (int)$attr['value_id'];
|
||||
$result['attributes'][] = [
|
||||
'attribute_id' => (int)$attr['attribute_id'],
|
||||
'value_id' => (int)$attr['value_id'],
|
||||
'attribute_id' => $attrId,
|
||||
'attribute_type' => isset($attrTypesMap[$attrId]) ? $attrTypesMap[$attrId] : 0,
|
||||
'attribute_names' => isset($attrNamesMap[$attrId]) ? $attrNamesMap[$attrId] : [],
|
||||
'value_id' => $valId,
|
||||
'value_names' => isset($valueNamesMap[$valId]) ? $valueNamesMap[$valId] : [],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Variants (only for parent products)
|
||||
if (empty($product['parent_id'])) {
|
||||
$result['variants'] = $this->findVariantsForApi($id);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pobiera warianty produktu z atrybutami i tłumaczeniami dla REST API.
|
||||
*
|
||||
* @param int $productId ID produktu nadrzędnego
|
||||
* @return array Lista wariantów
|
||||
*/
|
||||
public function findVariantsForApi(int $productId): array
|
||||
{
|
||||
$stmt = $this->db->query(
|
||||
'SELECT id, permutation_hash, sku, ean, price_brutto, price_brutto_promo,
|
||||
price_netto, price_netto_promo, quantity, stock_0_buy, weight, status
|
||||
FROM pp_shop_products
|
||||
WHERE parent_id = :pid
|
||||
ORDER BY id ASC',
|
||||
[':pid' => $productId]
|
||||
);
|
||||
|
||||
$rows = $stmt ? $stmt->fetchAll(\PDO::FETCH_ASSOC) : [];
|
||||
if (!is_array($rows)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Collect all variant IDs, then load attributes in batch
|
||||
$variantIds = [];
|
||||
foreach ($rows as $row) {
|
||||
$variantIds[] = (int)$row['id'];
|
||||
}
|
||||
|
||||
// Load all attributes for all variants at once
|
||||
$allAttrsRaw = [];
|
||||
if (!empty($variantIds)) {
|
||||
$allAttrsRaw = $this->db->select('pp_shop_products_attributes', ['product_id', 'attribute_id', 'value_id'], ['product_id' => $variantIds]);
|
||||
if (!is_array($allAttrsRaw)) {
|
||||
$allAttrsRaw = [];
|
||||
}
|
||||
}
|
||||
|
||||
// Group by variant and collect unique IDs for batch loading
|
||||
$attrsByVariant = [];
|
||||
$allAttrIds = [];
|
||||
$allValueIds = [];
|
||||
foreach ($allAttrsRaw as $a) {
|
||||
$pid = (int)$a['product_id'];
|
||||
$aId = (int)$a['attribute_id'];
|
||||
$vId = (int)$a['value_id'];
|
||||
$attrsByVariant[$pid][] = ['attribute_id' => $aId, 'value_id' => $vId];
|
||||
$allAttrIds[] = $aId;
|
||||
$allValueIds[] = $vId;
|
||||
}
|
||||
|
||||
$attrNamesMap = $this->batchLoadAttributeNames($allAttrIds);
|
||||
$valueNamesMap = $this->batchLoadValueNames($allValueIds);
|
||||
|
||||
$variants = [];
|
||||
foreach ($rows as $row) {
|
||||
$variantId = (int)$row['id'];
|
||||
$variantAttrs = [];
|
||||
if (isset($attrsByVariant[$variantId])) {
|
||||
foreach ($attrsByVariant[$variantId] as $a) {
|
||||
$aId = $a['attribute_id'];
|
||||
$vId = $a['value_id'];
|
||||
$variantAttrs[] = [
|
||||
'attribute_id' => $aId,
|
||||
'attribute_names' => isset($attrNamesMap[$aId]) ? $attrNamesMap[$aId] : [],
|
||||
'value_id' => $vId,
|
||||
'value_names' => isset($valueNamesMap[$vId]) ? $valueNamesMap[$vId] : [],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$variants[] = [
|
||||
'id' => $variantId,
|
||||
'permutation_hash' => $row['permutation_hash'],
|
||||
'sku' => $row['sku'],
|
||||
'ean' => $row['ean'],
|
||||
'price_brutto' => $row['price_brutto'] !== null ? (float)$row['price_brutto'] : null,
|
||||
'price_brutto_promo' => $row['price_brutto_promo'] !== null ? (float)$row['price_brutto_promo'] : null,
|
||||
'price_netto' => $row['price_netto'] !== null ? (float)$row['price_netto'] : null,
|
||||
'price_netto_promo' => $row['price_netto_promo'] !== null ? (float)$row['price_netto_promo'] : null,
|
||||
'quantity' => (int)$row['quantity'],
|
||||
'stock_0_buy' => (int)($row['stock_0_buy'] ?? 0),
|
||||
'weight' => $row['weight'] !== null ? (float)$row['weight'] : null,
|
||||
'status' => (int)$row['status'],
|
||||
'attributes' => $variantAttrs,
|
||||
];
|
||||
}
|
||||
|
||||
return $variants;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pobiera pojedynczy wariant po ID dla REST API.
|
||||
*
|
||||
* @param int $variantId ID wariantu
|
||||
* @return array|null Dane wariantu lub null
|
||||
*/
|
||||
public function findVariantForApi(int $variantId): ?array
|
||||
{
|
||||
$row = $this->db->get('pp_shop_products', '*', ['id' => $variantId]);
|
||||
if (!$row || empty($row['parent_id'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$attrs = $this->db->select('pp_shop_products_attributes', ['attribute_id', 'value_id'], ['product_id' => $variantId]);
|
||||
$variantAttrs = [];
|
||||
if (is_array($attrs) && !empty($attrs)) {
|
||||
$attrIds = [];
|
||||
$valueIds = [];
|
||||
foreach ($attrs as $a) {
|
||||
$attrIds[] = (int)$a['attribute_id'];
|
||||
$valueIds[] = (int)$a['value_id'];
|
||||
}
|
||||
$attrNamesMap = $this->batchLoadAttributeNames($attrIds);
|
||||
$valueNamesMap = $this->batchLoadValueNames($valueIds);
|
||||
|
||||
foreach ($attrs as $a) {
|
||||
$aId = (int)$a['attribute_id'];
|
||||
$vId = (int)$a['value_id'];
|
||||
$variantAttrs[] = [
|
||||
'attribute_id' => $aId,
|
||||
'attribute_names' => isset($attrNamesMap[$aId]) ? $attrNamesMap[$aId] : [],
|
||||
'value_id' => $vId,
|
||||
'value_names' => isset($valueNamesMap[$vId]) ? $valueNamesMap[$vId] : [],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => (int)$row['id'],
|
||||
'parent_id' => (int)$row['parent_id'],
|
||||
'permutation_hash' => $row['permutation_hash'],
|
||||
'sku' => $row['sku'],
|
||||
'ean' => $row['ean'],
|
||||
'price_brutto' => $row['price_brutto'] !== null ? (float)$row['price_brutto'] : null,
|
||||
'price_brutto_promo' => $row['price_brutto_promo'] !== null ? (float)$row['price_brutto_promo'] : null,
|
||||
'price_netto' => $row['price_netto'] !== null ? (float)$row['price_netto'] : null,
|
||||
'price_netto_promo' => $row['price_netto_promo'] !== null ? (float)$row['price_netto_promo'] : null,
|
||||
'quantity' => (int)$row['quantity'],
|
||||
'stock_0_buy' => (int)($row['stock_0_buy'] ?? 0),
|
||||
'weight' => $row['weight'] !== null ? (float)$row['weight'] : null,
|
||||
'status' => (int)$row['status'],
|
||||
'attributes' => $variantAttrs,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Tworzy nowy wariant (kombinację) produktu przez API.
|
||||
*
|
||||
* @param int $parentId ID produktu nadrzędnego
|
||||
* @param array $data Dane wariantu (attributes, sku, ean, price_brutto, etc.)
|
||||
* @return array|null ['id' => int, 'permutation_hash' => string] lub null przy błędzie
|
||||
*/
|
||||
public function createVariantForApi(int $parentId, array $data): ?array
|
||||
{
|
||||
$parent = $this->db->get('pp_shop_products', ['id', 'archive', 'parent_id', 'vat'], ['id' => $parentId]);
|
||||
if (!$parent) {
|
||||
return null;
|
||||
}
|
||||
if (!empty($parent['archive'])) {
|
||||
return null;
|
||||
}
|
||||
if (!empty($parent['parent_id'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$attributes = isset($data['attributes']) && is_array($data['attributes']) ? $data['attributes'] : [];
|
||||
if (empty($attributes)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Build permutation hash
|
||||
ksort($attributes);
|
||||
$hashParts = [];
|
||||
foreach ($attributes as $attrId => $valueId) {
|
||||
$hashParts[] = (int)$attrId . '-' . (int)$valueId;
|
||||
}
|
||||
$permutationHash = implode('|', $hashParts);
|
||||
|
||||
// Check duplicate
|
||||
$existing = $this->db->count('pp_shop_products', [
|
||||
'AND' => [
|
||||
'parent_id' => $parentId,
|
||||
'permutation_hash' => $permutationHash,
|
||||
],
|
||||
]);
|
||||
if ($existing > 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$insertData = [
|
||||
'parent_id' => $parentId,
|
||||
'permutation_hash' => $permutationHash,
|
||||
'vat' => $parent['vat'] ?? 0,
|
||||
'sku' => isset($data['sku']) ? (string)$data['sku'] : null,
|
||||
'ean' => isset($data['ean']) ? (string)$data['ean'] : null,
|
||||
'price_brutto' => isset($data['price_brutto']) ? (float)$data['price_brutto'] : null,
|
||||
'price_netto' => isset($data['price_netto']) ? (float)$data['price_netto'] : null,
|
||||
'quantity' => isset($data['quantity']) ? (int)$data['quantity'] : 0,
|
||||
'stock_0_buy' => isset($data['stock_0_buy']) ? (int)$data['stock_0_buy'] : 0,
|
||||
'weight' => isset($data['weight']) ? (float)$data['weight'] : null,
|
||||
'status' => 1,
|
||||
];
|
||||
|
||||
$this->db->insert('pp_shop_products', $insertData);
|
||||
$variantId = (int)$this->db->id();
|
||||
if ($variantId <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Insert attribute rows
|
||||
foreach ($attributes as $attrId => $valueId) {
|
||||
$this->db->insert('pp_shop_products_attributes', [
|
||||
'product_id' => $variantId,
|
||||
'attribute_id' => (int)$attrId,
|
||||
'value_id' => (int)$valueId,
|
||||
]);
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $variantId,
|
||||
'permutation_hash' => $permutationHash,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Aktualizuje wariant produktu przez API.
|
||||
*
|
||||
* @param int $variantId ID wariantu
|
||||
* @param array $data Pola do aktualizacji
|
||||
* @return bool true jeśli sukces
|
||||
*/
|
||||
public function updateVariantForApi(int $variantId, array $data): bool
|
||||
{
|
||||
$variant = $this->db->get('pp_shop_products', ['id', 'parent_id'], ['id' => $variantId]);
|
||||
if (!$variant || empty($variant['parent_id'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$casts = [
|
||||
'sku' => 'string',
|
||||
'ean' => 'string',
|
||||
'price_brutto' => 'float_or_null',
|
||||
'price_netto' => 'float_or_null',
|
||||
'price_brutto_promo' => 'float_or_null',
|
||||
'price_netto_promo' => 'float_or_null',
|
||||
'quantity' => 'int',
|
||||
'stock_0_buy' => 'int',
|
||||
'weight' => 'float_or_null',
|
||||
'status' => 'int',
|
||||
];
|
||||
|
||||
$updateData = [];
|
||||
foreach ($casts as $field => $type) {
|
||||
if (array_key_exists($field, $data)) {
|
||||
$value = $data[$field];
|
||||
if ($type === 'string') {
|
||||
$updateData[$field] = ($value !== null) ? (string)$value : '';
|
||||
} elseif ($type === 'int') {
|
||||
$updateData[$field] = (int)$value;
|
||||
} elseif ($type === 'float_or_null') {
|
||||
$updateData[$field] = ($value !== null && $value !== '') ? (float)$value : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($updateData)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->db->update('pp_shop_products', $updateData, ['id' => $variantId]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Usuwa wariant produktu przez API.
|
||||
*
|
||||
* @param int $variantId ID wariantu
|
||||
* @return bool true jeśli sukces
|
||||
*/
|
||||
public function deleteVariantForApi(int $variantId): bool
|
||||
{
|
||||
$variant = $this->db->get('pp_shop_products', ['id', 'parent_id'], ['id' => $variantId]);
|
||||
if (!$variant || empty($variant['parent_id'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->db->delete('pp_shop_products_langs', ['product_id' => $variantId]);
|
||||
$this->db->delete('pp_shop_products_attributes', ['product_id' => $variantId]);
|
||||
$this->db->delete('pp_shop_products', ['id' => $variantId]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch-loads attribute names for multiple attribute IDs.
|
||||
*
|
||||
* @param int[] $attrIds
|
||||
* @return array<int, array<string, string>> [attrId => [langId => name]]
|
||||
*/
|
||||
private function batchLoadAttributeNames(array $attrIds): array
|
||||
{
|
||||
if (empty($attrIds)) {
|
||||
return [];
|
||||
}
|
||||
$translations = $this->db->select(
|
||||
'pp_shop_attributes_langs',
|
||||
['attribute_id', 'lang_id', 'name'],
|
||||
['attribute_id' => array_values(array_unique($attrIds))]
|
||||
);
|
||||
$result = [];
|
||||
if (is_array($translations)) {
|
||||
foreach ($translations as $t) {
|
||||
$aId = (int)($t['attribute_id'] ?? 0);
|
||||
$langId = (string)($t['lang_id'] ?? '');
|
||||
if ($aId > 0 && $langId !== '') {
|
||||
$result[$aId][$langId] = (string)($t['name'] ?? '');
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch-loads value names for multiple value IDs.
|
||||
*
|
||||
* @param int[] $valueIds
|
||||
* @return array<int, array<string, string>> [valueId => [langId => name]]
|
||||
*/
|
||||
private function batchLoadValueNames(array $valueIds): array
|
||||
{
|
||||
if (empty($valueIds)) {
|
||||
return [];
|
||||
}
|
||||
$translations = $this->db->select(
|
||||
'pp_shop_attributes_values_langs',
|
||||
['value_id', 'lang_id', 'name'],
|
||||
['value_id' => array_values(array_unique($valueIds))]
|
||||
);
|
||||
$result = [];
|
||||
if (is_array($translations)) {
|
||||
foreach ($translations as $t) {
|
||||
$vId = (int)($t['value_id'] ?? 0);
|
||||
$langId = (string)($t['lang_id'] ?? '');
|
||||
if ($vId > 0 && $langId !== '') {
|
||||
$result[$vId][$langId] = (string)($t['name'] ?? '');
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch-loads attribute types for multiple attribute IDs.
|
||||
*
|
||||
* @param int[] $attrIds
|
||||
* @return array<int, int> [attrId => type]
|
||||
*/
|
||||
private function batchLoadAttributeTypes(array $attrIds): array
|
||||
{
|
||||
if (empty($attrIds)) {
|
||||
return [];
|
||||
}
|
||||
$rows = $this->db->select(
|
||||
'pp_shop_attributes',
|
||||
['id', 'type'],
|
||||
['id' => array_values(array_unique($attrIds))]
|
||||
);
|
||||
$result = [];
|
||||
if (is_array($rows)) {
|
||||
foreach ($rows as $row) {
|
||||
$result[(int)$row['id']] = (int)($row['type'] ?? 0);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -2939,12 +3359,18 @@ class ProductRepository
|
||||
|
||||
$attributes = \Shared\Helpers\Helpers::removeDuplicates($attributes, 'id');
|
||||
|
||||
$sorted = [];
|
||||
$toSort = [];
|
||||
foreach ($attributes as $key => $val) {
|
||||
$row = [];
|
||||
$row['id'] = $key;
|
||||
$row['values'] = $val;
|
||||
$sorted[$attrRepo->getAttributeOrder((int) $key)] = $row;
|
||||
$toSort[] = ['order' => (int) $attrRepo->getAttributeOrder((int) $key), 'data' => $row];
|
||||
}
|
||||
usort($toSort, function ($a, $b) { return $a['order'] - $b['order']; });
|
||||
|
||||
$sorted = [];
|
||||
foreach ($toSort as $i => $item) {
|
||||
$sorted[$i + 1] = $item['data'];
|
||||
}
|
||||
|
||||
return $sorted;
|
||||
|
||||
@@ -182,6 +182,8 @@ class ShopPaymentMethodController
|
||||
'description' => (string)($paymentMethod['description'] ?? ''),
|
||||
'status' => (int)($paymentMethod['status'] ?? 0),
|
||||
'apilo_payment_type_id' => $paymentMethod['apilo_payment_type_id'] ?? '',
|
||||
'min_order_amount' => $paymentMethod['min_order_amount'] ?? '',
|
||||
'max_order_amount' => $paymentMethod['max_order_amount'] ?? '',
|
||||
];
|
||||
|
||||
$fields = [
|
||||
@@ -203,6 +205,16 @@ class ShopPaymentMethodController
|
||||
'tab' => 'settings',
|
||||
'rows' => 5,
|
||||
]),
|
||||
FormField::number('min_order_amount', [
|
||||
'label' => 'Min. kwota zamowienia (PLN)',
|
||||
'tab' => 'settings',
|
||||
'step' => 0.01,
|
||||
]),
|
||||
FormField::number('max_order_amount', [
|
||||
'label' => 'Maks. kwota zamowienia (PLN)',
|
||||
'tab' => 'settings',
|
||||
'step' => 0.01,
|
||||
]),
|
||||
FormField::select('apilo_payment_type_id', [
|
||||
'label' => 'Typ platnosci Apilo',
|
||||
'tab' => 'settings',
|
||||
|
||||
@@ -547,6 +547,11 @@ class ShopProductController
|
||||
FormAction::cancel( $backUrl ),
|
||||
];
|
||||
|
||||
if ( $productId > 0 ) {
|
||||
$previewUrl = $this->repository->getProductUrl( $productId );
|
||||
$actions[] = FormAction::preview( $previewUrl );
|
||||
}
|
||||
|
||||
return new FormEditViewModel(
|
||||
'product-edit',
|
||||
$title,
|
||||
|
||||
@@ -56,6 +56,22 @@ class FormAction
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Predefiniowana akcja Podgląd (otwiera w nowej karcie)
|
||||
*/
|
||||
public static function preview(string $url, string $label = 'Podgląd'): self
|
||||
{
|
||||
return new self(
|
||||
'preview',
|
||||
$label,
|
||||
$url,
|
||||
null,
|
||||
'btn btn-info',
|
||||
'link',
|
||||
['target' => '_blank']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Predefiniowana akcja Anuluj
|
||||
*/
|
||||
|
||||
@@ -92,13 +92,15 @@ class ApiRouter
|
||||
},
|
||||
'products' => function () use ($db) {
|
||||
$productRepo = new \Domain\Product\ProductRepository($db);
|
||||
return new Controllers\ProductsApiController($productRepo);
|
||||
$attrRepo = new \Domain\Attribute\AttributeRepository($db);
|
||||
return new Controllers\ProductsApiController($productRepo, $attrRepo);
|
||||
},
|
||||
'dictionaries' => function () use ($db) {
|
||||
$statusRepo = new \Domain\ShopStatus\ShopStatusRepository($db);
|
||||
$transportRepo = new \Domain\Transport\TransportRepository($db);
|
||||
$paymentRepo = new \Domain\PaymentMethod\PaymentMethodRepository($db);
|
||||
return new Controllers\DictionariesApiController($statusRepo, $transportRepo, $paymentRepo);
|
||||
$attrRepo = new \Domain\Attribute\AttributeRepository($db);
|
||||
return new Controllers\DictionariesApiController($statusRepo, $transportRepo, $paymentRepo, $attrRepo);
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace api\Controllers;
|
||||
|
||||
use api\ApiRouter;
|
||||
use Domain\Attribute\AttributeRepository;
|
||||
use Domain\ShopStatus\ShopStatusRepository;
|
||||
use Domain\Transport\TransportRepository;
|
||||
use Domain\PaymentMethod\PaymentMethodRepository;
|
||||
@@ -11,15 +12,18 @@ class DictionariesApiController
|
||||
private $statusRepo;
|
||||
private $transportRepo;
|
||||
private $paymentRepo;
|
||||
private $attrRepo;
|
||||
|
||||
public function __construct(
|
||||
ShopStatusRepository $statusRepo,
|
||||
TransportRepository $transportRepo,
|
||||
PaymentMethodRepository $paymentRepo
|
||||
PaymentMethodRepository $paymentRepo,
|
||||
AttributeRepository $attrRepo
|
||||
) {
|
||||
$this->statusRepo = $statusRepo;
|
||||
$this->transportRepo = $transportRepo;
|
||||
$this->paymentRepo = $paymentRepo;
|
||||
$this->attrRepo = $attrRepo;
|
||||
}
|
||||
|
||||
public function statuses(): void
|
||||
@@ -79,4 +83,15 @@ class DictionariesApiController
|
||||
|
||||
ApiRouter::sendSuccess($result);
|
||||
}
|
||||
|
||||
public function attributes(): void
|
||||
{
|
||||
if (!ApiRouter::requireMethod('GET')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$attributes = $this->attrRepo->listForApi();
|
||||
|
||||
ApiRouter::sendSuccess($attributes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,18 @@
|
||||
namespace api\Controllers;
|
||||
|
||||
use api\ApiRouter;
|
||||
use Domain\Attribute\AttributeRepository;
|
||||
use Domain\Product\ProductRepository;
|
||||
|
||||
class ProductsApiController
|
||||
{
|
||||
private $productRepo;
|
||||
private $attrRepo;
|
||||
|
||||
public function __construct(ProductRepository $productRepo)
|
||||
public function __construct(ProductRepository $productRepo, AttributeRepository $attrRepo)
|
||||
{
|
||||
$this->productRepo = $productRepo;
|
||||
$this->attrRepo = $attrRepo;
|
||||
}
|
||||
|
||||
public function list(): void
|
||||
@@ -25,6 +28,20 @@ class ProductsApiController
|
||||
'promoted' => isset($_GET['promoted']) ? $_GET['promoted'] : '',
|
||||
];
|
||||
|
||||
// Attribute filters: attribute_{id}={value_id}
|
||||
$attrFilters = [];
|
||||
foreach ($_GET as $key => $value) {
|
||||
if (strpos($key, 'attribute_') === 0) {
|
||||
$attrId = (int)substr($key, 10);
|
||||
if ($attrId > 0 && (int)$value > 0) {
|
||||
$attrFilters[$attrId] = (int)$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($attrFilters)) {
|
||||
$filters['attributes'] = $attrFilters;
|
||||
}
|
||||
|
||||
$sort = isset($_GET['sort']) ? $_GET['sort'] : 'id';
|
||||
$sortDir = isset($_GET['sort_dir']) ? $_GET['sort_dir'] : 'DESC';
|
||||
$page = max(1, (int)(isset($_GET['page']) ? $_GET['page'] : 1));
|
||||
@@ -90,6 +107,11 @@ class ProductsApiController
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_numeric($body['price_brutto']) || (float)$body['price_brutto'] < 0) {
|
||||
ApiRouter::sendError('BAD_REQUEST', 'price_brutto must be a non-negative number', 400);
|
||||
return;
|
||||
}
|
||||
|
||||
$formData = $this->mapApiToFormData($body);
|
||||
|
||||
$productId = $this->productRepo->saveProduct($formData);
|
||||
@@ -139,6 +161,141 @@ class ProductsApiController
|
||||
ApiRouter::sendSuccess($updated);
|
||||
}
|
||||
|
||||
public function variants(): void
|
||||
{
|
||||
if (!ApiRouter::requireMethod('GET')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$id = (int)(isset($_GET['id']) ? $_GET['id'] : 0);
|
||||
if ($id <= 0) {
|
||||
ApiRouter::sendError('BAD_REQUEST', 'Missing or invalid id parameter', 400);
|
||||
return;
|
||||
}
|
||||
|
||||
$product = $this->productRepo->find($id);
|
||||
if ($product === null) {
|
||||
ApiRouter::sendError('NOT_FOUND', 'Product not found', 404);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($product['parent_id'])) {
|
||||
ApiRouter::sendError('BAD_REQUEST', 'Cannot get variants of a variant product', 400);
|
||||
return;
|
||||
}
|
||||
|
||||
$variants = $this->productRepo->findVariantsForApi($id);
|
||||
|
||||
// Available attributes for this product
|
||||
$allAttributes = $this->attrRepo->listForApi();
|
||||
$usedAttrIds = [];
|
||||
foreach ($variants as $variant) {
|
||||
foreach ($variant['attributes'] as $a) {
|
||||
$usedAttrIds[(int)$a['attribute_id']] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$availableAttributes = [];
|
||||
foreach ($allAttributes as $attr) {
|
||||
if (isset($usedAttrIds[$attr['id']])) {
|
||||
$availableAttributes[] = $attr;
|
||||
}
|
||||
}
|
||||
|
||||
ApiRouter::sendSuccess([
|
||||
'product_id' => $id,
|
||||
'available_attributes' => $availableAttributes,
|
||||
'variants' => $variants,
|
||||
]);
|
||||
}
|
||||
|
||||
public function create_variant(): void
|
||||
{
|
||||
if (!ApiRouter::requireMethod('POST')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$parentId = (int)(isset($_GET['id']) ? $_GET['id'] : 0);
|
||||
if ($parentId <= 0) {
|
||||
ApiRouter::sendError('BAD_REQUEST', 'Missing or invalid id parameter', 400);
|
||||
return;
|
||||
}
|
||||
|
||||
$body = ApiRouter::getJsonBody();
|
||||
if ($body === null) {
|
||||
ApiRouter::sendError('BAD_REQUEST', 'Missing or invalid JSON body', 400);
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($body['attributes']) || !is_array($body['attributes'])) {
|
||||
ApiRouter::sendError('BAD_REQUEST', 'Missing or empty attributes', 400);
|
||||
return;
|
||||
}
|
||||
|
||||
$result = $this->productRepo->createVariantForApi($parentId, $body);
|
||||
if ($result === null) {
|
||||
ApiRouter::sendError('BAD_REQUEST', 'Cannot create variant: parent not found, is archived, is itself a variant, or combination already exists', 400);
|
||||
return;
|
||||
}
|
||||
|
||||
$variant = $this->productRepo->findVariantForApi($result['id']);
|
||||
|
||||
http_response_code(201);
|
||||
echo json_encode([
|
||||
'status' => 'ok',
|
||||
'data' => $variant !== null ? $variant : $result,
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
public function update_variant(): void
|
||||
{
|
||||
if (!ApiRouter::requireMethod('PUT')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$variantId = (int)(isset($_GET['id']) ? $_GET['id'] : 0);
|
||||
if ($variantId <= 0) {
|
||||
ApiRouter::sendError('BAD_REQUEST', 'Missing or invalid id parameter', 400);
|
||||
return;
|
||||
}
|
||||
|
||||
$body = ApiRouter::getJsonBody();
|
||||
if ($body === null) {
|
||||
ApiRouter::sendError('BAD_REQUEST', 'Missing or invalid JSON body', 400);
|
||||
return;
|
||||
}
|
||||
|
||||
$success = $this->productRepo->updateVariantForApi($variantId, $body);
|
||||
if (!$success) {
|
||||
ApiRouter::sendError('NOT_FOUND', 'Variant not found', 404);
|
||||
return;
|
||||
}
|
||||
|
||||
$variant = $this->productRepo->findVariantForApi($variantId);
|
||||
ApiRouter::sendSuccess($variant);
|
||||
}
|
||||
|
||||
public function delete_variant(): void
|
||||
{
|
||||
if (!ApiRouter::requireMethod('DELETE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$variantId = (int)(isset($_GET['id']) ? $_GET['id'] : 0);
|
||||
if ($variantId <= 0) {
|
||||
ApiRouter::sendError('BAD_REQUEST', 'Missing or invalid id parameter', 400);
|
||||
return;
|
||||
}
|
||||
|
||||
$success = $this->productRepo->deleteVariantForApi($variantId);
|
||||
if (!$success) {
|
||||
ApiRouter::sendError('NOT_FOUND', 'Variant not found', 404);
|
||||
return;
|
||||
}
|
||||
|
||||
ApiRouter::sendSuccess(['id' => $variantId, 'deleted' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mapuje dane z JSON API na format oczekiwany przez saveProduct().
|
||||
*
|
||||
|
||||
157
docs/API.md
157
docs/API.md
@@ -152,6 +152,7 @@ Parametry filtrowania (opcjonalne):
|
||||
| `search` | string | Szukaj po nazwie, EAN lub SKU |
|
||||
| `status` | int (0/1) | Filtruj po statusie (1 = aktywny, 0 = nieaktywny) |
|
||||
| `promoted` | int (0/1) | Filtruj po promocji |
|
||||
| `attribute_{id}` | int | Filtruj po atrybucie — `attribute_1=3` oznacza atrybut 1 = wartosc 3 (wiele filtrow AND) |
|
||||
| `sort` | string | Sortuj po: id, name, price_brutto, status, promoted, quantity (domyslnie id) |
|
||||
| `sort_dir` | string | Kierunek: ASC lub DESC (domyslnie DESC) |
|
||||
| `page` | int | Numer strony (domyslnie 1) |
|
||||
@@ -244,7 +245,33 @@ Odpowiedz:
|
||||
],
|
||||
"categories": [1, 5],
|
||||
"attributes": [
|
||||
{"attribute_id": 1, "value_id": 3}
|
||||
{
|
||||
"attribute_id": 1,
|
||||
"attribute_type": 1,
|
||||
"attribute_names": {"pl": "Kolor", "en": "Color"},
|
||||
"value_id": 3,
|
||||
"value_names": {"pl": "Czerwony", "en": "Red"}
|
||||
}
|
||||
],
|
||||
"variants": [
|
||||
{
|
||||
"id": 101,
|
||||
"permutation_hash": "1-3|2-5",
|
||||
"sku": "PROD-001-RED-L",
|
||||
"ean": null,
|
||||
"price_brutto": 109.99,
|
||||
"price_brutto_promo": null,
|
||||
"price_netto": 89.42,
|
||||
"price_netto_promo": null,
|
||||
"quantity": 5,
|
||||
"stock_0_buy": 0,
|
||||
"weight": 0.5,
|
||||
"status": 1,
|
||||
"attributes": [
|
||||
{"attribute_id": 1, "attribute_names": {"pl": "Kolor"}, "value_id": 3, "value_names": {"pl": "Czerwony"}},
|
||||
{"attribute_id": 2, "attribute_names": {"pl": "Rozmiar"}, "value_id": 5, "value_names": {"pl": "L"}}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -306,6 +333,104 @@ Partial update — wystarczy przeslac tylko zmienione pola. Pola nieprzeslane za
|
||||
|
||||
Odpowiedz: pelne dane produktu (jak w `get`).
|
||||
|
||||
### Warianty produktow
|
||||
|
||||
#### Lista wariantow produktu
|
||||
```
|
||||
GET api.php?endpoint=products&action=variants&id={product_id}
|
||||
```
|
||||
|
||||
Zwraca warianty produktu nadrzednego wraz z dostepnymi atrybutami.
|
||||
|
||||
Odpowiedz:
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"data": {
|
||||
"product_id": 1,
|
||||
"available_attributes": [
|
||||
{
|
||||
"id": 1,
|
||||
"type": 1,
|
||||
"status": 1,
|
||||
"names": {"pl": "Kolor", "en": "Color"},
|
||||
"values": [
|
||||
{"id": 3, "names": {"pl": "Czerwony", "en": "Red"}, "is_default": 0, "impact_on_the_price": null},
|
||||
{"id": 4, "names": {"pl": "Niebieski", "en": "Blue"}, "is_default": 0, "impact_on_the_price": 10.0}
|
||||
]
|
||||
}
|
||||
],
|
||||
"variants": [
|
||||
{
|
||||
"id": 101,
|
||||
"permutation_hash": "1-3",
|
||||
"sku": "PROD-001-RED",
|
||||
"ean": null,
|
||||
"price_brutto": 109.99,
|
||||
"price_brutto_promo": null,
|
||||
"price_netto": 89.42,
|
||||
"price_netto_promo": null,
|
||||
"quantity": 5,
|
||||
"stock_0_buy": 0,
|
||||
"weight": 0.5,
|
||||
"status": 1,
|
||||
"attributes": [
|
||||
{"attribute_id": 1, "attribute_names": {"pl": "Kolor"}, "value_id": 3, "value_names": {"pl": "Czerwony"}}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Tworzenie wariantu
|
||||
```
|
||||
POST api.php?endpoint=products&action=create_variant&id={product_id}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"attributes": {"1": 3, "2": 5},
|
||||
"sku": "PROD-001-RED-L",
|
||||
"ean": "5901234123458",
|
||||
"price_brutto": 109.99,
|
||||
"quantity": 5,
|
||||
"weight": 0.5
|
||||
}
|
||||
```
|
||||
|
||||
Wymagane: `attributes` (mapa attribute_id -> value_id, min. 1). Kombinacja atrybutow musi byc unikalna.
|
||||
|
||||
Odpowiedz (HTTP 201): pelne dane wariantu.
|
||||
|
||||
#### Aktualizacja wariantu
|
||||
```
|
||||
PUT api.php?endpoint=products&action=update_variant&id={variant_id}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"sku": "PROD-001-RED-XL",
|
||||
"price_brutto": 119.99,
|
||||
"quantity": 3
|
||||
}
|
||||
```
|
||||
|
||||
Partial update — mozna zmienic: sku, ean, price_brutto, price_netto, price_brutto_promo, price_netto_promo, quantity, stock_0_buy, weight, status.
|
||||
|
||||
Odpowiedz: pelne dane wariantu.
|
||||
|
||||
#### Usuwanie wariantu
|
||||
```
|
||||
DELETE api.php?endpoint=products&action=delete_variant&id={variant_id}
|
||||
```
|
||||
|
||||
Odpowiedz:
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"data": {"id": 101, "deleted": true}
|
||||
}
|
||||
```
|
||||
|
||||
### Slowniki
|
||||
|
||||
#### Lista statusow zamowien
|
||||
@@ -336,6 +461,32 @@ GET api.php?endpoint=dictionaries&action=transports
|
||||
GET api.php?endpoint=dictionaries&action=payment_methods
|
||||
```
|
||||
|
||||
#### Lista atrybutow
|
||||
```
|
||||
GET api.php?endpoint=dictionaries&action=attributes
|
||||
```
|
||||
|
||||
Zwraca aktywne atrybuty z wartosciami i wielojezycznymi nazwami.
|
||||
|
||||
Odpowiedz:
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"data": [
|
||||
{
|
||||
"id": 1,
|
||||
"type": 1,
|
||||
"status": 1,
|
||||
"names": {"pl": "Kolor", "en": "Color"},
|
||||
"values": [
|
||||
{"id": 3, "names": {"pl": "Czerwony"}, "is_default": 0, "impact_on_the_price": null},
|
||||
{"id": 4, "names": {"pl": "Niebieski"}, "is_default": 1, "impact_on_the_price": 10.0}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Polling
|
||||
|
||||
Aby pobierac tylko nowe/zmienione zamowienia, uzyj parametru `updated_since`:
|
||||
@@ -362,5 +513,5 @@ UPDATE pp_settings SET value = 'twoj-klucz-api' WHERE param = 'api_key';
|
||||
- Router: `\api\ApiRouter` (`autoload/api/ApiRouter.php`)
|
||||
- Kontrolery: `autoload/api/Controllers/`
|
||||
- `OrdersApiController` — zamowienia (5 akcji)
|
||||
- `ProductsApiController` — produkty (4 akcje: list, get, create, update)
|
||||
- `DictionariesApiController` — slowniki (3 akcje)
|
||||
- `ProductsApiController` — produkty (8 akcji: list, get, create, update, variants, create_variant, update_variant, delete_variant)
|
||||
- `DictionariesApiController` — slowniki (4 akcje: statuses, transports, payment_methods, attributes)
|
||||
|
||||
@@ -4,6 +4,50 @@ Logi zmian z migracji na Domain-Driven Architecture. Najnowsze na gorze.
|
||||
|
||||
---
|
||||
|
||||
## ver. 0.304 (2026-02-22) - Konfigurowalne limity kwotowe metod platnosci
|
||||
|
||||
- **NEW**: Kolumny `min_order_amount` i `max_order_amount` w `pp_shop_payment_methods` — konfigurowalne limity kwotowe per metoda platnosci
|
||||
- **NEW**: Pola min/max kwoty zamowienia w formularzu edycji metody platnosci (admin)
|
||||
- **FIX**: Zastapiono hardcoded warunek PayPo (id=6, 40-1000 PLN) generycznym filtrowaniem na froncie (basket checkout)
|
||||
- **NEW**: Cache invalidation po zapisie metody platnosci
|
||||
- **NEW**: 4 nowe testy jednostkowe (734 total, 2080 assertions)
|
||||
- **MIGRATION**: `migrations/0.304.sql` — ALTER TABLE pp_shop_payment_methods ADD min/max_order_amount
|
||||
|
||||
---
|
||||
|
||||
## ver. 0.303 (2026-02-22) - Fix: wyswietlanie atrybutow produktu na froncie + podglad produktu w adminie
|
||||
|
||||
- **FIX**: Naprawiono wyswietlanie atrybutow produktu na froncie — gdy dwa atrybuty mialy te sama wartosc kolejnosci (`o`), jeden nadpisywal drugi (kolizja kluczy tablicy). Teraz atrybuty sortowane przez `usort()` z unikalnymi kluczami sekwencyjnymi.
|
||||
- **NEW**: Przycisk "Podglad" w formularzu edycji produktu — otwiera strone produktu w nowej karcie
|
||||
- **NEW**: `FormAction::preview()` — nowy typ akcji formularza z `target="_blank"`
|
||||
|
||||
---
|
||||
|
||||
## ver. 0.302 (2026-02-22) - REST API: warianty produktow, atrybuty, filtrowanie
|
||||
|
||||
- **NEW**: API wariantow produktow — CRUD: `variants`, `create_variant`, `update_variant`, `delete_variant`
|
||||
- **NEW**: API slownik atrybutow — `dictionaries/attributes` z wielojezycznymi nazwami i wartosciami
|
||||
- **NEW**: Filtrowanie produktow po atrybutach w `products/list` — parametry `attribute_{id}={value_id}`
|
||||
- **NEW**: Wzbogacone atrybuty w `products/get` — nazwy atrybutow i wartosci z tlumaczeniami
|
||||
- **NEW**: Warianty w odpowiedzi `products/get` — lista wariantow z atrybutami dla produktow nadrzednych
|
||||
- **NEW**: Walidacja `price_brutto` przy tworzeniu produktu (musi byc nieujemna liczba)
|
||||
- **NEW**: Batch-loading atrybutow i wartosci (4 zapytania zamiast N+1) w `AttributeRepository::listForApi()`
|
||||
- **NEW**: 43 nowe testy jednostkowe (730 total, 2066 assertions)
|
||||
|
||||
---
|
||||
|
||||
## ver. 0.301 (2026-02-22) - Mobile responsive: filtry tabel i szczegoly zamowienia
|
||||
|
||||
- **NEW**: Filtry w tabelach admina domyslnie ukryte — przycisk toggle z ikona filtra, badge z liczba aktywnych filtrow
|
||||
- **NEW**: Stan filtrow zapamietywany w `localStorage` per widok; auto-show gdy filtry aktywne
|
||||
- **NEW**: Mobilna wersja szczegolow zamowienia — responsywny layout (CSS-only, breakpoint 767px)
|
||||
- **NEW**: Pasek akcji zamowienia — ikony-only na mobile, flex row bez zawijania
|
||||
- **NEW**: Tabela produktow zamowienia — kompaktowa lista na mobile (obraz + nazwa + linia `qty x cena = suma`)
|
||||
- **NEW**: Sekcje informacyjne zamowienia — full-width stacking na mobile
|
||||
- **NEW**: Dropdown integracji jako bottom-sheet na mobile
|
||||
|
||||
---
|
||||
|
||||
## ver. 0.300 (2026-02-21) - System aktualizacji oparty na manifestach JSON
|
||||
|
||||
- **NEW**: Manifest JSON per wersja — zastępuje osobne pliki `_sql.txt` i `_files.txt`
|
||||
|
||||
@@ -508,12 +508,16 @@ Metody platnosci sklepu (modul `/admin/shop_payment_method`).
|
||||
| description | Opis metody platnosci (wyswietlany m.in. w checkout) |
|
||||
| status | Status: 1 = aktywna, 0 = nieaktywna |
|
||||
| apilo_payment_type_id | ID typu platnosci Apilo (NULL gdy brak mapowania) |
|
||||
| min_order_amount | Minimalna kwota zamowienia (DECIMAL(10,2), NULL = brak limitu) |
|
||||
| max_order_amount | Maksymalna kwota zamowienia (DECIMAL(10,2), NULL = brak limitu) |
|
||||
| sellasist_payment_type_id | DEPRECATED (integracja Sellasist usunieta w ver. 0.263) |
|
||||
|
||||
**Uzywane w:** `Domain\PaymentMethod\PaymentMethodRepository`, `admin\Controllers\ShopPaymentMethodController`, `front\factory\ShopPaymentMethod`, `shop\PaymentMethod`, `admin\controls\ShopTransport`, `cron.php`
|
||||
|
||||
**Aktualizacja 2026-02-14 (ver. 0.268):** modul `/admin/shop_payment_method` korzysta z `Domain\PaymentMethod\PaymentMethodRepository` przez `admin\Controllers\ShopPaymentMethodController`. Usunieto legacy klasy `admin\controls\ShopPaymentMethod`, `admin\factory\ShopPaymentMethod`, `admin\view\ShopPaymentMethod` oraz widok `admin/templates/shop-payment-method/view-list.php`.
|
||||
|
||||
**Aktualizacja 2026-02-22 (ver. 0.304):** dodano kolumny `min_order_amount` i `max_order_amount` — konfigurowalne limity kwotowe metod platnosci. Zastapiono hardcoded warunek PayPo (id=6, 40-1000 PLN) generycznym filtrowaniem na froncie.
|
||||
|
||||
## pp_shop_transports
|
||||
Rodzaje transportu sklepu (modul `/admin/shop_transport`).
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@ composer test # standard
|
||||
## Aktualny stan
|
||||
|
||||
```text
|
||||
OK (692 tests, 1988 assertions)
|
||||
OK (734 tests, 2080 assertions)
|
||||
```
|
||||
|
||||
Zweryfikowano: 2026-02-21 (ver. 0.300)
|
||||
Zweryfikowano: 2026-02-22 (ver. 0.304)
|
||||
|
||||
## Konfiguracja
|
||||
|
||||
|
||||
@@ -69,45 +69,5 @@ Build script automatycznie je wczyta i umieści w manifeście + legacy `_sql.txt
|
||||
### .updateignore
|
||||
Plik w katalogu głównym projektu, wzorce plików wykluczonych z paczek (jak `.gitignore`).
|
||||
|
||||
---
|
||||
|
||||
## Stary sposób (do v0.300) — ręczne pakowanie
|
||||
|
||||
### Struktura aktualizacji
|
||||
|
||||
Aktualizacje znajdują się w folderze `updates/0.XX/` gdzie XX oznacza dziesiątki wersji.
|
||||
|
||||
#### Pliki aktualizacji:
|
||||
- `ver_X.XXX.zip` - paczka ZIP ze zmienionymi plikami (BEZ folderu wersji, bezpośrednio struktura katalogów)
|
||||
- `ver_X.XXX_sql.txt` - opcjonalny plik z zapytaniami SQL (jeśli wymagane zmiany w bazie)
|
||||
- `ver_X.XXX_files.txt` - opcjonalny plik z listą plików do **USUNIĘCIA** przy aktualizacji (format: `F: ../sciezka/do/pliku.php`)
|
||||
- `changelog.php` - historia zmian
|
||||
- `versions.php` - konfiguracja wersji (zmienna `$current_ver`)
|
||||
|
||||
#### Zasada pakowania plików
|
||||
- Do paczek aktualizacji **nie dodajemy plików `*.md`** (dokumentacja jest tylko wewnętrzna/deweloperska).
|
||||
- Do paczek aktualizacji **nie dodajemy `updates/changelog.php`** (to plik serwisowy po stronie repozytorium aktualizacji, nie runtime klienta).
|
||||
- Do paczek aktualizacji **nie dodajemy głównego `.htaccess` z katalogu projektu** (ten plik wdrażamy osobno, poza ZIP aktualizacji).
|
||||
|
||||
### Procedura ręczna
|
||||
|
||||
1. Określ numer wersji
|
||||
2. Utwórz folder tymczasowy: `mkdir -p temp/temp_XXX/sciezka/do/pliku`
|
||||
3. Skopiuj zmienione pliki do folderu tymczasowego
|
||||
4. Utwórz ZIP z zawartości folderu (nie z samego folderu!)
|
||||
5. Usuń folder tymczasowy
|
||||
6. Zaktualizuj `changelog.php` i `versions.php`
|
||||
7. (Opcjonalnie) Utwórz `_sql.txt` i `_files.txt`
|
||||
|
||||
**WAŻNE:** W archiwum ZIP NIE powinno być folderu z nazwą wersji. Struktura ZIP zaczyna się bezpośrednio od katalogów projektu (admin/, autoload/, itp.).
|
||||
|
||||
## Status bieżącej aktualizacji (ver. 0.300)
|
||||
|
||||
- Wersja udostępniona: `0.300` (data: 2026-02-21).
|
||||
- Pliki publikacyjne:
|
||||
- `updates/0.30/ver_0.300.zip`
|
||||
- Pliki metadanych aktualizacji:
|
||||
- `updates/changelog.php`
|
||||
- `updates/versions.php` (`$current_ver = 300`)
|
||||
- Weryfikacja testów przed publikacją:
|
||||
- `OK (692 tests, 1988 assertions)`
|
||||
### INFO
|
||||
pamiętaj że push czasem zwraca błąd autoryzacji, wtedy spróbuj ponownie
|
||||
2
migrations/0.304.sql
Normal file
2
migrations/0.304.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE pp_shop_payment_methods ADD COLUMN min_order_amount DECIMAL(10,2) DEFAULT NULL;
|
||||
ALTER TABLE pp_shop_payment_methods ADD COLUMN max_order_amount DECIMAL(10,2) DEFAULT NULL;
|
||||
@@ -13,7 +13,14 @@
|
||||
$basket_summary = \Domain\Basket\BasketCalculator::summaryPrice( $basket, $coupon ) + $transport_cost;
|
||||
?>
|
||||
<? if ( is_array( $this -> payment_methods ) ): foreach ( $this -> payment_methods as $payment_method ):?>
|
||||
<? if ( $payment_method['id'] != 6 or $payment_method['id'] == 6 and $basket_summary >= 40 and $basket_summary <= 1000 ):?>
|
||||
<?
|
||||
$min = isset($payment_method['min_order_amount']) ? (float)$payment_method['min_order_amount'] : null;
|
||||
$max = isset($payment_method['max_order_amount']) ? (float)$payment_method['max_order_amount'] : null;
|
||||
$show = true;
|
||||
if ($min !== null && $min > 0 && $basket_summary < $min) $show = false;
|
||||
if ($max !== null && $max > 0 && $basket_summary > $max) $show = false;
|
||||
?>
|
||||
<? if ( $show ):?>
|
||||
<div class="options">
|
||||
<div class="check">
|
||||
<input type="radio" class="icheck" name="payment_method" value="<?= $payment_method['id'];?>"
|
||||
|
||||
@@ -359,4 +359,81 @@ class AttributeRepositoryTest extends TestCase
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// --- listForApi ---
|
||||
|
||||
public function testListForApiReturnsActiveAttributesWithValues(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('select')
|
||||
->willReturnCallback(function ($table, $columns, $where) {
|
||||
if ($table === 'pp_shop_attributes') {
|
||||
return [
|
||||
['id' => '5', 'type' => '0', 'status' => '1'],
|
||||
];
|
||||
}
|
||||
if ($table === 'pp_shop_attributes_langs') {
|
||||
return [
|
||||
['attribute_id' => '5', 'lang_id' => 'pl', 'name' => 'Rozmiar'],
|
||||
['attribute_id' => '5', 'lang_id' => 'en', 'name' => 'Size'],
|
||||
];
|
||||
}
|
||||
if ($table === 'pp_shop_attributes_values') {
|
||||
return [
|
||||
['id' => '12', 'attribute_id' => '5', 'is_default' => '1', 'impact_on_the_price' => null],
|
||||
['id' => '13', 'attribute_id' => '5', 'is_default' => '0', 'impact_on_the_price' => '10.00'],
|
||||
];
|
||||
}
|
||||
if ($table === 'pp_shop_attributes_values_langs') {
|
||||
return [
|
||||
['value_id' => '12', 'lang_id' => 'pl', 'name' => 'M'],
|
||||
['value_id' => '12', 'lang_id' => 'en', 'name' => 'M'],
|
||||
['value_id' => '13', 'lang_id' => 'pl', 'name' => 'L'],
|
||||
['value_id' => '13', 'lang_id' => 'en', 'name' => 'L'],
|
||||
];
|
||||
}
|
||||
if ($table === 'pp_langs') {
|
||||
return [['id' => 'pl', 'start' => 1, 'o' => 1]];
|
||||
}
|
||||
return [];
|
||||
});
|
||||
|
||||
$repository = new AttributeRepository($mockDb);
|
||||
$result = $repository->listForApi();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertSame(5, $result[0]['id']);
|
||||
$this->assertSame(0, $result[0]['type']);
|
||||
$this->assertSame(1, $result[0]['status']);
|
||||
$this->assertSame('Rozmiar', $result[0]['names']['pl']);
|
||||
$this->assertSame('Size', $result[0]['names']['en']);
|
||||
$this->assertCount(2, $result[0]['values']);
|
||||
$this->assertSame(12, $result[0]['values'][0]['id']);
|
||||
$this->assertSame(1, $result[0]['values'][0]['is_default']);
|
||||
$this->assertNull($result[0]['values'][0]['impact_on_the_price']);
|
||||
$this->assertSame(13, $result[0]['values'][1]['id']);
|
||||
$this->assertSame(10.0, $result[0]['values'][1]['impact_on_the_price']);
|
||||
}
|
||||
|
||||
public function testListForApiReturnsEmptyWhenNoAttributes(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('select')
|
||||
->willReturnCallback(function ($table) {
|
||||
if ($table === 'pp_shop_attributes') {
|
||||
return [];
|
||||
}
|
||||
if ($table === 'pp_langs') {
|
||||
return [['id' => 'pl', 'start' => 1, 'o' => 1]];
|
||||
}
|
||||
return [];
|
||||
});
|
||||
|
||||
$repository = new AttributeRepository($mockDb);
|
||||
$result = $repository->listForApi();
|
||||
|
||||
$this->assertSame([], $result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,8 @@ class PaymentMethodRepositoryTest extends TestCase
|
||||
$this->assertSame('test', $updateRow['description']);
|
||||
$this->assertSame(1, $updateRow['status']);
|
||||
$this->assertSame(22, $updateRow['apilo_payment_type_id']);
|
||||
$this->assertNull($updateRow['min_order_amount']);
|
||||
$this->assertNull($updateRow['max_order_amount']);
|
||||
$this->assertSame(['id' => 3], $updateWhere);
|
||||
}
|
||||
|
||||
@@ -113,6 +115,102 @@ class PaymentMethodRepositoryTest extends TestCase
|
||||
$this->assertNull($repository->save(0, ['status' => 1]));
|
||||
}
|
||||
|
||||
public function testSavePersistsMinMaxOrderAmount(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
$updateRow = null;
|
||||
|
||||
$mockDb->expects($this->once())
|
||||
->method('update')
|
||||
->willReturnCallback(function ($table, $row) use (&$updateRow) {
|
||||
$updateRow = $row;
|
||||
return true;
|
||||
});
|
||||
|
||||
$repository = new PaymentMethodRepository($mockDb);
|
||||
$repository->save(5, [
|
||||
'description' => 'test',
|
||||
'status' => 1,
|
||||
'apilo_payment_type_id' => '',
|
||||
'min_order_amount' => '40.00',
|
||||
'max_order_amount' => '1000.00',
|
||||
]);
|
||||
|
||||
$this->assertSame(40.0, $updateRow['min_order_amount']);
|
||||
$this->assertSame(1000.0, $updateRow['max_order_amount']);
|
||||
}
|
||||
|
||||
public function testSaveConvertsEmptyMinMaxToNull(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
$updateRow = null;
|
||||
|
||||
$mockDb->expects($this->once())
|
||||
->method('update')
|
||||
->willReturnCallback(function ($table, $row) use (&$updateRow) {
|
||||
$updateRow = $row;
|
||||
return true;
|
||||
});
|
||||
|
||||
$repository = new PaymentMethodRepository($mockDb);
|
||||
$repository->save(6, [
|
||||
'description' => 'test',
|
||||
'status' => 1,
|
||||
'apilo_payment_type_id' => '',
|
||||
'min_order_amount' => '',
|
||||
'max_order_amount' => '',
|
||||
]);
|
||||
|
||||
$this->assertNull($updateRow['min_order_amount']);
|
||||
$this->assertNull($updateRow['max_order_amount']);
|
||||
}
|
||||
|
||||
public function testFindNormalizesMinMaxOrderAmount(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
$mockDb->expects($this->once())
|
||||
->method('get')
|
||||
->with('pp_shop_payment_methods', '*', ['id' => 6])
|
||||
->willReturn([
|
||||
'id' => '6',
|
||||
'name' => 'PayPo',
|
||||
'description' => '',
|
||||
'status' => '1',
|
||||
'apilo_payment_type_id' => null,
|
||||
'min_order_amount' => '40.00',
|
||||
'max_order_amount' => '1000.00',
|
||||
]);
|
||||
|
||||
$repository = new PaymentMethodRepository($mockDb);
|
||||
$result = $repository->find(6);
|
||||
|
||||
$this->assertSame(40.0, $result['min_order_amount']);
|
||||
$this->assertSame(1000.0, $result['max_order_amount']);
|
||||
}
|
||||
|
||||
public function testFindNormalizesNullMinMaxOrderAmount(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
$mockDb->expects($this->once())
|
||||
->method('get')
|
||||
->with('pp_shop_payment_methods', '*', ['id' => 7])
|
||||
->willReturn([
|
||||
'id' => '7',
|
||||
'name' => 'Przelew',
|
||||
'description' => '',
|
||||
'status' => '1',
|
||||
'apilo_payment_type_id' => null,
|
||||
'min_order_amount' => null,
|
||||
'max_order_amount' => null,
|
||||
]);
|
||||
|
||||
$repository = new PaymentMethodRepository($mockDb);
|
||||
$result = $repository->find(7);
|
||||
|
||||
$this->assertNull($result['min_order_amount']);
|
||||
$this->assertNull($result['max_order_amount']);
|
||||
}
|
||||
|
||||
public function testListForAdminWhitelistsSortAndDirection(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
@@ -877,4 +877,419 @@ class ProductRepositoryTest extends TestCase
|
||||
|
||||
$this->assertEquals([], $repository->promotedProductIdsCached(6));
|
||||
}
|
||||
|
||||
// --- findVariantsForApi ---
|
||||
|
||||
public function testFindVariantsForApiReturnsVariants(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockStmt = new class {
|
||||
public function fetchAll($mode = null): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'id' => '101',
|
||||
'permutation_hash' => '5-12|7-18',
|
||||
'sku' => 'SKU-M-RED',
|
||||
'ean' => null,
|
||||
'price_brutto' => '109.99',
|
||||
'price_brutto_promo' => null,
|
||||
'price_netto' => '89.42',
|
||||
'price_netto_promo' => null,
|
||||
'quantity' => '5',
|
||||
'stock_0_buy' => '0',
|
||||
'weight' => null,
|
||||
'status' => '1',
|
||||
],
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
$mockDb->method('query')->willReturn($mockStmt);
|
||||
$mockDb->method('select')->willReturnCallback(function ($table, $columns, $where) {
|
||||
if ($table === 'pp_shop_products_attributes') {
|
||||
return [
|
||||
['product_id' => '101', 'attribute_id' => '5', 'value_id' => '12'],
|
||||
['product_id' => '101', 'attribute_id' => '7', 'value_id' => '18'],
|
||||
];
|
||||
}
|
||||
if ($table === 'pp_shop_attributes_langs') {
|
||||
return [
|
||||
['attribute_id' => '5', 'lang_id' => 'pl', 'name' => 'Rozmiar'],
|
||||
['attribute_id' => '7', 'lang_id' => 'pl', 'name' => 'Kolor'],
|
||||
];
|
||||
}
|
||||
if ($table === 'pp_shop_attributes_values_langs') {
|
||||
return [
|
||||
['value_id' => '12', 'lang_id' => 'pl', 'name' => 'M'],
|
||||
['value_id' => '18', 'lang_id' => 'pl', 'name' => 'Czerwony'],
|
||||
];
|
||||
}
|
||||
return [];
|
||||
});
|
||||
$mockDb->method('get')->willReturn(0);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->findVariantsForApi(1);
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertSame(101, $result[0]['id']);
|
||||
$this->assertSame('5-12|7-18', $result[0]['permutation_hash']);
|
||||
$this->assertSame('SKU-M-RED', $result[0]['sku']);
|
||||
$this->assertSame(109.99, $result[0]['price_brutto']);
|
||||
$this->assertSame(5, $result[0]['quantity']);
|
||||
$this->assertCount(2, $result[0]['attributes']);
|
||||
}
|
||||
|
||||
public function testFindVariantsForApiReturnsEmptyWhenNoVariants(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockStmt = new class {
|
||||
public function fetchAll($mode = null): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
$mockDb->method('query')->willReturn($mockStmt);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->findVariantsForApi(1);
|
||||
|
||||
$this->assertSame([], $result);
|
||||
}
|
||||
|
||||
// --- findVariantForApi ---
|
||||
|
||||
public function testFindVariantForApiReturnsVariant(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('get')->willReturnCallback(function ($table, $columns, $where) {
|
||||
if ($table === 'pp_shop_products') {
|
||||
return [
|
||||
'id' => '101',
|
||||
'parent_id' => '1',
|
||||
'permutation_hash' => '5-12',
|
||||
'sku' => 'SKU-M',
|
||||
'ean' => null,
|
||||
'price_brutto' => '99.99',
|
||||
'price_brutto_promo' => null,
|
||||
'price_netto' => '81.29',
|
||||
'price_netto_promo' => null,
|
||||
'quantity' => '10',
|
||||
'stock_0_buy' => '0',
|
||||
'weight' => null,
|
||||
'status' => '1',
|
||||
];
|
||||
}
|
||||
return null;
|
||||
});
|
||||
$mockDb->method('select')->willReturnCallback(function ($table) {
|
||||
if ($table === 'pp_shop_products_attributes') {
|
||||
return [['attribute_id' => '5', 'value_id' => '12']];
|
||||
}
|
||||
if ($table === 'pp_shop_attributes_langs') {
|
||||
return [['attribute_id' => '5', 'lang_id' => 'pl', 'name' => 'Rozmiar']];
|
||||
}
|
||||
if ($table === 'pp_shop_attributes_values_langs') {
|
||||
return [['value_id' => '12', 'lang_id' => 'pl', 'name' => 'M']];
|
||||
}
|
||||
return [];
|
||||
});
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->findVariantForApi(101);
|
||||
|
||||
$this->assertNotNull($result);
|
||||
$this->assertSame(101, $result['id']);
|
||||
$this->assertSame(1, $result['parent_id']);
|
||||
$this->assertSame('5-12', $result['permutation_hash']);
|
||||
$this->assertSame(99.99, $result['price_brutto']);
|
||||
$this->assertCount(1, $result['attributes']);
|
||||
}
|
||||
|
||||
public function testFindVariantForApiReturnsNullForNonVariant(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('get')->willReturn([
|
||||
'id' => '1',
|
||||
'parent_id' => null,
|
||||
'permutation_hash' => '',
|
||||
]);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->findVariantForApi(1);
|
||||
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
public function testFindVariantForApiReturnsNullForNonexistent(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
$mockDb->method('get')->willReturn(null);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->findVariantForApi(999);
|
||||
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
// --- createVariantForApi ---
|
||||
|
||||
public function testCreateVariantForApiSuccess(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$callCount = 0;
|
||||
$mockDb->method('get')->willReturnCallback(function ($table, $columns, $where) use (&$callCount) {
|
||||
$callCount++;
|
||||
if ($callCount === 1) {
|
||||
// Parent exists
|
||||
return ['id' => '1', 'archive' => '0', 'parent_id' => null, 'vat' => '23'];
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
$mockDb->method('count')->willReturn(0);
|
||||
$mockDb->method('insert')->willReturn(true);
|
||||
$mockDb->method('id')->willReturn(101);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->createVariantForApi(1, [
|
||||
'attributes' => [5 => 12, 7 => 18],
|
||||
'sku' => 'SKU-M-RED',
|
||||
'price_brutto' => 109.99,
|
||||
'quantity' => 5,
|
||||
]);
|
||||
|
||||
$this->assertNotNull($result);
|
||||
$this->assertSame(101, $result['id']);
|
||||
$this->assertSame('5-12|7-18', $result['permutation_hash']);
|
||||
}
|
||||
|
||||
public function testCreateVariantForApiReturnsNullForArchivedParent(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('get')->willReturn([
|
||||
'id' => '1', 'archive' => '1', 'parent_id' => null, 'vat' => '23',
|
||||
]);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->createVariantForApi(1, [
|
||||
'attributes' => [5 => 12],
|
||||
]);
|
||||
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
public function testCreateVariantForApiReturnsNullWhenParentIsVariant(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('get')->willReturn([
|
||||
'id' => '101', 'archive' => '0', 'parent_id' => '1', 'vat' => '23',
|
||||
]);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->createVariantForApi(101, [
|
||||
'attributes' => [5 => 12],
|
||||
]);
|
||||
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
public function testCreateVariantForApiReturnsNullForEmptyAttributes(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('get')->willReturn([
|
||||
'id' => '1', 'archive' => '0', 'parent_id' => null, 'vat' => '23',
|
||||
]);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->createVariantForApi(1, ['attributes' => []]);
|
||||
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
public function testCreateVariantForApiReturnsNullForDuplicateHash(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('get')->willReturn([
|
||||
'id' => '1', 'archive' => '0', 'parent_id' => null, 'vat' => '23',
|
||||
]);
|
||||
$mockDb->method('count')->willReturn(1);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->createVariantForApi(1, [
|
||||
'attributes' => [5 => 12],
|
||||
]);
|
||||
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
// --- updateVariantForApi ---
|
||||
|
||||
public function testUpdateVariantForApiSuccess(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('get')->willReturn([
|
||||
'id' => '101', 'parent_id' => '1',
|
||||
]);
|
||||
|
||||
$mockDb->expects($this->once())->method('update');
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->updateVariantForApi(101, [
|
||||
'sku' => 'NEW-SKU',
|
||||
'price_brutto' => 119.99,
|
||||
]);
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testUpdateVariantForApiReturnsFalseForNonVariant(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('get')->willReturn([
|
||||
'id' => '1', 'parent_id' => null,
|
||||
]);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->updateVariantForApi(1, ['sku' => 'NEW']);
|
||||
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
public function testUpdateVariantForApiReturnsFalseForNonexistent(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
$mockDb->method('get')->willReturn(null);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->updateVariantForApi(999, ['sku' => 'NEW']);
|
||||
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
public function testUpdateVariantForApiFiltersUnallowedFields(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('get')->willReturn([
|
||||
'id' => '101', 'parent_id' => '1',
|
||||
]);
|
||||
|
||||
$mockDb->expects($this->once())
|
||||
->method('update')
|
||||
->with(
|
||||
'pp_shop_products',
|
||||
$this->callback(function ($data) {
|
||||
return isset($data['sku'])
|
||||
&& !isset($data['parent_id'])
|
||||
&& !isset($data['permutation_hash']);
|
||||
}),
|
||||
$this->anything()
|
||||
);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$repository->updateVariantForApi(101, [
|
||||
'sku' => 'NEW',
|
||||
'parent_id' => 999,
|
||||
'permutation_hash' => 'hacked',
|
||||
]);
|
||||
}
|
||||
|
||||
public function testUpdateVariantForApiCastsTypes(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('get')->willReturn([
|
||||
'id' => '101', 'parent_id' => '1',
|
||||
]);
|
||||
|
||||
$mockDb->expects($this->once())
|
||||
->method('update')
|
||||
->with(
|
||||
'pp_shop_products',
|
||||
$this->callback(function ($data) {
|
||||
return $data['sku'] === '123'
|
||||
&& $data['price_brutto'] === 99.99
|
||||
&& $data['quantity'] === 5
|
||||
&& $data['weight'] === null
|
||||
&& $data['status'] === 1;
|
||||
}),
|
||||
$this->anything()
|
||||
);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$repository->updateVariantForApi(101, [
|
||||
'sku' => 123,
|
||||
'price_brutto' => '99.99',
|
||||
'quantity' => '5',
|
||||
'weight' => '',
|
||||
'status' => '1',
|
||||
]);
|
||||
}
|
||||
|
||||
// --- deleteVariantForApi ---
|
||||
|
||||
public function testDeleteVariantForApiSuccess(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('get')->willReturn([
|
||||
'id' => '101', 'parent_id' => '1',
|
||||
]);
|
||||
|
||||
$deleteCalls = [];
|
||||
$mockDb->expects($this->exactly(3))
|
||||
->method('delete')
|
||||
->willReturnCallback(function ($table, $where) use (&$deleteCalls) {
|
||||
$deleteCalls[] = ['table' => $table, 'where' => $where];
|
||||
return true;
|
||||
});
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->deleteVariantForApi(101);
|
||||
|
||||
$this->assertTrue($result);
|
||||
$this->assertSame('pp_shop_products_langs', $deleteCalls[0]['table']);
|
||||
$this->assertSame(['product_id' => 101], $deleteCalls[0]['where']);
|
||||
$this->assertSame('pp_shop_products_attributes', $deleteCalls[1]['table']);
|
||||
$this->assertSame('pp_shop_products', $deleteCalls[2]['table']);
|
||||
}
|
||||
|
||||
public function testDeleteVariantForApiReturnsFalseForNonVariant(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->method('get')->willReturn([
|
||||
'id' => '1', 'parent_id' => null,
|
||||
]);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->deleteVariantForApi(1);
|
||||
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
public function testDeleteVariantForApiReturnsFalseForNonexistent(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
$mockDb->method('get')->willReturn(null);
|
||||
|
||||
$repository = new ProductRepository($mockDb);
|
||||
$result = $repository->deleteVariantForApi(999);
|
||||
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace Tests\Unit\api\Controllers;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use api\Controllers\DictionariesApiController;
|
||||
use Domain\Attribute\AttributeRepository;
|
||||
use Domain\ShopStatus\ShopStatusRepository;
|
||||
use Domain\Transport\TransportRepository;
|
||||
use Domain\PaymentMethod\PaymentMethodRepository;
|
||||
@@ -12,6 +13,7 @@ class DictionariesApiControllerTest extends TestCase
|
||||
private $mockStatusRepo;
|
||||
private $mockTransportRepo;
|
||||
private $mockPaymentRepo;
|
||||
private $mockAttrRepo;
|
||||
private $controller;
|
||||
|
||||
protected function setUp(): void
|
||||
@@ -19,11 +21,13 @@ class DictionariesApiControllerTest extends TestCase
|
||||
$this->mockStatusRepo = $this->createMock(ShopStatusRepository::class);
|
||||
$this->mockTransportRepo = $this->createMock(TransportRepository::class);
|
||||
$this->mockPaymentRepo = $this->createMock(PaymentMethodRepository::class);
|
||||
$this->mockAttrRepo = $this->createMock(AttributeRepository::class);
|
||||
|
||||
$this->controller = new DictionariesApiController(
|
||||
$this->mockStatusRepo,
|
||||
$this->mockTransportRepo,
|
||||
$this->mockPaymentRepo
|
||||
$this->mockPaymentRepo,
|
||||
$this->mockAttrRepo
|
||||
);
|
||||
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
@@ -136,4 +140,50 @@ class DictionariesApiControllerTest extends TestCase
|
||||
|
||||
$this->assertSame(405, http_response_code());
|
||||
}
|
||||
|
||||
// --- attributes ---
|
||||
|
||||
public function testAttributesReturnsFormattedList(): void
|
||||
{
|
||||
$this->mockAttrRepo->method('listForApi')
|
||||
->willReturn([
|
||||
[
|
||||
'id' => 5,
|
||||
'type' => 0,
|
||||
'status' => 1,
|
||||
'names' => ['pl' => 'Rozmiar', 'en' => 'Size'],
|
||||
'values' => [
|
||||
[
|
||||
'id' => 12,
|
||||
'names' => ['pl' => 'M', 'en' => 'M'],
|
||||
'is_default' => 1,
|
||||
'impact_on_the_price' => null,
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
ob_start();
|
||||
$this->controller->attributes();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$json = json_decode($output, true);
|
||||
$this->assertSame('ok', $json['status']);
|
||||
$this->assertCount(1, $json['data']);
|
||||
$this->assertSame(5, $json['data'][0]['id']);
|
||||
$this->assertSame('Rozmiar', $json['data'][0]['names']['pl']);
|
||||
$this->assertCount(1, $json['data'][0]['values']);
|
||||
$this->assertSame(12, $json['data'][0]['values'][0]['id']);
|
||||
}
|
||||
|
||||
public function testAttributesRejectsPostMethod(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
|
||||
ob_start();
|
||||
$this->controller->attributes();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(405, http_response_code());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,20 @@ namespace Tests\Unit\api\Controllers;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use api\Controllers\ProductsApiController;
|
||||
use Domain\Attribute\AttributeRepository;
|
||||
use Domain\Product\ProductRepository;
|
||||
|
||||
class ProductsApiControllerTest extends TestCase
|
||||
{
|
||||
private $mockRepo;
|
||||
private $mockAttrRepo;
|
||||
private $controller;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->mockRepo = $this->createMock(ProductRepository::class);
|
||||
$this->controller = new ProductsApiController($this->mockRepo);
|
||||
$this->mockAttrRepo = $this->createMock(AttributeRepository::class);
|
||||
$this->controller = new ProductsApiController($this->mockRepo, $this->mockAttrRepo);
|
||||
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
$_GET = [];
|
||||
@@ -405,4 +408,257 @@ class ProductsApiControllerTest extends TestCase
|
||||
$this->assertSame(7, $result['producer_id']);
|
||||
$this->assertSame(2, $result['product_unit']);
|
||||
}
|
||||
|
||||
// --- variants ---
|
||||
|
||||
public function testVariantsReturnsVariantsList(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
$_GET['id'] = '1';
|
||||
|
||||
$this->mockRepo->method('find')
|
||||
->with(1)
|
||||
->willReturn(['id' => 1, 'parent_id' => null]);
|
||||
|
||||
$this->mockRepo->method('findVariantsForApi')
|
||||
->with(1)
|
||||
->willReturn([
|
||||
[
|
||||
'id' => 101,
|
||||
'permutation_hash' => '5-12',
|
||||
'sku' => 'SKU-M',
|
||||
'attributes' => [['attribute_id' => 5, 'value_id' => 12]],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->mockAttrRepo->method('listForApi')
|
||||
->willReturn([
|
||||
['id' => 5, 'type' => 0, 'status' => 1, 'names' => ['pl' => 'Rozmiar'], 'values' => []],
|
||||
]);
|
||||
|
||||
ob_start();
|
||||
$this->controller->variants();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$json = json_decode($output, true);
|
||||
$this->assertSame('ok', $json['status']);
|
||||
$this->assertSame(1, $json['data']['product_id']);
|
||||
$this->assertCount(1, $json['data']['variants']);
|
||||
$this->assertCount(1, $json['data']['available_attributes']);
|
||||
}
|
||||
|
||||
public function testVariantsReturns400WhenMissingId(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
|
||||
ob_start();
|
||||
$this->controller->variants();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(400, http_response_code());
|
||||
}
|
||||
|
||||
public function testVariantsReturns404WhenProductNotFound(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
$_GET['id'] = '999';
|
||||
|
||||
$this->mockRepo->method('find')->willReturn(null);
|
||||
|
||||
ob_start();
|
||||
$this->controller->variants();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(404, http_response_code());
|
||||
}
|
||||
|
||||
public function testVariantsReturns400ForVariantProduct(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
$_GET['id'] = '101';
|
||||
|
||||
$this->mockRepo->method('find')
|
||||
->with(101)
|
||||
->willReturn(['id' => 101, 'parent_id' => 1]);
|
||||
|
||||
ob_start();
|
||||
$this->controller->variants();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(400, http_response_code());
|
||||
}
|
||||
|
||||
public function testVariantsRejectsPostMethod(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_GET['id'] = '1';
|
||||
|
||||
ob_start();
|
||||
$this->controller->variants();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(405, http_response_code());
|
||||
}
|
||||
|
||||
// --- create_variant ---
|
||||
|
||||
public function testCreateVariantRejectsGetMethod(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
$_GET['id'] = '1';
|
||||
|
||||
ob_start();
|
||||
$this->controller->create_variant();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(405, http_response_code());
|
||||
}
|
||||
|
||||
public function testCreateVariantReturns400WhenMissingId(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
|
||||
ob_start();
|
||||
$this->controller->create_variant();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(400, http_response_code());
|
||||
}
|
||||
|
||||
public function testCreateVariantReturns400WhenNoBody(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_GET['id'] = '1';
|
||||
|
||||
ob_start();
|
||||
$this->controller->create_variant();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(400, http_response_code());
|
||||
}
|
||||
|
||||
// --- update_variant ---
|
||||
|
||||
public function testUpdateVariantRejectsGetMethod(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
$_GET['id'] = '101';
|
||||
|
||||
ob_start();
|
||||
$this->controller->update_variant();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(405, http_response_code());
|
||||
}
|
||||
|
||||
public function testUpdateVariantReturns400WhenMissingId(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'PUT';
|
||||
|
||||
ob_start();
|
||||
$this->controller->update_variant();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(400, http_response_code());
|
||||
}
|
||||
|
||||
public function testUpdateVariantReturns400WhenNoBody(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'PUT';
|
||||
$_GET['id'] = '101';
|
||||
|
||||
ob_start();
|
||||
$this->controller->update_variant();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(400, http_response_code());
|
||||
}
|
||||
|
||||
// --- delete_variant ---
|
||||
|
||||
public function testDeleteVariantRejectsGetMethod(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
$_GET['id'] = '101';
|
||||
|
||||
ob_start();
|
||||
$this->controller->delete_variant();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(405, http_response_code());
|
||||
}
|
||||
|
||||
public function testDeleteVariantReturns400WhenMissingId(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'DELETE';
|
||||
|
||||
ob_start();
|
||||
$this->controller->delete_variant();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(400, http_response_code());
|
||||
}
|
||||
|
||||
public function testDeleteVariantReturns404WhenNotFound(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'DELETE';
|
||||
$_GET['id'] = '999';
|
||||
|
||||
$this->mockRepo->method('deleteVariantForApi')
|
||||
->with(999)
|
||||
->willReturn(false);
|
||||
|
||||
ob_start();
|
||||
$this->controller->delete_variant();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertSame(404, http_response_code());
|
||||
}
|
||||
|
||||
public function testDeleteVariantSuccess(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'DELETE';
|
||||
$_GET['id'] = '101';
|
||||
|
||||
$this->mockRepo->method('deleteVariantForApi')
|
||||
->with(101)
|
||||
->willReturn(true);
|
||||
|
||||
ob_start();
|
||||
$this->controller->delete_variant();
|
||||
$output = ob_get_clean();
|
||||
|
||||
$json = json_decode($output, true);
|
||||
$this->assertSame('ok', $json['status']);
|
||||
$this->assertSame(101, $json['data']['id']);
|
||||
$this->assertTrue($json['data']['deleted']);
|
||||
}
|
||||
|
||||
// --- list with attribute filter ---
|
||||
|
||||
public function testListPassesAttributeFilters(): void
|
||||
{
|
||||
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||
$_GET['attribute_5'] = '12';
|
||||
$_GET['attribute_7'] = '18';
|
||||
|
||||
$this->mockRepo->expects($this->once())
|
||||
->method('listForApi')
|
||||
->with(
|
||||
$this->callback(function ($filters) {
|
||||
return isset($filters['attributes'])
|
||||
&& $filters['attributes'][5] === 12
|
||||
&& $filters['attributes'][7] === 18;
|
||||
}),
|
||||
$this->anything(),
|
||||
$this->anything(),
|
||||
$this->anything(),
|
||||
$this->anything()
|
||||
)
|
||||
->willReturn(['items' => [], 'total' => 0, 'page' => 1, 'per_page' => 50]);
|
||||
|
||||
ob_start();
|
||||
$this->controller->list();
|
||||
ob_get_clean();
|
||||
}
|
||||
}
|
||||
|
||||
BIN
updates/0.30/ver_0.301.zip
Normal file
BIN
updates/0.30/ver_0.301.zip
Normal file
Binary file not shown.
26
updates/0.30/ver_0.301_manifest.json
Normal file
26
updates/0.30/ver_0.301_manifest.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"changelog": "NEW - Ukrywalne filtry tabel, mobilna wersja szczegółów zamówienia",
|
||||
"version": "0.301",
|
||||
"files": {
|
||||
"added": [
|
||||
"admin/layout/style-css/order-details-mobile.css"
|
||||
],
|
||||
"deleted": [
|
||||
|
||||
],
|
||||
"modified": [
|
||||
"admin/layout/style-css/table-list.css",
|
||||
"admin/templates/components/table-list.php",
|
||||
"admin/templates/shop-order/order-details.php",
|
||||
"admin/templates/site/main-layout.php"
|
||||
]
|
||||
},
|
||||
"checksum_zip": "sha256:e823d9ff8d4e41a65a68bfc46d854db4c4e3dab6d39ca38207a4894a45d7be0f",
|
||||
"sql": [
|
||||
|
||||
],
|
||||
"date": "2026-02-22",
|
||||
"directories_deleted": [
|
||||
|
||||
]
|
||||
}
|
||||
BIN
updates/0.30/ver_0.302.zip
Normal file
BIN
updates/0.30/ver_0.302.zip
Normal file
Binary file not shown.
19
updates/0.30/ver_0.302_manifest.json
Normal file
19
updates/0.30/ver_0.302_manifest.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": "0.302",
|
||||
"date": "2026-02-22",
|
||||
"checksum_zip": "sha256:9a105e21eefa97b885d75f000be958e0604f119a01f0266ffc8ecdb34b346a7c",
|
||||
"files": {
|
||||
"modified": [
|
||||
"autoload/Domain/Attribute/AttributeRepository.php",
|
||||
"autoload/Domain/Product/ProductRepository.php",
|
||||
"autoload/api/ApiRouter.php",
|
||||
"autoload/api/Controllers/DictionariesApiController.php",
|
||||
"autoload/api/Controllers/ProductsApiController.php"
|
||||
],
|
||||
"added": [],
|
||||
"deleted": []
|
||||
},
|
||||
"directories_deleted": [],
|
||||
"sql": [],
|
||||
"changelog": "NEW - REST API wariantow produktow (CRUD), slownik atrybutow, filtrowanie po atrybutach, wzbogacone atrybuty z tlumaczeniami"
|
||||
}
|
||||
BIN
updates/0.30/ver_0.303.zip
Normal file
BIN
updates/0.30/ver_0.303.zip
Normal file
Binary file not shown.
26
updates/0.30/ver_0.303_manifest.json
Normal file
26
updates/0.30/ver_0.303_manifest.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"changelog": "FIX - naprawiono wyswietlanie atrybutow produktu na froncie (kolizja kolejnosci), NEW - przycisk Podglad w edycji produktu",
|
||||
"version": "0.303",
|
||||
"files": {
|
||||
"added": [
|
||||
|
||||
],
|
||||
"deleted": [
|
||||
|
||||
],
|
||||
"modified": [
|
||||
"admin/templates/components/form-edit.php",
|
||||
"autoload/Domain/Product/ProductRepository.php",
|
||||
"autoload/admin/Controllers/ShopProductController.php",
|
||||
"autoload/admin/ViewModels/Forms/FormAction.php"
|
||||
]
|
||||
},
|
||||
"checksum_zip": "sha256:6d8cc0c3419c50345d9c4fa1f526a09004194cbf7f76302f3cfe7afe64b00545",
|
||||
"sql": [
|
||||
|
||||
],
|
||||
"date": "2026-02-22",
|
||||
"directories_deleted": [
|
||||
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,17 @@
|
||||
<b>ver. 0.304 - 22.02.2026</b><br />
|
||||
NEW - konfigurowalne limity kwotowe metod platnosci (min/max kwota zamowienia), zastapienie hardcoded warunku PayPo
|
||||
<hr>
|
||||
<b>ver. 0.303 - 22.02.2026</b><br />
|
||||
FIX - naprawiono wyswietlanie atrybutow produktu na froncie (kolizja kolejnosci), NEW - przycisk Podglad w edycji produktu
|
||||
<hr>
|
||||
<b>ver. 0.302 - 22.02.2026</b><br />
|
||||
NEW - REST API wariantów produktów (CRUD), słownik atrybutów, filtrowanie po atrybutach, wzbogacone atrybuty z tłumaczeniami
|
||||
<hr>
|
||||
<b>ver. 0.301 - 22.02.2026</b><br />
|
||||
NEW - Ukrywalne filtry tabel, mobilna wersja szczegółów zamówienia
|
||||
<hr>
|
||||
<b>ver. 0.300 - 21.02.2026</b><br />
|
||||
- NEW - System aktualizacji oparty na manifestach JSON (checksum SHA256, backup plików, automatyczny build)
|
||||
- NEW - System aktualizacji oparty na manifestach JSON (checksum SHA256, backup plikĂłw, automatyczny build)
|
||||
- NEW - Panel logu aktualizacji w panelu admina
|
||||
<hr>
|
||||
<b>ver. 0.299 - 21.02.2026</b><br />
|
||||
@@ -9,31 +21,31 @@
|
||||
- FIX - kilka poprawek po aktualizacji
|
||||
<hr>
|
||||
<b>ver. 0.297 - 19.02.2026</b><br />
|
||||
- NEW - REST API produktów (lista, szczegóły, tworzenie, aktualizacja)
|
||||
- NEW - Endpoint products z filtrowaniem, sortowaniem i paginacją
|
||||
- NEW - Partial update produktów (tylko zmienione pola)
|
||||
- NEW - REST API produktów (lista, szczegóły, tworzenie, aktualizacja)
|
||||
- NEW - Endpoint products z filtrowaniem, sortowaniem i paginacjÄ…
|
||||
- NEW - Partial update produktĂłw (tylko zmienione pola)
|
||||
<hr>
|
||||
<b>ver. 0.296 - 19.02.2026</b><br />
|
||||
- NEW - REST API zamówień dla ordersPRO (lista, szczegóły, zmiana statusu, płatności)
|
||||
- NEW - Endpointy słownikowe (statusy, transporty, metody płatności)
|
||||
- NEW - REST API zamówień dla ordersPRO (lista, szczegóły, zmiana statusu, płatności)
|
||||
- NEW - Endpointy słownikowe (statusy, transporty, metody płatności)
|
||||
- NEW - Autentykacja API przez X-Api-Key header
|
||||
- NEW - Kolumna updated_at w pp_shop_orders (polling zmian)
|
||||
<hr>
|
||||
<b>ver. 0.295 - 19.02.2026</b><br />
|
||||
- NEW - Edycja produktów w zamówieniu z panelu admina (dodawanie, usuwanie, zmiana ilości/cen)
|
||||
- NEW - Wyszukiwarka produktów AJAX w formularzu edycji zamówienia
|
||||
- NEW - Automatyczna korekta stanów magazynowych i przeliczanie kosztu dostawy
|
||||
- FIX - Cena promo w zamówieniu = 0 gdy identyczna z ceną bazową
|
||||
- NEW - Edycja produktów w zamówieniu z panelu admina (dodawanie, usuwanie, zmiana ilości/cen)
|
||||
- NEW - Wyszukiwarka produktĂłw AJAX w formularzu edycji zamĂłwienia
|
||||
- NEW - Automatyczna korekta stanĂłw magazynowych i przeliczanie kosztu dostawy
|
||||
- FIX - Cena promo w zamĂłwieniu = 0 gdy identyczna z cenÄ… bazowÄ…
|
||||
<hr>
|
||||
<b>ver. 0.294 - 19.02.2026</b><br />
|
||||
- FIX - Code review zakończony (96/96 klas, ~1144 metod): 27 fixów across all layers
|
||||
- FIX - Code review zakończony (96/96 klas, ~1144 metod): 27 fixów across all layers
|
||||
- FIX - Domain: null guard na query()->fetchAll() w 8 repozytoriach, redundancja DI w PromotionRepository
|
||||
- FIX - Admin: null safety find() ?: [] w 10 kontrolerach, null guard w App logowaniu/2FA
|
||||
- FIX - Front: LayoutEngine undefined $level + $_GET null check, ShopBasketController missing global $lang_id
|
||||
- FIX - Shared: Helpers $_GET null check + bug 'png' → 'image/png' (Imagick lossless WebP nigdy nie działał)
|
||||
- FIX - Shared: Helpers $_GET null check + bug 'png' → 'image/png' (Imagick lossless WebP nigdy nie działał)
|
||||
<hr>
|
||||
<b>ver. 0.293 - 19.02.2026</b><br />
|
||||
- FIX - ArticleRepository: SQL injection fix (addslashes→parameterized), uproszczenie articleDetailsFrontend
|
||||
- FIX - ArticleRepository: SQL injection fix (addslashes→parameterized), uproszczenie articleDetailsFrontend
|
||||
- FIX - AttributeRepository: martwy class_exists('\S') blokowal czyszczenie cache/temp
|
||||
- FIX - CategoryRepository: martwy class_exists('\S') blokowal generowanie linkow SEO kategorii
|
||||
- FIX - BannerRepository: parametryzacja dat w SQL + null guard na query()
|
||||
@@ -52,12 +64,12 @@
|
||||
- UPDATE - front\controls\Site przemianowany na front\App (router, camelCase: checkUrlParams, pageTitle)
|
||||
- UPDATE - front\view\Site przemianowany na front\LayoutEngine (layout engine, camelCase: cookieInformation)
|
||||
- CLEANUP - usuniete autoload/front/controls/ i autoload/front/view/ (puste foldery + pliki legacy)
|
||||
- UPDATE - usuniecie 12 legacy klas z autoload/shop/ (~2363 linii) — pelna migracja na Domain-Driven Architecture
|
||||
- UPDATE - usuniecie 12 legacy klas z autoload/shop/ (~2363 linii) — pelna migracja na Domain-Driven Architecture
|
||||
- UPDATE - class.Order.php: logika Apilo sync i email statusu przeniesiona do OrderAdminService
|
||||
- UPDATE - class.Product.php: ~20 metod przeniesionych do ProductRepository, calculate_basket_product_price do BasketCalculator
|
||||
- FIX - findCached(): stale Redis cache z obiektami \shop\Product powodowal ceny 0,00 zl
|
||||
- FIX - szablony: konwersja object access na array access po migracji Product
|
||||
- UPDATE - AttributeRepository::getAttributeValueById() — dodano Redis cache
|
||||
- UPDATE - AttributeRepository::getAttributeValueById() — dodano Redis cache
|
||||
- CLEANUP - katalog autoload/shop/ pusty, zero referencji \shop\ w aktywnym kodzie
|
||||
<hr>
|
||||
<b>ver. 0.291 - 17.02.2026</b><br />
|
||||
@@ -101,17 +113,17 @@
|
||||
- FIX - Tpl::render() branch 3: sprawdzal templates_user ale ladowal templates
|
||||
<hr>
|
||||
<b>ver. 0.284 - 16.02.2026</b><br />
|
||||
- CLEANUP - usunieta klasa DbModel (base ORM) — logika wbudowana bezposrednio w shop\Promotion
|
||||
- CLEANUP - usunieta klasa DbModel (base ORM) — logika wbudowana bezposrednio w shop\Promotion
|
||||
<hr>
|
||||
<b>ver. 0.283 - 16.02.2026</b><br />
|
||||
- UPDATE - migracja class.S.php do Shared\Helpers\Helpers (~140 plikow przepietych)
|
||||
- UPDATE - migracja class.Html.php do Shared\Html\Html
|
||||
- UPDATE - migracja class.Email.php do Shared\Email\Email
|
||||
- UPDATE - migracja class.Image.php do Shared\Image\ImageManipulator
|
||||
- UPDATE - migracja class.Log.php do Shared\Log\Log (usunieta — logika przeniesiona)
|
||||
- UPDATE - migracja class.Log.php do Shared\Log\Log (usunieta — logika przeniesiona)
|
||||
- CLEANUP - usunieta class.Mobile_Detect.php (przestarzala detekcja UA)
|
||||
- CLEANUP - usunieto 12 nieuzywanych metod z klasy S
|
||||
- FIX - array_cartesian_product() — blad iteracji po niezdefiniowanej zmiennej
|
||||
- FIX - array_cartesian_product() — blad iteracji po niezdefiniowanej zmiennej
|
||||
<hr>
|
||||
<b>ver. 0.282 - 16.02.2026</b><br />
|
||||
- UPDATE - Cache cleanup: eliminacja legacy class.Cache.php, migracja CacheHandler i RedisConnection do Shared\Cache namespace
|
||||
@@ -123,7 +135,7 @@
|
||||
<hr>
|
||||
<b>ver. 0.281 - 16.02.2026</b><br />
|
||||
- UPDATE - migracja Banners frontend: factory + view do Domain/Views (DI)
|
||||
- NEW - `front\Views\Banners` — czysty VIEW (banners, mainBanner)
|
||||
- NEW - `front\Views\Banners` — czysty VIEW (banners, mainBanner)
|
||||
- UPDATE - `BannerRepository` rozszerzony o 2 metody frontendowe (banners, mainBanner) z Redis cache
|
||||
- UPDATE - `front\view\Site::show()` przepiety na repo + Views
|
||||
- CLEANUP - usuniete: front\factory\Banners, front\view\Banners
|
||||
@@ -131,10 +143,10 @@
|
||||
<hr>
|
||||
<b>ver. 0.280 - 16.02.2026</b><br />
|
||||
- UPDATE - migracja Articles frontend: factory + view + encja do Domain/Views (DI)
|
||||
- NEW - `front\Views\Articles` — czysty VIEW + utility (renderowanie, generateTableOfContents, generateHeadersIds, getImage)
|
||||
- NEW - `front\Views\Articles` — czysty VIEW + utility (renderowanie, generateTableOfContents, generateHeadersIds, getImage)
|
||||
- UPDATE - `ArticleRepository` rozszerzony o 8 metod frontendowych (z Redis cache)
|
||||
- UPDATE - `front\view\Site::show()` — 5 sekcji przepietych na repo + Views
|
||||
- UPDATE - `front\controls\Site::route()` — single article + page_type switch przepiete na repo + Views
|
||||
- UPDATE - `front\view\Site::show()` — 5 sekcji przepietych na repo + Views
|
||||
- UPDATE - `front\controls\Site::route()` — single article + page_type switch przepiete na repo + Views
|
||||
- UPDATE - 5 szablonow `templates/articles/*` przepietych na `\front\Views\Articles::`
|
||||
- CLEANUP - usuniete: `class.Article` (encja + metody statyczne), `front\factory\Settings` (fasada)
|
||||
- FIX - eliminacja `global $lang` z `articleNoindex()`, eliminacja zaleznosci od `front\factory\Pages::page_sort()`
|
||||
@@ -145,22 +157,22 @@
|
||||
- UPDATE - nowy namespace `front\Controllers` z `NewsletterController` (DI via factory closures)
|
||||
- UPDATE - nowy namespace `front\Views` z `Languages` i `Newsletter` (czyste VIEW, statyczne metody)
|
||||
- UPDATE - routing frontend: `Site::getControllerFactories()` z fallback na stare kontrolery
|
||||
- FIX - `newsletter_unsubscribe()` — poprawiona skladnia medoo `delete()` (2 argumenty zamiast 3)
|
||||
- UPDATE - eliminacja fasady `front\factory\Languages` — 26 zaleznosci przepietych na `LanguagesRepository`
|
||||
- FIX - `newsletter_unsubscribe()` — poprawiona skladnia medoo `delete()` (2 argumenty zamiast 3)
|
||||
- UPDATE - eliminacja fasady `front\factory\Languages` — 26 zaleznosci przepietych na `LanguagesRepository`
|
||||
- CLEANUP - usuniete: `front\factory\Languages`, `front\factory\Newsletter`, `front\view\Languages`, `front\view\Newsletter`, `front\controls\Newsletter`
|
||||
- UPDATE - testy: `OK (437 tests, 1398 assertions)`
|
||||
<hr>
|
||||
<b>ver. 0.278 - 16.02.2026</b><br />
|
||||
- UPDATE - migracja Settings + Languages do wspolnych klas Domain (z cache Redis)
|
||||
- FIX - `get_single_settings_value()` — parametr `$param` poprawnie uzywany (wczesniej hardcoded `firm_name`)
|
||||
- FIX - `get_single_settings_value()` — parametr `$param` poprawnie uzywany (wczesniej hardcoded `firm_name`)
|
||||
<hr>
|
||||
<b>ver. 0.277 - 16.02.2026</b><br />
|
||||
- NEW - migracja modulu `ShopProduct` (factory) — pelna migracja ~40 metod do `ProductRepository` + ~30 akcji w `ShopProductController`
|
||||
- NEW - migracja modulu `ShopProduct` (factory) — pelna migracja ~40 metod do `ProductRepository` + ~30 akcji w `ShopProductController`
|
||||
- NEW - migracja modulu `Dashboard` do Domain + DI (`DashboardRepository`, `DashboardController`)
|
||||
- NEW - migracja modulu `Update` do Domain + DI (`UpdateRepository`, `UpdateController`)
|
||||
- UPDATE - klasa `admin\Site` przemianowana na `admin\App` (plik `App.php`)
|
||||
- UPDATE - refaktoring routingu — usunieto fallback na stare kontrolery, uproszczony routing
|
||||
- UPDATE - template `update/main-view.php` — panele zamiast `gridEdit`, `$.confirm()` zamiast `$.prompt()`
|
||||
- UPDATE - refaktoring routingu — usunieto fallback na stare kontrolery, uproszczony routing
|
||||
- UPDATE - template `update/main-view.php` — panele zamiast `gridEdit`, `$.confirm()` zamiast `$.prompt()`
|
||||
- CLEANUP - usuniete stare foldery: `autoload/admin/controls/`, `autoload/admin/factory/`, `autoload/admin/view/`
|
||||
- CLEANUP - usuniete legacy: `class.Dashboard.php` (controls/shop), `class.Update.php` (controls/factory/view), `class.Articles.php` (factory), `class.Page.php` (view), `class.ShopProduct.php` (controls/factory/view)
|
||||
- UPDATE - `front\factory\Newsletter` przepieta na `ArticleRepository::articlesByDateAdd()`
|
||||
@@ -249,12 +261,12 @@
|
||||
- UPDATE - pliki aktualizacji: `updates/0.20/ver_0.268.zip`, `ver_0.268_files.txt`
|
||||
<hr>
|
||||
<b>ver. 0.267 - 13.02.2026</b><br />
|
||||
- FIX - front: poprawione dobieranie layoutu dla kategorii/produktu/koszyka i innych stron modułowych (fallback do layoutu domyślnego)
|
||||
- FIX - produkt/koszyk: poprawiona obsługa ilości dla kombinacji (stan 0 po dodaniu do koszyka, limit max, odczyt `stock_0_buy`)
|
||||
- FIX - produkt: usunięty błąd JS `TypeError: $(...).visible is not a function` (zamiana na `:visible`)
|
||||
- FIX - SEO redirecty produktów: blokada konfliktów po kopiowaniu URL oraz utwardzone wykrywanie pętli redirectów (`lang_id` + graf przejść)
|
||||
- UPDATE - admin: `input-switch` zapisuje wartość `on` (spójnie z obsługą pól checkbox w formularzach)
|
||||
- CLEANUP - usunięte pliki: `apilo-bck`, `geocode-cache.php`
|
||||
- FIX - front: poprawione dobieranie layoutu dla kategorii/produktu/koszyka i innych stron modułowych (fallback do layoutu domyślnego)
|
||||
- FIX - produkt/koszyk: poprawiona obsługa ilości dla kombinacji (stan 0 po dodaniu do koszyka, limit max, odczyt `stock_0_buy`)
|
||||
- FIX - produkt: usunięty błąd JS `TypeError: $(...).visible is not a function` (zamiana na `:visible`)
|
||||
- FIX - SEO redirecty produktów: blokada konfliktów po kopiowaniu URL oraz utwardzone wykrywanie pętli redirectów (`lang_id` + graf przejść)
|
||||
- UPDATE - admin: `input-switch` zapisuje wartość `on` (spójnie z obsługą pól checkbox w formularzach)
|
||||
- CLEANUP - usunięte pliki: `apilo-bck`, `geocode-cache.php`
|
||||
- UPDATE - testy: `OK (235 tests, 682 assertions)`
|
||||
- UPDATE - pliki aktualizacji: `updates/0.20/ver_0.267.zip`, `ver_0.267_files.txt`, `ver_0.267_sql.txt`
|
||||
<hr>
|
||||
@@ -328,7 +340,7 @@
|
||||
<hr><b>ver. 0.257 - 12.02.2026</b><br />
|
||||
- NEW - migracja modulu `Newsletter` do architektury Domain + DI (`Domain\\Newsletter\\NewsletterRepository`, `Domain\\Newsletter\\NewsletterPreviewRenderer`, `admin\\Controllers\\NewsletterController`)
|
||||
- UPDATE - widoki `/admin/newsletter/*` przepiete z legacy `grid/gridEdit` na nowe komponenty (`components/table-list`, `components/form-edit`) + nowy endpoint `/admin/newsletter/preview/`
|
||||
- UPDATE - routing DI (`admin\\Site`) rozszerzony o moduł `Newsletter`
|
||||
- UPDATE - routing DI (`admin\\Site`) rozszerzony o moduł `Newsletter`
|
||||
- UPDATE - `admin\\factory\\Newsletter` dziala jako fasada do nowego repozytorium (backward compatibility)
|
||||
- UPDATE - `front\\factory\\Newsletter` nie korzysta juz z `admin\\view\\Newsletter`
|
||||
- CLEANUP - usuniete legacy klasy `autoload/admin/controls/class.Newsletter.php`, `autoload/admin/view/class.Newsletter.php`
|
||||
@@ -349,7 +361,7 @@
|
||||
- UPDATE - migracja widokow languages (`languages-list`, `language-edit`, `translations-list`, `translation-edit`) na `components/table-list` i `components/form-edit`
|
||||
- UPDATE - routing DI dla `Languages` w `admin\\Site` oraz kompatybilna fasada `admin\\factory\\Languages` delegujaca do repozytorium
|
||||
- UPDATE - naprawiono zapis edycji jezyka (ID jezyka pobierane z URL przy edycji)
|
||||
- UPDATE - globalne poprawki UX filtrów w `components/table-list` (kompaktowe kolumny `Aktywny`/`Domyslny`, spacing i pelna szerokosc selecta)
|
||||
- UPDATE - globalne poprawki UX filtrĂłw w `components/table-list` (kompaktowe kolumny `Aktywny`/`Domyslny`, spacing i pelna szerokosc selecta)
|
||||
- CLEANUP - usuniete legacy klasy: `autoload/admin/controls/class.Languages.php`, `autoload/admin/view/class.Languages.php`
|
||||
<hr>
|
||||
<b>ver. 0.253 - 12.02.2026</b><br />
|
||||
@@ -412,74 +424,74 @@
|
||||
- UPDATE - refaktoryzacja: article_save przeniesiony do Domain\Article\ArticleRepository::save() z prywatnymi helperami
|
||||
- UPDATE - refaktoryzacja: article_delete przeniesiony do Domain\Article\ArticleRepository::archive()
|
||||
- UPDATE - ArticlesController: nowe akcje save() i delete() z DI
|
||||
- UPDATE - admin\factory\Articles::article_save() i articles_set_archive() delegują do repozytorium (kompatybilność)
|
||||
- UPDATE - admin\factory\Articles::article_save() i articles_set_archive() delegują do repozytorium (kompatybilność)
|
||||
<hr><b>ver. 0.243</b><br />
|
||||
- UPDATE - refaktoryzacja: cleanup nieprzypisanych plików/zdjęć artykułów przeniesiony do Domain\Article\ArticleRepository
|
||||
- UPDATE - ArticlesController::edit() używa repozytorium do cleanupu, a admin\factory\Articles zachowuje delegowanie (kompatybilność)
|
||||
- UPDATE - refaktoryzacja: cleanup nieprzypisanych plików/zdjęć artykułów przeniesiony do Domain\Article\ArticleRepository
|
||||
- UPDATE - ArticlesController::edit() używa repozytorium do cleanupu, a admin\factory\Articles zachowuje delegowanie (kompatybilność)
|
||||
<hr><b>ver. 0.242</b><br />
|
||||
- NEW - refaktoryzacja: Domain\Article\ArticleRepository + migracja article_edit do admin\Controllers\ArticlesController (DI)
|
||||
- UPDATE - admin\factory\Articles::article_details() deleguje do nowego repozytorium (kompatybilność zachowana)
|
||||
- UPDATE - metody przejęte przez nowe kontrolery oznaczone jako @deprecated w legacy kontrolerach admin\controls
|
||||
- UPDATE - admin\factory\Articles::article_details() deleguje do nowego repozytorium (kompatybilność zachowana)
|
||||
- UPDATE - metody przejęte przez nowe kontrolery oznaczone jako @deprecated w legacy kontrolerach admin\controls
|
||||
<hr><b>ver. 0.241</b><br />
|
||||
- NEW - refaktoryzacja: admin\Controllers\ProductArchiveController - archiwum produktów z DI
|
||||
- NEW - refaktoryzacja: admin\Controllers\ProductArchiveController - archiwum produktĂłw z DI
|
||||
- NEW - ProductRepository::archive(), unarchive() - operacje archiwizacji w repozytorium
|
||||
- FIX - naprawiono SQL w liście archiwum (puste wyszukiwanie filtrowało wszystkie wyniki)
|
||||
- FIX - naprawiono brakujący filtr archive = 1 w zapytaniu bez wyszukiwania
|
||||
- UPDATE - wyczyszczono szablony archiwum (usunięto zbędne funkcje: apilo, baselinker, duplikowanie)
|
||||
- FIX - naprawiono SQL w liście archiwum (puste wyszukiwanie filtrowało wszystkie wyniki)
|
||||
- FIX - naprawiono brakujÄ…cy filtr archive = 1 w zapytaniu bez wyszukiwania
|
||||
- UPDATE - wyczyszczono szablony archiwum (usunięto zbędne funkcje: apilo, baselinker, duplikowanie)
|
||||
<hr>
|
||||
<b>ver. 0.240</b><br />
|
||||
- NEW - refaktoryzacja: Domain\Settings\SettingsRepository + admin\Controllers\SettingsController (architektura Domain-Driven)
|
||||
- NEW - refaktoryzacja: Domain\Cache\CacheRepository - czyszczenie cache z obsługą Redis
|
||||
- FIX - komunikat potwierdzenia zapisu ustawień w panelu administratora
|
||||
- NEW - refaktoryzacja: Domain\Cache\CacheRepository - czyszczenie cache z obsługą Redis
|
||||
- FIX - komunikat potwierdzenia zapisu ustawień w panelu administratora
|
||||
- FIX - naprawiono element #content w layoucie admina (powiadomienia grid.js)
|
||||
<hr><b>ver. 0.239</b><br />
|
||||
- NEW - refaktoryzacja: Domain\Banner\BannerRepository + admin\Controllers\BannerController (pełna migracja kontrolera)
|
||||
- NEW - refaktoryzacja: Domain\Banner\BannerRepository + admin\Controllers\BannerController (pełna migracja kontrolera)
|
||||
- NEW - refaktoryzacja: Domain\Product\ProductRepository::getPrice(), getName() - migracja kolejnych metod
|
||||
- NEW - router admin z obsługą nowych kontrolerów (fallback na stare)
|
||||
- UPDATE - shop\Product::get_product_price(), get_product_name() używają nowego repozytorium (kompatybilność zachowana)
|
||||
- NEW - router admin z obsługą nowych kontrolerów (fallback na stare)
|
||||
- UPDATE - shop\Product::get_product_price(), get_product_name() używają nowego repozytorium (kompatybilność zachowana)
|
||||
<hr>
|
||||
<b>ver. 0.238</b><br />
|
||||
- NEW - refaktoryzacja: Domain\Product\ProductRepository - pierwsza klasa w nowej architekturze Domain-Driven
|
||||
- NEW - Dependency Injection zamiast global variables
|
||||
- UPDATE - shop\Product::get_product_quantity() używa teraz nowego repozytorium (kompatybilność zachowana)
|
||||
- UPDATE - shop\Product::get_product_quantity() używa teraz nowego repozytorium (kompatybilność zachowana)
|
||||
<hr>
|
||||
<b>ver. 0.237</b><br />
|
||||
- NEW - automatyczne czyszczenie cache produktu po aktualizacji przez CRON (Sellasist, Apilo, Baselinker)
|
||||
- UPDATE - przycisk "Wyczyść cache" w panelu administratora z obsługą AJAX i komunikatami o postępie
|
||||
- UPDATE - przycisk "Wyczyść cache" w panelu administratora z obsługą AJAX i komunikatami o postępie
|
||||
<hr>
|
||||
<b>ver. 0.236</b><br />
|
||||
- FIX - zabezpieczenie przed duplikatami zamówień w Apilo - automatyczne pobieranie ID zamówienia przy błędzie "idExternal już wykorzystywany"
|
||||
- FIX - zabezpieczenie przed duplikatami zamówień w Apilo - automatyczne pobieranie ID zamówienia przy błędzie "idExternal już wykorzystywany"
|
||||
<hr>
|
||||
<b>ver. 0.235</b><br />
|
||||
- FIX - poprawka funkcji aktualizacji
|
||||
<hr>
|
||||
<b>ver. 0.234</b><br />
|
||||
- NEW - przycisk zaznaczania zamówienia jako wysłane do trustmate.io
|
||||
- NEW - przycisk zaznaczania zamówienia jako wysłane do trustmate.io
|
||||
<hr>
|
||||
<b>ver. 0.232</b><br />
|
||||
- NEW - opcje GPSR
|
||||
<hr>
|
||||
<b>ver. 0.231</b><br />
|
||||
- FIX - poprawki bezpieczeństwa + dwuetapowa weryfikacja logowania
|
||||
- FIX - poprawki bezpieczeństwa + dwuetapowa weryfikacja logowania
|
||||
<hr>
|
||||
<b>ver. 0.230</b><br />
|
||||
- FIX - poprawki bezpieczeństwa
|
||||
- FIX - poprawki bezpieczeństwa
|
||||
<hr>
|
||||
<b>ver. 0.229</b><br />
|
||||
- NEW - pola dodatkowe z opcją wymagane/niewymagane
|
||||
- NEW - pola dodatkowe z opcjÄ… wymagane/niewymagane
|
||||
<hr>
|
||||
<b>ver. 0.228</b><br />
|
||||
- NEW - cron do wysyłania zamówień do trustmate.io
|
||||
- NEW - cron do wysyłania zamówień do trustmate.io
|
||||
<hr>
|
||||
<b>ver. 0.227</b><br />
|
||||
- NEW - historia kodów rabatowych
|
||||
- NEW - historia kodĂłw rabatowych
|
||||
<hr>
|
||||
<b>ver. 0.226</b><br />
|
||||
- NEW - dodanie opcji faktury do zamówienia
|
||||
- NEW - dodanie opcji faktury do zamĂłwienia
|
||||
<hr>
|
||||
<b>ver. 0.225</b><br />
|
||||
- NEW - przycisk czyszczenia cache<br>
|
||||
- NEW - ponowne wysyłanie zamówienia do apilo
|
||||
- NEW - ponowne wysyłanie zamówienia do apilo
|
||||
<hr>
|
||||
<b>ver. 0.224</b><br />
|
||||
- NEW - sortowanie form dostawy
|
||||
@@ -491,20 +503,20 @@
|
||||
- NEW - integracja z Orlen Paczka
|
||||
<hr>
|
||||
<b>ver. 0.221</b><br />
|
||||
- NEW - Automatyczne przekierowania adresów URL produktów, zmiany w pliku htaccess
|
||||
- NEW - Automatyczne przekierowania adresĂłw URL produktĂłw, zmiany w pliku htaccess
|
||||
<hr>
|
||||
<b>ver. 0.220</b><br />
|
||||
- NEW - Dodanie możliwości wyświetlenia na strone ostatnio dodane produkty [PRODUKTY_NEW] lub [PRODUKTY_NEW:10].<br>
|
||||
- NEW - Dodanie możliwości wyświetlenia na strone popularnych produktów [PRODUKTY_TOP] lub [PRODUKTY_TOP:10].
|
||||
- NEW - Dodanie możliwości wyświetlenia na strone ostatnio dodane produkty [PRODUKTY_NEW] lub [PRODUKTY_NEW:10].<br>
|
||||
- NEW - Dodanie możliwości wyświetlenia na strone popularnych produktów [PRODUKTY_TOP] lub [PRODUKTY_TOP:10].
|
||||
<hr>
|
||||
<b>ver. 0.219</b><br />
|
||||
- NEW - Dodanie możliwości zmiany daty w artykułach
|
||||
- NEW - Dodanie możliwości zmiany daty w artykułach
|
||||
<hr>
|
||||
<b>ver. 0.218</b><br />
|
||||
- NEW - indywidualny kod GTM
|
||||
<hr>
|
||||
<b>ver. 0.217</b><br />
|
||||
- NEW - zwiększenie obsługi REDIS
|
||||
- NEW - zwiększenie obsługi REDIS
|
||||
<hr>
|
||||
<b>ver. 0.216</b><br />
|
||||
- NEW - aktualizacja api i cron (apilo)
|
||||
@@ -519,43 +531,43 @@
|
||||
- FIX - wyliczenie darmowej dostawy
|
||||
<hr>
|
||||
<b>ver. 0.212</b><br />
|
||||
- NEW - zmiany w zapisywaniu zamówienia do apilo
|
||||
- NEW - zmiany w zapisywaniu zamĂłwienia do apilo
|
||||
<hr>
|
||||
<b>ver. 0.211</b><br />
|
||||
- NEW - Debugowanie apilo + wyświetlanie podkategorii
|
||||
- NEW - Debugowanie apilo + wyświetlanie podkategorii
|
||||
<hr>
|
||||
<b>ver. 0.210</b><br />
|
||||
- NEW - dodatkowe pola w widoku produktów
|
||||
- NEW - dodatkowe pola w widoku produktĂłw
|
||||
<hr>
|
||||
<b>ver. 0.209</b><br />
|
||||
- NEW - zmiany w widoku produktów (panel administratora)
|
||||
- NEW - zmiany w widoku produktĂłw (panel administratora)
|
||||
<hr>
|
||||
<b>ver. 0.208</b><br />
|
||||
- NEW - zmiany w wyszukiwarce produktów
|
||||
- NEW - zmiany w wyszukiwarce produktĂłw
|
||||
<hr>
|
||||
<b>ver. 0.204-0.207</b><br />
|
||||
- NEW - htaccess update
|
||||
<hr>
|
||||
<b>ver. 0.204-0.206</b><br />
|
||||
- NEW - wysyłanie produktów do apilo
|
||||
- NEW - wysyłanie produktów do apilo
|
||||
<hr>
|
||||
<b>ver. 0.203</b><br />
|
||||
- NEW - zmiana sposobu wyliczania cen produkty z dodatkami
|
||||
<hr>
|
||||
<b>ver. 0.202</b><br />
|
||||
- NEW - dodano "główne zdjęcie" w edycji artykułu
|
||||
- NEW - dodano "główne zdjęcie" w edycji artykułu
|
||||
<hr>
|
||||
<b>ver. 0.201</b><br />
|
||||
- FIX - aktualizacja statusów na podstawie baselinkera
|
||||
- FIX - aktualizacja statusĂłw na podstawie baselinkera
|
||||
<hr>
|
||||
<b>ver. 0.200</b><br />
|
||||
- NEW - wysyłanie produktów do baselinker
|
||||
- NEW - wysyłanie produktów do baselinker
|
||||
<hr>
|
||||
<b>ver. 0.199</b><br />
|
||||
- NEW - usprawnienie edycji danych do XML
|
||||
<hr>
|
||||
<b>ver. 0.198</b><br />
|
||||
- NEW - automatyczne generowanie kodów SKU
|
||||
- NEW - automatyczne generowanie kodĂłw SKU
|
||||
<hr>
|
||||
<b>ver. 0.197</b><br />
|
||||
- FIX - poprawki w Dashboard
|
||||
@@ -564,7 +576,7 @@
|
||||
- FIX - integracja z apilo.com
|
||||
<hr>
|
||||
<b>ver. 0.195</b><br />
|
||||
- FIX - aktualizacja statusów
|
||||
- FIX - aktualizacja statusĂłw
|
||||
<hr>
|
||||
<b>ver. 0.194</b><br />
|
||||
- UPDATE - integracja apilo
|
||||
@@ -573,46 +585,46 @@
|
||||
- UPDATE - aktualizacja synchronizacji z baselinker
|
||||
<hr>
|
||||
<b>ver. 0.192</b><br />
|
||||
- NEW - pobieranie statusów z sellasist
|
||||
- NEW - pobieranie statusĂłw z sellasist
|
||||
<hr>
|
||||
<b>ver. 0.191</b><br />
|
||||
- NEW - integracja z selasist
|
||||
<hr>
|
||||
<b>ver. 0.190</b><br />
|
||||
- FIX - produkty powiązane
|
||||
- FIX - produkty powiÄ…zane
|
||||
<hr>
|
||||
<b>ver. 0.189</b><br />
|
||||
- FIX - ceny promocyjne produktów z dodatkiem
|
||||
- FIX - ceny promocyjne produktĂłw z dodatkiem
|
||||
<hr>
|
||||
<b>ver. 0.188</b><br />
|
||||
- NEW - widok listy produktów
|
||||
- NEW - widok listy produktĂłw
|
||||
<hr>
|
||||
<b>ver. 0.187</b><br />
|
||||
- FIX - pobieranie cen z APILO
|
||||
<hr>
|
||||
<b>ver. 0.186</b><br />
|
||||
- FIX - dodawanie do koszyka tych samych produktów ale z różną personalizacją
|
||||
- FIX - dodawanie do koszyka tych samych produktów ale z różną personalizacją
|
||||
<hr>
|
||||
<b>ver. 0.185</b><br />
|
||||
- FIX - masowa edycja produktów
|
||||
- FIX - masowa edycja produktĂłw
|
||||
<hr>
|
||||
<b>ver. 0.184</b><br />
|
||||
- NEW - druga część integracji z apilo, masowa edycja produktów
|
||||
- NEW - druga część integracji z apilo, masowa edycja produktów
|
||||
<hr>
|
||||
<b>ver. 0.183</b><br />
|
||||
- NEW - pierwsza część integracji z apilo
|
||||
- NEW - pierwsza część integracji z apilo
|
||||
<hr>
|
||||
<b>ver. 0.182</b><br />
|
||||
- FIX - layout
|
||||
<hr>
|
||||
<b>ver. 0.181</b><br />
|
||||
- NEW - infinitescroll - opcja włączy/wyłącz
|
||||
- NEW - infinitescroll - opcja włączy/wyłącz
|
||||
<hr>
|
||||
<b>ver. 0.180</b><br />
|
||||
- NEW - aktualizacja dashboard
|
||||
<hr>
|
||||
<b>ver. 0.179</b><br />
|
||||
- NEW - obsługa EAN
|
||||
- NEW - obsługa EAN
|
||||
<hr>
|
||||
<b>ver. 0.177, 0.178</b><br />
|
||||
- FIX - custom_label
|
||||
@@ -628,7 +640,7 @@
|
||||
<hr>
|
||||
<b>ver. 0.173</b><br />
|
||||
- NEW - duplikowanie produktu wraz z kombinacjami
|
||||
- NEW - dodanie przechodzenia pomiędzy zamówienia (poprzednie/następne zamówienie)
|
||||
- NEW - dodanie przechodzenia pomiędzy zamówienia (poprzednie/następne zamówienie)
|
||||
<hr>
|
||||
<b>ver. 0.172</b><br />
|
||||
- FIX - poprawki w Cache
|
||||
@@ -640,22 +652,22 @@
|
||||
- NEW - usuwanie cache produktu przy zapisie
|
||||
<hr>
|
||||
<b>ver. 0.169</b><br />
|
||||
- FIX - poprawki w liście produktów
|
||||
- FIX - poprawki w liście produktów
|
||||
<hr>
|
||||
<b>ver. 0.168</b><br />
|
||||
- NEW - archiwum produktów
|
||||
- NEW - archiwum produktĂłw
|
||||
<hr>
|
||||
<b>ver. 0.167</b><br />
|
||||
- NEW - dodanie obsługi cen i stanów magazynowych kombinacji produktów
|
||||
- NEW - dodanie obsługi cen i stanów magazynowych kombinacji produktów
|
||||
<hr>
|
||||
<b>ver. 0.166</b><br />
|
||||
- NEW - współpraca z GTM
|
||||
- NEW - współpraca z GTM
|
||||
<hr>
|
||||
<b>ver. 0.164/5</b><br />
|
||||
- FIX - ukrywanie produktów nieaktywnych
|
||||
- FIX - ukrywanie produktĂłw nieaktywnych
|
||||
<hr>
|
||||
<b>ver. 0.163</b><br />
|
||||
- NEW - automatyczne podpowiadanie produktów do zestawu na podstawie wcześniejszych zakupów klientów
|
||||
- NEW - automatyczne podpowiadanie produktów do zestawu na podstawie wcześniejszych zakupów klientów
|
||||
<hr>
|
||||
<b>ver. 0.162</b><br />
|
||||
- NEW - GA4
|
||||
@@ -671,7 +683,7 @@
|
||||
- FIX - cron Baselinker
|
||||
<hr>
|
||||
<b>ver. 0.158</b><br />
|
||||
- UPDATE - poprawa kolorystyki przycisków
|
||||
- UPDATE - poprawa kolorystyki przyciskĂłw
|
||||
<hr>
|
||||
<b>ver. 0.157</b><br />
|
||||
- NEW - szybka zmiana statusu produktu
|
||||
@@ -683,10 +695,10 @@
|
||||
- NEW - infinite scroll w widoku kategorii
|
||||
<hr>
|
||||
<b>ver. 0.154</b><br />
|
||||
- FIX - atrybuty produktów
|
||||
- FIX - atrybuty produktĂłw
|
||||
<hr>
|
||||
<b>ver. 0.153</b><br />
|
||||
- FIX - atrybuty produktów
|
||||
- FIX - atrybuty produktĂłw
|
||||
<hr>
|
||||
<b>ver. 0.152</b><br />
|
||||
- FIX - tematy maili
|
||||
@@ -695,7 +707,7 @@
|
||||
- FIX - tematy maili
|
||||
<hr>
|
||||
<b>ver. 0.150</b><br />
|
||||
- NEW - domyślna forma transportu
|
||||
- NEW - domyślna forma transportu
|
||||
<hr>
|
||||
<b>ver. 0.149</b><br />
|
||||
- NEW - tematy maili
|
||||
@@ -713,10 +725,10 @@
|
||||
- NEW - omnibus ready
|
||||
<hr>
|
||||
<b>ver. 0.144</b><br />
|
||||
- FIX - usunięcie adresu marianek.pl z kodu
|
||||
- FIX - usunięcie adresu marianek.pl z kodu
|
||||
<hr>
|
||||
<b>ver. 0.143</b><br />
|
||||
- FIX - poprawa generowania plików WEBP
|
||||
- FIX - poprawa generowania plikĂłw WEBP
|
||||
<hr>
|
||||
<b>ver. 0.142</b><br />
|
||||
- FIX - poprawa adresu strony głównej
|
||||
- FIX - poprawa adresu strony głównej
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?
|
||||
$current_ver = 300;
|
||||
<?
|
||||
$current_ver = 304;
|
||||
|
||||
for ($i = 1; $i <= $current_ver; $i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user