Version Notes
Enjoy it ;)
Download this release
Release Info
Developer | Riccardo Tempesta |
Extension | MSP_Unifeed |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Catalog/Category/Edit/Tab/Feed.php +72 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Template.php +32 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Template/Edit.php +45 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Template/Edit/Form.php +82 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Template/Grid.php +95 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed.php +38 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit.php +56 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Form.php +36 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Categories.php +33 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Ga.php +69 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Ga/After.php +28 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Settings.php +88 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Settings/After.php +51 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tabs.php +58 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Grid.php +184 -0
- app/code/community/MSP/Unifeed/Helper/Data.php +23 -0
- app/code/community/MSP/Unifeed/Model/Eav/Entity/Attribute/Backend/Feed.php +39 -0
- app/code/community/MSP/Unifeed/Model/Feed.php +575 -0
- app/code/community/MSP/Unifeed/Model/Feed/Attribute.php +58 -0
- app/code/community/MSP/Unifeed/Model/Feed/Status.php +45 -0
- app/code/community/MSP/Unifeed/Model/Observer.php +37 -0
- app/code/community/MSP/Unifeed/Model/Product/Feed.php +79 -0
- app/code/community/MSP/Unifeed/Model/Resource/Catalog/Eav/Mysql4/Product/Collection.php +46 -0
- app/code/community/MSP/Unifeed/Model/Resource/Feed.php +32 -0
- app/code/community/MSP/Unifeed/Model/Resource/Feed/Collection.php +37 -0
- app/code/community/MSP/Unifeed/Model/Resource/Template.php +32 -0
- app/code/community/MSP/Unifeed/Model/Resource/Template/Collection.php +37 -0
- app/code/community/MSP/Unifeed/Model/Template.php +50 -0
- app/code/community/MSP/Unifeed/Model/Template/Abstract.php +226 -0
- app/code/community/MSP/Unifeed/Model/Template/Container.php +24 -0
- app/code/community/MSP/Unifeed/Model/Template/Product.php +96 -0
- app/code/community/MSP/Unifeed/Model/Template/Type.php +48 -0
- app/code/community/MSP/Unifeed/Model/Tree.php +137 -0
- app/code/community/MSP/Unifeed/controllers/FeedController.php +270 -0
- app/code/community/MSP/Unifeed/controllers/OutputController.php +94 -0
- app/code/community/MSP/Unifeed/controllers/TemplateController.php +136 -0
- app/code/community/MSP/Unifeed/etc/config.xml +204 -0
- app/code/community/MSP/Unifeed/etc/system.xml +51 -0
- app/code/community/MSP/Unifeed/sql/msp_unifeed_setup/mysql4-install-1.0.0.php +81 -0
- app/design/adminhtml/default/default/layout/msp_unifeed.xml +29 -0
- app/design/adminhtml/default/default/template/msp_unifeed/catalog/category/edit/feed.phtml +38 -0
- app/design/adminhtml/default/default/template/msp_unifeed/edit/categories.phtml +90 -0
- app/design/adminhtml/default/default/template/msp_unifeed/edit/form.phtml +4 -0
- app/design/adminhtml/default/default/template/msp_unifeed/edit/ga/after.phtml +3 -0
- app/design/adminhtml/default/default/template/msp_unifeed/edit/settings/after.phtml +1 -0
- app/etc/modules/MSP_Unifeed.xml +29 -0
- package.xml +18 -0
- shell/unifeed.php +25 -0
app/code/community/MSP/Unifeed/Block/Adminhtml/Catalog/Category/Edit/Tab/Feed.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Catalog_Category_Edit_Tab_Feed
|
22 |
+
extends Mage_Adminhtml_Block_Widget
|
23 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
24 |
+
{
|
25 |
+
public function getTabLabel()
|
26 |
+
{
|
27 |
+
return Mage::helper('msp_unifeed')->__('UniFeed');
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getTabTitle()
|
31 |
+
{
|
32 |
+
return Mage::helper('msp_unifeed')->__('UniFeed');
|
33 |
+
}
|
34 |
+
|
35 |
+
public function canShowTab()
|
36 |
+
{
|
37 |
+
return true;
|
38 |
+
}
|
39 |
+
|
40 |
+
public function isHidden()
|
41 |
+
{
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getCategory()
|
46 |
+
{
|
47 |
+
return Mage::registry('category');
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getStoreId()
|
51 |
+
{
|
52 |
+
return $this->getCategory()->getStoreId();
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getCategoryId()
|
56 |
+
{
|
57 |
+
return $this->getCategory()->getId();
|
58 |
+
}
|
59 |
+
|
60 |
+
protected function hasFeed($feedId)
|
61 |
+
{
|
62 |
+
if (strpos($this->getCategory()->getMspUnifeedIds(), ':'.intval($feedId).':') !== false)
|
63 |
+
return true;
|
64 |
+
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
|
68 |
+
protected function getFeedsCollection()
|
69 |
+
{
|
70 |
+
return Mage::getModel('msp_unifeed/feed')->getResourceCollection()->load();
|
71 |
+
}
|
72 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Template.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Template extends Mage_Adminhtml_Block_Widget_Grid_Container
|
22 |
+
{
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
$this->_blockGroup = 'msp_unifeed';
|
26 |
+
$this->_controller = 'adminhtml_template';
|
27 |
+
$this->_headerText = Mage::helper('msp_unifeed')->__('Templates List');
|
28 |
+
$this->_addButtonLabel = Mage::helper('msp_unifeed')->__('Add New Template');
|
29 |
+
|
30 |
+
parent::__construct();
|
31 |
+
}
|
32 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Template/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Template_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
22 |
+
{
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
$this->_objectId = 'id';
|
27 |
+
$this->_blockGroup = 'msp_unifeed';
|
28 |
+
$this->_controller = 'adminhtml_template';
|
29 |
+
|
30 |
+
$this->_updateButton('save', 'label', Mage::helper('msp_unifeed')->__('Save Template'));
|
31 |
+
$this->_updateButton('delete', 'label', Mage::helper('msp_unifeed')->__('Delete Template'));
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getHeaderText()
|
35 |
+
{
|
36 |
+
if (Mage::registry('msp_unifeed_template_data') && Mage::registry('msp_unifeed_template_data')->getId())
|
37 |
+
{
|
38 |
+
return Mage::helper('msp_unifeed')->__("Edit Template '%s'", $this->htmlEscape(Mage::registry('msp_unifeed_template_data')->getName()));
|
39 |
+
}
|
40 |
+
else
|
41 |
+
{
|
42 |
+
return Mage::helper('msp_unifeed')->__('Add Template');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Template/Edit/Form.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Template_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
22 |
+
{
|
23 |
+
protected function _prepareForm()
|
24 |
+
{
|
25 |
+
$form = new Varien_Data_Form(array(
|
26 |
+
'id' => 'edit_form',
|
27 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
28 |
+
'method' => 'post',
|
29 |
+
));
|
30 |
+
|
31 |
+
$fieldset = $form->addFieldset(
|
32 |
+
'msp_unifeed_template_form',
|
33 |
+
array(
|
34 |
+
'legend' => Mage::helper('msp_unifeed')->__('Template settings')
|
35 |
+
)
|
36 |
+
);
|
37 |
+
|
38 |
+
$fieldset->addField('name', 'text', array(
|
39 |
+
'label' => Mage::helper('msp_unifeed')->__('Template name'),
|
40 |
+
'class' => 'required-entry',
|
41 |
+
'required' => true,
|
42 |
+
'name' => 'template[name]',
|
43 |
+
));
|
44 |
+
|
45 |
+
$fieldset->addField('type', 'select', array(
|
46 |
+
'label' => Mage::helper('msp_unifeed')->__('Type'),
|
47 |
+
'name' => 'template[type]',
|
48 |
+
'class' => 'required-entry',
|
49 |
+
'values' => Mage::getSingleton('msp_unifeed/template_type')->getOptionArray(),
|
50 |
+
));
|
51 |
+
|
52 |
+
$fieldset->addField('template_open', 'textarea', array(
|
53 |
+
'label' => Mage::helper('msp_unifeed')->__('Template Open'),
|
54 |
+
'required' => false,
|
55 |
+
'style' => 'width: 600px',
|
56 |
+
'name' => 'template[template_open]',
|
57 |
+
));
|
58 |
+
|
59 |
+
$fieldset->addField('template_product', 'textarea', array(
|
60 |
+
'label' => Mage::helper('msp_unifeed')->__('Product Template'),
|
61 |
+
'class' => 'required-entry',
|
62 |
+
'required' => true,
|
63 |
+
'style' => 'width: 600px',
|
64 |
+
'name' => 'template[template_product]',
|
65 |
+
));
|
66 |
+
|
67 |
+
$fieldset->addField('template_close', 'textarea', array(
|
68 |
+
'label' => Mage::helper('msp_unifeed')->__('Template Close'),
|
69 |
+
'required' => false,
|
70 |
+
'style' => 'width: 600px',
|
71 |
+
'name' => 'template[template_close]',
|
72 |
+
));
|
73 |
+
|
74 |
+
if (Mage::registry('msp_unifeed_template_data'))
|
75 |
+
$form->setValues(Mage::registry('msp_unifeed_template_data')->getData());
|
76 |
+
|
77 |
+
$form->setUseContainer(true);
|
78 |
+
$this->setForm($form);
|
79 |
+
|
80 |
+
return parent::_prepareForm();
|
81 |
+
}
|
82 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Template/Grid.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Template_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
22 |
+
{
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
$this->setId('templateGrid');
|
27 |
+
$this->_controller = 'msp_unifeed_adm';
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _prepareCollection()
|
31 |
+
{
|
32 |
+
$model = Mage::getModel('msp_unifeed/template');
|
33 |
+
$collection = $model->getCollection();
|
34 |
+
$this->setCollection($collection);
|
35 |
+
|
36 |
+
$this->setDefaultSort('name');
|
37 |
+
$this->setDefaultDir('ASC');
|
38 |
+
$this->setSaveParametersInSession(true);
|
39 |
+
|
40 |
+
return parent::_prepareCollection();
|
41 |
+
}
|
42 |
+
|
43 |
+
protected function _prepareColumns()
|
44 |
+
{
|
45 |
+
$this->addColumn('id', array(
|
46 |
+
'header' => Mage::helper('msp_unifeed')->__('ID'),
|
47 |
+
'align' => 'right',
|
48 |
+
'width' => '50px',
|
49 |
+
'index' => 'msp_unifeed_template_id',
|
50 |
+
));
|
51 |
+
|
52 |
+
$this->addColumn('name', array(
|
53 |
+
'header' => Mage::helper('msp_unifeed')->__('Name'),
|
54 |
+
'align' => 'left',
|
55 |
+
'index' => 'name',
|
56 |
+
'type' => 'text',
|
57 |
+
'truncate' => 50,
|
58 |
+
'escape' => true,
|
59 |
+
));
|
60 |
+
|
61 |
+
$this->addColumn('type', array(
|
62 |
+
'header' => Mage::helper('msp_unifeed')->__('Format Type'),
|
63 |
+
'index' => 'type',
|
64 |
+
'type' => 'options',
|
65 |
+
'options' => Mage::getSingleton('msp_unifeed/template_type')->getHashArray(),
|
66 |
+
));
|
67 |
+
|
68 |
+
$this->addColumn('action',
|
69 |
+
array(
|
70 |
+
'header' => Mage::helper('msp_unifeed')->__('Action'),
|
71 |
+
'width' => '100px',
|
72 |
+
'type' => 'action',
|
73 |
+
'getter' => 'getId',
|
74 |
+
'actions' => array(array(
|
75 |
+
'caption' => Mage::helper('msp_unifeed')->__('Edit'),
|
76 |
+
'url' => array(
|
77 |
+
'base'=>'*/*/edit'
|
78 |
+
),
|
79 |
+
'field' => 'id'
|
80 |
+
)),
|
81 |
+
'filter' => false,
|
82 |
+
'sortable' => false,
|
83 |
+
'index' => 'msp_unifeed',
|
84 |
+
));
|
85 |
+
|
86 |
+
return parent::_prepareColumns();
|
87 |
+
}
|
88 |
+
|
89 |
+
public function getRowUrl($row)
|
90 |
+
{
|
91 |
+
return $this->getUrl('*/*/edit', array(
|
92 |
+
'id' => $row->getId(),
|
93 |
+
));
|
94 |
+
}
|
95 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Unifeed extends Mage_Adminhtml_Block_Widget_Grid_Container
|
22 |
+
{
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
$this->_blockGroup = 'msp_unifeed';
|
26 |
+
$this->_controller = 'adminhtml_unifeed';
|
27 |
+
$this->_headerText = Mage::helper('msp_unifeed')->__('Feeds List');
|
28 |
+
$this->_addButtonLabel = Mage::helper('msp_unifeed')->__('Add New Feed');
|
29 |
+
|
30 |
+
$this->_addButton('rebuild', array(
|
31 |
+
'label' => Mage::helper('msp_unifeed')->__('Rebuild Feeds'),
|
32 |
+
'onclick' => "self.location.href='".$this->getUrl('*/*/rebuild/')."'",
|
33 |
+
'level' => -1
|
34 |
+
));
|
35 |
+
|
36 |
+
parent::__construct();
|
37 |
+
}
|
38 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Unifeed_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
22 |
+
{
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
$this->_objectId = 'id';
|
27 |
+
$this->_blockGroup = 'msp_unifeed';
|
28 |
+
$this->_controller = 'adminhtml_unifeed';
|
29 |
+
|
30 |
+
if (Mage::registry('msp_unifeed_data')->getId())
|
31 |
+
{
|
32 |
+
$this->_addButton('rebuild', array(
|
33 |
+
'label' => Mage::helper('msp_unifeed')->__('Rebuild Feed'),
|
34 |
+
'onclick' => "self.location.href='".$this->getUrl('*/*/rebuild/', array('id' => Mage::registry('msp_unifeed_data')->getId()))."'",
|
35 |
+
'level' => -1
|
36 |
+
));
|
37 |
+
}
|
38 |
+
|
39 |
+
$this->_updateButton('save', 'label', Mage::helper('msp_unifeed')->__('Save Feed'));
|
40 |
+
|
41 |
+
if (Mage::registry('msp_unifeed_data')->getId())
|
42 |
+
$this->_updateButton('delete', 'label', Mage::helper('msp_unifeed')->__('Delete Feed'));
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getHeaderText()
|
46 |
+
{
|
47 |
+
if (Mage::registry('msp_unifeed_data') && Mage::registry('msp_unifeed_data')->getId())
|
48 |
+
{
|
49 |
+
return Mage::helper('msp_unifeed')->__("Edit Feed '%s'", $this->htmlEscape(Mage::registry('msp_unifeed_data')->getName()));
|
50 |
+
}
|
51 |
+
else
|
52 |
+
{
|
53 |
+
return Mage::helper('msp_unifeed')->__('Add Feed');
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Form.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Unifeed_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
22 |
+
{
|
23 |
+
protected function _prepareForm()
|
24 |
+
{
|
25 |
+
$form = new Varien_Data_Form(array(
|
26 |
+
'id' => 'edit_form',
|
27 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
28 |
+
'method' => 'post',
|
29 |
+
));
|
30 |
+
|
31 |
+
$form->setUseContainer(true);
|
32 |
+
$this->setForm($form);
|
33 |
+
|
34 |
+
return parent::_prepareForm();
|
35 |
+
}
|
36 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Categories.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Unifeed_Edit_Tab_Categories extends Mage_Adminhtml_Block_Widget_Container
|
22 |
+
{
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
$this->setTemplate('msp_unifeed/edit/categories.phtml');
|
27 |
+
}
|
28 |
+
|
29 |
+
protected function getTreeUrl()
|
30 |
+
{
|
31 |
+
return $this->getUrl('*/*/json', array('id' => $this->getRequest()->getParam('id')));
|
32 |
+
}
|
33 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Ga.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Unifeed_Edit_Tab_Ga extends Mage_Adminhtml_Block_Widget_Form
|
22 |
+
{
|
23 |
+
protected function _prepareForm()
|
24 |
+
{
|
25 |
+
$form = new Varien_Data_Form();
|
26 |
+
$this->setForm($form);
|
27 |
+
|
28 |
+
$fieldset = $form->addFieldset(
|
29 |
+
'msp_unifeed_form_ga',
|
30 |
+
array(
|
31 |
+
'legend' => Mage::helper('msp_unifeed')->__('Google Analytics Tracking')
|
32 |
+
)
|
33 |
+
);
|
34 |
+
|
35 |
+
$fieldset->addField('ga_source', 'text', array(
|
36 |
+
'label' => Mage::helper('msp_unifeed')->__('Campaign Source'),
|
37 |
+
'name' => 'feed[ga_source]',
|
38 |
+
));
|
39 |
+
|
40 |
+
$fieldset->addField('ga_medium', 'text', array(
|
41 |
+
'label' => Mage::helper('msp_unifeed')->__('Campaign Medium'),
|
42 |
+
'name' => 'feed[ga_medium]',
|
43 |
+
));
|
44 |
+
|
45 |
+
$fieldset->addField('ga_term', 'text', array(
|
46 |
+
'label' => Mage::helper('msp_unifeed')->__('Campaign Term'),
|
47 |
+
'name' => 'feed[ga_term]',
|
48 |
+
));
|
49 |
+
|
50 |
+
$fieldset->addField('ga_content', 'text', array(
|
51 |
+
'label' => Mage::helper('msp_unifeed')->__('Campaign Content'),
|
52 |
+
'name' => 'feed[ga_content]',
|
53 |
+
));
|
54 |
+
|
55 |
+
$fieldset->addField('ga_name', 'text', array(
|
56 |
+
'label' => Mage::helper('msp_unifeed')->__('Campaign Name'),
|
57 |
+
'name' => 'feed[ga_name]',
|
58 |
+
));
|
59 |
+
|
60 |
+
if (Mage::registry('msp_unifeed_data'))
|
61 |
+
$form->setValues(Mage::registry('msp_unifeed_data')->getData());
|
62 |
+
|
63 |
+
$this->setChild('form_after',
|
64 |
+
$this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed_edit_tab_ga_after')
|
65 |
+
);
|
66 |
+
|
67 |
+
return parent::_prepareForm();
|
68 |
+
}
|
69 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Ga/After.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Unifeed_Edit_Tab_Ga_After extends Mage_Adminhtml_Block_Widget
|
22 |
+
{
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
$this->setTemplate('msp_unifeed/edit/ga/after.phtml');
|
27 |
+
}
|
28 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Settings.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Unifeed_Edit_Tab_Settings extends Mage_Adminhtml_Block_Widget_Form
|
22 |
+
{
|
23 |
+
protected function _prepareForm()
|
24 |
+
{
|
25 |
+
$form = new Varien_Data_Form();
|
26 |
+
$this->setForm($form);
|
27 |
+
|
28 |
+
$this->setTemplate('msp_unifeed/edit/form.phtml');
|
29 |
+
|
30 |
+
$fieldset = $form->addFieldset(
|
31 |
+
'msp_unifeed_form_settings',
|
32 |
+
array(
|
33 |
+
'legend' => Mage::helper('msp_unifeed')->__('Feed settings')
|
34 |
+
)
|
35 |
+
);
|
36 |
+
|
37 |
+
$fieldset->addField('code', 'text', array(
|
38 |
+
'label' => Mage::helper('msp_unifeed')->__('Feed Code'),
|
39 |
+
'class' => 'required-entry',
|
40 |
+
'required' => true,
|
41 |
+
'name' => 'feed[code]',
|
42 |
+
'note' => Mage::helper('msp_unifeed')->__('Must contain only standard lowercase characters or numbers (0-9, a-z)')
|
43 |
+
));
|
44 |
+
|
45 |
+
$fieldset->addField('name', 'text', array(
|
46 |
+
'label' => Mage::helper('msp_unifeed')->__('Feed Description'),
|
47 |
+
'class' => 'required-entry',
|
48 |
+
'required' => true,
|
49 |
+
'name' => 'feed[name]',
|
50 |
+
));
|
51 |
+
|
52 |
+
$fieldset->addField('msp_unifeed_template_id', 'select', array(
|
53 |
+
'label' => Mage::helper('msp_unifeed')->__('Template'),
|
54 |
+
'name' => 'feed[msp_unifeed_template_id]',
|
55 |
+
'class' => 'required-entry',
|
56 |
+
'values' => Mage::getSingleton('msp_unifeed/template')->getOptionArray(),
|
57 |
+
));
|
58 |
+
|
59 |
+
$fieldset->addField('store_id', 'select', array(
|
60 |
+
'label' => Mage::helper('msp_unifeed')->__('Store'),
|
61 |
+
'name' => 'feed[store_id]',
|
62 |
+
'class' => 'required-entry',
|
63 |
+
'values' => Mage::getSingleton('adminhtml/system_config_source_store')->toOptionArray(),
|
64 |
+
));
|
65 |
+
|
66 |
+
$fieldset->addField('status', 'select', array(
|
67 |
+
'label' => Mage::helper('msp_unifeed')->__('Status'),
|
68 |
+
'name' => 'feed[status]',
|
69 |
+
'class' => 'required-entry',
|
70 |
+
'values' => Mage::getSingleton('msp_unifeed/feed_status')->getOptionArray(),
|
71 |
+
));
|
72 |
+
|
73 |
+
if (Mage::registry('msp_unifeed_data') && Mage::registry('msp_unifeed_data')->getData())
|
74 |
+
{
|
75 |
+
$data = Mage::registry('msp_unifeed_data')->getData();
|
76 |
+
$form->setValues($data);
|
77 |
+
$this->setChild('form_after',
|
78 |
+
$this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed_edit_tab_settings_after')->setFeedId($data['msp_unifeed_feed_id'])
|
79 |
+
);
|
80 |
+
}
|
81 |
+
else
|
82 |
+
{
|
83 |
+
$form->setValues(array('status' => 1));
|
84 |
+
}
|
85 |
+
|
86 |
+
return parent::_prepareForm();
|
87 |
+
}
|
88 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Settings/After.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Unifeed_Edit_Tab_Settings_After extends Mage_Adminhtml_Block_Widget
|
22 |
+
{
|
23 |
+
protected $_feedId;
|
24 |
+
|
25 |
+
public function __construct()
|
26 |
+
{
|
27 |
+
parent::__construct();
|
28 |
+
$this->setTemplate('msp_unifeed/edit/settings/after.phtml');
|
29 |
+
}
|
30 |
+
|
31 |
+
public function setFeedId($feedId)
|
32 |
+
{
|
33 |
+
$this->_feedId = $feedId;
|
34 |
+
return $this;
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getFeedId()
|
38 |
+
{
|
39 |
+
return $this->_feedId;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getFeedUrl()
|
43 |
+
{
|
44 |
+
$model = Mage::getModel('msp_unifeed/feed')->load($this->getFeedId());
|
45 |
+
|
46 |
+
$url = Mage::app()->getStore($model->getStoreId())->getUrl('msp_unifeed/output/index', array('code' => $model->getCode()));
|
47 |
+
$url = preg_replace("/\?.+$/", '', $url);
|
48 |
+
|
49 |
+
return $url;
|
50 |
+
}
|
51 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tabs.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Unifeed_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
22 |
+
{
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
$this->setId('msp_unifeed_tabs');
|
27 |
+
$this->setDestElementId('edit_form');
|
28 |
+
$this->setTitle(Mage::helper('msp_unifeed')->__('Feed'));
|
29 |
+
}
|
30 |
+
|
31 |
+
public function getFeed()
|
32 |
+
{
|
33 |
+
return Mage::registry('msp_unifeed_data');
|
34 |
+
}
|
35 |
+
|
36 |
+
protected function _beforeToHtml()
|
37 |
+
{
|
38 |
+
$this->addTab('settings_section', array(
|
39 |
+
'label' => Mage::helper('msp_unifeed')->__('Feed Settings'),
|
40 |
+
'title' => Mage::helper('msp_unifeed')->__('Feed Settings'),
|
41 |
+
'content' => $this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed_edit_tab_settings')->toHtml(),
|
42 |
+
));
|
43 |
+
|
44 |
+
$this->addTab('categories', array(
|
45 |
+
'label' => Mage::helper('msp_unifeed')->__('Categories Selection'),
|
46 |
+
'title' => Mage::helper('msp_unifeed')->__('Categories Selection'),
|
47 |
+
'content' => $this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed_edit_tab_categories')->toHtml(),
|
48 |
+
));
|
49 |
+
|
50 |
+
$this->addTab('ga_section', array(
|
51 |
+
'label' => Mage::helper('msp_unifeed')->__('Google Analytics Tracking'),
|
52 |
+
'title' => Mage::helper('msp_unifeed')->__('Google Analytics Tracking'),
|
53 |
+
'content' => $this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed_edit_tab_ga')->toHtml(),
|
54 |
+
));
|
55 |
+
|
56 |
+
return parent::_beforeToHtml();
|
57 |
+
}
|
58 |
+
}
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Grid.php
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Block_Adminhtml_Unifeed_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
22 |
+
{
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
$this->setId('unifeedGrid');
|
27 |
+
$this->_controller = 'msp_unifeedadm';
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _prepareCollection()
|
31 |
+
{
|
32 |
+
$model = Mage::getModel('msp_unifeed/feed');
|
33 |
+
$collection = $model->getCollection();
|
34 |
+
$this->setCollection($collection);
|
35 |
+
|
36 |
+
$this->setDefaultSort('name');
|
37 |
+
$this->setDefaultDir('ASC');
|
38 |
+
$this->setSaveParametersInSession(true);
|
39 |
+
|
40 |
+
return parent::_prepareCollection();
|
41 |
+
}
|
42 |
+
|
43 |
+
public function decorateStatus($value, $row, $column, $isExport)
|
44 |
+
{
|
45 |
+
$class = '';
|
46 |
+
|
47 |
+
if ($row->getBuildStatus() == MSP_Unifeed_Model_Feed::BUILD_STATUS_NOT_READY)
|
48 |
+
{
|
49 |
+
$class = 'critical';
|
50 |
+
$text = $this->__('Not Ready');
|
51 |
+
}
|
52 |
+
elseif ($row->getBuildStatus() == MSP_Unifeed_Model_Feed::BUILD_STATUS_BUILDING)
|
53 |
+
{
|
54 |
+
$class = 'major';
|
55 |
+
$text = $this->__('Building');
|
56 |
+
}
|
57 |
+
elseif ($row->getBuildStatus() == MSP_Unifeed_Model_Feed::BUILD_STATUS_UPDATING)
|
58 |
+
{
|
59 |
+
$class = 'minor';
|
60 |
+
$text = $this->__('Updating');
|
61 |
+
}
|
62 |
+
elseif ($row->getBuildStatus() == MSP_Unifeed_Model_Feed::BUILD_STATUS_MARKED_REBUILD)
|
63 |
+
{
|
64 |
+
$class = 'minor';
|
65 |
+
$text = $this->__('On queue');
|
66 |
+
}
|
67 |
+
else
|
68 |
+
{
|
69 |
+
$class = 'notice';
|
70 |
+
$text = $this->__('Ready');
|
71 |
+
}
|
72 |
+
|
73 |
+
return '<span class="grid-severity-'.$class.'"><span>'.$text.'</span></span>';
|
74 |
+
}
|
75 |
+
|
76 |
+
public function decorateDate($value, $row, $column, $isExport)
|
77 |
+
{
|
78 |
+
$class = '';
|
79 |
+
|
80 |
+
$date = $row->getBuildDate();
|
81 |
+
|
82 |
+
if (!$date)
|
83 |
+
return '';
|
84 |
+
|
85 |
+
return date('Y-m-d H:i', $date);
|
86 |
+
}
|
87 |
+
|
88 |
+
protected function _prepareColumns()
|
89 |
+
{
|
90 |
+
$this->addColumn('id', array(
|
91 |
+
'header' => Mage::helper('msp_unifeed')->__('ID'),
|
92 |
+
'align' => 'right',
|
93 |
+
'width' => '50px',
|
94 |
+
'index' => 'msp_unifeed_feed_id',
|
95 |
+
));
|
96 |
+
|
97 |
+
$this->addColumn('name', array(
|
98 |
+
'header' => Mage::helper('msp_unifeed')->__('Name'),
|
99 |
+
'align' => 'left',
|
100 |
+
'index' => 'name',
|
101 |
+
'type' => 'text',
|
102 |
+
'truncate' => 50,
|
103 |
+
'escape' => true,
|
104 |
+
));
|
105 |
+
|
106 |
+
$this->addColumn('code', array(
|
107 |
+
'header' => Mage::helper('msp_unifeed')->__('Code'),
|
108 |
+
'align' => 'left',
|
109 |
+
'index' => 'code',
|
110 |
+
'type' => 'text',
|
111 |
+
'escape' => true,
|
112 |
+
));
|
113 |
+
|
114 |
+
$this->addColumn('msp_unifeed_template_id', array(
|
115 |
+
'header' => Mage::helper('msp_unifeed')->__('Template'),
|
116 |
+
'index' => 'msp_unifeed_template_id',
|
117 |
+
'type' => 'options',
|
118 |
+
'options' => Mage::getSingleton('msp_unifeed/template')->getHashArray(),
|
119 |
+
));
|
120 |
+
|
121 |
+
$storeHash = array();
|
122 |
+
$storeOptions = Mage::getSingleton('adminhtml/system_config_source_store')->toOptionArray();
|
123 |
+
foreach ($storeOptions as $store)
|
124 |
+
$storeHash[$store['value']] = $store['label'];
|
125 |
+
|
126 |
+
$this->addColumn('store_id', array(
|
127 |
+
'header' => Mage::helper('msp_unifeed')->__('Store'),
|
128 |
+
'index' => 'store_id',
|
129 |
+
'type' => 'options',
|
130 |
+
'options' => $storeHash,
|
131 |
+
));
|
132 |
+
|
133 |
+
$this->addColumn('status', array(
|
134 |
+
'header' => Mage::helper('msp_unifeed')->__('Status'),
|
135 |
+
'index' => 'status',
|
136 |
+
'type' => 'options',
|
137 |
+
'width' => '100px',
|
138 |
+
'options' => Mage::getSingleton('msp_unifeed/feed_status')->getHashArray(),
|
139 |
+
));
|
140 |
+
|
141 |
+
$this->addColumn('build_status', array(
|
142 |
+
'header' => $this->__('Build Status'),
|
143 |
+
'width' => '120',
|
144 |
+
'filter' => false,
|
145 |
+
'align' => 'left',
|
146 |
+
'frame_callback' => array($this, 'decorateStatus')
|
147 |
+
));
|
148 |
+
|
149 |
+
$this->addColumn('build_date', array(
|
150 |
+
'header' => $this->__('Build Date'),
|
151 |
+
'width' => '120',
|
152 |
+
'filter' => false,
|
153 |
+
'align' => 'left',
|
154 |
+
'frame_callback' => array($this, 'decorateDate')
|
155 |
+
));
|
156 |
+
|
157 |
+
$this->addColumn('action',
|
158 |
+
array(
|
159 |
+
'header' => Mage::helper('msp_unifeed')->__('Action'),
|
160 |
+
'width' => '100px',
|
161 |
+
'type' => 'action',
|
162 |
+
'getter' => 'getId',
|
163 |
+
'actions' => array(array(
|
164 |
+
'caption' => Mage::helper('msp_unifeed')->__('Edit'),
|
165 |
+
'url' => array(
|
166 |
+
'base'=>'*/*/edit'
|
167 |
+
),
|
168 |
+
'field' => 'id'
|
169 |
+
)),
|
170 |
+
'filter' => false,
|
171 |
+
'sortable' => false,
|
172 |
+
'index' => 'action',
|
173 |
+
));
|
174 |
+
|
175 |
+
return parent::_prepareColumns();
|
176 |
+
}
|
177 |
+
|
178 |
+
public function getRowUrl($row)
|
179 |
+
{
|
180 |
+
return $this->getUrl('*/*/edit', array(
|
181 |
+
'id' => $row->getId(),
|
182 |
+
));
|
183 |
+
}
|
184 |
+
}
|
app/code/community/MSP/Unifeed/Helper/Data.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Helper_Data extends Mage_Core_Helper_Abstract {
|
22 |
+
|
23 |
+
}
|
app/code/community/MSP/Unifeed/Model/Eav/Entity/Attribute/Backend/Feed.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Eav_Entity_Attribute_Backend_Feed extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract
|
22 |
+
{
|
23 |
+
public function beforeSave($object)
|
24 |
+
{
|
25 |
+
$data = $object->getData($this->getAttribute()->getAttributeCode());
|
26 |
+
if (is_array($data))
|
27 |
+
{
|
28 |
+
$data = array_unique($data);
|
29 |
+
$value = preg_replace('/:+/', ':', ':'.implode(':', $data).':');
|
30 |
+
$object->setData($this->getAttribute()->getAttributeCode(), $value);
|
31 |
+
}
|
32 |
+
else
|
33 |
+
{
|
34 |
+
$object->setData($this->getAttribute()->getAttributeCode(), '');
|
35 |
+
}
|
36 |
+
|
37 |
+
return parent::beforeSave($object);
|
38 |
+
}
|
39 |
+
}
|
app/code/community/MSP/Unifeed/Model/Feed.php
ADDED
@@ -0,0 +1,575 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Feed extends Mage_Core_Model_Abstract
|
22 |
+
{
|
23 |
+
const BUILD_STATUS_NOT_READY = 0;
|
24 |
+
const BUILD_STATUS_BUILDING = 1;
|
25 |
+
const BUILD_STATUS_MARKED_REBUILD = 2;
|
26 |
+
const BUILD_STATUS_UPDATING = 3;
|
27 |
+
const BUILD_STATUS_READY = 4;
|
28 |
+
|
29 |
+
protected $_categoryIdsArray = null;
|
30 |
+
protected $_templateModel = null;
|
31 |
+
protected $_containerFilter = null;
|
32 |
+
protected $_productFilter = null;
|
33 |
+
protected $_categories = array();
|
34 |
+
protected $_fpBuffer = null;
|
35 |
+
|
36 |
+
public function _construct()
|
37 |
+
{
|
38 |
+
parent::_construct();
|
39 |
+
$this->_init('msp_unifeed/feed');
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getTemplate()
|
43 |
+
{
|
44 |
+
if (!$this->_templateModel)
|
45 |
+
$this->_templateModel = Mage::getModel('msp_unifeed/template')->load($this->getMspUnifeedTemplateId());
|
46 |
+
|
47 |
+
return $this->_templateModel;
|
48 |
+
}
|
49 |
+
|
50 |
+
protected function getStore()
|
51 |
+
{
|
52 |
+
return Mage::app()->getStore($this->getStoreId());
|
53 |
+
}
|
54 |
+
|
55 |
+
protected function getUnifeedWorkingPath()
|
56 |
+
{
|
57 |
+
$path = Mage::getBaseDir('var').DS.'unifeed';
|
58 |
+
|
59 |
+
if (!is_dir($path))
|
60 |
+
mkdir($path);
|
61 |
+
|
62 |
+
chmod($path, 0777);
|
63 |
+
|
64 |
+
return $path;
|
65 |
+
}
|
66 |
+
|
67 |
+
protected function getLockFile()
|
68 |
+
{
|
69 |
+
return $this->getUnifeedWorkingPath().DS.'export.lck';
|
70 |
+
}
|
71 |
+
|
72 |
+
protected function getBufferFileName()
|
73 |
+
{
|
74 |
+
if (!$this->getId())
|
75 |
+
return '';
|
76 |
+
|
77 |
+
return $this->getUnifeedWorkingPath().DS.'unifeed-'.$this->getId().'.buf';
|
78 |
+
}
|
79 |
+
|
80 |
+
public function getFinalFileName()
|
81 |
+
{
|
82 |
+
if (!$this->getId())
|
83 |
+
return '';
|
84 |
+
|
85 |
+
return $this->getUnifeedWorkingPath().DS.'unifeed-'.$this->getId().'.exp';
|
86 |
+
}
|
87 |
+
|
88 |
+
protected function getRebuildFileName()
|
89 |
+
{
|
90 |
+
if (!$this->getId())
|
91 |
+
return '';
|
92 |
+
|
93 |
+
return $this->getUnifeedWorkingPath().DS.'unifeed-'.$this->getId().'.reb';
|
94 |
+
}
|
95 |
+
|
96 |
+
protected function getCategoriesCollection()
|
97 |
+
{
|
98 |
+
if (!$this->getId())
|
99 |
+
return null;
|
100 |
+
|
101 |
+
$store = $this->getStore();
|
102 |
+
$collection = Mage::getModel('catalog/category')->getCollection();
|
103 |
+
$collection
|
104 |
+
->setStoreId($store->getId())
|
105 |
+
->addAttributeToSelect('*')
|
106 |
+
->addAttributeToFilter(array(array('attribute'=>'msp_unifeed_ids', 'like'=>"%:".$this->getId().":%")))
|
107 |
+
->load();
|
108 |
+
|
109 |
+
return $collection;
|
110 |
+
}
|
111 |
+
|
112 |
+
protected function getCategoryIdsArray()
|
113 |
+
{
|
114 |
+
if (!$this->getId())
|
115 |
+
return array();
|
116 |
+
|
117 |
+
if (!is_array($this->_categoryIdsArray))
|
118 |
+
{
|
119 |
+
$this->_categoryIdsArray = array();
|
120 |
+
|
121 |
+
$categories = $this->getCategoriesCollection();
|
122 |
+
foreach ($categories as $category)
|
123 |
+
{
|
124 |
+
$this->_categoryIdsArray[] = $category->getId();
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
return $this->_categoryIdsArray;
|
129 |
+
}
|
130 |
+
|
131 |
+
public function getProductsCollection()
|
132 |
+
{
|
133 |
+
if (!$this->getId())
|
134 |
+
return null;
|
135 |
+
|
136 |
+
$store = $this->getStore();
|
137 |
+
$collection = Mage::getModel('msp_unifeed/resource_catalog_eav_mysql4_product_collection');
|
138 |
+
|
139 |
+
$visibility = array(
|
140 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
|
141 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
|
142 |
+
);
|
143 |
+
|
144 |
+
$categories = $this->getCategoryIdsArray();
|
145 |
+
if (!count($categories))
|
146 |
+
return null;
|
147 |
+
|
148 |
+
$collection
|
149 |
+
->addAttributeToSelect('*')
|
150 |
+
->addStoreFilter($this->getStoreId())
|
151 |
+
->addWebsiteFilter($this->getStore()->getWebsite())
|
152 |
+
->addPriceData(0, $this->getStore()->getWebsiteId())
|
153 |
+
->joinAttribute('custom_name', 'catalog_product/name', 'entity_id', null, 'inner', $store->getId())
|
154 |
+
->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $store->getId())
|
155 |
+
->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', $store->getId())
|
156 |
+
->addAttributeToFilter('visibility', $visibility)
|
157 |
+
->addCategoriesFilter($categories);
|
158 |
+
|
159 |
+
$this->addMediaGalleryAttributeToCollection($collection);
|
160 |
+
|
161 |
+
$collection
|
162 |
+
->load();
|
163 |
+
|
164 |
+
return $collection;
|
165 |
+
}
|
166 |
+
|
167 |
+
protected function getContainerFilterModel()
|
168 |
+
{
|
169 |
+
if (!$this->_containerFilter)
|
170 |
+
$this->_containerFilter = Mage::getModel('msp_unifeed/template_container');
|
171 |
+
|
172 |
+
return $this->_containerFilter;
|
173 |
+
}
|
174 |
+
|
175 |
+
protected function getProductFilterModel()
|
176 |
+
{
|
177 |
+
if (!$this->_productFilter)
|
178 |
+
$this->_productFilter = Mage::getModel('msp_unifeed/template_product');
|
179 |
+
|
180 |
+
return $this->_productFilter;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Get category
|
185 |
+
* @param $id
|
186 |
+
* @return Mage_Catalog_Model_Category
|
187 |
+
*/
|
188 |
+
protected function getCategory($id)
|
189 |
+
{
|
190 |
+
if (!isset($this->_categories[$id]))
|
191 |
+
$this->_categories[$id] = Mage::getModel('catalog/category')->load($id);
|
192 |
+
|
193 |
+
return $this->_categories[$id];
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Open buffer file
|
198 |
+
*
|
199 |
+
* @return MSP_UniFeed_Model_Feed
|
200 |
+
*/
|
201 |
+
protected function openBufferFile()
|
202 |
+
{
|
203 |
+
if (!$this->getId())
|
204 |
+
return $this;
|
205 |
+
|
206 |
+
$this->_fpBuffer = fopen($this->getBufferFileName(), 'a');
|
207 |
+
return $this;
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Clear buffer file
|
212 |
+
*
|
213 |
+
* @return MSP_UniFeed_Model_Feed
|
214 |
+
*/
|
215 |
+
protected function clearBufferFile()
|
216 |
+
{
|
217 |
+
if (!$this->getId())
|
218 |
+
return $this;
|
219 |
+
|
220 |
+
@unlink($this->getBufferFileName());
|
221 |
+
return $this;
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Write buffer immediately
|
226 |
+
*
|
227 |
+
* @param string $buffer
|
228 |
+
* @return MSP_UniFeed_Model_Feed
|
229 |
+
*/
|
230 |
+
protected function writeBufferFile($buffer)
|
231 |
+
{
|
232 |
+
if (!$this->getId())
|
233 |
+
return $this;
|
234 |
+
|
235 |
+
if (!$this->_fpBuffer)
|
236 |
+
$this->openBufferFile();
|
237 |
+
|
238 |
+
fputs($this->_fpBuffer, $buffer);
|
239 |
+
|
240 |
+
return $this;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Close buffer file
|
245 |
+
*
|
246 |
+
* @return MSP_UniFeed_Model_Feed
|
247 |
+
*/
|
248 |
+
protected function closeBufferFile()
|
249 |
+
{
|
250 |
+
if (!$this->getId())
|
251 |
+
return $this;
|
252 |
+
|
253 |
+
if (!$this->_fpBuffer)
|
254 |
+
return $this;
|
255 |
+
|
256 |
+
fclose($this->_fpBuffer);
|
257 |
+
$this->_fpBuffer = 0;
|
258 |
+
return $this;
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Finalize buffer file
|
263 |
+
*
|
264 |
+
* @return MSP_UniFeed_Model_Feed
|
265 |
+
*/
|
266 |
+
protected function finalizeBufferFile()
|
267 |
+
{
|
268 |
+
if (!$this->getId())
|
269 |
+
return $this;
|
270 |
+
|
271 |
+
@rename($this->getBufferFileName(), $this->getFinalFileName());
|
272 |
+
@unlink($this->getRebuildFileName());
|
273 |
+
@unlink($this->getPositionFileName());
|
274 |
+
@unlink($this->getIdsFileName());
|
275 |
+
|
276 |
+
return $this;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Get AMP for current format
|
281 |
+
*
|
282 |
+
* @return string
|
283 |
+
*/
|
284 |
+
public function getAmp()
|
285 |
+
{
|
286 |
+
if (($this->getType() == 'xml') || ($this->getType() == 'html'))
|
287 |
+
return '&';
|
288 |
+
|
289 |
+
return '&';
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Get GoogleAnalytics string
|
294 |
+
*
|
295 |
+
* @return string
|
296 |
+
*/
|
297 |
+
public function getGaQueryString()
|
298 |
+
{
|
299 |
+
$utm = array();
|
300 |
+
|
301 |
+
$amp = $this->getAmp();
|
302 |
+
|
303 |
+
if ($this->getGaSource())
|
304 |
+
$utm[] = 'utm_source='.urlencode($this->getGaSource());
|
305 |
+
|
306 |
+
if ($this->getGaMedium())
|
307 |
+
$utm[] = 'utm_medium='.urlencode($this->getGaMedium());
|
308 |
+
|
309 |
+
if ($this->getGaTerm())
|
310 |
+
$utm[] = 'utm_term='.urlencode($this->getGaTerm());
|
311 |
+
|
312 |
+
if ($this->getGaContent())
|
313 |
+
$utm[] = 'utm_content='.urlencode($this->getGaContent());
|
314 |
+
|
315 |
+
if ($this->getGaName())
|
316 |
+
$utm[] = 'utm_campaign='.urlencode($this->getGaName());
|
317 |
+
|
318 |
+
return join($amp, $utm);
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Load mediagallery with product's collection
|
323 |
+
*
|
324 |
+
* @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $productCollection
|
325 |
+
* @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
|
326 |
+
*/
|
327 |
+
protected function addMediaGalleryAttributeToCollection(Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $productCollection)
|
328 |
+
{
|
329 |
+
if (!count($productCollection->getAllIds()))
|
330 |
+
return $productCollection;
|
331 |
+
|
332 |
+
$mediaGalleryAttributeId = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'media_gallery')->getAttributeId();
|
333 |
+
$resource = Mage::getSingleton('core/resource');
|
334 |
+
$read = $resource->getConnection('catalog_read');
|
335 |
+
|
336 |
+
$mediaGalleryData = $read->fetchAll('
|
337 |
+
SELECT
|
338 |
+
main.entity_id, `main`.`value_id`, `main`.`value` AS `file`,
|
339 |
+
`value`.`label`, `value`.`position`, `value`.`disabled`, `default_value`.`label` AS `label_default`,
|
340 |
+
`default_value`.`position` AS `position_default`,
|
341 |
+
`default_value`.`disabled` AS `disabled_default`
|
342 |
+
FROM '.$resource->getTableName('catalog_product_entity_media_gallery').' AS `main`
|
343 |
+
LEFT JOIN '.$resource->getTableName('catalog_product_entity_media_gallery_value').' AS `value`
|
344 |
+
ON main.value_id=value.value_id AND value.store_id=' . Mage::app()->getStore()->getId() . '
|
345 |
+
LEFT JOIN '.$resource->getTableName('catalog_product_entity_media_gallery_value').' AS `default_value`
|
346 |
+
ON main.value_id=default_value.value_id AND default_value.store_id=0
|
347 |
+
WHERE (
|
348 |
+
main.attribute_id = '.$read->quote($mediaGalleryAttributeId).')
|
349 |
+
AND (main.entity_id IN ('.$read->quote($productCollection->getAllIds()).'))
|
350 |
+
ORDER BY IF(value.position IS NULL, default_value.position, value.position) ASC
|
351 |
+
');
|
352 |
+
|
353 |
+
$mediaGalleryByProductId = array();
|
354 |
+
foreach ($mediaGalleryData as $galleryImage) {
|
355 |
+
$k = $galleryImage['entity_id'];
|
356 |
+
unset($galleryImage['entity_id']);
|
357 |
+
if (!isset($mediaGalleryByProductId[$k])) {
|
358 |
+
$mediaGalleryByProductId[$k] = array();
|
359 |
+
}
|
360 |
+
$mediaGalleryByProductId[$k][] = $galleryImage;
|
361 |
+
}
|
362 |
+
unset($mediaGalleryData);
|
363 |
+
|
364 |
+
foreach ($productCollection as &$product) {
|
365 |
+
$productId = $product->getData('entity_id');
|
366 |
+
if (isset($mediaGalleryByProductId[$productId])) {
|
367 |
+
$product->setData('media_gallery', array('images' => $mediaGalleryByProductId[$productId]));
|
368 |
+
}
|
369 |
+
}
|
370 |
+
unset($mediaGalleryByProductId);
|
371 |
+
|
372 |
+
return $productCollection;
|
373 |
+
}
|
374 |
+
|
375 |
+
/**
|
376 |
+
* Return single product feed
|
377 |
+
*
|
378 |
+
* @param Mage_Core_Model_Catalog_Product
|
379 |
+
* @param array $baseInfo [optional]
|
380 |
+
* @param bool $categorySkip [optional]
|
381 |
+
* @return string
|
382 |
+
*/
|
383 |
+
protected function getProductFeed($product, $baseInfo = array())
|
384 |
+
{
|
385 |
+
if (!$this->getId())
|
386 |
+
return '';
|
387 |
+
|
388 |
+
$info = $baseInfo;
|
389 |
+
|
390 |
+
$info['product'] = $product;
|
391 |
+
$info['stock'] = $this->_stockModel->loadByProduct($product);
|
392 |
+
$info['final_price'] = $product->getFinalPrice();
|
393 |
+
$info['final_price_rule'] = Mage::getModel('catalogrule/rule')->calcProductPriceRule($product, $product->getMinimalPrice());
|
394 |
+
$info['final_price_tax'] = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true);
|
395 |
+
$info['final_price_notax'] = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), false);
|
396 |
+
$info['catalog_price'] = $product->getPriceModel()->getFinalPrice(1, $product);
|
397 |
+
|
398 |
+
$info['images'] = array();
|
399 |
+
$mediaGallery = $product->getMediaGalleryImages();
|
400 |
+
|
401 |
+
foreach ($mediaGallery as $image)
|
402 |
+
$info['images'][] = $image['url'];
|
403 |
+
|
404 |
+
$n = 0;
|
405 |
+
$categories = array();
|
406 |
+
$categoryNames = array();
|
407 |
+
|
408 |
+
$categoryIds = array();
|
409 |
+
$categoryIdsTmp = $product->getCategoryIds();
|
410 |
+
|
411 |
+
foreach ($categoryIdsTmp as $categoryId) $categoryIds[] = $categoryId;
|
412 |
+
|
413 |
+
foreach ($categoryIds as $categoryId)
|
414 |
+
{
|
415 |
+
$category = $this->getCategory($categoryId);
|
416 |
+
if ($category->getIsActive()) continue;
|
417 |
+
|
418 |
+
$info["category$n"] = $category;
|
419 |
+
|
420 |
+
$categories[] = $category;
|
421 |
+
$categoryNames[] = $category->getName();
|
422 |
+
$n++;
|
423 |
+
}
|
424 |
+
|
425 |
+
$info['categories'] = $categories;
|
426 |
+
$info['category_names'] = $categoryNames;
|
427 |
+
|
428 |
+
$item = $this->getProductFilterModel()->setVariables($info)->setFeed($this)->filter($this->getTemplate()->getTemplateProduct());
|
429 |
+
|
430 |
+
return $item;
|
431 |
+
}
|
432 |
+
|
433 |
+
/**
|
434 |
+
* Set rebuild flag
|
435 |
+
*
|
436 |
+
* @return MSP_UniFeed_Model_Feed
|
437 |
+
*/
|
438 |
+
public function setRebuildFlag()
|
439 |
+
{
|
440 |
+
if (!$this->getId())
|
441 |
+
return $this;
|
442 |
+
|
443 |
+
$fp = fopen($this->getRebuildFileName(), 'w');
|
444 |
+
fputs($fp, time());
|
445 |
+
fclose($fp);
|
446 |
+
|
447 |
+
return $this;
|
448 |
+
}
|
449 |
+
|
450 |
+
/**
|
451 |
+
* Get rebuild flag
|
452 |
+
*
|
453 |
+
* @return bool
|
454 |
+
*/
|
455 |
+
public function getRebuildFlag()
|
456 |
+
{
|
457 |
+
if (!$this->getId())
|
458 |
+
return 0;
|
459 |
+
|
460 |
+
clearstatcache();
|
461 |
+
return file_exists($this->getRebuildFileName()) || !file_exists($this->getFinalFileName());
|
462 |
+
}
|
463 |
+
|
464 |
+
/**
|
465 |
+
* Get build status
|
466 |
+
*
|
467 |
+
* @return int
|
468 |
+
*/
|
469 |
+
public function getBuildStatus()
|
470 |
+
{
|
471 |
+
if (!$this->getId())
|
472 |
+
return -1;
|
473 |
+
|
474 |
+
if (!file_exists($this->getFinalFileName()))
|
475 |
+
{
|
476 |
+
if (file_exists($this->getBufferFileName()))
|
477 |
+
return self::BUILD_STATUS_BUILDING;
|
478 |
+
|
479 |
+
return self::BUILD_STATUS_NOT_READY;
|
480 |
+
}
|
481 |
+
|
482 |
+
if (file_exists($this->getRebuildFileName()))
|
483 |
+
{
|
484 |
+
if (file_exists($this->getBufferFileName()))
|
485 |
+
return self::BUILD_STATUS_UPDATING;
|
486 |
+
else
|
487 |
+
return self::BUILD_STATUS_MARKED_REBUILD;
|
488 |
+
}
|
489 |
+
|
490 |
+
return self::BUILD_STATUS_READY;
|
491 |
+
}
|
492 |
+
|
493 |
+
/**
|
494 |
+
* Get build date
|
495 |
+
*
|
496 |
+
* @return int
|
497 |
+
*/
|
498 |
+
public function getBuildDate()
|
499 |
+
{
|
500 |
+
if (!$this->getId())
|
501 |
+
return -1;
|
502 |
+
|
503 |
+
if (!file_exists($this->getFinalFileName()))
|
504 |
+
return 0;
|
505 |
+
|
506 |
+
return filemtime($this->getFinalFileName());
|
507 |
+
}
|
508 |
+
|
509 |
+
public function buildAll()
|
510 |
+
{
|
511 |
+
$fp = fopen($this->getLockFile(), "w");
|
512 |
+
|
513 |
+
if (flock($fp, LOCK_EX|LOCK_NB))
|
514 |
+
{
|
515 |
+
$collection = Mage::getModel('msp_unifeed/feed')->getCollection();
|
516 |
+
foreach ($collection as $f)
|
517 |
+
{
|
518 |
+
$feed = Mage::getModel('msp_unifeed/feed')->load($f->getId());
|
519 |
+
$feed->build();
|
520 |
+
}
|
521 |
+
|
522 |
+
fclose($fp);
|
523 |
+
unlink($this->getLockFile());
|
524 |
+
}
|
525 |
+
}
|
526 |
+
|
527 |
+
/**
|
528 |
+
* Build feed
|
529 |
+
* @return MSP_UniFeed_Model_Feed
|
530 |
+
*/
|
531 |
+
public function build()
|
532 |
+
{
|
533 |
+
if (!$this->getId())
|
534 |
+
return $this;
|
535 |
+
|
536 |
+
if (!$this->getRebuildFlag())
|
537 |
+
return $this;
|
538 |
+
|
539 |
+
if (!$this->getStatus())
|
540 |
+
{
|
541 |
+
@unlink($this->getBufferFileName());
|
542 |
+
@unlink($this->getFinalFileName());
|
543 |
+
return $this;
|
544 |
+
}
|
545 |
+
|
546 |
+
// Initialize
|
547 |
+
$this->_stockModel = Mage::getModel('cataloginventory/stock_item');
|
548 |
+
|
549 |
+
// Common data info
|
550 |
+
$store = $this->getStore();
|
551 |
+
$baseInfo['store'] = $store;
|
552 |
+
$baseInfo['timestamp'] = date('Y-m-d').'T'.date('H:i:s').'Z';
|
553 |
+
$baseInfo['locale'] = Mage::app()->getLocale()->getLocaleCode();
|
554 |
+
|
555 |
+
$this->clearBufferFile();
|
556 |
+
$this->writeBufferFile($this->getContainerFilterModel()->filter($this->getTemplate()->getTemplateOpen()), null);
|
557 |
+
|
558 |
+
// Categories
|
559 |
+
$collection = $this->getProductsCollection();
|
560 |
+
if ($collection)
|
561 |
+
{
|
562 |
+
foreach ($collection as $product)
|
563 |
+
{
|
564 |
+
$product->setStoreId($store->getId());
|
565 |
+
$this->writeBufferFile($this->getProductFeed($product, $baseInfo, false));
|
566 |
+
}
|
567 |
+
}
|
568 |
+
|
569 |
+
$this->writeBufferFile($this->getContainerFilterModel()->filter($this->getTemplate()->getTemplateClose()), null);
|
570 |
+
$this->closeBufferFile();
|
571 |
+
$this->finalizeBufferFile();
|
572 |
+
|
573 |
+
return $this;
|
574 |
+
}
|
575 |
+
}
|
app/code/community/MSP/Unifeed/Model/Feed/Attribute.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Feed_Attribute extends Mage_Core_Model_Abstract
|
22 |
+
{
|
23 |
+
protected function _construct()
|
24 |
+
{
|
25 |
+
$this->_init('msp_unifeed/feed_attribute');
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getAllOptions()
|
29 |
+
{
|
30 |
+
$model = Mage::getModel("msp_unifeed/feed");
|
31 |
+
$collection = $model->getCollection();
|
32 |
+
|
33 |
+
$out = array();
|
34 |
+
|
35 |
+
$allids = $collection->getAllIds();
|
36 |
+
foreach ($allids as $id)
|
37 |
+
{
|
38 |
+
$model->load($id);
|
39 |
+
$out[] = array('label'=>$model->getName(), 'value'=>$model->getId());
|
40 |
+
}
|
41 |
+
|
42 |
+
return $out;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getOptionArray()
|
46 |
+
{
|
47 |
+
$options = $this->getOptions();
|
48 |
+
foreach ($options as $option)
|
49 |
+
$out[$option['value']] = $option['label'];
|
50 |
+
|
51 |
+
return $out;
|
52 |
+
}
|
53 |
+
|
54 |
+
public function getOptions()
|
55 |
+
{
|
56 |
+
return $this->getAllOptions();
|
57 |
+
}
|
58 |
+
}
|
app/code/community/MSP/Unifeed/Model/Feed/Status.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
|
22 |
+
class MSP_Unifeed_Model_Feed_Status extends Mage_Core_Model_Abstract
|
23 |
+
{
|
24 |
+
const STATUS_ENABLED = 1;
|
25 |
+
const STATUS_DISABLED = 0;
|
26 |
+
|
27 |
+
static public function getHashArray()
|
28 |
+
{
|
29 |
+
return array(
|
30 |
+
self::STATUS_ENABLED=>Mage::helper('msp_unifeed')->__('Enabled'),
|
31 |
+
self::STATUS_DISABLED=>Mage::helper('msp_unifeed')->__('Disabled')
|
32 |
+
);
|
33 |
+
}
|
34 |
+
|
35 |
+
static public function getOptionArray()
|
36 |
+
{
|
37 |
+
$out = array();
|
38 |
+
$options = self::getHashArray();
|
39 |
+
|
40 |
+
foreach ($options as $k => $v)
|
41 |
+
$out[] = array('label' => $v, 'value' => $k);
|
42 |
+
|
43 |
+
return $out;
|
44 |
+
}
|
45 |
+
}
|
app/code/community/MSP/Unifeed/Model/Observer.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Observer
|
22 |
+
{
|
23 |
+
public function rebuildCatalog()
|
24 |
+
{
|
25 |
+
if (!Mage::getStoreConfig(self::XML_UNIFEED_GENERAL_ENABLED))
|
26 |
+
return;
|
27 |
+
|
28 |
+
if (!Mage::getStoreConfig(self::XML_UNIFEED_GENERAL_DAILY_REBUILD))
|
29 |
+
return;
|
30 |
+
|
31 |
+
$feeds = Mage::getModel('msp_unifeed/feed')->getCollection();
|
32 |
+
foreach ($feeds as $feed)
|
33 |
+
{
|
34 |
+
$feed->setRebuildFlag();
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
app/code/community/MSP/Unifeed/Model/Product/Feed.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Product_Feed extends Mage_Core_Model_Abstract
|
22 |
+
{
|
23 |
+
public function setCategories($feedId, $categoryIds)
|
24 |
+
{
|
25 |
+
$count = 0;
|
26 |
+
|
27 |
+
$collection = Mage::getModel('catalog/category')
|
28 |
+
->getCollection();
|
29 |
+
|
30 |
+
$collection
|
31 |
+
->addAttributeToSelect(array('msp_unifeed_ids'))
|
32 |
+
->load();
|
33 |
+
|
34 |
+
$categoryModel = Mage::getModel('catalog/category');
|
35 |
+
foreach ($collection as $category)
|
36 |
+
{
|
37 |
+
// Add category
|
38 |
+
if (in_array($category->getId(), $categoryIds))
|
39 |
+
{
|
40 |
+
$categoryFeeds = explode(':', $category->getMspUnifeedIds());
|
41 |
+
$categoryFeeds[] = $feedId;
|
42 |
+
|
43 |
+
$categoryModel
|
44 |
+
->setData(array())
|
45 |
+
->load($category->getId())
|
46 |
+
->setMspUnifeedIds($categoryFeeds)
|
47 |
+
->save();
|
48 |
+
|
49 |
+
$count++;
|
50 |
+
}
|
51 |
+
|
52 |
+
// Remove category
|
53 |
+
else
|
54 |
+
{
|
55 |
+
$categoryFeeds2 = array();
|
56 |
+
$categoryFeeds = explode(':', $category->getMspUnifeedIds());
|
57 |
+
|
58 |
+
if (in_array($feedId, $categoryFeeds))
|
59 |
+
{
|
60 |
+
foreach ($categoryFeeds as $i)
|
61 |
+
{
|
62 |
+
if (!$i || ($i == $feedId))
|
63 |
+
continue;
|
64 |
+
|
65 |
+
$categoryFeeds2[] = $i;
|
66 |
+
}
|
67 |
+
|
68 |
+
$categoryModel
|
69 |
+
->setData(array())
|
70 |
+
->load($category->getId())
|
71 |
+
->setMspUnifeedIds($categoryFeeds2)
|
72 |
+
->save();
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
return $count;
|
78 |
+
}
|
79 |
+
}
|
app/code/community/MSP/Unifeed/Model/Resource/Catalog/Eav/Mysql4/Product/Collection.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Resource_Catalog_Eav_Mysql4_Product_Collection extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
|
22 |
+
{
|
23 |
+
public function addCategoriesFilter($categories)
|
24 |
+
{
|
25 |
+
$alias = 'cat_index';
|
26 |
+
$categoryCondition = $this->getConnection()->quoteInto(
|
27 |
+
$alias.'.product_id=e.entity_id AND '.$alias.'.store_id=? AND ',
|
28 |
+
$this->getStoreId()
|
29 |
+
);
|
30 |
+
|
31 |
+
$categoryCondition.= $alias.'.category_id IN ('.join(',', $categories).')';
|
32 |
+
|
33 |
+
$this->getSelect()
|
34 |
+
->distinct()
|
35 |
+
->joinInner(
|
36 |
+
array($alias => $this->getTable('catalog/category_product_index')),
|
37 |
+
$categoryCondition,
|
38 |
+
array()
|
39 |
+
);
|
40 |
+
|
41 |
+
$this->_categoryIndexJoined = true;
|
42 |
+
$this->_joinFields['position'] = array('table'=>$alias, 'field'=>'position' );
|
43 |
+
|
44 |
+
return $this;
|
45 |
+
}
|
46 |
+
}
|
app/code/community/MSP/Unifeed/Model/Resource/Feed.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Resource_Feed extends Mage_Core_Model_Mysql4_Abstract
|
22 |
+
{
|
23 |
+
public function _construct()
|
24 |
+
{
|
25 |
+
$this->_init('msp_unifeed/feed', 'msp_unifeed_feed_id');
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getLastInsertId()
|
29 |
+
{
|
30 |
+
return $this->_getWriteAdapter()->lastInsertId($this->getMainTable());
|
31 |
+
}
|
32 |
+
}
|
app/code/community/MSP/Unifeed/Model/Resource/Feed/Collection.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Resource_Feed_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
22 |
+
{
|
23 |
+
public function _construct()
|
24 |
+
{
|
25 |
+
$this->_init('msp_unifeed/feed');
|
26 |
+
}
|
27 |
+
|
28 |
+
public function toOptionArray($valueField='msp_unifeed_feed_id', $labelField='name')
|
29 |
+
{
|
30 |
+
return $this->_toOptionArray($valueField, $labelField);
|
31 |
+
}
|
32 |
+
|
33 |
+
public function toOptionHash($valueField='msp_unifeed_feed_id', $labelField='name')
|
34 |
+
{
|
35 |
+
return $this->_toOptionHash($valueField, $labelField);
|
36 |
+
}
|
37 |
+
}
|
app/code/community/MSP/Unifeed/Model/Resource/Template.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Resource_Template extends Mage_Core_Model_Mysql4_Abstract
|
22 |
+
{
|
23 |
+
public function _construct()
|
24 |
+
{
|
25 |
+
$this->_init('msp_unifeed/template', 'msp_unifeed_template_id');
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getLastInsertId()
|
29 |
+
{
|
30 |
+
return $this->_getWriteAdapter()->lastInsertId($this->getMainTable());
|
31 |
+
}
|
32 |
+
}
|
app/code/community/MSP/Unifeed/Model/Resource/Template/Collection.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Resource_Template_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
22 |
+
{
|
23 |
+
public function _construct()
|
24 |
+
{
|
25 |
+
$this->_init('msp_unifeed/template');
|
26 |
+
}
|
27 |
+
|
28 |
+
public function toOptionArray($valueField='msp_unifeed_template_id', $labelField='name')
|
29 |
+
{
|
30 |
+
return $this->_toOptionArray($valueField, $labelField);
|
31 |
+
}
|
32 |
+
|
33 |
+
public function toOptionHash($valueField='msp_unifeed_template_id', $labelField='name')
|
34 |
+
{
|
35 |
+
return $this->_toOptionHash($valueField, $labelField);
|
36 |
+
}
|
37 |
+
}
|
app/code/community/MSP/Unifeed/Model/Template.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Template extends Mage_Core_Model_Abstract
|
22 |
+
{
|
23 |
+
public function _construct()
|
24 |
+
{
|
25 |
+
parent::_construct();
|
26 |
+
$this->_init('msp_unifeed/template');
|
27 |
+
}
|
28 |
+
|
29 |
+
static public function getHashArray()
|
30 |
+
{
|
31 |
+
$out = array();
|
32 |
+
|
33 |
+
$collection = Mage::getModel('msp_unifeed/template')->getCollection();
|
34 |
+
foreach ($collection as $template)
|
35 |
+
$out[$template->getid()] = $template->getName();
|
36 |
+
|
37 |
+
return $out;
|
38 |
+
}
|
39 |
+
|
40 |
+
static public function getOptionArray()
|
41 |
+
{
|
42 |
+
$out = array();
|
43 |
+
$options = self::getHashArray();
|
44 |
+
|
45 |
+
foreach ($options as $k => $v)
|
46 |
+
$out[] = array('label' => $v, 'value' => $k);
|
47 |
+
|
48 |
+
return $out;
|
49 |
+
}
|
50 |
+
}
|
app/code/community/MSP/Unifeed/Model/Template/Abstract.php
ADDED
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
abstract class MSP_Unifeed_Model_Template_Abstract extends Mage_Core_Model_Email_Template_Filter
|
22 |
+
{
|
23 |
+
const CONSTRUCTION_SET_PATTERN = '/{{set\s*(.*?)}}(.*?){{\\/set\s*}}/si';
|
24 |
+
|
25 |
+
protected $_feed;
|
26 |
+
|
27 |
+
public function getFeed()
|
28 |
+
{
|
29 |
+
return $this->_feed;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function setFeed($feed)
|
33 |
+
{
|
34 |
+
$this->_feed = $feed;
|
35 |
+
return $this;
|
36 |
+
}
|
37 |
+
|
38 |
+
public function ifDirective($construction)
|
39 |
+
{
|
40 |
+
$params = $this->_getIncludeParameters(' '.$construction[1]);
|
41 |
+
|
42 |
+
if (isset($params['a']) && isset($params['b']) && isset($params['op']))
|
43 |
+
{
|
44 |
+
$val = false;
|
45 |
+
switch ($params['op'])
|
46 |
+
{
|
47 |
+
case 'eq':
|
48 |
+
if ($params['a'] == $params['b'])
|
49 |
+
$val = true;
|
50 |
+
break;
|
51 |
+
|
52 |
+
case 'lt':
|
53 |
+
if ($params['a'] < $params['b'])
|
54 |
+
$val = true;
|
55 |
+
break;
|
56 |
+
|
57 |
+
case 'gt':
|
58 |
+
if ($params['a'] > $params['b'])
|
59 |
+
$val = true;
|
60 |
+
break;
|
61 |
+
|
62 |
+
case 'le':
|
63 |
+
if ($params['a'] <= $params['b'])
|
64 |
+
$val = true;
|
65 |
+
break;
|
66 |
+
|
67 |
+
case 'ge':
|
68 |
+
if ($params['a'] >= $params['b'])
|
69 |
+
$val = true;
|
70 |
+
break;
|
71 |
+
}
|
72 |
+
|
73 |
+
if (!$val)
|
74 |
+
{
|
75 |
+
if (isset($construction[3]) && isset($construction[4]))
|
76 |
+
{
|
77 |
+
return $construction[4];
|
78 |
+
}
|
79 |
+
return '';
|
80 |
+
}
|
81 |
+
else
|
82 |
+
{
|
83 |
+
return $construction[2];
|
84 |
+
}
|
85 |
+
|
86 |
+
return parent::ifDirective($construction);
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
protected function formatDirective($construction)
|
91 |
+
{
|
92 |
+
$params = $this->_getIncludeParameters($construction[2]);
|
93 |
+
if (!isset($params['var']))
|
94 |
+
return '';
|
95 |
+
|
96 |
+
if (!isset($params['decimals']))
|
97 |
+
$params['decimals'] = 2;
|
98 |
+
|
99 |
+
if (!isset($params['separator']))
|
100 |
+
$params['separator'] = '.';
|
101 |
+
|
102 |
+
$allowedTags = null;
|
103 |
+
|
104 |
+
return number_format($params['var'], $params['decimals'], $params['separator'], '');
|
105 |
+
}
|
106 |
+
|
107 |
+
protected function striptagsDirective($construction)
|
108 |
+
{
|
109 |
+
$params = $this->_getIncludeParameters($construction[2]);
|
110 |
+
if (!isset($params['var']))
|
111 |
+
return '';
|
112 |
+
|
113 |
+
return strip_tags($params['var']);
|
114 |
+
}
|
115 |
+
|
116 |
+
protected function csvquoteDirective($construction)
|
117 |
+
{
|
118 |
+
$params = $this->_getIncludeParameters($construction[2]);
|
119 |
+
if (!isset($params['enc'])) $params['enc'] = '"';
|
120 |
+
|
121 |
+
if (!isset($params['var']))
|
122 |
+
return $params['enc'].$params['enc'];
|
123 |
+
|
124 |
+
$out = $params['enc'].str_replace($params['enc'], $params['enc'].$params['enc'], $params['var']).$params['enc'];
|
125 |
+
return $out;
|
126 |
+
}
|
127 |
+
|
128 |
+
protected function quoteDirective($construction)
|
129 |
+
{
|
130 |
+
$params = $this->_getIncludeParameters($construction[2]);
|
131 |
+
if (!isset($params['enc'])) $params['enc'] = '"';
|
132 |
+
|
133 |
+
if (!isset($params['var']))
|
134 |
+
return $params['enc'].$params['enc'];
|
135 |
+
|
136 |
+
$out = $params['var'];
|
137 |
+
$out = str_replace("\\", "\\\\", $out);
|
138 |
+
$out = str_replace("\n", "\\n", $out);
|
139 |
+
$out = str_replace($params['enc'], "\\".$params['enc'], $out);
|
140 |
+
|
141 |
+
$out = $params['enc'].$out.$params['enc'];
|
142 |
+
return $out;
|
143 |
+
}
|
144 |
+
|
145 |
+
protected function htmlunescapeDirective($construction)
|
146 |
+
{
|
147 |
+
$params = $this->_getIncludeParameters($construction[2]);
|
148 |
+
if (!isset($params['var']))
|
149 |
+
return '';
|
150 |
+
|
151 |
+
$out = html_entity_decode($params['var']);
|
152 |
+
return $out;
|
153 |
+
}
|
154 |
+
|
155 |
+
protected function nlbrDirective($construction)
|
156 |
+
{
|
157 |
+
$params = $this->_getIncludeParameters($construction[2]);
|
158 |
+
if (!isset($params['var']))
|
159 |
+
return '';
|
160 |
+
|
161 |
+
$out = preg_replace("/[\n\r]+/", '', nl2br($params['var']));
|
162 |
+
return $out;
|
163 |
+
}
|
164 |
+
|
165 |
+
protected function newlineDirective($construction)
|
166 |
+
{
|
167 |
+
return "\n";
|
168 |
+
}
|
169 |
+
|
170 |
+
protected function implodeDirective($construction)
|
171 |
+
{
|
172 |
+
$params = $this->_getIncludeParameters($construction[2]);
|
173 |
+
if (!isset($params['glue']))
|
174 |
+
$params['glue'] = '/';
|
175 |
+
|
176 |
+
if (!isset($params['var']))
|
177 |
+
return '';
|
178 |
+
|
179 |
+
return implode($params['glue'], $params['var']);
|
180 |
+
}
|
181 |
+
|
182 |
+
public function setDirective($construction)
|
183 |
+
{
|
184 |
+
$params = $this->_getIncludeParameters(' '.$construction[1]);
|
185 |
+
if (!isset($params['var']))
|
186 |
+
return '';
|
187 |
+
|
188 |
+
$this->_templateVars[$params['var']] = $this->filter($construction[2]);
|
189 |
+
return '';
|
190 |
+
}
|
191 |
+
|
192 |
+
public function filter($value)
|
193 |
+
{
|
194 |
+
foreach (array(self::CONSTRUCTION_SET_PATTERN=>'setDirective') as $pattern=>$directive)
|
195 |
+
{
|
196 |
+
if (preg_match_all($pattern, $value, $constructions, PREG_SET_ORDER))
|
197 |
+
{
|
198 |
+
foreach ($constructions as $index=>$construction)
|
199 |
+
{
|
200 |
+
$replacedValue = '';
|
201 |
+
$callback = array($this, $directive);
|
202 |
+
if (!is_callable($callback))
|
203 |
+
{
|
204 |
+
continue;
|
205 |
+
}
|
206 |
+
try
|
207 |
+
{
|
208 |
+
$replacedValue = call_user_func($callback, $construction);
|
209 |
+
}
|
210 |
+
catch(Exception $e)
|
211 |
+
{
|
212 |
+
throw $e;
|
213 |
+
}
|
214 |
+
|
215 |
+
$value = str_replace($construction[0], $replacedValue, $value);
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
$value = trim($value);
|
221 |
+
$value = parent::filter($value);
|
222 |
+
|
223 |
+
return $value;
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
app/code/community/MSP/Unifeed/Model/Template/Container.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Template_Container extends MSP_Unifeed_Model_Template_Abstract
|
22 |
+
{
|
23 |
+
|
24 |
+
}
|
app/code/community/MSP/Unifeed/Model/Template/Product.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Template_Product extends MSP_Unifeed_Model_Template_Abstract
|
22 |
+
{
|
23 |
+
public function gaDirective($construction)
|
24 |
+
{
|
25 |
+
$params = $this->_getIncludeParameters($construction[2]);
|
26 |
+
if (!isset($params['url']))
|
27 |
+
$params['url'] = $this->_templateVars['product']->getProductUrl();
|
28 |
+
|
29 |
+
$amp = $this->getFeed()->getAmp();
|
30 |
+
|
31 |
+
if (strpos($params['url'], '?'))
|
32 |
+
$params['url'] .= $amp.$this->getFeed()->getGaQueryString();
|
33 |
+
else
|
34 |
+
$params['url'] .= '?'.$this->getFeed()->getGaQueryString();
|
35 |
+
|
36 |
+
return $params['url'];
|
37 |
+
}
|
38 |
+
|
39 |
+
public function attributesDirective($construction)
|
40 |
+
{
|
41 |
+
$params = $this->_getIncludeParameters($construction[2]);
|
42 |
+
|
43 |
+
$product = $this->_templateVars['product'];
|
44 |
+
|
45 |
+
$excludeAttr = array();
|
46 |
+
if (isset($params['exclude']))
|
47 |
+
$excludeAttr = preg_split('/\s*,\s*/', $params['exclude']);
|
48 |
+
|
49 |
+
$glue = '|';
|
50 |
+
if (isset($params['glue']))
|
51 |
+
$glue = $params['glue'];
|
52 |
+
|
53 |
+
$data = array();
|
54 |
+
$attributes = $product->getAttributes();
|
55 |
+
|
56 |
+
foreach ($attributes as $attribute)
|
57 |
+
{
|
58 |
+
if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr))
|
59 |
+
{
|
60 |
+
$value = $attribute->getFrontend()->getValue($product);
|
61 |
+
|
62 |
+
if (!$product->hasData($attribute->getAttributeCode()) || ((string)$value == '') || !$product->getData($attribute->getAttributeCode()))
|
63 |
+
continue;
|
64 |
+
|
65 |
+
if (is_string($value) && strlen($value))
|
66 |
+
{
|
67 |
+
if (!$attribute->getIsFilterable())
|
68 |
+
continue;
|
69 |
+
|
70 |
+
if (!$attribute->getIsVisibleOnFront())
|
71 |
+
continue;
|
72 |
+
|
73 |
+
$data[$attribute->getAttributeCode()] = array(
|
74 |
+
'label' => $attribute->getFrontendLabel(),
|
75 |
+
'value' => $value,
|
76 |
+
'code' => $attribute->getAttributeCode()
|
77 |
+
);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
$return = array();
|
83 |
+
foreach ($data as $k => $v)
|
84 |
+
{
|
85 |
+
if (isset($params['uselabel']) && $params['uselabel'])
|
86 |
+
$label = $v['label']; //strtolower(preg_replace('/[\W\s]+/', '_', $v['label']));
|
87 |
+
else
|
88 |
+
$label = $k;
|
89 |
+
|
90 |
+
$return[] = $label."=".$v['value'];
|
91 |
+
}
|
92 |
+
|
93 |
+
return implode($glue, $return);
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
app/code/community/MSP/Unifeed/Model/Template/Type.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Template_Type extends Mage_Core_Model_Abstract
|
22 |
+
{
|
23 |
+
const TYPE_CSV = 'csv';
|
24 |
+
const TYPE_XML = 'xml';
|
25 |
+
const TYPE_TXT = 'txt';
|
26 |
+
const TYPE_HTML = 'html';
|
27 |
+
|
28 |
+
static public function getHashArray()
|
29 |
+
{
|
30 |
+
return array(
|
31 |
+
self::TYPE_CSV=>Mage::helper('msp_unifeed')->__('CSV'),
|
32 |
+
self::TYPE_TXT=>Mage::helper('msp_unifeed')->__('TXT'),
|
33 |
+
self::TYPE_XML=>Mage::helper('msp_unifeed')->__('XML'),
|
34 |
+
self::TYPE_HTML=>Mage::helper('msp_unifeed')->__('HTML'),
|
35 |
+
);
|
36 |
+
}
|
37 |
+
|
38 |
+
static public function getOptionArray()
|
39 |
+
{
|
40 |
+
$out = array();
|
41 |
+
$options = self::getHashArray();
|
42 |
+
|
43 |
+
foreach ($options as $k => $v)
|
44 |
+
$out[] = array('label' => $v, 'value' => $k);
|
45 |
+
|
46 |
+
return $out;
|
47 |
+
}
|
48 |
+
}
|
app/code/community/MSP/Unifeed/Model/Tree.php
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_Model_Tree extends Mage_Core_Model_Abstract
|
22 |
+
{
|
23 |
+
protected $_feed;
|
24 |
+
protected $_categoryModel;
|
25 |
+
|
26 |
+
public function setFeed($feed)
|
27 |
+
{
|
28 |
+
$this->_feed = $feed;
|
29 |
+
return $this;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getFeed()
|
33 |
+
{
|
34 |
+
return $this->_feed;
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function getCategoryModel($categoryId)
|
38 |
+
{
|
39 |
+
if (!$this->_categoryModel)
|
40 |
+
$this->_categoryModel = Mage::getModel('catalog/category');
|
41 |
+
|
42 |
+
return $this->_categoryModel->setData(array())->load($categoryId);
|
43 |
+
}
|
44 |
+
|
45 |
+
protected function getCategoryChildren($categoryId)
|
46 |
+
{
|
47 |
+
// Magento 1.5.1.0 bug
|
48 |
+
if ($categoryId == Mage_Catalog_Model_Category::TREE_ROOT_ID)
|
49 |
+
{
|
50 |
+
$collection = Mage::getResourceModel('catalog/category_collection');
|
51 |
+
$collection
|
52 |
+
->addAttributeToSelect('name')
|
53 |
+
->addPathFilter('^'.$categoryId.'/[0-9]+$')
|
54 |
+
->load();
|
55 |
+
|
56 |
+
return $collection;
|
57 |
+
}
|
58 |
+
|
59 |
+
return $this->getCategoryModel($categoryId)->getChildrenCategories();
|
60 |
+
|
61 |
+
return Mage::getResourceModel('catalog/category_collection')
|
62 |
+
->addAttributeToSelect('name')
|
63 |
+
->addAttributeToSelect('all_children')
|
64 |
+
->addAttributeToSelect('is_anchor')
|
65 |
+
->addAttributeToFilter('parent_id', $categoryId)
|
66 |
+
->joinUrlRewrite()->load();
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getCategory($categoryId, $depth = 0, $level = 0)
|
70 |
+
{
|
71 |
+
$category = $this->getCategoryModel($categoryId);
|
72 |
+
$children = $this->getCategoryChildren($categoryId);
|
73 |
+
|
74 |
+
$hasChildren = $children->count() ? true : false;
|
75 |
+
if ($level > $depth)
|
76 |
+
return;
|
77 |
+
|
78 |
+
$nodeinfo = $this->getCategoryInfo($categoryId);
|
79 |
+
$out = $nodeinfo;
|
80 |
+
|
81 |
+
if ($hasChildren)
|
82 |
+
{
|
83 |
+
$out['subs'] = array();
|
84 |
+
foreach ($children as $subcategory)
|
85 |
+
{
|
86 |
+
$item = $this->getCategory($subcategory->getId(), $depth, $level + 1);
|
87 |
+
if ($item)
|
88 |
+
array_push($out['subs'], $item);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
return $out;
|
93 |
+
}
|
94 |
+
|
95 |
+
public function getCategoryInfo($categoryId)
|
96 |
+
{
|
97 |
+
if (!$categoryId)
|
98 |
+
return;
|
99 |
+
|
100 |
+
$category = $this->getCategoryModel($categoryId);
|
101 |
+
|
102 |
+
return array(
|
103 |
+
'title' => $category->getName(),
|
104 |
+
'url' => $category->getUrl(),
|
105 |
+
'id' => $category->getId(),
|
106 |
+
'checked' => $this->isChecked($category)
|
107 |
+
);
|
108 |
+
}
|
109 |
+
|
110 |
+
public function getRootCategory($depth = 0, $level = 0)
|
111 |
+
{
|
112 |
+
$categoryId = Mage_Catalog_Model_Category::TREE_ROOT_ID;
|
113 |
+
$children = $this->getCategoryChildren($categoryId);
|
114 |
+
|
115 |
+
$out = array();
|
116 |
+
|
117 |
+
foreach ($children as $category)
|
118 |
+
{
|
119 |
+
if (!$category->getId())
|
120 |
+
continue;
|
121 |
+
//if (!$category->getName())
|
122 |
+
// continue;
|
123 |
+
|
124 |
+
$out[] = $this->getCategory($category->getId(), $depth);
|
125 |
+
}
|
126 |
+
|
127 |
+
return $out;
|
128 |
+
}
|
129 |
+
|
130 |
+
public function isChecked(Mage_Catalog_Model_Category $category)
|
131 |
+
{
|
132 |
+
if (strpos($category->getMspUnifeedIds(), ':'.intval($this->getFeed()->getId()).':') !== false)
|
133 |
+
return true;
|
134 |
+
|
135 |
+
return false;
|
136 |
+
}
|
137 |
+
}
|
app/code/community/MSP/Unifeed/controllers/FeedController.php
ADDED
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_FeedController extends Mage_Adminhtml_Controller_Action
|
22 |
+
{
|
23 |
+
protected function _prapareAction()
|
24 |
+
{
|
25 |
+
if (Mage::registry('msp_unifeed_data') && Mage::registry('msp_unifeed_data')->getId())
|
26 |
+
return $this;
|
27 |
+
|
28 |
+
$id = $this->getRequest()->getParam('id');
|
29 |
+
|
30 |
+
$model = Mage::getModel('msp_unifeed/feed');
|
31 |
+
|
32 |
+
if ($id)
|
33 |
+
$model->load($id);
|
34 |
+
|
35 |
+
Mage::register('msp_unifeed_data', $model);
|
36 |
+
return $this;
|
37 |
+
}
|
38 |
+
|
39 |
+
protected function getFeed()
|
40 |
+
{
|
41 |
+
return Mage::registry('msp_unifeed_data');
|
42 |
+
}
|
43 |
+
|
44 |
+
public function indexAction()
|
45 |
+
{
|
46 |
+
$this->loadLayout();
|
47 |
+
$this->_addContent($this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed'));
|
48 |
+
$this->renderLayout();
|
49 |
+
}
|
50 |
+
|
51 |
+
public function newAction()
|
52 |
+
{
|
53 |
+
$this->_forward('edit');
|
54 |
+
}
|
55 |
+
|
56 |
+
public function productsAction()
|
57 |
+
{
|
58 |
+
$this->_prapareAction();
|
59 |
+
|
60 |
+
$this->getResponse()->setBody(
|
61 |
+
$this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed_edit_tab_products')->toHtml()
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
+
public function rebuildAction()
|
66 |
+
{
|
67 |
+
$this->_prapareAction();
|
68 |
+
|
69 |
+
if ($this->getFeed()->getId())
|
70 |
+
{
|
71 |
+
$this->getFeed()->setRebuildFlag();
|
72 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Feed marked for rebuild'));
|
73 |
+
$this->_redirect('*/*/edit', array('id' => $this->getFeed()->getId()));
|
74 |
+
}
|
75 |
+
else
|
76 |
+
{
|
77 |
+
$feeds = $this->getFeed()->getCollection();
|
78 |
+
foreach ($feeds as $feed)
|
79 |
+
$feed->setRebuildFlag();
|
80 |
+
|
81 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('All feeds are marked for rebuild'));
|
82 |
+
$this->_redirect('*/*/index');
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
public function editAction()
|
87 |
+
{
|
88 |
+
$this->_prapareAction();
|
89 |
+
$model = $this->getFeed();
|
90 |
+
|
91 |
+
$this->loadLayout();
|
92 |
+
$this->_setActiveMenu('msp_unifeed/items');
|
93 |
+
|
94 |
+
$this->_addContent($this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed_edit'));
|
95 |
+
$this->_addLeft($this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed_edit_tabs'));
|
96 |
+
|
97 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
98 |
+
|
99 |
+
$this->renderLayout();
|
100 |
+
}
|
101 |
+
|
102 |
+
public function saveAction()
|
103 |
+
{
|
104 |
+
$this->_prapareAction();
|
105 |
+
$model = $this->getFeed();
|
106 |
+
|
107 |
+
$feedId = $model->getId();
|
108 |
+
|
109 |
+
if ($this->getRequest()->getPost())
|
110 |
+
{
|
111 |
+
try
|
112 |
+
{
|
113 |
+
$postData = $this->getRequest()->getPost();
|
114 |
+
$feedData = $postData['feed'];
|
115 |
+
|
116 |
+
$feedData['code'] = trim($feedData['code']);
|
117 |
+
|
118 |
+
if (!preg_match('/^[a-z0-9]+$/', $feedData['code']))
|
119 |
+
{
|
120 |
+
trigger_error(Mage::helper('msp_unifeed')->__('Invalid code format'));
|
121 |
+
}
|
122 |
+
|
123 |
+
$model
|
124 |
+
->setData('name', $feedData['name'])
|
125 |
+
->setData('code', $feedData['code'])
|
126 |
+
->setData('store_id', $feedData['store_id'])
|
127 |
+
->setData('msp_unifeed_template_id', $feedData['msp_unifeed_template_id'])
|
128 |
+
->setData('ga_source', $feedData['ga_source'])
|
129 |
+
->setData('ga_term', $feedData['ga_term'])
|
130 |
+
->setData('ga_content', $feedData['ga_content'])
|
131 |
+
->setData('ga_name', $feedData['ga_name'])
|
132 |
+
->setData('ga_medium', $feedData['ga_medium'])
|
133 |
+
->setData('status', $feedData['status']);
|
134 |
+
|
135 |
+
$model->save();
|
136 |
+
|
137 |
+
if (!$feedId)
|
138 |
+
$feedId = $model->getId();
|
139 |
+
|
140 |
+
if ($feedId)
|
141 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Feed was successfully saved'));
|
142 |
+
else
|
143 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('One error occurred while trying to save'));
|
144 |
+
|
145 |
+
if ($feedId)
|
146 |
+
{
|
147 |
+
$productFeed = Mage::getModel('msp_unifeed/product_feed');
|
148 |
+
if ($postData['add_sku'])
|
149 |
+
{
|
150 |
+
$skus = preg_split("/[\s\n]+/", $postData['add_sku']);
|
151 |
+
$res = $productFeed->addProducts(array($feedId), $skus, true);
|
152 |
+
|
153 |
+
if ($res)
|
154 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('%d products were added to this feed', $res));
|
155 |
+
else
|
156 |
+
Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('adminhtml')->__('No new products were added to this feed'));
|
157 |
+
}
|
158 |
+
|
159 |
+
if ($postData['del_sku'])
|
160 |
+
{
|
161 |
+
$skus = preg_split("/[\s\n]+/", $postData['del_sku']);
|
162 |
+
$res = $productFeed->removeProducts(array($feedId), $skus, true);
|
163 |
+
|
164 |
+
if ($res)
|
165 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('%d products were removed from this feed', $res));
|
166 |
+
else
|
167 |
+
Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('adminhtml')->__('No new products were removed from this feed'));
|
168 |
+
}
|
169 |
+
|
170 |
+
if (!$postData['categories'])
|
171 |
+
$postData['categories'] = '';
|
172 |
+
|
173 |
+
$ids = explode(",", $postData['categories']);
|
174 |
+
$res = $productFeed->setCategories($feedId, $ids);
|
175 |
+
|
176 |
+
$this->_redirect('*/*/edit', array('id' => $feedId));
|
177 |
+
return;
|
178 |
+
}
|
179 |
+
|
180 |
+
} catch (Exception $e) {
|
181 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
182 |
+
$this->_redirect('*/*/edit', array('id' => $feedId));
|
183 |
+
return;
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
$this->_redirect('*/*/index');
|
188 |
+
}
|
189 |
+
|
190 |
+
public function deleteAction()
|
191 |
+
{
|
192 |
+
$this->_prapareAction();
|
193 |
+
$model = $this->getFeed();
|
194 |
+
|
195 |
+
if ($model->getId())
|
196 |
+
{
|
197 |
+
try
|
198 |
+
{
|
199 |
+
$model->delete();
|
200 |
+
|
201 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Feed was successfully deleted'));
|
202 |
+
$this->_redirect('*/*/index');
|
203 |
+
}
|
204 |
+
catch (Exception $e)
|
205 |
+
{
|
206 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
207 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
$this->_redirect('*/*/index');
|
212 |
+
}
|
213 |
+
|
214 |
+
protected function getRecursiveTree($res)
|
215 |
+
{
|
216 |
+
$out = array();
|
217 |
+
foreach ($res as $item)
|
218 |
+
{
|
219 |
+
$childrenCount = array_key_exists('subs', $item) ? sizeof($item['subs']) : 0;
|
220 |
+
|
221 |
+
$info = array(
|
222 |
+
'id' => $item['id'],
|
223 |
+
'text' => $item['title'],
|
224 |
+
'expanded' => true,
|
225 |
+
'checked' => $item['checked'],
|
226 |
+
'leaf' => !$childrenCount,
|
227 |
+
'allowDrop' => true,
|
228 |
+
'allowDrag' => true,
|
229 |
+
'cls' => 'folder'
|
230 |
+
);
|
231 |
+
|
232 |
+
if ($childrenCount)
|
233 |
+
{
|
234 |
+
$info['children'] = $this->getRecursiveTree($item['subs']);
|
235 |
+
}
|
236 |
+
|
237 |
+
$out[] = $info;
|
238 |
+
}
|
239 |
+
|
240 |
+
return $out;
|
241 |
+
}
|
242 |
+
|
243 |
+
public function jsonAction()
|
244 |
+
{
|
245 |
+
$this->_prapareAction();
|
246 |
+
|
247 |
+
$categoryId = $this->getRequest()->getParam('node');
|
248 |
+
$feed = $this->getFeed();
|
249 |
+
|
250 |
+
$model = Mage::getModel('msp_unifeed/tree');
|
251 |
+
$model->setFeed($feed);
|
252 |
+
|
253 |
+
if ($categoryId)
|
254 |
+
{
|
255 |
+
$res = $model->getCategory($categoryId, 100);
|
256 |
+
if (array_key_exists('subs', $res))
|
257 |
+
$res = $res['subs'];
|
258 |
+
else
|
259 |
+
$res = array();
|
260 |
+
}
|
261 |
+
else
|
262 |
+
{
|
263 |
+
$res = $model->getRootCategory(100);
|
264 |
+
}
|
265 |
+
|
266 |
+
$out = $this->getRecursiveTree($res);
|
267 |
+
|
268 |
+
$this->getResponse()->setBody(json_encode($out));
|
269 |
+
}
|
270 |
+
}
|
app/code/community/MSP/Unifeed/controllers/OutputController.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_OutputController extends Mage_Core_Controller_Front_Action
|
22 |
+
{
|
23 |
+
protected $_feed;
|
24 |
+
|
25 |
+
const XML_UNIFEED_GENERAL_ENABLED = 'msp_unifeed/general/enabled';
|
26 |
+
|
27 |
+
protected function getFeed($feedCode = null)
|
28 |
+
{
|
29 |
+
if (!$this->_feed)
|
30 |
+
$this->_feed = Mage::getModel('msp_unifeed/feed');
|
31 |
+
|
32 |
+
if (!is_null($feedCode))
|
33 |
+
$this->_feed->load($feedCode, 'code');
|
34 |
+
|
35 |
+
return $this->_feed;
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function setContentType($type)
|
39 |
+
{
|
40 |
+
header('Content-Type: '.$type);
|
41 |
+
return $this;
|
42 |
+
}
|
43 |
+
|
44 |
+
public function buildAction()
|
45 |
+
{exit;
|
46 |
+
$feedCode = $this->getRequest()->getParam('code');
|
47 |
+
|
48 |
+
$feed = $this->getFeed($feedCode);
|
49 |
+
if (!Mage::getStoreConfig(self::XML_UNIFEED_GENERAL_ENABLED) || !$feed->getId() || !$feed->getStatus())
|
50 |
+
{
|
51 |
+
$this->norouteAction();
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
|
55 |
+
$feed->build();
|
56 |
+
}
|
57 |
+
|
58 |
+
public function indexAction()
|
59 |
+
{
|
60 |
+
$feedCode = $this->getRequest()->getParam('code');
|
61 |
+
|
62 |
+
$feed = $this->getFeed($feedCode);
|
63 |
+
if (
|
64 |
+
!Mage::getStoreConfig(self::XML_UNIFEED_GENERAL_ENABLED) ||
|
65 |
+
!$feed->getId() ||
|
66 |
+
!$feed->getStatus() ||
|
67 |
+
!file_exists($feed->getFinalFileName())
|
68 |
+
) {
|
69 |
+
$this->norouteAction();
|
70 |
+
return;
|
71 |
+
}
|
72 |
+
|
73 |
+
switch ($feed->getTemplate()->getType())
|
74 |
+
{
|
75 |
+
case MSP_Unifeed_Model_Template_Type::TYPE_CSV:
|
76 |
+
$this->setContentType('text/csv');
|
77 |
+
break;
|
78 |
+
|
79 |
+
case MSP_Unifeed_Model_Template_Type::TYPE_TXT:
|
80 |
+
$this->setContentType('text/plain');
|
81 |
+
break;
|
82 |
+
|
83 |
+
case MSP_Unifeed_Model_Template_Type::TYPE_XML:
|
84 |
+
$this->setContentType('text/xml');
|
85 |
+
break;
|
86 |
+
|
87 |
+
case MSP_Unifeed_Model_Template_Type::TYPE_HTML:
|
88 |
+
$this->setContentType('text/html');
|
89 |
+
break;
|
90 |
+
}
|
91 |
+
|
92 |
+
readfile($feed->getFinalFileName());
|
93 |
+
}
|
94 |
+
}
|
app/code/community/MSP/Unifeed/controllers/TemplateController.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
class MSP_Unifeed_TemplateController extends Mage_Adminhtml_Controller_Action
|
22 |
+
{
|
23 |
+
protected function _prapareAction()
|
24 |
+
{
|
25 |
+
if (Mage::registry('msp_unifeed_template_data'))
|
26 |
+
return $this;
|
27 |
+
|
28 |
+
$id = $this->getRequest()->getParam('id');
|
29 |
+
|
30 |
+
$model = Mage::getModel('msp_unifeed/template');
|
31 |
+
|
32 |
+
if ($id)
|
33 |
+
$model->load($id);
|
34 |
+
|
35 |
+
Mage::register('msp_unifeed_template_data', $model);
|
36 |
+
return $this;
|
37 |
+
}
|
38 |
+
|
39 |
+
protected function getFeed()
|
40 |
+
{
|
41 |
+
return Mage::registry('msp_unifeed_template_data');
|
42 |
+
}
|
43 |
+
|
44 |
+
public function indexAction()
|
45 |
+
{
|
46 |
+
$this->loadLayout();
|
47 |
+
$this->_addContent($this->getLayout()->createBlock('msp_unifeed/adminhtml_template'));
|
48 |
+
$this->renderLayout();
|
49 |
+
}
|
50 |
+
|
51 |
+
public function newAction()
|
52 |
+
{
|
53 |
+
$this->_forward('edit');
|
54 |
+
}
|
55 |
+
|
56 |
+
public function editAction()
|
57 |
+
{
|
58 |
+
$this->_prapareAction();
|
59 |
+
$model = $this->getFeed();
|
60 |
+
|
61 |
+
$this->loadLayout();
|
62 |
+
$this->_setActiveMenu('msp_unifeed_template/items');
|
63 |
+
|
64 |
+
$this->_addContent($this->getLayout()->createBlock('msp_unifeed/adminhtml_template_edit'));
|
65 |
+
$this->renderLayout();
|
66 |
+
}
|
67 |
+
|
68 |
+
public function saveAction()
|
69 |
+
{
|
70 |
+
$this->_prapareAction();
|
71 |
+
$model = $this->getFeed();
|
72 |
+
|
73 |
+
$templateId = $model->getId();
|
74 |
+
|
75 |
+
if ($this->getRequest()->getPost())
|
76 |
+
{
|
77 |
+
try
|
78 |
+
{
|
79 |
+
$postData = $this->getRequest()->getPost();
|
80 |
+
$templateData = $postData['template'];
|
81 |
+
|
82 |
+
$model
|
83 |
+
->setData('name', $templateData['name'])
|
84 |
+
->setData('template_open', $templateData['template_open'])
|
85 |
+
->setData('template_close', $templateData['template_close'])
|
86 |
+
->setData('template_product', $templateData['template_product'])
|
87 |
+
->setData('type', $templateData['type'])
|
88 |
+
;
|
89 |
+
|
90 |
+
$model->save();
|
91 |
+
|
92 |
+
if (!$templateId)
|
93 |
+
$templateId = $model->getId();
|
94 |
+
|
95 |
+
if ($templateId)
|
96 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Template was successfully saved'));
|
97 |
+
else
|
98 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('One error occurred while trying to save'));
|
99 |
+
|
100 |
+
$this->_redirect('*/*/edit', array('id' => $templateId));
|
101 |
+
return;
|
102 |
+
|
103 |
+
} catch (Exception $e) {
|
104 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
105 |
+
$this->_redirect('*/*/edit', array('id' => $templateId));
|
106 |
+
return;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
$this->_redirect('*/*/index');
|
111 |
+
}
|
112 |
+
|
113 |
+
public function deleteAction()
|
114 |
+
{
|
115 |
+
$this->_prapareAction();
|
116 |
+
$model = $this->getTemplate();
|
117 |
+
|
118 |
+
if ($model->getId())
|
119 |
+
{
|
120 |
+
try
|
121 |
+
{
|
122 |
+
$model->delete();
|
123 |
+
|
124 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Template was successfully deleted'));
|
125 |
+
$this->_redirect('*/*/index');
|
126 |
+
}
|
127 |
+
catch (Exception $e)
|
128 |
+
{
|
129 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
130 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
$this->_redirect('*/*/index');
|
135 |
+
}
|
136 |
+
}
|
app/code/community/MSP/Unifeed/etc/config.xml
ADDED
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* IDEALIAGroup srl
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 info@idealiagroup.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category MSP
|
17 |
+
* @package MSP_Unifeed
|
18 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<config>
|
23 |
+
<modules>
|
24 |
+
<MSP_Unifeed>
|
25 |
+
<version>1.0.0</version>
|
26 |
+
</MSP_Unifeed>
|
27 |
+
</modules>
|
28 |
+
|
29 |
+
<global>
|
30 |
+
<models>
|
31 |
+
<msp_unifeed>
|
32 |
+
<class>MSP_Unifeed_Model</class>
|
33 |
+
<resourceModel>msp_unifeed_resource</resourceModel>
|
34 |
+
</msp_unifeed>
|
35 |
+
|
36 |
+
<msp_unifeed_resource>
|
37 |
+
<class>MSP_Unifeed_Model_Resource</class>
|
38 |
+
<entities>
|
39 |
+
<feed>
|
40 |
+
<table>msp_unifeed_feed</table>
|
41 |
+
</feed>
|
42 |
+
<template>
|
43 |
+
<table>msp_unifeed_template</table>
|
44 |
+
</template>
|
45 |
+
</entities>
|
46 |
+
</msp_unifeed_resource>
|
47 |
+
<catalog_resource>
|
48 |
+
<rewrite>
|
49 |
+
<eav_mysql4_product_collection>MSP_Unifeed_Model_Resource_Catalog_Eav_Mysql4_Product_Collection
|
50 |
+
</eav_mysql4_product_collection>
|
51 |
+
</rewrite>
|
52 |
+
</catalog_resource>
|
53 |
+
</models>
|
54 |
+
|
55 |
+
<blocks>
|
56 |
+
<msp_unifeed>
|
57 |
+
<class>MSP_Unifeed_Block</class>
|
58 |
+
</msp_unifeed>
|
59 |
+
</blocks>
|
60 |
+
|
61 |
+
<helpers>
|
62 |
+
<msp_unifeed>
|
63 |
+
<class>MSP_Unifeed_Helper</class>
|
64 |
+
</msp_unifeed>
|
65 |
+
</helpers>
|
66 |
+
|
67 |
+
<resources>
|
68 |
+
<msp_unifeed_setup>
|
69 |
+
<setup>
|
70 |
+
<module>MSP_Unifeed</module>
|
71 |
+
</setup>
|
72 |
+
</msp_unifeed_setup>
|
73 |
+
</resources>
|
74 |
+
</global>
|
75 |
+
|
76 |
+
<frontend>
|
77 |
+
<routers>
|
78 |
+
<msp_unifeed>
|
79 |
+
<use>standard</use>
|
80 |
+
<args>
|
81 |
+
<module>MSP_Unifeed</module>
|
82 |
+
<frontName>msp_unifeed</frontName>
|
83 |
+
</args>
|
84 |
+
</msp_unifeed>
|
85 |
+
</routers>
|
86 |
+
</frontend>
|
87 |
+
|
88 |
+
<admin>
|
89 |
+
<routers>
|
90 |
+
<msp_unifeedadm>
|
91 |
+
<use>admin</use>
|
92 |
+
<args>
|
93 |
+
<module>MSP_Unifeed</module>
|
94 |
+
<frontName>msp_unifeedadm</frontName>
|
95 |
+
</args>
|
96 |
+
</msp_unifeedadm>
|
97 |
+
</routers>
|
98 |
+
</admin>
|
99 |
+
|
100 |
+
<adminhtml>
|
101 |
+
<translate>
|
102 |
+
<modules>
|
103 |
+
<msp_unifeedadm>
|
104 |
+
<files>
|
105 |
+
<default>MSP_Unifeed.csv</default>
|
106 |
+
</files>
|
107 |
+
</msp_unifeedadm>
|
108 |
+
</modules>
|
109 |
+
</translate>
|
110 |
+
<acl>
|
111 |
+
<resources>
|
112 |
+
<admin>
|
113 |
+
<children>
|
114 |
+
<system>
|
115 |
+
<children>
|
116 |
+
<config>
|
117 |
+
<children>
|
118 |
+
<msp_unifeed translate="title" module="msp_unifeed">
|
119 |
+
<title>MSP Unifeed</title>
|
120 |
+
<sort_order>1000</sort_order>
|
121 |
+
</msp_unifeed>
|
122 |
+
</children>
|
123 |
+
</config>
|
124 |
+
</children>
|
125 |
+
</system>
|
126 |
+
<catalog>
|
127 |
+
<children>
|
128 |
+
<msp_unifeed translate="title" module="msp_unifeed">
|
129 |
+
<title>MSP Unifeed</title>
|
130 |
+
<sort_order>1000</sort_order>
|
131 |
+
<children>
|
132 |
+
<msp_unifeed_template translate="title" module="msp_unifeed">
|
133 |
+
<title>Templates</title>
|
134 |
+
<sort_order>10</sort_order>
|
135 |
+
</msp_unifeed_template>
|
136 |
+
<msp_unifeed_feed translate="title" module="msp_unifeed">
|
137 |
+
<title>Feeds</title>
|
138 |
+
<sort_order>20</sort_order>
|
139 |
+
</msp_unifeed_feed>
|
140 |
+
</children>
|
141 |
+
</msp_unifeed>
|
142 |
+
</children>
|
143 |
+
</catalog>
|
144 |
+
</children>
|
145 |
+
</admin>
|
146 |
+
</resources>
|
147 |
+
</acl>
|
148 |
+
|
149 |
+
<menu>
|
150 |
+
<catalog>
|
151 |
+
<children>
|
152 |
+
<msp_unifeed translate="title" module="msp_unifeed">
|
153 |
+
<title>MSP Unifeed</title>
|
154 |
+
<sort_order>1000</sort_order>
|
155 |
+
|
156 |
+
<children>
|
157 |
+
<msp_unifeed_template translate="title" module="msp_unifeed">
|
158 |
+
<title>Templates</title>
|
159 |
+
<action>msp_unifeedadm/template/index</action>
|
160 |
+
<sort_order>10</sort_order>
|
161 |
+
</msp_unifeed_template>
|
162 |
+
<msp_unifeed_feed translate="title" module="msp_unifeed">
|
163 |
+
<title>Feeds</title>
|
164 |
+
<action>msp_unifeedadm/feed/index</action>
|
165 |
+
<sort_order>20</sort_order>
|
166 |
+
</msp_unifeed_feed>
|
167 |
+
</children>
|
168 |
+
|
169 |
+
</msp_unifeed>
|
170 |
+
</children>
|
171 |
+
</catalog>
|
172 |
+
</menu>
|
173 |
+
|
174 |
+
<layout>
|
175 |
+
<updates>
|
176 |
+
<msp_unifeed module="msp_unifeed">
|
177 |
+
<file>msp_unifeed.xml</file>
|
178 |
+
</msp_unifeed>
|
179 |
+
</updates>
|
180 |
+
</layout>
|
181 |
+
</adminhtml>
|
182 |
+
|
183 |
+
<default>
|
184 |
+
<msp_unifeed>
|
185 |
+
<general>
|
186 |
+
<enabled>1</enabled>
|
187 |
+
<daily-rebuild>1</daily-rebuild>
|
188 |
+
</general>
|
189 |
+
</msp_unifeed>
|
190 |
+
</default>
|
191 |
+
<crontab>
|
192 |
+
<jobs>
|
193 |
+
<msp_unifeed_rebuild>
|
194 |
+
<schedule>
|
195 |
+
<cron_expr>0 22 * * *</cron_expr>
|
196 |
+
</schedule>
|
197 |
+
<run>
|
198 |
+
<model>msp_unifeed/observer::rebuildCatalog</model>
|
199 |
+
</run>
|
200 |
+
</msp_unifeed_rebuild>
|
201 |
+
</jobs>
|
202 |
+
</crontab>
|
203 |
+
|
204 |
+
</config>
|
app/code/community/MSP/Unifeed/etc/system.xml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<magespecialist translate="label" module="msp_unifeed">
|
5 |
+
<label>Magespecialist.it</label>
|
6 |
+
<sort_order>200</sort_order>
|
7 |
+
</magespecialist>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<msp_unifeed translate="label" module="msp_unifeed">
|
11 |
+
<label>UniFeed</label>
|
12 |
+
<tab>magespecialist</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>10</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<general translate="label">
|
20 |
+
<label>General</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<enabled translate="label">
|
28 |
+
<label>Enable UniFeed</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<sort_order>10</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>0</show_in_website>
|
34 |
+
<show_in_store>0</show_in_store>
|
35 |
+
</enabled>
|
36 |
+
<daily-rebuild translate="label">
|
37 |
+
<label>Daily rebuild</label>
|
38 |
+
<frontend_type>select</frontend_type>
|
39 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
40 |
+
<sort_order>20</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>0</show_in_website>
|
43 |
+
<show_in_store>0</show_in_store>
|
44 |
+
<comment>(starts at 10.00pm)</comment>
|
45 |
+
</daily-rebuild>
|
46 |
+
</fields>
|
47 |
+
</general>
|
48 |
+
</groups>
|
49 |
+
</msp_unifeed>
|
50 |
+
</sections>
|
51 |
+
</config>
|
app/code/community/MSP/Unifeed/sql/msp_unifeed_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
/* @var $this Mage_Core_Model_Resource_Setup */
|
22 |
+
|
23 |
+
$installer = $this;
|
24 |
+
$installer->startSetup();
|
25 |
+
$installer->run("
|
26 |
+
-- DROP TABLE IF EXISTS {$this->getTable('msp_unifeed_feed')};
|
27 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('msp_unifeed_feed')} (
|
28 |
+
`msp_unifeed_feed_id` int(11) NOT NULL auto_increment,
|
29 |
+
`store_id` int(11) NOT NULL,
|
30 |
+
`code` char(32) NOT NULL,
|
31 |
+
`name` varchar(255) NOT NULL,
|
32 |
+
`status` tinyint(1) NOT NULL default '1',
|
33 |
+
`msp_unifeed_template_id` int(11) NOT NULL,
|
34 |
+
`ga_source` text NOT NULL default '',
|
35 |
+
`ga_medium` text NOT NULL default '',
|
36 |
+
`ga_term` text NOT NULL default '',
|
37 |
+
`ga_content` text NOT NULL default '',
|
38 |
+
`ga_name` text NOT NULL default '',
|
39 |
+
PRIMARY KEY (`msp_unifeed_feed_id`),
|
40 |
+
UNIQUE KEY `code` (`code`)
|
41 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
42 |
+
");
|
43 |
+
|
44 |
+
$installer->run("
|
45 |
+
-- DROP TABLE IF EXISTS {$this->getTable('msp_unifeed_template')};
|
46 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('msp_unifeed_template')} (
|
47 |
+
`msp_unifeed_template_id` int(11) NOT NULL auto_increment,
|
48 |
+
`name` varchar(255) NOT NULL,
|
49 |
+
`type` varchar(255) NOT NULL,
|
50 |
+
`template_open` text NOT NULL default '',
|
51 |
+
`template_product` text NOT NULL default '',
|
52 |
+
`template_close` text NOT NULL default '',
|
53 |
+
PRIMARY KEY (`msp_unifeed_template_id`)
|
54 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
55 |
+
");
|
56 |
+
/*
|
57 |
+
$installer->run("
|
58 |
+
INSERT INTO {$this->getTable('msp_unifeed_template')} (`name`, `type`, `template_open`, `template_product`, `template_close`) VALUES
|
59 |
+
('Ciao', 'xml', '<"."?xml version=\"1.0\" encoding=\"UTF-8\" ?".">\r\n<products>', '{{set var=\"cstm_category\"}}{{implode var=\$category_names glue=\"#\"}}{{/set}}\r\n<product num=\"{{var product.getSku()}}\">\r\n<category>{{htmlescape var=\$cstm_category}}</category>\r\n<brand>{{htmlescape var=\$product.getAttributeText(''manufacturer'')}}</brand>\r\n<internal_ref>{{htmlescape var=\$product.getSku()}}</internal_ref>\r\n<designation>{{htmlescape var=\$product.getName()}}</designation>\r\n<price currency=\"{{var store.getBaseCurrencyCode()}}\">{{format var=\$final_price}}</price>\r\n<availability>{{format decimals=0 var=\$stock.getQty()}}</availability>\r\n<url>{{ga url=\$product.getProductUrl()}}</url>\r\n<img>{{var product.getImageUrl()}}</img>\r\n<decription>{{htmlescape var=\$product.getShortDescription()}}</decription>\r\n</product>', '</products>'),
|
60 |
+
('Kelkoo', 'xml', '<"."?xml version=\"1.0\" encoding=\"UTF-8\" ?".">\r\n<products>', '{{set var=\"cstm_category\"}}{{implode var=\$category_names glue=\"#\"}}{{/set}}\r\n<product>\r\n<Category>{{htmlescape var=\$cstm_category}}</Category>\r\n<Manufacturer>{{htmlescape var=\$product.getAttributeText(''manufacturer'')}}</Manufacturer>\r\n<Productname>{{htmlescape var=\$product.getName()}}</Productname>\r\n<Productcode>{{htmlescape var=\$product.getSku()}}</Productcode>\r\n<Price>{{format var=\$final_price}}</Price>\r\n<Availability>{{if a=\$stock.getQty() b=0 op=gt}}disponibile{{else}}non disponibile{{/if}}</Availability>\r\n<ProductURL>{{ga url=\$product.getProductUrl()}}</ProductURL>\r\n<ImageURL>{{var product.getImageUrl()}}</ImageURL>\r\n<Description>{{htmlescape var=\$product.getShortDescription()}}</Description>\r\n</product>', '</products>'),
|
61 |
+
('Buyplaza', 'txt', '', '{{set var=\"cstm_category\"}}{{implode var=\$category_names glue=\",\"}}{{/set}}\r\n{{var product.getName()}}|{{var product.getAttributeText(''manufacturer'')}}|{{striptags var=\$product.getShortDescription()}}|{{format var=\$final_price separator=\",\"}}|{{ga url=\$product.getProductUrl()}}|{{var cstm_category}}|{{var product.getImageUrl()}}{{newline}}', ''),
|
62 |
+
('Ilpiubasso', 'txt', '', '{{set var=\"cstm_category\"}}{{implode var=\$category_names glue=\",\"}}{{/set}}\r\n{{var cstm_category}}|{{var product.getName()}}|{{var product.getAttributeText(''manufacturer'')}}|{{striptags var=\$product.getShortDescription()}}|{{format var=\$final_price separator='',''}}|{{var product.getSku()}}|{{ga url=\$product.getProductUrl()}}|{{if a=\$stock.getQty() b=0 op=gt}}Disponibile{{else}}Non disponibile{{/if}}|{{var product.getImageUrl()}}|Vedi sito<Endrecord>', ''),
|
63 |
+
('MrWallet', 'xml', '<"."?xml version=\"1.0\" encoding=\"UTF-8\" ?".">\r\n<prodotti>', '{{set var=\"cstm_category\"}}{{implode var=\$category_names glue=\"#\"}}{{/set}}\r\n<prodotto>\r\n<categoria>{{htmlescape var=\$cstm_category}}</categoria>\r\n<marca>{{htmlescape var=\$product.getAttributeText(''manufacturer'')}}</marca>\r\n<nome>{{htmlescape var=\$product.getName()}}</nome>\r\n<id>{{htmlescape var=\$product.getSku()}}</id>\r\n<prezzo>{{format var=\$final_price}}</prezzo>\r\n<url>{{ga url=\$product.getProductUrl()}}</url>\r\n<immagine>{{var product.getImageUrl()}}</immagine>\r\n<descrizione>{{htmlescape var=\$product.getShortDescription()}}</descrizione>\r\n<lingua>{{var locale.getLocaleCode()}}</lingua>\r\n<valuta>{{var store.getBaseCurrencyCode()}}</valuta>\r\n<speseconsegna>-1</speseconsegna>\r\n</prodotto>', '</prodotti>'),
|
64 |
+
('TrovaPrezzi', 'txt', '', '{{set var=\"cstm_category\"}}{{implode var=\$category_names glue=\",\"}}{{/set}}\r\n{{var product.getName()}}|{{var product.getAttributeText(''manufacturer'')}}|{{striptags var=\$product.getShortDescription()}}|{{format var=\$final_price}}|{{var product.getSku()}}|{{ga url=\$product.getProductUrl()}}|{{if a=\$stock.getQty() b=0 op=gt}}disponibile{{else}}non disponibile{{/if}}|{{var cstm_category}}|{{var product.getImageUrl()}}|-1|{{var product.getSku()}}<endrecord>', '');
|
65 |
+
");
|
66 |
+
*/
|
67 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
68 |
+
$setup->startSetup();
|
69 |
+
$setup->addAttribute('catalog_category', 'msp_unifeed_ids', array(
|
70 |
+
'label' => 'MSP UniFeed',
|
71 |
+
'type' => 'varchar',
|
72 |
+
'input' => '',
|
73 |
+
'backend' => 'msp_unifeed/eav_entity_attribute_backend_feed',
|
74 |
+
'visible' => false,
|
75 |
+
'visible_on_front' => false,
|
76 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
77 |
+
'required' => false
|
78 |
+
));
|
79 |
+
|
80 |
+
$setup->endSetup();
|
81 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/msp_unifeed.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* IDEALIAGroup srl
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 info@idealiagroup.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category MSP
|
17 |
+
* @package MSP_Unifeed
|
18 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<layout>
|
23 |
+
<adminhtml_catalog_category_edit>
|
24 |
+
<reference name="tabs">
|
25 |
+
<block type="msp_unifeed/adminhtml_catalog_category_edit_tab_feed" name="tab_msp_unifeed" template="msp_unifeed/catalog/category/edit/feed.phtml" />
|
26 |
+
<action method="addTab"><name>msp_unifeed</name><block>tab_msp_unifeed</block></action>
|
27 |
+
</reference>
|
28 |
+
</adminhtml_catalog_category_edit>
|
29 |
+
</layout>
|
app/design/adminhtml/default/default/template/msp_unifeed/catalog/category/edit/feed.phtml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
?>
|
21 |
+
<div class="entry-edit">
|
22 |
+
<div class="entry-edit-head">
|
23 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('msp_unifeed')->__('Catalog feeds')?></h4>
|
24 |
+
</div>
|
25 |
+
<fieldset id="fieldset">
|
26 |
+
<input type="hidden" name="category[msp_unifeed_ids][]" value="" />
|
27 |
+
<table class="form-list" cellspacing="0">
|
28 |
+
<tbody>
|
29 |
+
<?php foreach ($this->getFeedsCollection() as $_feed): ?>
|
30 |
+
<tr>
|
31 |
+
<td class="label"><input name="general[msp_unifeed_ids][]" value="<?php echo $_feed->getId() ?>" class="checkbox feed-checkbox" id="category_feed_<?php echo $_feed->getId() ?>" type="checkbox"<?php if ($this->hasFeed($_feed->getId())): ?> checked="true"<?php endif; ?>/> <?php echo $_feed->getName()?></td>
|
32 |
+
<td class="scope-label">[GLOBAL]</td>
|
33 |
+
</tr>
|
34 |
+
<?php endforeach; ?>
|
35 |
+
</tbody>
|
36 |
+
</table>
|
37 |
+
</fieldset>
|
38 |
+
</div>
|
app/design/adminhtml/default/default/template/msp_unifeed/edit/categories.phtml
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="tree-actions">
|
2 |
+
<a href="#" onclick="nodesTree.collapseAll(); return false;"><?php echo Mage::helper('msp_unifeed')->__('Collapse All'); ?></a>
|
3 |
+
<span class="separator">|</span>
|
4 |
+
<a href="#" onclick="nodesTree.expandAll(); return false;"><?php echo Mage::helper('msp_unifeed')->__('Expand All'); ?></a>
|
5 |
+
</div>
|
6 |
+
<br/>
|
7 |
+
<div class="tree-holder">
|
8 |
+
<div id="tree-div" style="width:100%; overflow:auto;"></div>
|
9 |
+
</div>
|
10 |
+
|
11 |
+
<input type="hidden" name="categories" id="serializedCategories" value="null" />
|
12 |
+
|
13 |
+
<script type="text/javascript">
|
14 |
+
var nodesTree;
|
15 |
+
var rootNode;
|
16 |
+
|
17 |
+
function getRecursiveSelected(out, node)
|
18 |
+
{
|
19 |
+
try
|
20 |
+
{
|
21 |
+
if (node.getUI().checked()) out.push(node.id);
|
22 |
+
}
|
23 |
+
catch(e) {}
|
24 |
+
|
25 |
+
if (node.childNodes.length)
|
26 |
+
{
|
27 |
+
for (var i=0; i<node.childNodes.length; i++)
|
28 |
+
{
|
29 |
+
out = getRecursiveSelected(out, node.childNodes[i]);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
return out;
|
34 |
+
}
|
35 |
+
|
36 |
+
function doSave()
|
37 |
+
{
|
38 |
+
var sel=new Array();
|
39 |
+
sel = getRecursiveSelected(sel, rootNode);
|
40 |
+
|
41 |
+
$('serializedCategories').value = sel.join(',');
|
42 |
+
}
|
43 |
+
|
44 |
+
function nodeCheck(node, state)
|
45 |
+
{
|
46 |
+
if (node.childNodes.length)
|
47 |
+
{
|
48 |
+
for (var i = 0; i < node.childNodes.length; i++)
|
49 |
+
{
|
50 |
+
if (node.childNodes[i].getUI().checked()) continue;
|
51 |
+
node.childNodes[i].getUI().check(state, true);
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
doSave();
|
56 |
+
}
|
57 |
+
|
58 |
+
Ext.onReady(function() {
|
59 |
+
// Build loader
|
60 |
+
var treeLoader = new Ext.tree.CustomUITreeLoader({
|
61 |
+
dataUrl : '<?php echo $this->getTreeUrl() ?>',
|
62 |
+
baseAttr: {
|
63 |
+
uiProvider: Ext.tree.CheckboxNodeUI
|
64 |
+
}
|
65 |
+
});
|
66 |
+
|
67 |
+
// Build tree
|
68 |
+
nodesTree = new Ext.tree.TreePanel('tree-div', {
|
69 |
+
animate : true,
|
70 |
+
loader : treeLoader,
|
71 |
+
enableDD : false,
|
72 |
+
rootVisible : false,
|
73 |
+
containerScroll : true
|
74 |
+
});
|
75 |
+
|
76 |
+
// Build root
|
77 |
+
rootNode = new Ext.tree.AsyncTreeNode({
|
78 |
+
text : '',
|
79 |
+
draggable : false,
|
80 |
+
id : '0'
|
81 |
+
});
|
82 |
+
|
83 |
+
nodesTree.setRootNode(rootNode);
|
84 |
+
nodesTree.render();
|
85 |
+
rootNode.expand();
|
86 |
+
|
87 |
+
// Events handler
|
88 |
+
nodesTree.on('check', nodeCheck);
|
89 |
+
});
|
90 |
+
</script>
|
app/design/adminhtml/default/default/template/msp_unifeed/edit/form.phtml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<div class="entry-edit">
|
2 |
+
<?php echo $this->getFormHtml();?>
|
3 |
+
</div>
|
4 |
+
<?php echo $this->getChildHtml('form_after');?>
|
app/design/adminhtml/default/default/template/msp_unifeed/edit/ga/after.phtml
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<b><?php echo $this->__('Please note:') ?></b><br />
|
2 |
+
<?php echo $this->__('To activate Google Analytics Tracking you have to use directive "ga" to generate a correct tracking URL in your feed template.') ?><br />
|
3 |
+
<?php echo $this->__('E.g.: <i>{{ga url=$product.getProductUrl()}}</i>.') ?>
|
app/design/adminhtml/default/default/template/msp_unifeed/edit/settings/after.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php echo $this->__('<b>Feed URL</b>: %s', $this->getFeedUrl()) ?><br />
|
app/etc/modules/MSP_Unifeed.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* IDEALIAGroup srl
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 info@idealiagroup.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category MSP
|
17 |
+
* @package MSP_Unifeed
|
18 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<config>
|
23 |
+
<modules>
|
24 |
+
<MSP_Unifeed>
|
25 |
+
<active>true</active>
|
26 |
+
<codePool>community</codePool>
|
27 |
+
</MSP_Unifeed>
|
28 |
+
</modules>
|
29 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>MSP_Unifeed</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Cookie Notice</summary>
|
10 |
+
<description>Cookie Notice</description>
|
11 |
+
<notes>Enjoy it ;)</notes>
|
12 |
+
<authors><author><name>Riccardo Tempesta</name><user>idealiagroup</user><email>tempesta@idealiagroup.com</email></author></authors>
|
13 |
+
<date>2014-06-18</date>
|
14 |
+
<time>15:19:18</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="MSP_Unifeed.xml" hash="25a1764e43ceba9e33c69c1d71c7305d"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="msp_unifeed.xml" hash="d58b29b9ed80eb2f6ee2c49991258406"/></dir><dir name="template"><dir name="msp_unifeed"><dir name="catalog"><dir name="category"><dir name="edit"><file name="feed.phtml" hash="e51d110f08b07af8fe7d297118992394"/></dir></dir></dir><dir name="edit"><file name="categories.phtml" hash="a55924211d0754ca3c5411b959cba211"/><file name="form.phtml" hash="07d9ec21daa220cf984483da7f28a2ec"/><dir name="ga"><file name="after.phtml" hash="c9f868dda6080d96b99401ea2ca138f3"/></dir><dir name="settings"><file name="after.phtml" hash="587bd70132a7abcd44910295b4793be5"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="MSP"><dir name="Unifeed"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Category"><dir name="Edit"><dir name="Tab"><file name="Feed.php" hash="daac88998046e5bcb8bba2a204cfab62"/></dir></dir></dir></dir><dir name="Template"><dir name="Edit"><file name="Form.php" hash="d3c4d5cd3fb41ccecd141f1d5837447b"/></dir><file name="Edit.php" hash="40711dff46a1ec9839648c0c7d7c76cf"/><file name="Grid.php" hash="ca01f1fc1bbf7afa05008e5388fe1752"/></dir><file name="Template.php" hash="ccdea2f6871b9059468b9cefb3f74629"/><dir name="Unifeed"><dir name="Edit"><file name="Form.php" hash="13d72691770d31ee28b0ea198e785c17"/><dir name="Tab"><file name="Categories.php" hash="f9535ed46f5dc7d25df09691cc8cad4c"/><dir name="Ga"><file name="After.php" hash="9e16c571f526edb7ffad9f593eb50886"/></dir><file name="Ga.php" hash="da0bf500a03c8fb3aeb6a6a0339982f1"/><dir name="Settings"><file name="After.php" hash="61f1dd0570f12cec4e4a38c5624ad55b"/></dir><file name="Settings.php" hash="9bf00ccb20560c16ce757607c927247d"/></dir><file name="Tabs.php" hash="b0059b2e427653e96fdc90b576aeeee7"/></dir><file name="Edit.php" hash="1b5f2f0ae8d3fbad842d586c1c68797b"/><file name="Grid.php" hash="4c57fcdbbe196cc0add2ea88129b8c1c"/></dir><file name="Unifeed.php" hash="4fe9cda2d8344e94b604493d9ec557a5"/></dir></dir><dir name="Helper"><file name="Data.php" hash="30f9ac0e686d5b747d3796bb098f5a27"/></dir><dir name="Model"><dir name="Eav"><dir name="Entity"><dir name="Attribute"><dir name="Backend"><file name="Feed.php" hash="3c0b69958118a59afaa1a19978515037"/></dir></dir></dir></dir><dir name="Feed"><file name="Attribute.php" hash="7712fb54c8ff2a7e505e94815b1e31ff"/><file name="Status.php" hash="0a710ca1ccbdfa44191ab935b2ddd45e"/></dir><file name="Feed.php" hash="25038f531a5a61978eb96a0301484ee4"/><file name="Observer.php" hash="5b2d6b065deb36a3504b9af141b01e78"/><dir name="Product"><file name="Feed.php" hash="35f61b358e553429e445a4d123ec7d17"/></dir><dir name="Resource"><dir name="Catalog"><dir name="Eav"><dir name="Mysql4"><dir name="Product"><file name="Collection.php" hash="af9eb6c7bd3026156733412d56c6057a"/></dir></dir></dir></dir><dir name="Feed"><file name="Collection.php" hash="1703dafd4b4bf686a0808b3c479a677e"/></dir><file name="Feed.php" hash="7fc0e3b80809843902621a19edc0c675"/><dir name="Template"><file name="Collection.php" hash="f0f03cd1b39ab2ea42ff5c7943d3bc9b"/></dir><file name="Template.php" hash="a745a39765ec85abadb97e42aa57a338"/></dir><dir name="Template"><file name="Abstract.php" hash="3342110faa5e1f3bed3f27af41e84aa7"/><file name="Container.php" hash="867c2c53f262ec8ec962061fff74535b"/><file name="Product.php" hash="cb7043e21534af003efe70e01002fd07"/><file name="Type.php" hash="84cc2ad2997f1925484fd1c17a9f4f29"/></dir><file name="Template.php" hash="aaa76afb224952bc8a40572dcf310927"/><file name="Tree.php" hash="c94c537b83f12051b697c61d396e030e"/></dir><dir name="controllers"><file name="FeedController.php" hash="3de5daec7c5d4a85f10521a0653d6006"/><file name="OutputController.php" hash="c814bd2eac947c189c88afc3f9dfa601"/><file name="TemplateController.php" hash="7c5618f004cdc7f61aaba8cecebb9d29"/></dir><dir name="etc"><file name="config.xml" hash="f703620d26992f7524ceefb8925d52e5"/><file name="system.xml" hash="ab66a42e26a4480714a321458ed16e4d"/></dir><dir name="sql"><dir name="msp_unifeed_setup"><file name="mysql4-install-1.0.0.php" hash="3b8c564a513fd35fe2c5a4cf8ea189de"/></dir></dir></dir></dir></target><target name="mage"><dir name="shell"><file name="unifeed.php" hash="060ee36d9bc0222cce1eba933b9fa2e0"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
shell/unifeed.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* IDEALIAGroup srl
|
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 info@idealiagroup.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category MSP
|
16 |
+
* @package MSP_Unifeed
|
17 |
+
* @copyright Copyright (c) 2014 IDEALIAGroup srl (http://www.idealiagroup.com)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
$magePath = dirname(dirname(__FILE__));
|
22 |
+
require_once($magePath.'/app/Mage.php');
|
23 |
+
|
24 |
+
Mage::app('admin')->setUseSessionInUrl(false);
|
25 |
+
Mage::getModel('msp_unifeed/feed')->buildAll();
|