Skip to content

Commit a6f064c

Browse files
author
Igor Podobed
committed
Merged release/1.0.2 into master
2 parents a43d477 + 33b8aaa commit a6f064c

File tree

4 files changed

+79
-39
lines changed

4 files changed

+79
-39
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace Aheadworks\Langshop\Plugin\Langshop\Model\ResourceModel\TranslatableResource\Product\UrlKey;
5+
6+
use Magento\Catalog\Model\Product;
7+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
8+
use Aheadworks\Langshop\Model\ResourceModel\TranslatableResource\Product as ProductResource;
9+
10+
class Save
11+
{
12+
/**
13+
* Set url_key attributes to avoid url rewrites logic
14+
*
15+
* @param ProductResource $productResource
16+
* @param Product $product
17+
* @return Product[]
18+
*/
19+
public function beforeSave(
20+
ProductResource $productResource,
21+
Product $product
22+
): array {
23+
$entityId = $product->getEntityId();
24+
if ($entityId) {
25+
$urlKey = $productResource->getAttributeRawValue(
26+
$entityId,
27+
ProductAttributeInterface::CODE_SEO_FIELD_URL_KEY,
28+
$product->getStoreId()
29+
);
30+
if ($urlKey && is_string($urlKey)) {
31+
$product
32+
->setData(ProductAttributeInterface::CODE_SEO_FIELD_URL_KEY, $urlKey)
33+
->setOrigData(ProductAttributeInterface::CODE_SEO_FIELD_URL_KEY, $urlKey);
34+
}
35+
}
36+
37+
return [$product];
38+
}
39+
}

bitbucket-pipelines.yml

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -25,72 +25,72 @@ definitions:
2525
artifacts:
2626
- "*.zip"
2727
test_steps:
28-
- step: &codesnifferTest-2.4.6-p2
28+
- step: &codesnifferTest-2.4.6-p3
2929
name: Run codesniffer tests
30-
image: aheadworks/m2test-new:2.4.6-p2-without-db-8.2
30+
image: aheadworks/m2test-new:2.4.6-p3-without-db-8.2
3131
script:
3232
- pip install --upgrade pip && pip3 install aheadworks-deploy-manager
33-
- python3 -m aheadworks_test_manager codesniffer ${PWD} test-results/codesniffer-2.4.6-p2.xml
33+
- python3 -m aheadworks_test_manager codesniffer ${PWD} test-results/codesniffer-2.4.6-p3.xml
3434
artifacts:
3535
- "test-results/**"
3636
- step: &unitTestPHP81-244
37-
name: Run unit tests PHP 8.1 on Magento 2.4.4-p5
38-
image: aheadworks/m2test-new:2.4.4-p5-with-db-8.1
37+
name: Run unit tests PHP 8.1 on Magento 2.4.4-p6
38+
image: aheadworks/m2test-new:2.4.4-p6-with-db-8.1
3939
script:
4040
- *prepareSSH
4141
- pip install --upgrade pip && pip3 install aheadworks-deploy-manager
42-
- python3 -m aheadworks_test_manager unit ${PWD} test-results/test-unit-2.4.4-p5.xml
42+
- python3 -m aheadworks_test_manager unit ${PWD} test-results/test-unit-2.4.4-p6.xml
4343
artifacts:
4444
- "test-results/**"
4545
- step: &unitTestPHP81
46-
name: Run unit tests PHP 8.2 on Magento 2.4.6-p2
47-
image: aheadworks/m2test-new:2.4.6-p2-with-db-8.2
46+
name: Run unit tests PHP 8.2 on Magento 2.4.6-p3
47+
image: aheadworks/m2test-new:2.4.6-p3-with-db-8.2
4848
script:
4949
- *prepareSSH
5050
- pip install --upgrade pip && pip3 install aheadworks-deploy-manager
51-
- python3 -m aheadworks_test_manager unit ${PWD} test-results/test-unit-2.4.6-p2.xml
51+
- python3 -m aheadworks_test_manager unit ${PWD} test-results/test-unit-2.4.6-p3.xml
5252
artifacts:
5353
- "test-results/**"
5454
- step: &phpstanTestPHP81-244
55-
name: Run phpstan tests PHP 8.1 on Magento 2.4.4-p5
56-
image: aheadworks/m2test-new:2.4.4-p5-with-db-8.1
55+
name: Run phpstan tests PHP 8.1 on Magento 2.4.4-p6
56+
image: aheadworks/m2test-new:2.4.4-p6-with-db-8.1
5757
script:
5858
- *prepareSSH
5959
- pip install --upgrade pip && pip3 install aheadworks-deploy-manager
60-
- python3 -m aheadworks_test_manager phpstan ${PWD} test-results/test-phpstan-2.4.4-p5.xml
60+
- python3 -m aheadworks_test_manager phpstan ${PWD} test-results/test-phpstan-2.4.4-p6.xml
6161
artifacts:
6262
- "test-results/**"
6363
- step: &phpstanTestPHP81
64-
name: Run phpstan tests PHP 8.2 on Magento 2.4.6-p2
65-
image: aheadworks/m2test-new:2.4.6-p2-with-db-8.2
64+
name: Run phpstan tests PHP 8.2 on Magento 2.4.6-p3
65+
image: aheadworks/m2test-new:2.4.6-p3-with-db-8.2
6666
script:
6767
- *prepareSSH
6868
- pip install --upgrade pip && pip3 install aheadworks-deploy-manager
69-
- python3 -m aheadworks_test_manager phpstan ${PWD} test-results/test-phpstan-2.4.6-p2.xml
69+
- python3 -m aheadworks_test_manager phpstan ${PWD} test-results/test-phpstan-2.4.6-p3.xml
7070
artifacts:
7171
- "test-results/**"
7272
- step: &messDetectorTestPHP81
7373
name: Run mess detector tests PHP 8.2
74-
image: aheadworks/m2test-new:2.4.6-p2-with-db-8.2
74+
image: aheadworks/m2test-new:2.4.6-p3-with-db-8.2
7575
script:
7676
- *prepareSSH
7777
- pip install --upgrade pip && pip3 install aheadworks-deploy-manager
7878
- python3 -m aheadworks_test_manager mess-detector ${PWD}
7979
artifacts:
8080
- "test-results/**"
81-
- step: &installMagento-2.4.4-p5
82-
name: Run install Magento 2.4.4-p5 test
83-
image: aheadworks/m2test-new:2.4.4-p5-without-db-8.1
81+
- step: &installMagento-2.4.4-p6
82+
name: Run install Magento 2.4.4-p6 test
83+
image: aheadworks/m2test-new:2.4.4-p6-without-db-8.1
8484
script:
8585
- *prepareSSH
8686
- pip install --upgrade pip && pip3 install aheadworks-deploy-manager
8787
- python3 -m aheadworks_test_manager install-magento ${PWD} test-results/test-unit.xml
8888
artifacts:
8989
- "logs1/**"
9090
- "test-results/test-unit.xml"
91-
- step: &installMagento-2.4.6-p2
92-
name: Run install Magento 2.4.6-p2 test
93-
image: aheadworks/m2test-new:2.4.6-p2-without-db-8.2
91+
- step: &installMagento-2.4.6-p3
92+
name: Run install Magento 2.4.6-p3 test
93+
image: aheadworks/m2test-new:2.4.6-p3-without-db-8.2
9494
script:
9595
- *prepareSSH
9696
- pip install --upgrade pip && pip3 install aheadworks-deploy-manager
@@ -160,13 +160,13 @@ pipelines:
160160
master:
161161
- step: *build
162162
- parallel:
163-
- step: *codesnifferTest-2.4.6-p2
163+
- step: *codesnifferTest-2.4.6-p3
164164
- step: *unitTestPHP81-244
165165
- step: *unitTestPHP81
166166
- step: *phpstanTestPHP81-244
167167
- step: *phpstanTestPHP81
168-
- step: *installMagento-2.4.4-p5
169-
- step: *installMagento-2.4.6-p2
168+
- step: *installMagento-2.4.4-p6
169+
- step: *installMagento-2.4.6-p3
170170
- step: *rebuildPrivateComposer
171171
- step: *build_packages
172172
- step: *swaggerWebApiDocBuild
@@ -175,30 +175,30 @@ pipelines:
175175
# For every commit to develop branch: run tests
176176
develop:
177177
- parallel:
178-
- step: *codesnifferTest-2.4.6-p2
178+
- step: *codesnifferTest-2.4.6-p3
179179
- step: *unitTestPHP81-244
180180
- step: *unitTestPHP81
181181
- step: *phpstanTestPHP81-244
182182
- step: *phpstanTestPHP81
183-
- step: *installMagento-2.4.4-p5
184-
- step: *installMagento-2.4.6-p2
183+
- step: *installMagento-2.4.4-p6
184+
- step: *installMagento-2.4.6-p3
185185
- step: *rebuildPrivateComposer
186186
feature/*:
187187
- parallel:
188-
- step: *codesnifferTest-2.4.6-p2
188+
- step: *codesnifferTest-2.4.6-p3
189189
- step: *unitTestPHP81
190190
- step: *phpstanTestPHP81-244
191191
- step: *phpstanTestPHP81
192192
bugfix/*:
193193
- parallel:
194-
- step: *codesnifferTest-2.4.6-p2
194+
- step: *codesnifferTest-2.4.6-p3
195195
- step: *unitTestPHP81
196196
- step: *phpstanTestPHP81-244
197197
- step: *phpstanTestPHP81
198198
release/*:
199199
- step: *build
200200
- parallel:
201-
- step: *codesnifferTest-2.4.6-p2
201+
- step: *codesnifferTest-2.4.6-p3
202202
- step: *unitTestPHP81-244
203203
- step: *unitTestPHP81
204204
- step: *phpstanTestPHP81-244
@@ -221,23 +221,23 @@ pipelines:
221221
# Run tests manually
222222
run-all-tests:
223223
- parallel:
224-
- step: *codesnifferTest-2.4.6-p2
224+
- step: *codesnifferTest-2.4.6-p3
225225
- step: *unitTestPHP81-244
226226
- step: *unitTestPHP81
227227
- step: *phpstanTestPHP81-244
228228
- step: *phpstanTestPHP81
229229
- step: *messDetectorTestPHP81
230-
- step: *installMagento-2.4.4-p5
231-
- step: *installMagento-2.4.6-p2
230+
- step: *installMagento-2.4.4-p6
231+
- step: *installMagento-2.4.6-p3
232232

233233
# Run prerelease tests manually
234234
run-prerelease-tests:
235235
- parallel:
236-
- step: *codesnifferTest-2.4.6-p2
236+
- step: *codesnifferTest-2.4.6-p3
237237
- step: *unitTestPHP81-244
238238
- step: *unitTestPHP81
239-
- step: *installMagento-2.4.4-p5
240-
- step: *installMagento-2.4.6-p2
239+
- step: *installMagento-2.4.4-p6
240+
- step: *installMagento-2.4.6-p3
241241

242242
get_key:
243243
- step: *get_key
@@ -256,7 +256,7 @@ pipelines:
256256
- variables:
257257
- name: SEVERITY
258258
default: 9
259-
- step: *codesnifferTest-2.4.6-p2
259+
- step: *codesnifferTest-2.4.6-p3
260260

261261
phpstan-test-with-select-severity:
262262
- variables:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"magento/module-webapi": "^100.4.3"
1818
},
1919
"type": "magento2-module",
20-
"version": "1.0.1",
20+
"version": "1.0.2",
2121
"license": [
2222
"proprietary"
2323
],

etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
<plugin name="aw_ls_image_label_save" type="Aheadworks\Langshop\Plugin\Langshop\Model\ResourceModel\TranslatableResource\Product\Image\Label\Save"/>
157157
<plugin name="aw_ls_option_save" type="Aheadworks\Langshop\Plugin\Langshop\Model\ResourceModel\TranslatableResource\Product\Option\Save"/>
158158
<plugin name="aw_ls_option_values_save" type="Aheadworks\Langshop\Plugin\Langshop\Model\ResourceModel\TranslatableResource\Product\Option\Value\Save"/>
159+
<plugin name="aw_ls_url_key_save" type="Aheadworks\Langshop\Plugin\Langshop\Model\ResourceModel\TranslatableResource\Product\UrlKey\Save"/>
159160
</type>
160161
<type name="Aheadworks\Langshop\Model\ResourceModel\TranslatableResource\Category">
161162
<plugin name="aw_ls_category_save" type="Aheadworks\Langshop\Plugin\Langshop\Model\ResourceModel\TranslatableResource\Category\Save"/>

0 commit comments

Comments
 (0)