Version Notes
First release of the extension
Download this release
Release Info
| Developer | ExtDev Company |
| Extension | ED_EC |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/community/Extdev/All/Block/System/Config/Tabs.php +45 -0
- app/code/community/Extdev/All/Helper/Data.php +54 -0
- app/code/community/Extdev/All/Model/Source/Abstract.php +77 -0
- app/code/community/Extdev/All/etc/config.xml +36 -0
- app/code/community/Extdev/All/etc/system.xml +9 -0
- app/code/community/Extdev/Easycalls/Block/Adminhtml/Widget/Grid/Column/Renderer/Eclink.php +78 -0
- app/code/community/Extdev/Easycalls/Helper/Config.php +69 -0
- app/code/community/Extdev/Easycalls/Helper/Data.php +20 -0
- app/code/community/Extdev/Easycalls/Helper/Observer.php +50 -0
- app/code/community/Extdev/Easycalls/Model/Source/Abstract.php +20 -0
- app/code/community/Extdev/Easycalls/Model/Source/Config/Phonessrc.php +32 -0
- app/code/community/Extdev/Easycalls/etc/config.xml +77 -0
- app/code/community/Extdev/Easycalls/etc/system.xml +54 -0
- app/etc/modules/Extdev_All.xml +9 -0
- app/etc/modules/Extdev_Easycalls.xml +12 -0
- app/locale/en_US/Extdev_All.csv +1 -0
- app/locale/en_US/Extdev_Easycalls.csv +8 -0
- package.xml +18 -0
app/code/community/Extdev/All/Block/System/Config/Tabs.php
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* ExtDev
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the EULA
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://extdev.net/LICENSE.txt
|
| 11 |
+
*
|
| 12 |
+
* DISCLAIMER
|
| 13 |
+
*
|
| 14 |
+
* Do not edit or add to this file if you wish to upgrade this extension
|
| 15 |
+
* to newer versions in the future
|
| 16 |
+
*
|
| 17 |
+
* @category ExtDev
|
| 18 |
+
* @package Extdev_All
|
| 19 |
+
* @copyright 2012 ExtDev Co. (http://extdev.net)
|
| 20 |
+
* @license http://extdev.net/LICENSE.txt
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class Extdev_All_Block_System_Config_Tabs extends Mage_Adminhtml_Block_System_Config_Tabs
|
| 24 |
+
{
|
| 25 |
+
protected function _ed_sort($a, $b)
|
| 26 |
+
{
|
| 27 |
+
return strcmp($a->label, $b->label);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
public function initTabs()
|
| 31 |
+
{
|
| 32 |
+
$sections = Mage::getSingleton('adminhtml/config')->getSections();
|
| 33 |
+
$ednSections = array();
|
| 34 |
+
foreach($sections->children() as $sectionId => $section) {
|
| 35 |
+
if(isset($section->tab) && $section->tab == 'ednall') {
|
| 36 |
+
$ednSections[] = $section;
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
usort($ednSections, array($this, '_ed_sort'));
|
| 40 |
+
foreach($ednSections as $index => $section) {
|
| 41 |
+
$section->sort_order = $index;
|
| 42 |
+
}
|
| 43 |
+
return parent::initTabs();
|
| 44 |
+
}
|
| 45 |
+
}
|
app/code/community/Extdev/All/Helper/Data.php
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* ExtDev
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the EULA
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://extdev.net/LICENSE.txt
|
| 12 |
+
*
|
| 13 |
+
* DISCLAIMER
|
| 14 |
+
*
|
| 15 |
+
* Do not edit or add to this file if you wish to upgrade this extension
|
| 16 |
+
* to newer versions in the future
|
| 17 |
+
*
|
| 18 |
+
* @category ExtDev
|
| 19 |
+
* @package Extdev_All
|
| 20 |
+
* @copyright 2012 ExtDev Co. (http://extdev.net)
|
| 21 |
+
* @license http://extdev.net/LICENSE.txt
|
| 22 |
+
*/
|
| 23 |
+
|
| 24 |
+
class Extdev_All_Helper_Data extends Mage_Core_Helper_Abstract
|
| 25 |
+
{
|
| 26 |
+
/**
|
| 27 |
+
* Check is extension installed, active and not
|
| 28 |
+
* disabled in the Advanced > Disable Output tab
|
| 29 |
+
* @param $name - extension name
|
| 30 |
+
* @return bool - results of check
|
| 31 |
+
*/
|
| 32 |
+
public function isExtensionInstalled($name)
|
| 33 |
+
{
|
| 34 |
+
$modules = (array)Mage::getConfig()->getNode('modules')->children();
|
| 35 |
+
return array_key_exists($name, $modules)
|
| 36 |
+
&& 'true' == (string)$modules[$name]->active
|
| 37 |
+
&& !(bool)Mage::getStoreConfig('advanced/modules_disable_output/' . $name);
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Check extension version
|
| 42 |
+
* @param $extensionName
|
| 43 |
+
* @param $extVersion
|
| 44 |
+
* @param string $operator
|
| 45 |
+
* @return bool
|
| 46 |
+
*/
|
| 47 |
+
public function checkExtensionVersion($extensionName, $extVersion, $operator = '>=')
|
| 48 |
+
{
|
| 49 |
+
if ($this->isExtensionInstalled($extensionName) && ($version = Mage::getConfig()->getModuleConfig($extensionName)->version)) {
|
| 50 |
+
return version_compare($version, $extVersion, $operator);
|
| 51 |
+
}
|
| 52 |
+
return false;
|
| 53 |
+
}
|
| 54 |
+
}
|
app/code/community/Extdev/All/Model/Source/Abstract.php
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* ExtDev
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the EULA
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://extdev.net/LICENSE.txt
|
| 12 |
+
*
|
| 13 |
+
* DISCLAIMER
|
| 14 |
+
*
|
| 15 |
+
* Do not edit or add to this file if you wish to upgrade this extension
|
| 16 |
+
* to newer versions in the future
|
| 17 |
+
*
|
| 18 |
+
* @category ExtDev
|
| 19 |
+
* @package Extdev_All
|
| 20 |
+
* @copyright 2012 ExtDev Co. (http://extdev.net)
|
| 21 |
+
* @license http://extdev.net/LICENSE.txt
|
| 22 |
+
*/
|
| 23 |
+
|
| 24 |
+
class Extdev_All_Model_Source_Abstract
|
| 25 |
+
{
|
| 26 |
+
protected $_extension = 'ednall';
|
| 27 |
+
|
| 28 |
+
public function toOptionArray()
|
| 29 |
+
{
|
| 30 |
+
return array();
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Returns array(value => ..., label => ...) for option with given value
|
| 35 |
+
* @param string $value
|
| 36 |
+
* @return array
|
| 37 |
+
*/
|
| 38 |
+
public function getOption($value)
|
| 39 |
+
{
|
| 40 |
+
$_options = $this->toOptionArray();
|
| 41 |
+
|
| 42 |
+
foreach ($_options as $_option)
|
| 43 |
+
if ($_option['value'] == $value)
|
| 44 |
+
return $_option;
|
| 45 |
+
|
| 46 |
+
return false;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Get label for option with given value
|
| 51 |
+
* @param string $value
|
| 52 |
+
* @return string
|
| 53 |
+
*/
|
| 54 |
+
public function getOptionLabel($value)
|
| 55 |
+
{
|
| 56 |
+
$_option = $this->getOption($value);
|
| 57 |
+
if (!$_option) return false;
|
| 58 |
+
return $_option['label'];
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* Returns associative array $value => $label
|
| 63 |
+
* @return array
|
| 64 |
+
*/
|
| 65 |
+
public function toShortOptionArray()
|
| 66 |
+
{
|
| 67 |
+
$_options = array();
|
| 68 |
+
foreach ($this->toOptionArray() as $option)
|
| 69 |
+
$_options[$option['value']] = $option['label'];
|
| 70 |
+
return $_options;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
protected function _getHelper($ext = '')
|
| 74 |
+
{
|
| 75 |
+
return Mage::helper($this->_extension . ($ext ? '/' . $ext : ''));
|
| 76 |
+
}
|
| 77 |
+
}
|
app/code/community/Extdev/All/etc/config.xml
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Extdev_All>
|
| 5 |
+
<version>1.0</version>
|
| 6 |
+
</Extdev_All>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<helpers>
|
| 10 |
+
<ednall>
|
| 11 |
+
<class>Extdev_All_Helper</class>
|
| 12 |
+
</ednall>
|
| 13 |
+
</helpers>
|
| 14 |
+
<blocks>
|
| 15 |
+
<ednall>
|
| 16 |
+
<class>Extdev_All_Block</class>
|
| 17 |
+
</ednall>
|
| 18 |
+
<adminhtml>
|
| 19 |
+
<rewrite>
|
| 20 |
+
<system_config_tabs>Extdev_All_Block_System_Config_Tabs</system_config_tabs>
|
| 21 |
+
</rewrite>
|
| 22 |
+
</adminhtml>
|
| 23 |
+
</blocks>
|
| 24 |
+
</global>
|
| 25 |
+
<adminhtml>
|
| 26 |
+
<translate>
|
| 27 |
+
<modules>
|
| 28 |
+
<Extdev_All>
|
| 29 |
+
<files>
|
| 30 |
+
<default>Extdev_All.csv</default>
|
| 31 |
+
</files>
|
| 32 |
+
</Extdev_All>
|
| 33 |
+
</modules>
|
| 34 |
+
</translate>
|
| 35 |
+
</adminhtml>
|
| 36 |
+
</config>
|
app/code/community/Extdev/All/etc/system.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<ednall translate="label" module="ednall">
|
| 5 |
+
<label>ExtDev Extensions</label>
|
| 6 |
+
<sort_order>250</sort_order>
|
| 7 |
+
</ednall>
|
| 8 |
+
</tabs>
|
| 9 |
+
</config>
|
app/code/community/Extdev/Easycalls/Block/Adminhtml/Widget/Grid/Column/Renderer/Eclink.php
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* ExtDev
|
| 5 |
+
*
|
| 6 |
+
* DISCLAIMER
|
| 7 |
+
*
|
| 8 |
+
* Do not edit or add to this file if you wish to upgrade this extension
|
| 9 |
+
* to newer versions in the future
|
| 10 |
+
*
|
| 11 |
+
* @category ExtDev
|
| 12 |
+
* @package Extdev_Easycalls
|
| 13 |
+
* @copyright 2012 ExtDev Co. (http://extdev.net)
|
| 14 |
+
* @license OSL v3.0
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
class Extdev_Easycalls_Block_Adminhtml_Widget_Grid_Column_Renderer_Eclink extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 18 |
+
{
|
| 19 |
+
/** @var $_order Mage_Sales_Model_Order */
|
| 20 |
+
protected $_order = null;
|
| 21 |
+
|
| 22 |
+
protected function _initOrder(Varien_Object $row)
|
| 23 |
+
{
|
| 24 |
+
if ($row instanceof Mage_Sales_Model_Order) {
|
| 25 |
+
$this->_order = $row;
|
| 26 |
+
}
|
| 27 |
+
return $this;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* @return Mage_Sales_Model_Order
|
| 32 |
+
*/
|
| 33 |
+
protected function _getOrder()
|
| 34 |
+
{
|
| 35 |
+
return $this->_order;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
protected function _getShippingPhone()
|
| 39 |
+
{
|
| 40 |
+
if ($this->_getOrder() && $this->_getOrder()->getShippingAddress()) {
|
| 41 |
+
return $this->_getOrder()->getShippingAddress()->getTelephone();
|
| 42 |
+
}
|
| 43 |
+
return false;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
protected function _getBillingPhone()
|
| 47 |
+
{
|
| 48 |
+
if ($this->_getOrder() && $this->_getOrder()->getBillingAddress()) {
|
| 49 |
+
return $this->_getOrder()->getBillingAddress()->getTelephone();
|
| 50 |
+
}
|
| 51 |
+
return false;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
public function _getValue(Varien_Object $row)
|
| 55 |
+
{
|
| 56 |
+
$hrefFormat = Mage::helper('edneasycalls/config')->getGeneralLinkTemplate();
|
| 57 |
+
$format = <<<AH
|
| 58 |
+
<a href="{$hrefFormat}">%s</a>
|
| 59 |
+
AH;
|
| 60 |
+
|
| 61 |
+
$phoneNumber = null;
|
| 62 |
+
$phoneSrcPriority = Mage::helper('edneasycalls/config')->getGeneralPhonesSourcePriority();
|
| 63 |
+
$this->_initOrder($row);
|
| 64 |
+
if ($phoneSrcPriority === Extdev_Easycalls_Model_Source_Config_Phonessrc::FIRST_BILLING) {
|
| 65 |
+
$phoneNumber = $this->_getBillingPhone();
|
| 66 |
+
} else {
|
| 67 |
+
$phoneNumber = $this->_getShippingPhone();
|
| 68 |
+
}
|
| 69 |
+
if ($phoneNumber === null) {
|
| 70 |
+
if ($phoneSrcPriority === Extdev_Easycalls_Model_Source_Config_Phonessrc::FIRST_BILLING) {
|
| 71 |
+
$phoneNumber = $this->_getShippingPhone();
|
| 72 |
+
} else {
|
| 73 |
+
$phoneNumber = $this->_getBillingPhone();
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
return $phoneNumber ? sprintf($format, $phoneNumber, $phoneNumber) : $this->__('N/A');
|
| 77 |
+
}
|
| 78 |
+
}
|
app/code/community/Extdev/Easycalls/Helper/Config.php
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* ExtDev
|
| 5 |
+
*
|
| 6 |
+
* DISCLAIMER
|
| 7 |
+
*
|
| 8 |
+
* Do not edit or add to this file if you wish to upgrade this extension
|
| 9 |
+
* to newer versions in the future
|
| 10 |
+
*
|
| 11 |
+
* @category ExtDev
|
| 12 |
+
* @package Extdev_Easycalls
|
| 13 |
+
* @copyright 2012 ExtDev Co. (http://extdev.net)
|
| 14 |
+
* @license OSL v3.0
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
class Extdev_Easycalls_Helper_Config extends Mage_Core_Helper_Abstract
|
| 18 |
+
{
|
| 19 |
+
const EXTENSION_KEY = 'edneasycalls';
|
| 20 |
+
|
| 21 |
+
const GENERAL_ENABLED = 'general/enabled';
|
| 22 |
+
const GENERAL_LINK_TEMPLATE = 'general/linktemplate';
|
| 23 |
+
const GENERAL_PHONES_SRC = 'general/phonesrcpriority';
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Returns module config value by a param.
|
| 27 |
+
* Example: Mage::helper('edneasycalls/config')->getConfig(Extdev_Easycalls_Helper_Config::GENERAL_ENABLED)
|
| 28 |
+
* @param $key
|
| 29 |
+
* @param null $store
|
| 30 |
+
* @return mixed
|
| 31 |
+
*/
|
| 32 |
+
public function getConfig($key, $store = null)
|
| 33 |
+
{
|
| 34 |
+
return Mage::getStoreConfig(self::EXTENSION_KEY . '/' . $key, $store);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* getGeneral_DisableNotifications - calls getConfig('general/disable_notifications')
|
| 39 |
+
* @param $name
|
| 40 |
+
* @param $arguments
|
| 41 |
+
* @return mixed
|
| 42 |
+
*/
|
| 43 |
+
public function __call($name, $arguments)
|
| 44 |
+
{
|
| 45 |
+
//TODO add stores support
|
| 46 |
+
if (strpos($name, 'get') === 0 && strpos($name, '_') !== false) {
|
| 47 |
+
$name = substr($name, 3);
|
| 48 |
+
list($fieldset, $option) = explode('_', $name);
|
| 49 |
+
$fieldset = strtolower($fieldset);
|
| 50 |
+
$option = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $option));
|
| 51 |
+
return $this->getConfig($fieldset . '/' . $option);
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
public function getGeneralEnabled($store = null)
|
| 56 |
+
{
|
| 57 |
+
return $this->getConfig(self::GENERAL_ENABLED, $store);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
public function getGeneralLinkTemplate($store = null)
|
| 61 |
+
{
|
| 62 |
+
return $this->getConfig(self::GENERAL_LINK_TEMPLATE, $store);
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
public function getGeneralPhonesSourcePriority($store = null)
|
| 66 |
+
{
|
| 67 |
+
return $this->getConfig(self::GENERAL_PHONES_SRC, $store);
|
| 68 |
+
}
|
| 69 |
+
}
|
app/code/community/Extdev/Easycalls/Helper/Data.php
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* ExtDev
|
| 5 |
+
*
|
| 6 |
+
* DISCLAIMER
|
| 7 |
+
*
|
| 8 |
+
* Do not edit or add to this file if you wish to upgrade this extension
|
| 9 |
+
* to newer versions in the future
|
| 10 |
+
*
|
| 11 |
+
* @category ExtDev
|
| 12 |
+
* @package Extdev_Easycalls
|
| 13 |
+
* @copyright 2012 ExtDev Co. (http://extdev.net)
|
| 14 |
+
* @license OSL v3.0
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
class Extdev_Easycalls_Helper_Data extends Mage_Core_Helper_Abstract
|
| 18 |
+
{
|
| 19 |
+
|
| 20 |
+
}
|
app/code/community/Extdev/Easycalls/Helper/Observer.php
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* ExtDev
|
| 5 |
+
*
|
| 6 |
+
* DISCLAIMER
|
| 7 |
+
*
|
| 8 |
+
* Do not edit or add to this file if you wish to upgrade this extension
|
| 9 |
+
* to newer versions in the future
|
| 10 |
+
*
|
| 11 |
+
* @category ExtDev
|
| 12 |
+
* @package Extdev_Easycalls
|
| 13 |
+
* @copyright 2012 ExtDev Co. (http://extdev.net)
|
| 14 |
+
* @license OSL v3.0
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
class Extdev_Easycalls_Helper_Observer extends Mage_Core_Helper_Abstract
|
| 18 |
+
{
|
| 19 |
+
/** @var $_configHelper Extdev_Easycalls_Helper_Config */
|
| 20 |
+
protected $_configHelper = null;
|
| 21 |
+
|
| 22 |
+
protected function _getConfigHelper()
|
| 23 |
+
{
|
| 24 |
+
if ($this->_configHelper === null) {
|
| 25 |
+
$this->_configHelper = Mage::helper('edneasycalls/config');
|
| 26 |
+
}
|
| 27 |
+
return $this->_configHelper;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
public function addColumnToOrdersGrid($observer)
|
| 31 |
+
{
|
| 32 |
+
if ($this->_getConfigHelper()->getGeneralEnabled()) {
|
| 33 |
+
$block = $observer->getBlock();
|
| 34 |
+
if ($block instanceof Mage_Adminhtml_Block_Sales_Order_Grid) {
|
| 35 |
+
/** @var $block Mage_Adminhtml_Block_Sales_Order_Grid */
|
| 36 |
+
$block->addColumn('phone', array(
|
| 37 |
+
'header' => $this->__('Phone'),
|
| 38 |
+
'index' => 'increment_id',
|
| 39 |
+
'type' => 'options',
|
| 40 |
+
'width' => '150px',
|
| 41 |
+
'renderer' => 'Extdev_Easycalls_Block_Adminhtml_Widget_Grid_Column_Renderer_Eclink'
|
| 42 |
+
));
|
| 43 |
+
|
| 44 |
+
/** Moving Phone column after status column */
|
| 45 |
+
$block->addColumnsOrder('phone', 'status');
|
| 46 |
+
$block->sortColumnsByOrder();
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
}
|
app/code/community/Extdev/Easycalls/Model/Source/Abstract.php
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* ExtDev
|
| 5 |
+
*
|
| 6 |
+
* DISCLAIMER
|
| 7 |
+
*
|
| 8 |
+
* Do not edit or add to this file if you wish to upgrade this extension
|
| 9 |
+
* to newer versions in the future
|
| 10 |
+
*
|
| 11 |
+
* @category ExtDev
|
| 12 |
+
* @package Extdev_Easycalls
|
| 13 |
+
* @copyright 2012 ExtDev Co. (http://extdev.net)
|
| 14 |
+
* @license OSL v3.0
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
class Extdev_Easycalls_Model_Source_Abstract extends Extdev_All_Model_Source_Abstract
|
| 18 |
+
{
|
| 19 |
+
protected $_extension = 'edneasycalls';
|
| 20 |
+
}
|
app/code/community/Extdev/Easycalls/Model/Source/Config/Phonessrc.php
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* ExtDev
|
| 5 |
+
*
|
| 6 |
+
* DISCLAIMER
|
| 7 |
+
*
|
| 8 |
+
* Do not edit or add to this file if you wish to upgrade this extension
|
| 9 |
+
* to newer versions in the future
|
| 10 |
+
*
|
| 11 |
+
* @category ExtDev
|
| 12 |
+
* @package Extdev_Easycalls
|
| 13 |
+
* @copyright 2012 ExtDev Co. (http://extdev.net)
|
| 14 |
+
* @license OSL v3.0
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
class Extdev_Easycalls_Model_Source_Config_Phonessrc extends Extdev_Easycalls_Model_Source_Abstract
|
| 18 |
+
{
|
| 19 |
+
const FIRST_SHIPPING = '1';
|
| 20 |
+
const FIRST_BILLING = '2';
|
| 21 |
+
|
| 22 |
+
const FIRST_SHIPPING_LABEL = 'First from shipping and then from billing';
|
| 23 |
+
const FIRST_BILLING_LABEL = 'First from billing and then from shipping';
|
| 24 |
+
|
| 25 |
+
public function toOptionArray()
|
| 26 |
+
{
|
| 27 |
+
return array(
|
| 28 |
+
array('value' => self::FIRST_SHIPPING, 'label' => self::FIRST_SHIPPING_LABEL),
|
| 29 |
+
array('value' => self::FIRST_BILLING, 'label' => self::FIRST_BILLING_LABEL)
|
| 30 |
+
);
|
| 31 |
+
}
|
| 32 |
+
}
|
app/code/community/Extdev/Easycalls/etc/config.xml
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Extdev_Easycalls>
|
| 5 |
+
<version>1.0</version>
|
| 6 |
+
</Extdev_Easycalls>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<blocks>
|
| 10 |
+
<edneasycalls>
|
| 11 |
+
<class>Extdev_Easycalls_Block</class>
|
| 12 |
+
</edneasycalls>
|
| 13 |
+
</blocks>
|
| 14 |
+
<helpers>
|
| 15 |
+
<edneasycalls>
|
| 16 |
+
<class>Extdev_Easycalls_Helper</class>
|
| 17 |
+
</edneasycalls>
|
| 18 |
+
</helpers>
|
| 19 |
+
<models>
|
| 20 |
+
<edneasycalls>
|
| 21 |
+
<class>Extdev_Easycalls_Model</class>
|
| 22 |
+
</edneasycalls>
|
| 23 |
+
</models>
|
| 24 |
+
</global>
|
| 25 |
+
<adminhtml>
|
| 26 |
+
<translate>
|
| 27 |
+
<modules>
|
| 28 |
+
<Extdev_Easycalls>
|
| 29 |
+
<files>
|
| 30 |
+
<default>Extdev_Easycalls.csv</default>
|
| 31 |
+
</files>
|
| 32 |
+
</Extdev_Easycalls>
|
| 33 |
+
</modules>
|
| 34 |
+
</translate>
|
| 35 |
+
<events>
|
| 36 |
+
<adminhtml_block_html_before>
|
| 37 |
+
<observers>
|
| 38 |
+
<edneasycalls>
|
| 39 |
+
<class>Extdev_Easycalls_Helper_Observer</class>
|
| 40 |
+
<method>addColumnToOrdersGrid</method>
|
| 41 |
+
</edneasycalls>
|
| 42 |
+
</observers>
|
| 43 |
+
</adminhtml_block_html_before>
|
| 44 |
+
</events>
|
| 45 |
+
<acl>
|
| 46 |
+
<resources>
|
| 47 |
+
<all>
|
| 48 |
+
<title>Allow Everything</title>
|
| 49 |
+
</all>
|
| 50 |
+
<admin>
|
| 51 |
+
<children>
|
| 52 |
+
<system>
|
| 53 |
+
<children>
|
| 54 |
+
<config>
|
| 55 |
+
<children>
|
| 56 |
+
<edneasycalls>
|
| 57 |
+
<title><![CDATA[ExtDev – Easy Calls]]></title>
|
| 58 |
+
</edneasycalls>
|
| 59 |
+
</children>
|
| 60 |
+
</config>
|
| 61 |
+
</children>
|
| 62 |
+
</system>
|
| 63 |
+
</children>
|
| 64 |
+
</admin>
|
| 65 |
+
</resources>
|
| 66 |
+
</acl>
|
| 67 |
+
</adminhtml>
|
| 68 |
+
<default>
|
| 69 |
+
<edneasycalls>
|
| 70 |
+
<general>
|
| 71 |
+
<enabled>0</enabled>
|
| 72 |
+
<linktemplate><![CDATA[callto://%s]]></linktemplate>
|
| 73 |
+
<phonesrcpriority>1</phonesrcpriority>
|
| 74 |
+
</general>
|
| 75 |
+
</edneasycalls>
|
| 76 |
+
</default>
|
| 77 |
+
</config>
|
app/code/community/Extdev/Easycalls/etc/system.xml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<sections>
|
| 4 |
+
<edneasycalls translate="label" module="edneasycalls">
|
| 5 |
+
<label>Easy Calls</label>
|
| 6 |
+
<tab>ednall</tab>
|
| 7 |
+
<frontend_type>text</frontend_type>
|
| 8 |
+
<sort_order>2012</sort_order>
|
| 9 |
+
<show_in_default>1</show_in_default>
|
| 10 |
+
<show_in_website>1</show_in_website>
|
| 11 |
+
<show_in_store>1</show_in_store>
|
| 12 |
+
<groups>
|
| 13 |
+
<general translate="label">
|
| 14 |
+
<label>General Settings</label>
|
| 15 |
+
<frontend_type>text</frontend_type>
|
| 16 |
+
<sort_order>10</sort_order>
|
| 17 |
+
<show_in_default>1</show_in_default>
|
| 18 |
+
<show_in_website>1</show_in_website>
|
| 19 |
+
<show_in_store>1</show_in_store>
|
| 20 |
+
<fields>
|
| 21 |
+
<enabled>
|
| 22 |
+
<label>Enabled</label>
|
| 23 |
+
<frontend_type>select</frontend_type>
|
| 24 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 25 |
+
<sort_order>10</sort_order>
|
| 26 |
+
<show_in_default>1</show_in_default>
|
| 27 |
+
<show_in_website>1</show_in_website>
|
| 28 |
+
<show_in_store>1</show_in_store>
|
| 29 |
+
</enabled>
|
| 30 |
+
<linktemplate>
|
| 31 |
+
<label>Link Template</label>
|
| 32 |
+
<frontend_type>text</frontend_type>
|
| 33 |
+
<sort_order>20</sort_order>
|
| 34 |
+
<comment>%s will be replaced with customer number</comment>
|
| 35 |
+
<validate>required-entry</validate>
|
| 36 |
+
<show_in_default>1</show_in_default>
|
| 37 |
+
<show_in_website>1</show_in_website>
|
| 38 |
+
<show_in_store>1</show_in_store>
|
| 39 |
+
</linktemplate>
|
| 40 |
+
<phonesrcpriority>
|
| 41 |
+
<label>Phone Address Priority</label>
|
| 42 |
+
<frontend_type>select</frontend_type>
|
| 43 |
+
<source_model>edneasycalls/source_config_phonessrc</source_model>
|
| 44 |
+
<sort_order>30</sort_order>
|
| 45 |
+
<show_in_default>1</show_in_default>
|
| 46 |
+
<show_in_website>1</show_in_website>
|
| 47 |
+
<show_in_store>1</show_in_store>
|
| 48 |
+
</phonesrcpriority>
|
| 49 |
+
</fields>
|
| 50 |
+
</general>
|
| 51 |
+
</groups>
|
| 52 |
+
</edneasycalls>
|
| 53 |
+
</sections>
|
| 54 |
+
</config>
|
app/etc/modules/Extdev_All.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Extdev_All>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Extdev_All>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
app/etc/modules/Extdev_Easycalls.xml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Extdev_Easycalls>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
<depends>
|
| 8 |
+
<Extdev_All/>
|
| 9 |
+
</depends>
|
| 10 |
+
</Extdev_Easycalls>
|
| 11 |
+
</modules>
|
| 12 |
+
</config>
|
app/locale/en_US/Extdev_All.csv
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
"ExtDev Extensions","ExtDev Extensions"
|
app/locale/en_US/Extdev_Easycalls.csv
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"%s will be replaced with customer number","%s will be replaced with customer number"
|
| 2 |
+
"Easy Calls","Easy Calls"
|
| 3 |
+
"Enabled","Enabled"
|
| 4 |
+
"General Settings","General Settings"
|
| 5 |
+
"Link Template","Link Template"
|
| 6 |
+
"N/A","N/A"
|
| 7 |
+
"Phone","Phone"
|
| 8 |
+
"Phone Address Priority","Phone Address Priority"
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>ED_EC</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>OSL v3.0</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Provides easy way to be connected with your customers via Skype</summary>
|
| 10 |
+
<description>Just activate the module after installation and you will be able to make calls to your customers in a couple of clicks.</description>
|
| 11 |
+
<notes>First release of the extension</notes>
|
| 12 |
+
<authors><author><name>ExtDev Company</name><user>extdev</user><email>extdev.net@gmail.com</email></author></authors>
|
| 13 |
+
<date>2012-07-29</date>
|
| 14 |
+
<time>13:58:40</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Extdev"><dir name="All"><dir name="Block"><dir name="System"><dir name="Config"><file name="Tabs.php" hash="35f9637fa67983a490cffac5d3b89d5f"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="8027bee2112de91c1097a35f90431011"/></dir><dir name="Model"><dir name="Source"><file name="Abstract.php" hash="5ff8ff99dbe936bec3817e7348f37f15"/></dir></dir><dir name="etc"><file name="config.xml" hash="6fba388f60494a50fde7cf3fab2ee6b5"/><file name="system.xml" hash="3bad7636cf2a74de5c6ab64389d27d93"/></dir></dir><dir name="Easycalls"><dir name="Block"><dir name="Adminhtml"><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Eclink.php" hash="3cf09b20d49de434150406bfd324a33f"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Config.php" hash="4088ae08e5bf55e6ad916ab552bdfc86"/><file name="Data.php" hash="436f8aede17bba96c05b70cc63ad79ca"/><file name="Observer.php" hash="1dec2b3fbddc8689d375b74d4711dc85"/></dir><dir name="Model"><dir name="Source"><file name="Abstract.php" hash="61c2c61e39f2421f24e06fc613d4d511"/><dir name="Config"><file name="Phonessrc.php" hash="edea5eb9f0ae6e871661a550bde24028"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="15e694374faa99b4650f6305a95f9607"/><file name="system.xml" hash="0f89a37f07b75156f9aa22a29a45a1d0"/></dir></dir></dir></target><target name="mageweb"><dir name="app"><dir name="etc"><dir name="modules"><file name="Extdev_Easycalls.xml" hash="1a16cf046dcbb92a4a0b6e0fdf8f07f5"/><file name="Extdev_All.xml" hash="f259561877e53aa1d05e7302fd3f8723"/></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Extdev_Easycalls.csv" hash="53197242f3ff97abbe892eb82fa84ca7"/><file name="Extdev_All.csv" hash="5471df37e46adaf9360ee762c8000baa"/></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
+
</package>
|
