-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c5c556
commit 53f6c63
Showing
59 changed files
with
2,575 additions
and
703 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,24 @@ | ||
<?php | ||
namespace Remarkety\Mgconnector\Api\Data; | ||
|
||
/** | ||
* Defines a data structure representing a point, to demonstrating passing | ||
* more complex types in and out of a function call. | ||
*/ | ||
interface QueueCollectionInterface | ||
{ | ||
/** | ||
* Get rules. | ||
* | ||
* @return \Remarkety\Mgconnector\Api\Data\QueueInterface[] | ||
*/ | ||
public function getQueueItems(); | ||
|
||
/** | ||
* Set rules . | ||
* | ||
* @param \Remarkety\Mgconnector\Api\Data\QueueInterface[] $items | ||
* @return $this | ||
*/ | ||
public function setQueueItems(array $items = null); | ||
} |
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
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 Remarkety\Mgconnector\Api; | ||
|
||
use Remarkety\Mgconnector\Api\Data\QueueInterface; | ||
use Magento\Framework\Api\SearchCriteriaInterface; | ||
|
||
interface QueueRepositoryInterface | ||
{ | ||
public function save(QueueInterface $page); | ||
|
||
public function getById($id); | ||
|
||
public function getList(SearchCriteriaInterface $criteria); | ||
|
||
public function delete(QueueInterface $page); | ||
|
||
public function deleteById($id); | ||
} |
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,74 @@ | ||
<?php | ||
|
||
/** | ||
* Adminhtml queue grid block | ||
* | ||
* @category Remarkety | ||
* @package Remarkety_Mgconnector | ||
* @author Piotr Pierzak <piotrek.pierzak@gmail.com> | ||
*/ | ||
namespace Remarkety\Mgconnector\Block\Adminhtml\Install; | ||
|
||
use \Magento\Store\Model\ResourceModel\Store\Collection as StoreCollection; | ||
use \Remarkety\Mgconnector\Model\QueueFactory; | ||
use \Magento\Catalog\Model\ProductFactory; | ||
|
||
class Grid extends \Magento\Backend\Block\Widget\Grid\Extended | ||
{ | ||
public function __construct( | ||
\Magento\Backend\Block\Template\Context $context, | ||
\Magento\Backend\Helper\Data $backendHelper, | ||
array $data = [] | ||
) | ||
{ | ||
parent::__construct($context, $backendHelper, $data); | ||
$this->setPagerVisibility(false); | ||
$this->setFilterVisibility(false); | ||
} | ||
|
||
public function getRowUrl($item) | ||
{ | ||
return ''; | ||
} | ||
|
||
protected function _prepareCollection() | ||
{ | ||
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | ||
/** @var \Magento\Store\Model\ResourceModel\Store\Collection $collection */ | ||
$collection = $objectManager->create('Magento\Store\Model\ResourceModel\Store\Collection'); | ||
|
||
$collection->addOrder('website_id')->addOrder('group_id'); | ||
|
||
$this->setCollection($collection); | ||
parent::_prepareCollection(); | ||
return $this; | ||
} | ||
|
||
protected function _prepareColumns() | ||
{ | ||
$this->addColumn('website_id', [ | ||
'header' => __('Website'), | ||
'index' => 'website_id', | ||
'renderer' => 'Remarkety\Mgconnector\Block\Adminhtml\Install\Grid\Render\Website' | ||
]); | ||
|
||
$this->addColumn('group_id', [ | ||
'header' => __('Store'), | ||
'index' => 'group_id', | ||
'renderer' => 'Remarkety\Mgconnector\Block\Adminhtml\Install\Grid\Render\Group' | ||
]); | ||
|
||
$this->addColumn('name', array( | ||
'header' => __('Store view'), | ||
'index' => 'name' | ||
)); | ||
|
||
$this->addColumn('store_id', [ | ||
'header' => __('Status'), | ||
'index' => 'store_id', | ||
'renderer' => 'Remarkety\Mgconnector\Block\Adminhtml\Install\Grid\Render\Status' | ||
]); | ||
|
||
return parent::_prepareColumns(); | ||
} | ||
} |
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,30 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Remarkety\Mgconnector\Block\Adminhtml\Install\Grid\Render; | ||
|
||
/** | ||
* Store render website | ||
* | ||
* @author Magento Core Team <core@magentocommerce.com> | ||
*/ | ||
class Group extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer | ||
{ | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function render(\Magento\Framework\DataObject $row) | ||
{ | ||
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | ||
/** | ||
* @var $groupRepository \Magento\Store\Model\GroupRepository | ||
*/ | ||
$groupRepository = $objectManager->get('Magento\Store\Model\GroupRepository'); | ||
$group = $groupRepository->get($row->getGroupId()); | ||
|
||
return $group->getName(); | ||
} | ||
} |
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 | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Remarkety\Mgconnector\Block\Adminhtml\Install\Grid\Render; | ||
use Remarkety\Mgconnector\Helper\ConfigHelper; | ||
|
||
/** | ||
* Store render website | ||
* | ||
* @author Magento Core Team <core@magentocommerce.com> | ||
*/ | ||
class Status extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer | ||
{ | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function render(\Magento\Framework\DataObject $row) | ||
{ | ||
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | ||
/** | ||
* @var $configHelper ConfigHelper | ||
*/ | ||
$configHelper = $objectManager->get('Remarkety\Mgconnector\Helper\ConfigHelper'); | ||
$installed = $configHelper->isStoreInstalled($row->getStoreId()); | ||
if($installed){ | ||
$ret = '<span style="color:green">'. __('Connected') .'</span>'; | ||
|
||
$publicId = $configHelper->getRemarketyPublicId($row->getStoreId()); | ||
if(empty($publicId)){ | ||
$ret .= '<br />'; | ||
$ret .= '<span style="color:red">(' . __('Missing Remarkety\'s store id; website tracking and live updates will not work.') . ')</span>'; | ||
} | ||
|
||
return $ret; | ||
} else { | ||
return '<button id="install_button_'.$row->getStoreId().'" type="button" class="scalable save" onclick="window.location = \''. $this->getUrl('*/install/install', ['mode' => \Remarkety\Mgconnector\Model\Install::MODE_INSTALL_LOGIN, 'store' => $row->getStoreId()]) .'\'" style=""> | ||
Connect to Remarkety | ||
</button>'; | ||
} | ||
} | ||
} |
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,30 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Remarkety\Mgconnector\Block\Adminhtml\Install\Grid\Render; | ||
|
||
/** | ||
* Store render website | ||
* | ||
* @author Magento Core Team <core@magentocommerce.com> | ||
*/ | ||
class Website extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer | ||
{ | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function render(\Magento\Framework\DataObject $row) | ||
{ | ||
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | ||
/** | ||
* @var $websiteRepo \Magento\Store\Model\WebsiteRepository | ||
*/ | ||
$websiteRepo = $objectManager->get('Magento\Store\Model\WebsiteRepository'); | ||
$website = $websiteRepo->getById($row->getWebsiteId()); | ||
|
||
return $website->getName(); | ||
} | ||
} |
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
Oops, something went wrong.