Skip to content

Commit

Permalink
Merge pull request #10 from magmodules/1.6.0
Browse files Browse the repository at this point in the history
1.6.0
  • Loading branch information
Marvin-Magmodules authored Jan 26, 2018
2 parents 16e26ed + fba8489 commit 62060f5
Show file tree
Hide file tree
Showing 55 changed files with 2,287 additions and 994 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.idea/*
.idea
*.zip
.DS_Store
5 changes: 4 additions & 1 deletion app/code/community/Magmodules/Channable/Block/Adminhtml/Config/Form/Field/Extra.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
*/
Expand All @@ -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();

/**
Expand Down
25 changes: 24 additions & 1 deletion app/code/community/Magmodules/Channable/Block/Adminhtml/Config/Form/Field/Filter.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
*/
Expand All @@ -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();

/**
Expand Down Expand Up @@ -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'),
Expand All @@ -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');
Expand Down
5 changes: 4 additions & 1 deletion app/code/community/Magmodules/Channable/Block/Adminhtml/Config/Form/Field/Shipping.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
*/
Expand All @@ -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();

/**
Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Magmodules/Channable/Block/Adminhtml/Config/Form/Renderer/Select.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
*/
Expand Down Expand Up @@ -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(
Expand Down
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();
}
}
54 changes: 34 additions & 20 deletions app/code/community/Magmodules/Channable/Block/Adminhtml/System/Config/Form/Field/Feeds.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
*/
Expand All @@ -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(
Expand Down
19 changes: 14 additions & 5 deletions app/code/community/Magmodules/Channable/Block/Adminhtml/System/Config/Form/Field/Heading.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
*/
Expand All @@ -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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
*/
Expand Down
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()
);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
*/
Expand Down
Loading

0 comments on commit 62060f5

Please sign in to comment.