From 3f595dc9643fe5cc9f4c5cb10362c23d4c0a2b86 Mon Sep 17 00:00:00 2001 From: devEcommercePL <155567765+devEcommercePL@users.noreply.github.com> Date: Wed, 2 Jul 2025 23:27:49 +0200 Subject: [PATCH 1/7] Update YesNo.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Accept capital-initial “Yes/No” and “Tak/Nie” in YesNo::cast() • Added “Yes” and “Tak” to TRUE_LIKE. • Added “No” and “Nie” to FALSE_LIKE. This makes the boolean cast more forgiving when consuming data that capitalises only the first letter, improving robustness of Shopware integrations without changing existing behaviour. --- src/Util/YesNo.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Util/YesNo.php b/src/Util/YesNo.php index c4d92ad..b89c16b 100644 --- a/src/Util/YesNo.php +++ b/src/Util/YesNo.php @@ -13,11 +13,13 @@ class YesNo '1', 'YES', 'yes', + 'Yes', 'Y', 'y', 'A', 'a', - 'tak' + 'tak', + 'Tak' ]; private const FALSE_LIKE = [ @@ -27,11 +29,13 @@ class YesNo '0', 'NO', 'no', + 'No', 'N', 'n', 'B', 'b', - 'nie' + 'nie', + 'Nie' ]; public static function cast(string|bool|int $value): bool From 4773c48fd1a0d08e292192f4549faacc2fa1c19f Mon Sep 17 00:00:00 2001 From: devEcommercePL <155567765+devEcommercePL@users.noreply.github.com> Date: Sun, 10 Aug 2025 20:53:25 +0200 Subject: [PATCH 2/7] =?UTF-8?q?fix=20correct=20variant=20grouping=20by=20a?= =?UTF-8?q?lways=20assigning=20a=20parent=20and=20creating=20configurator?= =?UTF-8?q?=20settings=20-=20When=20no=20persisted=20parent=20exists,=20ge?= =?UTF-8?q?nerate/set=20a=20parent=20product=20ID=20(using=20Uuid::randomH?= =?UTF-8?q?ex())=20on=20$swData=20and=20use=20it=20as=20parentId=20for=20a?= =?UTF-8?q?ll=20variants.=20-=20Fallback=20to=20variantListingConfig=20pro?= =?UTF-8?q?perty=20check=20(instead=20of=20displayParent)=20to=20keep=20pa?= =?UTF-8?q?rent=20listing=20behavior=20compatible=20with=20newer=20Shopwar?= =?UTF-8?q?e=20versions.=20-=20For=20variants=20that=20don=E2=80=99t=20yet?= =?UTF-8?q?=20exist=20in=20SW,=20create=20configurator=20settings=20from?= =?UTF-8?q?=20their=20options=20with=20productId=20=3D=20resolved=20parent?= =?UTF-8?q?=20ID.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Transformer/VariantsTransformer.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Transformer/VariantsTransformer.php b/src/Transformer/VariantsTransformer.php index 85126a0..9da5d4d 100644 --- a/src/Transformer/VariantsTransformer.php +++ b/src/Transformer/VariantsTransformer.php @@ -79,13 +79,31 @@ public function transform(ProductTransformationDTO $productData, Context $contex $shopwareData = $variant->getShopwareData(); if (null !== $parentProduct) { - $shopwareData->setParentId($parentProduct->getId()); + $parentProductId = $parentProduct->getId(); + } else{ + if(!$swData->getData('id')) { + $swData->setId(Uuid::randomHex()); + } + + $parentProductId = $swData->getData('id'); } + $shopwareData->setParentId($parentProductId); + $swData->addChild($shopwareData); - if (property_exists(ProductEntity::class, 'displayParent')) { + if (property_exists(ProductEntity::class, 'variantListingConfig')) { $swData->setDisplayParent(); } + + if(!$variant->getSwProduct()) { + foreach ($variant->getShopwareData()->getData('options') as $option) { + $swData->addConfigrationSettings([ + 'id' => null, + 'productId' => $parentProductId, + 'optionId' => $option['id'], + ]); + } + } foreach ($variant->getSwProduct()?->getOptionIds() ?? [] as $optionId) { if ( From 1ad8984acd603976212ac9bdb1a183bd41f046eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Andrzejewski?= Date: Sun, 10 Aug 2025 21:16:49 +0200 Subject: [PATCH 3/7] fix correct variant grouping by always assigning a parent and creating configurator settings --- src/DTO/ProductShopwareData.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/DTO/ProductShopwareData.php b/src/DTO/ProductShopwareData.php index 77a5946..52c4da4 100644 --- a/src/DTO/ProductShopwareData.php +++ b/src/DTO/ProductShopwareData.php @@ -103,7 +103,7 @@ public function setMedia(array $payloads): void $this->data['media'] = $payloads; } - public function setTax(string $taxId): void + public function setTax(?string $taxId): void { $this->data['taxId'] = $taxId; } @@ -148,7 +148,7 @@ public function setProductNumber(string $sku): void $this->data['productNumber'] = $sku; } - public function setPrice(array $pricePayload): void + public function setPrice(?array $pricePayload): void { $this->data['price'] = $pricePayload; } @@ -170,7 +170,12 @@ public function addChild(ProductShopwareData $productShopwareData): void public function setDisplayParent(bool $display = true): void { - $this->data['displayParent'] = $display; + $this->data['variantListingConfig'] = [ + 'extensions' => [], + 'displayParent' => $display, + 'mainVariantId' => null, + 'configuratorGroupConfig' => null + ]; } public function addConfigrationSettings(array $configurationSettings): void From 8e7c2d3315865c6bd648d667740ccc6bf0a049f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Andrzejewski?= Date: Sun, 10 Aug 2025 22:55:07 +0200 Subject: [PATCH 4/7] - Full inheritance for variants - Add filterProductsNotMatchingSkuPattern (filter not products and parts) - Hide attributes with hide metadata value - Disable default filterable attribute for new attributes - Use only selected brands (temporary) --- README.md | 8 ++++ src/DTO/ProductShopwareData.php | 6 +-- src/Persistor/ProductPersistor.php | 16 +++++++ src/Persistor/PropertyGroupPersistor.php | 18 +++++++- .../ManufacturerAttributeProcessor.php | 4 ++ src/QueryBuilder/AttributeQueryBuilder.php | 5 +++ src/Resources/config/config.xml | 15 ++++++- src/Resources/config/services.yml | 1 + src/Service/ConfigService.php | 7 +++ .../ProductCustomBusinessTransformer.php | 43 +++++++++++++++++++ src/Transformer/PropertyGroupTransformer.php | 1 + src/Transformer/VariantsTransformer.php | 6 ++- 12 files changed, 123 insertions(+), 7 deletions(-) create mode 100644 src/Transformer/ProductCustomBusinessTransformer.php diff --git a/README.md b/README.md index 4558e28..266ec90 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,13 @@ # Shopware Ergonode Integration +## Our modification devEcommerce +- Fix adding new variants (wrong grouping) +- Full inheritance for variants +- Add filterProductsNotMatchingSkuPattern (filter not products and parts) +- Hide attributes with hide metadata value +- Disable default filterable attribute for new attributes +- Use only selected brands (temporary) + ## Description This plugin synchronizes data from Ergonode to Shopware. It takes advantage of Ergonode's GraphQL API and utilizes diff --git a/src/DTO/ProductShopwareData.php b/src/DTO/ProductShopwareData.php index 52c4da4..0f5630a 100644 --- a/src/DTO/ProductShopwareData.php +++ b/src/DTO/ProductShopwareData.php @@ -103,7 +103,7 @@ public function setMedia(array $payloads): void $this->data['media'] = $payloads; } - public function setTax(?string $taxId): void + public function setTax(?string $taxId): void // devEcommerce change { $this->data['taxId'] = $taxId; } @@ -148,7 +148,7 @@ public function setProductNumber(string $sku): void $this->data['productNumber'] = $sku; } - public function setPrice(?array $pricePayload): void + public function setPrice(?array $pricePayload): void // devEcommerce change { $this->data['price'] = $pricePayload; } @@ -170,7 +170,7 @@ public function addChild(ProductShopwareData $productShopwareData): void public function setDisplayParent(bool $display = true): void { - $this->data['variantListingConfig'] = [ + $this->data['variantListingConfig'] = [ // devEcommerce change 'extensions' => [], 'displayParent' => $display, 'mainVariantId' => null, diff --git a/src/Persistor/ProductPersistor.php b/src/Persistor/ProductPersistor.php index aee79d9..78eed92 100644 --- a/src/Persistor/ProductPersistor.php +++ b/src/Persistor/ProductPersistor.php @@ -97,6 +97,8 @@ public function persist(array $productListData, Context $context): array $productListData = $this->filterMainProducts($productListData); + $productListData = $this->filterProductsNotMatchingSkuPattern($productListData); // devEcommerce change + foreach ($productListData as $productData) { $mainProductPayload = $this->getProductPayload($productData['node'] ?? [], $context); if ( @@ -306,6 +308,20 @@ private function filterMainProducts(array $productListData): array ); } + // start devEcommerce change + private function filterProductsNotMatchingSkuPattern(array $productListData): array + { + return array_values( + array_filter( + $productListData, + static function (array $productData): bool { + return preg_match('/^V[0-9]+$/', $productData['node']['sku']) === 1; // todo move to configuration + } + ) + ); + } + // stop devEcommerce change + private function extractSkus(array $productListData, bool $onlyVariants = false): array { foreach ($productListData as $productData) { diff --git a/src/Persistor/PropertyGroupPersistor.php b/src/Persistor/PropertyGroupPersistor.php index df84c87..4c4462c 100644 --- a/src/Persistor/PropertyGroupPersistor.php +++ b/src/Persistor/PropertyGroupPersistor.php @@ -9,6 +9,8 @@ use Ergonode\IntegrationShopware\Processor\Attribute\AttributeCustomProcessorResolver; use Ergonode\IntegrationShopware\Provider\PropertyGroupProvider; use Ergonode\IntegrationShopware\Transformer\PropertyGroupTransformer; +use Ergonode\IntegrationShopware\Util\YesNo; +use Ergonode\IntegrationShopware\Service\ConfigService; use Shopware\Core\Content\Property\PropertyGroupDefinition; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; @@ -33,7 +35,8 @@ public function __construct( EntityRepository $propertyGroupOptionRepository, PropertyGroupTransformer $propertyGroupTransformer, PropertyGroupProvider $propertyGroupProvider, - AttributeCustomProcessorResolver $attributeCustomProcessorResolver + AttributeCustomProcessorResolver $attributeCustomProcessorResolver, + private ConfigService $configService ) { $this->propertyGroupRepository = $propertyGroupRepository; $this->propertyGroupOptionRepository = $propertyGroupOptionRepository; @@ -57,6 +60,19 @@ public function persistStream(AttributeStreamResultsProxy $attributes, Context $ continue; } + // start devEcommerce change + $skipMetaHideAttribute = false; + foreach ($node['metadata'] as $metadata) { + if (($metadata['key'] === $this->configService->getHideMetaDataKey() && YesNo::cast($metadata['value']))) { + $skipMetaHideAttribute = true; + break; + } + } + if ($skipMetaHideAttribute) { + continue; + } + // end devEcommerce change + $propertyGroup = $this->propertyGroupProvider->getPropertyGroupByMapping($code, $context); $dto = new PropertyGroupTransformationDTO($node); diff --git a/src/Processor/Attribute/ManufacturerAttributeProcessor.php b/src/Processor/Attribute/ManufacturerAttributeProcessor.php index 0edb59f..173422c 100644 --- a/src/Processor/Attribute/ManufacturerAttributeProcessor.php +++ b/src/Processor/Attribute/ManufacturerAttributeProcessor.php @@ -59,6 +59,10 @@ public function process(array $node, Context $context): void $code = $option['code']; $manufacturerEntity = $this->getExistingManufacturerEntity($code, $context); + if(!in_array($code, ['gymtek', 'outtec', 'kedica', 'queenfit', 'xride', 'luverno', 'stars' ])) { // devCommerce change + continue; + } + $translations = []; foreach ($option['name'] as $nameRow) { $translations[IsoCodeConverter::ergonodeToShopwareIso($nameRow['language'])] = [ diff --git a/src/QueryBuilder/AttributeQueryBuilder.php b/src/QueryBuilder/AttributeQueryBuilder.php index 3378e2f..0c048d1 100644 --- a/src/QueryBuilder/AttributeQueryBuilder.php +++ b/src/QueryBuilder/AttributeQueryBuilder.php @@ -44,6 +44,11 @@ protected function getAttributeSelectionSet(): array ->setSelectionSet([ 'code', 'scope', + (new Query('metadata')) // devEcommerce change + ->setSelectionSet([ + 'key', + 'value', + ]), (new Query('name')) ->setSelectionSet([ 'language', diff --git a/src/Resources/config/config.xml b/src/Resources/config/config.xml index 15c18b5..50c0d40 100644 --- a/src/Resources/config/config.xml +++ b/src/Resources/config/config.xml @@ -26,6 +26,17 @@ + + Fields configuration* + + + hideMetaDataKey + ukryty_w_sklepie + + Enter the exact name of the metadata key used in Ergonode. Example: "ukryty_w_sklepie". When this key is set on an attribute, that attribute will be hidden in the storefront. This value is inherited by all sales channels. + + + Fields mapping Fields mapping @@ -80,8 +91,8 @@ - Product sync - Product sync + Template sync + Template sync templateLayoutMapping diff --git a/src/Resources/config/services.yml b/src/Resources/config/services.yml index f2827b3..1a72217 100644 --- a/src/Resources/config/services.yml +++ b/src/Resources/config/services.yml @@ -215,6 +215,7 @@ services: - '@Ergonode\IntegrationShopware\Transformer\ProductScaleUnitTransformer' - '@Ergonode\IntegrationShopware\Transformer\ProductMinMaxQuantityTransformer' - '@Ergonode\IntegrationShopware\Transformer\ProductLayoutTransformer' + - '@Ergonode\IntegrationShopware\Transformer\ProductCustomBusinessTransformer' Ergonode\IntegrationShopware\Transformer\CategoryAttributesTransformerChain: arguments: diff --git a/src/Service/ConfigService.php b/src/Service/ConfigService.php index 2ed5804..0908977 100644 --- a/src/Service/ConfigService.php +++ b/src/Service/ConfigService.php @@ -186,4 +186,11 @@ public function getTemplateLayoutMapping(): array }, $value) ); } + + // start devEcommerce change + public function getHideMetaDataKey(): string + { + return $this->configService->getString(self::CONFIG_NAMESPACE . 'hideMetaDataKey'); + } + // end devEcommerce change } diff --git a/src/Transformer/ProductCustomBusinessTransformer.php b/src/Transformer/ProductCustomBusinessTransformer.php new file mode 100644 index 0000000..d97df7d --- /dev/null +++ b/src/Transformer/ProductCustomBusinessTransformer.php @@ -0,0 +1,43 @@ +configService = $configService; + } + + public function transform(ProductTransformationDTO $productData, Context $context): ProductTransformationDTO { + $swData = $productData->getShopwareData(); + $ergonodeData = $productData->getErgonodeData(); + $sku = $ergonodeData->getSku(); + + if (preg_match('/^V[0-9]+_.+$/', $sku)) { // handle for good parts + // inherit from a parent + $swData->setName(''); + $swData->setTax(null); + $swData->setPrice(null); + $swData->setData('isCloseout', null); + $swData->setData('shippingFree', null); + $swData->setData('markAsTopseller', null); + $swData->setData('minPurchase', null); + $swData->setData('purchaseSteps', null); + $swData->setData('active', null); + $swData->setProperties([]); + } + + $productData->setShopwareData($swData); + + return $productData; + } + +} diff --git a/src/Transformer/PropertyGroupTransformer.php b/src/Transformer/PropertyGroupTransformer.php index 59125c1..f7626fd 100644 --- a/src/Transformer/PropertyGroupTransformer.php +++ b/src/Transformer/PropertyGroupTransformer.php @@ -87,6 +87,7 @@ public function transformAttributeNode(PropertyGroupTransformationDTO $dto): Pro $dto->setPropertyGroupPayload([ 'id' => $propertyGroup?->getId(), 'name' => $code, + 'filterable' => $propertyGroup?->getFilterable() ?? false, // devEcommerce change 'options' => $options, 'translations' => $translations, 'extensions' => [ diff --git a/src/Transformer/VariantsTransformer.php b/src/Transformer/VariantsTransformer.php index 9da5d4d..42595ca 100644 --- a/src/Transformer/VariantsTransformer.php +++ b/src/Transformer/VariantsTransformer.php @@ -15,6 +15,7 @@ use Shopware\Core\Content\Product\Aggregate\ProductConfiguratorSetting\ProductConfiguratorSettingDefinition; use Shopware\Core\Content\Product\ProductEntity; use Shopware\Core\Framework\Context; +use Shopware\Core\Framework\Uuid\Uuid; class VariantsTransformer { @@ -78,6 +79,7 @@ public function transform(ProductTransformationDTO $productData, Context $contex foreach ($transformedVariants as $variant) { $shopwareData = $variant->getShopwareData(); + // start devEcommerce change - fix configuratorSettings when add a new option if (null !== $parentProduct) { $parentProductId = $parentProduct->getId(); } else{ @@ -91,7 +93,7 @@ public function transform(ProductTransformationDTO $productData, Context $contex $shopwareData->setParentId($parentProductId); $swData->addChild($shopwareData); - if (property_exists(ProductEntity::class, 'variantListingConfig')) { + if (property_exists(ProductEntity::class, 'variantListingConfig')) { // devEcommerce change $swData->setDisplayParent(); } @@ -104,6 +106,8 @@ public function transform(ProductTransformationDTO $productData, Context $contex ]); } } + // end start devEcommerce change + foreach ($variant->getSwProduct()?->getOptionIds() ?? [] as $optionId) { if ( From 28c2ae40e454591f179ac58ad80014d7e7d5591c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Andrzejewski?= Date: Fri, 22 Aug 2025 08:46:37 +0200 Subject: [PATCH 5/7] - Change php-graphql-client (not compatible with psr/http-message^2.0) - Category: inject the main category as tree root - Images: leave the original name as a prefix - Change default: DEFAULT_STOCK_VALUE to "0", DEFAULT_GROSS_PRICE to "99999", minPurchaseMapping to "1" --- README.md | 11 +++++- composer.json | 2 +- src/Manager/FileManager.php | 3 +- src/Processor/CategoryTreeSyncProcessor.php | 38 ++++++++++++++++++- src/QueryBuilder/CategoryQueryBuilder.php | 5 +++ .../ProductDefaultValuesTransformer.php | 2 +- .../ProductMinMaxQuantityTransformer.php | 2 +- src/Transformer/ProductPriceTransformer.php | 12 +++--- 8 files changed, 64 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 266ec90..e261edf 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,20 @@ # Shopware Ergonode Integration ## Our modification devEcommerce +- Change php-graphql-client (not compatible with psr/http-message^2.0) +- **Variants**: - Fix adding new variants (wrong grouping) - Full inheritance for variants -- Add filterProductsNotMatchingSkuPattern (filter not products and parts) +- **Attributes**: - Hide attributes with hide metadata value - Disable default filterable attribute for new attributes +- Add filterProductsNotMatchingSkuPattern (filter not products and parts) +- Category: inject the main category as tree root +- Images: leave the original name as a prefix +- **Change default** + - DEFAULT_STOCK_VALUE to "0" + - DEFAULT_GROSS_PRICE to "99999" + - minPurchaseMapping to "1" - Use only selected brands (temporary) ## Description diff --git a/composer.json b/composer.json index 942d6c0..dce0af7 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "ext-json": "*", "shopware/administration": "6.6.*", "shopware/core": "6.6.*", - "gmostafa/php-graphql-client": "^1.13" + "carnage/php-graphql-client": "^1.14" }, "require-dev": { "phpunit/phpunit": "~9.5.17", diff --git a/src/Manager/FileManager.php b/src/Manager/FileManager.php index 0f59de1..618fcd1 100644 --- a/src/Manager/FileManager.php +++ b/src/Manager/FileManager.php @@ -86,6 +86,7 @@ private function buildFileName(ProductMultimediaTranslation $image): string 'url' => $image->getUrl(), ]; - return md5(json_encode($imageData)); + //return md5(json_encode($imageData)); + return pathinfo($imageData['name'], PATHINFO_FILENAME) . '_' . pathinfo($imageData['url'], PATHINFO_FILENAME); // devEcommerce change } } diff --git a/src/Processor/CategoryTreeSyncProcessor.php b/src/Processor/CategoryTreeSyncProcessor.php index f75be94..046cfa2 100644 --- a/src/Processor/CategoryTreeSyncProcessor.php +++ b/src/Processor/CategoryTreeSyncProcessor.php @@ -113,7 +113,7 @@ public function processStream( $stopwatch->start('process'); try { - $leafEdges = $edge['node']['categoryTreeLeafList']['edges'] ?? []; + $leafEdges = $this->normalizeCategoryTreeEdges($edge); $primaryKeys = $this->categoryTreePersistor->persistLeaves($leafEdges, $currentTreeCode, $context); $this->categoryTreePersistor->markCategoriesAsActive($primaryKeys); @@ -178,6 +178,42 @@ public function processStream( return $counter; } + /** + * devEcommerce change + */ + private function normalizeCategoryTreeEdges(mixed $edge): mixed + { + $leafEdges = $edge['node']['categoryTreeLeafList']['edges'] ?? []; + $categoryTreeCode = $edge['node']['code']; + $categoryTreeNames = $edge['node']['name']; + $mainEdgeKeys = array_keys(array_filter( + $leafEdges, + fn($row) => empty($row['node']['parentCategory']) + )); + + if(!empty($mainEdgeKeys)) { + $firstCategory = [ + 'node' => [ + 'category' => [ + 'code' => $categoryTreeCode, + 'name' => $categoryTreeNames, + ], + 'parentCategory' => null, + ] + ]; + array_unshift($leafEdges,$firstCategory); + + foreach ($mainEdgeKeys as $key) { + $leafEdges[$key+1]['node']['parentCategory'] = ['code' => $categoryTreeCode]; + } + } + + file_put_contents('../custom/plugins/ergo_graph.log', print_r($mainEdgeKeys, true) . "\n-----\n" ,FILE_APPEND); + file_put_contents('../custom/plugins/ergo_graph.log', print_r($leafEdges, true) . "\n-----\n" ,FILE_APPEND); + + return $leafEdges; + } + /** * Gets ID of last existing top level category * diff --git a/src/QueryBuilder/CategoryQueryBuilder.php b/src/QueryBuilder/CategoryQueryBuilder.php index 50df7a2..bb59d10 100644 --- a/src/QueryBuilder/CategoryQueryBuilder.php +++ b/src/QueryBuilder/CategoryQueryBuilder.php @@ -154,6 +154,11 @@ public function buildTreeStream( (new Query('node')) ->setSelectionSet([ 'code', + (new Query('name')) // devEcommerce change + ->setSelectionSet([ + 'value', + 'language', + ]), (new Query('categoryTreeLeafList')) ->setArguments($categoryLeafArguments) ->setSelectionSet([ diff --git a/src/Transformer/ProductDefaultValuesTransformer.php b/src/Transformer/ProductDefaultValuesTransformer.php index 3d02e53..9ceb3dc 100644 --- a/src/Transformer/ProductDefaultValuesTransformer.php +++ b/src/Transformer/ProductDefaultValuesTransformer.php @@ -12,7 +12,7 @@ class ProductDefaultValuesTransformer implements ProductDataTransformerInterface { - private const DEFAULT_STOCK_VALUE = 999; + private const DEFAULT_STOCK_VALUE = 0; private ConfigService $configService; diff --git a/src/Transformer/ProductMinMaxQuantityTransformer.php b/src/Transformer/ProductMinMaxQuantityTransformer.php index 4599564..48b75a4 100644 --- a/src/Transformer/ProductMinMaxQuantityTransformer.php +++ b/src/Transformer/ProductMinMaxQuantityTransformer.php @@ -83,7 +83,7 @@ private function getMinPurchase( $existingMinPurchase = $productData->getSwProduct()?->getMinPurchase(); // if unmapped, return current value if ($minPurchaseMapping === false) { - return $existingMinPurchase; + return $existingMinPurchase ?? 1; // devEcommerce change } $minPurchase = $minPurchaseMapping?->getTranslation($defaultLanguage)?->getValue(); diff --git a/src/Transformer/ProductPriceTransformer.php b/src/Transformer/ProductPriceTransformer.php index c40248f..7816438 100644 --- a/src/Transformer/ProductPriceTransformer.php +++ b/src/Transformer/ProductPriceTransformer.php @@ -11,6 +11,8 @@ class ProductPriceTransformer implements ProductDataTransformerInterface { + const DEFAULT_GROSS_PRICE = 99999; // devEcommerce change + public function transform(ProductTransformationDTO $productData, Context $context): ProductTransformationDTO { $swData = $productData->getShopwareData(); @@ -18,20 +20,20 @@ public function transform(ProductTransformationDTO $productData, Context $contex $defaultLanguage = $productData->getDefaultLanguage(); $pricePayload = [ - 'linked' => false, + 'linked' => true, // devEcommerce change 'currencyId' => Defaults::CURRENCY, ]; if (!$productData->getSwProduct()?->getPrice()) { - $pricePayload['gross'] = 0; + $pricePayload['gross'] = self::DEFAULT_GROSS_PRICE; // devEcommerce change if ($ergonodeData->getPriceGross() instanceof ProductAttribute) { - $pricePayload['gross'] = (float)$ergonodeData->getPriceGross()->getTranslation($defaultLanguage)?->getValue() ?? 0; + $pricePayload['gross'] = (float)$ergonodeData->getPriceGross()->getTranslation($defaultLanguage)?->getValue() ?? self::DEFAULT_GROSS_PRICE; // devEcommerce change } - $pricePayload['net'] = 0; + $pricePayload['net'] = self::DEFAULT_GROSS_PRICE; // devEcommerce change if ($ergonodeData->getPriceNet() instanceof ProductAttribute) { $pricePayload['net'] = (float)$ergonodeData->getPriceNet()->getTranslation($defaultLanguage)?->getValue( - ) ?? 0; + ) ?? self::DEFAULT_GROSS_PRICE; // devEcommerce change } } else { $pricePayload['gross'] = $ergonodeData->getPriceGross() From 2431a82eb9d3db68e358a485f9009bab52edb742 Mon Sep 17 00:00:00 2001 From: devEcommercePL <155567765+devEcommercePL@users.noreply.github.com> Date: Fri, 22 Aug 2025 08:48:51 +0200 Subject: [PATCH 6/7] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e261edf..3f94aa7 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ ## Our modification devEcommerce - Change php-graphql-client (not compatible with psr/http-message^2.0) - **Variants**: -- Fix adding new variants (wrong grouping) -- Full inheritance for variants + - Fix adding new variants (wrong grouping) + - Full inheritance for variants - **Attributes**: -- Hide attributes with hide metadata value -- Disable default filterable attribute for new attributes + - Hide attributes with hide metadata value + - Disable default filterable attribute for new attributes - Add filterProductsNotMatchingSkuPattern (filter not products and parts) - Category: inject the main category as tree root - Images: leave the original name as a prefix @@ -136,4 +136,4 @@ Available cache pools: |------------------|-------------| | 6.6 from 6.6.0.0 | Version 3.x | | 6.5 from 6.5.0.0 | Version 2.x | -| 6.4 from 6.4.0.0 | Version 1.x | \ No newline at end of file +| 6.4 from 6.4.0.0 | Version 1.x | From 9f8996360296159056262f9b42718dcf2eff16e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Andrzejewski?= Date: Wed, 27 Aug 2025 14:39:45 +0200 Subject: [PATCH 7/7] - Languages - updates only active languages - update composer version --- README.md | 1 + composer.json | 6 +++--- src/Processor/Attribute/ManufacturerAttributeProcessor.php | 2 +- src/Provider/LanguageProvider.php | 3 +++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3f94aa7..cc00116 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ - Hide attributes with hide metadata value - Disable default filterable attribute for new attributes - Add filterProductsNotMatchingSkuPattern (filter not products and parts) +- Languages - updates only active languages - Category: inject the main category as tree root - Images: leave the original name as a prefix - **Change default** diff --git a/composer.json b/composer.json index dce0af7..143b8d1 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "ergonode/integration-shopware", "description": "Shopware Ergonode Integration", - "version": "3.0.1", + "version": "3.0.10-patch", "type": "shopware-platform-plugin", "license": "proprietary", "authors": [ @@ -24,8 +24,8 @@ "require": { "php": ">= 8.2", "ext-json": "*", - "shopware/administration": "6.6.*", - "shopware/core": "6.6.*", + "shopware/administration": ">=6.6.0 <6.7.0", + "shopware/core": ">=6.6.0 <6.7.0", "carnage/php-graphql-client": "^1.14" }, "require-dev": { diff --git a/src/Processor/Attribute/ManufacturerAttributeProcessor.php b/src/Processor/Attribute/ManufacturerAttributeProcessor.php index 173422c..4af75ad 100644 --- a/src/Processor/Attribute/ManufacturerAttributeProcessor.php +++ b/src/Processor/Attribute/ManufacturerAttributeProcessor.php @@ -59,7 +59,7 @@ public function process(array $node, Context $context): void $code = $option['code']; $manufacturerEntity = $this->getExistingManufacturerEntity($code, $context); - if(!in_array($code, ['gymtek', 'outtec', 'kedica', 'queenfit', 'xride', 'luverno', 'stars' ])) { // devCommerce change + if(!in_array($code, ['gymtek', 'outtec', 'kedica', 'queenfit', 'xride', 'luverno', 'stars' ])) { // devEcommerce change continue; } diff --git a/src/Provider/LanguageProvider.php b/src/Provider/LanguageProvider.php index e89c717..78ab97b 100644 --- a/src/Provider/LanguageProvider.php +++ b/src/Provider/LanguageProvider.php @@ -9,6 +9,7 @@ use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; +use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; use Shopware\Core\System\Language\LanguageEntity; class LanguageProvider @@ -58,6 +59,8 @@ public function getActiveLocaleCodes(Context $context): array { $criteria = new Criteria(); $criteria->addAssociation('locale'); + $criteria->addAssociation('swagLanguagePackLanguage'); // devEcommerce change + $criteria->addFilter(new EqualsFilter('swagLanguagePackLanguage.salesChannelActive', true)); // devEcommerce change /** @var LanguageEntity[] $languages */ $languages = $this->languageRepository->search($criteria, $context);