Skip to content

Commit eb02570

Browse files
author
Denis Laca
committed
Bugfixes, add catalog export
1 parent 0f1b757 commit eb02570

30 files changed

+1429
-1297
lines changed

Block/Exponea.php

+60-60
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
1-
<?php
2-
namespace Exponea\Exponea\Block;
3-
use \Magento\Framework\View\Element\Template;
4-
5-
class Exponea extends Template
6-
{
7-
protected $helper;
8-
protected $customerSession;
9-
10-
public function __construct(
11-
\Magento\Framework\View\Element\Template\Context $_context,
12-
\Exponea\Exponea\Helpers\Helper $_helper,
13-
\Magento\Customer\Model\Session $_customerSession,
14-
array $data = []
15-
) {
16-
parent::__construct($_context, $data);
17-
$this->helper = $_helper;
18-
$this->customerSession = $_customerSession;
19-
}
20-
21-
public function getProjectToken() {
22-
return $this->helper->getProjectToken();
23-
}
24-
25-
public function userIdEnabled() {
26-
return $this->helper->getEnableUserId();
27-
}
28-
29-
public function isCustomerLoggedIn() {
30-
return $this->customerSession->isLoggedIn();
31-
}
32-
33-
public function getCustomerId() {
34-
return $this->customerSession->getCustomer()->getId();
35-
}
36-
37-
public function getCustomerEmail() {
38-
return $this->customerSession->getCustomer()->getEmail();
39-
}
40-
41-
public function getCustomerFirstname() {
42-
return $this->customerSession->getCustomer()->getFirstname();
43-
}
44-
45-
public function getCustomerLastname() {
46-
return $this->customerSession->getCustomer()->getLastname();
47-
}
48-
49-
public function getEndpoint() {
50-
return $this->helper->getEndpoint();
51-
}
52-
53-
protected function _toHtml() {
54-
if ($this->helper->getEnable() && $this->helper->getProjectToken()) {
55-
return parent::_toHtml();
56-
}
57-
return '';
58-
}
59-
}
60-
1+
<?php
2+
namespace Exponea\Exponea\Block;
3+
use \Magento\Framework\View\Element\Template;
4+
5+
class Exponea extends Template
6+
{
7+
protected $helper;
8+
protected $customerSession;
9+
10+
public function __construct(
11+
\Magento\Framework\View\Element\Template\Context $_context,
12+
\Exponea\Exponea\Helpers\Helper $_helper,
13+
\Magento\Customer\Model\Session $_customerSession,
14+
array $data = []
15+
) {
16+
parent::__construct($_context, $data);
17+
$this->helper = $_helper;
18+
$this->customerSession = $_customerSession;
19+
}
20+
21+
public function getProjectToken() {
22+
return $this->helper->getProjectToken();
23+
}
24+
25+
public function userIdEnabled() {
26+
return $this->helper->getEnableUserId();
27+
}
28+
29+
public function isCustomerLoggedIn() {
30+
return $this->customerSession->isLoggedIn();
31+
}
32+
33+
public function getCustomerId() {
34+
return $this->customerSession->getCustomer()->getId();
35+
}
36+
37+
public function getCustomerEmail() {
38+
return $this->customerSession->getCustomer()->getEmail();
39+
}
40+
41+
public function getCustomerFirstname() {
42+
return $this->customerSession->getCustomer()->getFirstname();
43+
}
44+
45+
public function getCustomerLastname() {
46+
return $this->customerSession->getCustomer()->getLastname();
47+
}
48+
49+
public function getEndpoint() {
50+
return $this->helper->getEndpoint();
51+
}
52+
53+
protected function _toHtml() {
54+
if ($this->helper->getEnable() && $this->helper->getProjectToken()) {
55+
return parent::_toHtml();
56+
}
57+
return '';
58+
}
59+
}
60+

Block/System/Config/ImportCatalog.php

+37-37
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
<?php
2-
namespace Exponea\Exponea\Block\System\Config;
3-
4-
class ImportCatalog extends \Magento\Config\Block\System\Config\Form\Field {
5-
6-
protected $_template = 'Exponea_Exponea::system/config/import-catalog.phtml';
7-
8-
public function __construct(
9-
\Magento\Backend\Block\Template\Context $context,
10-
array $data = []
11-
) {
12-
parent::__construct($context, $data);
13-
}
14-
15-
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element) {
16-
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
17-
return parent::render($element);
18-
}
19-
20-
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element) {
21-
return $this->_toHtml();
22-
}
23-
24-
public function getAjaxUrl() {
25-
return $this->getUrl('exponea_exponea/system_config/importcatalog');
26-
}
27-
28-
public function getButtonHtml() {
29-
$button = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button')->setData([
30-
'id' => 'import_catalog',
31-
'label' => __('Import catalog'),
32-
]);
33-
34-
return $button->toHtml();
35-
}
36-
}
37-
1+
<?php
2+
namespace Exponea\Exponea\Block\System\Config;
3+
4+
class ImportCatalog extends \Magento\Config\Block\System\Config\Form\Field {
5+
6+
protected $_template = 'Exponea_Exponea::system/config/import-catalog.phtml';
7+
8+
public function __construct(
9+
\Magento\Backend\Block\Template\Context $context,
10+
array $data = []
11+
) {
12+
parent::__construct($context, $data);
13+
}
14+
15+
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element) {
16+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
17+
return parent::render($element);
18+
}
19+
20+
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element) {
21+
return $this->_toHtml();
22+
}
23+
24+
public function getAjaxUrl() {
25+
return $this->getUrl('exponea_exponea/system_config/importcatalog');
26+
}
27+
28+
public function getButtonHtml() {
29+
$button = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button')->setData([
30+
'id' => 'import_catalog',
31+
'label' => __('Import catalog'),
32+
]);
33+
34+
return $button->toHtml();
35+
}
36+
}
37+

Block/System/Config/ImportOrders.php

+37-37
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
<?php
2-
namespace Exponea\Exponea\Block\System\Config;
3-
4-
class ImportOrders extends \Magento\Config\Block\System\Config\Form\Field {
5-
6-
protected $_template = 'Exponea_Exponea::system/config/import-orders.phtml';
7-
8-
public function __construct(
9-
\Magento\Backend\Block\Template\Context $context,
10-
array $data = []
11-
) {
12-
parent::__construct($context, $data);
13-
}
14-
15-
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element) {
16-
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
17-
return parent::render($element);
18-
}
19-
20-
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element) {
21-
return $this->_toHtml();
22-
}
23-
24-
public function getAjaxUrl() {
25-
return $this->getUrl('exponea_exponea/system_config/importorders');
26-
}
27-
28-
public function getButtonHtml() {
29-
$button = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button')->setData([
30-
'id' => 'import_orders',
31-
'label' => __('Import orders'),
32-
]);
33-
34-
return $button->toHtml();
35-
}
36-
}
37-
1+
<?php
2+
namespace Exponea\Exponea\Block\System\Config;
3+
4+
class ImportOrders extends \Magento\Config\Block\System\Config\Form\Field {
5+
6+
protected $_template = 'Exponea_Exponea::system/config/import-orders.phtml';
7+
8+
public function __construct(
9+
\Magento\Backend\Block\Template\Context $context,
10+
array $data = []
11+
) {
12+
parent::__construct($context, $data);
13+
}
14+
15+
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element) {
16+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
17+
return parent::render($element);
18+
}
19+
20+
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element) {
21+
return $this->_toHtml();
22+
}
23+
24+
public function getAjaxUrl() {
25+
return $this->getUrl('exponea_exponea/system_config/importorders');
26+
}
27+
28+
public function getButtonHtml() {
29+
$button = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button')->setData([
30+
'id' => 'import_orders',
31+
'label' => __('Import orders'),
32+
]);
33+
34+
return $button->toHtml();
35+
}
36+
}
37+

0 commit comments

Comments
 (0)