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
- app/code/community/Find/Feed/Block/Adminhtml/Edit/Codes.php +64 -0
- app/code/community/Find/Feed/Block/Adminhtml/Edit/Codes/Edit/Form.php +124 -0
- app/code/community/Find/Feed/Block/Adminhtml/List/Codes.php +53 -0
- app/code/community/Find/Feed/Block/Adminhtml/List/Codes/Grid.php +131 -0
- app/code/community/Find/Feed/Block/Adminhtml/List/Items.php +51 -0
- app/code/community/Find/Feed/Block/Adminhtml/List/Items/Grid.php +183 -0
- app/code/community/Find/Feed/Helper/Data.php +69 -0
- app/code/community/Find/Feed/Model/Adminhtml/System/Source/Cron/Frequency.php +63 -0
- app/code/community/Find/Feed/Model/Adminhtml/System/Source/Cron/Hours.php +50 -0
- app/code/community/Find/Feed/Model/Codes.php +43 -0
- app/code/community/Find/Feed/Model/Import.php +241 -0
- app/code/community/Find/Feed/Model/Mysql4/Codes.php +42 -0
- app/code/community/Find/Feed/Model/Mysql4/Codes/Collection.php +55 -0
- app/code/community/Find/Feed/Model/Mysql4/Setup.php +36 -0
- app/code/community/Find/Feed/Model/Observer.php +92 -0
- app/code/community/Find/Feed/controllers/Adminhtml/Codes/GridController.php +161 -0
- app/code/community/Find/Feed/controllers/Adminhtml/Items/GridController.php +115 -0
- app/code/community/Find/Feed/etc/adminhtml.xml +51 -0
- app/code/community/Find/Feed/etc/config.xml +480 -0
- app/code/community/Find/Feed/etc/system.xml +128 -0
- app/code/community/Find/Feed/sql/find_feed_setup/mysql4-install-0.0.1.php +41 -0
- app/code/community/Find/Feed/sql/find_feed_setup/mysql4-upgrade-0.0.1-0.0.2.php +50 -0
- app/design/adminhtml/default/find/layout/feed.xml +46 -0
- app/design/adminhtml/default/find/template/head/window.phtml +68 -0
- app/etc/modules/Find_Feed.xml +35 -0
- app/locale/en_US/Find_Feed.csv +44 -0
- 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]#x2F;', $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 |