Find_Feed - Version 1.0.6

Version Notes

1.0.41

Download this release

Release Info

Developer Magento Core Team
Extension Find_Feed
Version 1.0.6
Comparing to
See all releases


Version 1.0.6

Files changed (27) hide show
  1. app/code/community/Find/Feed/Block/Adminhtml/Edit/Codes.php +64 -0
  2. app/code/community/Find/Feed/Block/Adminhtml/Edit/Codes/Edit/Form.php +124 -0
  3. app/code/community/Find/Feed/Block/Adminhtml/List/Codes.php +53 -0
  4. app/code/community/Find/Feed/Block/Adminhtml/List/Codes/Grid.php +131 -0
  5. app/code/community/Find/Feed/Block/Adminhtml/List/Items.php +51 -0
  6. app/code/community/Find/Feed/Block/Adminhtml/List/Items/Grid.php +183 -0
  7. app/code/community/Find/Feed/Helper/Data.php +69 -0
  8. app/code/community/Find/Feed/Model/Adminhtml/System/Source/Cron/Frequency.php +63 -0
  9. app/code/community/Find/Feed/Model/Adminhtml/System/Source/Cron/Hours.php +50 -0
  10. app/code/community/Find/Feed/Model/Codes.php +43 -0
  11. app/code/community/Find/Feed/Model/Import.php +241 -0
  12. app/code/community/Find/Feed/Model/Mysql4/Codes.php +42 -0
  13. app/code/community/Find/Feed/Model/Mysql4/Codes/Collection.php +55 -0
  14. app/code/community/Find/Feed/Model/Mysql4/Setup.php +36 -0
  15. app/code/community/Find/Feed/Model/Observer.php +92 -0
  16. app/code/community/Find/Feed/controllers/Adminhtml/Codes/GridController.php +161 -0
  17. app/code/community/Find/Feed/controllers/Adminhtml/Items/GridController.php +115 -0
  18. app/code/community/Find/Feed/etc/adminhtml.xml +51 -0
  19. app/code/community/Find/Feed/etc/config.xml +480 -0
  20. app/code/community/Find/Feed/etc/system.xml +128 -0
  21. app/code/community/Find/Feed/sql/find_feed_setup/mysql4-install-0.0.1.php +41 -0
  22. app/code/community/Find/Feed/sql/find_feed_setup/mysql4-upgrade-0.0.1-0.0.2.php +50 -0
  23. app/design/adminhtml/default/find/layout/feed.xml +46 -0
  24. app/design/adminhtml/default/find/template/head/window.phtml +68 -0
  25. app/etc/modules/Find_Feed.xml +35 -0
  26. app/locale/en_US/Find_Feed.csv +44 -0
  27. package.xml +18 -0
app/code/community/Find/Feed/Block/Adminhtml/Edit/Codes.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Attribute map edit codes form container block
30
+ *
31
+ * @category Find
32
+ * @package Find_Feed
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Find_Feed_Block_Adminhtml_Edit_Codes extends Mage_Adminhtml_Block_Widget_Form_Container
36
+ {
37
+ /**
38
+ * Initialize form container
39
+ *
40
+ */
41
+ public function __construct()
42
+ {
43
+ $this->_blockGroup = 'find_feed';
44
+ $this->_controller = 'adminhtml_edit_codes';
45
+
46
+ parent::__construct();
47
+
48
+ $this->_removeButton('back');
49
+ $url = $this->getUrl('*/codes_grid/saveForm');
50
+ $this->_updateButton('save', 'onclick', 'saveNewImportItem(\''.$url.'\')');
51
+ $this->_updateButton('reset', 'label', 'Close');
52
+ $this->_updateButton('reset', 'onclick', 'closeNewImportItem()');
53
+ }
54
+
55
+ /**
56
+ * Return Form Header text
57
+ *
58
+ * @return string
59
+ */
60
+ public function getHeaderText()
61
+ {
62
+ return Mage::helper('find_feed')->__('Import Attribute Map');
63
+ }
64
+ }
app/code/community/Find/Feed/Block/Adminhtml/Edit/Codes/Edit/Form.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Attribute map edit form container block
30
+ *
31
+ * @category Find
32
+ * @package Find_Feed
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Find_Feed_Block_Adminhtml_Edit_Codes_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+ /**
38
+ * Import codes list
39
+ *
40
+ * @return array
41
+ */
42
+ protected function _getImportCodeList()
43
+ {
44
+ $attributes = Mage::getConfig()->getNode(Find_Feed_Model_Import::XML_NODE_FIND_FEED_ATTRIBUTES)->children();
45
+ $result = array();
46
+ foreach ($attributes as $node) {
47
+ $label = trim((string)$node->label);
48
+ if ($label) {
49
+ $result[$label] = $label;
50
+ }
51
+ }
52
+
53
+ return $result;
54
+ }
55
+
56
+ /**
57
+ * Magento entity type list for eav attributes
58
+ *
59
+ * @return array
60
+ */
61
+ protected function _getCatalogEntityType()
62
+ {
63
+ return Mage::getSingleton('eav/config')->getEntityType('catalog_product')->getId();
64
+ }
65
+
66
+
67
+ /**
68
+ * Magento eav attributes list
69
+ *
70
+ * @return array
71
+ */
72
+ protected function _getEavAttributeList()
73
+ {
74
+ $result = array();
75
+ $collection = Mage::getResourceModel('catalog/product_attribute_collection');
76
+ foreach ($collection as $model) {
77
+ $result[$model->getAttributeCode()] = $model->getAttributeCode();
78
+ }
79
+ return $result;
80
+ }
81
+
82
+ /**
83
+ * Prepare form
84
+ *
85
+ * @return Varien_Object
86
+ */
87
+ protected function _prepareForm()
88
+ {
89
+ $form = new Varien_Data_Form(array(
90
+ 'id' => 'import_item_form',
91
+ 'method' => 'post'
92
+ ));
93
+
94
+ $fieldset = $form->addFieldset('generate_fieldset', array(
95
+ 'legend' => Mage::helper('find_feed')->__('Item params')
96
+ ));
97
+ $fieldset->addField('import_code', 'select', array(
98
+ 'label' => Mage::helper('find_feed')->__('Import code'),
99
+ 'name' => 'import_code',
100
+ 'required' => true,
101
+ 'options' => $this->_getImportCodeList()
102
+ ));
103
+ $fieldset->addField('eav_code', 'select', array(
104
+ 'label' => Mage::helper('find_feed')->__('Eav code'),
105
+ 'name' => 'eav_code',
106
+ 'required' => true,
107
+ 'options' => $this->_getEavAttributeList()
108
+ ));
109
+
110
+ $source = Mage::getModel('eav/entity_attribute_source_boolean');
111
+ $isImportedOptions = $source->getOptionArray();
112
+
113
+ $fieldset->addField('is_imported', 'select', array(
114
+ 'label' => Mage::helper('find_feed')->__('Is imported'),
115
+ 'name' => 'is_imported',
116
+ 'value' => 1,
117
+ 'options' => $isImportedOptions
118
+ ));
119
+ $form->setUseContainer(true);
120
+
121
+ $this->setForm($form);
122
+ return parent::_prepareForm();
123
+ }
124
+ }
app/code/community/Find/Feed/Block/Adminhtml/List/Codes.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * TheFind feed attribute map grid container
30
+ *
31
+ * @category Find
32
+ * @package Find_Feed
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Find_Feed_Block_Adminhtml_List_Codes extends Mage_Adminhtml_Block_Widget_Grid_Container
36
+ {
37
+ /**
38
+ * Initialize grid container settings
39
+ *
40
+ */
41
+ public function __construct()
42
+ {
43
+ $this->_blockGroup = 'find_feed';
44
+ $this->_controller = 'adminhtml_list_codes';
45
+ $this->_headerText = Mage::helper('find_feed')->__('Attributes Map');
46
+ $this->_addButtonLabel = Mage::helper('find_feed')->__('Add New');
47
+
48
+ parent::__construct();
49
+
50
+ $url = $this->getUrl('*/codes_grid/editForm');
51
+ $this->_updateButton('add', 'onclick', 'openNewImportWindow(\''.$url.'\');');
52
+ }
53
+ }
app/code/community/Find/Feed/Block/Adminhtml/List/Codes/Grid.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * TheFind feed attribute map Grid
30
+ *
31
+ * @category Find
32
+ * @package Find_Feed
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Find_Feed_Block_Adminhtml_List_Codes_Grid extends Mage_Adminhtml_Block_Widget_Grid
36
+ {
37
+ /**
38
+ * Initialize grid settings
39
+ *
40
+ */
41
+ protected function _construct()
42
+ {
43
+ parent::_construct();
44
+
45
+ $this->setId('find_feed_list_codes');
46
+ $this->setUseAjax(true);
47
+ }
48
+
49
+ /**
50
+ * Prepare codes collection
51
+ *
52
+ * @return Find_Feed_Block_Adminhtml_List_Codes_Grid
53
+ */
54
+ protected function _prepareCollection()
55
+ {
56
+ $collection = Mage::getResourceModel('find_feed/codes_collection');
57
+ $this->setCollection($collection);
58
+ return parent::_prepareCollection();
59
+ }
60
+
61
+ /**
62
+ * Configuration of grid
63
+ *
64
+ * @return $this
65
+ */
66
+ protected function _prepareColumns()
67
+ {
68
+ $this->addColumn('import_code', array(
69
+ 'header'=> Mage::helper('find_feed')->__('Feed code'),
70
+ 'width' => '80px',
71
+ 'type' => 'text',
72
+ 'index' => 'import_code'
73
+ ));
74
+
75
+ $this->addColumn('eav_code', array(
76
+ 'header'=> Mage::helper('find_feed')->__('Eav code'),
77
+ 'width' => '80px',
78
+ 'type' => 'text',
79
+ 'index' => 'eav_code'
80
+ ));
81
+
82
+ $source = Mage::getModel('eav/entity_attribute_source_boolean');
83
+ $isImportedOptions = $source->getOptionArray();
84
+
85
+ $this->addColumn('is_imported', array(
86
+ 'header' => Mage::helper('find_feed')->__('In feed'),
87
+ 'width' => '100px',
88
+ 'index' => 'is_imported',
89
+ 'type' => 'options',
90
+ 'options' => $isImportedOptions
91
+ ));
92
+ return parent::_prepareColumns();
93
+ }
94
+
95
+ /**
96
+ * Prepare massaction
97
+ *
98
+ * @return $this
99
+ */
100
+ protected function _prepareMassaction()
101
+ {
102
+ $this->setMassactionIdField('code_id');
103
+ $this->getMassactionBlock()->setFormFieldName('code_id');
104
+
105
+ $this->getMassactionBlock()->addItem('enable', array(
106
+ 'label' => Mage::helper('find_feed')->__('Import'),
107
+ 'url' => $this->getUrl('*/codes_grid/massEnable'),
108
+ 'selected' => true,
109
+ ));
110
+ $this->getMassactionBlock()->addItem('disable', array(
111
+ 'label' => Mage::helper('find_feed')->__('Not import'),
112
+ 'url' => $this->getUrl('*/codes_grid/massDisable'),
113
+ ));
114
+ $this->getMassactionBlock()->addItem('delete', array(
115
+ 'label' => Mage::helper('find_feed')->__('Delete'),
116
+ 'url' => $this->getUrl('*/codes_grid/delete'),
117
+ ));
118
+
119
+ return $this;
120
+ }
121
+
122
+ /**
123
+ * Return Grid URL for AJAX query
124
+ *
125
+ * @return string
126
+ */
127
+ public function getGridUrl()
128
+ {
129
+ return $this->getUrl('*/codes_grid/grid', array('_current'=>true));
130
+ }
131
+ }
app/code/community/Find/Feed/Block/Adminhtml/List/Items.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * TheFind feed product grid container
30
+ *
31
+ * @category Find
32
+ * @package Find_Feed
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Find_Feed_Block_Adminhtml_List_Items extends Mage_Adminhtml_Block_Widget_Grid_Container
36
+ {
37
+ /**
38
+ * Initialize grid container settings
39
+ *
40
+ */
41
+ public function __construct()
42
+ {
43
+ $this->_blockGroup = 'find_feed';
44
+ $this->_controller = 'adminhtml_list_items';
45
+ $this->_headerText = Mage::helper('find_feed')->__('Product Import');
46
+
47
+ parent::__construct();
48
+
49
+ $this->_removeButton('add');
50
+ }
51
+ }
app/code/community/Find/Feed/Block/Adminhtml/List/Items/Grid.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * TheFind feed product grid container
30
+ *
31
+ * @category Find
32
+ * @package Find_Feed
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Find_Feed_Block_Adminhtml_List_Items_Grid extends Mage_Adminhtml_Block_Widget_Grid
36
+ {
37
+ /**
38
+ * Initialize grid settings
39
+ *
40
+ */
41
+ protected function _construct()
42
+ {
43
+ parent::_construct();
44
+
45
+ $this->setId('find_feed_list_items');
46
+ $this->setDefaultSort('id');
47
+ $this->setUseAjax(true);
48
+ }
49
+
50
+ /**
51
+ * Return Current work store
52
+ *
53
+ * @return Mage_Core_Model_Store
54
+ */
55
+ protected function _getStore()
56
+ {
57
+ return Mage::app()->getStore();
58
+ }
59
+
60
+ /**
61
+ * Prepare product collection
62
+ *
63
+ * @return Find_Feed_Block_Adminhtml_List_Items_Grid
64
+ */
65
+ protected function _prepareCollection()
66
+ {
67
+ $collection = Mage::getModel('catalog/product')->getCollection()
68
+ ->setStore($this->_getStore())
69
+ ->addAttributeToSelect('name')
70
+ ->addAttributeToSelect('sku')
71
+ ->addAttributeToSelect('price')
72
+ ->addAttributeToSelect('attribute_set_id')
73
+ ->addAttributeToSelect('is_imported');
74
+ $this->setCollection($collection);
75
+
76
+ return parent::_prepareCollection();
77
+ }
78
+
79
+ /**
80
+ * Prepare grid columns
81
+ *
82
+ * @return Find_Feed_Block_Adminhtml_List_Items_Grid
83
+ */
84
+ protected function _prepareColumns()
85
+ {
86
+ $this->addColumn('id', array(
87
+ 'header' => Mage::helper('find_feed')->__('ID'),
88
+ 'sortable' => true,
89
+ 'width' => '60px',
90
+ 'index' => 'entity_id'
91
+ ));
92
+
93
+ $this->addColumn('name', array(
94
+ 'header' => Mage::helper('find_feed')->__('Product Name'),
95
+ 'index' => 'name',
96
+ 'column_css_class' => 'name'
97
+ ));
98
+
99
+ $this->addColumn('type', array(
100
+ 'header' => Mage::helper('find_feed')->__('Type'),
101
+ 'width' => '60px',
102
+ 'index' => 'type_id',
103
+ 'type' => 'options',
104
+ 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
105
+ ));
106
+
107
+ $entityTypeId = Mage::helper('find_feed')->getProductEntityType();
108
+ $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
109
+ ->setEntityTypeFilter($entityTypeId)
110
+ ->load()
111
+ ->toOptionHash();
112
+
113
+ $this->addColumn('set_name', array(
114
+ 'header' => Mage::helper('find_feed')->__('Attrib. Set Name'),
115
+ 'width' => '100px',
116
+ 'index' => 'attribute_set_id',
117
+ 'type' => 'options',
118
+ 'options' => $sets,
119
+ ));
120
+
121
+ $this->addColumn('sku', array(
122
+ 'header' => Mage::helper('find_feed')->__('SKU'),
123
+ 'width' => '80px',
124
+ 'index' => 'sku',
125
+ 'column_css_class' => 'sku'
126
+ ));
127
+
128
+ $this->addColumn('price', array(
129
+ 'header' => Mage::helper('find_feed')->__('Price'),
130
+ 'align' => 'center',
131
+ 'type' => 'currency',
132
+ 'currency_code' => $this->_getStore()->getCurrentCurrencyCode(),
133
+ 'rate' => $this->_getStore()->getBaseCurrency()->getRate($this->_getStore()->getCurrentCurrencyCode()),
134
+ 'index' => 'price'
135
+ ));
136
+
137
+ $source = Mage::getModel('eav/entity_attribute_source_boolean');
138
+ $isImportedOptions = $source->getOptionArray();
139
+
140
+ $this->addColumn('is_imported', array(
141
+ 'header' => Mage::helper('find_feed')->__('In feed'),
142
+ 'width' => '100px',
143
+ 'index' => 'is_imported',
144
+ 'type' => 'options',
145
+ 'options' => $isImportedOptions
146
+ ));
147
+
148
+ return parent::_prepareColumns();
149
+ }
150
+
151
+ /**
152
+ * Prepare massaction
153
+ *
154
+ * @return Find_Feed_Block_Adminhtml_List_Items_Grid
155
+ */
156
+ protected function _prepareMassaction()
157
+ {
158
+ $this->setMassactionIdField('entity_id');
159
+ $this->getMassactionBlock()->setFormFieldName('item_id');
160
+
161
+ $this->getMassactionBlock()->addItem('enable', array(
162
+ 'label' => Mage::helper('find_feed')->__('Publish'),
163
+ 'url' => $this->getUrl('*/items_grid/massEnable'),
164
+ 'selected' => true,
165
+ ));
166
+ $this->getMassactionBlock()->addItem('disable', array(
167
+ 'label' => Mage::helper('find_feed')->__('Not publish'),
168
+ 'url' => $this->getUrl('*/items_grid/massDisable'),
169
+ ));
170
+
171
+ return $this;
172
+ }
173
+
174
+ /**
175
+ * Return Grid URL for AJAX query
176
+ *
177
+ * @return string
178
+ */
179
+ public function getGridUrl()
180
+ {
181
+ return $this->getUrl('*/*/grid', array('_current'=>true));
182
+ }
183
+ }
app/code/community/Find/Feed/Helper/Data.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * TheFind feed helper
30
+ *
31
+ * @category Find
32
+ * @package Find_Feed
33
+ */
34
+ class Find_Feed_Helper_Data extends Mage_Core_Helper_Abstract
35
+ {
36
+ /**
37
+ * Checking if some required attributes missed
38
+ *
39
+ * @param array $attributes
40
+ * @return bool
41
+ */
42
+ public function checkRequired($attributes)
43
+ {
44
+ $attributeConfig = Mage::getConfig()->getNode(Find_Feed_Model_Import::XML_NODE_FIND_FEED_ATTRIBUTES);
45
+ $attributeRequired = array();
46
+ foreach ($attributeConfig->children() as $ac) {
47
+ if ((int)$ac->required) {
48
+ $attributeRequired[] = (string)$ac->label;
49
+ }
50
+ }
51
+
52
+ foreach ($attributeRequired as $value) {
53
+ if (!isset($attributes[$value])) {
54
+ return false;
55
+ }
56
+ }
57
+ return true;
58
+ }
59
+
60
+ /**
61
+ * Product entity type
62
+ *
63
+ * @return int
64
+ */
65
+ public function getProductEntityType()
66
+ {
67
+ return Mage::getSingleton('eav/config')->getEntityType('catalog_product')->getId();
68
+ }
69
+ }
app/code/community/Find/Feed/Model/Adminhtml/System/Source/Cron/Frequency.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Source for cron frequency
30
+ *
31
+ * @category Find
32
+ * @package Find_Feed
33
+ */
34
+ class Find_Feed_Model_Adminhtml_System_Source_Cron_Frequency
35
+ {
36
+ const DAILY = 1;
37
+ const WEEKLY = 2;
38
+ const MONTHLY = 3;
39
+ const EVERY_MINUTE = 4;
40
+
41
+ /**
42
+ * Fetch options array
43
+ *
44
+ * @return array
45
+ */
46
+ public function toOptionArray()
47
+ {
48
+ return array(
49
+ array(
50
+ 'label' => 'Daily',
51
+ 'value' => self::DAILY),
52
+ array(
53
+ 'label' => 'Weekly',
54
+ 'value' => self::WEEKLY),
55
+ array(
56
+ 'label' => 'Monthly',
57
+ 'value' => self::MONTHLY),
58
+ array(
59
+ 'label' => 'Every minute',
60
+ 'value' => self::EVERY_MINUTE)
61
+ );
62
+ }
63
+ }
app/code/community/Find/Feed/Model/Adminhtml/System/Source/Cron/Hours.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Source for cron hours
30
+ *
31
+ * @category Find
32
+ * @package Find_Feed
33
+ */
34
+ class Find_Feed_Model_Adminhtml_System_Source_Cron_Hours
35
+ {
36
+
37
+ /**
38
+ * Fetch options array
39
+ *
40
+ * @return array
41
+ */
42
+ public function toOptionArray()
43
+ {
44
+ $hours = array();
45
+ for ($i = 1; $i <= 24; $i++) {
46
+ $hours[] = array('label' => $i, 'value' => $i);
47
+ }
48
+ return $hours;
49
+ }
50
+ }
app/code/community/Find/Feed/Model/Codes.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * TheFind feed attribute map grid container
29
+ *
30
+ * @category Find
31
+ * @package Find_Feed
32
+ */
33
+ class Find_Feed_Model_Codes extends Mage_Core_Model_Abstract
34
+ {
35
+ /**
36
+ * Local constructor
37
+ *
38
+ */
39
+ protected function _construct()
40
+ {
41
+ $this->_init('find_feed/codes');
42
+ }
43
+ }
app/code/community/Find/Feed/Model/Import.php ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * TheFind feed import model
29
+ *
30
+ * @category Find
31
+ * @package Find_Feed
32
+ */
33
+ class Find_Feed_Model_Import extends Mage_Core_Model_Abstract
34
+ {
35
+ const SEPARATOR = "\t";
36
+ const LINE_END = "\r\n";
37
+ const ENCLOSURE = '"';
38
+ const COLLECTION_PAGE_SIZE = 5000;
39
+
40
+ const XML_PATH_SETTINGS_FTP_SERVER = 'feed/settings/ftp_server';
41
+ const XML_PATH_SETTINGS_FTP_USER = 'feed/settings/ftp_user';
42
+ const XML_PATH_SETTINGS_FTP_PASSWORD = 'feed/settings/ftp_password';
43
+ const XML_PATH_SETTINGS_FTP_PATH = 'feed/settings/ftp_path';
44
+ const XML_PATH_SETTINGS_FINDFEED_FILENAME = 'feed/settings/findfeed_filename';
45
+
46
+ const XML_NODE_FIND_FEED_ATTRIBUTES = 'find_feed_attributes';
47
+
48
+ /**
49
+ * Cron action
50
+ */
51
+ public function dispatch()
52
+ {
53
+ $this->processImport();
54
+ }
55
+
56
+ /**
57
+ * TheFind feed process import
58
+ */
59
+ public function processImport()
60
+ {
61
+ $file = $this->_createFile();
62
+ if ($file) {
63
+ $this->_deleteFtpFiles();
64
+ $this->_sendFile($file);
65
+ if (!$this->_deleteFile($file)) {
66
+ Mage::throwException(Mage::helper('find_feed')->__("FTP: Can't delete files"));
67
+ }
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Create temp csv file and write export
73
+ *
74
+ * @return mixed
75
+ */
76
+ protected function _createFile()
77
+ {
78
+ $dir = $this->_getTmpDir();
79
+ $fileName = Mage::getStoreConfig(self::XML_PATH_SETTINGS_FINDFEED_FILENAME);
80
+ if (!$dir || !$fileName) {
81
+ return false;
82
+ }
83
+
84
+ if (!($attributes = $this->_getImportAttributes()) || count($attributes) <= 0) {
85
+ return false;
86
+ }
87
+
88
+ $headers = array_keys($attributes);
89
+
90
+ $file = new Varien_Io_File;
91
+ $file->checkAndCreateFolder($dir);
92
+ $file->cd($dir);
93
+ $file->streamOpen($fileName, 'w+');
94
+ $file->streamLock();
95
+ $file->streamWriteCsv($headers, self::SEPARATOR, self::ENCLOSURE);
96
+
97
+ $productCollectionPrototype = Mage::getResourceModel('catalog/product_collection');
98
+ $productCollectionPrototype->setPageSize(self::COLLECTION_PAGE_SIZE);
99
+ $pageNumbers = $productCollectionPrototype->getLastPageNumber();
100
+ unset($productCollectionPrototype);
101
+
102
+ for ($i = 1; $i <= $pageNumbers; $i++) {
103
+ $productCollection = Mage::getResourceModel('catalog/product_collection');
104
+ $productCollection->addAttributeToSelect($attributes);
105
+ $productCollection->addAttributeToFilter('is_imported', 1);
106
+ $productCollection->setPageSize(self::COLLECTION_PAGE_SIZE);
107
+ $productCollection->setCurPage($i)->load();
108
+ foreach ($productCollection as $product) {
109
+ $attributesRow = array();
110
+ foreach ($attributes as $key => $value) {
111
+ $attributesRow[$key] = $product->getData($value);
112
+ }
113
+ $file->streamWriteCsv($attributesRow, self::SEPARATOR, self::ENCLOSURE);
114
+ }
115
+ unset($productCollection);
116
+ }
117
+
118
+ $file->streamUnlock();
119
+ $file->streamClose();
120
+
121
+ if ($file->fileExists($fileName)) {
122
+ return $fileName;
123
+ }
124
+ return false;
125
+ }
126
+
127
+ /**
128
+ * List import codes (attribute map) model
129
+ *
130
+ * @return mixed
131
+ */
132
+ protected function _getImportAttributes()
133
+ {
134
+ $attributes = Mage::getResourceModel('find_feed/codes_collection')
135
+ ->getImportAttributes();
136
+
137
+ if (!Mage::helper('find_feed')->checkRequired($attributes)) {
138
+ return false;
139
+ }
140
+ return $attributes;
141
+ }
142
+
143
+ /**
144
+ * Send file to remote ftp server
145
+ *
146
+ * @param string $fileName
147
+ */
148
+ protected function _sendFile($fileName)
149
+ {
150
+ $dir = $this->_getTmpDir();
151
+ $ftpServer = Mage::getStoreConfig(self::XML_PATH_SETTINGS_FTP_SERVER);
152
+ $ftpUserName = Mage::getStoreConfig(self::XML_PATH_SETTINGS_FTP_USER);
153
+ $ftpPass = Mage::getStoreConfig(self::XML_PATH_SETTINGS_FTP_PASSWORD);
154
+ $ftpPath = trim(Mage::getStoreConfig(self::XML_PATH_SETTINGS_FTP_PATH), '/');
155
+ if ($ftpPath) {
156
+ $ftpPath = $ftpPath.'/';
157
+ }
158
+
159
+ $ch = curl_init();
160
+ curl_setopt($ch, CURLOPT_URL, 'ftp://'.$ftpUserName.':'.$ftpPass.'@'.$ftpServer.'/'.$ftpPath.$fileName);
161
+ curl_setopt($ch, CURLOPT_UPLOAD, 1);
162
+ curl_setopt($ch, CURLOPT_INFILE, fopen($dir.$fileName, 'r'));
163
+ curl_setopt($ch, CURLOPT_INFILESIZE, filesize($dir.$fileName));
164
+ curl_exec($ch);
165
+ curl_close($ch);
166
+ }
167
+
168
+ /**
169
+ * Delete all files in current feed ftp directory
170
+ *
171
+ * @return bool
172
+ */
173
+ protected function _deleteFtpFiles()
174
+ {
175
+ if (is_callable('ftp_connect')) {
176
+ $ftpServer = Mage::getStoreConfig(self::XML_PATH_SETTINGS_FTP_SERVER);
177
+ $ftpUserName = Mage::getStoreConfig(self::XML_PATH_SETTINGS_FTP_USER);
178
+ $ftpPass = Mage::getStoreConfig(self::XML_PATH_SETTINGS_FTP_PASSWORD);
179
+ $ftpPath = trim(Mage::getStoreConfig(self::XML_PATH_SETTINGS_FTP_PATH), '/');
180
+ if ($ftpPath) {
181
+ $ftpPath = $ftpPath.'/';
182
+ }
183
+
184
+ try {
185
+ $connId = ftp_connect($ftpServer);
186
+
187
+ $loginResult = ftp_login($connId, $ftpUserName, $ftpPass);
188
+ if (!$loginResult) {
189
+ return false;
190
+ }
191
+ ftp_pasv($connId, true);
192
+
193
+ $ftpDir = $ftpPath?$ftpPath:'.';
194
+ $nlist = ftp_nlist($connId, $ftpDir);
195
+ if ($nlist === false) {
196
+ return false;
197
+ }
198
+ foreach ($nlist as $file) {
199
+ if (!preg_match('/\.[xX][mM][lL]$/', $file)) {
200
+ ftp_delete($connId, $file);
201
+ }
202
+ }
203
+
204
+ ftp_close($connId);
205
+ } catch (Exception $e) {
206
+ Mage::log($e->getMessage());
207
+ return false;
208
+ }
209
+ return true;
210
+ } else {
211
+ return false;
212
+ }
213
+ }
214
+
215
+ /**
216
+ * Current tmp directory
217
+ *
218
+ * @return string
219
+ */
220
+ protected function _getTmpDir()
221
+ {
222
+ return Mage::getBaseDir('var') . DS . 'export' . DS . 'find_feed' . DS;
223
+ }
224
+
225
+ /**
226
+ * Delete tmp file
227
+ *
228
+ * @param string $fileName
229
+ * @return true
230
+ */
231
+ protected function _deleteFile($fileName)
232
+ {
233
+ $dir = $this->_getTmpDir();
234
+ $file = new Varien_Io_File;
235
+ if ($file->fileExists($dir . $fileName, true)) {
236
+ $file->cd($dir);
237
+ $file->rm($fileName);
238
+ }
239
+ return true;
240
+ }
241
+ }
app/code/community/Find/Feed/Model/Mysql4/Codes.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Thefind feed codes (attribute map) model
29
+ *
30
+ * @category Find
31
+ * @package Find_Feed
32
+ */
33
+ class Find_Feed_Model_Mysql4_Codes extends Mage_Core_Model_Mysql4_Abstract
34
+ {
35
+ /**
36
+ * Class local constructor
37
+ */
38
+ protected function _construct()
39
+ {
40
+ $this->_init('find_feed/feed_import_codes', 'code_id');
41
+ }
42
+ }
app/code/community/Find/Feed/Model/Mysql4/Codes/Collection.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * TheFind feed codes (attribute map) collection
29
+ *
30
+ * @category Find
31
+ * @package Find_Feed
32
+ */
33
+ class Find_Feed_Model_Mysql4_Codes_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
34
+ {
35
+ /**
36
+ * Local constructor
37
+ *
38
+ */
39
+ protected function _construct()
40
+ {
41
+ $this->_init('find_feed/codes');
42
+ }
43
+
44
+ /**
45
+ * Fetch attributes to import
46
+ *
47
+ * @return array
48
+ */
49
+ public function getImportAttributes()
50
+ {
51
+ $this->addFieldToFilter('is_imported', array('eq' => '1'));
52
+ return $this->_toOptionHash('import_code', 'eav_code');
53
+ }
54
+
55
+ }
app/code/community/Find/Feed/Model/Mysql4/Setup.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Thefind feed module setup
29
+ *
30
+ * @category Find
31
+ * @package Find_Feed
32
+ */
33
+ class Find_Feed_Model_Mysql4_Setup extends Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
34
+ {
35
+ }
36
+
app/code/community/Find/Feed/Model/Observer.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * TheFind feed main observer
29
+ *
30
+ * @category Find
31
+ * @package Find_Feed
32
+ */
33
+ class Find_Feed_Model_Observer
34
+ {
35
+ /**
36
+ * Save system config event
37
+ *
38
+ * @param Varien_Object $observer
39
+ */
40
+ public function saveSystemConfig($observer)
41
+ {
42
+ $store = $observer->getStore();
43
+ $website = $observer->getWebsite();
44
+ $groups['settings']['fields']['cron_schedule']['value'] = $this->_getSchedule();
45
+
46
+ Mage::getModel('adminhtml/config_data')
47
+ ->setSection('feed')
48
+ ->setWebsite($website)
49
+ ->setStore($store)
50
+ ->setGroups($groups)
51
+ ->save();
52
+ }
53
+
54
+ /**
55
+ * Transform system settings option to cron schedule string
56
+ *
57
+ * @return string
58
+ */
59
+ protected function _getSchedule()
60
+ {
61
+ $data = Mage::app()->getRequest()->getPost('groups');
62
+
63
+ $frequency = !empty($data['settings']['fields']['cron_frequency']['value'])?
64
+ $data['settings']['fields']['cron_frequency']['value']:
65
+ 0;
66
+ $hours = !empty($data['settings']['fields']['cron_hours']['value'])?
67
+ $data['settings']['fields']['cron_hours']['value']:
68
+ 0;
69
+
70
+ $schedule = "0 $hours ";
71
+
72
+ switch ($frequency) {
73
+ case Find_Feed_Model_Adminhtml_System_Source_Cron_Frequency::DAILY:
74
+ $schedule .= "* * *";
75
+ break;
76
+ case Find_Feed_Model_Adminhtml_System_Source_Cron_Frequency::WEEKLY:
77
+ $schedule .= "* * 1";
78
+ break;
79
+ case Find_Feed_Model_Adminhtml_System_Source_Cron_Frequency::MONTHLY:
80
+ $schedule .= "1 * *";
81
+ break;
82
+ case Find_Feed_Model_Adminhtml_System_Source_Cron_Frequency::EVERY_MINUTE:
83
+ $schedule = "0-59 * * * *";
84
+ break;
85
+ default:
86
+ $schedule .= "* */1 *";
87
+ break;
88
+ }
89
+
90
+ return $schedule;
91
+ }
92
+ }
app/code/community/Find/Feed/controllers/Adminhtml/Codes/GridController.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * TheFind feed attribute map grid controller
29
+ *
30
+ * @category Find
31
+ * @package Find_Feed
32
+ */
33
+ class Find_Feed_Adminhtml_Codes_GridController extends Mage_Adminhtml_Controller_Action
34
+ {
35
+ /**
36
+ * Main index action
37
+ *
38
+ */
39
+ public function indexAction()
40
+ {
41
+ $this->loadLayout();
42
+ $this->renderLayout();
43
+ }
44
+
45
+ /**
46
+ * Grid action
47
+ *
48
+ */
49
+ public function gridAction()
50
+ {
51
+ $this->loadLayout();
52
+ $this->getResponse()->setBody($this->getLayout()->createBlock('find_feed/adminhtml_list_codes_grid')->toHtml());
53
+ }
54
+
55
+ /**
56
+ * Grid edit form action
57
+ *
58
+ */
59
+ public function editFormAction()
60
+ {
61
+ $this->loadLayout();
62
+ $this->getResponse()->setBody($this->getLayout()->createBlock('find_feed/adminhtml_edit_codes')->toHtml());
63
+ }
64
+
65
+ /**
66
+ * Save grid edit form action
67
+ *
68
+ */
69
+ public function saveFormAction()
70
+ {
71
+ $codeId = $this->getRequest()->getParam('code_id');
72
+ $response = new Varien_Object();
73
+ try {
74
+ $model = Mage::getModel('find_feed/codes');
75
+ if ($codeId) {
76
+ $model->load($codeId);
77
+ }
78
+ $model->setImportCode($this->getRequest()->getParam('import_code'));
79
+ $model->setEavCode($this->getRequest()->getParam('eav_code'));
80
+ $model->setIsImported(intval($this->getRequest()->getParam('is_imported')));
81
+ $model->save();
82
+ $response->setError(0);
83
+ } catch(Exception $e) {
84
+ $response->setError(1);
85
+ $response->setMessage('Save error');
86
+ }
87
+ $this->getResponse()->setBody($response->toJson());
88
+ }
89
+
90
+ /**
91
+ * Codes (attribute map) list for mass action
92
+ *
93
+ * @return array
94
+ */
95
+ protected function _getMassActionCodes()
96
+ {
97
+ $idList = $this->getRequest()->getParam('code_id');
98
+ if (!empty($idList)) {
99
+ $codes = array();
100
+ foreach ($idList as $id) {
101
+ $model = Mage::getModel('find_feed/codes');
102
+ if ($model->load($id)) {
103
+ array_push($codes, $model);
104
+ }
105
+ }
106
+ return $codes;
107
+ } else {
108
+ return array();
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Set imported codes (attribute map) mass action
114
+ */
115
+ public function massEnableAction()
116
+ {
117
+ $updatedCodes = 0;
118
+ foreach ($this->_getMassActionCodes() as $code) {
119
+ $code->setIsImported(1);
120
+ $code->save();
121
+ $updatedCodes++;
122
+ }
123
+ if ($updatedCodes > 0) {
124
+ $this->_getSession()->addSuccess(Mage::helper('find_feed')->__("%s codes imported", $updatedCodes));
125
+ }
126
+ $this->_redirect('*/*/index');
127
+ }
128
+
129
+ /**
130
+ * Set not imported codes (attribute map) mass action
131
+ */
132
+ public function massDisableAction()
133
+ {
134
+ $updatedCodes = 0;
135
+ foreach ($this->_getMassActionCodes() as $code) {
136
+ $code->setIsImported(0);
137
+ $code->save();
138
+ $updatedCodes++;
139
+ }
140
+ if ($updatedCodes > 0) {
141
+ $this->_getSession()->addSuccess(Mage::helper('find_feed')->__("%s codes not imported", $updatedCodes));
142
+ }
143
+ $this->_redirect('*/*/index');
144
+ }
145
+
146
+ /**
147
+ * Delete codes (attribute map) mass action
148
+ */
149
+ public function deleteAction()
150
+ {
151
+ $updatedCodes = 0;
152
+ foreach ($this->_getMassActionCodes() as $code) {
153
+ $code->delete();
154
+ $updatedCodes++;
155
+ }
156
+ if ($updatedCodes > 0) {
157
+ $this->_getSession()->addSuccess(Mage::helper('find_feed')->__("%s codes deleted", $updatedCodes));
158
+ }
159
+ $this->_redirect('*/*/index');
160
+ }
161
+ }
app/code/community/Find/Feed/controllers/Adminhtml/Items/GridController.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * TheFind feed product grid controller
29
+ *
30
+ * @category Find
31
+ * @package Find_Feed
32
+ */
33
+ class Find_Feed_Adminhtml_Items_GridController extends Mage_Adminhtml_Controller_Action
34
+ {
35
+ /**
36
+ * Main index action
37
+ */
38
+ public function indexAction()
39
+ {
40
+ $this->loadLayout();
41
+ $this->renderLayout();
42
+ }
43
+
44
+ /**
45
+ * Grid action
46
+ */
47
+ public function gridAction()
48
+ {
49
+ $this->loadLayout();
50
+ $this->getResponse()->setBody($this->getLayout()->createBlock('find_feed/adminhtml_list_items_grid')->toHtml());
51
+ }
52
+
53
+ /**
54
+ * Product list for mass action
55
+ *
56
+ * @return array
57
+ */
58
+ protected function _getMassActionProducts()
59
+ {
60
+ $idList = $this->getRequest()->getParam('item_id');
61
+ if (!empty($idList)) {
62
+ $products = array();
63
+ foreach ($idList as $id) {
64
+ $model = Mage::getModel('catalog/product');
65
+ if ($model->load($id)) {
66
+ array_push($products, $model);
67
+ }
68
+ }
69
+ return $products;
70
+ } else {
71
+ return array();
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Add product to feed mass action
77
+ */
78
+ public function massEnableAction()
79
+ {
80
+ $idList = $this->getRequest()->getParam('item_id');
81
+ $updateAction = Mage::getModel('catalog/product_action');
82
+ $attrData = array(
83
+ 'is_imported' => 1
84
+ );
85
+ $updatedProducts = count($idList);
86
+ if ($updatedProducts) {
87
+ try {
88
+ $updateAction->updateAttributes($idList, $attrData, Mage::app()->getStore()->getId());
89
+ Mage::getModel('find_feed/import')->processImport();
90
+ $this->_getSession()->addSuccess(Mage::helper('find_feed')->__("%s product in feed.", $updatedProducts));
91
+ } catch (Exception $e) {
92
+ $this->_getSession()->addError(Mage::helper('find_feed')->__("Unable to process an import. ") . $e->getMessage());
93
+ }
94
+ }
95
+ $this->_redirect('*/*/index');
96
+ }
97
+
98
+ /**
99
+ * Not add product to feed mass action
100
+ */
101
+ public function massDisableAction()
102
+ {
103
+ $updatedProducts = 0;
104
+ foreach ($this->_getMassActionProducts() as $product) {
105
+ $product->setIsImported(0);
106
+ $product->save();
107
+ $updatedProducts++;
108
+ }
109
+ if ($updatedProducts) {
110
+ Mage::getModel('find_feed/import')->processImport();
111
+ $this->_getSession()->addSuccess(Mage::helper('find_feed')->__("%s product not in feed.", $updatedProducts));
112
+ }
113
+ $this->_redirect('*/*/index');
114
+ }
115
+ }
app/code/community/Find/Feed/etc/adminhtml.xml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Find
23
+ * @package Find_Feed
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <menu>
30
+ <catalog translate="title" module="find_feed">
31
+ <children>
32
+ <feed translate="title" module="find_feed">
33
+ <title>TheFind Feed</title>
34
+ <sort_order>5</sort_order>
35
+ <children>
36
+ <import_products translate="title" module="find_feed">
37
+ <title>Manage Attributes</title>
38
+ <action>adminhtml/codes_grid/index</action>
39
+ <sort_order>5</sort_order>
40
+ </import_products>
41
+ <import_items translate="title" module="find_feed">
42
+ <title>Manage Items</title>
43
+ <action>adminhtml/items_grid/index</action>
44
+ <sort_order>10</sort_order>
45
+ </import_items>
46
+ </children>
47
+ </feed>
48
+ </children>
49
+ </catalog>
50
+ </menu>
51
+ </config>
app/code/community/Find/Feed/etc/config.xml ADDED
@@ -0,0 +1,480 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Find
23
+ * @package Find_Feed
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Find_Feed>
31
+ <version>0.0.2</version>
32
+ </Find_Feed>
33
+ </modules>
34
+ <global>
35
+ <models>
36
+ <find_feed>
37
+ <class>Find_Feed_Model</class>
38
+ <resourceModel>find_feed_mysql4</resourceModel>
39
+ </find_feed>
40
+ <find_feed_mysql4>
41
+ <class>Find_Feed_Model_Mysql4</class>
42
+ <entities>
43
+ <feed_import_codes>
44
+ <table>find_feed_import_codes</table>
45
+ </feed_import_codes>
46
+ </entities>
47
+ </find_feed_mysql4>
48
+ </models>
49
+ <resources>
50
+ <find_feed_setup>
51
+ <setup>
52
+ <module>Find_Feed</module>
53
+ <class>Find_Feed_Model_Mysql4_Setup</class>
54
+ </setup>
55
+ </find_feed_setup>
56
+ </resources>
57
+ <blocks>
58
+ <find_feed><class>Find_Feed_Block</class></find_feed>
59
+ </blocks>
60
+ <helpers>
61
+ <find_feed>
62
+ <class>Find_Feed_Helper</class>
63
+ </find_feed>
64
+ </helpers>
65
+ </global>
66
+ <adminhtml>
67
+ <events>
68
+ <admin_system_config_changed_section_feed>
69
+ <observers>
70
+ <find_feed>
71
+ <class>find_feed/observer</class>
72
+ <method>saveSystemConfig</method>
73
+ </find_feed>
74
+ </observers>
75
+ </admin_system_config_changed_section_feed>
76
+ </events>
77
+ <acl>
78
+ <resources>
79
+ <admin>
80
+ <children>
81
+ <system>
82
+ <children>
83
+ <config>
84
+ <children>
85
+ <feed>
86
+ <title>Feed</title>
87
+ </feed>
88
+ </children>
89
+ </config>
90
+ </children>
91
+ </system>
92
+ </children>
93
+ </admin>
94
+ </resources>
95
+ </acl>
96
+ </adminhtml>
97
+ <crontab>
98
+ <jobs>
99
+ <find_feed_file_send>
100
+ <schedule>
101
+ <config_path>feed/settings/cron_schedule</config_path>
102
+ </schedule>
103
+ <run>
104
+ <model>find_feed/import::dispatch</model>
105
+ </run>
106
+ </find_feed_file_send>
107
+ </jobs>
108
+ </crontab>
109
+ <admin>
110
+ <routers>
111
+ <adminhtml>
112
+ <args>
113
+ <modules>
114
+ <find_feed before="Mage_Adminhtml">Find_Feed_Adminhtml</find_feed>
115
+ </modules>
116
+ </args>
117
+ </adminhtml>
118
+ </routers>
119
+ </admin>
120
+ <stores>
121
+ <admin>
122
+ <design>
123
+ <theme>
124
+ <default>find</default>
125
+ </theme>
126
+ </design>
127
+ </admin>
128
+ </stores>
129
+ <adminhtml>
130
+ <layout>
131
+ <updates>
132
+ <find_feed>
133
+ <file>feed.xml</file>
134
+ </find_feed>
135
+ </updates>
136
+ </layout>
137
+ </adminhtml>
138
+ <find_feed_attributes>
139
+ <title>
140
+ <required>1</required>
141
+ <label>Title</label>
142
+ </title>
143
+ <description>
144
+ <required>1</required>
145
+ <label>Description</label>
146
+ </description>
147
+ <price>
148
+ <required>1</required>
149
+ <label>Price</label>
150
+ </price>
151
+ <page_url>
152
+ <required>1</required>
153
+ <label>Page_Url</label>
154
+ </page_url>
155
+ <image_link>
156
+ <required>1</required>
157
+ <label>Image_Link</label>
158
+ </image_link>
159
+ <sku>
160
+ <required>0</required>
161
+ <label>SKU</label>
162
+ </sku>
163
+ <upc_ean>
164
+ <required>0</required>
165
+ <labe>UPC-EAN</labe>
166
+ </upc_ean>
167
+ <mpn>
168
+ <required>0</required>
169
+ <label>MPN</label>
170
+ </mpn>
171
+ <isbn>
172
+ <required>0</required>
173
+ <label>ISBN</label>
174
+ </isbn>
175
+ <unique_id>
176
+ <required>0</required>
177
+ <label>Unique_ID</label>
178
+ </unique_id>
179
+ <style_id>
180
+ <required>0</required>
181
+ <label>Style_ID</label>
182
+ </style_id>
183
+ <style_name>
184
+ <required>0</required>
185
+ <label>Style_Name</label>
186
+ </style_name>
187
+ <sale>
188
+ <required>0</required>
189
+ <label>Sale</label>
190
+ </sale>
191
+ <sale_price>
192
+ <required>0</required>
193
+ <label>Sale_Price</label>
194
+ </sale_price>
195
+ <shipping_cost>
196
+ <required>0</required>
197
+ <label>Shipping_Cost</label>
198
+ </shipping_cost>
199
+ <free_shipping>
200
+ <required>0</required>
201
+ <label>Free_Shipping</label>
202
+ </free_shipping>
203
+ <online_only>
204
+ <required>0</required>
205
+ <label>Online_Only</label>
206
+ </online_only>
207
+ <qty>
208
+ <required>0</required>
209
+ <label>Stock_Quantity</label>
210
+ </qty>
211
+ <user_rating>
212
+ <required>0</required>
213
+ <label>User_Rating</label>
214
+ </user_rating>
215
+ <user_review_link>
216
+ <required>0</required>
217
+ <label>User_Review_Link</label>
218
+ </user_review_link>
219
+ <brand>
220
+ <required>0</required>
221
+ <label>Brand</label>
222
+ </brand>
223
+ <categories>
224
+ <required>0</required>
225
+ <label>Categories</label>
226
+ </categories>
227
+ <color>
228
+ <required>0</required>
229
+ <label>Color</label>
230
+ </color>
231
+ <compatible_with>
232
+ <required>0</required>
233
+ <label>Compatible_Wirth</label>
234
+ </compatible_with>
235
+ <condition>
236
+ <required>0</required>
237
+ <label>Condition</label>
238
+ </condition>
239
+ <coupons>
240
+ <required>0</required>
241
+ <label>Coupons</label>
242
+ </coupons>
243
+ <made_in>
244
+ <required>0</required>
245
+ <label>Made_In</label>
246
+ </made_in>
247
+ <model>
248
+ <required>0</required>
249
+ <label>Model</label>
250
+ </model>
251
+ <model_number>
252
+ <required>0</required>
253
+ <label>Model_Number</label>
254
+ </model_number>
255
+ <similar_to>
256
+ <required>0</required>
257
+ <label>Similar_To</label>
258
+ </similar_to>
259
+ <tags>
260
+ <required>0</required>
261
+ <label>Tags-Keywords</label>
262
+ </tags>
263
+ <unit_qty>
264
+ <required>0</required>
265
+ <label>Unit_Quantity</label>
266
+ </unit_qty>
267
+ <video_link>
268
+ <required>0</required>
269
+ <label>Video_Link</label>
270
+ </video_link>
271
+ <video_title>
272
+ <required>0</required>
273
+ <label>Video_Title</label>
274
+ </video_title>
275
+ <weight>
276
+ <required>0</required>
277
+ <label>Weight</label>
278
+ </weight>
279
+ <actors>
280
+ <required>0</required>
281
+ <label>Actors</label>
282
+ </actors>
283
+ <age_range>
284
+ <required>0</required>
285
+ <label>Age_Range</label>
286
+ </age_range>
287
+ <artist>
288
+ <required>0</required>
289
+ <label>Artist</label>
290
+ </artist>
291
+ <aspect_ratio>
292
+ <reuired>0</reuired>
293
+ <label>Aspect_Ratio</label>
294
+ </aspect_ratio>
295
+ <author>
296
+ <required>0</required>
297
+ <label>Author</label>
298
+ </author>
299
+ <battery_life>
300
+ <required>0</required>
301
+ <label>Battery_Life</label>
302
+ </battery_life>
303
+ <binding>
304
+ <required>0</required>
305
+ <label>Binding</label>
306
+ </binding>
307
+ <capacity>
308
+ <required>0</required>
309
+ <label>Capasity</label>
310
+ </capacity>
311
+ <color_output>
312
+ <required>0</required>
313
+ <label>Color_Output</label>
314
+ </color_output>
315
+ <department>
316
+ <required>0</required>
317
+ <label>Department</label>
318
+ </department>
319
+ <director>
320
+ <required>0</required>
321
+ <label>Directior</label>
322
+ </director>
323
+ <display_type>
324
+ <required>0</required>
325
+ <label>Display_Type</label>
326
+ </display_type>
327
+ <edition>
328
+ <required>0</required>
329
+ <label>Edition</label>
330
+ </edition>
331
+ <focus_type>
332
+ <required>0</required>
333
+ <label>Focus_Type</label>
334
+ </focus_type>
335
+ <format>
336
+ <required>0</required>
337
+ <label>Format</label>
338
+ </format>
339
+ <genre>
340
+ <required>0</required>
341
+ <label>Genre</label>
342
+ </genre>
343
+ <heel_height>
344
+ <required>0</required>
345
+ <label>Heel_Height</label>
346
+ </heel_height>
347
+ <height>
348
+ <required>0</required>
349
+ <label>Height</label>
350
+ </height>
351
+ <insallation>
352
+ <required>0</required>
353
+ <label>Installation</label>
354
+ </insallation>
355
+ <length>
356
+ <required>0</required>
357
+ <label>Length</label>
358
+ </length>
359
+ <load_type>
360
+ <required>0</required>
361
+ <label>Load_Type</label>
362
+ </load_type>
363
+ <material>
364
+ <required>0</required>
365
+ <label>Material</label>
366
+ </material>
367
+ <media_rating>
368
+ <required>0</required>
369
+ <label>Media_Rating</label>
370
+ </media_rating>
371
+ <megapixels>
372
+ <required>0</required>
373
+ <label>Megapixels</label>
374
+ </megapixels>
375
+ <memory_card_slot>
376
+ <required>0</required>
377
+ <label>Memory_Card_Slot</label>
378
+ </memory_card_slot>
379
+ <occasion>
380
+ <required>0</required>
381
+ <label>Occasion</label>
382
+ </occasion>
383
+ <optical_drive>
384
+ <required>0</required>
385
+ <label>Optical_Drive</label>
386
+ </optical_drive>
387
+ <pages>
388
+ <required>0</required>
389
+ <label>Pages</label>
390
+ </pages>
391
+ <gaming_platform>
392
+ <required>0</required>
393
+ <label>Gaming_Platform</label>
394
+ </gaming_platform>
395
+ <processor_speed>
396
+ <required>0</required>
397
+ <label>Processor_Speed</label>
398
+ </processor_speed>
399
+ <publisher>
400
+ <required>0</required>
401
+ <label>Publisher</label>
402
+ </publisher>
403
+ <recommended_usage>
404
+ <required>0</required>
405
+ <label>Recommended_Usage</label>
406
+ </recommended_usage>
407
+ <screen_resolution>
408
+ <required>0</required>
409
+ <label>Screen_Resolution</label>
410
+ </screen_resolution>
411
+ <sales_rank>
412
+ <required>0</required>
413
+ <label>Sales_Rank</label>
414
+ </sales_rank>
415
+ <screen_size>
416
+ <required>0</required>
417
+ <label>Screen_Size</label>
418
+ </screen_size>
419
+ <shoe_width>
420
+ <required>0</required>
421
+ <label>Shoe_Width</label>
422
+ </shoe_width>
423
+ <sizes>
424
+ <required>0</required>
425
+ <label>Sizes</label>
426
+ </sizes>
427
+ <sizes_in_stock>
428
+ <required>0</required>
429
+ <label>Sizes_in_Stock</label>
430
+ </sizes_in_stock>
431
+ <subject>
432
+ <required>0</required>
433
+ <label>Subject</label>
434
+ </subject>
435
+ <tech_spec_link>
436
+ <required>0</required>
437
+ <label>Tech_Spec_Link</label>
438
+ </tech_spec_link>
439
+ <width>
440
+ <required>0</required>
441
+ <label>Width</label>
442
+ </width>
443
+ <wireless_interface>
444
+ <required>0</required>
445
+ <label>Wireless_Interface</label>
446
+ </wireless_interface>
447
+ <year>
448
+ <required>0</required>
449
+ <label>Year</label>
450
+ </year>
451
+ <zoom>
452
+ <required>0</required>
453
+ <label>Zoom</label>
454
+ </zoom>
455
+ <alt_image_1>
456
+ <required>0</required>
457
+ <label>Alt_Image_1</label>
458
+ </alt_image_1>
459
+ <alt_image_2>
460
+ <required>0</required>
461
+ <label>Alt_Image_2</label>
462
+ </alt_image_2>
463
+ <alt_image_3>
464
+ <required>0</required>
465
+ <label>Alt_Image_3</label>
466
+ </alt_image_3>
467
+ <option_1>
468
+ <required>0</required>
469
+ <label>Option_1</label>
470
+ </option_1>
471
+ <option_2>
472
+ <required>0</required>
473
+ <label>Option_2</label>
474
+ </option_2>
475
+ <option_3>
476
+ <required>0</required>
477
+ <label>Option_3</label>
478
+ </option_3>
479
+ </find_feed_attributes>
480
+ </config>
app/code/community/Find/Feed/etc/system.xml ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Find
23
+ * @package Find_Feed
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <tabs>
30
+ <find translate="label" module="find_feed">
31
+ <label>The Find</label>
32
+ <sort_order>300</sort_order>
33
+ </find>
34
+ </tabs>
35
+ <sections>
36
+ <feed translate="label" module="find_feed">
37
+ <label>Feed</label>
38
+ <tab>find</tab>
39
+ <sort_order>10</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ <groups>
44
+ <settings translate="label">
45
+ <label>Settings</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>200</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ <fields>
52
+ <name translate="label">
53
+ <label>FTP Settings</label>
54
+ </name>
55
+ <ftp_server translate="label">
56
+ <label>FTP Server</label>
57
+ <frontend_type>text</frontend_type>
58
+ <sort_order>10</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </ftp_server>
63
+ <ftp_path translate="label">
64
+ <label>FTP Path</label>
65
+ <frontend_type>text</frontend_type>
66
+ <sort_order>15</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ </ftp_path>
71
+ <ftp_user translate="label comment">
72
+ <label>FTP User</label>
73
+ <frontend_type>text</frontend_type>
74
+ <sort_order>20</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ <comment><![CDATA[In order to access your FTP account information, you must first register and verify your store in TheFind Merchant Center. Click <a href="https://merchant.thefind.com/mc/claim.fhtml">here</a> to get started.]]></comment>
79
+ </ftp_user>
80
+ <ftp_password translate="label">
81
+ <label>FTP Password</label>
82
+ <frontend_type>password</frontend_type>
83
+ <sort_order>30</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ </ftp_password>
88
+ <findfeed_filename translate="label">
89
+ <label>TheFind Feed Filename</label>
90
+ <frontend_type>text</frontend_type>
91
+ <sort_order>30</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ </findfeed_filename>
96
+ <findfeed_update translate="label">
97
+ <sort_order>40</sort_order>
98
+ <label>Update TheFind Item when Product is Updated</label>
99
+ <frontend_type>select</frontend_type>
100
+ <source_model>adminhtml/system_config_source_yesno</source_model>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ </findfeed_update>
105
+ <cron_frequency translate="label comment">
106
+ <label>Cron Frequency</label>
107
+ <frontend_type>select</frontend_type>
108
+ <source_model>find_feed/adminhtml_system_source_cron_frequency</source_model>
109
+ <sort_order>60</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ </cron_frequency>
114
+ <cron_hours translate="label comment">
115
+ <label>Cron Hour</label>
116
+ <frontend_type>select</frontend_type>
117
+ <source_model>find_feed/adminhtml_system_source_cron_hours</source_model>
118
+ <sort_order>70</sort_order>
119
+ <show_in_default>1</show_in_default>
120
+ <show_in_website>1</show_in_website>
121
+ <show_in_store>1</show_in_store>
122
+ </cron_hours>
123
+ </fields>
124
+ </settings>
125
+ </groups>
126
+ </feed>
127
+ </sections>
128
+ </config>
app/code/community/Find/Feed/sql/find_feed_setup/mysql4-install-0.0.1.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ $this->startSetup();
28
+
29
+ $this->run("
30
+
31
+ CREATE TABLE {$this->getTable('find_feed_import_codes')} (
32
+ `code_id` int(10) unsigned NOT NULL auto_increment,
33
+ `import_code` varchar(255) NOT NULL,
34
+ `eav_code` varchar(255) NOT NULL,
35
+ `is_imported` int(10) unsigned NOT NULL,
36
+ PRIMARY KEY (`code_id`)
37
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
38
+
39
+ ");
40
+
41
+ $this->endSetup();
app/code/community/Find/Feed/sql/find_feed_setup/mysql4-upgrade-0.0.1-0.0.2.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Find
22
+ * @package Find_Feed
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ $this->startSetup();
28
+
29
+ $this->addAttribute('catalog_product', 'is_imported', array(
30
+ 'group' => 'General',
31
+ 'type' => 'int',
32
+ 'input' => 'select',
33
+ 'label' => 'In feed',
34
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
35
+ 'visible' => 1,
36
+ 'required' => 0,
37
+ 'visible_on_front' => 0,
38
+ 'is_html_allowed_on_front' => 0,
39
+ 'is_configurable' => 0,
40
+ 'source' => 'eav/entity_attribute_source_boolean',
41
+ 'searchable' => 0,
42
+ 'filterable' => 0,
43
+ 'comparable' => 0,
44
+ 'unique' => false,
45
+ 'user_defined' => false,
46
+ 'is_user_defined' => false,
47
+ 'used_in_product_listing' => true
48
+ ));
49
+
50
+ $this->endSetup();
app/design/adminhtml/default/find/layout/feed.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category design
23
+ * @package default_find
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+
29
+ <layout>
30
+ <adminhtml_codes_grid_index>
31
+ <reference name="head">
32
+ <action method="addItem"><type>js</type><name>prototype/window.js</name></action>
33
+ <action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
34
+ <action method="addItem"><type>js_css</type><name>prototype/windows/themes/magento.css</name></action>
35
+ </reference>
36
+ <reference name="content">
37
+ <block type="core/template" template="head/window.phtml" name="head.window" />
38
+ <block type="find_feed/adminhtml_list_codes" name="adminhtml_list_codes" />
39
+ </reference>
40
+ </adminhtml_codes_grid_index>
41
+ <adminhtml_items_grid_index>
42
+ <reference name="content">
43
+ <block type="find_feed/adminhtml_list_items" name="adminhtml_list_items_grid" />
44
+ </reference>
45
+ </adminhtml_items_grid_index>
46
+ </layout>
app/design/adminhtml/default/find/template/head/window.phtml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_find
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <script type="text/javascript">
28
+ function openNewImportWindow(url) {
29
+ dialog_import_window = Dialog.info('', {
30
+ draggable:true,
31
+ resizable:true,
32
+ closable:true,
33
+ className:"magento",
34
+ windowClassName:"popup-window",
35
+ title:"New import item",
36
+ top:50,
37
+ width:950,
38
+ height:575,
39
+ zIndex:10,
40
+ recenterAuto:false,
41
+ hideEffect:Element.hide,
42
+ showEffect:Element.show,
43
+ id:"new-import"
44
+ });
45
+ new Ajax.Updater($$('#new-import_content #modal_dialog_message')[0], url, {evalScripts: true});
46
+ }
47
+
48
+ function saveNewImportItem(url)
49
+ {
50
+ new Ajax.Request(url, {
51
+ parameters: $('import_item_form').serialize(true),
52
+ onSuccess: function(response) {
53
+ var json = response.responseText.evalJSON();
54
+ if (json) {
55
+ dialog_import_window.close();
56
+ if (typeof(find_feed_list_codesJsObject) == 'object') {
57
+ find_feed_list_codesJsObject.reload();
58
+ }
59
+ }
60
+ }
61
+ });
62
+ }
63
+
64
+ function closeNewImportItem()
65
+ {
66
+ dialog_import_window.close();
67
+ }
68
+ </script>
app/etc/modules/Find_Feed.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Find
23
+ * @package Find_Feed
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Find_Feed>
31
+ <active>true</active>
32
+ <codePool>community</codePool>
33
+ </Find_Feed>
34
+ </modules>
35
+ </config>
app/locale/en_US/Find_Feed.csv ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "%s codes deleted","%s codes deleted"
2
+ "%s codes imported","%s codes imported"
3
+ "%s codes not imported","%s codes not imported"
4
+ "%s product in feed.","%s product in feed."
5
+ "%s product not in feed.","%s product not in feed."
6
+ "Add New","Add New"
7
+ "Attrib. Set Name","Attrib. Set Name"
8
+ "Attributes Map","Attributes Map"
9
+ "Cron Frequency","Cron Frequency"
10
+ "Cron Hour","Cron Hour"
11
+ "Delete","Delete"
12
+ "Eav code","Eav code"
13
+ "FTP Password","FTP Password"
14
+ "FTP Path","FTP Path"
15
+ "FTP Server","FTP Server"
16
+ "FTP Settings","FTP Settings"
17
+ "FTP User","FTP User"
18
+ "FTP: Can't delete files","FTP: Can't delete files"
19
+ "Feed","Feed"
20
+ "Feed code","Feed code"
21
+ "ID","ID"
22
+ "Import","Import"
23
+ "Import Attribute Map","Import Attribute Map"
24
+ "Import code","Import code"
25
+ "In feed","In feed"
26
+ "In order to access your FTP account information, you must first register and verify your store in TheFind Merchant Center. Click <a href=""https://merchant.thefind.com/mc/claim.fhtml"">here</a> to get started.","In order to access your FTP account information, you must first register and verify your store in TheFind Merchant Center. Click <a href=""https://merchant.thefind.com/mc/claim.fhtml"">here</a> to get started."
27
+ "Is imported","Is imported"
28
+ "Item params","Item params"
29
+ "Manage Attributes","Manage Attributes"
30
+ "Manage Items","Manage Items"
31
+ "Not import","Not import"
32
+ "Not publish","Not publish"
33
+ "Price","Price"
34
+ "Product Import","Product Import"
35
+ "Product Name","Product Name"
36
+ "Publish","Publish"
37
+ "SKU","SKU"
38
+ "Settings","Settings"
39
+ "The Find","The Find"
40
+ "TheFind Feed Filename","TheFind Feed Filename"
41
+ "TheFind Feed","TheFind Feed"
42
+ "Type","Type"
43
+ "Unable to process an import. ","Unable to process an import. "
44
+ "Update TheFind Item when Product is Updated","Update TheFind Item when Product is Updated"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Find_Feed</name>
4
+ <version>1.0.6</version>
5
+ <stability>stable</stability>
6
+ <license>mixed</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Integration with TheFind shopping engine</summary>
10
+ <description>Current integration includes managing product feeds from Magento store to TheFind, mapping of Magento Attributes to TheFind structure.</description>
11
+ <notes>1.0.41</notes>
12
+ <authors><author><name>Magento Core Team</name><user>auto-converted</user><email>eeadmin@magentocommerce.com</email></author></authors>
13
+ <date>2010-08-18</date>
14
+ <time>13:48:11</time>
15
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="find"><dir name="layout"><file name="feed.xml" hash="74469083c4d9485dcbafd7409d828542"/></dir><dir name="template"><dir name="head"><file name="window.phtml" hash="b055c4955de1f603928aa2988b99b158"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Find_Feed.csv" hash="d13c2438f31913423d1e74bd98298034"/></dir></target><target name="magecommunity"><dir name="Find"><dir name="Feed"><dir name="Block"><dir name="Adminhtml"><dir name="Edit"><dir name="Codes"><dir name="Edit"><file name="Form.php" hash="4aa1336d9648c10692cc5d4d37b88cb4"/></dir></dir><file name="Codes.php" hash="40c2928a46c9352927d93882944e482c"/></dir><dir name="List"><dir name="Codes"><file name="Grid.php" hash="5a196798c6672b4b1245b4216bd0a3d6"/></dir><dir name="Items"><file name="Grid.php" hash="2d8389a3972a7b6774e842e4fb941c58"/></dir><file name="Codes.php" hash="3c6a052e7dbc3356aba2a7777d6845f3"/><file name="Items.php" hash="4e12802b5fa30dc7f80f5bfcd6aa515e"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Codes"><file name="GridController.php" hash="8f30b8c3a43745ce6bd9b1f8a8bf5759"/></dir><dir name="Items"><file name="GridController.php" hash="336eb0939e35e1206c6ffadb03f7a987"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d14298da125c3718a6003d304b6d75c7"/><file name="config.xml" hash="5a7005d6ebbb8686581c99df486b9db2"/><file name="system.xml" hash="2ba2baba6137fca4886eb8c6a64fdc9c"/></dir><dir name="Helper"><file name="Data.php" hash="2dc788cdff15161c0d32ae12e1b53369"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="d828f96f82321538d21eb150f50509e7"/><file name="Hours.php" hash="27fe6c65c7f8610363bfc009d3b0475f"/></dir></dir></dir></dir><dir name="Mysql4"><dir name="Codes"><file name="Collection.php" hash="d7b8bcd8b9d8603517d61b22b1877434"/></dir><file name="Codes.php" hash="219ca82f1a636c0d1d5e7a330654762b"/><file name="Setup.php" hash="9ceadb63c6cad10a1261b8ef00ae18b6"/></dir><file name="Codes.php" hash="fccdc26d340b2c2402442e35a1a616b7"/><file name="Import.php" hash="319a17cc4b688f0688bb4bee7551a98f"/><file name="Observer.php" hash="7f1652ed621c677dbaf2e373508de3e3"/></dir><dir name="sql"><dir name="find_feed_setup"><file name="mysql4-install-0.0.1.php" hash="17a1710a9a60f5a3bc3d417ff9760751"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="ddf3c9d15a73a7f51a5fb3714a8b29f7"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Find_Feed.xml" hash="a75332e3ae92f4b253aca19e60f8c15c"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.4.1.1</min><max>1.4.2</max></package></required></dependencies>
18
+ </package>