-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
905 additions
and
674 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
# Shopware | ||
Voor de handleiding ga naar https://postnl.github.io/shopware | ||
# PostNL integratie voor Shopware 6 | ||
|
||
## Welke versie moet ik gebruiken? | ||
Vanwege breaking changes in Shopware zijn we genoodzaakt om voor bepaalde Shopware versies een nieuwe major versie van de plugin uit te brengen. Zie onderstaande tabel welke versie van de plugin geschikt is voor jouw Shopware installatie. | ||
|
||
| Shopware | Plugin | | ||
|-------------------|------------| | ||
| 6.6 vanaf 6.6.0.0 | Versie 4.x | | ||
| 6.5 vanaf 6.5.2.0 | Versie 3.x | | ||
| 6.4 vanaf 6.4.1.0 | Versie 2.x | | ||
|
||
#### Laatste versies | ||
![Shopware 6.6](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2Fpostnl%2Fshopware%2Fraw%2Fmaster%2Fcomposer.json&query=version&prefix=Versie%20&style=flat-square&label=Shopware%206.6&color=ed7000) | ||
![Shopware 6.5](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2Fpostnl%2Fshopware%2Fraw%2Fmaster-sw65%2Fcomposer.json&query=version&prefix=Versie%20&style=flat-square&label=Shopware%206.5&color=ed7000) | ||
![Shopware 6.4](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2Fpostnl%2Fshopware%2Fraw%2Fmaster-sw64%2Fcomposer.json&query=version&prefix=Versie%20&style=flat-square&label=Shopware%206.4&color=ed7000) | ||
|
||
## Installatie | ||
De installatie handleiding is te vinden op https://postnl.github.io/shopware | ||
|
||
Installatie via Composer of door deze repository te clonen is mogelijk, maar wordt niet officieel ondersteunt. Hiervoor zijn extra stappen nodig die niet in de handleiding worden beschreven. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/Migration/Migration1715095320AddTechnicalNameToShippingMethods.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PostNL\Shopware6\Migration; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use PostNL\Shopware6\Defaults; | ||
use Shopware\Core\Checkout\Shipping\Aggregate\ShippingMethodTranslation\ShippingMethodTranslationDefinition; | ||
use Shopware\Core\Checkout\Shipping\ShippingMethodDefinition; | ||
use Shopware\Core\Framework\Log\Package; | ||
use Shopware\Core\Framework\Migration\MigrationStep; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
#[Package('core')] | ||
class Migration1715095320AddTechnicalNameToShippingMethods extends MigrationStep | ||
{ | ||
public function getCreationTimestamp(): int | ||
{ | ||
return 1715095320; | ||
} | ||
|
||
public function update(Connection $connection): void | ||
{ | ||
try { | ||
$connection->beginTransaction(); | ||
|
||
$fetchQB = $connection->createQueryBuilder(); | ||
$updateShippingMethodQB = $connection->createQueryBuilder(); | ||
$updateTranslationQB = $connection->createQueryBuilder(); | ||
|
||
$fetchQB | ||
->select('sm.id', 'sm.technical_name', 'smt.language_id', 'smt.custom_fields') | ||
->from(ShippingMethodDefinition::ENTITY_NAME, 'sm') | ||
->join( | ||
'sm', | ||
ShippingMethodTranslationDefinition::ENTITY_NAME, | ||
'smt', | ||
'sm.id = smt.shipping_method_id' | ||
) | ||
->where('smt.custom_fields LIKE "%postnl%"') | ||
->andWhere('sm.technical_name IS NULL'); | ||
|
||
$updateShippingMethodQB | ||
->update(ShippingMethodDefinition::ENTITY_NAME, 'sm') | ||
->set('sm.technical_name', ':technical_name') | ||
->where('sm.id = :id'); | ||
|
||
$updateTranslationQB | ||
->update(ShippingMethodTranslationDefinition::ENTITY_NAME, 'smt') | ||
->set('smt.custom_fields', ':custom_fields') | ||
->where('smt.shipping_method_id = :shipping_method_id') | ||
->andWhere('smt.language_id = :language_id'); | ||
|
||
$rows = $fetchQB->fetchAllAssociative(); | ||
|
||
foreach($rows as $row) { | ||
$customFields = json_decode($row['custom_fields'], true); | ||
$deliveryType = $customFields[Defaults::CUSTOM_FIELDS_KEY]['deliveryType']; | ||
unset($customFields[Defaults::CUSTOM_FIELDS_KEY]); | ||
|
||
$customFields = (!empty($customFields)) | ||
? json_encode($customFields) | ||
: null; | ||
|
||
$updateShippingMethodQB | ||
->setParameters( | ||
[ | ||
'id' => $row['id'], | ||
'technical_name' => 'postnl_'.strtolower($deliveryType), | ||
] | ||
) | ||
->executeStatement(); | ||
|
||
$updateTranslationQB | ||
->setParameters( | ||
[ | ||
'shipping_method_id' => $row['id'], | ||
'language_id' => $row['language_id'], | ||
'custom_fields' => $customFields, | ||
] | ||
) | ||
->executeStatement(); | ||
} | ||
|
||
$connection->commit(); | ||
} | ||
catch (\Exception $e) { | ||
$connection->rollBack(); | ||
|
||
throw $e; | ||
} | ||
} | ||
} |
26 changes: 15 additions & 11 deletions
26
src/Resources/app/administration/src/app/component/base/sw-icon/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
const { Component } = Shopware; | ||
|
||
Component.override('sw-icon', { | ||
methods: { | ||
loadIconSvgData(variant, iconName, iconFullName) { | ||
if(variant !== 'postnl') { | ||
return this.$super('loadIconSvgData', variant, iconName, iconFullName); | ||
} | ||
// TODO Shopware 6.7: Create copy of mt-icon instead, as that is a basic vue component and cannot be overridden | ||
Component.override( | ||
Component.getComponentRegistry().has('sw-icon-deprecated') ? 'sw-icon-deprecated' : 'sw-icon', | ||
{ | ||
methods: { | ||
loadIconSvgData(variant, iconName, iconFullName) { | ||
if(variant !== 'postnl') { | ||
return this.$super('loadIconSvgData', variant, iconName, iconFullName); | ||
} | ||
|
||
return import(`./../../../assets/icons/${iconFullName}.svg`).then((iconSvgData) => { | ||
this.iconSvgData = iconSvgData.default; | ||
}); | ||
return import(`./../../../assets/icons/${iconFullName}.svg`).then((iconSvgData) => { | ||
this.iconSvgData = iconSvgData.default; | ||
}); | ||
}, | ||
}, | ||
}, | ||
}); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/Resources/app/administration/src/module/postnl/component/config/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import './product-selection'; | ||
import './postnl-required-hint'; | ||
|
||
import './postnl-config-api-credentials-link'; | ||
import './postnl-config-api-credentials-test'; | ||
import './postnl-config-customer-data'; | ||
import './postnl-config-sender-address'; | ||
import './postnl-config-return-address'; | ||
import './postnl-config-info'; | ||
import './postnl-config-description-text'; |
7 changes: 0 additions & 7 deletions
7
...nistration/src/module/postnl/component/config/postnl-config-api-credentials-link/index.js
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
...nt/config/postnl-config-api-credentials-link/postnl-config-api-credentials-link.html.twig
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
...administration/src/module/postnl/component/config/postnl-config-description-text/index.js
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
.../component/config/postnl-config-description-text/postnl-config-description-text.html.twig
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
...ostnl/component/config/postnl-config-description-text/postnl-config-description-text.scss
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.