Skip to content

Commit 1bc9dad

Browse files
authored
Merge pull request #1 from integer-net/update-is-new-values
Update is new values via Cronjob
2 parents 4686611 + 227b208 commit 1bc9dad

22 files changed

+271
-459
lines changed

.codeclimate.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.gitattributes

Lines changed: 0 additions & 12 deletions
This file was deleted.

.scrutinizer.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 109 deletions
This file was deleted.

.travis/before_script.sh

Lines changed: 0 additions & 75 deletions
This file was deleted.

README.md

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33

44
[![Latest Version on Packagist][ico-version]][link-packagist]
55
[![Software License][ico-license]](LICENSE.md)
6-
[![Build Status][ico-travis]][link-travis]
76
![Supported Magento Versions][ico-compatibility]
8-
9-
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
10-
[![Quality Score][ico-code-quality]][link-code-quality]
11-
[![Maintainability][ico-maintainability]][link-maintainability]
127
</div>
138

149
---
@@ -29,8 +24,15 @@ Create an "is_new" product attribute and update it automatically from the "news_
2924
3025
## Configuration
3126
27+
You can disable auto generation in `Store -> Configuration -> Catalog -> Product "Is New" Attribute -> Will be updated automatically every night` per Store View.
28+
3229
## Usage
3330
31+
A new product attribute "Is new" (`is_new`) will be created upon installation of this module.
32+
A cronjob is running every night at 00:01 and regenerates the value of this attribute for each
33+
product, depending on the content of the "Set Product as New From" (`news_from_date` and
34+
`news_to_date`) date attributes.
35+
3436
## Changelog
3537
3638
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
@@ -39,26 +41,6 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re
3941
4042
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
4143
42-
## Testing
43-
44-
### Unit Tests
45-
46-
```
47-
./vendor/bin/phpunit tests/unit
48-
```
49-
50-
### Magento Integration Tests
51-
52-
0. Configure test database in `dev/tests/integration/etc/install-config-mysql.php`. [Read more in the Magento docs.](https://devdocs.magento.com/guides/v2.4/test/integration/integration_test_execution.html)
53-
54-
1. Copy `tests/integration/phpunit.xml.dist` from the package to `dev/tests/integration/phpunit.xml` in your Magento installation.
55-
56-
2. In that directory, run
57-
``` bash
58-
../../../vendor/bin/phpunit
59-
```
60-
61-
6244
## Security
6345
6446
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
@@ -74,16 +56,8 @@ The MIT License (MIT). Please see [License File](LICENSE) for more information.
7456
7557
[ico-version]: https://img.shields.io/packagist/v/integer-net/magento2-product-is-new-attribute.svg?style=flat-square
7658
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
77-
[ico-travis]: https://img.shields.io/travis/integer-net/magento2-product-is-new-attribute/master.svg?style=flat-square
78-
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/integer-net/magento2-product-is-new-attribute?style=flat-square
79-
[ico-code-quality]: https://img.shields.io/scrutinizer/g/integer-net/magento2-product-is-new-attribute.svg?style=flat-square
80-
[ico-maintainability]: https://img.shields.io/codeclimate/maintainability/integer-net/magento2-product-is-new-attribute?style=flat-square
81-
[ico-compatibility]: https://img.shields.io/badge/magento-2.2%20|%202.3%20|%202.4-brightgreen.svg?logo=magento&longCache=true&style=flat-square
59+
[ico-compatibility]: https://img.shields.io/badge/magento-2.3%20|%202.4-brightgreen.svg?logo=magento&longCache=true&style=flat-square
8260
8361
[link-packagist]: https://packagist.org/packages/integer-net/magento2-product-is-new-attribute
84-
[link-travis]: https://travis-ci.org/integer-net/magento2-product-is-new-attribute
85-
[link-scrutinizer]: https://scrutinizer-ci.com/g/integer-net/magento2-product-is-new-attribute/code-structure
86-
[link-code-quality]: https://scrutinizer-ci.com/g/integer-net/magento2-product-is-new-attribute
87-
[link-maintainability]: https://codeclimate.com/github/integer-net/magento2-product-is-new-attribute
8862
[link-author]: https://github.com/avstudnitz
8963
[link-contributors]: ../../contributors

auth.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

composer.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,15 @@
1818
"IntegerNet\\ProductIsNewAttribute\\": "src"
1919
}
2020
},
21-
"autoload-dev": {
22-
"psr-4": {
23-
"IntegerNet\\ProductIsNewAttribute\\": "tests/src"
24-
}
25-
},
2621
"repositories": [
2722
{
2823
"type": "composer",
2924
"url": "https://repo.magento.com/"
3025
}
3126
],
3227
"require": {
33-
"php": "~7.3||~7.4||~8.1",
34-
"magento/framework": "^102.0.0||^103.0.0"
28+
"php": "~7.4||~8.1",
29+
"magento/framework": "^103.0.0"
3530
},
3631
"require-dev": {
3732
"roave/security-advisories": "dev-master",

src/Cron/UpdateIsNew.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace IntegerNet\ProductIsNewAttribute\Cron;
5+
6+
use IntegerNet\ProductIsNewAttribute\Service\ProductsUpdateService;
7+
8+
class UpdateIsNew
9+
{
10+
private ProductsUpdateService $productUpdateService;
11+
12+
public function __construct(
13+
ProductsUpdateService $productUpdateService
14+
) {
15+
$this->productUpdateService = $productUpdateService;
16+
}
17+
18+
public function execute(): void
19+
{
20+
$this->productUpdateService->updateIsNewValues();
21+
}
22+
}

src/ExampleClass.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)