Version Notes
Enjoy it ;)
Download this release
Release Info
Developer | Riccardo Tempesta |
Extension | MSP_Unifeed |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.4
- .gitignore +3 -0
- Changelog.txt +11 -0
- License.txt +0 -0
- README.md +17 -0
- app/code/community/MSP/Unifeed/Block/Adminhtml/Catalog/Category/Edit/Tab/Feed.php +72 -72
- app/code/community/MSP/Unifeed/Block/Adminhtml/Template.php +32 -32
- app/code/community/MSP/Unifeed/Block/Adminhtml/Template/Edit.php +45 -45
- app/code/community/MSP/Unifeed/Block/Adminhtml/Template/Edit/Form.php +82 -82
- app/code/community/MSP/Unifeed/Block/Adminhtml/Template/Grid.php +95 -95
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed.php +38 -38
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit.php +56 -56
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Form.php +36 -36
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Categories.php +33 -33
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Ga.php +69 -69
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Ga/After.php +28 -28
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Settings.php +88 -88
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tab/Settings/After.php +51 -51
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Edit/Tabs.php +58 -58
- app/code/community/MSP/Unifeed/Block/Adminhtml/Unifeed/Grid.php +184 -184
- app/code/community/MSP/Unifeed/Helper/Data.php +22 -22
- app/code/community/MSP/Unifeed/Model/Eav/Entity/Attribute/Backend/Feed.php +39 -39
- app/code/community/MSP/Unifeed/Model/Feed.php +578 -575
- app/code/community/MSP/Unifeed/Model/Feed/Attribute.php +58 -58
- app/code/community/MSP/Unifeed/Model/Feed/Status.php +45 -45
- app/code/community/MSP/Unifeed/Model/Observer.php +40 -40
- app/code/community/MSP/Unifeed/Model/Product/Feed.php +79 -79
- app/code/community/MSP/Unifeed/Model/Resource/Catalog/Eav/Mysql4/Product/Collection.php +45 -45
- app/code/community/MSP/Unifeed/Model/Resource/Feed.php +31 -31
- app/code/community/MSP/Unifeed/Model/Resource/Feed/Collection.php +37 -37
- app/code/community/MSP/Unifeed/Model/Resource/Template.php +31 -31
- app/code/community/MSP/Unifeed/Model/Resource/Template/Collection.php +37 -37
- app/code/community/MSP/Unifeed/Model/Template.php +50 -50
- app/code/community/MSP/Unifeed/Model/Template/Abstract.php +226 -226
- app/code/community/MSP/Unifeed/Model/Template/Container.php +24 -24
- app/code/community/MSP/Unifeed/Model/Template/Product.php +96 -96
- app/code/community/MSP/Unifeed/Model/Template/Type.php +48 -48
- app/code/community/MSP/Unifeed/Model/Tree.php +137 -137
- app/code/community/MSP/Unifeed/controllers/{FeedController.php → Adminhtml/Unifeed/FeedController.php} +274 -270
- app/code/community/MSP/Unifeed/controllers/{TemplateController.php → Adminhtml/Unifeed/TemplateController.php} +140 -136
- app/code/community/MSP/Unifeed/controllers/OutputController.php +94 -94
- app/code/community/MSP/Unifeed/etc/config.xml +204 -204
- app/code/community/MSP/Unifeed/etc/system.xml +50 -50
- app/code/community/MSP/Unifeed/sql/msp_unifeed_setup/mysql4-install-1.0.0.php +81 -81
- app/design/adminhtml/default/default/layout/msp_unifeed.xml +29 -29
- app/design/adminhtml/default/default/template/msp_unifeed/catalog/category/edit/feed.phtml +38 -38
- app/design/adminhtml/default/default/template/msp_unifeed/edit/categories.phtml +90 -90
- app/design/adminhtml/default/default/template/msp_unifeed/edit/form.phtml +4 -4
- app/design/adminhtml/default/default/template/msp_unifeed/edit/ga/after.phtml +3 -3
- app/design/adminhtml/default/default/template/msp_unifeed/edit/settings/after.phtml +1 -1
- app/etc/modules/MSP_Unifeed.xml +28 -28
- composer.json +23 -0
- modman +5 -0
- package.xml +2 -18
- shell/unifeed.php +33 -25
.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
.idea/
|
2 |
+
*~
|
3 |
+
*.swp
|
Changelog.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
1.0.2
|
2 |
|
3 |
Bugfix release
|
1 |
+
1.0.4
|
2 |
+
|
3 |
+
Changes related to SUPEE-6788
|
4 |
+
|
5 |
+
1.0.3
|
6 |
+
|
7 |
+
Added controller authorization check
|
8 |
+
Standardization of shell script
|
9 |
+
Modman and composer config
|
10 |
+
Collection fix for 1.9
|
11 |
+
|
12 |
1.0.2
|
13 |
|
14 |
Bugfix release
|
License.txt
CHANGED
File without changes
|
README.md
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# MSP Unifeed Magento extension
|
2 |
+
==================
|
3 |
+
|
4 |
+
MSP Unifeed is an easy and flexible extension to create product feeds in multiple formats (csv, txt or xml) for any external platform which need to import your catalog.
|
5 |
+
You can create feed models with your own syntax using a lot of available variables and directives to retrieve information about stores and products and parse it with conditional and programmable statements.
|
6 |
+
|
7 |
+
Extension's development is available on github here:
|
8 |
+
https://github.com/magespecialist/MSP_Unifeed
|
9 |
+
while Magento stable packages are available for free at MageSpecialist website here:
|
10 |
+
http://www.magespecialist.it/en/unifeed.html
|
11 |
+
|
12 |
+
Quick programming reference is available at https://github.com/magespecialist/MSP_Unifeed/wiki/Quick-programming-reference
|
13 |
+
|
14 |
+
# Dependency notice
|
15 |
+
Be sure to install MSP_Common magento extension **before** MSP Unifeed or your store could not work properly.
|
16 |
+
You can install it via Magento Connect here: http://www.magentocommerce.com/magento-connect/msp-common.html
|
17 |
+
(Ignore this dependency if you use composer to install the extension)
|
app/code/community/MSP/Unifeed/Block/Adminhtml/Catalog/Category/Edit/Tab/Feed.php
CHANGED
@@ -1,72 +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 |
-
}
|
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
CHANGED
@@ -1,32 +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 |
-
}
|
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
CHANGED
@@ -1,45 +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 |
-
}
|
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
CHANGED
@@ -1,82 +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 |
-
}
|
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
CHANGED
@@ -1,95 +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 |
-
}
|
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
CHANGED
@@ -1,38 +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 |
-
}
|
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
CHANGED
@@ -1,56 +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 |
-
}
|
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
CHANGED
@@ -1,36 +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 |
-
}
|
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
CHANGED
@@ -1,33 +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 |
-
}
|
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
CHANGED
@@ -1,69 +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 |
-
}
|
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
CHANGED
@@ -1,28 +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 |
-
}
|
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
CHANGED
@@ -1,88 +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 |
-
}
|
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
CHANGED
@@ -1,51 +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 |
-
}
|
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
CHANGED
@@ -1,58 +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 |
-
}
|
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
CHANGED
@@ -1,184 +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 |
-
}
|
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
CHANGED
@@ -1,23 +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 |
}
|
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
CHANGED
@@ -1,39 +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 |
-
}
|
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
CHANGED
@@ -1,575 +1,578 @@
|
|
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 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
$
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
->
|
153 |
-
->
|
154 |
-
->
|
155 |
-
->
|
156 |
-
->
|
157 |
-
->
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
*
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
if (!$this->
|
236 |
-
$this
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
if (!$this->
|
254 |
-
return $this;
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
@
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
if ($this->
|
307 |
-
$utm[] = '
|
308 |
-
|
309 |
-
if ($this->
|
310 |
-
$utm[] = '
|
311 |
-
|
312 |
-
if ($this->
|
313 |
-
$utm[] = '
|
314 |
-
|
315 |
-
if ($this->
|
316 |
-
$utm[] = '
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
*
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
$
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
`
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
$mediaGalleryByProductId[$k]
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
*
|
380 |
-
*
|
381 |
-
* @
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
$info
|
392 |
-
|
393 |
-
$info['
|
394 |
-
$info['
|
395 |
-
$info['
|
396 |
-
$info['
|
397 |
-
|
398 |
-
$info['
|
399 |
-
$
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
$
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
$
|
409 |
-
$
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
$
|
419 |
-
|
420 |
-
|
421 |
-
$
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
$
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
if (
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
if (
|
504 |
-
return
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
if (!$this->
|
537 |
-
return $this;
|
538 |
-
|
539 |
-
if (!$this->
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
//
|
550 |
-
$
|
551 |
-
|
552 |
-
|
553 |
-
$
|
554 |
-
|
555 |
-
$
|
556 |
-
$
|
557 |
-
|
558 |
-
|
559 |
-
$
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
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 |
+
// Fix for Magento 1.9
|
140 |
+
$collection->setStoreId($this->getStoreId());
|
141 |
+
|
142 |
+
$visibility = array(
|
143 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
|
144 |
+
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
|
145 |
+
);
|
146 |
+
|
147 |
+
$categories = $this->getCategoryIdsArray();
|
148 |
+
if (!count($categories))
|
149 |
+
return null;
|
150 |
+
|
151 |
+
$collection
|
152 |
+
->addAttributeToSelect('*')
|
153 |
+
->addStoreFilter($this->getStoreId())
|
154 |
+
->addWebsiteFilter($this->getStore()->getWebsite())
|
155 |
+
->addPriceData(0, $this->getStore()->getWebsiteId())
|
156 |
+
->joinAttribute('custom_name', 'catalog_product/name', 'entity_id', null, 'inner', $store->getId())
|
157 |
+
->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $store->getId())
|
158 |
+
->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', $store->getId())
|
159 |
+
->addAttributeToFilter('visibility', $visibility)
|
160 |
+
->addCategoriesFilter($categories);
|
161 |
+
|
162 |
+
$this->addMediaGalleryAttributeToCollection($collection);
|
163 |
+
|
164 |
+
$collection
|
165 |
+
->load();
|
166 |
+
|
167 |
+
return $collection;
|
168 |
+
}
|
169 |
+
|
170 |
+
protected function getContainerFilterModel()
|
171 |
+
{
|
172 |
+
if (!$this->_containerFilter)
|
173 |
+
$this->_containerFilter = Mage::getModel('msp_unifeed/template_container');
|
174 |
+
|
175 |
+
return $this->_containerFilter;
|
176 |
+
}
|
177 |
+
|
178 |
+
protected function getProductFilterModel()
|
179 |
+
{
|
180 |
+
if (!$this->_productFilter)
|
181 |
+
$this->_productFilter = Mage::getModel('msp_unifeed/template_product');
|
182 |
+
|
183 |
+
return $this->_productFilter;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Get category
|
188 |
+
* @param $id
|
189 |
+
* @return Mage_Catalog_Model_Category
|
190 |
+
*/
|
191 |
+
protected function getCategory($id)
|
192 |
+
{
|
193 |
+
if (!isset($this->_categories[$id]))
|
194 |
+
$this->_categories[$id] = Mage::getModel('catalog/category')->load($id);
|
195 |
+
|
196 |
+
return $this->_categories[$id];
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Open buffer file
|
201 |
+
*
|
202 |
+
* @return MSP_UniFeed_Model_Feed
|
203 |
+
*/
|
204 |
+
protected function openBufferFile()
|
205 |
+
{
|
206 |
+
if (!$this->getId())
|
207 |
+
return $this;
|
208 |
+
|
209 |
+
$this->_fpBuffer = fopen($this->getBufferFileName(), 'a');
|
210 |
+
return $this;
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Clear buffer file
|
215 |
+
*
|
216 |
+
* @return MSP_UniFeed_Model_Feed
|
217 |
+
*/
|
218 |
+
protected function clearBufferFile()
|
219 |
+
{
|
220 |
+
if (!$this->getId())
|
221 |
+
return $this;
|
222 |
+
|
223 |
+
@unlink($this->getBufferFileName());
|
224 |
+
return $this;
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Write buffer immediately
|
229 |
+
*
|
230 |
+
* @param string $buffer
|
231 |
+
* @return MSP_UniFeed_Model_Feed
|
232 |
+
*/
|
233 |
+
protected function writeBufferFile($buffer)
|
234 |
+
{
|
235 |
+
if (!$this->getId())
|
236 |
+
return $this;
|
237 |
+
|
238 |
+
if (!$this->_fpBuffer)
|
239 |
+
$this->openBufferFile();
|
240 |
+
|
241 |
+
fputs($this->_fpBuffer, $buffer);
|
242 |
+
|
243 |
+
return $this;
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Close buffer file
|
248 |
+
*
|
249 |
+
* @return MSP_UniFeed_Model_Feed
|
250 |
+
*/
|
251 |
+
protected function closeBufferFile()
|
252 |
+
{
|
253 |
+
if (!$this->getId())
|
254 |
+
return $this;
|
255 |
+
|
256 |
+
if (!$this->_fpBuffer)
|
257 |
+
return $this;
|
258 |
+
|
259 |
+
fclose($this->_fpBuffer);
|
260 |
+
$this->_fpBuffer = 0;
|
261 |
+
return $this;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Finalize buffer file
|
266 |
+
*
|
267 |
+
* @return MSP_UniFeed_Model_Feed
|
268 |
+
*/
|
269 |
+
protected function finalizeBufferFile()
|
270 |
+
{
|
271 |
+
if (!$this->getId())
|
272 |
+
return $this;
|
273 |
+
|
274 |
+
@rename($this->getBufferFileName(), $this->getFinalFileName());
|
275 |
+
@unlink($this->getRebuildFileName());
|
276 |
+
@unlink($this->getPositionFileName());
|
277 |
+
@unlink($this->getIdsFileName());
|
278 |
+
|
279 |
+
return $this;
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Get AMP for current format
|
284 |
+
*
|
285 |
+
* @return string
|
286 |
+
*/
|
287 |
+
public function getAmp()
|
288 |
+
{
|
289 |
+
if (($this->getType() == 'xml') || ($this->getType() == 'html'))
|
290 |
+
return '&';
|
291 |
+
|
292 |
+
return '&';
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Get GoogleAnalytics string
|
297 |
+
*
|
298 |
+
* @return string
|
299 |
+
*/
|
300 |
+
public function getGaQueryString()
|
301 |
+
{
|
302 |
+
$utm = array();
|
303 |
+
|
304 |
+
$amp = $this->getAmp();
|
305 |
+
|
306 |
+
if ($this->getGaSource())
|
307 |
+
$utm[] = 'utm_source='.urlencode($this->getGaSource());
|
308 |
+
|
309 |
+
if ($this->getGaMedium())
|
310 |
+
$utm[] = 'utm_medium='.urlencode($this->getGaMedium());
|
311 |
+
|
312 |
+
if ($this->getGaTerm())
|
313 |
+
$utm[] = 'utm_term='.urlencode($this->getGaTerm());
|
314 |
+
|
315 |
+
if ($this->getGaContent())
|
316 |
+
$utm[] = 'utm_content='.urlencode($this->getGaContent());
|
317 |
+
|
318 |
+
if ($this->getGaName())
|
319 |
+
$utm[] = 'utm_campaign='.urlencode($this->getGaName());
|
320 |
+
|
321 |
+
return join($amp, $utm);
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Load mediagallery with product's collection
|
326 |
+
*
|
327 |
+
* @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $productCollection
|
328 |
+
* @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
|
329 |
+
*/
|
330 |
+
protected function addMediaGalleryAttributeToCollection(Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $productCollection)
|
331 |
+
{
|
332 |
+
if (!count($productCollection->getAllIds()))
|
333 |
+
return $productCollection;
|
334 |
+
|
335 |
+
$mediaGalleryAttributeId = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'media_gallery')->getAttributeId();
|
336 |
+
$resource = Mage::getSingleton('core/resource');
|
337 |
+
$read = $resource->getConnection('catalog_read');
|
338 |
+
|
339 |
+
$mediaGalleryData = $read->fetchAll('
|
340 |
+
SELECT
|
341 |
+
main.entity_id, `main`.`value_id`, `main`.`value` AS `file`,
|
342 |
+
`value`.`label`, `value`.`position`, `value`.`disabled`, `default_value`.`label` AS `label_default`,
|
343 |
+
`default_value`.`position` AS `position_default`,
|
344 |
+
`default_value`.`disabled` AS `disabled_default`
|
345 |
+
FROM '.$resource->getTableName('catalog_product_entity_media_gallery').' AS `main`
|
346 |
+
LEFT JOIN '.$resource->getTableName('catalog_product_entity_media_gallery_value').' AS `value`
|
347 |
+
ON main.value_id=value.value_id AND value.store_id=' . Mage::app()->getStore()->getId() . '
|
348 |
+
LEFT JOIN '.$resource->getTableName('catalog_product_entity_media_gallery_value').' AS `default_value`
|
349 |
+
ON main.value_id=default_value.value_id AND default_value.store_id=0
|
350 |
+
WHERE (
|
351 |
+
main.attribute_id = '.$read->quote($mediaGalleryAttributeId).')
|
352 |
+
AND (main.entity_id IN ('.$read->quote($productCollection->getAllIds()).'))
|
353 |
+
ORDER BY IF(value.position IS NULL, default_value.position, value.position) ASC
|
354 |
+
');
|
355 |
+
|
356 |
+
$mediaGalleryByProductId = array();
|
357 |
+
foreach ($mediaGalleryData as $galleryImage) {
|
358 |
+
$k = $galleryImage['entity_id'];
|
359 |
+
unset($galleryImage['entity_id']);
|
360 |
+
if (!isset($mediaGalleryByProductId[$k])) {
|
361 |
+
$mediaGalleryByProductId[$k] = array();
|
362 |
+
}
|
363 |
+
$mediaGalleryByProductId[$k][] = $galleryImage;
|
364 |
+
}
|
365 |
+
unset($mediaGalleryData);
|
366 |
+
|
367 |
+
foreach ($productCollection as &$product) {
|
368 |
+
$productId = $product->getData('entity_id');
|
369 |
+
if (isset($mediaGalleryByProductId[$productId])) {
|
370 |
+
$product->setData('media_gallery', array('images' => $mediaGalleryByProductId[$productId]));
|
371 |
+
}
|
372 |
+
}
|
373 |
+
unset($mediaGalleryByProductId);
|
374 |
+
|
375 |
+
return $productCollection;
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Return single product feed
|
380 |
+
*
|
381 |
+
* @param Mage_Core_Model_Catalog_Product
|
382 |
+
* @param array $baseInfo [optional]
|
383 |
+
* @param bool $categorySkip [optional]
|
384 |
+
* @return string
|
385 |
+
*/
|
386 |
+
protected function getProductFeed($product, $baseInfo = array())
|
387 |
+
{
|
388 |
+
if (!$this->getId())
|
389 |
+
return '';
|
390 |
+
|
391 |
+
$info = $baseInfo;
|
392 |
+
|
393 |
+
$info['product'] = $product;
|
394 |
+
$info['stock'] = $this->_stockModel->loadByProduct($product);
|
395 |
+
$info['final_price'] = $product->getFinalPrice();
|
396 |
+
$info['final_price_rule'] = Mage::getModel('catalogrule/rule')->calcProductPriceRule($product, $product->getMinimalPrice());
|
397 |
+
$info['final_price_tax'] = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true);
|
398 |
+
$info['final_price_notax'] = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), false);
|
399 |
+
$info['catalog_price'] = $product->getPriceModel()->getFinalPrice(1, $product);
|
400 |
+
|
401 |
+
$info['images'] = array();
|
402 |
+
$mediaGallery = $product->getMediaGalleryImages();
|
403 |
+
|
404 |
+
foreach ($mediaGallery as $image)
|
405 |
+
$info['images'][] = $image['url'];
|
406 |
+
|
407 |
+
$n = 0;
|
408 |
+
$categories = array();
|
409 |
+
$categoryNames = array();
|
410 |
+
|
411 |
+
$categoryIds = array();
|
412 |
+
$categoryIdsTmp = $product->getCategoryIds();
|
413 |
+
|
414 |
+
foreach ($categoryIdsTmp as $categoryId) $categoryIds[] = $categoryId;
|
415 |
+
|
416 |
+
foreach ($categoryIds as $categoryId)
|
417 |
+
{
|
418 |
+
$category = $this->getCategory($categoryId);
|
419 |
+
if ($category->getIsActive()) continue;
|
420 |
+
|
421 |
+
$info["category$n"] = $category;
|
422 |
+
|
423 |
+
$categories[] = $category;
|
424 |
+
$categoryNames[] = $category->getName();
|
425 |
+
$n++;
|
426 |
+
}
|
427 |
+
|
428 |
+
$info['categories'] = $categories;
|
429 |
+
$info['category_names'] = $categoryNames;
|
430 |
+
|
431 |
+
$item = $this->getProductFilterModel()->setVariables($info)->setFeed($this)->filter($this->getTemplate()->getTemplateProduct());
|
432 |
+
|
433 |
+
return $item;
|
434 |
+
}
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Set rebuild flag
|
438 |
+
*
|
439 |
+
* @return MSP_UniFeed_Model_Feed
|
440 |
+
*/
|
441 |
+
public function setRebuildFlag()
|
442 |
+
{
|
443 |
+
if (!$this->getId())
|
444 |
+
return $this;
|
445 |
+
|
446 |
+
$fp = fopen($this->getRebuildFileName(), 'w');
|
447 |
+
fputs($fp, time());
|
448 |
+
fclose($fp);
|
449 |
+
|
450 |
+
return $this;
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Get rebuild flag
|
455 |
+
*
|
456 |
+
* @return bool
|
457 |
+
*/
|
458 |
+
public function getRebuildFlag()
|
459 |
+
{
|
460 |
+
if (!$this->getId())
|
461 |
+
return 0;
|
462 |
+
|
463 |
+
clearstatcache();
|
464 |
+
return file_exists($this->getRebuildFileName()) || !file_exists($this->getFinalFileName());
|
465 |
+
}
|
466 |
+
|
467 |
+
/**
|
468 |
+
* Get build status
|
469 |
+
*
|
470 |
+
* @return int
|
471 |
+
*/
|
472 |
+
public function getBuildStatus()
|
473 |
+
{
|
474 |
+
if (!$this->getId())
|
475 |
+
return -1;
|
476 |
+
|
477 |
+
if (!file_exists($this->getFinalFileName()))
|
478 |
+
{
|
479 |
+
if (file_exists($this->getBufferFileName()))
|
480 |
+
return self::BUILD_STATUS_BUILDING;
|
481 |
+
|
482 |
+
return self::BUILD_STATUS_NOT_READY;
|
483 |
+
}
|
484 |
+
|
485 |
+
if (file_exists($this->getRebuildFileName()))
|
486 |
+
{
|
487 |
+
if (file_exists($this->getBufferFileName()))
|
488 |
+
return self::BUILD_STATUS_UPDATING;
|
489 |
+
else
|
490 |
+
return self::BUILD_STATUS_MARKED_REBUILD;
|
491 |
+
}
|
492 |
+
|
493 |
+
return self::BUILD_STATUS_READY;
|
494 |
+
}
|
495 |
+
|
496 |
+
/**
|
497 |
+
* Get build date
|
498 |
+
*
|
499 |
+
* @return int
|
500 |
+
*/
|
501 |
+
public function getBuildDate()
|
502 |
+
{
|
503 |
+
if (!$this->getId())
|
504 |
+
return -1;
|
505 |
+
|
506 |
+
if (!file_exists($this->getFinalFileName()))
|
507 |
+
return 0;
|
508 |
+
|
509 |
+
return filemtime($this->getFinalFileName());
|
510 |
+
}
|
511 |
+
|
512 |
+
public function buildAll()
|
513 |
+
{
|
514 |
+
$fp = fopen($this->getLockFile(), "w");
|
515 |
+
|
516 |
+
if (flock($fp, LOCK_EX|LOCK_NB))
|
517 |
+
{
|
518 |
+
$collection = Mage::getModel('msp_unifeed/feed')->getCollection();
|
519 |
+
foreach ($collection as $f)
|
520 |
+
{
|
521 |
+
$feed = Mage::getModel('msp_unifeed/feed')->load($f->getId());
|
522 |
+
$feed->build();
|
523 |
+
}
|
524 |
+
|
525 |
+
fclose($fp);
|
526 |
+
unlink($this->getLockFile());
|
527 |
+
}
|
528 |
+
}
|
529 |
+
|
530 |
+
/**
|
531 |
+
* Build feed
|
532 |
+
* @return MSP_UniFeed_Model_Feed
|
533 |
+
*/
|
534 |
+
public function build()
|
535 |
+
{
|
536 |
+
if (!$this->getId())
|
537 |
+
return $this;
|
538 |
+
|
539 |
+
if (!$this->getRebuildFlag())
|
540 |
+
return $this;
|
541 |
+
|
542 |
+
if (!$this->getStatus())
|
543 |
+
{
|
544 |
+
@unlink($this->getBufferFileName());
|
545 |
+
@unlink($this->getFinalFileName());
|
546 |
+
return $this;
|
547 |
+
}
|
548 |
+
|
549 |
+
// Initialize
|
550 |
+
$this->_stockModel = Mage::getModel('cataloginventory/stock_item');
|
551 |
+
|
552 |
+
// Common data info
|
553 |
+
$store = $this->getStore();
|
554 |
+
$baseInfo['store'] = $store;
|
555 |
+
$baseInfo['timestamp'] = date('Y-m-d').'T'.date('H:i:s').'Z';
|
556 |
+
$baseInfo['locale'] = Mage::app()->getLocale()->getLocaleCode();
|
557 |
+
|
558 |
+
$this->clearBufferFile();
|
559 |
+
$this->writeBufferFile($this->getContainerFilterModel()->filter($this->getTemplate()->getTemplateOpen()), null);
|
560 |
+
|
561 |
+
// Categories
|
562 |
+
$collection = $this->getProductsCollection();
|
563 |
+
if ($collection)
|
564 |
+
{
|
565 |
+
foreach ($collection as $product)
|
566 |
+
{
|
567 |
+
$product->setStoreId($store->getId());
|
568 |
+
$this->writeBufferFile($this->getProductFeed($product, $baseInfo, false));
|
569 |
+
}
|
570 |
+
}
|
571 |
+
|
572 |
+
$this->writeBufferFile($this->getContainerFilterModel()->filter($this->getTemplate()->getTemplateClose()), null);
|
573 |
+
$this->closeBufferFile();
|
574 |
+
$this->finalizeBufferFile();
|
575 |
+
|
576 |
+
return $this;
|
577 |
+
}
|
578 |
+
}
|
app/code/community/MSP/Unifeed/Model/Feed/Attribute.php
CHANGED
@@ -1,58 +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 |
-
}
|
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
CHANGED
@@ -1,45 +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 |
-
}
|
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
CHANGED
@@ -1,40 +1,40 @@
|
|
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 |
-
const XML_UNIFEED_GENERAL_ENABLED = "msp_unifeed/general/enabled";
|
24 |
-
const XML_UNIFEED_GENERAL_DAILY_REBUILD = "msp_unifeed/general/daily-rebuild";
|
25 |
-
|
26 |
-
public function rebuildCatalog()
|
27 |
-
{
|
28 |
-
if (!Mage::getStoreConfig(self::XML_UNIFEED_GENERAL_ENABLED))
|
29 |
-
return;
|
30 |
-
|
31 |
-
if (!Mage::getStoreConfig(self::XML_UNIFEED_GENERAL_DAILY_REBUILD))
|
32 |
-
return;
|
33 |
-
|
34 |
-
$feeds = Mage::getModel('msp_unifeed/feed')->getCollection();
|
35 |
-
foreach ($feeds as $feed)
|
36 |
-
{
|
37 |
-
$feed->setRebuildFlag();
|
38 |
-
}
|
39 |
-
}
|
40 |
-
}
|
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 |
+
const XML_UNIFEED_GENERAL_ENABLED = "msp_unifeed/general/enabled";
|
24 |
+
const XML_UNIFEED_GENERAL_DAILY_REBUILD = "msp_unifeed/general/daily-rebuild";
|
25 |
+
|
26 |
+
public function rebuildCatalog()
|
27 |
+
{
|
28 |
+
if (!Mage::getStoreConfig(self::XML_UNIFEED_GENERAL_ENABLED))
|
29 |
+
return;
|
30 |
+
|
31 |
+
if (!Mage::getStoreConfig(self::XML_UNIFEED_GENERAL_DAILY_REBUILD))
|
32 |
+
return;
|
33 |
+
|
34 |
+
$feeds = Mage::getModel('msp_unifeed/feed')->getCollection();
|
35 |
+
foreach ($feeds as $feed)
|
36 |
+
{
|
37 |
+
$feed->setRebuildFlag();
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
app/code/community/MSP/Unifeed/Model/Product/Feed.php
CHANGED
@@ -1,79 +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 |
-
}
|
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
CHANGED
@@ -1,46 +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 |
}
|
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
CHANGED
@@ -1,32 +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 |
}
|
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
CHANGED
@@ -1,37 +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 |
-
}
|
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
CHANGED
@@ -1,32 +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 |
}
|
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
CHANGED
@@ -1,37 +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 |
-
}
|
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
CHANGED
@@ -1,50 +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 |
-
}
|
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
CHANGED
@@ -1,226 +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 |
-
|
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
CHANGED
@@ -1,24 +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 |
-
}
|
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
CHANGED
@@ -1,96 +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 |
-
|
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
CHANGED
@@ -1,48 +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 |
-
}
|
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
CHANGED
@@ -1,137 +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 |
-
}
|
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 → Adminhtml/Unifeed/FeedController.php}
RENAMED
@@ -1,270 +1,274 @@
|
|
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
|
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 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
);
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
$
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
$
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
$this->
|
93 |
-
|
94 |
-
|
95 |
-
$this->
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
$this->
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
->
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
->setData('
|
129 |
-
->setData('
|
130 |
-
->setData('
|
131 |
-
->setData('
|
132 |
-
->setData('
|
133 |
-
->setData('
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
}
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
'
|
227 |
-
'
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
$
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
}
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
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_Adminhtml_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 |
+
protected function _isAllowed(){
|
45 |
+
return Mage::getSingleton('admin/session')->isAllowed('catalog/msp_unifeed/msp_unifeed_feed');
|
46 |
+
}
|
47 |
+
|
48 |
+
public function indexAction()
|
49 |
+
{
|
50 |
+
$this->loadLayout();
|
51 |
+
$this->_addContent($this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed'));
|
52 |
+
$this->renderLayout();
|
53 |
+
}
|
54 |
+
|
55 |
+
public function newAction()
|
56 |
+
{
|
57 |
+
$this->_forward('edit');
|
58 |
+
}
|
59 |
+
|
60 |
+
public function productsAction()
|
61 |
+
{
|
62 |
+
$this->_prapareAction();
|
63 |
+
|
64 |
+
$this->getResponse()->setBody(
|
65 |
+
$this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed_edit_tab_products')->toHtml()
|
66 |
+
);
|
67 |
+
}
|
68 |
+
|
69 |
+
public function rebuildAction()
|
70 |
+
{
|
71 |
+
$this->_prapareAction();
|
72 |
+
|
73 |
+
if ($this->getFeed()->getId())
|
74 |
+
{
|
75 |
+
$this->getFeed()->setRebuildFlag();
|
76 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Feed marked for rebuild'));
|
77 |
+
$this->_redirect('*/*/edit', array('id' => $this->getFeed()->getId()));
|
78 |
+
}
|
79 |
+
else
|
80 |
+
{
|
81 |
+
$feeds = $this->getFeed()->getCollection();
|
82 |
+
foreach ($feeds as $feed)
|
83 |
+
$feed->setRebuildFlag();
|
84 |
+
|
85 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('All feeds are marked for rebuild'));
|
86 |
+
$this->_redirect('*/*/index');
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
public function editAction()
|
91 |
+
{
|
92 |
+
$this->_prapareAction();
|
93 |
+
$model = $this->getFeed();
|
94 |
+
|
95 |
+
$this->loadLayout();
|
96 |
+
$this->_setActiveMenu('msp_unifeed/items');
|
97 |
+
|
98 |
+
$this->_addContent($this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed_edit'));
|
99 |
+
$this->_addLeft($this->getLayout()->createBlock('msp_unifeed/adminhtml_unifeed_edit_tabs'));
|
100 |
+
|
101 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
102 |
+
|
103 |
+
$this->renderLayout();
|
104 |
+
}
|
105 |
+
|
106 |
+
public function saveAction()
|
107 |
+
{
|
108 |
+
$this->_prapareAction();
|
109 |
+
$model = $this->getFeed();
|
110 |
+
|
111 |
+
$feedId = $model->getId();
|
112 |
+
|
113 |
+
if ($this->getRequest()->getPost())
|
114 |
+
{
|
115 |
+
try
|
116 |
+
{
|
117 |
+
$postData = $this->getRequest()->getPost();
|
118 |
+
$feedData = $postData['feed'];
|
119 |
+
|
120 |
+
$feedData['code'] = trim($feedData['code']);
|
121 |
+
|
122 |
+
if (!preg_match('/^[a-z0-9]+$/', $feedData['code']))
|
123 |
+
{
|
124 |
+
trigger_error(Mage::helper('msp_unifeed')->__('Invalid code format'));
|
125 |
+
}
|
126 |
+
|
127 |
+
$model
|
128 |
+
->setData('name', $feedData['name'])
|
129 |
+
->setData('code', $feedData['code'])
|
130 |
+
->setData('store_id', $feedData['store_id'])
|
131 |
+
->setData('msp_unifeed_template_id', $feedData['msp_unifeed_template_id'])
|
132 |
+
->setData('ga_source', $feedData['ga_source'])
|
133 |
+
->setData('ga_term', $feedData['ga_term'])
|
134 |
+
->setData('ga_content', $feedData['ga_content'])
|
135 |
+
->setData('ga_name', $feedData['ga_name'])
|
136 |
+
->setData('ga_medium', $feedData['ga_medium'])
|
137 |
+
->setData('status', $feedData['status']);
|
138 |
+
|
139 |
+
$model->save();
|
140 |
+
|
141 |
+
if (!$feedId)
|
142 |
+
$feedId = $model->getId();
|
143 |
+
|
144 |
+
if ($feedId)
|
145 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Feed was successfully saved'));
|
146 |
+
else
|
147 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('One error occurred while trying to save'));
|
148 |
+
|
149 |
+
if ($feedId)
|
150 |
+
{
|
151 |
+
$productFeed = Mage::getModel('msp_unifeed/product_feed');
|
152 |
+
if ($postData['add_sku'])
|
153 |
+
{
|
154 |
+
$skus = preg_split("/[\s\n]+/", $postData['add_sku']);
|
155 |
+
$res = $productFeed->addProducts(array($feedId), $skus, true);
|
156 |
+
|
157 |
+
if ($res)
|
158 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('%d products were added to this feed', $res));
|
159 |
+
else
|
160 |
+
Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('adminhtml')->__('No new products were added to this feed'));
|
161 |
+
}
|
162 |
+
|
163 |
+
if ($postData['del_sku'])
|
164 |
+
{
|
165 |
+
$skus = preg_split("/[\s\n]+/", $postData['del_sku']);
|
166 |
+
$res = $productFeed->removeProducts(array($feedId), $skus, true);
|
167 |
+
|
168 |
+
if ($res)
|
169 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('%d products were removed from this feed', $res));
|
170 |
+
else
|
171 |
+
Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('adminhtml')->__('No new products were removed from this feed'));
|
172 |
+
}
|
173 |
+
|
174 |
+
if (!$postData['categories'])
|
175 |
+
$postData['categories'] = '';
|
176 |
+
|
177 |
+
$ids = explode(",", $postData['categories']);
|
178 |
+
$res = $productFeed->setCategories($feedId, $ids);
|
179 |
+
|
180 |
+
$this->_redirect('*/*/edit', array('id' => $feedId));
|
181 |
+
return;
|
182 |
+
}
|
183 |
+
|
184 |
+
} catch (Exception $e) {
|
185 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
186 |
+
$this->_redirect('*/*/edit', array('id' => $feedId));
|
187 |
+
return;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
$this->_redirect('*/*/index');
|
192 |
+
}
|
193 |
+
|
194 |
+
public function deleteAction()
|
195 |
+
{
|
196 |
+
$this->_prapareAction();
|
197 |
+
$model = $this->getFeed();
|
198 |
+
|
199 |
+
if ($model->getId())
|
200 |
+
{
|
201 |
+
try
|
202 |
+
{
|
203 |
+
$model->delete();
|
204 |
+
|
205 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Feed was successfully deleted'));
|
206 |
+
$this->_redirect('*/*/index');
|
207 |
+
}
|
208 |
+
catch (Exception $e)
|
209 |
+
{
|
210 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
211 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
$this->_redirect('*/*/index');
|
216 |
+
}
|
217 |
+
|
218 |
+
protected function getRecursiveTree($res)
|
219 |
+
{
|
220 |
+
$out = array();
|
221 |
+
foreach ($res as $item)
|
222 |
+
{
|
223 |
+
$childrenCount = array_key_exists('subs', $item) ? sizeof($item['subs']) : 0;
|
224 |
+
|
225 |
+
$info = array(
|
226 |
+
'id' => $item['id'],
|
227 |
+
'text' => $item['title'],
|
228 |
+
'expanded' => true,
|
229 |
+
'checked' => $item['checked'],
|
230 |
+
'leaf' => !$childrenCount,
|
231 |
+
'allowDrop' => true,
|
232 |
+
'allowDrag' => true,
|
233 |
+
'cls' => 'folder'
|
234 |
+
);
|
235 |
+
|
236 |
+
if ($childrenCount)
|
237 |
+
{
|
238 |
+
$info['children'] = $this->getRecursiveTree($item['subs']);
|
239 |
+
}
|
240 |
+
|
241 |
+
$out[] = $info;
|
242 |
+
}
|
243 |
+
|
244 |
+
return $out;
|
245 |
+
}
|
246 |
+
|
247 |
+
public function jsonAction()
|
248 |
+
{
|
249 |
+
$this->_prapareAction();
|
250 |
+
|
251 |
+
$categoryId = $this->getRequest()->getParam('node');
|
252 |
+
$feed = $this->getFeed();
|
253 |
+
|
254 |
+
$model = Mage::getModel('msp_unifeed/tree');
|
255 |
+
$model->setFeed($feed);
|
256 |
+
|
257 |
+
if ($categoryId)
|
258 |
+
{
|
259 |
+
$res = $model->getCategory($categoryId, 100);
|
260 |
+
if (array_key_exists('subs', $res))
|
261 |
+
$res = $res['subs'];
|
262 |
+
else
|
263 |
+
$res = array();
|
264 |
+
}
|
265 |
+
else
|
266 |
+
{
|
267 |
+
$res = $model->getRootCategory(100);
|
268 |
+
}
|
269 |
+
|
270 |
+
$out = $this->getRecursiveTree($res);
|
271 |
+
|
272 |
+
$this->getResponse()->setBody(json_encode($out));
|
273 |
+
}
|
274 |
+
}
|
app/code/community/MSP/Unifeed/controllers/{TemplateController.php → Adminhtml/Unifeed/TemplateController.php}
RENAMED
@@ -1,136 +1,140 @@
|
|
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
|
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 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
$this->
|
63 |
-
|
64 |
-
|
65 |
-
$this->
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
->setData('
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
}
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
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_Adminhtml_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 |
+
protected function _isAllowed(){
|
45 |
+
return Mage::getSingleton('admin/session')->isAllowed('catalog/msp_unifeed/msp_unifeed_template');
|
46 |
+
}
|
47 |
+
|
48 |
+
public function indexAction()
|
49 |
+
{
|
50 |
+
$this->loadLayout();
|
51 |
+
$this->_addContent($this->getLayout()->createBlock('msp_unifeed/adminhtml_template'));
|
52 |
+
$this->renderLayout();
|
53 |
+
}
|
54 |
+
|
55 |
+
public function newAction()
|
56 |
+
{
|
57 |
+
$this->_forward('edit');
|
58 |
+
}
|
59 |
+
|
60 |
+
public function editAction()
|
61 |
+
{
|
62 |
+
$this->_prapareAction();
|
63 |
+
$model = $this->getFeed();
|
64 |
+
|
65 |
+
$this->loadLayout();
|
66 |
+
$this->_setActiveMenu('msp_unifeed_template/items');
|
67 |
+
|
68 |
+
$this->_addContent($this->getLayout()->createBlock('msp_unifeed/adminhtml_template_edit'));
|
69 |
+
$this->renderLayout();
|
70 |
+
}
|
71 |
+
|
72 |
+
public function saveAction()
|
73 |
+
{
|
74 |
+
$this->_prapareAction();
|
75 |
+
$model = $this->getFeed();
|
76 |
+
|
77 |
+
$templateId = $model->getId();
|
78 |
+
|
79 |
+
if ($this->getRequest()->getPost())
|
80 |
+
{
|
81 |
+
try
|
82 |
+
{
|
83 |
+
$postData = $this->getRequest()->getPost();
|
84 |
+
$templateData = $postData['template'];
|
85 |
+
|
86 |
+
$model
|
87 |
+
->setData('name', $templateData['name'])
|
88 |
+
->setData('template_open', $templateData['template_open'])
|
89 |
+
->setData('template_close', $templateData['template_close'])
|
90 |
+
->setData('template_product', $templateData['template_product'])
|
91 |
+
->setData('type', $templateData['type'])
|
92 |
+
;
|
93 |
+
|
94 |
+
$model->save();
|
95 |
+
|
96 |
+
if (!$templateId)
|
97 |
+
$templateId = $model->getId();
|
98 |
+
|
99 |
+
if ($templateId)
|
100 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Template was successfully saved'));
|
101 |
+
else
|
102 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('One error occurred while trying to save'));
|
103 |
+
|
104 |
+
$this->_redirect('*/*/edit', array('id' => $templateId));
|
105 |
+
return;
|
106 |
+
|
107 |
+
} catch (Exception $e) {
|
108 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
109 |
+
$this->_redirect('*/*/edit', array('id' => $templateId));
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
$this->_redirect('*/*/index');
|
115 |
+
}
|
116 |
+
|
117 |
+
public function deleteAction()
|
118 |
+
{
|
119 |
+
$this->_prapareAction();
|
120 |
+
$model = $this->getTemplate();
|
121 |
+
|
122 |
+
if ($model->getId())
|
123 |
+
{
|
124 |
+
try
|
125 |
+
{
|
126 |
+
$model->delete();
|
127 |
+
|
128 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Template was successfully deleted'));
|
129 |
+
$this->_redirect('*/*/index');
|
130 |
+
}
|
131 |
+
catch (Exception $e)
|
132 |
+
{
|
133 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
134 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
$this->_redirect('*/*/index');
|
139 |
+
}
|
140 |
+
}
|
app/code/community/MSP/Unifeed/controllers/OutputController.php
CHANGED
@@ -1,94 +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 |
-
}
|
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/etc/config.xml
CHANGED
@@ -1,204 +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.
|
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 |
-
<
|
91 |
-
<
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
</args>
|
96 |
-
</
|
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>
|
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>
|
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>
|
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.4</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 |
+
<adminhtml>
|
91 |
+
<args>
|
92 |
+
<modules>
|
93 |
+
<msp_unifeed before="Mage_Adminhtml">MSP_Unifeed_Adminhtml</msp_unifeed>
|
94 |
+
</modules>
|
95 |
+
</args>
|
96 |
+
</adminhtml>
|
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>adminhtml/unifeed_template</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>adminhtml/unifeed_feed</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
CHANGED
@@ -1,51 +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>
|
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
CHANGED
@@ -1,81 +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();
|
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
CHANGED
@@ -1,29 +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>
|
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
CHANGED
@@ -1,38 +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>
|
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
CHANGED
@@ -1,90 +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>
|
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
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<div class="entry-edit">
|
2 |
-
<?php echo $this->getFormHtml();?>
|
3 |
-
</div>
|
4 |
-
<?php echo $this->getChildHtml('form_after');?>
|
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
CHANGED
@@ -1,3 +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>.') ?>
|
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
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php echo $this->__('<b>Feed URL</b>: %s', $this->getFeedUrl()) ?><br />
|
1 |
+
<?php echo $this->__('<b>Feed URL</b>: %s', $this->getFeedUrl()) ?><br />
|
app/etc/modules/MSP_Unifeed.xml
CHANGED
@@ -1,29 +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>
|
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>
|
composer.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "magespecialist/msp_unifeed",
|
3 |
+
"license": "OSL-3.0",
|
4 |
+
"type": "magento-module",
|
5 |
+
"description": "Magento extension for creating products feeds in multiple formats (csv, txt or xml) with fully customizable templates.",
|
6 |
+
"homepage": "https://github.com/magespecialist/MSP_Unifeed",
|
7 |
+
"require": {
|
8 |
+
"magento-hackathon/magento-composer-installer": "*",
|
9 |
+
"magespecialist/msp_common": "*"
|
10 |
+
},
|
11 |
+
"repositories": [
|
12 |
+
{
|
13 |
+
"type": "vcs",
|
14 |
+
"url": "git@github.com:magespecialist/MSP_Common.git"
|
15 |
+
}
|
16 |
+
],
|
17 |
+
"authors":[
|
18 |
+
{
|
19 |
+
"name":"MageSpecialist",
|
20 |
+
"email":"info@magespecialist.it"
|
21 |
+
}
|
22 |
+
]
|
23 |
+
}
|
modman
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
app/code/community/MSP/Unifeed app/code/community/MSP/Unifeed
|
2 |
+
app/design/adminhtml/default/default/layout/msp_unifeed.xml app/design/adminhtml/default/default/layout/msp_unifeed.xml
|
3 |
+
app/design/adminhtml/default/default/template/msp_unifeed app/design/adminhtml/default/default/template/msp_unifeed
|
4 |
+
app/etc/modules/MSP_Unifeed.xml app/etc/modules/MSP_Unifeed.xml
|
5 |
+
shell/unifeed.php shell/unifeed.php
|
package.xml
CHANGED
@@ -1,19 +1,3 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<package>
|
3 |
-
|
4 |
-
<version>1.0.2</version>
|
5 |
-
<stability>stable</stability>
|
6 |
-
<license>OSL</license>
|
7 |
-
<channel>community</channel>
|
8 |
-
<extends/>
|
9 |
-
<summary>UniFeed is an easy and flexible extension to create feeds in multiple formats.</summary>
|
10 |
-
<description>New Unifeed is an easy and flexible extension to create product feeds in multiple formats (csv, txt or xml) for any external platform which need to import your catalog.
|
11 |
-
You can create feed models with your own syntax using a lot of available variables and directives to retrieve information about stores and products and parse it with conditional and programmable statements.</description>
|
12 |
-
<notes>Enjoy it ;)</notes>
|
13 |
-
<authors><author><name>Riccardo Tempesta</name><user>idealiagroup</user><email>tempesta@idealiagroup.com</email></author></authors>
|
14 |
-
<date>2014-09-30</date>
|
15 |
-
<time>15:10:48</time>
|
16 |
-
<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="b8d4ed3ab2d62ca738edbc3cb02af261"/><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="d71c1a2e38a017a31fcb86d6a342df54"/><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>
|
17 |
-
<compatible/>
|
18 |
-
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
-
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<package><name>MSP_Unifeed</name><version>1.0.4</version><stability>stable</stability><license>OSL</license><channel>community</channel><extends></extends><summary>UniFeed is an easy and flexible extension to create feeds in multiple formats.</summary><description>New Unifeed is an easy and flexible extension to create product feeds in multiple formats (csv, txt or xml) for any external platform which need to import your catalog.
|
3 |
+
You can create feed models with your own syntax using a lot of available variables and directives to retrieve information about stores and products and parse it with conditional and programmable statements.</description><notes>Enjoy it ;)</notes><authors><author><name>Riccardo Tempesta</name><user>idealiagroup</user><email>tempesta@idealiagroup.com</email></author></authors><date>2015-10-30</date><time>8:04:15</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><file name="Changelog.txt" hash="6df53246b7c40dbd70ae6c4f8a224c8a"/><file name="Compatibility.txt" hash="c7394ae4c1e4687a8948c81d7275edb9"/><file name="License.txt" hash="c7f02203c7e2483e1fc301cdacb322a6"/><file name="README.md" hash="9af3673a184e13c74f75647649f62924"/><file name="composer.json" hash="f3984a488beafa8c38cde68fa8861a81"/><file name="modman" hash="bf95dc32e9033fe9f63e6afc1c40f1d4"/><file name="package.xml" hash="f258335bbf37cd84bb7cf63bf8b62d0d"/><dir name="shell"><file name="unifeed.php" hash="108e501fb75389eb1220e00a60e947fe"/></dir><dir name="app"><dir name="etc"><dir name="modules"><file name="MSP_Unifeed.xml" hash="d094e7215f28a1a0a95170201142e084"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="msp_unifeed"><dir name="catalog"><dir name="category"><dir name="edit"><file name="feed.phtml" hash="3af03ba6da5bde90b4a73b8a8ad0496a"/></dir></dir></dir><dir name="edit"><file name="categories.phtml" hash="ca9b45a8998790c5f4e12a5fe6bdbe0e"/><file name="form.phtml" hash="e0b0a19f87b45f95bfb9bffbeae13a33"/><dir name="ga"><file name="after.phtml" hash="2c5cbbacd75efbb881c686f02b90f58d"/></dir><dir name="settings"><file name="after.phtml" hash="5d073bc5c07439d06492705afb0a9f7f"/></dir></dir></dir></dir><dir name="layout"><file name="msp_unifeed.xml" hash="52dc0ebb7daa1f7f936272127147908a"/></dir></dir></dir></dir></dir><dir name="code"><dir name="community"><dir name="MSP"><dir name="Unifeed"><dir name="Helper"><file name="Data.php" hash="ea4e8c89d22f1d4e880932943cb3a6ee"/></dir><dir name="etc"><file name="config.xml" hash="59de74043aa91b2478d2028d96d69eee"/><file name="system.xml" hash="63ece8965b2974d58709f2616aa727c7"/></dir><dir name="Block"><dir name="Adminhtml"><file name="Template.php" hash="515de1ec84ca64b8beca53c13fb2fd32"/><file name="Unifeed.php" hash="8a27e9d863e03d3bbbf2fee22e802792"/><dir name="Template"><file name="Edit.php" hash="708a10ab0126bd8b2018d879f9369998"/><file name="Grid.php" hash="6f3674df5c7720533acbf3ee466926c6"/><dir name="Edit"><file name="Form.php" hash="183a19de7e0a7fb3dc293525bb7e38f2"/></dir></dir><dir name="Catalog"><dir name="Category"><dir name="Edit"><dir name="Tab"><file name="Feed.php" hash="1a9284d2ad34927b64ea62a7fe9d2f4a"/></dir></dir></dir></dir><dir name="Unifeed"><file name="Edit.php" hash="9a29b22cb678d808d6922b6ac5b2b3dc"/><file name="Grid.php" hash="8665c87adbf03897efb49985c49a9a4a"/><dir name="Edit"><file name="Form.php" hash="0077a621df619418ff98b1dbe00ea7c2"/><file name="Tabs.php" hash="6a0dd2499b4b32c9288e6e9f4cfae644"/><dir name="Tab"><file name="Categories.php" hash="4aaf67324e00e46d4b90a57aebb2cf06"/><file name="Ga.php" hash="e6ac4d390555a48eda3f1f97d568c8c5"/><file name="Settings.php" hash="997d7f51675954084c6d2d2f016ed66d"/><dir name="Ga"><file name="After.php" hash="e0634985a93010f698bacf5c31287409"/></dir><dir name="Settings"><file name="After.php" hash="7cea9cfac14b353a7fbfcdeca19afae7"/></dir></dir></dir></dir></dir></dir><dir name="Model"><file name="Feed.php" hash="92734ae034189eda82f8dbfee9863ff4"/><file name="Observer.php" hash="f4dd2dd2d9ab6eb16fb14513924368e2"/><file name="Template.php" hash="bab06badbcc50789776ea103196214fb"/><file name="Tree.php" hash="92272106e7d0e5cfd441069ab42c3ca9"/><dir name="Template"><file name="Abstract.php" hash="6baaba73565aa8b9144ca8b952d215c4"/><file name="Container.php" hash="291aa0d8a5160cd223358777b5de4517"/><file name="Product.php" hash="879293127ee91aeccc7dbd6a07af37bf"/><file name="Type.php" hash="1d8a9d964175f657ce15d179890808ee"/></dir><dir name="Eav"><dir name="Entity"><dir name="Attribute"><dir name="Backend"><file name="Feed.php" hash="c8731bdfbd3e8f83ce24d350cc32a092"/></dir></dir></dir></dir><dir name="Feed"><file name="Attribute.php" hash="d908d344320df79ac65e34536924c27c"/><file name="Status.php" hash="8c2b39c41cfb4d50a30620e6c7966251"/></dir><dir name="Product"><file name="Feed.php" hash="3f9f74f43ca7bb961af7220c0c2377a0"/></dir><dir name="Resource"><file name="Feed.php" hash="dc28ff1f28ce20c52f580a6214716c62"/><file name="Template.php" hash="7810c4898f06c51027e08f9cd66c65cf"/><dir name="Template"><file name="Collection.php" hash="ef730dbb67cb4cab2a14238533b9e48e"/></dir><dir name="Catalog"><dir name="Eav"><dir name="Mysql4"><dir name="Product"><file name="Collection.php" hash="4deee24b3f1b1471d9eb882af0372875"/></dir></dir></dir></dir><dir name="Feed"><file name="Collection.php" hash="64b833f117e0225b88d57d29450d9b56"/></dir></dir></dir><dir name="sql"><dir name="msp_unifeed_setup"><file name="mysql4-install-1.0.0.php" hash="0eceb6e89545ec031e72f8618fa89c59"/></dir></dir><dir name="controllers"><file name="OutputController.php" hash="b94ed02730aaa0e686613af14ef70f0c"/><dir name="Adminhtml"><dir name="Unifeed"><file name="FeedController.php" hash="ccd3702a837aa15cc71609e93eb50eb0"/><file name="TemplateController.php" hash="bea42ca064a92bb125cfcfb8f5d9e8ba"/></dir></dir></dir></dir></dir></dir></dir></dir></target></contents></package>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shell/unifeed.php
CHANGED
@@ -1,25 +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 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
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 |
+
require_once 'abstract.php';
|
22 |
+
|
23 |
+
class MSP_Unifeed_Shell_Unifeed extends Mage_Shell_Abstract
|
24 |
+
{
|
25 |
+
public function run()
|
26 |
+
{
|
27 |
+
Mage::app('admin')->setUseSessionInUrl(false);
|
28 |
+
Mage::getModel('msp_unifeed/feed')->buildAll();
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
$shell = new MSP_Unifeed_Shell_Unifeed();
|
33 |
+
$shell->run();
|