Skip to content

Commit bbc05b2

Browse files
committed
Version 1.0.2
1 parent 41bcb75 commit bbc05b2

File tree

15 files changed

+96
-67
lines changed

15 files changed

+96
-67
lines changed

Block/Adminhtml/System/Config/Field/DatePicker.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22
/**
33
* Magenizr CustomShipping
44
*
5-
* @category Magenizr
6-
* @package Magenizr_CustomShipping
7-
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
8-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5+
* @category Magenizr
6+
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
7+
* @license https://www.magenizr.com/license Magenizr EULA
98
*/
109

1110
namespace Magenizr\CustomShipping\Block\Adminhtml\System\Config\Field;
1211

1312
class DatePicker extends \Magento\Config\Block\System\Config\Form\Field
1413
{
1514

16-
const TEMPLATE_DATEPICKER = 'system/config/field/datepicker.phtml';
15+
private const TEMPLATE_DATEPICKER = 'system/config/field/datepicker.phtml';
1716

1817
/**
19-
* @Override Title
18+
* Set template
19+
*
20+
* @return mixed
2021
*/
2122
protected function _prepareLayout()
2223
{

Helper/Config.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
/**
33
* Magenizr CustomShipping
44
*
5-
* @category Magenizr
6-
* @package Magenizr_CustomShipping
7-
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
8-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5+
* @category Magenizr
6+
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
7+
* @license https://www.magenizr.com/license Magenizr EULA
98
*/
109

1110
namespace Magenizr\CustomShipping\Helper;
@@ -30,7 +29,8 @@ class Config extends \Magento\Framework\App\Helper\AbstractHelper
3029
private $tab = 'carriers';
3130

3231
/**
33-
* Config constructor.
32+
* Init Constructor
33+
*
3434
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone
3535
* @param \Magento\Customer\Model\Session $session
3636
* @param \Magento\Framework\App\Helper\Context $context
@@ -50,7 +50,7 @@ public function __construct(
5050
/**
5151
* Get module configuration values from core_config_data
5252
*
53-
* @param $setting
53+
* @param string $setting
5454
* @return mixed
5555
*/
5656
public function getConfig($setting)
@@ -68,9 +68,15 @@ public function getConfig($setting)
6868
*/
6969
public function isAvailable()
7070
{
71-
$date_current = strtotime($this->timezone->formatDate());
72-
$date_start = strtotime($this->getConfig('date_start'));
73-
$date_end = strtotime($this->getConfig('date_end'));
71+
$timezone = $this->timezone->getConfigTimezone();
72+
73+
$date_current = date_create('now', new \DateTimeZone($timezone))
74+
->getTimestamp();
75+
$date_start = date_create($this->getConfig('date_start'), new \DateTimeZone($timezone))
76+
->getTimestamp();
77+
$date_end = date_create($this->getConfig('date_end'), new \DateTimeZone($timezone))
78+
->getTimestamp();
79+
7480
$frequency = $this->getConfig('frequency');
7581
$day = strtolower(date('D', $date_current));
7682

Model/Adminhtml/Shipping/Config/Source/AllMethods.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
/**
33
* Magenizr CustomShipping
44
*
5-
* @category Magenizr
6-
* @package Magenizr_CustomShipping
7-
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
8-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5+
* @category Magenizr
6+
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
7+
* @license https://www.magenizr.com/license Magenizr EULA
98
*/
109

1110
namespace Magenizr\CustomShipping\Model\Adminhtml\Shipping\Config\Source;
@@ -22,6 +21,12 @@ class AllMethods implements \Magento\Framework\Option\ArrayInterface
2221
*/
2322
private $scopeConfig;
2423

24+
/**
25+
* Init Constructor
26+
*
27+
* @param \Magento\Framework\App\Config $scopeConfig
28+
* @param \Magento\Shipping\Model\Config $shippingConfig
29+
*/
2530
public function __construct(
2631
\Magento\Framework\App\Config $scopeConfig,
2732
\Magento\Shipping\Model\Config $shippingConfig

Model/Adminhtml/System/Config/Source/Availability.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
/**
33
* Magenizr CustomShipping
44
*
5-
* @category Magenizr
6-
* @package Magenizr_CustomShipping
7-
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
8-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5+
* @category Magenizr
6+
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
7+
* @license https://www.magenizr.com/license Magenizr EULA
98
*/
109

1110
namespace Magenizr\CustomShipping\Model\Adminhtml\System\Config\Source;

Model/Adminhtml/System/Config/Source/Weekdays.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
/**
33
* Magenizr CustomShipping
44
*
5-
* @category Magenizr
6-
* @package Magenizr_CustomShipping
7-
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
8-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5+
* @category Magenizr
6+
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
7+
* @license https://www.magenizr.com/license Magenizr EULA
98
*/
109

1110
namespace Magenizr\CustomShipping\Model\Adminhtml\System\Config\Source;

Model/Carrier/Custom.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
/**
33
* Magenizr CustomShipping
44
*
5-
* @category Magenizr
6-
* @package Magenizr_CustomShipping
7-
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
8-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5+
* @category Magenizr
6+
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
7+
* @license https://www.magenizr.com/license Magenizr EULA
98
*/
109

1110
namespace Magenizr\CustomShipping\Model\Carrier;

Model/Plugin/Shipping/Rate/Result/FilteredRates.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
/**
33
* Magenizr CustomShipping
44
*
5-
* @category Magenizr
6-
* @package Magenizr_CustomShipping
7-
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
8-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5+
* @category Magenizr
6+
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
7+
* @license https://www.magenizr.com/license Magenizr EULA
98
*/
109

1110
namespace Magenizr\CustomShipping\Model\Plugin\Shipping\Rate\Result;

Model/Plugin/Shipping/Rate/Result/Remove.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
/**
33
* Magenizr CustomShipping
44
*
5-
* @category Magenizr
6-
* @package Magenizr_CustomShipping
7-
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
8-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
5+
* @category Magenizr
6+
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
7+
* @license https://www.magenizr.com/license Magenizr EULA
98
*/
109

1110
namespace Magenizr\CustomShipping\Model\Plugin\Shipping\Rate\Result;

README.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ This Magento 2 module allows you to provide a custom shipping method in backend
55

66
## Installation (Composer)
77

8-
1. Update your composer.json `composer require "magenizr/magento2-customshipping":"1.0.1" --no-update`
8+
1. Update your composer.json `composer require "magenizr/magento2-customshipping":"1.0.2" --no-update`
99
2. Install dependencies and update your composer.lock `composer update --lock`
1010

1111
```
1212
./composer.json has been updated
1313
Loading composer repositories with package information
1414
Updating dependencies (including require-dev)
1515
Package operations: 1 install, 0 updates, 0 removals
16-
- Installing magenizr/magento2-customshipping (1.0.1): Downloading (100%)
16+
- Installing magenizr/magento2-customshipping (1.0.2): Downloading (100%)
1717
Writing lock file
1818
Generating autoload files
1919
```
@@ -25,15 +25,40 @@ php bin/magento module:enable Magenizr_CustomShipping --clear-static-content
2525
php bin/magento setup:upgrade
2626
```
2727

28-
# Installation (Manually)
28+
## Installation (Composer 2)
29+
30+
1. Update your composer.json `composer require "magenizr/magento2-customshipping":"1.0.2" --no-update`
31+
2. Use `composer update magenizr/magento2-customshipping --no-install` to update your composer.lock file.
32+
33+
```
34+
Updating dependencies
35+
Lock file operations: 1 install, 1 update, 0 removals
36+
- Locking magenizr/magento2-customshipping (1.0.2)
37+
```
38+
39+
3. And then `composer install` to install the package.
40+
41+
```
42+
Installing dependencies from lock file (including require-dev)
43+
Verifying lock file contents can be installed on current platform.
44+
Package operations: 1 install, 0 update, 0 removals
45+
- Installing magenizr/magento2-customshipping (1.0.2): Extracting archive
46+
```
47+
48+
4. Enable the module and clear static content.
49+
50+
```
51+
php bin/magento module:enable Magenizr_CustomShipping --clear-static-content
52+
```
53+
54+
## Installation (Manually)
2955
1. Download the latest version of the source code.
30-
2. Extract the downloaded tar.gz file. Example: `tar -xzf Magenizr_CustomShipping_1.0.1.tar.gz`.
56+
2. Extract the downloaded tar.gz file. Example: `tar -xzf Magenizr_CustomShipping_1.0.2.tar.gz`.
3157
3. Copy the code into `./app/code/Magenizr/CustomShipping/`.
3258
4. Enable the module and clear static content.
3359

3460
```
3561
php bin/magento module:enable Magenizr_CustomShipping --clear-static-content
36-
php bin/magento setup:upgrade
3762
```
3863

3964
## Features
@@ -52,6 +77,10 @@ The functionality can be used in the backend section `Stores > Configuration > S
5277
If you have any issues with this extension, open an issue on [Github](https://github.com/magenizr/Magenizr_CustomShipping/issues). For a custom build, don't hesitate to contact us on [Magento Marketplace](https://marketplace.magento.com/partner/magenizr).
5378

5479
## History
80+
===== 1.0.2 =====
81+
* Cleanup to meet coding standards (EQP, ECG)
82+
* Remove framework constraints in composer.json
83+
5584
===== 1.0.1 =====
5685
* Magento 2.4.x compatibility added
5786
* i18n added

composer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magenizr/magento2-customshipping",
33
"description": "This Magento 2 module allows you to provide a custom shipping method in backend only, frontend only or both. With the Scheduler feature you can manage the availability automatically.",
44
"type": "magento2-module",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"license": [
77
"OSL-3.0"
88
],
@@ -13,9 +13,6 @@
1313
"homepage": "https://www.magenizr.com"
1414
}
1515
],
16-
"require": {
17-
"magento/framework": "^100|^101|^102|^103"
18-
},
1916
"repositories": [
2017
{
2118
"type": "composer",

0 commit comments

Comments
 (0)