diff --git a/Block/Adminhtml/System/Config/Form/Composer/Version.php b/Block/Adminhtml/System/Config/Form/Composer/Version.php deleted file mode 100644 index f3c418d..0000000 --- a/Block/Adminhtml/System/Config/Form/Composer/Version.php +++ /dev/null @@ -1,126 +0,0 @@ -deploymentConfig = $deploymentConfig; - $this->componentRegistrar = $componentRegistrar; - $this->readFactory = $readFactory; - parent::__construct($context, $data); - } - - /** - * Render button - * - * @param AbstractElement $element - * @return string - * @throws LocalizedException - */ - public function render(AbstractElement $element) - { - // Remove scope label - $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); - return parent::render($element); - } - - /** - * Return element html - * - * @param AbstractElement $element - * @return string - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _getElementHtml(AbstractElement $element) - { - return 'v' . $this->getVersion(); - } - - /** - * Get Module version number - * - * @return string - */ - public function getVersion() - { - return $this->getComposerVersion($this->getModuleName()); - } - - /** - * Get module composer version - * - * @param $moduleName - * @return Phrase|string|void - */ - public function getComposerVersion($moduleName) - { - $path = $this->componentRegistrar->getPath( - ComponentRegistrar::MODULE, - $moduleName - ); - - try { - $directoryRead = $this->readFactory->create($path); - $composerJsonData = $directoryRead->readFile('composer.json'); - - if ($composerJsonData) { - $data = json_decode($composerJsonData); - return !empty($data->version) ? $data->version : __('Unknown'); - } - } catch (Exception $e) { - // - } - - return 'Unknown'; - } -} diff --git a/Block/Adminhtml/System/Config/Form/Module/Version.php b/Block/Adminhtml/System/Config/Form/Module/Version.php deleted file mode 100644 index 9bc7c75..0000000 --- a/Block/Adminhtml/System/Config/Form/Module/Version.php +++ /dev/null @@ -1,78 +0,0 @@ -_moduleList = $moduleList; - } - - /** - * Render button - * - * @param AbstractElement $element - * @return string - * @throws LocalizedException - */ - public function render(AbstractElement $element) - { - // Remove scope label - $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); - return parent::render($element); - } - - /** - * Return element html - * - * @param AbstractElement $element - * @return string - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _getElementHtml(AbstractElement $element) - { - return 'v' . $this->getVersion(); - } - - /** - * Get Module version number - * - * @return string - */ - public function getVersion() - { - $moduleInfo = $this->_moduleList->getOne($this->getModuleName()); - return $moduleInfo['setup_version']; - } -} diff --git a/Controller/Guesttocustomer/LookupformPost.php b/Controller/Guesttocustomer/LookupformPost.php index 4be6213..1f94162 100644 --- a/Controller/Guesttocustomer/LookupformPost.php +++ b/Controller/Guesttocustomer/LookupformPost.php @@ -16,6 +16,7 @@ use Magento\Framework\Data\Form\FormKey\Validator; use Magento\Framework\View\Result\Page; use Magento\Framework\View\Result\PageFactory; +use Magento\Sales\Api\Data\OrderInterface; use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Sales\Model\Order; use MagePal\GuestToCustomer\Helper\Data; @@ -128,11 +129,13 @@ public function execute() /** * @param CustomerInterface|false $customer - * @param Order $order + * @param Order | OrderInterface $order */ protected function addCustomerIdToOrder($customer, $order) { - if ($customer && !$order->getCustomerId() && $order->getCustomerEmail() === $customer->getEmail()) { + if ($customer && !$order->getCustomerId() + && strcasecmp($order->getCustomerEmail(), $customer->getEmail()) == 0 + ) { $this->helperData->setCustomerData($order, $customer); $comment = sprintf( diff --git a/README.md b/README.md index 33b090c..894660d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ [![GitHub stars](https://img.shields.io/github/stars/magepal/magento2-guest-to-customer.svg)](https://www.magepal.com/guest-to-customer.html) [![GitHub forks](https://img.shields.io/github/forks/magepal/magento2-guest-to-customer.svg)](https://www.magepal.com/guest-to-customer.html) -##### For Magento 2.0.x, 2.1.x, 2.2.x and 2.3.x +##### For Magento 2.0.x, 2.1.x, 2.2.x, 2.3.x and 2.4.x + +Magento 2 customer In general E-commerce, shoppers do not like to create an account during checkout and often opt to checkout as a guest customer instead of a registered user. As a Magento store owner, if your online store sells products in various colors, sizes, or other customizable items then you may be dealing with canceling and rewriting orders on a daily bases because of customers' change of heart after purchasing or they simply want to be able to get order status updates. Perfect for reordering or modifying existing orders without having to manually copy all of your customer's existing billing and shipping information. diff --git a/composer.json b/composer.json index ddb9b9d..b7bbd2a 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "php": "~5.6.0|7.0.2|7.0.4|~7.0.6|~7.1.0|~7.1.3|~7.2.0|~7.3.0|~7.4.0", "magento/module-backend": "100.0.*|100.1.*|100.2.*|101.0.*|102.0.*", "magento/framework": "100.0.*|100.1.*|101.0.*|102.0.*|103.0.*", - "magepal/magento2-core":">1.1.0" + "magepal/magento2-core": ">=1.1.11" }, "type": "magento2-module", "version": "1.2.7", diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index cff4042..3061162 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -15,12 +15,12 @@ magepal MagePal_GuestToCustomer::guesttocustomer - + 1 - Copyright © 2020 MagePal, LLC +
+ Copyright © 2021 MagePal, LLC Documentation Support Latest Version @@ -30,32 +30,12 @@ Need to change the email address of an existing order? Download our free Edit Order Email Address extension today! -
- ]]> - +
+ ]]> + + - MagePal\GuestToCustomer\Block\Adminhtml\System\Config\Form\Composer\Version + MagePal\Core\Block\Adminhtml\System\Config\Composer\Version @@ -71,9 +51,7 @@ Magento\Config\Model\Config\Source\Yesno - - Automatically add order to existing customer with same email address. - + Automatically add order to existing customer with same email address.