-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Vendic/feature/SWEHY-15
Feature/SWEHY-15
- Loading branch information
Showing
7 changed files
with
133 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* @copyright Copyright (c) Vendic B.V https://vendic.nl/ | ||
*/ | ||
|
||
namespace Vendic\HyvaCheckoutCreateAccount\Model; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Store\Model\ScopeInterface; | ||
|
||
class Config | ||
{ | ||
private const IS_ENABLED = 'hyva_themes_checkout/new_customer/enable'; | ||
private const SEND_RESET_PASSWORD_MAIL = 'hyva_themes_checkout/new_customer/send_reset_password_mail'; | ||
private const NEW_PASSWORD_TEMPLATE = 'hyva_themes_checkout/new_customer/create_password_template'; | ||
|
||
public function __construct(private ScopeConfigInterface $scopeConfig) | ||
{ | ||
} | ||
|
||
public function isEnabled(): bool | ||
{ | ||
return (bool)$this->scopeConfig->getValue( | ||
self::IS_ENABLED, | ||
ScopeInterface::SCOPE_STORE | ||
); | ||
} | ||
|
||
public function sendPasswordMailEnabled(): bool | ||
{ | ||
return (bool)$this->scopeConfig->getValue( | ||
self::SEND_RESET_PASSWORD_MAIL, | ||
ScopeInterface::SCOPE_STORE | ||
); | ||
} | ||
|
||
public function getNewPasswordTemplate(): string | ||
{ | ||
return $this->scopeConfig->getValue( | ||
self::NEW_PASSWORD_TEMPLATE, | ||
ScopeInterface::SCOPE_STORE | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> | ||
<system> | ||
<section id="hyva_themes_checkout"> | ||
<include path="Vendic_HyvaCheckoutCreateAccount::system/new_customer.xml"/> | ||
</section> | ||
</system> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" ?> | ||
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd"> | ||
<group id="new_customer" | ||
showInDefault="1" | ||
showInWebsite="1" | ||
showInStore="1" | ||
sortOrder="55" | ||
translate="label"> | ||
<label>New Customer</label> | ||
|
||
<field id="enable" | ||
type="select" | ||
translate="label" | ||
showInDefault="1" | ||
showInWebsite="1" | ||
showInStore="1" | ||
canRestore="1"> | ||
<label>Enable New Customer</label> | ||
<comment>Will add a checkbox to checkout for creating a new account.</comment> | ||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model> | ||
</field> | ||
|
||
<field id="send_reset_password_mail" | ||
type="select" | ||
translate="label" | ||
showInDefault="1" | ||
showInWebsite="1" | ||
showInStore="1" | ||
canRestore="1"> | ||
<label>Send Reset Password Mail</label> | ||
<comment>This will send a reset password mail after creating a new account.</comment> | ||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model> | ||
<depends> | ||
<field id="enable">1</field> | ||
</depends> | ||
</field> | ||
|
||
<field id="create_password_template" | ||
type="select" | ||
translate="label" | ||
showInDefault="1" | ||
showInWebsite="1" | ||
showInStore="1" | ||
canRestore="1"> | ||
<label>Create Password Template</label> | ||
<source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> | ||
<depends> | ||
<field id="enable">1</field> | ||
</depends> | ||
</field> | ||
|
||
</group> | ||
</include> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> | ||
<default> | ||
<hyva_themes_checkout> | ||
<new_customer> | ||
<enable>1</enable> | ||
<send_reset_password_mail>1</send_reset_password_mail> | ||
<create_password_template>hyva_themes_checkout_new_customer_create_password_template</create_password_template> | ||
</new_customer> | ||
</hyva_themes_checkout> | ||
</default> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd"> | ||
<template id="hyva_themes_checkout_new_customer_create_password_template" label="Create Password" file="password_reset.html" type="html" module="Magento_Customer" area="frontend"/> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters