Amasty_ZeroSellersReport - Version 1.0.0

Version Notes

Initial

Download this release

Release Info

Developer Amasty Team
Extension Amasty_ZeroSellersReport
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (54) hide show
  1. app/code/local/Amasty/Base/Block/Adminhtml/Debug/Base.php +12 -0
  2. app/code/local/Amasty/Base/Block/Adminhtml/Debug/Conflict.php +73 -0
  3. app/code/local/Amasty/Base/Block/Adminhtml/Debug/Event.php +19 -0
  4. app/code/local/Amasty/Base/Block/Adminhtml/Debug/General.php +62 -0
  5. app/code/local/Amasty/Base/Block/Adminhtml/Debug/Rewrite.php +19 -0
  6. app/code/local/Amasty/Base/Block/Adminhtml/Promo.php +62 -0
  7. app/code/local/Amasty/Base/Block/Adminhtml/Update.php +62 -0
  8. app/code/local/Amasty/Base/Block/Conflicts.php +34 -0
  9. app/code/local/Amasty/Base/Block/Extensions.php +118 -0
  10. app/code/local/Amasty/Base/Block/Store.php +27 -0
  11. app/code/local/Amasty/Base/Helper/Data.php +169 -0
  12. app/code/local/Amasty/Base/Helper/Module.php +216 -0
  13. app/code/local/Amasty/Base/Helper/Promo.php +27 -0
  14. app/code/local/Amasty/Base/Model/Conflict.php +201 -0
  15. app/code/local/Amasty/Base/Model/Feed.php +115 -0
  16. app/code/local/Amasty/Base/Model/Resource/Event/Collection.php +26 -0
  17. app/code/local/Amasty/Base/controllers/Adminhtml/Ambase/BaseController.php +106 -0
  18. app/code/local/Amasty/Base/etc/adminhtml.xml +55 -0
  19. app/code/local/Amasty/Base/etc/config.xml +135 -0
  20. app/code/local/Amasty/Base/etc/system.xml +121 -0
  21. app/code/local/Amasty/Base/sql/ambase_setup/mysql4-install-1.0.0.php +9 -0
  22. app/code/local/Amasty/Base/sql/ambase_setup/mysql4-upgrade-1.0.0-1.0.1.php +24 -0
  23. app/code/local/Amasty/ZeroSellers/Block/Adminhtml/Purchased.php +18 -0
  24. app/code/local/Amasty/ZeroSellers/Block/Adminhtml/Purchased/Grid.php +237 -0
  25. app/code/local/Amasty/ZeroSellers/Block/Adminhtml/Purchased/Renderer/Website.php +25 -0
  26. app/code/local/Amasty/ZeroSellers/Helper/Data.php +11 -0
  27. app/code/local/Amasty/ZeroSellers/Model/Command/Abstract.php +110 -0
  28. app/code/local/Amasty/ZeroSellers/Model/Command/Addspecial.php +31 -0
  29. app/code/local/Amasty/ZeroSellers/Model/Command/Disable.php +32 -0
  30. app/code/local/Amasty/ZeroSellers/Model/Command/Modifyprice.php +154 -0
  31. app/code/local/Amasty/ZeroSellers/Model/Command/Modifyspecial.php +19 -0
  32. app/code/local/Amasty/ZeroSellers/Model/Resource/Catalog/Product/Collection.php +109 -0
  33. app/code/local/Amasty/ZeroSellers/controllers/Adminhtml/AmzerosellersController.php +96 -0
  34. app/code/local/Amasty/ZeroSellers/etc/adminhtml.xml +73 -0
  35. app/code/local/Amasty/ZeroSellers/etc/config.xml +57 -0
  36. app/code/local/Amasty/ZeroSellers/etc/system.xml +54 -0
  37. app/design/adminhtml/default/default/layout/amasty/ambase/ambase.xml +39 -0
  38. app/design/adminhtml/default/default/template/amasty/ambase/debug/conflict.phtml +118 -0
  39. app/design/adminhtml/default/default/template/amasty/ambase/debug/event.phtml +28 -0
  40. app/design/adminhtml/default/default/template/amasty/ambase/debug/general.phtml +70 -0
  41. app/design/adminhtml/default/default/template/amasty/ambase/debug/rewrite.phtml +62 -0
  42. app/design/adminhtml/default/default/template/amasty/ambase/promo.phtml +36 -0
  43. app/design/adminhtml/default/default/template/amasty/ambase/update.phtml +41 -0
  44. app/etc/modules/Amasty_Base.xml +17 -0
  45. app/etc/modules/Amasty_ZeroSellers.xml +20 -0
  46. app/locale/en_US/Amasty_Base.csv +40 -0
  47. js/amasty/ambase/store.js +7 -0
  48. package.xml +18 -0
  49. skin/adminhtml/default/default/css/amasty/ambase/style.css +76 -0
  50. skin/adminhtml/default/default/images/ambase/amasty.png +0 -0
  51. skin/adminhtml/default/default/images/ambase/bad.gif +0 -0
  52. skin/adminhtml/default/default/images/ambase/ok.gif +0 -0
  53. skin/adminhtml/default/default/images/ambase/shop.png +0 -0
  54. skin/adminhtml/default/default/images/ambase/update.gif +0 -0
app/code/local/Amasty/Base/Block/Adminhtml/Debug/Base.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Block_Adminhtml_Debug_Base extends Mage_Adminhtml_Block_Widget_Form
8
+ {
9
+ function getClassPath($rewrites, $codePool, $rewriteIndex){
10
+ return Amasty_Base_Model_Conflict::getClassPath($codePool[$rewriteIndex], $rewrites[$rewriteIndex]);
11
+ }
12
+ }
app/code/local/Amasty/Base/Block/Adminhtml/Debug/Conflict.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Block_Adminhtml_Debug_Conflict extends Amasty_Base_Block_Adminhtml_Debug_Base
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setTemplate('amasty/ambase/debug/conflict.phtml');
13
+ }
14
+
15
+ function getPossibleConflictsList(){
16
+ return Mage::helper("ambase")->getPossibleConflictsList();
17
+ }
18
+
19
+ function getFixUrl($object, $module, $rewrite){
20
+ return Mage::helper("adminhtml")->getUrl("adminhtml/ambase_base/fix", array(
21
+ "object" => $object,
22
+ "module" => $module,
23
+ "rewrite" => $rewrite
24
+ ));
25
+ }
26
+
27
+ function getRollbackUrl($object, $module, $rewrite){
28
+ return Mage::helper("adminhtml")->getUrl("adminhtml/ambase_base/rollback", array(
29
+ "object" => $object,
30
+ "module" => $module,
31
+ "rewrite" => $rewrite
32
+ ));
33
+ }
34
+
35
+ function hasConflict($rewrites){
36
+ $ret = FALSE;
37
+ foreach($rewrites as $rewrite){
38
+ if (strpos($rewrite, "Amasty") === FALSE){
39
+ $ret = TRUE;
40
+ break;
41
+ }
42
+ }
43
+ return $ret;
44
+ }
45
+
46
+ function conflictResolved($codePool, $rewrites){
47
+ $ret = FALSE;
48
+ krsort($rewrites);
49
+
50
+ $extendsClasses = $rewrites;
51
+
52
+ foreach($rewrites as $rewriteIndex => $class){
53
+ unset($extendsClasses[$rewriteIndex]);
54
+
55
+ if (count($extendsClasses) > 0){
56
+ $classPath = $this->getClassPath($rewrites, $codePool, $rewriteIndex);
57
+ $pureClassName = Amasty_Base_Model_Conflict::getPureClassName($class);
58
+
59
+ $lines = file($classPath);
60
+ foreach($lines as $line)
61
+ {
62
+ if(strpos($line, $pureClassName) !== FALSE){
63
+ $ret = TRUE;
64
+ break;
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ return $ret;
71
+ }
72
+ }
73
+ ?>
app/code/local/Amasty/Base/Block/Adminhtml/Debug/Event.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Block_Adminhtml_Debug_Event extends Mage_Adminhtml_Block_Widget_Form
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setTemplate('amasty/ambase/debug/event.phtml');
13
+ }
14
+
15
+ function getEventsList()
16
+ {
17
+ return Mage::helper('ambase')->getEventsList();
18
+ }
19
+ }
app/code/local/Amasty/Base/Block/Adminhtml/Debug/General.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Block_Adminhtml_Debug_General extends Amasty_Base_Block_Adminhtml_Debug_Base
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setTemplate('amasty/ambase/debug/general.phtml');
13
+ }
14
+
15
+ function getDisableModulesOutput() {
16
+ $config = array();
17
+
18
+ $resource = Mage::getSingleton('core/resource');
19
+ $readConnection = $resource->getConnection('core_read');
20
+
21
+ $tableName = $resource->getTableName('core/config_data');
22
+
23
+ $query = "SELECT * FROM " . $tableName . " WHERE path LIKE '%advanced/modules_disable_output%' AND value = 1";
24
+
25
+ $data = $readConnection->fetchAll($query);
26
+
27
+ foreach($data as $item){
28
+ $config[] = array(
29
+ "name" => str_replace("advanced/modules_disable_output/", "", $item["path"])
30
+ );
31
+ }
32
+
33
+ return $config;
34
+ }
35
+
36
+ function isCompilationEnabled() {
37
+ $ret = FALSE;
38
+
39
+ $configFile = BP . DS . 'includes' . DS . 'config.php';
40
+ if (file_exists($configFile)){
41
+ $config = file_get_contents($configFile);
42
+ $ret = strpos($config, "#define('COMPILER_INCLUDE_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src')") === FALSE;
43
+ }
44
+
45
+ return $ret;
46
+ }
47
+
48
+ function getCrontabConfig() {
49
+
50
+ $resource = Mage::getSingleton('core/resource');
51
+ $readConnection = $resource->getConnection('core_read');
52
+
53
+ $tableName = $resource->getTableName('cron/schedule');
54
+
55
+ $query = "SELECT * FROM " . $tableName . " order by schedule_id desc limit 5";
56
+
57
+ $data = $readConnection->fetchAll($query);
58
+
59
+ return $data;
60
+ }
61
+
62
+ }
app/code/local/Amasty/Base/Block/Adminhtml/Debug/Rewrite.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Block_Adminhtml_Debug_Rewrite extends Amasty_Base_Block_Adminhtml_Debug_Base
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setTemplate('amasty/ambase/debug/rewrite.phtml');
13
+ }
14
+
15
+ function getRewritesList(){
16
+ return Mage::helper("ambase")->getRewritesList();
17
+ }
18
+ }
19
+ ?>
app/code/local/Amasty/Base/Block/Adminhtml/Promo.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Block_Adminhtml_Promo extends Mage_Adminhtml_Block_Widget_Form
8
+ {
9
+ protected $_promoHelper;
10
+
11
+ protected function _getPromoHelper()
12
+ {
13
+ if (!$this->_promoHelper)
14
+ {
15
+ $this->_promoHelper = Mage::helper("ambase/promo");
16
+ }
17
+
18
+ return $this->_promoHelper;
19
+ }
20
+
21
+ function getLatestNotification()
22
+ {
23
+ $ret = null;
24
+
25
+ $mageNotifications = !Mage::getStoreConfig('advanced/modules_disable_output/Mage_AdminNotification');
26
+
27
+ $collection = $this->_getPromoHelper()->getNotificationsCollection();
28
+
29
+ $collection->getSelect()
30
+
31
+ ->order('notification_id DESC')
32
+ ->limit(1);
33
+
34
+ if ($this->isSubscribed() && !$mageNotifications)
35
+ {
36
+ $items = array_values($collection->getItems());
37
+
38
+ $ret = count($items) > 0 ? $items[0] : null;
39
+ }
40
+
41
+ return $ret;
42
+ }
43
+
44
+ function getCloseUrl()
45
+ {
46
+ return Mage::helper("adminhtml")->getUrl("adminhtml/ambase_base/closePromo", array(
47
+ ));
48
+ }
49
+
50
+ function getUnsubscribeUrl()
51
+ {
52
+ return Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/ambase", array(
53
+
54
+ ));
55
+ }
56
+
57
+ function isSubscribed()
58
+ {
59
+ return $this->_getPromoHelper()->isSubscribed();
60
+ }
61
+
62
+ }
app/code/local/Amasty/Base/Block/Adminhtml/Update.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Block_Adminhtml_Update extends Mage_Adminhtml_Block_Widget_Form
8
+ {
9
+ protected $_moduleHelper;
10
+
11
+ protected function _getModuleHelper()
12
+ {
13
+ if (!$this->_moduleHelper)
14
+ {
15
+ $controllerModule = Mage::app()->getRequest()->getControllerModule();
16
+ $this->_moduleHelper = Mage::helper("ambase/module")->init($controllerModule);
17
+ }
18
+
19
+ return $this->_moduleHelper;
20
+ }
21
+
22
+ function isNewVersionAvailable()
23
+ {
24
+ return $this->isSubscribed() && $this->_getModuleHelper()->isNewVersionAvailable();
25
+ }
26
+
27
+ function getModuleTitle()
28
+ {
29
+ return $this->_getModuleHelper()->getModuleTitle();
30
+ }
31
+
32
+ function getModuleLink()
33
+ {
34
+ return $this->_getModuleHelper()->getModuleLink();
35
+ }
36
+
37
+ function getModuleCode()
38
+ {
39
+ return $this->_getModuleHelper()->getModuleCode();
40
+ }
41
+
42
+ function getLatestVersion()
43
+ {
44
+ return $this->_getModuleHelper()->getLatestVersion();
45
+ }
46
+
47
+ function getCloseUrl(){
48
+ return Mage::helper("adminhtml")->getUrl("adminhtml/ambase_base/closeUpdate", array(
49
+ 'code' => $this->getModuleCode()
50
+ ));
51
+ }
52
+
53
+ function getUnsubscribeUrl(){
54
+ return Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/ambase", array(
55
+
56
+ ));
57
+ }
58
+
59
+ function isSubscribed(){
60
+ return $this->_getModuleHelper()->isSubscribed();
61
+ }
62
+ }
app/code/local/Amasty/Base/Block/Conflicts.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Block_Conflicts extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
8
+ {
9
+ public function render(Varien_Data_Form_Element_Abstract $element)
10
+ {
11
+ $autoload = Mage::app()->getRequest()->getParam('autoload');
12
+
13
+ $helper = Mage::helper("ambase");
14
+ $html = $this->_getHeaderHtml($element);
15
+
16
+ $ajaxUrl = Mage::helper("adminhtml")->getUrl("adminhtml/ambase_base/ajax");
17
+ $html.= '<div id="ambase_conflicts_container"></div>';
18
+ $html.= '<button id="ambase_conflicts_show" type="button" class="scalable" onclick="ambaseShow(\''.$ajaxUrl.'\')" style=""><span><span><span>'.$helper->__("Show").'</span></span></span></button>&nbsp;&nbsp;&nbsp;';
19
+
20
+ if ($autoload){
21
+ $html .= "<script>
22
+ Event.observe(window, 'load', function(){
23
+ $('ambase_conflicts-head').click();
24
+ $('ambase_conflicts_show').click();
25
+ });
26
+ </script>";
27
+ }
28
+
29
+ // $html .= Mage::getUrl('adminhtml/ambase/download');
30
+ // $html.= Amasty_Base_Model_Conflicts::run();
31
+ $html .= $this->_getFooterHtml($element);
32
+ return $html;
33
+ }
34
+ }
app/code/local/Amasty/Base/Block/Extensions.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Block_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
8
+ {
9
+ protected $_dummyElement;
10
+ protected $_fieldRenderer;
11
+ protected $_values;
12
+
13
+ public function render(Varien_Data_Form_Element_Abstract $element)
14
+ {
15
+ $html = $this->_getHeaderHtml($element);
16
+ $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
17
+ sort($modules);
18
+
19
+ foreach ($modules as $moduleName) {
20
+ if (strstr($moduleName, 'Amasty_') === false) {
21
+ if(strstr($moduleName, 'Belitsoft_') === false){
22
+ if(strstr($moduleName, 'Mageplace_') === false){
23
+ if(strstr($moduleName, 'Magpleasure_') === false) {
24
+ continue;
25
+ }
26
+ }
27
+ }
28
+ }
29
+
30
+ if (in_array($moduleName, array(
31
+ 'Amasty_Base', 'Magpleasure_Common', 'Magpleasure_Searchcore'
32
+ ))) {
33
+ continue;
34
+ }
35
+
36
+ if ((string)Mage::getConfig()->getModuleConfig($moduleName)->is_system == 'true')
37
+ continue;
38
+
39
+ $html.= $this->_getFieldHtml($element, $moduleName);
40
+ }
41
+ $html .= $this->_getFooterHtml($element);
42
+
43
+ return $html;
44
+ }
45
+
46
+ protected function _getFieldRenderer()
47
+ {
48
+ if (empty($this->_fieldRenderer)) {
49
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
50
+ }
51
+ return $this->_fieldRenderer;
52
+ }
53
+
54
+ protected function _getFieldHtml($fieldset, $moduleCode)
55
+ {
56
+ $currentVer = Mage::getConfig()->getModuleConfig($moduleCode)->version;
57
+ if (!$currentVer)
58
+ return '';
59
+
60
+ // in case we have no data in the RSS
61
+ $moduleName = (string)Mage::getConfig()->getNode('modules/' . $moduleCode . '/name');
62
+ if ($moduleName) {
63
+ $name = $moduleName;
64
+ $url = (string)Mage::getConfig()->getNode('modules/' . $moduleCode . '/url');
65
+ $moduleName = '<a href="' . $url . '" target="_blank" title="' . $name . '">' . $name . "</a>";
66
+ } else {
67
+ $moduleName = substr($moduleCode, strpos($moduleCode, '_') + 1);
68
+ }
69
+
70
+ $baseKey = (string)Mage::getConfig()->getNode('modules/' . $moduleCode . '/baseKey');
71
+
72
+ $allExtensions = Amasty_Base_Helper_Module::getAllExtensions();
73
+
74
+ $status = '<a target="_blank"><img src="'.$this->getSkinUrl('images/ambase/ok.gif').'" title="'.$this->__("Installed").'"/></a>';
75
+
76
+ if ($allExtensions && isset($allExtensions[$moduleCode])){
77
+
78
+ $ext = array();
79
+
80
+ if (is_array($allExtensions[$moduleCode]) && !array_key_exists('name', $allExtensions[$moduleCode])){
81
+
82
+ if (!empty($baseKey) && isset($allExtensions[$moduleCode][$baseKey])){
83
+ $ext = $allExtensions[$moduleCode][$baseKey];
84
+
85
+ } else {
86
+ $ext = end($allExtensions[$moduleCode]);
87
+ }
88
+ } else {
89
+ $ext = $allExtensions[$moduleCode];
90
+ }
91
+
92
+ $url = $ext['url'];
93
+ $name = $ext['name'];
94
+ $lastVer = $ext['version'];
95
+
96
+ $moduleName = '<a href="'.$url.'" target="_blank" title="'.$name.'">'.$name."</a>";
97
+
98
+ if (version_compare($currentVer, $lastVer, '<')) {
99
+ $status = '<a href="'.$url.'" target="_blank"><img src="'.$this->getSkinUrl('images/ambase/update.gif').'" alt="'.$this->__("Update available").'" title="'.$this->__("Update available").'"/></a>';
100
+ }
101
+ }
102
+
103
+ // in case if module output disabled
104
+ if (Mage::getStoreConfig('advanced/modules_disable_output/' . $moduleCode)) {
105
+ $status = '<a target="_blank"><img src="' . $this->getSkinUrl('images/ambase/bad.gif') . '" alt="' . $this->__('Output disabled') . '" title="' . $this->__('Output disabled') . '"/></a>';
106
+ }
107
+
108
+ $moduleName = $status . ' ' . $moduleName;
109
+
110
+ $field = $fieldset->addField($moduleCode, 'label', array(
111
+ 'name' => 'dummy',
112
+ 'label' => $moduleName,
113
+ 'value' => $currentVer,
114
+ ))->setRenderer($this->_getFieldRenderer());
115
+
116
+ return $field->toHtml();
117
+ }
118
+ }
app/code/local/Amasty/Base/Block/Store.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Block_Store extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
8
+ {
9
+ protected $_dummyElement;
10
+ protected $_fieldRenderer;
11
+ protected $_values;
12
+
13
+ public function render(Varien_Data_Form_Element_Abstract $element)
14
+ {
15
+ $html = "<iframe id='amasty_store' src='//amasty.com/store/'></iframe>";
16
+
17
+ return $html;
18
+ }
19
+
20
+ protected function _getFieldRenderer()
21
+ {
22
+ if (empty($this->_fieldRenderer)) {
23
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
24
+ }
25
+ return $this->_fieldRenderer;
26
+ }
27
+ }
app/code/local/Amasty/Base/Helper/Data.php ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Helper_Data extends Mage_Core_Helper_Abstract
8
+ {
9
+ public function isVersionLessThan($major=1, $minor=4)
10
+ {
11
+ $curr = explode('.', Mage::getVersion()); // 1.3. compatibility
12
+ $need = func_get_args();
13
+ foreach ($need as $k => $v){
14
+ if ($curr[$k] != $v)
15
+ return ($curr[$k] < $v);
16
+ }
17
+ return false;
18
+ }
19
+
20
+ public function isModuleActive($code)
21
+ {
22
+ return ('true' == (string)Mage::getConfig()->getNode('modules/'.$code.'/active'));
23
+ }
24
+
25
+ function getRewritesList(){
26
+ $moduleFiles = glob(Mage::getBaseDir('etc') . DS . 'modules' . DS . '*.xml');
27
+
28
+ if (!$moduleFiles) {
29
+ return false;
30
+ }
31
+
32
+ // load file contents
33
+ $unsortedConfig = new Varien_Simplexml_Config();
34
+ $unsortedConfig->loadString('<config/>');
35
+ $fileConfig = new Varien_Simplexml_Config();
36
+
37
+ foreach($moduleFiles as $filePath) {
38
+ $fileConfig->loadFile($filePath);
39
+ $unsortedConfig->extend($fileConfig);
40
+ }
41
+
42
+ // create sorted config [only active modules]
43
+ $sortedConfig = new Varien_Simplexml_Config();
44
+ $sortedConfig->loadString('<config><modules/></config>');
45
+
46
+ foreach ($unsortedConfig->getNode('modules')->children() as $moduleName => $moduleNode) {
47
+ if('true' === (string)$moduleNode->active) {
48
+ $sortedConfig->getNode('modules')->appendChild($moduleNode);
49
+ }
50
+ }
51
+
52
+ $fileConfig = new Varien_Simplexml_Config();
53
+
54
+ $_finalResult = array();
55
+
56
+ foreach($sortedConfig->getNode('modules')->children() as $moduleName => $moduleNode) {
57
+ $codePool = (string)$moduleNode->codePool;
58
+ $configPath = BP . DS . 'app' . DS . 'code' . DS . $codePool . DS . uc_words($moduleName, DS) . DS . 'etc' . DS . 'config.xml';
59
+
60
+ $fileConfig->loadFile($configPath);
61
+
62
+ $rewriteBlocks = array('blocks', 'models', 'helpers');
63
+
64
+ foreach($rewriteBlocks as $param) {
65
+ if(!isset($_finalResult[$param])) {
66
+ $_finalResult[$param] = array();
67
+ }
68
+
69
+ if($rewrites = $fileConfig->getXpath('global/' . $param . '/*/rewrite')) {
70
+ foreach ($rewrites as $rewrite) {
71
+ $parentElement = $rewrite->xpath('../..');
72
+ foreach($parentElement[0] as $moduleKey => $moduleItems) {
73
+ $moduleItemsArray['rewrite'] = array();
74
+ $moduleItemsArray['codePool'] = array();
75
+ foreach ($moduleItems->rewrite as $rewriteLine)
76
+ {
77
+ foreach ($rewriteLine as $key => $value)
78
+ {
79
+ $moduleItemsArray['rewrite'][$key] = (string)$value;
80
+ $moduleItemsArray['codePool'][$key] = $codePool;
81
+ }
82
+ }
83
+ if($moduleItems->rewrite) {
84
+ $_finalResult[$param] = array_merge_recursive($_finalResult[$param], array($moduleKey => $moduleItemsArray));
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+
92
+ return $_finalResult;
93
+ }
94
+
95
+ /**
96
+ * Retrive possible conflicts list
97
+ *
98
+ * @return array
99
+ */
100
+ function getPossibleConflictsList()
101
+ {
102
+ $_finalResult = $this->getRewritesList();
103
+
104
+ foreach(array_keys($_finalResult) as $groupType) {
105
+
106
+ foreach(array_keys($_finalResult[$groupType]) as $key) {
107
+ // remove some repeating elements after merging all parents
108
+ foreach($_finalResult[$groupType][$key]['rewrite'] as $key1 => $value) {
109
+ if(is_array($value)) {
110
+ $_finalResult[$groupType][$key]['rewrite'][$key1] = array_unique($value);
111
+ }
112
+
113
+ // if rewrites count < 2 - no conflicts - remove
114
+ if(
115
+ (gettype($_finalResult[$groupType][$key]['rewrite'][$key1]) == 'array' && count($_finalResult[$groupType][$key]['rewrite'][$key1]) < 2)
116
+ ||
117
+ gettype($_finalResult[$groupType][$key]['rewrite'][$key1]) == 'string'
118
+ ) {
119
+ unset($_finalResult[$groupType][$key]['rewrite'][$key1]);
120
+ unset($_finalResult[$groupType][$key]['codePool'][$key1]);
121
+ }
122
+ }
123
+
124
+ // clear empty elements
125
+ if(count($_finalResult[$groupType][$key]['rewrite']) < 1) {
126
+ unset($_finalResult[$groupType][$key]);
127
+ }
128
+
129
+
130
+ }
131
+
132
+ // clear empty elements
133
+ if(count($_finalResult[$groupType]) < 1) {
134
+ unset($_finalResult[$groupType]);
135
+ }
136
+
137
+ }
138
+
139
+ return $_finalResult;
140
+ }
141
+
142
+ public function ajaxHtml(){
143
+ return Mage::app()->getLayout()->createBlock('ambase/adminhtml_debug_general')->toHtml() .
144
+ Mage::app()->getLayout()->createBlock('ambase/adminhtml_debug_conflict')->toHtml() .
145
+ Mage::app()->getLayout()->createBlock('ambase/adminhtml_debug_rewrite')->toHtml() .
146
+ Mage::app()->getLayout()->createBlock('ambase/adminhtml_debug_event')->toHtml();
147
+ }
148
+
149
+ public function getParentClasses($class){
150
+ return array_values(class_parents($class));
151
+ }
152
+
153
+ public function getEventsList()
154
+ {
155
+ $scopes = array(
156
+ 'global',
157
+ 'frontend',
158
+ 'adminhtml',
159
+ );
160
+ $collection = Mage::getResourceModel('ambase/event_collection');
161
+
162
+ $data = array();
163
+ foreach ($scopes as $scope) {
164
+ $data = array_merge($data, $collection->_prepareData($scope));
165
+ }
166
+
167
+ return $data;
168
+ }
169
+ }
app/code/local/Amasty/Base/Helper/Module.php ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Helper_Module extends Mage_Core_Helper_Abstract
8
+ {
9
+ const INSTALLED_PATH = 'ambase/feed/installed';
10
+ const EXTENSIONS_PATH = 'ambase_extensions';
11
+ const UPDATED_PREFIX = 'ambase/feed/updated_';
12
+
13
+ const URL_EXTENSIONS = 'http://amasty.com/feed-extensions.xml';
14
+ const BASE_MODULE_PERIOD = 3;
15
+ const MODULE_PERIOD = 1;
16
+
17
+ protected $_controllerModule;
18
+ protected $_extension = array(
19
+ 'name' => null,
20
+ 'url' => null,
21
+ 'version' => null
22
+ );
23
+
24
+
25
+ function init($controllerModule)
26
+ {
27
+ $segments = explode('_', $controllerModule);
28
+ $controllerModule = implode('_', array_slice($segments, 0, 2));
29
+ $this->_controllerModule = $controllerModule;
30
+ return $this;
31
+ }
32
+
33
+ static function reload()
34
+ {
35
+ $feedData = array();
36
+ $feedXml = self::getFeedData();
37
+ if ($feedXml && $feedXml->channel && $feedXml->channel->item)
38
+ {
39
+ foreach ($feedXml->channel->item as $item) {
40
+ $code = (string)$item->code;
41
+
42
+ if (!isset($feedData[$code])){
43
+ $feedData[$code] = array();
44
+ }
45
+
46
+ $feedData[$code][(string)$item->title] = array(
47
+ 'name' => (string)$item->title,
48
+ 'url' => (string)$item->link,
49
+ 'version' => (string)$item->version,
50
+ );
51
+ }
52
+
53
+ if ($feedData)
54
+ {
55
+ Mage::app()->saveCache(serialize($feedData), self::EXTENSIONS_PATH);
56
+ }
57
+ }
58
+ }
59
+
60
+
61
+ static function getFeedData()
62
+ {
63
+ if (!extension_loaded('curl')) {
64
+ return null;
65
+ }
66
+
67
+ $curl = new Varien_Http_Adapter_Curl();
68
+ $curl->setConfig(array(
69
+ 'timeout' => 2
70
+ ));
71
+ $curl->write(Zend_Http_Client::GET, self::URL_EXTENSIONS, '1.0');
72
+ $data = $curl->read();
73
+ if ($data === false) {
74
+ return false;
75
+ }
76
+ $data = preg_split('/^\r?$/m', $data, 2);
77
+ $data = trim($data[1]);
78
+ $curl->close();
79
+
80
+ try {
81
+ $xml = new SimpleXMLElement($data);
82
+ }
83
+ catch (Exception $e) {
84
+ return false;
85
+ }
86
+
87
+ return $xml;
88
+ }
89
+
90
+ static function getAllExtensions()
91
+ {
92
+ $ret = @unserialize(Mage::app()->loadCache(self::EXTENSIONS_PATH));
93
+
94
+ if (!$ret)
95
+ {
96
+ self::reload();
97
+ $ret = @unserialize(Mage::app()->loadCache(self::EXTENSIONS_PATH));
98
+ }
99
+
100
+ return $ret;
101
+ }
102
+
103
+ protected function _getExtension()
104
+ {
105
+ if (!$this->_extension || $this->_extension['name'] === null)
106
+ {
107
+ $allExtensions = self::getAllExtensions();
108
+
109
+ if (isset($allExtensions[$this->_controllerModule]))
110
+ {
111
+ $this->_extension = array_pop($allExtensions[$this->_controllerModule]);
112
+ }
113
+ }
114
+ return $this->_extension;
115
+ }
116
+
117
+ function getModuleCode()
118
+ {
119
+ $item = $this->_getExtension();
120
+ return $this->_controllerModule;
121
+ }
122
+
123
+ function getModuleTitle()
124
+ {
125
+ $item = $this->_getExtension();
126
+ return (string) ($item ? $item['name'] : null);
127
+ }
128
+
129
+ function getModuleLink()
130
+ {
131
+ $item = $this->_getExtension();
132
+ return (string) ($item ? $item['url'] : null);
133
+ }
134
+
135
+ function getLatestVersion()
136
+ {
137
+ $item = $this->_getExtension();
138
+ return (string) ($item ? $item['version'] : null);
139
+ }
140
+
141
+ protected function _getInstalledVersion()
142
+ {
143
+ $ret = null;
144
+ $modules = (array)Mage::getConfig()->getNode('modules')->children();
145
+ $moduleCode = $this->getModuleCode();
146
+ if (isset($modules[$moduleCode]))
147
+ {
148
+ $ret = (string)$modules[$moduleCode]->version;
149
+ }
150
+ return $ret;
151
+ }
152
+
153
+ protected function _isAmastyModule()
154
+ {
155
+ return strpos($this->_controllerModule, "Amasty") !== FALSE && $this->_getInstalledVersion() !== NULL;
156
+ }
157
+
158
+ static function baseModuleInstalled()
159
+ {
160
+ $ret = Mage::getStoreConfig(Amasty_Base_Helper_Module::INSTALLED_PATH);
161
+ if (!$ret)
162
+ {
163
+ $ret = time();
164
+ Mage::getConfig()->saveConfig(Amasty_Base_Helper_Module::INSTALLED_PATH, $ret);
165
+ Mage::getConfig()->cleanCache();
166
+ }
167
+ return $ret;
168
+ }
169
+
170
+ function moduleUpdated()
171
+ {
172
+ $path = Amasty_Base_Helper_Module::UPDATED_PREFIX . $this->_controllerModule;
173
+ $ret = Mage::getStoreConfig($path);
174
+ if (!$ret)
175
+ {
176
+ $this->setModuleUpdated();
177
+ }
178
+ return $ret;
179
+ }
180
+
181
+ function setModuleUpdated()
182
+ {
183
+ $path = Amasty_Base_Helper_Module::UPDATED_PREFIX . $this->_controllerModule;
184
+ Mage::getConfig()->saveConfig($path, time());
185
+ Mage::getConfig()->cleanCache();
186
+ }
187
+
188
+ protected function _validateBaseModulePeriod()
189
+ {
190
+ return strtotime("+" . self::BASE_MODULE_PERIOD . " month" , self::baseModuleInstalled()) < time();
191
+ }
192
+
193
+ protected function _validateModulePeriod()
194
+ {
195
+ return strtotime("+" . self::MODULE_PERIOD . " month" , self::moduleUpdated()) < time();
196
+ }
197
+
198
+ function isNewVersionAvailable()
199
+ {
200
+ $ret = false;
201
+ if ($this->_isAmastyModule() && $this->_validateBaseModulePeriod() && $this->_validateModulePeriod())
202
+ {
203
+ if (version_compare($this->getLatestVersion(), $this->_getInstalledVersion(), 'gt'))
204
+ {
205
+
206
+ $ret = true;
207
+ }
208
+ }
209
+ return $ret;
210
+ }
211
+
212
+ function isSubscribed()
213
+ {
214
+ return Mage::getStoreConfig('ambase/feed/update') == 1;
215
+ }
216
+ }
app/code/local/Amasty/Base/Helper/Promo.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Helper_Promo extends Mage_Core_Helper_Abstract
8
+ {
9
+ function getNotificationsCollection()
10
+ {
11
+ $collection = Mage::getModel("adminnotification/inbox")->getCollection();
12
+
13
+ $collection->getSelect()
14
+ ->where('title like "%amasty%" or description like "%amasty%" or url like "%amasty%"')
15
+ ->where('is_read != 1')
16
+ ->where('is_remove != 1');
17
+
18
+ return $collection;
19
+ }
20
+
21
+ function isSubscribed()
22
+ {
23
+ return Mage::getStoreConfig('ambase/feed/promo') == 1;
24
+ }
25
+ }
26
+
27
+ ?>
app/code/local/Amasty/Base/Model/Conflict.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+
8
+ class Amasty_Base_Model_Conflict{
9
+ protected $_log = array();
10
+ protected $_beforeCode = '/* added automatically by conflict fixing tool */ ';
11
+
12
+ protected function _log($m){
13
+ $this->_log[] = $m;
14
+ Mage::log($m, null, 'amasty_conflict_checker.log');
15
+ }
16
+
17
+ function log(){
18
+ return $this->_log;
19
+ }
20
+
21
+ protected function _getRewriteConfig($object, $module, $rewrite){
22
+ $ret = array(
23
+ "classes" => null,
24
+ "codePool" => null
25
+ );
26
+ $conflictsList = Mage::helper("ambase")->getPossibleConflictsList();
27
+ if (isset($conflictsList[$object]) &&
28
+ isset($conflictsList[$object][$module]) &&
29
+ isset($conflictsList[$object][$module]["rewrite"][$rewrite])){
30
+
31
+ $rewriteClasses = $conflictsList[$object][$module]["rewrite"][$rewrite];
32
+ $codePool = $conflictsList[$object][$module]["codePool"][$rewrite];
33
+
34
+ krsort($rewriteClasses);
35
+
36
+ $ret["classes"] = $rewriteClasses;
37
+ $ret["codePool"] = $codePool;
38
+
39
+
40
+ } else {
41
+ throw new Exception("Conflict not found");
42
+ }
43
+
44
+ return $ret;
45
+ }
46
+
47
+ protected function _checkPermissions($config){
48
+ foreach($config["classes"] as $rewriteIndex => $rewriteClass){
49
+ $classPath = self::getClassPath($config['codePool'][$rewriteIndex], $rewriteClass);
50
+
51
+ if (!is_writable($classPath)){
52
+ Mage::throwException('Please add write permissions on the file ' . $classPath);
53
+ }
54
+ }
55
+ }
56
+
57
+ public function fix($object, $module, $rewrite){
58
+
59
+ $config = $this->_getRewriteConfig($object, $module, $rewrite);
60
+
61
+ $this->_checkPermissions($config);
62
+
63
+ $extendsClasses = $config["classes"];
64
+
65
+ foreach($config["classes"] as $rewriteIndex => $rewriteClass){
66
+ unset($extendsClasses[$rewriteIndex]);
67
+
68
+ if (count($extendsClasses) > 0)
69
+ $this->_applyFix($rewriteClass, $extendsClasses, $rewriteIndex, $config["codePool"]);
70
+ }
71
+ }
72
+
73
+ public function rollback($object, $module, $rewrite){
74
+ $config = $this->_getRewriteConfig($object, $module, $rewrite);
75
+
76
+ $this->_checkPermissions($config);
77
+
78
+ $extendsClasses = $config["classes"];
79
+
80
+ foreach($config["classes"] as $rewriteIndex => $rewriteClass){
81
+ unset($extendsClasses[$rewriteIndex]);
82
+
83
+ if (count($extendsClasses) > 0) {
84
+ $classPath = self::getClassPath($config['codePool'][$rewriteIndex], $rewriteClass);
85
+ $backupPath = $this->_getBackupFileName($classPath);
86
+ $backupFixedPath = $this->_getBackupFixedFileName($classPath);
87
+
88
+ if (file_exists($backupPath)){
89
+ rename($classPath, $backupFixedPath);
90
+ $this->_log($classPath . " renamed to " . $backupFixedPath);
91
+ rename($backupPath, $classPath);
92
+ $this->_log($backupPath . " renamed to " . $classPath);
93
+ } else {
94
+ if (file_exists($backupFixedPath)){
95
+ $this->_log("Rollback already completed: " . $classPath);
96
+ } else {
97
+ throw new Exception("Backup not found:" . $backupPath);
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }
103
+
104
+ static function getClassPath($pool, $class){
105
+ return BP . DS . 'app' . DS . 'code' . DS . $pool . DS . uc_words($class, DS) . '.php';
106
+ }
107
+
108
+ protected function _applyFix($class, $extends, $rewriteIndex, $codePool){
109
+ $classPath = self::getClassPath($codePool[$rewriteIndex], $class);
110
+
111
+ if (file_exists($classPath)){
112
+ $parentClasses = Mage::helper("ambase")->getParentClasses($class);
113
+ if (count($parentClasses) > 0){
114
+
115
+ $this->_createPureClass($class, $parentClasses, $classPath, $extends);
116
+ $this->_overwriteExistingClass($class, $parentClasses, $classPath);
117
+ } else {
118
+ throw new Exception("Parent class not found:" . $class);
119
+ }
120
+ } else {
121
+ throw new Exception("Wrong class path:" . $classPath);
122
+ }
123
+ }
124
+
125
+ protected function _createPureClass($class, $parentClasses, $classPath, $extends){
126
+ $tplClass = "class :pure_class extends :extend_class {}";
127
+ $tpl = "if (Mage::getConfig()->getNode('modules/:extend_module/active')) {
128
+ " . $tplClass . "
129
+ }";
130
+
131
+
132
+ $classDir = str_replace(".php", "", $classPath);
133
+
134
+ $purePath = $classDir . DS . "Amasty". DS . "Pure.php";
135
+
136
+ if (!file_exists($classDir)){
137
+ mkdir($classDir);
138
+ $this->_log("Dir created: " . $classDir);
139
+ }
140
+
141
+ if (!file_exists($classDir . DS . "Amasty")){
142
+ mkdir($classDir . DS . "Amasty");
143
+ $this->_log("Dir created: " . $classDir . DS . "Amasty");
144
+ }
145
+
146
+ $pureClassData = array();
147
+
148
+ foreach($extends as $extendClass){
149
+ $moduleName = implode("_", array_slice(explode("_", $extendClass), 0, 2));
150
+ $params = array(
151
+ ":class" => $class,
152
+ ":extend_module" => $moduleName,
153
+ ":extend_class" => $extendClass,
154
+ ":pure_class" => self::getPureClassName($class),
155
+
156
+
157
+ );
158
+ $pureClassData [] = strtr($tpl, $params);
159
+ }
160
+
161
+ $pureClassCode = implode(" else ", $pureClassData);
162
+
163
+ $pureClassCode .= " else { " . strtr($tplClass, array(
164
+ ":pure_class" => self::getPureClassName($class),
165
+ ":extend_class" => $parentClasses[0]
166
+ )) . " }";
167
+
168
+ file_put_contents($purePath, "<?php " . $this->_beforeCode . $pureClassCode . " ?>");
169
+
170
+ $this->_log("File created: " . $purePath);
171
+
172
+ }
173
+
174
+ protected function _overwriteExistingClass($class, $parentClasses, $classPath){
175
+ $classCode = file_get_contents($classPath);
176
+
177
+ $classCodeNew = strtr($classCode, array(
178
+ $parentClasses[0] => self::getPureClassName($class)
179
+ ));
180
+
181
+ if ($classCode != $classCodeNew){
182
+ rename($classPath, $this->_getBackupFileName($classPath));
183
+ $this->_log($classPath . " renamed to " . $this->_getBackupFileName($classPath));
184
+ file_put_contents($classPath, $classCodeNew);
185
+ $this->_log("File created: " . $classPath);
186
+ }
187
+ }
188
+
189
+ static function getPureClassName($class){
190
+ return $class . '_Amasty_Pure';
191
+ }
192
+
193
+ protected function _getBackupFileName($classPath){
194
+ return $classPath . '_ambackup';
195
+ }
196
+
197
+ protected function _getBackupFixedFileName($classPath){
198
+ return $classPath . '_fixed_ambackup';
199
+ }
200
+ }
201
+ ?>
app/code/local/Amasty/Base/Model/Feed.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Model_Feed extends Mage_AdminNotification_Model_Feed
8
+ {
9
+ const XML_FREQUENCY_PATH = 'ambase/feed/check_frequency';
10
+ const XML_LAST_UPDATE_PATH = 'ambase/feed/last_update';
11
+
12
+ const URL_NEWS = 'http://amasty.com/feed-news.xml';
13
+
14
+
15
+ public function check()
16
+ {
17
+ $this->checkUpdate();
18
+ }
19
+
20
+ protected function _isPromoSubscribed()
21
+ {
22
+ return Mage::helper("ambase/promo")->isSubscribed();
23
+ }
24
+
25
+ public function checkUpdate()
26
+ {
27
+
28
+ if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
29
+ return $this;
30
+ }
31
+
32
+ $this->setLastUpdate();
33
+
34
+ if (!extension_loaded('curl')) {
35
+ return $this;
36
+ }
37
+
38
+ if ($this->_isPromoSubscribed()) {
39
+ // load all new and relevant updates into inbox
40
+ $feedData = array();
41
+ $feedXml = $this->getFeedData();
42
+ $wasInstalled = gmdate('Y-m-d H:i:s', Amasty_Base_Helper_Module::baseModuleInstalled());
43
+
44
+ if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
45
+ foreach ($feedXml->channel->item as $item) {
46
+
47
+ $date = $this->getDate((string)$item->pubDate);
48
+
49
+ // compare strings, but they are well-formmatted
50
+ if ($date < $wasInstalled){
51
+ continue;
52
+ }
53
+
54
+ $feedData[] = array(
55
+ 'severity' => 3,
56
+ 'date_added' => $this->getDate($date),
57
+ 'title' => (string)$item->title,
58
+ 'description' => (string)$item->description,
59
+ 'url' => (string)$item->link,
60
+ );
61
+ }
62
+
63
+ if ($feedData) {
64
+ $inbox = Mage::getModel('adminnotification/inbox');
65
+
66
+ if ($inbox)
67
+ $inbox->parse($feedData);
68
+ }
69
+ }
70
+ }
71
+
72
+ //load all available extensions in the cache
73
+ Amasty_Base_Helper_Module::reload();
74
+
75
+ return $this;
76
+ }
77
+
78
+ public function getFrequency()
79
+ {
80
+ return Mage::getStoreConfig(self::XML_FREQUENCY_PATH);
81
+ }
82
+
83
+ public function getLastUpdate()
84
+ {
85
+ return Mage::app()->loadCache('ambase_notifications_lastcheck');
86
+ }
87
+
88
+ public function setLastUpdate()
89
+ {
90
+ Mage::app()->saveCache(time(), 'ambase_notifications_lastcheck');
91
+ return $this;
92
+ }
93
+
94
+ public function getFeedUrl()
95
+ {
96
+ if (is_null($this->_feedUrl)) {
97
+ $this->_feedUrl = self::URL_NEWS;
98
+ }
99
+ $query = '?s=' . urlencode(Mage::getStoreConfig('web/unsecure/base_url'));
100
+ return $this->_feedUrl . $query;
101
+ }
102
+
103
+ protected function isExtensionInstalled($code)
104
+ {
105
+ $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
106
+ foreach ($modules as $moduleName) {
107
+ if ($moduleName == $code){
108
+ return true;
109
+ }
110
+ }
111
+
112
+ return false;
113
+ }
114
+
115
+ }
app/code/local/Amasty/Base/Model/Resource/Event/Collection.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ class Amasty_Base_Model_Resource_Event_Collection extends Varien_Data_Collection
8
+ {
9
+ public function _prepareData($scope) {
10
+ $config = Mage::getConfig()->getNode($scope . '/events')->children();
11
+ $data = array();
12
+
13
+ foreach ($config as $node) {
14
+ $eventName = $node->getName();
15
+
16
+ foreach ($node->observers->children() as $observer) {
17
+ $data[$eventName][] = array(
18
+ 'class' => Mage::getConfig()->getModelClassName((string) $observer->class),
19
+ 'method' => (string) $observer->method,
20
+ 'scope' => $scope
21
+ );
22
+ }
23
+ }
24
+ return $data;
25
+ }
26
+ }
app/code/local/Amasty/Base/controllers/Adminhtml/Ambase/BaseController.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+
8
+ class Amasty_Base_Adminhtml_Ambase_BaseController extends Mage_Adminhtml_Controller_Action
9
+ {
10
+ protected $_moduleHelper;
11
+
12
+ protected function _getModuleHelper($code)
13
+ {
14
+ if (!$this->_moduleHelper)
15
+ {
16
+ $this->_moduleHelper = Mage::helper("ambase/module")->init($code);
17
+ }
18
+
19
+ return $this->_moduleHelper;
20
+ }
21
+
22
+ public function closeUpdateAction()
23
+ {
24
+ $code = Mage::app()->getRequest()->getParam('code');
25
+
26
+ $moduleHelper = $this->_getModuleHelper($code);
27
+
28
+ if ($moduleHelper->isNewVersionAvailable())
29
+ {
30
+ $moduleHelper->setModuleUpdated();
31
+ }
32
+ }
33
+
34
+ public function closePromoAction()
35
+ {
36
+ $collection = Mage::helper("ambase/promo")->getNotificationsCollection();
37
+
38
+ foreach($collection as $notification)
39
+ {
40
+ $notification->setIsRead(true);
41
+ $notification->save();
42
+ }
43
+ }
44
+
45
+ public function ajaxAction()
46
+ {
47
+ $helper = Mage::helper("ambase");
48
+ print $helper->ajaxHtml();
49
+ }
50
+
51
+ public function fixAction()
52
+ {
53
+ $object = Mage::app()->getRequest()->getParam('object');
54
+ $module = Mage::app()->getRequest()->getParam('module');
55
+ $rewrite = Mage::app()->getRequest()->getParam('rewrite');
56
+ if ($module && $rewrite && $object){
57
+
58
+ try {
59
+ $conflict = Mage::getModel("ambase/conflict");
60
+ $conflict->fix($object, $module, $rewrite);
61
+
62
+ foreach($conflict->log() as $m)
63
+ Mage::getSingleton('adminhtml/session')->addNotice($m);
64
+
65
+ } catch (Exception $e) {
66
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
67
+ }
68
+
69
+
70
+ $this->_redirect("adminhtml/system_config/edit", array(
71
+ "section" => "ambase",
72
+ "autoload" => 1
73
+ ));
74
+ }
75
+ }
76
+
77
+ public function rollbackAction()
78
+ {
79
+ $object = Mage::app()->getRequest()->getParam('object');
80
+ $module = Mage::app()->getRequest()->getParam('module');
81
+ $rewrite = Mage::app()->getRequest()->getParam('rewrite');
82
+ if ($module && $rewrite && $object){
83
+ try {
84
+ $conflict = Mage::getModel("ambase/conflict");
85
+ $conflict->rollback($object, $module, $rewrite);
86
+
87
+ foreach($conflict->log() as $m)
88
+ Mage::getSingleton('adminhtml/session')->addNotice($m);
89
+
90
+ } catch (Exception $e) {
91
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
92
+ }
93
+
94
+ $this->_redirect("adminhtml/system_config/edit", array(
95
+ "section" => "ambase",
96
+ "autoload" => 1
97
+ ));
98
+ }
99
+ }
100
+
101
+ protected function _isAllowed()
102
+ {
103
+ return Mage::getSingleton('admin/session')->isAllowed('system/config');
104
+ }
105
+ }
106
+ ?>
app/code/local/Amasty/Base/etc/adminhtml.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Amasty Team
5
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
6
+ * @package Amasty_Base
7
+ */
8
+ -->
9
+ <config>
10
+ <acl>
11
+ <resources>
12
+ <all>
13
+ <title>Allow Everything</title>
14
+ </all>
15
+ <admin>
16
+ <children>
17
+ <system>
18
+ <children>
19
+ <config>
20
+ <children>
21
+ <ambase translate="title">
22
+ <title>Amasty - Extensions Information</title>
23
+ </ambase>
24
+ <amstore translate="title">
25
+ <title>Amasty - Extensions Store</title>
26
+ </amstore>
27
+ </children>
28
+ </config>
29
+ </children>
30
+ </system>
31
+ </children>
32
+ </admin>
33
+ </resources>
34
+ </acl>
35
+ <events>
36
+ <controller_action_predispatch>
37
+ <observers>
38
+ <ambase_upds>
39
+ <type>singleton</type>
40
+ <class>ambase/feed</class>
41
+ <method>check</method>
42
+ </ambase_upds>
43
+ </observers>
44
+ </controller_action_predispatch>
45
+ </events>
46
+ <translate>
47
+ <modules>
48
+ <Amasty_Base>
49
+ <files>
50
+ <default>Amasty_Base.csv</default>
51
+ </files>
52
+ </Amasty_Base>
53
+ </modules>
54
+ </translate>
55
+ </config>
app/code/local/Amasty/Base/etc/config.xml ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Amasty Team
5
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
6
+ * @package Amasty_Base
7
+ */
8
+ -->
9
+ <config>
10
+ <modules>
11
+ <Amasty_Base>
12
+ <version>2.1.7</version>
13
+ </Amasty_Base>
14
+ </modules>
15
+
16
+ <global>
17
+ <blocks>
18
+ <ambase>
19
+ <class>Amasty_Base_Block</class>
20
+ </ambase>
21
+ </blocks>
22
+ <resources>
23
+ <ambase_setup>
24
+ <setup>
25
+ <module>Amasty_Base</module>
26
+ </setup>
27
+ <connection>
28
+ <use>core_setup</use>
29
+ </connection>
30
+ </ambase_setup>
31
+ <ambase_write>
32
+ <connection>
33
+ <use>core_write</use>
34
+ </connection>
35
+ </ambase_write>
36
+ <ambase_read>
37
+ <connection>
38
+ <use>core_read</use>
39
+ </connection>
40
+ </ambase_read>
41
+ </resources>
42
+ <models>
43
+ <ambase>
44
+ <class>Amasty_Base_Model</class>
45
+ <resourceModel>ambase_resource</resourceModel>
46
+ </ambase>
47
+ <ambase_resource>
48
+ <class>Amasty_Base_Model_Resource</class>
49
+ </ambase_resource>
50
+ </models>
51
+ <helpers>
52
+ <ambase>
53
+ <class>Amasty_Base_Helper</class>
54
+ </ambase>
55
+ </helpers>
56
+ </global>
57
+
58
+ <admin>
59
+ <routers>
60
+ <adminhtml>
61
+ <args>
62
+ <modules>
63
+ <Amasty_Base after="Mage_Adminhtml">Amasty_Base_Adminhtml</Amasty_Base>
64
+ </modules>
65
+ </args>
66
+ </adminhtml>
67
+ </routers>
68
+ </admin>
69
+
70
+ <adminhtml>
71
+ <layout>
72
+ <updates>
73
+ <ambase module="Amasty_Base">
74
+ <file>amasty/ambase/ambase.xml</file>
75
+ </ambase>
76
+ </updates>
77
+ </layout>
78
+
79
+ <acl>
80
+ <resources>
81
+ <all>
82
+ <title>Allow Everything</title>
83
+ </all>
84
+ <admin>
85
+ <children>
86
+ <system>
87
+ <children>
88
+ <config>
89
+ <children>
90
+ <ambase translate="title">
91
+ <title>Amasty - Extensions Information</title>
92
+ </ambase>
93
+ <amstore translate="title">
94
+ <title>Amasty - Extensions Store</title>
95
+ </amstore>
96
+ </children>
97
+ </config>
98
+ </children>
99
+ </system>
100
+ </children>
101
+ </admin>
102
+ </resources>
103
+ </acl>
104
+ <events>
105
+ <controller_action_predispatch>
106
+ <observers>
107
+ <ambase_upds>
108
+ <type>singleton</type>
109
+ <class>ambase/feed</class>
110
+ <method>check</method>
111
+ </ambase_upds>
112
+ </observers>
113
+ </controller_action_predispatch>
114
+ </events>
115
+ <translate>
116
+ <modules>
117
+ <Amasty_Base>
118
+ <files>
119
+ <default>Amasty_Base.csv</default>
120
+ </files>
121
+ </Amasty_Base>
122
+ </modules>
123
+ </translate>
124
+ </adminhtml>
125
+
126
+ <default>
127
+ <ambase>
128
+ <feed>
129
+ <check_frequency>86400</check_frequency>
130
+ <update>1</update>
131
+ <promo>1</promo>
132
+ </feed>
133
+ </ambase>
134
+ </default>
135
+ </config>
app/code/local/Amasty/Base/etc/system.xml ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Amasty Team
5
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
6
+ * @package Amasty_Base
7
+ */
8
+ -->
9
+ <config>
10
+ <tabs>
11
+ <amasty translate="label" module="ambase">
12
+ <label><![CDATA[<div style="position: absolute;"><img id="amasty_block" src="" alt="" border="0" /></div>&nbsp;<script>
13
+ var n = SKIN_URL.indexOf("adminhtml");
14
+ $('amasty_block').src = SKIN_URL.substring(0, n) + "adminhtml/default/default/images/ambase/amasty.png";
15
+ </script>]]></label>
16
+ <sort_order>400</sort_order>
17
+ </amasty>
18
+ </tabs>
19
+ <sections>
20
+ <amstore>
21
+ <label><![CDATA[Extensions Store]]></label>
22
+ <tab>amasty</tab>
23
+ <class>amasty-store-tab</class>
24
+ <frontend_type>text</frontend_type>
25
+ <sort_order>100</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
+ <groups>
30
+ <extensions translate="label">
31
+ <label>Amasty Extensions Store</label>
32
+ <frontend_type>text</frontend_type>
33
+ <frontend_model>ambase/store</frontend_model>
34
+ <sort_order>999</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </extensions>
39
+ </groups>
40
+ </amstore>
41
+ <ambase translate="label" module="ambase">
42
+ <label><![CDATA[Extensions &amp; Notifications]]></label>
43
+ <tab>amasty</tab>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>110</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ <groups>
50
+ <extensions translate="label">
51
+ <label>Installed Extensions</label>
52
+ <frontend_type>text</frontend_type>
53
+ <frontend_model>ambase/extensions</frontend_model>
54
+ <sort_order>40</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>1</show_in_store>
58
+ </extensions>
59
+ <feed>
60
+ <label>Notifications</label>
61
+ <frontend_type>text</frontend_type>
62
+ <sort_order>90</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ <fields>
67
+ <update translate="label">
68
+ <label>I`d like to be informed by Amasty Updates about</label>
69
+ <comment><![CDATA[]]></comment>
70
+ <frontend_type>select</frontend_type>
71
+ <source_model>adminhtml/system_config_source_yesno</source_model>
72
+ <sort_order>1</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </update>
77
+ <promo translate="label">
78
+ <label>I`d like to be informed by Amasty Promos about</label>
79
+ <comment><![CDATA[]]></comment>
80
+ <frontend_type>select</frontend_type>
81
+ <source_model>adminhtml/system_config_source_yesno</source_model>
82
+ <sort_order>1</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ </promo>
87
+
88
+ <!-- <interests translate="label">
89
+ <label>I'd like to be informed by Amasty about:</label>
90
+ <comment></comment>
91
+ <frontend_type>multiselect</frontend_type>
92
+ <sort_order>100</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ <can_be_empty>1</can_be_empty>
97
+ <source_model>ambase/source_updates_type</source_model>
98
+ </interests>-->
99
+ </fields>
100
+ </feed>
101
+ <conflicts translate="label">
102
+ <label><![CDATA[Troubleshooter<script>
103
+ function ambaseShow(url){
104
+ new Ajax.Request(url, {
105
+ onSuccess: function(response) {
106
+ $("ambase_conflicts_container").update(response.transport.response)
107
+ }
108
+ });
109
+ }
110
+ </script>]]></label>
111
+ <frontend_type>text</frontend_type>
112
+ <frontend_model>ambase/conflicts</frontend_model>
113
+ <sort_order>200</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <show_in_website>1</show_in_website>
116
+ <show_in_store>1</show_in_store>
117
+ </conflicts>
118
+ </groups>
119
+ </ambase>
120
+ </sections>
121
+ </config>
app/code/local/Amasty/Base/sql/ambase_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+
8
+ $this->startSetup();
9
+ $this->endSetup();
app/code/local/Amasty/Base/sql/ambase_setup/mysql4-upgrade-1.0.0-1.0.1.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+
8
+ $this->startSetup();
9
+
10
+ Amasty_Base_Helper_Module::baseModuleInstalled();
11
+
12
+ $feedData = array();
13
+ $feedData[] = array(
14
+ 'severity' => 4,
15
+ 'date_added' => gmdate('Y-m-d H:i:s', time()),
16
+ 'title' => 'Amasty`s extension has been installed. Remember to flush all cache, recompile, log-out and log back in.',
17
+ 'description' => 'You can see versions of the installed extensions right in the admin, as well as configure notifications about major updates.',
18
+ 'url' => 'http://amasty.com/news/updates-and-notifications-configuration-9.html'
19
+ // 'url' => Mage::getModel('adminhtml/url')->getUrl('adminhtml/system_config/edit', array('section'=>'ambase')),
20
+ );
21
+
22
+ Mage::getModel('adminnotification/inbox')->parse($feedData);
23
+
24
+ $this->endSetup();
app/code/local/Amasty/ZeroSellers/Block/Adminhtml/Purchased.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_ZeroSellers
6
+ */
7
+ class Amasty_ZeroSellers_Block_Adminhtml_Purchased extends Mage_Adminhtml_Block_Widget_Grid_Container
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+
13
+ $this->_controller = 'adminhtml_purchased';
14
+ $this->_blockGroup = 'amzerosellers';
15
+ $this->_headerText = Mage::helper('amzerosellers')->__('Zero Sellers');
16
+ $this->_removeButton('add');
17
+ }
18
+ }
app/code/local/Amasty/ZeroSellers/Block/Adminhtml/Purchased/Grid.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_ZeroSellers
6
+ */
7
+ class Amasty_ZeroSellers_Block_Adminhtml_Purchased_Grid extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+ /**
10
+ * Not displayed in the collection.
11
+ *
12
+ * @var array $_forbiddenTypes
13
+ */
14
+ protected $_forbiddenTypes = array('grouped','configurable');
15
+
16
+ /**
17
+ * @var array $_massAction
18
+ */
19
+ protected $_massActions = array('addspecial', 'modifyspecial', 'disable');
20
+
21
+ public function __construct()
22
+ {
23
+ parent::__construct();
24
+ $this->setId('amzerosellers_purchased');
25
+ $this->setDefaultSort('qty_ordered');
26
+ $this->setDefaultDir('ASC');
27
+ $this->setUseAjax(true);
28
+ $this->setSaveParametersInSession(true);
29
+ $threshold = (int) Mage::getStoreConfig('amzerosellers/general/threshold');
30
+ $threshold = max(array($threshold, 0));
31
+ $this->setDefaultFilter(array('qty_ordered' => array('to' => $threshold)));
32
+ }
33
+
34
+ protected function _prepareCollection()
35
+ {
36
+ /** @var Amasty_ZeroSellers_Model_Resource_Catalog_Product_Collection $collection */
37
+ $collection = Mage::getModel('amzerosellers/resource_catalog_product_collection')
38
+ ->addAttributeToSelect('sku')
39
+ ->addAttributeToSelect('name')
40
+ ->addAttributeToSelect('type_id')
41
+ ->addAttributeToSelect('price')
42
+ ->addAttributeToFilter('type_id', array('nin' => $this->_forbiddenTypes));
43
+ $collection->joinAttribute('special_price', 'catalog_product/special_price', 'entity_id', null, 'left');
44
+ $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
45
+ $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
46
+ $collection->addQty();
47
+
48
+ $select = $collection->getSelect();
49
+ $columnId = $this->getParam($this->getVarNameSort(), $this->_defaultSort);
50
+ $dir = $this->getParam($this->getVarNameDir(), $this->_defaultDir);
51
+ if (isset($this->_columns[$columnId]) && $this->_columns[$columnId]->getIndex()) {
52
+ $dir = (strtolower($dir)=='desc') ? 'desc' : 'asc';
53
+ $select->order($columnId . ' ' . $dir);
54
+ }
55
+
56
+ $this->setCollection($collection);
57
+ return parent::_prepareCollection();
58
+ }
59
+
60
+ protected function _addColumnFilterToCollection($column)
61
+ {
62
+ if ($collection = $this->getCollection()) {
63
+ if ($column->getId() == 'websites') {
64
+ $collection->joinField('websites',
65
+ 'catalog/product_website',
66
+ 'website_id',
67
+ 'product_id=entity_id',
68
+ null,
69
+ 'left');
70
+ }
71
+ }
72
+ return parent::_addColumnFilterToCollection($column);
73
+ }
74
+
75
+
76
+ /**
77
+ * Sets sorting order by some column && fix sorting by SUM(*) column issue
78
+ *
79
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
80
+ * @return Mage_Adminhtml_Block_Widget_Grid
81
+ */
82
+ protected function _setCollectionOrder($column)
83
+ {
84
+ $columnIndex = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
85
+ if ($columnIndex == 'qty_ordered') {
86
+ $collection = $this->getCollection();
87
+ if ($collection) {
88
+ $collection
89
+ ->setOrder($columnIndex, strtoupper($column->getDir()))
90
+ ->setOrder('sku', 'ASC');
91
+ }
92
+ }
93
+
94
+ return parent::_setCollectionOrder($column);
95
+ }
96
+
97
+ protected function _prepareColumns()
98
+ {
99
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
100
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
101
+
102
+ $hlp = Mage::helper('amzerosellers');
103
+
104
+ $this->addColumn('qty_ordered', array(
105
+ 'header' => $hlp->__('Purchased Qty'),
106
+ 'type' => 'number',
107
+ 'index' => 'qty_ordered',
108
+ 'width' => '15px',
109
+ 'filter_condition_callback' => array($this, '_orderedQtyFilter'),
110
+ ));
111
+
112
+ $this->addColumn('qty', array(
113
+ 'header' => $hlp->__('Stock Qty'),
114
+ 'type' => 'number',
115
+ 'index' => 'qty',
116
+ ));
117
+
118
+ if (!Mage::app()->isSingleStoreMode()) {
119
+ $this->addColumn('websites',
120
+ array(
121
+ 'header' => $hlp->__('Websites'),
122
+ 'width' => '120px',
123
+ 'sortable' => false,
124
+ 'index' => 'websites',
125
+ 'type' => 'options',
126
+ //collection filters are broken after call $this->getCollection()->addWebsiteNamesToResult(), using website renderer instead
127
+ 'renderer' => 'Amasty_ZeroSellers_Block_Adminhtml_Purchased_Renderer_Website',
128
+ 'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
129
+ ));
130
+ }
131
+
132
+ $allowedTypes = Mage::getSingleton('catalog/product_type')->getOptionArray();
133
+ foreach ($this->_forbiddenTypes as $forbiddenType) {
134
+ unset($allowedTypes[$forbiddenType]);
135
+ }
136
+ $this->addColumn('type_id', array(
137
+ 'header' => $hlp->__('Type'),
138
+ 'width' => '100px',
139
+ 'index' => 'type_id',
140
+ 'type' => 'options',
141
+ 'options' => $allowedTypes,
142
+ ));
143
+
144
+ $this->addColumn('name', array(
145
+ 'header' => $hlp->__('Product Name'),
146
+ 'type' => 'text',
147
+ 'index' => 'name',
148
+ ));
149
+
150
+ $this->addColumn('sku', array(
151
+ 'header' => $hlp->__('SKU'),
152
+ 'index' => 'sku',
153
+ ));
154
+
155
+ $currencyCode = Mage::app()->getStore()->getBaseCurrency()->getCode();
156
+ $this->addColumn('price', array(
157
+ 'header' => $hlp->__('Price'),
158
+ 'type' => 'price',
159
+ 'currency_code' => $currencyCode,
160
+ 'index' => 'price',
161
+ ));
162
+
163
+ $this->addColumn('special_price', array(
164
+ 'header' => $hlp->__('Special Price'),
165
+ 'type' => 'price',
166
+ 'currency_code' => $currencyCode,
167
+ 'index' => 'special_price',
168
+ ));
169
+
170
+ $this->addColumn('visibility', array(
171
+ 'header' => $hlp->__('Visibility'),
172
+ 'width' => '150px',
173
+ 'index' => 'visibility',
174
+ 'type' => 'options',
175
+ 'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
176
+ ));
177
+
178
+ $this->addColumn('status', array(
179
+ 'header' => $hlp->__('Status'),
180
+ 'width' => '100px',
181
+ 'index' => 'status',
182
+ 'type' => 'options',
183
+ 'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
184
+ ));
185
+
186
+ $this->addColumn('action_view', array(
187
+ 'header' => $hlp->__('View'),
188
+ 'width' => '50px',
189
+ 'sortable' => false,
190
+ 'filter' => false,
191
+ 'type' => 'action',
192
+ 'is_system' => true,
193
+ 'actions' => array(
194
+ array(
195
+ 'url' => $this->getUrl('adminhtml/catalog_product/edit', array('id' => '$entity_id')),
196
+ 'caption' => $hlp->__('View'),
197
+ )
198
+ )
199
+ ));
200
+
201
+ return parent::_prepareColumns();
202
+ }
203
+
204
+ protected function _prepareMassaction()
205
+ {
206
+ $this->setMassactionIdField('entity_id');
207
+ $block = $this->getMassactionBlock();
208
+ $block->setFormFieldName('product_id');
209
+ foreach ($this->_massActions as $type) {
210
+ if (Mage::getSingleton('admin/session')->isAllowed('report/products/amzerosellers_purchased/' . $type)) {
211
+ $command = Amasty_ZeroSellers_Model_Command_Abstract::factory($type);
212
+ $command->addAction($block);
213
+ }
214
+ }
215
+ return $this;
216
+ }
217
+
218
+ protected function _orderedQtyFilter($collection, $column) {
219
+ $value = $column->getFilter()->getValue();
220
+ if ($value === NULL) {
221
+ return $this;
222
+ }
223
+ if (isset($value['from'])) {
224
+ $collection->getSelect()->having('qty_ordered >= ' . $value['from']);
225
+ }
226
+ if (isset($value['to'])) {
227
+ $collection->getSelect()->having('qty_ordered <= ' . $value['to']);
228
+ }
229
+
230
+ return $this;
231
+ }
232
+
233
+ public function getGridUrl()
234
+ {
235
+ return $this->getUrl('*/*/grid', array('_current'=>true));
236
+ }
237
+ }
app/code/local/Amasty/ZeroSellers/Block/Adminhtml/Purchased/Renderer/Website.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Xnotif
6
+ */
7
+
8
+ class Amasty_ZeroSellers_Block_Adminhtml_Purchased_Renderer_Website extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Text
9
+ {
10
+ function render(Varien_Object $row)
11
+ {
12
+ $productWebsite = $row->getData($this->getColumn()->getIndex());
13
+ if ($productWebsite) {
14
+ return Mage::app()->getWebsite($productWebsite)->getName();
15
+ }
16
+ $product = Mage::getModel('catalog/product')->load($row->getId());
17
+ $websiteIds =$product->getWebsiteIds();
18
+ $result = '';
19
+ foreach ($websiteIds as $websiteId) {
20
+ $result .= $result ? ', ' : null;
21
+ $result .= Mage::app()->getWebsite($websiteId)->getName();
22
+ }
23
+ return $result;
24
+ }
25
+ }
app/code/local/Amasty/ZeroSellers/Helper/Data.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_ZeroSellers
6
+ */
7
+ class Amasty_ZeroSellers_Helper_Data extends Mage_Core_Helper_Url
8
+ {
9
+
10
+
11
+ }
app/code/local/Amasty/ZeroSellers/Model/Command/Abstract.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) Amasty Ltd. ( http://www.amasty.com/ )
5
+ * @package Amasty_ZeroSellers
6
+ */
7
+ class Amasty_ZeroSellers_Model_Command_Abstract
8
+ {
9
+ protected $_type = '';
10
+ protected $_label = '';
11
+ protected $_fieldLabel = '';
12
+
13
+ protected $_errors = array();
14
+
15
+ public function __construct($type='')
16
+ {
17
+ $this->_type = $type;
18
+ }
19
+
20
+ /**
21
+ * Factory method. Creates a new command object by its type
22
+ *
23
+ * @param string $type command type
24
+ * @return Amasty_ZeroSellers_Model_Command_Abstract
25
+ */
26
+ public static function factory($type)
27
+ {
28
+ $className = 'Amasty_ZeroSellers_Model_Command_' . ucfirst($type);
29
+ return new $className($type);
30
+ }
31
+
32
+ /**
33
+ * Executes the command
34
+ *
35
+ * @param array $ids product ids
36
+ * @param int $storeId store id
37
+ * @param string $val field value
38
+ * @throws Exception
39
+ * @return string success message if any
40
+ */
41
+ public function execute($ids, $storeId, $val)
42
+ {
43
+ $this->_errors = array();
44
+
45
+ $hlp = Mage::helper('amzerosellers');
46
+ if (!is_array($ids)) {
47
+ throw new Exception($hlp->__('Please select product(s)'));
48
+ }
49
+ if (!strlen($val)) {
50
+ throw new Exception($hlp->__('Please provide the value for the action'));
51
+ }
52
+
53
+ return '';
54
+ }
55
+
56
+ /**
57
+ * Adds the command label to the mass actions list
58
+ *
59
+ * @param Amasty_ZeroSellers_Block_Adminhtml_Purchased_Grid $grid
60
+ * @return Amasty_ZeroSellers_Model_Command_Abstract
61
+ */
62
+ public function addAction($block)
63
+ {
64
+ $hlp = Mage::helper('amzerosellers');
65
+ $storeId = intVal(Mage::app()->getRequest()->getParam('store'));
66
+
67
+ $params = array(
68
+ 'label' => $hlp->__($this->_label),
69
+ 'url' => $block->getParentBlock()->getUrl('adminhtml/amzerosellers/do/command/' . $this->_type . '/store/' . $storeId),
70
+ );
71
+ if($this->_fieldLabel) {
72
+ $params['additional'] = $this->_getValueField($hlp->__($this->_fieldLabel));
73
+ }
74
+ $block->addItem('ampzerosellers_' . $this->_type, $params);
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * Returns value field options for the mass actions block
80
+ *
81
+ * @param string $title field title
82
+ * @return array
83
+ */
84
+ protected function _getValueField($title)
85
+ {
86
+ $field = array('amzerosellers_value' => array(
87
+ 'name' => 'amzerosellers_value',
88
+ 'type' => 'text',
89
+ 'class' => 'required-entry',
90
+ 'label' => $title,
91
+ ));
92
+ return $field;
93
+ }
94
+
95
+ /**
96
+ * Gets list of not critical errors after the command execution
97
+ *
98
+ * @return array
99
+ */
100
+ public function getErrors()
101
+ {
102
+ return $this->_errors;
103
+ }
104
+
105
+ public function getLabel()
106
+ {
107
+ return $this->_label;
108
+ }
109
+
110
+ }
app/code/local/Amasty/ZeroSellers/Model/Command/Addspecial.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) Amasty Ltd. ( http://www.amasty.com/ )
5
+ * @package Amasty_ZeroSellers
6
+ */
7
+ class Amasty_ZeroSellers_Model_Command_Addspecial extends Amasty_ZeroSellers_Model_Command_Modifyprice
8
+ {
9
+ public function __construct($type)
10
+ {
11
+ parent::__construct($type);
12
+ $this->_label = 'Modify Special Price using Price';
13
+ }
14
+
15
+ protected function _prepareQuery($table, $value, $where)
16
+ {
17
+ $where[] = 't.`value` > 0 ';
18
+ $id = Mage::getSingleton('eav/config')
19
+ ->getAttribute('catalog_product', 'special_price')
20
+ ->getAttributeId();
21
+
22
+ $value = str_replace('`value`', 't.`value`', $value);
23
+ $sql = "INSERT INTO $table (entity_type_id, attribute_id , store_id, entity_id, `value`) "
24
+ . " SELECT entity_type_id, $id, store_id, entity_id, $value FROM $table AS t"
25
+ . " WHERE " . join(' AND ', $where)
26
+ . " ON DUPLICATE KEY UPDATE `value` = $value";
27
+
28
+ return $sql;
29
+ }
30
+
31
+ }
app/code/local/Amasty/ZeroSellers/Model/Command/Disable.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) Amasty Ltd. ( http://www.amasty.com/ )
5
+ * @package Amasty_ZeroSellers
6
+ */
7
+ class Amasty_ZeroSellers_Model_Command_Disable extends Amasty_ZeroSellers_Model_Command_Abstract
8
+ {
9
+ public function __construct($type)
10
+ {
11
+ parent::__construct($type);
12
+ $this->_label = 'Disable';
13
+ }
14
+
15
+ /**
16
+ * Executes the command
17
+ *
18
+ * @param array $ids product ids
19
+ * @param int $storeId store id
20
+ * @param string $val field value
21
+ * @return string success message if any
22
+ */
23
+ public function execute($ids, $storeId, $val)
24
+ {
25
+ parent::execute($ids, $storeId, $val ='no_need');
26
+ $disableStatus = 2;
27
+ Mage::getSingleton('catalog/product_action')->updateAttributes($ids, array('status' => $disableStatus), $storeId);
28
+ $success = Mage::helper('amzerosellers')->__("Total of %d product(s) have been disabled.",count($ids));
29
+ return $success;
30
+ }
31
+
32
+ }
app/code/local/Amasty/ZeroSellers/Model/Command/Modifyprice.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) Amasty Ltd. ( http://www.amasty.com/ )
5
+ * @package Amasty_ZeroSellers
6
+ */
7
+ class Amasty_ZeroSellers_Model_Command_Modifyprice extends Amasty_ZeroSellers_Model_Command_Abstract
8
+ {
9
+ public function __construct($type)
10
+ {
11
+ parent::__construct($type);
12
+ $this->_label = 'Update Price';
13
+ $this->_fieldLabel = 'By';
14
+ }
15
+
16
+ /**
17
+ * Executes the command
18
+ *
19
+ * @param array $ids product ids
20
+ * @param int $storeId store id
21
+ * @param string $val field value
22
+ * @return string success message if any
23
+ */
24
+ public function execute($ids, $storeId, $val)
25
+ {
26
+ parent::execute($ids, $storeId, $val);
27
+
28
+ $hlp = Mage::helper('amzerosellers');
29
+
30
+ if (!preg_match('/^[+-][0-9]+(\.[0-9]+)?%?$/', $val)){
31
+ throw new Exception($hlp->__('Please provide the difference as +12.5, -12.5, +12.5% or -12.5%'));
32
+ }
33
+
34
+ $sign = substr($val, 0, 1);
35
+ $val = substr($val, 1);
36
+
37
+ $percent = ('%' == substr($val, -1, 1));
38
+ if ($percent)
39
+ $val = substr($val, 0, -1);
40
+
41
+ $val = floatval($val);
42
+ if ($val < 0.00001){
43
+ throw new Exception($hlp->__('Please provide a non empty difference'));
44
+ }
45
+
46
+ $attrCode = $this->_getAttrCode();
47
+ $this->_updateAttribute($attrCode, $ids, $storeId, array(
48
+ 'sign' => $sign, 'val' => $val, 'percent' => $percent)
49
+ );
50
+
51
+ if (version_compare(Mage::getVersion(), '1.4.1.0') > 0){
52
+ $obj = new Varien_Object();
53
+ $obj->setData(array(
54
+ 'product_ids' => array_unique($ids),
55
+ 'attributes_data' => array($attrCode => true), // known indexers use just keys
56
+ 'store_id' => $storeId,
57
+ ));
58
+ // register mass action indexer event
59
+ Mage::getSingleton('index/indexer')->processEntityAction(
60
+ $obj, Mage_Catalog_Model_Product::ENTITY, Mage_Index_Model_Event::TYPE_MASS_ACTION
61
+ );
62
+ }
63
+
64
+ $success = $hlp->__('Total of %d products(s) have been successfully updated', count($ids));
65
+ return $success;
66
+ }
67
+
68
+ /**
69
+ * Mass update attribute value
70
+ *
71
+ * @param string $attrCode attribute code, price or special price
72
+ * @param array $productIds applied product ids
73
+ * @param int $storeId store id
74
+ * @param array $diff difference data (sign, value, if percentage)
75
+ * @return bool true
76
+ */
77
+ protected function _updateAttribute($attrCode, $productIds, $storeId, $diff)
78
+ {
79
+ $attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', $attrCode);
80
+
81
+ $db = Mage::getSingleton('core/resource')->getConnection('core_write');
82
+ $table = $attribute->getBackend()->getTable();
83
+
84
+ $where = array(
85
+ $db->quoteInto('entity_id IN(?)', $productIds),
86
+ $db->quoteInto('attribute_id=?', $attribute->getAttributeId()),
87
+ );
88
+
89
+ /**
90
+ * If we work in single store mode all values should be saved just
91
+ * for default store id. In this case we clear all not default values
92
+ */
93
+
94
+ $defaultStoreId = Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;
95
+ if (Mage::app()->isSingleStoreMode()) {
96
+ $db->delete($table, join(' AND ', array_merge($where, array(
97
+ $db->quoteInto('store_id <> ?', $defaultStoreId)
98
+ ))));
99
+ }
100
+
101
+ $value = $diff['percent'] ? '`value` * ' . $diff['val'] . '/ 100' : $diff['val'];
102
+ $value = '`value`' . $diff['sign'] . $value;
103
+ $value = 'ROUND(' . $value . ',2)'; // probably we will need change 2 to additional setting
104
+
105
+ $storeIds = array();
106
+ if ($attribute->isScopeStore()) {
107
+ $where[] = $db->quoteInto('store_id = ?', $storeId);
108
+ $storeIds[] = $storeId;
109
+ }
110
+ elseif ($attribute->isScopeWebsite() && $storeId != $defaultStoreId) {
111
+ $storeIds = Mage::app()->getStore($storeId)->getWebsite()->getStoreIds(true);
112
+ $where[] = $db->quoteInto('store_id IN(?)', $storeIds);
113
+ }
114
+ else {
115
+ $where[] = $db->quoteInto('store_id = ?', $defaultStoreId);
116
+ }
117
+
118
+ // in case of store-view or website scope we need to insert default values
119
+ // first, to be able to update them.
120
+ // @todo: Special price can be null in the base store
121
+ if ($storeIds){
122
+ $cond = array(
123
+ $db->quoteInto('t.entity_id IN(?)', $productIds),
124
+ $db->quoteInto('t.attribute_id=?', $attribute->getAttributeId()),
125
+ 't.store_id = ' . $defaultStoreId,
126
+ );
127
+ foreach ($storeIds as $id){
128
+ // copy attr value from global scope if current attr value does not exists.
129
+ $sql = "INSERT IGNORE INTO $table (`entity_type_id`, `attribute_id`, `store_id`, `entity_id`, `value`) "
130
+ . " SELECT t.`entity_type_id`, t.`attribute_id`, $id, t.`entity_id`, t.`value` FROM $table AS t"
131
+ . " WHERE " . join(' AND ', $cond)
132
+ ;
133
+ $db->raw_query($sql);
134
+ }
135
+ }
136
+
137
+ $sql = $this->_prepareQuery($table, $value, $where);
138
+ $db->raw_query($sql);
139
+
140
+ return true;
141
+ }
142
+
143
+ protected function _prepareQuery($table, $value, $where)
144
+ {
145
+ $sql = "UPDATE $table SET `value` = $value WHERE " . join(' AND ', $where);
146
+ return $sql;
147
+ }
148
+
149
+ protected function _getAttrCode()
150
+ {
151
+ return 'price';
152
+ }
153
+
154
+ }
app/code/local/Amasty/ZeroSellers/Model/Command/Modifyspecial.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) Amasty Ltd. ( http://www.amasty.com/ )
5
+ * @package Amasty_ZeroSellers
6
+ */
7
+ class Amasty_ZeroSellers_Model_Command_Modifyspecial extends Amasty_ZeroSellers_Model_Command_Modifyprice
8
+ {
9
+ public function __construct($type)
10
+ {
11
+ parent::__construct($type);
12
+ $this->_label = 'Update Special Price';
13
+ }
14
+
15
+ protected function _getAttrCode()
16
+ {
17
+ return 'special_price';
18
+ }
19
+ }
app/code/local/Amasty/ZeroSellers/Model/Resource/Catalog/Product/Collection.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_ZeroSellers
6
+ */
7
+ class Amasty_ZeroSellers_Model_Resource_Catalog_Product_Collection extends Mage_Catalog_Model_Resource_Product_Collection
8
+ {
9
+
10
+ protected $_qtyOrderedSelectCondition = 'COALESCE(SUM(o_items.qty_ordered),0)';
11
+
12
+ protected function _initSelect()
13
+ {
14
+ parent::_initSelect();
15
+ $this->_addOrderedQty();
16
+ return $this;
17
+ }
18
+
19
+ /**
20
+ * Get SQL for get record count && correct HAVING use.
21
+ *
22
+ * @return Varien_Db_Select
23
+ */
24
+ public function getSelectCountSql()
25
+ {
26
+ $this->_renderFilters();
27
+
28
+ $countSelect = clone $this->getSelect();
29
+ $countSelect->reset(Zend_Db_Select::ORDER);
30
+ $countSelect->reset(Zend_Db_Select::LIMIT_COUNT);
31
+ $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
32
+ $countSelect->reset(Zend_Db_Select::COLUMNS);
33
+
34
+ //add qty_ordered for HAVING condition
35
+ $countSelect->columns($this->_qtyOrderedSelectCondition . ' as qty_ordered');
36
+ $countSelect = 'SELECT COUNT(*) FROM(' . $countSelect . ') final' ;
37
+
38
+ return $countSelect;
39
+ }
40
+
41
+ /**
42
+ * Add product qty to collection.
43
+ *
44
+ * @return $this
45
+ * @throws Mage_Core_Exception
46
+ */
47
+ public function addQty()
48
+ {
49
+ if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
50
+ $this->joinField('qty',
51
+ 'cataloginventory/stock_item',
52
+ 'qty',
53
+ 'product_id=entity_id',
54
+ '{{table}}.stock_id=1',
55
+ 'left');
56
+ }
57
+
58
+ return $this;
59
+ }
60
+
61
+ /**
62
+ * Add aggregated sales/order_item.ordered_qty to collection as qty_ordered.
63
+ *
64
+ * @return $this
65
+ */
66
+ protected function _addOrderedQty()
67
+ {
68
+ $this->_joinOrderedQty($this->getSelect());
69
+ return $this;
70
+ }
71
+
72
+ /**
73
+ * Join ordered_qty.
74
+ *
75
+ * @param Zend_Db_Select This Zend_Db_Select object.
76
+ * @return Zend_Db_Select This Zend_Db_Select object.
77
+ */
78
+ protected function _joinOrderedQty($select)
79
+ {
80
+ $period = MAX((int)Mage::getStoreConfig('amzerosellers/general/period'), 0);
81
+ $select->joinLeft(
82
+ array('o_items' => $this->getTable('sales/order_item')),
83
+ 'e.entity_id = o_items.product_id AND o_items.created_at >= (CURDATE() - INTERVAL '. $period .' DAY)',
84
+ array('qty_ordered' => $this->_qtyOrderedSelectCondition)
85
+ )
86
+ ->group('e.entity_id');
87
+ return $select;
88
+ }
89
+
90
+ /**
91
+ * Retrive all ids for collection && correct HAVING use.
92
+ *
93
+ * @param unknown_type $limit
94
+ * @param unknown_type $offset
95
+ * @return array
96
+ */
97
+ public function getAllIds($limit = null, $offset = null)
98
+ {
99
+ $idsSelect = $this->_getClearSelect();
100
+ $idsSelect->columns('e.' . $this->getEntity()->getIdFieldName());
101
+ $idsSelect->limit($limit, $offset);
102
+ $idsSelect->resetJoinLeft();
103
+
104
+ //add qty_ordered for HAVING condition
105
+ $this->_joinOrderedQty($idsSelect);
106
+
107
+ return $this->getConnection()->fetchCol($idsSelect, $this->_bindParams);
108
+ }
109
+ }
app/code/local/Amasty/ZeroSellers/controllers/Adminhtml/AmzerosellersController.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_ZeroSellers
6
+ */
7
+ class Amasty_ZeroSellers_Adminhtml_AmzerosellersController extends Mage_Adminhtml_Controller_Action
8
+ {
9
+ public function indexAction()
10
+ {
11
+ $this->loadLayout();
12
+ $this->_setActiveMenu('report/products/amzerosellers_purchased');
13
+ if (!Mage::helper('ambase')->isVersionLessThan(1,4)){
14
+ $this
15
+ ->_title($this->__('Reports'))
16
+ ->_title($this->__('Products'))
17
+ ->_title($this->__('Zero Sellers'));
18
+ }
19
+ $this->_addBreadcrumb($this->__('Products'), $this->__('Zero Sellers'));
20
+ $block = $this->getLayout()->createBlock('amzerosellers/adminhtml_purchased');
21
+ $this->_addContent($block);
22
+ $this->renderLayout();
23
+ return $this;
24
+ }
25
+
26
+ public function doAction()
27
+ {
28
+ $commandType = trim($this->getRequest()->getParam('command'));
29
+ if (Mage::getSingleton('admin/session')->isAllowed('report/products/amzerosellers_purchased/' . $commandType)) {
30
+ $productIds = $this->getRequest()->getParam('product_id');
31
+ $val = $this->getRequest()->getParam('amzerosellers_value');
32
+ $storeId = (int)$this->getRequest()->getParam('store', 0);
33
+
34
+ if (is_array($val)) {
35
+ $val = implode(',', $val);
36
+ } else {
37
+ $val = trim($val);
38
+ }
39
+
40
+ try {
41
+ $command = Amasty_ZeroSellers_Model_Command_Abstract::factory($commandType);
42
+
43
+ $success = $command->execute($productIds, $storeId, $val);
44
+ if ($success) {
45
+ $this->_getSession()->addSuccess($success);
46
+ }
47
+
48
+ // show non critical erroes to the user
49
+ foreach ($command->getErrors() as $err) {
50
+ $this->_getSession()->addError($err);
51
+ }
52
+ } catch (Exception $e) {
53
+ $this->_getSession()->addError($this->__('Error: %s', $e->getMessage()));
54
+ }
55
+
56
+ } else {
57
+ $this->_getSession()->addError($this->__('Access denied.'));
58
+ }
59
+ $this->_redirectReferer();
60
+ return $this;
61
+ }
62
+
63
+ public function exportCsvAction()
64
+ {
65
+ $fileName = 'zerosellers_report.csv';
66
+ $grid = $this->getLayout()->createBlock('amzerosellers/adminhtml_purchased_grid');
67
+ $fileInfo = $grid->getCsvFile();
68
+
69
+ //ensure BOM is included for correctly opening a file in some MS EXCEL versions
70
+ $bom = chr(239) . chr(187) . chr(191);
71
+ $utf8 = $bom . file_get_contents($fileInfo['value']);
72
+ file_put_contents($fileInfo['value'], $utf8);
73
+
74
+ $this->_prepareDownloadResponse($fileName, $fileInfo);
75
+ }
76
+
77
+ public function exportExcelAction()
78
+ {
79
+ $fileName = 'zerosellers_report.xml';
80
+ $grid = $this->getLayout()->createBlock('amzerosellers/adminhtml_purchased_grid');
81
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
82
+ }
83
+
84
+ public function gridAction()
85
+ {
86
+ $this->loadLayout();
87
+ $this->getResponse()->setBody(
88
+ $this->getLayout()->createBlock('amzerosellers/adminhtml_purchased_grid')->toHtml()
89
+ );
90
+ }
91
+
92
+ protected function _isAllowed()
93
+ {
94
+ return Mage::getSingleton('admin/session')->isAllowed('report/products/amzerosellers_purchased');
95
+ }
96
+ }
app/code/local/Amasty/ZeroSellers/etc/adminhtml.xml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Amasty Team
5
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
6
+ * @package Amasty_ZeroSellers
7
+ */
8
+ -->
9
+ <!--
10
+ Copyright (c) 2010 Amasty (http://www.amasty.com)
11
+ -->
12
+ <config>
13
+ <menu>
14
+ <report>
15
+ <children>
16
+ <products>
17
+ <children>
18
+ <amzerosellers_purchased translate="title" module="amzerosellers">
19
+ <title>Zero Sellers</title>
20
+ <action>adminhtml/amzerosellers</action>
21
+ <sort_order>10</sort_order>
22
+ </amzerosellers_purchased>
23
+ </children>
24
+ </products>
25
+ </children>
26
+ </report>
27
+ </menu>
28
+
29
+ <acl>
30
+ <resources>
31
+ <all>
32
+ <title>Allow Everything</title>
33
+ </all>
34
+ <admin>
35
+ <children>
36
+ <report>
37
+ <children>
38
+ <products>
39
+ <children>
40
+ <amzerosellers_purchased translate="title" module="amzerosellers">
41
+ <title>Zero Sellers</title>
42
+ <children>
43
+ <addspecial translate="title">
44
+ <title>Modify Special Price using Price</title>
45
+ </addspecial>
46
+ <modifyspecial translate="title">
47
+ <title>Update Special Price</title>
48
+ </modifyspecial>
49
+ <disable translate="title">
50
+ <title>Disable Product</title>
51
+ </disable>
52
+ </children>
53
+ </amzerosellers_purchased>
54
+ </children>
55
+ </products>
56
+ </children>
57
+ </report>
58
+ <system>
59
+ <children>
60
+ <config>
61
+ <children>
62
+ <amzerosellers translate="title" module="amzerosellers">
63
+ <title>Amasty - Zero Sellers</title>
64
+ </amzerosellers>
65
+ </children>
66
+ </config>
67
+ </children>
68
+ </system>
69
+ </children>
70
+ </admin>
71
+ </resources>
72
+ </acl>
73
+ </config>
app/code/local/Amasty/ZeroSellers/etc/config.xml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Amasty Team
5
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
6
+ * @package Amasty_ZeroSellers
7
+ */
8
+ -->
9
+ <!--
10
+ Copyright (c) 2012 Amasty (http://www.amasty.com)
11
+ -->
12
+ <config>
13
+ <modules>
14
+ <Amasty_ZeroSellers>
15
+ <version>1.0.0</version>
16
+ </Amasty_ZeroSellers>
17
+ </modules>
18
+
19
+ <global>
20
+ <blocks>
21
+ <amzerosellers>
22
+ <class>Amasty_ZeroSellers_Block</class>
23
+ </amzerosellers>
24
+ </blocks>
25
+ <models>
26
+ <amzerosellers>
27
+ <class>Amasty_ZeroSellers_Model</class>
28
+ </amzerosellers>
29
+ </models>
30
+ <helpers>
31
+ <amzerosellers>
32
+ <class>Amasty_ZeroSellers_Helper</class>
33
+ </amzerosellers>
34
+ </helpers>
35
+ </global>
36
+
37
+ <admin>
38
+ <routers>
39
+ <adminhtml>
40
+ <args>
41
+ <modules>
42
+ <Amasty_ZeroSellers after="Mage_Adminhtml">Amasty_ZeroSellers_Adminhtml</Amasty_ZeroSellers>
43
+ </modules>
44
+ </args>
45
+ </adminhtml>
46
+ </routers>
47
+ </admin>
48
+
49
+ <default>
50
+ <amzerosellers>
51
+ <general>
52
+ <period>30</period>
53
+ <threshold>0</threshold>
54
+ </general>
55
+ </amzerosellers>
56
+ </default>
57
+ </config>
app/code/local/Amasty/ZeroSellers/etc/system.xml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Amasty Team
5
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
6
+ * @package Amasty_ZeroSellers
7
+ */
8
+ -->
9
+ <config>
10
+ <sections>
11
+ <amzerosellers translate="label" module="amzerosellers">
12
+ <label>Zero Sellers</label>
13
+ <tab>amasty</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>160115</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <general translate="label">
21
+ <label>General</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>10</sort_order>
24
+ <sort_order>1</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ <fields>
29
+ <period translate="label comment">
30
+ <label>Period in Days</label>
31
+ <frontend_type>text</frontend_type>
32
+ <validate>validate-digits validate-zero-or-greater required-entry</validate>
33
+ <sort_order>10</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>0</show_in_store>
37
+ <comment>0 for today only</comment>
38
+ </period>
39
+ <threshold translate="label comment">
40
+ <label>Threshold</label>
41
+ <frontend_type>text</frontend_type>
42
+ <validate>validate-digits validate-zero-or-greater required-entry</validate>
43
+ <sort_order>20</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>0</show_in_store>
47
+ <comment>Show products purchased not more times than specified in this field</comment>
48
+ </threshold>
49
+ </fields>
50
+ </general>
51
+ </groups>
52
+ </amzerosellers>
53
+ </sections>
54
+ </config>
app/design/adminhtml/default/default/layout/amasty/ambase/ambase.xml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Amasty Team
5
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
6
+ * @package Amasty_Base
7
+ */
8
+ -->
9
+ <layout>
10
+ <adminhtml_system_config_edit>
11
+ <reference name="head">
12
+ <action method="addCss">
13
+ <name>css/amasty/ambase/style.css</name>
14
+ </action>
15
+ <action method="addJs">
16
+ <name>amasty/ambase/store.js</name>
17
+ </action>
18
+ </reference>
19
+ </adminhtml_system_config_edit>
20
+ <adminhtml_ambase_base_ajax>
21
+ <reference name="root">
22
+ <action method="setTemplate">
23
+ <template>empty.phtml</template>
24
+ </action>
25
+ </reference>
26
+ </adminhtml_ambase_base_ajax>
27
+ <default>
28
+ <reference name="root">
29
+ <reference name="notifications">
30
+ <block type="ambase/adminhtml_promo" name="ampromo" as="ampromo" after="messages" template="amasty/ambase/promo.phtml"></block>
31
+ </reference>
32
+
33
+ <reference name="content">
34
+ <block type="ambase/adminhtml_update" name="amupdate" as="amupdate" template="amasty/ambase/update.phtml"></block>
35
+ </reference>
36
+
37
+ </reference>
38
+ </default>
39
+ </layout>
app/design/adminhtml/default/default/template/amasty/ambase/debug/conflict.phtml ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ ?>
8
+ <?php
9
+ $conflictsList = $this->getPossibleConflictsList();
10
+ foreach($conflictsList as $objectKey => $objectsList){
11
+ ?>
12
+ <div class="ambase-debug-header"><?php echo ucfirst($objectKey);?></div>
13
+ <div class="ambase-debug-section">
14
+ <table cellspacing="0">
15
+ <?php
16
+ foreach($objectsList as $moduleKey => $conflicts) {
17
+ if (isset($conflicts["rewrite"]))
18
+ foreach($conflicts["rewrite"] as $rewriteKey => $rewrites){
19
+ $codePool = $conflicts["codePool"][$rewriteKey];
20
+
21
+ ;
22
+
23
+ ?>
24
+ <tr>
25
+ <td><?php
26
+ echo uc_words($moduleKey, " ") . " ";
27
+ echo uc_words($rewriteKey, " ");
28
+ // foreach(explode("_", $rewriteKey) as $rewritePartKey){
29
+ // echo ucfirst($rewritePartKey) . " ";
30
+ // }
31
+ ?></td>
32
+ <td>
33
+ <?php
34
+ foreach($rewrites as $rewriteIndex => $rewrite){
35
+ $rewriteParts = explode("_", $rewrite);
36
+
37
+ foreach(array_slice($rewriteParts, 0, 2) as $rewritePart){
38
+ echo ucfirst($rewritePart) . " ";
39
+ }
40
+ echo "<br/>";
41
+ }
42
+
43
+
44
+ ?>
45
+ </td>
46
+ <td>
47
+ <?php
48
+
49
+
50
+ if ($this->hasConflict($rewrites)){
51
+
52
+ if ( ! $this->conflictResolved($codePool, $rewrites)){
53
+ ?>
54
+ <button type="button" class="scalable save" onclick="document.location.href='<?php echo $this->getFixUrl($objectKey, $moduleKey, $rewriteKey); ?>'" style="">
55
+ <span><span><span><?php echo $this->__("Fix")?></span></span></span>
56
+ </button>
57
+ <?php
58
+ } else {
59
+ ?>
60
+ <button type="button" class="scalable" onclick="document.location.href='<?php echo $this->getRollbackUrl($objectKey, $moduleKey, $rewriteKey); ?>'" style="">
61
+ <span><span><span><?php echo $this->__("Rollback")?></span></span></span>
62
+ </button>
63
+ <?php
64
+ }
65
+ $instructionId = uniqid("ambase_instr");
66
+ krsort($rewrites);
67
+ $extends = $rewrites;
68
+
69
+ ?>
70
+ <div onclick="$(<?php print $instructionId?>).toggleClassName('ambase-hidden', true);" class="ambase-show-instruction"><?php echo $this->__("Show instructions")?></div>
71
+ <div class="ambase-instruction ambase-hidden" id="<?php echo $instructionId;?>">
72
+ <ul>
73
+ <?php foreach($rewrites as $rewriteIndex => $rewriteClass){
74
+ unset($extends[$rewriteIndex]);
75
+ $extendsValues = array_values($extends);
76
+
77
+ $parentClasses = Mage::helper("ambase")->getParentClasses($rewriteClass);
78
+ if (count($extendsValues) > 0) {
79
+ ?>
80
+ <li><?php
81
+ echo $this->__("Open file");
82
+ echo "&nbsp;<b>";
83
+ echo $this->getClassPath($rewrites, $codePool, $rewriteIndex);
84
+ echo "</b>";
85
+ ?></li>
86
+ <li><?php
87
+ echo $this->__("Replace");
88
+ echo "&nbsp;<b>" . $parentClasses[0];
89
+ echo "</b>&nbsp;";
90
+ echo $this->__("to");
91
+ echo "&nbsp;<b>" . $extendsValues[0];
92
+ echo "</b>";
93
+ ?></li>
94
+ <?php }
95
+
96
+ }?>
97
+ <li style="text-decoration: underline;"><?php echo $this->__("Clear magento cache and all external caches like APC (if any).")?></li>
98
+ </ul>
99
+ </div>
100
+ <?php
101
+ } else {
102
+ ?>
103
+ <div class="green"><?php echo $this->__("No actions required")?></div>
104
+ <?php
105
+ }
106
+ ?>
107
+ </td>
108
+ </tr>
109
+ <?php
110
+ }
111
+ }
112
+ ?>
113
+ </table>
114
+ </div>
115
+ <?php
116
+ }
117
+ ?>
118
+
app/design/adminhtml/default/default/template/amasty/ambase/debug/event.phtml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+
8
+ $events = $this->getEventsList();
9
+ ?>
10
+
11
+ <div class="ambase-debug-header ambase-debug-header-click" onclick="$('ambase-debug-section-events').toggle();"><?php echo $this->__('Events');?></div>
12
+ <div class="ambase-debug-section" id="ambase-debug-section-events" style="display:none;">
13
+ <table cellspacing="0">
14
+ <?php foreach ($events as $name => $event): ?>
15
+ <tr>
16
+ <td style="padding-right: 10px;"><?php echo $name; ?></td>
17
+ <td>
18
+ <?php foreach ($event as $listener): ?>
19
+ <?php echo $listener['class']; ?> (<?php echo $listener['scope'];?>)
20
+ <div class='ambase-file'>
21
+ <?php echo $this->__('method');?>: <?php echo $listener['method']; ?>
22
+ </div>
23
+ <?php endforeach; ?>
24
+ </td>
25
+ </tr>
26
+ <?php endforeach; ?>
27
+ </table>
28
+ </div>
app/design/adminhtml/default/default/template/amasty/ambase/debug/general.phtml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ ?>
8
+ <div class="ambase-debug-header"><?php echo $this->__("General")?></div>
9
+ <div class="ambase-debug-section">
10
+ <table cellspacing="0">
11
+ <tr>
12
+ <td><?php echo $this->__("Compilation")?></td>
13
+ <td>
14
+ <?php if ($this->isCompilationEnabled()) { ?>
15
+ <span class="red"><?php echo $this->__("On")?></span>
16
+ <?php } else { ?>
17
+ <span class="green"><?php echo $this->__("Off")?></span>
18
+ <?php }?>
19
+ </td>
20
+ </tr>
21
+ <tr>
22
+ <td><?php echo $this->__("Disabled output")?></td>
23
+ <td>
24
+ <?php if (count($this->getDisableModulesOutput()) > 0) {?>
25
+ <div class="red"><?php
26
+ foreach($this->getDisableModulesOutput() as $module){
27
+ echo $module['name']."<br/>";
28
+ }
29
+ ?></div>
30
+ <?php } else { ?>
31
+ <span class="green"><?php echo $this->__("No")?></span>
32
+
33
+ <?php } ?>
34
+ </td>
35
+ </tr>
36
+ <tr>
37
+ <td><?php echo $this->__("Cron")?></td>
38
+ <td><?php
39
+ $crontabConfig = $this->getCrontabConfig();
40
+ if (count($crontabConfig) === 0){
41
+ echo '<div class="red">';
42
+ echo $this->__('No cron jobs found') . "</div>";
43
+ echo "<a target='_blank' href='https://support.amasty.com/index.php?/Knowledgebase/Article/View/72/24/magento-cron'>" . $this->__("Learn more") . "</a>";
44
+ } else {
45
+ ?>
46
+ <table>
47
+ <?php foreach ($crontabConfig as $crontabRow){ ?>
48
+ <tr>
49
+ <td style="padding: 0px 5px;"><?php echo $crontabRow['job_code'];?></td>
50
+ <td style="padding: 0px 5px;"><?php echo $crontabRow['status'];?></td>
51
+ <td style="padding: 0px 5px;"><?php echo $crontabRow['created_at'];?></td>
52
+ </tr>
53
+ <?php }?>
54
+ </table>
55
+
56
+ <?php
57
+
58
+
59
+
60
+
61
+ // if (is_array($crontabConfig)){
62
+ // echo implode("<br/>", $crontabConfig);
63
+ // } else {
64
+ // echo $crontabConfig;
65
+ // }
66
+ }
67
+ ?></td>
68
+ </tr>
69
+ </table>
70
+ </div>
app/design/adminhtml/default/default/template/amasty/ambase/debug/rewrite.phtml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ ?>
8
+ <div class="ambase-debug-header ambase-debug-header-click" onclick="$('ambase-debug-section').toggle();"><?php echo $this->__("Rewrites");?></div>
9
+ <div class="ambase-debug-section" id="ambase-debug-section" style="display:none;">
10
+ <table cellspacing="0">
11
+
12
+
13
+ <?php
14
+ $_finalResult = $this->getRewritesList();
15
+ foreach(array_keys($_finalResult) as $groupType) {
16
+
17
+ foreach(array_keys($_finalResult[$groupType]) as $key) {
18
+ // remove some repeating elements after merging all parents
19
+ foreach($_finalResult[$groupType][$key]['rewrite'] as $key1 => $value) {
20
+ $codePool = $_finalResult[$groupType][$key]["codePool"][$key1];
21
+
22
+ $_classes = array();
23
+ if(is_array($value)) {
24
+ $_classes = array_unique($value);
25
+ } else {
26
+ $value = array($value);
27
+ $_classes = $value;
28
+ $codePool = array($codePool);
29
+ }
30
+ ?>
31
+ <tr>
32
+ <td><?php
33
+ echo uc_words($key, " ") . " ";
34
+ echo uc_words($key1, " ");
35
+ ?></td>
36
+ <td>
37
+ <?php
38
+ foreach($_classes as $_class){
39
+ $_index = array_search($_class, $value);
40
+
41
+ $_classParts = explode("_", $_class);
42
+
43
+ foreach(array_slice($_classParts, 0, 2) as $classPart){
44
+ echo ucfirst($classPart) . " ";
45
+
46
+ }
47
+ echo "<div class='ambase-file'>";
48
+ echo $this->getClassPath($value, $codePool, $_index);
49
+ echo "</div>";
50
+
51
+
52
+ }
53
+ ?>
54
+ </td>
55
+ </tr>
56
+ <?php
57
+ }
58
+ }
59
+ }
60
+ ?>
61
+ </table>
62
+ </div>
app/design/adminhtml/default/default/template/amasty/ambase/promo.phtml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ ?>
8
+ <?php
9
+ $notification = $this->getLatestNotification();
10
+
11
+ if ($notification) {
12
+
13
+ $closeUrl = $this->getCloseUrl();
14
+ $unsubscribeUrl = $this->getUnsubscribeUrl();
15
+
16
+ ?>
17
+ <div class="notification-global" id="amasty-update-notification">
18
+ <strong class="label"><?php echo $this->__("Latest Message:")?></strong>&nbsp;<?php echo $notification->getTitle()?>
19
+
20
+ <?php if($notification->getUrl()) {?>
21
+ &nbsp;<a href="<?php echo $notification->getUrl();?>" onclick="this.target='_blank';"><?php echo $this->__("Read details")?></a>
22
+ <?php }?>
23
+
24
+ <span class="f-right">
25
+ <a href="#" onclick="Effect.toggle('amasty-update-notification', 'blind', { duration: 0.1 });new Ajax.Request('<?php echo $closeUrl;?>', {
26
+ onCreate: function(request) {
27
+ Ajax.Responders.unregister(varienLoaderHandler.handler);
28
+ },
29
+ onSuccess: function(transport) {
30
+ Ajax.Responders.register(varienLoaderHandler.handler);
31
+ }
32
+ }); return false;"><?php echo $this->__("Close")?></a>&nbsp;|&nbsp;<a style="color: #A3A3A3;" href="<?php echo $unsubscribeUrl;?>"><?php echo $this->__("Unsubscribe")?></a>
33
+ </span>
34
+ </div>
35
+
36
+ <?php }?>
app/design/adminhtml/default/default/template/amasty/ambase/update.phtml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Amasty Team
4
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
5
+ * @package Amasty_Base
6
+ */
7
+ ?>
8
+ <?php
9
+ if ($this->isNewVersionAvailable())
10
+ {
11
+
12
+ $closeUrl = $this->getCloseUrl();
13
+ $unsubscribeUrl = $this->getUnsubscribeUrl();
14
+ ?>
15
+ <div id="amasty-promo-notification">
16
+ <ul class="messages">
17
+ <li class="notice-msg">
18
+ <ul>
19
+ <li>
20
+
21
+ <?php echo $this->__("New version %s is available for the %s by Amasty", $this->getLatestVersion(), $this->getModuleTitle())?>.&nbsp;<?php echo $this->__("See")?>&nbsp;<a href="<?php echo $this->getModuleLink();?>" onclick="this.target='_blank';"><?php echo $this->__("change-log")?></a>
22
+
23
+ <span class="f-right">
24
+ <a href="#" onclick="Effect.toggle('amasty-promo-notification', 'blind', { duration: 0.1 });new Ajax.Request('<?php echo $closeUrl;?>', {
25
+ onCreate: function(request) {
26
+ Ajax.Responders.unregister(varienLoaderHandler.handler);
27
+ },
28
+ onSuccess: function(transport) {
29
+ Ajax.Responders.register(varienLoaderHandler.handler);
30
+ }
31
+ }); return false;"><?php echo $this->__("Close")?></a>&nbsp;|&nbsp;<a style="color: #A3A3A3;" href="<?php echo $unsubscribeUrl;?>"><?php echo $this->__("Unsubscribe")?></a>
32
+ </span>
33
+
34
+ </li>
35
+ </ul>
36
+ </li>
37
+ </ul>
38
+ </div>
39
+ <?php
40
+ }
41
+ ?>
app/etc/modules/Amasty_Base.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Amasty Team
5
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
6
+ * @package Amasty_Base
7
+ */
8
+ -->
9
+ <config>
10
+ <modules>
11
+ <Amasty_Base>
12
+ <active>true</active>
13
+ <codePool>local</codePool>
14
+ <edition>community</edition>
15
+ </Amasty_Base>
16
+ </modules>
17
+ </config>
app/etc/modules/Amasty_ZeroSellers.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Amasty Team
5
+ * @copyright Copyright (c) 2016 Amasty (https://www.amasty.com)
6
+ * @package Amasty_ZeroSellers
7
+ */
8
+ -->
9
+ <!--
10
+ Copyright (c) 2012 Amasty (http://www.amasty.com)
11
+ -->
12
+ <config>
13
+ <modules>
14
+ <Amasty_ZeroSellers>
15
+ <active>true</active>
16
+ <codePool>local</codePool>
17
+ <edition>community</edition>
18
+ </Amasty_ZeroSellers>
19
+ </modules>
20
+ </config>
app/locale/en_US/Amasty_Base.csv ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Extensions Store","Extensions Store"
2
+ "Amasty Extensions Store","Amasty Extensions Store"
3
+ "Extensions &amp; Notifications","Extensions &amp; Notifications"
4
+ "Installed Extensions","Installed Extensions"
5
+ "Notifications","Notifications"
6
+ "I`d like to be informed by Amasty Updates about","I`d like to be informed by Amasty Updates about"
7
+ "I`d like to be informed by Amasty Promos about","I`d like to be informed by Amasty Promos about"
8
+ "Amasty - Extensions Information","Amasty - Extensions Information"
9
+ "Amasty - Extensions Store","Amasty - Extensions Store"
10
+ "Show","Show"
11
+ "Installed","Installed"
12
+ "Update available","Update available"
13
+ "Output disabled","Output disabled"
14
+ "Fix","Fix"
15
+ "Rollback","Rollback"
16
+ "Show instructions","Show instructions"
17
+ "Open file","Open file"
18
+ "Replace","Replace"
19
+ "to","to"
20
+ "Clear magento cache and all external caches like APC (if any).","Clear magento cache and all external caches like APC (if any)."
21
+ "No actions required","No actions required"
22
+ "General","General"
23
+ "Compilation","Compilation"
24
+ "On","On"
25
+ "Off","Off"
26
+ "Disabled output","Disabled output"
27
+ "No","No"
28
+ "Cron","Cron"
29
+ "No cron jobs found","No cron jobs found"
30
+ "Learn more","Learn more"
31
+ "Rewrites","Rewrites"
32
+ "Latest Message:","Latest Message:"
33
+ "Read details","Read details"
34
+ "Close","Close"
35
+ "Unsubscribe","Unsubscribe"
36
+ "New version %s is available for the %s by Amasty","New version %s is available for the %s by Amasty"
37
+ "See","See"
38
+ "change-log","change-log"
39
+ "Events","Events"
40
+ "method","method"
js/amasty/ambase/store.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ Event.observe(window, 'message', function(e){
2
+ if (e.data.action == 'setHeight')
3
+ {
4
+ var height = e.data.height;
5
+ $('amasty_store').setStyle({height: height+'px'});
6
+ }
7
+ });
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Amasty_ZeroSellersReport</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://amasty.com/license.html">Single Use License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Zero product sales tracker extension for Magento.</summary>
10
+ <description>Add a special 'Zero Sales' report to find out which of your store items are not selling. Sort products by type, status, price and other parameters to keep track of all zero sellers. Modify special price right on the grid to improve your marketing strategy and boost profits.</description>
11
+ <notes>Initial</notes>
12
+ <authors><author><name>Amasty Team</name><user>Amasty</user><email>support@amasty.com</email></author></authors>
13
+ <date>2016-07-25</date>
14
+ <time>09:11:11</time>
15
+ <contents><target name="magelocal"><dir name="Amasty"><dir name="Base"><dir name="Block"><dir name="Adminhtml"><dir name="Debug"><file name="Base.php" hash="d3e0c64c660367ac8f6592270817c746"/><file name="Conflict.php" hash="1540172674a517109ca6efb30b31c112"/><file name="Event.php" hash="a81a67bad90a90f197df6cbc4328bd54"/><file name="General.php" hash="ec560dd3fdd8b4c838df7d56773ddad2"/><file name="Rewrite.php" hash="1fdd2400839ea54ca04957f6aac042ae"/></dir><file name="Promo.php" hash="e4b6353ec5535adea9dc53cc390a2928"/><file name="Update.php" hash="5c366d6d26ef53ebfcd65f072e977791"/></dir><file name="Conflicts.php" hash="088bc65478b0806d2d723b3fe191d07a"/><file name="Extensions.php" hash="700e51dd5975c64843f312f141933ecf"/><file name="Store.php" hash="ef176be3bba817c167b7fb5d3ee1af66"/></dir><dir name="Helper"><file name="Data.php" hash="58de4b56eaffdaf4f63f8da091f75818"/><file name="Module.php" hash="290e53668485c3f198cba6a76968f889"/><file name="Promo.php" hash="2a7c1f0fdaf6ff5aebf18a7658eca3ab"/></dir><dir name="Model"><file name="Conflict.php" hash="9dacc05d7384aa674f05d170831578d1"/><file name="Feed.php" hash="04eb7d0a7fd7d18969b68a119b86131e"/><dir name="Resource"><dir name="Event"><file name="Collection.php" hash="237d9ed1ef57515d7a26c18bc710a24e"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Ambase"><file name="BaseController.php" hash="8f31cdacd8149b57320862fcf124886d"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="35e84ab8231cb745d63773b259d9826f"/><file name="config.xml" hash="4940d65b791f3097f57310a42b43b8ee"/><file name="system.xml" hash="4a0291999496f340c63c46369e7dbe2f"/></dir><dir name="sql"><dir name="ambase_setup"><file name="mysql4-install-1.0.0.php" hash="815186ed787115f37e995ee5ed2097ab"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="ee5f512c8c65579c8d712ee0df6a25ba"/></dir></dir></dir><dir name="ZeroSellers"><dir name="Block"><dir name="Adminhtml"><dir name="Purchased"><file name="Grid.php" hash="76a2cf031bfc7e20f73af6bc0a5cfec3"/><dir name="Renderer"><file name="Website.php" hash="a255cd5139d0df71d8f9077a0defd826"/></dir></dir><file name="Purchased.php" hash="0135381b30b0d1fb291133fb1117f7d6"/></dir></dir><dir name="Helper"><file name="Data.php" hash="a890f0d24b65bbf812f47060e7221fd8"/></dir><dir name="Model"><dir name="Command"><file name="Abstract.php" hash="6032a11e54ebfd8279b0490f5f810458"/><file name="Addspecial.php" hash="c99d169e75cadfdec784fd7364321f32"/><file name="Disable.php" hash="7faf78c14049ac537b1c085da526b10b"/><file name="Modifyprice.php" hash="60b5aafde6a50c9f1af408b128801de9"/><file name="Modifyspecial.php" hash="9a2c200719ca4e69a7f11500b3e7fe81"/></dir><dir name="Resource"><dir name="Catalog"><dir name="Product"><file name="Collection.php" hash="8acf38ff13fa2603a2f480e0d5320a7d"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AmzerosellersController.php" hash="de95bfb054655c75f4a0e3668da11f96"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="bdfe163285cee71c7506877cb60d47cd"/><file name="config.xml" hash="caa0a5c1c1dfe47ef86cd3318714183a"/><file name="system.xml" hash="803b74fb86635f2480b788baeacbe515"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Amasty_Base.xml" hash="0f33549c8caf9592324b4e3f4b30c78b"/><file name="Amasty_ZeroSellers.xml" hash="cbf076d4ce633296ddca749041397726"/></dir></target><target name="mageweb"><dir name="js"><dir name="amasty"><dir name="ambase"><file name="store.js" hash="af39fe63cf0adafe6d2d9b60ac4bdbb4"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="ambase"><file name="amasty.png" hash="df5b432f2a65d397d89fea1087e9fd0f"/><file name="bad.gif" hash="b8379f1ba7ab552ca46b9d5fd0452345"/><file name="ok.gif" hash="a38bc2ee6e116e39c6e2e3013ee50f5e"/><file name="shop.png" hash="810bbb4f3e286627e211d5e6f7190257"/><file name="update.gif" hash="8342e11f7739fcfa25134707f0536ed6"/></dir></dir><dir name="css"><dir name="amasty"><dir name="ambase"><file name="style.css" hash="ecbdd48a8acd42d7aba5896c9029112f"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Amasty_Base.csv" hash="4d08e35129a4994680c81c4f93eee557"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="amasty"><dir name="ambase"><file name="ambase.xml" hash="a9bff5b43587768373afa16d6f3ca369"/></dir></dir></dir><dir name="template"><dir name="amasty"><dir name="ambase"><dir name="debug"><file name="conflict.phtml" hash="a2142e075e8f16c3963c014b4322821a"/><file name="event.phtml" hash="9f140f80753cab8947e86609ecb032f4"/><file name="general.phtml" hash="4ad6cdcc701d1ea012ce9c0511087fb1"/><file name="rewrite.phtml" hash="92c4d945e83b12cb63781aba8b9ea3cd"/></dir><file name="promo.phtml" hash="b3a041cf127c550cebee1076ac7e211d"/><file name="update.phtml" hash="0ca2c2ef95bb0ad6dfdef70d75e9be80"/></dir></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/css/amasty/ambase/style.css ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #amasty_store
2
+ {
3
+ border: none;
4
+ height: 1700px; /* fallback */
5
+ width: 100%;
6
+ }
7
+
8
+ .amasty-store-tab
9
+ {
10
+ position: relative;
11
+ }
12
+
13
+ .amasty-store-tab span:after
14
+ {
15
+ top: 0;
16
+ right: 3px;
17
+ position: absolute;
18
+ content: " ";
19
+ display: block;
20
+ background: url(../../../images/ambase/shop.png) no-repeat;
21
+ width: 55px;
22
+ height: 23px;
23
+ }
24
+
25
+ .ambase-debug-section{
26
+ background: #FFF;
27
+ padding: 10px;
28
+ border: 1px solid #d6d6d6;
29
+ }
30
+
31
+ .ambase-debug-section table td{
32
+ padding: 5px 10px;
33
+ vertical-align: top;
34
+ }
35
+
36
+ .ambase-debug-section .green{
37
+ color: green;
38
+ }
39
+
40
+ .ambase-debug-section .red{
41
+ color: red;
42
+ }
43
+
44
+ .ambase-debug-header{
45
+ font-weight: bold;
46
+ padding: 10px 0px;
47
+ font-size: 1.3em;
48
+ }
49
+
50
+ .ambase-show-instruction{
51
+ color: grey;
52
+ text-decoration: underline;
53
+ cursor: pointer;
54
+ }
55
+
56
+ .ambase-instruction{
57
+ font-size: 0.8em;
58
+ }
59
+
60
+ .ambase-instruction li{
61
+ margin: 0;
62
+ }
63
+
64
+ .ambase-file{
65
+ font-size: 0.8em;
66
+ color: grey;
67
+ }
68
+
69
+ .ambase-debug-header-click{
70
+ text-decoration: underline;
71
+ cursor: pointer;
72
+ }
73
+
74
+ .ambase-hidden{
75
+ visibility: hidden;
76
+ }
skin/adminhtml/default/default/images/ambase/amasty.png ADDED
Binary file
skin/adminhtml/default/default/images/ambase/bad.gif ADDED
Binary file
skin/adminhtml/default/default/images/ambase/ok.gif ADDED
Binary file
skin/adminhtml/default/default/images/ambase/shop.png ADDED
Binary file
skin/adminhtml/default/default/images/ambase/update.gif ADDED
Binary file