-
Notifications
You must be signed in to change notification settings - Fork 6
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 #10 from magmodules/1.6.0
1.6.0
- Loading branch information
Showing
55 changed files
with
2,287 additions
and
994 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.idea/* | ||
.idea | ||
*.zip | ||
.DS_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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* @category Magmodules | ||
* @package Magmodules_Channable | ||
* @author Magmodules <[email protected]) | ||
* @copyright Copyright (c) 2017 (http://www.magmodules.eu) | ||
* @copyright Copyright (c) 2018 (http://www.magmodules.eu) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* | ||
*/ | ||
|
@@ -23,6 +23,9 @@ class Magmodules_Channable_Block_Adminhtml_Config_Form_Field_Extra | |
extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract | ||
{ | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $_renders = array(); | ||
|
||
/** | ||
|
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* @category Magmodules | ||
* @package Magmodules_Channable | ||
* @author Magmodules <[email protected]) | ||
* @copyright Copyright (c) 2017 (http://www.magmodules.eu) | ||
* @copyright Copyright (c) 2018 (http://www.magmodules.eu) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* | ||
*/ | ||
|
@@ -23,6 +23,9 @@ class Magmodules_Channable_Block_Adminhtml_Config_Form_Field_Filter | |
extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract | ||
{ | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $_renders = array(); | ||
|
||
/** | ||
|
@@ -50,6 +53,16 @@ public function __construct() | |
Mage::getModel('channable/adminhtml_system_config_source_conditions')->toOptionArray() | ||
); | ||
|
||
$rendererTypes = $layout->createBlock( | ||
'channable/adminhtml_config_form_renderer_select', | ||
'', | ||
array('is_render_to_js_template' => true) | ||
); | ||
|
||
$rendererTypes->setOptions( | ||
Mage::getModel('channable/adminhtml_system_config_source_producttypes')->toOptionArray() | ||
); | ||
|
||
$this->addColumn( | ||
'attribute', array( | ||
'label' => Mage::helper('channable')->__('Attribute'), | ||
|
@@ -73,8 +86,18 @@ public function __construct() | |
) | ||
); | ||
|
||
$this->addColumn( | ||
'product_type', array( | ||
'label' => Mage::helper('channable')->__('Apply To'), | ||
'style' => 'width:150px', | ||
'renderer' => $rendererTypes | ||
) | ||
); | ||
|
||
|
||
$this->_renders['attribute'] = $rendererAttributes; | ||
$this->_renders['condition'] = $rendererConditions; | ||
$this->_renders['product_type'] = $rendererTypes; | ||
|
||
$this->_addAfter = false; | ||
$this->_addButtonLabel = Mage::helper('channable')->__('Add Filter'); | ||
|
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* @category Magmodules | ||
* @package Magmodules_Channable | ||
* @author Magmodules <[email protected]) | ||
* @copyright Copyright (c) 2017 (http://www.magmodules.eu) | ||
* @copyright Copyright (c) 2018 (http://www.magmodules.eu) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* | ||
*/ | ||
|
@@ -23,6 +23,9 @@ class Magmodules_Channable_Block_Adminhtml_Config_Form_Field_Shipping | |
extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract | ||
{ | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $_renders = array(); | ||
|
||
/** | ||
|
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* @category Magmodules | ||
* @package Magmodules_Channable | ||
* @author Magmodules <[email protected]) | ||
* @copyright Copyright (c) 2017 (http://www.magmodules.eu) | ||
* @copyright Copyright (c) 2018 (http://www.magmodules.eu) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* | ||
*/ | ||
|
@@ -107,7 +107,7 @@ protected function _toHtml() | |
} | ||
|
||
if (is_array($value)) { | ||
$html .= '<optgroup label="' . $label . '">'; | ||
$html .= '<optgroup label="' . htmlspecialchars($label, ENT_QUOTES | ENT_HTML5) . '">'; | ||
foreach ($value as $keyGroup => $optionGroup) { | ||
if (!is_array($optionGroup)) { | ||
$optionGroup = array( | ||
|
80 changes: 80 additions & 0 deletions
80
app/code/community/Magmodules/Channable/Block/Adminhtml/System/Config/Form/Field/Button.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,80 @@ | ||
<?php | ||
/** | ||
* Magmodules.eu - http://www.magmodules.eu | ||
* | ||
* NOTICE OF LICENSE | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Magmodules | ||
* @package Magmodules_Channable | ||
* @author Magmodules <[email protected]> | ||
* @copyright Copyright (c) 2018 (http://www.magmodules.eu) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
class Magmodules_Channable_Block_Adminhtml_System_Config_Form_Field_Button | ||
extends Mage_Adminhtml_Block_System_Config_Form_Field | ||
{ | ||
|
||
/** | ||
* @var Mage_Adminhtml_Helper_Data | ||
*/ | ||
public $helper; | ||
|
||
/** | ||
* @inheritdoc. | ||
*/ | ||
public function _construct() | ||
{ | ||
parent::_construct(); | ||
$this->setTemplate('magmodules/channable/system/config/test_button.phtml'); | ||
$this->helper = Mage::helper('adminhtml'); | ||
} | ||
|
||
/** | ||
* Return element html | ||
* | ||
* @param Varien_Data_Form_Element_Abstract $element | ||
* | ||
* @return string | ||
*/ | ||
public function _getElementHtml(Varien_Data_Form_Element_Abstract $element) | ||
{ | ||
return $this->_toHtml(); | ||
} | ||
|
||
/** | ||
* Return ajax url for button | ||
* | ||
* @return string | ||
*/ | ||
public function getAjaxCheckUrl() | ||
{ | ||
return $this->helper->getUrl('adminhtml/selftest/run'); | ||
} | ||
|
||
/** | ||
* Generate button html | ||
* | ||
* @return string | ||
*/ | ||
public function getButtonHtml() | ||
{ | ||
$button = $this->getLayout()->createBlock('adminhtml/widget_button') | ||
->setData( | ||
array( | ||
'id' => 'test_check_button', | ||
'label' => $this->helper('adminhtml')->__('Run'), | ||
'onclick' => 'javascript:testModule(); return false;' | ||
) | ||
); | ||
|
||
return $button->toHtml(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* @category Magmodules | ||
* @package Magmodules_Channable | ||
* @author Magmodules <[email protected]) | ||
* @copyright Copyright (c) 2017 (http://www.magmodules.eu) | ||
* @copyright Copyright (c) 2018 (http://www.magmodules.eu) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* | ||
*/ | ||
|
@@ -32,37 +32,51 @@ public function render(Varien_Data_Form_Element_Abstract $element) | |
{ | ||
$helper = Mage::helper('channable'); | ||
$storeIds = $helper->getStoreIds('channable/connect/enabled'); | ||
$token = Mage::helper('channable')->getToken(); | ||
$token = $helper->getToken(); | ||
$sHtml = ''; | ||
|
||
if ($token) { | ||
foreach ($storeIds as $storeId) { | ||
$baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); | ||
$channableFeed = $baseUrl . 'channable/feed/get/code/' . $token . '/store/' . $storeId . '/array/1'; | ||
$storeTitle = Mage::app()->getStore($storeId)->getName(); | ||
$url = 'https://app.channable.com/connect/magento.html?'; | ||
$url .= 'store_id=' . $storeId . '&url=' . $baseUrl . '&token=' . $token; | ||
$msg = $this->__('Click to auto connect with Channable'); | ||
$store = Mage::getModel('core/store')->load($storeId); | ||
$baseUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); | ||
|
||
$sHtml .= '<tr> | ||
<td>' . $storeTitle . '</td> | ||
<td><a href="' . $channableFeed . '">' . $this->__('Preview') . '</a></td> | ||
<td><a href="' . $url . '" target="_blank">' . $msg . '</a></td> | ||
</tr>'; | ||
$url = sprintf( | ||
'https://app.channable.com/connect/magento.html?store_id=%s&url=%s&token=%s', | ||
$storeId, | ||
$baseUrl, | ||
$token | ||
); | ||
|
||
$sHtml .= sprintf( | ||
'<tr><td>%s</td><td>%s</td><td><a href="%s">%s</a></td><td><a href="%s" target="_blank">%s</a></td></tr>', | ||
$store->getWebsite()->getName(), | ||
$store->getName(), | ||
$baseUrl . 'channable/feed/get/code/' . $token . '/store/' . $storeId . '/array/1', | ||
$this->__('Preview'), | ||
$url, | ||
$this->__('Click to auto connect with Channable') | ||
); | ||
} | ||
} | ||
|
||
if (!$sHtml) { | ||
$html = $helper->__('No enabled feed(s) found or token missing'); | ||
} else { | ||
$html = '<div class="grid"> | ||
<table cellpadding="0" cellspacing="0" class="border" style="width:425px;"> | ||
<tbody> | ||
<tr class="headings"><th>Store</th><th>Preview</th><th>Connect</th></tr> | ||
</tbody> | ||
' . $sHtml . ' | ||
</table> | ||
</div>'; | ||
<table cellpadding="0" cellspacing="0" class="border" style="width:425px;"> | ||
<thead> | ||
<tr class="headings"> | ||
<th>' . $helper->__('Website') .'</th> | ||
<th>' . $helper->__('Store') .'</th> | ||
<th>' . $helper->__('Preview') .'</th> | ||
<th>' . $helper->__('Connect') .'</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
' . $sHtml . ' | ||
</tbody> | ||
</table> | ||
</div>'; | ||
} | ||
|
||
return sprintf( | ||
|
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* @category Magmodules | ||
* @package Magmodules_Channable | ||
* @author Magmodules <[email protected]) | ||
* @copyright Copyright (c) 2017 (http://www.magmodules.eu) | ||
* @copyright Copyright (c) 2018 (http://www.magmodules.eu) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* | ||
*/ | ||
|
@@ -30,11 +30,20 @@ class Magmodules_Channable_Block_Adminhtml_System_Config_Form_Field_Heading | |
*/ | ||
public function render(Varien_Data_Form_Element_Abstract $element) | ||
{ | ||
return sprintf( | ||
'<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4>%s</h4></td></tr>', | ||
$element->getHtmlId(), | ||
$element->getLabel() | ||
$html = sprintf( | ||
' | ||
<tr id="row_%s"> | ||
<td colspan="5"> | ||
<h4 id="%s" style="border-bottom: 1px solid #dddddd;padding: 20px 5px 5px 5px;">%s</h4> | ||
<div class="comment"> | ||
<span>%s</span> | ||
</div> | ||
</td> | ||
</tr>', | ||
$element->getHtmlId(), $element->getHtmlId(), $element->getLabel(), $element->getComment() | ||
); | ||
|
||
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* @category Magmodules | ||
* @package Magmodules_Channable | ||
* @author Magmodules <[email protected]) | ||
* @copyright Copyright (c) 2017 (http://www.magmodules.eu) | ||
* @copyright Copyright (c) 2018 (http://www.magmodules.eu) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* | ||
*/ | ||
|
50 changes: 50 additions & 0 deletions
50
app/code/community/Magmodules/Channable/Block/Adminhtml/System/Config/Form/Field/Result.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,50 @@ | ||
<?php | ||
/** | ||
* Magmodules.eu - http://www.magmodules.eu | ||
* | ||
* NOTICE OF LICENSE | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Magmodules | ||
* @package Magmodules_Channable | ||
* @author Magmodules <[email protected]> | ||
* @copyright Copyright (c) 2018 (http://www.magmodules.eu) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
class Magmodules_Channable_Block_Adminhtml_System_Config_Form_Field_Result | ||
extends Mage_Adminhtml_Block_System_Config_Form_Field | ||
{ | ||
|
||
/** | ||
* Return element html. | ||
* | ||
* @param Varien_Data_Form_Element_Abstract $element | ||
* | ||
* @return string | ||
*/ | ||
public function _getElementHtml(Varien_Data_Form_Element_Abstract $element) | ||
{ | ||
return $this->_toHtml(); | ||
} | ||
|
||
/** | ||
* @param Varien_Data_Form_Element_Abstract $element | ||
* | ||
* @return string | ||
*/ | ||
public function render(Varien_Data_Form_Element_Abstract $element) | ||
{ | ||
return sprintf( | ||
'<tr id="row_%s"><td colspan="5" class="label" style="margin-bottom: 10px;"><span id="result"><span id="test_result"></span></span></td></tr>', | ||
$element->getHtmlId() | ||
); | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* @category Magmodules | ||
* @package Magmodules_Channable | ||
* @author Magmodules <[email protected]) | ||
* @copyright Copyright (c) 2017 (http://www.magmodules.eu) | ||
* @copyright Copyright (c) 2018 (http://www.magmodules.eu) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* | ||
*/ | ||
|
Oops, something went wrong.