Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.0 compatible #3

Merged
merged 11 commits into from
Nov 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
245 changes: 144 additions & 101 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,141 +3,184 @@

class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
public function get_frontend_cfg(){
/**
* @var \Magento\Framework\Escaper
*/
protected $_escaper;
/**
* @var \Magento\Framework\Encryption\EncryptorInterface
*/
protected $_encryptor;
/**
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Framework\Escaper $_escaper
* @param \Magento\Framework\Encryption\EncryptorInterface $_encryptor
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Framework\Escaper $escaper,
\Magento\Framework\Encryption\EncryptorInterface $encryptor
) {
$this->_escaper = $escaper;
$this->_encryptor = $encryptor;
parent::__construct($context);
}
public function getFrontendCfg(){
$cfg = [];
$cfg['key'] = $this->scopeConfig->getValue(
'cc_uk/main_options/frontend_accesstoken',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['enabled'] = $this->scopeConfig->getValue(
$cfg['key'] = $this->_encryptor->decrypt(
$this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/main_options/frontend_accesstoken',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
)
);
$cfg['enabled'] = $this->scopeConfig->isSetFlag(
'cc_uk/main_options/frontend_enabled',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) == 1;
$cfg['hide_fields'] = $this->scopeConfig->getValue(
'cc_uk/gfx_options/hide_fields',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) == 1;
$cfg['auto_search'] = $this->scopeConfig->getValue(
'cc_uk/gfx_options/searchbar_auto_search',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) == 1;
$cfg['clean_postsearch'] = $this->scopeConfig->getValue(
'cc_uk/gfx_options/searchbar_clean_postsearch',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) == 1;
// special search configs

$cfg['searchbar_type'] = $this->scopeConfig->getValue(
'cc_uk/gfx_options/searchbar_type',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
/*
$cfg['search_bg'] = $this->scopeConfig->getValue(
'cc_uk/gfx_options/search_bg',
$cfg['hide_fields'] = $this->scopeConfig->isSetFlag(
'cc_uk/gfx_options/hide_fields',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['search_bg_color'] = $this->scopeConfig->getValue(
'cc_uk/gfx_options/search_bg_color',
$cfg['auto_search'] = $this->scopeConfig->isSetFlag(
'cc_uk/gfx_options/searchbar_auto_search',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['search_icon'] = $this->scopeConfig->getValue(
'cc_uk/gfx_options/search_icon',
$cfg['clean_postsearch'] = $this->scopeConfig->isSetFlag(
'cc_uk/gfx_options/searchbar_clean_postsearch',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
// special search configs

$cfg['search_icon_color'] = $this->scopeConfig->getValue(
'cc_uk/gfx_options/search_icon_color',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
$cfg['searchbar_type'] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/gfx_options/searchbar_type',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
*/

// errors

$cfg['error_msg'] = [];
$cfg['error_msg']["0001"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_1',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['error_msg']["0002"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_2',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['error_msg']["0003"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_3',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['error_msg']["0004"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_4',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
$cfg['error_msg']["0001"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_1',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['error_msg']["0002"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_2',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['error_msg']["0003"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_3',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['error_msg']["0004"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_4',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['txt'] = [];
$cfg['txt']["search_label"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/search_label',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['txt']["search_placeholder"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/search_placeholder',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['txt']['button_text'] = $this->scopeConfig->getValue(
'cc_uk/gfx_options/button_text',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
$cfg['txt']["search_label"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/search_label',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['txt']["search_placeholder"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/search_placeholder',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['txt']['button_text'] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/gfx_options/button_text',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);

return json_encode($cfg);
}
public function get_backend_cfg(){
public function getBackendCfg(){
$cfg = [];
$cfg['key'] = $this->scopeConfig->getValue(
'cc_uk/main_options/backend_accesstoken',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['enabled'] = $this->scopeConfig->getValue(
$cfg['key'] = $this->_encryptor->decrypt(
$this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/main_options/backend_accesstoken',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
)
);
$cfg['enabled'] = $this->scopeConfig->isSetFlag(
'cc_uk/main_options/backend_enabled',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) == 1;
$cfg['auto_search'] = $this->scopeConfig->getValue(
);
$cfg['auto_search'] = $this->scopeConfig->isSetFlag(
'cc_uk/gfx_options/searchbar_auto_search',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) == 1;
$cfg['clean_postsearch'] = $this->scopeConfig->getValue(
);
$cfg['clean_postsearch'] = $this->scopeConfig->isSetFlag(
'cc_uk/gfx_options/searchbar_clean_postsearch',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) == 1;
);

$cfg['searchbar_type'] = $this->scopeConfig->getValue(
'cc_uk/gfx_options/searchbar_type',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
$cfg['searchbar_type'] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/gfx_options/searchbar_type',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['error_msg'] = [];
$cfg['error_msg']["0001"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_1',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['error_msg']["0002"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_2',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['error_msg']["0003"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_3',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['error_msg']["0004"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_4',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
$cfg['error_msg']["0001"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_1',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['error_msg']["0002"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_2',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['error_msg']["0003"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_3',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['error_msg']["0004"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/error_msg_4',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['txt'] = [];
$cfg['txt']["search_label"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/search_label',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['txt']["search_placeholder"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/search_placeholder',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$cfg['txt']["search_buttontext"] = $this->scopeConfig->getValue(
'cc_uk/txt_options/search_buttontext',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
$cfg['txt']["search_label"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/search_label',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['txt']["search_placeholder"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/search_placeholder',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$cfg['txt']["search_buttontext"] = $this->_escaper->escapeHtml(
$this->scopeConfig->getValue(
'cc_uk/txt_options/search_buttontext',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
return json_encode($cfg);

Expand Down
19 changes: 0 additions & 19 deletions Model/Source/Searchbg.php

This file was deleted.

16 changes: 0 additions & 16 deletions Model/Source/Searchicon.php

This file was deleted.

7 changes: 3 additions & 4 deletions Model/Source/Searchtype.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

namespace Craftyclicks\Clicktoaddress\Model\Source;

class Searchtype implements \Magento\Framework\Option\ArrayInterface
class Searchtype implements \Magento\Framework\Data\OptionSourceInterface
{
/**
* @return array
*/
public function toOptionArray()
{
return [
//['value' => 'searchbar_icon', 'label' => 'SearchBar + Icon'],
['value' => 'searchbar_text', 'label' => 'SearchBar'],
['value' => 'traditional', 'label' => 'Traditional']
['value' => 'searchbar_text', 'label' => __('SearchBar')],
['value' => 'traditional', 'label' => __('Traditional')]
];
}
}
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,17 @@

First add the repository:
```
"repositories": [
{
"type": "vcs",
"url": "https://github.com/craftyclicks/magento2"
}
],
composer config repositories.craftyclicks git https://github.com/craftyclicks/magento2.git
```
& make sure that your your minimum-stability is dev.
Then, add the module to the required list either via the composer.json, or execute
& make sure that your your minimum-stability is alpha.
Then, request composer to fetch the module:
```
composer require craftyclicks/module-clicktoaddress
```
(or composer require craftyclicks/module-clicktoaddress:dev-branch for a specific branch)

Then execute install script
```
php -f bin/magento module:enable --clear-static-content Craftyclicks_Clicktoaddress
php -f bin/magento setup:upgrade
```

Expand All @@ -31,7 +25,6 @@ php -f bin/magento setup:upgrade
- Download & copy the git contents to the folder
- Run install script
```
php -f bin/magento module:enable --clear-static-content Craftyclicks_Clicktoaddress
php -f bin/magento setup:upgrade
```

Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
"name": "craftyclicks/module-clicktoaddress",
"description": "Apply postcode lookup to Magento 2.",
"require": {
"magento/framework": "1.0.0-beta"
"php": "~5.5.0|~5.6.0",
"magento/magento-composer-installer": "*"
},
"type": "magento2-module",
"version": "0.1.6",
"version": "0.1.9-beta",
"extra": {
"map": [
[
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/acl.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/Framework/Acl/etc/acl.xsd">
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Adminhtml::admin">
Expand Down
Loading