Skip to content

Commit

Permalink
Version 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
magenizr committed Oct 25, 2022
1 parent 41bcb75 commit bbc05b2
Show file tree
Hide file tree
Showing 15 changed files with 96 additions and 67 deletions.
13 changes: 7 additions & 6 deletions Block/Adminhtml/System/Config/Field/DatePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@
/**
* Magenizr CustomShipping
*
* @category Magenizr
* @package Magenizr_CustomShipping
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @category Magenizr
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
* @license https://www.magenizr.com/license Magenizr EULA
*/

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

class DatePicker extends \Magento\Config\Block\System\Config\Form\Field
{

const TEMPLATE_DATEPICKER = 'system/config/field/datepicker.phtml';
private const TEMPLATE_DATEPICKER = 'system/config/field/datepicker.phtml';

/**
* @Override Title
* Set template
*
* @return mixed
*/
protected function _prepareLayout()
{
Expand Down
24 changes: 15 additions & 9 deletions Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
/**
* Magenizr CustomShipping
*
* @category Magenizr
* @package Magenizr_CustomShipping
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @category Magenizr
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
* @license https://www.magenizr.com/license Magenizr EULA
*/

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

/**
* Config constructor.
* Init Constructor
*
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone
* @param \Magento\Customer\Model\Session $session
* @param \Magento\Framework\App\Helper\Context $context
Expand All @@ -50,7 +50,7 @@ public function __construct(
/**
* Get module configuration values from core_config_data
*
* @param $setting
* @param string $setting
* @return mixed
*/
public function getConfig($setting)
Expand All @@ -68,9 +68,15 @@ public function getConfig($setting)
*/
public function isAvailable()
{
$date_current = strtotime($this->timezone->formatDate());
$date_start = strtotime($this->getConfig('date_start'));
$date_end = strtotime($this->getConfig('date_end'));
$timezone = $this->timezone->getConfigTimezone();

$date_current = date_create('now', new \DateTimeZone($timezone))
->getTimestamp();
$date_start = date_create($this->getConfig('date_start'), new \DateTimeZone($timezone))
->getTimestamp();
$date_end = date_create($this->getConfig('date_end'), new \DateTimeZone($timezone))
->getTimestamp();

$frequency = $this->getConfig('frequency');
$day = strtolower(date('D', $date_current));

Expand Down
13 changes: 9 additions & 4 deletions Model/Adminhtml/Shipping/Config/Source/AllMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
/**
* Magenizr CustomShipping
*
* @category Magenizr
* @package Magenizr_CustomShipping
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @category Magenizr
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
* @license https://www.magenizr.com/license Magenizr EULA
*/

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

/**
* Init Constructor
*
* @param \Magento\Framework\App\Config $scopeConfig
* @param \Magento\Shipping\Model\Config $shippingConfig
*/
public function __construct(
\Magento\Framework\App\Config $scopeConfig,
\Magento\Shipping\Model\Config $shippingConfig
Expand Down
7 changes: 3 additions & 4 deletions Model/Adminhtml/System/Config/Source/Availability.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
/**
* Magenizr CustomShipping
*
* @category Magenizr
* @package Magenizr_CustomShipping
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @category Magenizr
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
* @license https://www.magenizr.com/license Magenizr EULA
*/

namespace Magenizr\CustomShipping\Model\Adminhtml\System\Config\Source;
Expand Down
7 changes: 3 additions & 4 deletions Model/Adminhtml/System/Config/Source/Weekdays.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
/**
* Magenizr CustomShipping
*
* @category Magenizr
* @package Magenizr_CustomShipping
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @category Magenizr
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
* @license https://www.magenizr.com/license Magenizr EULA
*/

namespace Magenizr\CustomShipping\Model\Adminhtml\System\Config\Source;
Expand Down
7 changes: 3 additions & 4 deletions Model/Carrier/Custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
/**
* Magenizr CustomShipping
*
* @category Magenizr
* @package Magenizr_CustomShipping
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @category Magenizr
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
* @license https://www.magenizr.com/license Magenizr EULA
*/

namespace Magenizr\CustomShipping\Model\Carrier;
Expand Down
7 changes: 3 additions & 4 deletions Model/Plugin/Shipping/Rate/Result/FilteredRates.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
/**
* Magenizr CustomShipping
*
* @category Magenizr
* @package Magenizr_CustomShipping
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @category Magenizr
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
* @license https://www.magenizr.com/license Magenizr EULA
*/

namespace Magenizr\CustomShipping\Model\Plugin\Shipping\Rate\Result;
Expand Down
7 changes: 3 additions & 4 deletions Model/Plugin/Shipping/Rate/Result/Remove.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
/**
* Magenizr CustomShipping
*
* @category Magenizr
* @package Magenizr_CustomShipping
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @category Magenizr
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
* @license https://www.magenizr.com/license Magenizr EULA
*/

namespace Magenizr\CustomShipping\Model\Plugin\Shipping\Rate\Result;
Expand Down
39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ This Magento 2 module allows you to provide a custom shipping method in backend

## Installation (Composer)

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

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

# Installation (Manually)
## Installation (Composer 2)

1. Update your composer.json `composer require "magenizr/magento2-customshipping":"1.0.2" --no-update`
2. Use `composer update magenizr/magento2-customshipping --no-install` to update your composer.lock file.

```
Updating dependencies
Lock file operations: 1 install, 1 update, 0 removals
- Locking magenizr/magento2-customshipping (1.0.2)
```

3. And then `composer install` to install the package.

```
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 1 install, 0 update, 0 removals
- Installing magenizr/magento2-customshipping (1.0.2): Extracting archive
```

4. Enable the module and clear static content.

```
php bin/magento module:enable Magenizr_CustomShipping --clear-static-content
```

## Installation (Manually)
1. Download the latest version of the source code.
2. Extract the downloaded tar.gz file. Example: `tar -xzf Magenizr_CustomShipping_1.0.1.tar.gz`.
2. Extract the downloaded tar.gz file. Example: `tar -xzf Magenizr_CustomShipping_1.0.2.tar.gz`.
3. Copy the code into `./app/code/Magenizr/CustomShipping/`.
4. Enable the module and clear static content.

```
php bin/magento module:enable Magenizr_CustomShipping --clear-static-content
php bin/magento setup:upgrade
```

## Features
Expand All @@ -52,6 +77,10 @@ The functionality can be used in the backend section `Stores > Configuration > S
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).

## History
===== 1.0.2 =====
* Cleanup to meet coding standards (EQP, ECG)
* Remove framework constraints in composer.json

===== 1.0.1 =====
* Magento 2.4.x compatibility added
* i18n added
Expand Down
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magenizr/magento2-customshipping",
"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.",
"type": "magento2-module",
"version": "1.0.1",
"version": "1.0.2",
"license": [
"OSL-3.0"
],
Expand All @@ -13,9 +13,6 @@
"homepage": "https://www.magenizr.com"
}
],
"require": {
"magento/framework": "^100|^101|^102|^103"
},
"repositories": [
{
"type": "composer",
Expand Down
7 changes: 3 additions & 4 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
/**
* Magenizr CustomShipping
*
* @category Magenizr
* @package Magenizr_CustomShipping
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @category Magenizr
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
* @license https://www.magenizr.com/license Magenizr EULA
*/
-->

Expand Down
7 changes: 3 additions & 4 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
/**
* Magenizr CustomShipping
*
* @category Magenizr
* @package Magenizr_CustomShipping
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @category Magenizr
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
* @license https://www.magenizr.com/license Magenizr EULA
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
Expand Down
7 changes: 3 additions & 4 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
/**
* Magenizr CustomShipping
*
* @category Magenizr
* @package Magenizr_CustomShipping
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @category Magenizr
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
* @license https://www.magenizr.com/license Magenizr EULA
*/
-->

Expand Down
9 changes: 4 additions & 5 deletions etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
/**
* Magenizr CustomShipping
*
* @category Magenizr
* @package Magenizr_CustomShipping
* @copyright Copyright (c) 2018 Magenizr (http://www.magenizr.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @category Magenizr
* @copyright Copyright (c) 2018 - 2022 Magenizr (https://agency.magenizr.com)
* @license https://www.magenizr.com/license Magenizr EULA
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magenizr_CustomShipping" setup_version="1.0.1" />
<module name="Magenizr_CustomShipping" />
</config>
4 changes: 2 additions & 2 deletions view/adminhtml/templates/system/config/field/datepicker.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<script type="text/javascript">
require(["jquery", "jquery/ui"], function (jq) {
jq(document).ready(function () {
jq("#<?php echo $block->getHtmlId(); ?>").datepicker( { dateFormat: "yy/mm/dd" } );
jq("#<?= $block->getHtmlId(); ?>").datepicker( { dateFormat: "yy/mm/dd" } );
jq(".ui-datepicker-trigger").removeAttr("style");
jq(".ui-datepicker-trigger").click(function(){
jq("#<?php echo $block->getHtmlId(); ?>").focus();
jq("#<?= $block->getHtmlId(); ?>").focus();
});
});
});
Expand Down

0 comments on commit bbc05b2

Please sign in to comment.