forked from lindomarcb/Magento-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instalação de módulos + Tradução + Backup BD + Documentação
Foram implementados os seguintes módulos: - Página FAQ - Módulo de Otimização Seo - Notificação e Envio de Novos Pedidos por Email no Magento Criada a pasta de Backups do Banco de Dados Módulos traduzidos Documentação atualizada
- Loading branch information
1 parent
26665ef
commit 8e72c1d
Showing
611 changed files
with
106,307 additions
and
74 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
app/code/Hiddentechies/Base/Block/Adminhtml/System/Config/Form/Info.php
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,47 @@ | ||
<?php | ||
|
||
namespace Hiddentechies\Base\Block\Adminhtml\System\Config\Form; | ||
|
||
class Info extends \Magento\Config\Block\System\Config\Form\Field { | ||
|
||
protected $moduleList; | ||
|
||
public function __construct( | ||
\Magento\Framework\Module\ModuleListInterface $moduleList, \Magento\Backend\Block\Template\Context $context, array $data = [] | ||
) { | ||
$this->moduleList = $moduleList; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element) { | ||
$html = ''; | ||
|
||
if (in_array('curl', get_loaded_extensions())) { | ||
$file = 'https://www.hiddentechies.com/documentation/notifications/latest_notifications.xml'; | ||
define('LATEST_NOTIFICATIONS_FILE', $file); | ||
|
||
$ch = curl_init(); | ||
$timeout = 5; | ||
curl_setopt($ch, CURLOPT_URL, LATEST_NOTIFICATIONS_FILE); | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); | ||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | ||
|
||
$response = curl_exec($ch); | ||
$errmsg = curl_error($ch); | ||
curl_close($ch); | ||
|
||
if ($errmsg == '') { | ||
$xml = simplexml_load_string($response); | ||
$content_info = $xml->item->content_info; | ||
|
||
$html .= '<div class="display-ht-notifications" style="float: left;clear: both;">'; | ||
$html .= $content_info; | ||
$html .= '</div>'; | ||
} | ||
} | ||
|
||
return $html; | ||
} | ||
|
||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace Hiddentechies\Base\Block; | ||
|
||
class Validate extends \Magento\Framework\View\Element\Template { | ||
|
||
public function __construct( | ||
\Magento\Catalog\Block\Product\Context $context, array $data = [] | ||
) { | ||
|
||
parent::__construct($context, $data); | ||
} | ||
|
||
protected function _prepareLayout() { | ||
return parent::_prepareLayout(); | ||
} | ||
|
||
} |
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,18 @@ | ||
{ | ||
"name": "hiddentechies/base", | ||
"description": "HiddenTechies Base Extension", | ||
"type": "magento2-module", | ||
"version": "2.0.0", | ||
"license": [ | ||
"OSL-3.0", | ||
"AFL-3.0" | ||
], | ||
"autoload": { | ||
"files": [ | ||
"registration.php" | ||
], | ||
"psr-4": { | ||
"Hiddentechies\\Base\\": "" | ||
} | ||
} | ||
} |
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:framework:ObjectManager/etc/config.xsd"> | ||
|
||
</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,8 @@ | ||
<?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> | ||
<tab id="hiddentechies" translate="label" sortOrder="999999"> | ||
<label>Hiddentechies</label> | ||
</tab> | ||
</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,4 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
|
||
</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:framework:Module/etc/module.xsd"> | ||
<module name="Hiddentechies_Base" setup_version="2.0.0" /> | ||
</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,6 @@ | ||
<?php | ||
\Magento\Framework\Component\ComponentRegistrar::register( | ||
\Magento\Framework\Component\ComponentRegistrar::MODULE, | ||
'Hiddentechies_Base', | ||
__DIR__ | ||
); |
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,38 @@ | ||
<?php | ||
|
||
namespace Hiddentechies\Neworder\Helper; | ||
|
||
use Magento\Customer\Api\Data\CustomerInterface; | ||
use Magento\Customer\Helper\View as CustomerViewHelper; | ||
|
||
class Data extends \Magento\Framework\App\Helper\AbstractHelper { | ||
|
||
/** | ||
* Neworder form data | ||
*/ | ||
protected $_data; | ||
|
||
/** | ||
* Initialize | ||
* | ||
* @param Magento\Framework\App\Helper\Context $context | ||
* @param Magento\Catalog\Model\ProductFactory $productFactory | ||
* @param Magento\Store\Model\StoreManagerInterface $storeManager | ||
* @param Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
\Magento\Framework\App\Helper\Context $context | ||
) { | ||
parent::__construct($context); | ||
} | ||
|
||
/** | ||
* Fetch System Config Value | ||
*/ | ||
public function getConfigVal($str = '') { | ||
return $this->scopeConfig | ||
->getValue($str, \Magento\Store\Model\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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
<?php | ||
|
||
namespace Hiddentechies\Neworder\Observer; | ||
|
||
use Magento\Framework\Event\ObserverInterface; | ||
|
||
class NewOrder implements ObserverInterface { | ||
|
||
/** | ||
* @var \Magento\Framework\Translate\Inline\StateInterface | ||
*/ | ||
protected $inlineTranslation; | ||
|
||
/** | ||
* Store manager | ||
* | ||
* @var \Magento\Store\Model\StoreManagerInterface | ||
*/ | ||
protected $_storeManager; | ||
|
||
/** | ||
* @var \Magento\Framework\Mail\Template\TransportBuilder | ||
*/ | ||
protected $_transportBuilder; | ||
|
||
/** | ||
* @var \Magento\Framework\App\Config\ScopeConfigInterface | ||
*/ | ||
protected $_scopeConfig; | ||
|
||
/** | ||
* Get extension configuration helper | ||
* @var \Hiddentechies\Testimonials\Helper\Config | ||
*/ | ||
public $dataHelper; | ||
|
||
/** | ||
* Pricing Helper | ||
* @var \Magento\Framework\Pricing\Helper\Data | ||
*/ | ||
public $curHelper; | ||
|
||
/** | ||
* Sales order Model | ||
* @var \Magento\Sales\Model\Order | ||
*/ | ||
protected $order; | ||
|
||
/** | ||
* Initialize dependencies. | ||
* | ||
* @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation | ||
* @param \Magento\Store\Model\StoreManagerInterface $storeManager | ||
* @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder | ||
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig | ||
* @param \Hiddentechies\Neworder\Helper\Config $dataHelper | ||
*/ | ||
public function __construct( | ||
\Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, | ||
\Magento\Store\Model\StoreManagerInterface $storeManager, | ||
\Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, | ||
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, | ||
\Magento\Sales\Model\Order $order, | ||
\Hiddentechies\Neworder\Helper\Data $dataHelper, | ||
\Magento\Framework\Pricing\Helper\Data $curHelper | ||
) { | ||
$this->inlineTranslation = $inlineTranslation; | ||
$this->_storeManager = $storeManager; | ||
$this->_transportBuilder = $transportBuilder; | ||
$this->_scopeConfig = $scopeConfig; | ||
$this->order = $order; | ||
$this->dataHelper = $dataHelper; | ||
$this->curHelper = $curHelper; | ||
} | ||
|
||
protected function _sendEmail($from, $to, $templateId, $vars, $store, $area = \Magento\Framework\App\Area::AREA_FRONTEND) { | ||
$this->inlineTranslation->suspend(); | ||
$this->_transportBuilder | ||
->setTemplateIdentifier($templateId) | ||
->setTemplateOptions([ | ||
'area' => $area, | ||
'store' => $store->getId() | ||
]) | ||
->setTemplateVars($vars) | ||
->setFrom($from) | ||
->addTo($to['email'], $to['name']); | ||
$transport = $this->_transportBuilder->getTransport(); | ||
$transport->sendMessage(); | ||
|
||
$this->inlineTranslation->resume(); | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* | ||
* @param \Magento\Framework\Event\Observer $observer | ||
* @return $this | ||
*/ | ||
public function execute(\Magento\Framework\Event\Observer $observer) { | ||
$isNewOrderEnable = $this->dataHelper->getConfigVal('newordersection/generalgroup/enabled'); | ||
// Check if new order email notification enabled | ||
if($isNewOrderEnable){ | ||
|
||
// Set current order details | ||
$orderIds = $observer->getEvent()->getOrderIds(); | ||
$order = $this->order->load($orderIds); | ||
$orderIncId = $order->getIncrementId(); | ||
|
||
// Set email config options | ||
$store = $this->_storeManager->getStore(); | ||
$from = $this->dataHelper->getConfigVal('newordersection/generalgroup/send_from'); | ||
$to = [ | ||
'email' => $this->dataHelper->getConfigVal('newordersection/generalgroup/email'), | ||
'name' => 'Administrator' | ||
]; | ||
$templateId = $this->dataHelper->getConfigVal('newordersection/generalgroup/template'); | ||
$subject = $this->dataHelper->getConfigVal('newordersection/generalgroup/subject'); | ||
|
||
// Set email template variables | ||
$vars = [ | ||
'admin_subject' => $subject, | ||
'cur_order_id' => "#".$orderIncId, | ||
]; | ||
|
||
// Call send email function with the necessary parameters | ||
$this->_sendEmail($from, $to, $templateId, $vars, $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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "hiddentechies/neworder", | ||
"description": "New Order Notification for Magento 2 extension helps admin to start getting notifications regarding new order right away.", | ||
"type": "magento2-module", | ||
"version": "1.0.2", | ||
"license": [ | ||
"OSL-3.0", | ||
"AFL-3.0" | ||
], | ||
"autoload": { | ||
"files": [ | ||
"registration.php" | ||
], | ||
"psr-4": { | ||
"Hiddentechies\\Neworder\\": "" | ||
} | ||
} | ||
} |
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,19 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Acl/etc/acl.xsd"> | ||
<acl> | ||
<resources> | ||
<resource id="Magento_Backend::admin"> | ||
<resource id="Hiddentechies_Neworder::neworder" title="New Order Notification" sortOrder="55"> | ||
<resource id="Hiddentechies_Neworder::newordernot" title="New Order Notification" sortOrder="10"/> | ||
</resource> | ||
<resource id="Magento_Backend::stores"> | ||
<resource id="Magento_Backend::stores_settings"> | ||
<resource id="Magento_Config::config"> | ||
<resource id="Hiddentechies_Neworder::config" title="New Order Notification Configuration"/> | ||
</resource> | ||
</resource> | ||
</resource> | ||
</resource> | ||
</resources> | ||
</acl> | ||
</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,8 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd"> | ||
<router id="admin"> | ||
<route id="hiddentechies_neworder" frontName="hiddentechies_neworder"> | ||
<module name="Hiddentechies_Neworder" before="Magento_Backend"/> | ||
</route> | ||
</router> | ||
</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,53 @@ | ||
<?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="newordersection" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
<class>separator-top</class> | ||
<label>New Order Notification</label> | ||
<tab>hiddentechies</tab> | ||
<resource>Hiddentechies_Neworder::config</resource> | ||
<group id="htinformation" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
<label>Product Information</label> | ||
<attribute type="expanded">1</attribute> | ||
<field id="product_info" translate="label comment" type="text" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
<frontend_model>Hiddentechies\Base\Block\Adminhtml\System\Config\Form\Info</frontend_model> | ||
</field> | ||
</group> | ||
<group id="generalgroup" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
<label>General</label> | ||
<field id="enabled" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
<label>Enable Notification?</label> | ||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model> | ||
</field> | ||
<field id="send_from" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
<label>Send Email From</label> | ||
<source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> | ||
<depends> | ||
<field id="enabled">1</field> | ||
</depends> | ||
</field> | ||
<field id="email" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
<label>Administrator email</label> | ||
<depends> | ||
<field id="enabled">1</field> | ||
</depends> | ||
<comment><![CDATA[Set receiver email address]]></comment> | ||
</field> | ||
<field id="subject" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
<label>Administrator email subject</label> | ||
<depends> | ||
<field id="enabled">1</field> | ||
</depends> | ||
</field> | ||
<field id="template" translate="label comment" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
<label>Email Template</label> | ||
<comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> | ||
<source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> | ||
<depends> | ||
<field id="enabled">1</field> | ||
</depends> | ||
</field> | ||
</group> | ||
</section> | ||
</system> | ||
</config> |
Oops, something went wrong.