Version Notes
1.6.0.0.23.0 version of package
internal svn revision #3cd616975d5927903d4f34bde0d9e5e2e727e9ba
Download this release
Release Info
Developer | Magento Core Team |
Extension | Magento_Mobile |
Version | 1.6.0.0.23.0 |
Comparing to | |
See all releases |
Code changes from version 1.5.0.0.23.0 to 1.6.0.0.23.0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/OfflineCatalog.php +115 -0
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid.php +1 -1
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid.php +3 -2
- app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Application.php +1 -1
- app/code/core/Mage/XmlConnect/Block/{Checkout/Shipping/Method/Avaliable.php → Adminhtml/Template/Grid/Renderer/Name.php} +6 -8
- app/code/core/Mage/XmlConnect/Helper/OfflineCatalog.php +307 -0
- app/code/core/Mage/XmlConnect/Model/Adminhtml/Search/Category.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Application.php +2 -2
- app/code/core/Mage/XmlConnect/Model/ConfigData.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Configuration.php +1 -1
- app/code/core/Mage/XmlConnect/Model/History.php +3 -3
- app/code/core/Mage/XmlConnect/Model/Images.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Input/Filter/MaliciousCode.php +0 -100
- app/code/core/Mage/XmlConnect/Model/Mysql4/Cms/Page/Collection.php +3 -3
- app/code/core/Mage/XmlConnect/Model/Mysql4/History/Collection.php +3 -3
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog.php +117 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Abstract.php +66 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Category.php +120 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Category/Category.php +61 -0
- app/code/core/Mage/XmlConnect/Model/{Mysql4/CategorySearch/Collection.php → OfflineCatalog/Category/IndexCategory.php} +30 -6
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Config.php +77 -0
- app/code/core/Mage/XmlConnect/Model/{Mysql4/Images/Collection.php → OfflineCatalog/Home.php} +27 -2
- app/code/core/Mage/XmlConnect/Model/{Mysql4/Images.php → OfflineCatalog/Homebanners.php} +27 -2
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product.php +111 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product/Gallery.php +61 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product/Product.php +61 -0
- app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product/Review.php +61 -0
- app/code/core/Mage/XmlConnect/Model/Resource/Application.php +6 -6
- app/code/core/Mage/XmlConnect/Model/Resource/Application/Collection.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Resource/CategorySearch/Collection.php +1 -2
- app/code/core/Mage/XmlConnect/Model/Resource/Cms/Page/Collection.php +4 -4
- app/code/core/Mage/XmlConnect/Model/Resource/History.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Resource/History/Collection.php +4 -4
- app/code/core/Mage/XmlConnect/Model/Resource/Images.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Resource/Images/Collection.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Resource/Queue.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Resource/Queue/Collection.php +17 -6
- app/code/core/Mage/XmlConnect/Model/Resource/Setup.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Resource/Template.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Resource/Template/Collection.php +1 -1
- app/code/core/Mage/XmlConnect/Model/Simplexml/Form/Element/CountryListSelect.php +1 -0
- app/code/core/Mage/XmlConnect/controllers/Adminhtml/MobileController.php +2 -2
- app/code/core/Mage/XmlConnect/controllers/CheckoutController.php +1 -0
- app/code/core/Mage/XmlConnect/controllers/OfflineCatalogController.php +63 -0
- app/code/core/Mage/XmlConnect/etc/config.xml +5 -4
- app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/install-1.6.0.0.php +279 -0
- app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-data-upgrade-1.5.9.9-1.6.0.0.php +1 -1
- app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-install-1.4.0.8.php +6 -6
- app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-upgrade-1.4.0.13-1.4.0.14.php +44 -23
- app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +397 -300
- app/code/core/Mage/XmlConnect/sql/xmlconnect_setup/{mysql4-upgrade-1.6.0.0-1.6.0.0.1.php → upgrade-1.6.0.0-1.6.0.0.1.php} +32 -19
- app/design/adminhtml/default/default/layout/xmlconnect.xml +2 -0
- app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design/image_edit.phtml +2 -2
- app/design/adminhtml/default/default/template/xmlconnect/edit/tab/design/preview/banner_rotator.phtml +1 -1
- app/design/adminhtml/default/default/template/xmlconnect/edit/tab/offlinecatalog.phtml +46 -0
- js/scriptaculous/dragdrop.js +2 -3
- package.xml +6 -6
- skin/adminhtml/default/default/images/xmlconnect/mobile_preview/android/bg_content.jpg +0 -0
- skin/adminhtml/default/default/images/xmlconnect/mobile_preview/android/bg_home_content.jpg +0 -0
- skin/adminhtml/default/default/images/xmlconnect/mobile_preview/android/logo_big.png +0 -0
app/code/core/Mage/XmlConnect/Block/Adminhtml/Mobile/Edit/Tab/OfflineCatalog.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_XmlConnect
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Tab for offline catalog management
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_OfflineCatalog
|
35 |
+
extends Mage_Adminhtml_Block_Template
|
36 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
37 |
+
{
|
38 |
+
/**
|
39 |
+
* Set design tab template
|
40 |
+
* Set to show global icon
|
41 |
+
*/
|
42 |
+
public function __construct()
|
43 |
+
{
|
44 |
+
parent::__construct();
|
45 |
+
$this->setShowGlobalIcon(true);
|
46 |
+
$this->setTemplate('xmlconnect/edit/tab/offlinecatalog.phtml');
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Prepare layout
|
51 |
+
*
|
52 |
+
* @return Mage_Core_Block_Abstract
|
53 |
+
*/
|
54 |
+
protected function _prepareLayout()
|
55 |
+
{
|
56 |
+
$this->_addGenerateButton();
|
57 |
+
return parent::_prepareLayout();
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Add generate button
|
62 |
+
*
|
63 |
+
* @return Mage_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_OfflineCatalog
|
64 |
+
*/
|
65 |
+
protected function _addGenerateButton()
|
66 |
+
{
|
67 |
+
$generateButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
|
68 |
+
'label' => $this->__('Generate Offline Catalog'),
|
69 |
+
'onclick' => 'generateOfflineCatalog(); return false;',
|
70 |
+
'class' => 'save'
|
71 |
+
))->setName('generate_offline_catalog_button');
|
72 |
+
$this->setChild('offline_catalog', $generateButton);
|
73 |
+
return $this;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Tab label getter
|
78 |
+
*
|
79 |
+
* @return string
|
80 |
+
*/
|
81 |
+
public function getTabLabel()
|
82 |
+
{
|
83 |
+
return $this->__('Offline Catalog');
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Tab title getter
|
88 |
+
*
|
89 |
+
* @return string
|
90 |
+
*/
|
91 |
+
public function getTabTitle()
|
92 |
+
{
|
93 |
+
return $this->__('Offline Catalog');
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Check if tab can be shown
|
98 |
+
*
|
99 |
+
* @return bool
|
100 |
+
*/
|
101 |
+
public function canShowTab()
|
102 |
+
{
|
103 |
+
return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Check if tab hidden
|
108 |
+
*
|
109 |
+
* @return bool
|
110 |
+
*/
|
111 |
+
public function isHidden()
|
112 |
+
{
|
113 |
+
return false;
|
114 |
+
}
|
115 |
+
}
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Queue/Grid.php
CHANGED
@@ -87,7 +87,7 @@ class Mage_XmlConnect_Block_Adminhtml_Queue_Grid extends Mage_Adminhtml_Block_Wi
|
|
87 |
$this->addColumn('app_code', array(
|
88 |
'header' => $this->__('Application Name'),
|
89 |
'align' => 'left',
|
90 |
-
'index' => '
|
91 |
'type' => 'options',
|
92 |
'options' => Mage::helper('xmlconnect')->getApplications(),
|
93 |
'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_application'
|
87 |
$this->addColumn('app_code', array(
|
88 |
'header' => $this->__('Application Name'),
|
89 |
'align' => 'left',
|
90 |
+
'index' => 'app.code',
|
91 |
'type' => 'options',
|
92 |
'options' => Mage::helper('xmlconnect')->getApplications(),
|
93 |
'renderer' => 'xmlconnect/adminhtml_queue_grid_renderer_application'
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid.php
CHANGED
@@ -74,7 +74,8 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Grid extends Mage_Adminhtml_Block
|
|
74 |
$this->addColumn('name', array(
|
75 |
'header' => $this->__('Template Name'),
|
76 |
'align' => 'left',
|
77 |
-
'index' => 'name',
|
|
|
78 |
'escape' => true
|
79 |
));
|
80 |
|
@@ -94,7 +95,7 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Grid extends Mage_Adminhtml_Block
|
|
94 |
|
95 |
$this->addColumn('app_code', array(
|
96 |
'header' => $this->__('Application'),
|
97 |
-
'index' => '
|
98 |
'type' => 'options',
|
99 |
'align' => 'left',
|
100 |
'options' => Mage::helper('xmlconnect')->getApplications(),
|
74 |
$this->addColumn('name', array(
|
75 |
'header' => $this->__('Template Name'),
|
76 |
'align' => 'left',
|
77 |
+
'index' => 'main_table.name',
|
78 |
+
'renderer' => 'xmlconnect/adminhtml_template_grid_renderer_name',
|
79 |
'escape' => true
|
80 |
));
|
81 |
|
95 |
|
96 |
$this->addColumn('app_code', array(
|
97 |
'header' => $this->__('Application'),
|
98 |
+
'index' => 'app.code',
|
99 |
'type' => 'options',
|
100 |
'align' => 'left',
|
101 |
'options' => Mage::helper('xmlconnect')->getApplications(),
|
app/code/core/Mage/XmlConnect/Block/Adminhtml/Template/Grid/Renderer/Application.php
CHANGED
@@ -42,7 +42,7 @@ class Mage_XmlConnect_Block_Adminhtml_Template_Grid_Renderer_Application
|
|
42 |
*/
|
43 |
public function render(Varien_Object $row)
|
44 |
{
|
45 |
-
$str = $this->
|
46 |
if ($str == '') {
|
47 |
$str = ' --- ';
|
48 |
}
|
42 |
*/
|
43 |
public function render(Varien_Object $row)
|
44 |
{
|
45 |
+
$str = $this->escapeHtml($row->getAppName());
|
46 |
if ($str == '') {
|
47 |
$str = ' --- ';
|
48 |
}
|
app/code/core/Mage/XmlConnect/Block/{Checkout/Shipping/Method/Avaliable.php → Adminhtml/Template/Grid/Renderer/Name.php}
RENAMED
@@ -25,16 +25,14 @@
|
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
-
*
|
29 |
-
* This class is an alias for properly named class
|
30 |
*
|
31 |
-
* @
|
32 |
-
* @
|
33 |
-
* @
|
34 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
35 |
*/
|
36 |
-
class
|
37 |
-
extends
|
38 |
{
|
39 |
/**
|
40 |
* Render grid row
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
+
* Adminhtml airmail queue grid block action item renderer
|
|
|
29 |
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
|
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Block_Adminhtml_Template_Grid_Renderer_Name
|
35 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
36 |
{
|
37 |
/**
|
38 |
* Render grid row
|
app/code/core/Mage/XmlConnect/Helper/OfflineCatalog.php
ADDED
@@ -0,0 +1,307 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_XmlConnect
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* XmlConnect offline catalog helper
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Helper_OfflineCatalog extends Mage_Core_Helper_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Result folder
|
38 |
+
*/
|
39 |
+
const RESULT_FOLDER = 'offline_catalog';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Map file
|
43 |
+
*/
|
44 |
+
const MAP_FILE = '_storage.dict';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Export url
|
48 |
+
*/
|
49 |
+
const EXPORT_URL = 'xmlconnect/offlineCatalog/index/key/';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Varien file IO
|
53 |
+
*
|
54 |
+
* @var null|Varien_Io_File
|
55 |
+
*/
|
56 |
+
protected $_fileIo;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Xml object
|
60 |
+
*
|
61 |
+
* @var null|Mage_XmlConnect_Model_Simplexml_Element
|
62 |
+
*/
|
63 |
+
protected $_xmlObject;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Layout model
|
67 |
+
*
|
68 |
+
* @var null|Mage_Core_Model_Layout
|
69 |
+
*/
|
70 |
+
protected $_layout;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Result dir
|
74 |
+
*
|
75 |
+
* @var null|string
|
76 |
+
*/
|
77 |
+
protected $_resultDir;
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Application model
|
81 |
+
*
|
82 |
+
* @var null|Mage_XmlConnect_Model_Application
|
83 |
+
*/
|
84 |
+
protected $_appModel;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Prepare result directory
|
88 |
+
*
|
89 |
+
* @return Mage_XmlConnect_Helper_OfflineCatalog
|
90 |
+
*/
|
91 |
+
public function prepareResultDirectory()
|
92 |
+
{
|
93 |
+
$fileModel = $this->_getFileIo();
|
94 |
+
$resultDir = $this->_getResultDir();
|
95 |
+
$fileModel->rmdirRecursive($resultDir);
|
96 |
+
$fileModel->mkdir($resultDir);
|
97 |
+
return $this;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Get file IO
|
102 |
+
*
|
103 |
+
* @return Varien_Io_File
|
104 |
+
*/
|
105 |
+
protected function _getFileIo()
|
106 |
+
{
|
107 |
+
if ($this->_fileIo === null) {
|
108 |
+
$this->_fileIo = new Varien_Io_File();
|
109 |
+
}
|
110 |
+
return $this->_fileIo;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Get handles
|
115 |
+
*
|
116 |
+
* @return array
|
117 |
+
*/
|
118 |
+
protected function _getHandles()
|
119 |
+
{
|
120 |
+
return array('xmlconnect_configuration_index', 'xmlconnect_catalog_categorydetails',
|
121 |
+
'xmlconnect_catalog_productview', 'xmlconnect_homebanners_index', 'xmlconnect_index_index',
|
122 |
+
'xmlconnect_catalog_productgallery', 'xmlconnect_catalog_productreviews'
|
123 |
+
);
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Add offline catalog data
|
128 |
+
*
|
129 |
+
* @param string $urlPath
|
130 |
+
* @param string $output
|
131 |
+
* @return Mage_XmlConnect_Helper_OfflineCatalog
|
132 |
+
*/
|
133 |
+
public function addOfflineCatalogData($urlPath, $output)
|
134 |
+
{
|
135 |
+
$xmlObj = $this->_getXmlObject();
|
136 |
+
$fileName = uniqid() . '-' . sha1($output) . '.cache';
|
137 |
+
|
138 |
+
$this->saveCacheFile($fileName, $output);
|
139 |
+
$xmlObj->addCustomChild('key', $urlPath);
|
140 |
+
$xmlObj->addCustomChild('string', $fileName);
|
141 |
+
return $this;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Save cache file
|
146 |
+
*
|
147 |
+
* @param string $fileName
|
148 |
+
* @param string $output
|
149 |
+
* @return Mage_XmlConnect_Helper_OfflineCatalog
|
150 |
+
*/
|
151 |
+
public function saveCacheFile($fileName, $output)
|
152 |
+
{
|
153 |
+
$filePath = $this->_getResultDir() . DS . $fileName;
|
154 |
+
$this->_getFileIo()->open(array('path' => $this->_getResultDir()));
|
155 |
+
$this->_getFileIo()->write($filePath, $output);
|
156 |
+
return $this;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Get result directory path
|
161 |
+
*
|
162 |
+
* @return string
|
163 |
+
*/
|
164 |
+
protected function _getResultDir()
|
165 |
+
{
|
166 |
+
if ($this->_resultDir === null) {
|
167 |
+
$this->_resultDir = Mage::getBaseDir('var') . DS . self::RESULT_FOLDER;
|
168 |
+
}
|
169 |
+
return $this->_resultDir;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Get xml object
|
174 |
+
*
|
175 |
+
* @return Mage_XmlConnect_Model_Simplexml_Element
|
176 |
+
*/
|
177 |
+
protected function _getXmlObject()
|
178 |
+
{
|
179 |
+
if ($this->_xmlObject === null) {
|
180 |
+
$this->_xmlObject = Mage::getModel('xmlconnect/simplexml_element', '<dict></dict>');
|
181 |
+
}
|
182 |
+
return $this->_xmlObject;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Get block
|
187 |
+
*
|
188 |
+
* @param string $blockName
|
189 |
+
* @return Mage_Core_Block_Abstract
|
190 |
+
*/
|
191 |
+
public function getBlock($blockName)
|
192 |
+
{
|
193 |
+
/** @var $layout Mage_Core_Model_Layouts */
|
194 |
+
$this->_prepareLayout();
|
195 |
+
$this->_layout->getUpdate()->load($this->_getHandles());
|
196 |
+
$this->_layout->generateXml()->generateBlocks();
|
197 |
+
$block = $this->_layout->getBlock($blockName);
|
198 |
+
$this->unsetLayout();
|
199 |
+
return $block;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Prepare layout
|
204 |
+
*
|
205 |
+
* @return Mage_XmlConnect_Helper_OfflineCatalog
|
206 |
+
*/
|
207 |
+
protected function _prepareLayout()
|
208 |
+
{
|
209 |
+
$this->_layout = Mage::getModel('core/layout');
|
210 |
+
return $this;
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Unset layout
|
215 |
+
*
|
216 |
+
* Only for PHP 5 >= 5.3.0
|
217 |
+
*
|
218 |
+
* @return Mage_XmlConnect_Helper_OfflineCatalog
|
219 |
+
*/
|
220 |
+
protected function unsetLayout()
|
221 |
+
{
|
222 |
+
/** @TODO Add support for previous PHP version */
|
223 |
+
unset($this->_layout);
|
224 |
+
gc_collect_cycles();
|
225 |
+
return $this;
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Get current device model
|
230 |
+
*
|
231 |
+
* @return Mage_XmlConnect_Model_Application|null
|
232 |
+
*/
|
233 |
+
public function getCurrentDeviceModel()
|
234 |
+
{
|
235 |
+
return $this->_appModel;
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Set current device model
|
240 |
+
*
|
241 |
+
* @param string $key
|
242 |
+
* @return bool
|
243 |
+
*/
|
244 |
+
public function setCurrentDeviceModel($key)
|
245 |
+
{
|
246 |
+
$appCode = $this->base64UrlDecode($key);
|
247 |
+
$appModel = Mage::getModel('xmlConnect/application')->loadByCode($appCode);
|
248 |
+
if (!$appModel->getId()) {
|
249 |
+
return false;
|
250 |
+
}
|
251 |
+
Mage::register('current_app', $appModel);
|
252 |
+
$this->_appModel = $appModel;
|
253 |
+
return true;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Base64 url encode
|
258 |
+
*
|
259 |
+
* @param string $data
|
260 |
+
* @return string
|
261 |
+
*/
|
262 |
+
public function base64UrlEncode($data)
|
263 |
+
{
|
264 |
+
/** @var $decryptHelper Mage_Core_Helper_Data */
|
265 |
+
$decryptHelper = Mage::helper('core/data');
|
266 |
+
return strtr($decryptHelper->encrypt($data), '+/=', '-_,');
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Base64 url dencode
|
271 |
+
*
|
272 |
+
* @param string $data
|
273 |
+
* @return string
|
274 |
+
*/
|
275 |
+
public function base64UrlDecode($data)
|
276 |
+
{
|
277 |
+
/** @var $decryptHelper Mage_Core_Helper_Data */
|
278 |
+
$decryptHelper = Mage::helper('core/data');
|
279 |
+
return $decryptHelper->decrypt(strtr($data, '-_,', '+/='));
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Render xml object
|
284 |
+
*
|
285 |
+
* @return Mage_XmlConnect_Helper_OfflineCatalog
|
286 |
+
*/
|
287 |
+
public function renderXmlObject()
|
288 |
+
{
|
289 |
+
/** @var $result Mage_XmlConnect_Model_Simplexml_Element */
|
290 |
+
$result = Mage::getModel('xmlconnect/simplexml_element', '<plist version="1.0"></plist>');
|
291 |
+
$result->appendChild($this->_getXmlObject())->asNiceXml($this->_getResultDir() . DS . self::MAP_FILE);
|
292 |
+
return $this;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Get export url
|
297 |
+
*
|
298 |
+
* @return string
|
299 |
+
*/
|
300 |
+
public function getExportUrl()
|
301 |
+
{
|
302 |
+
$app = Mage::helper('xmlconnect')->getApplication();
|
303 |
+
$secretKey = array('key' => $this->base64UrlEncode($app->getCode()));
|
304 |
+
$storeUrl = Mage::getModel('core/store')->load($app->getStoreId())->getUrl(self::EXPORT_URL, $secretKey);
|
305 |
+
return $storeUrl;
|
306 |
+
}
|
307 |
+
}
|
app/code/core/Mage/XmlConnect/Model/Adminhtml/Search/Category.php
CHANGED
@@ -46,7 +46,7 @@ class Mage_XmlConnect_Model_Adminhtml_Search_Category extends Varien_Object
|
|
46 |
$this->setResults($arr);
|
47 |
return $this;
|
48 |
}
|
49 |
-
/** @var $collection
|
50 |
$collection = Mage::getResourceModel('xmlconnect/categorySearch_collection');
|
51 |
$collection->addAttributeToSelect('name')->addAttributeToSelect('description')
|
52 |
->addSearchFilter($this->getQuery())->setCurPage($this->getStart())->setPageSize($this->getLimit())->load();
|
46 |
$this->setResults($arr);
|
47 |
return $this;
|
48 |
}
|
49 |
+
/** @var $collection Mage_XmlConnect_Model_Resource_CategorySearch_Collection */
|
50 |
$collection = Mage::getResourceModel('xmlconnect/categorySearch_collection');
|
51 |
$collection->addAttributeToSelect('name')->addAttributeToSelect('description')
|
52 |
->addSearchFilter($this->getQuery())->setCurPage($this->getStart())->setPageSize($this->getLimit())->load();
|
app/code/core/Mage/XmlConnect/Model/Application.php
CHANGED
@@ -27,8 +27,8 @@
|
|
27 |
/**
|
28 |
* Xmlconnect Application model
|
29 |
*
|
30 |
-
* @method
|
31 |
-
* @method
|
32 |
* @method string getName()
|
33 |
* @method Mage_XmlConnect_Model_Application setName(string $value)
|
34 |
* @method string getCode()
|
27 |
/**
|
28 |
* Xmlconnect Application model
|
29 |
*
|
30 |
+
* @method Mage_XmlConnect_Model_Resource_Application _getResource()
|
31 |
+
* @method Mage_XmlConnect_Model_Resource_Application getResource()
|
32 |
* @method string getName()
|
33 |
* @method Mage_XmlConnect_Model_Application setName(string $value)
|
34 |
* @method string getCode()
|
app/code/core/Mage/XmlConnect/Model/ConfigData.php
CHANGED
@@ -278,7 +278,7 @@ class Mage_XmlConnect_Model_ConfigData extends Mage_Core_Model_Abstract
|
|
278 |
$collection->addPathFilter($path, false);
|
279 |
}
|
280 |
|
281 |
-
return ($result = $collection->
|
282 |
}
|
283 |
|
284 |
/**
|
278 |
$collection->addPathFilter($path, false);
|
279 |
}
|
280 |
|
281 |
+
return ($result = $collection->fetchItem()) ? $result->getValue() : null;
|
282 |
}
|
283 |
|
284 |
/**
|
app/code/core/Mage/XmlConnect/Model/Configuration.php
CHANGED
@@ -133,7 +133,7 @@ class Mage_XmlConnect_Model_Configuration extends Mage_Core_Model_Abstract
|
|
133 |
protected function _getConfigDataCollection()
|
134 |
{
|
135 |
if (null === $this->_configDataCollection) {
|
136 |
-
$this->_configDataCollection = Mage::getModel('core/
|
137 |
} else {
|
138 |
$this->_configDataCollection->clear()->getSelect()->reset();
|
139 |
}
|
133 |
protected function _getConfigDataCollection()
|
134 |
{
|
135 |
if (null === $this->_configDataCollection) {
|
136 |
+
$this->_configDataCollection = Mage::getModel('core/resource_config_data_collection');
|
137 |
} else {
|
138 |
$this->_configDataCollection->clear()->getSelect()->reset();
|
139 |
}
|
app/code/core/Mage/XmlConnect/Model/History.php
CHANGED
@@ -27,8 +27,8 @@
|
|
27 |
/**
|
28 |
* Xmlconnect history model
|
29 |
*
|
30 |
-
* @method
|
31 |
-
* @method
|
32 |
* @method int getApplicationId()
|
33 |
* @method Mage_XmlConnect_Model_History setApplicationId(int $value)
|
34 |
* @method string getCreatedAt()
|
@@ -45,7 +45,7 @@
|
|
45 |
* @method Mage_XmlConnect_Model_History setCode(string $value)
|
46 |
*
|
47 |
* @category Mage
|
48 |
-
* @package
|
49 |
* @author Magento Core Team <core@magentocommerce.com>
|
50 |
*/
|
51 |
class Mage_XmlConnect_Model_History extends Mage_Core_Model_Abstract
|
27 |
/**
|
28 |
* Xmlconnect history model
|
29 |
*
|
30 |
+
* @method Mage_XmlConnect_Model_Resource_History _getResource()
|
31 |
+
* @method Mage_XmlConnect_Model_Resource_History getResource()
|
32 |
* @method int getApplicationId()
|
33 |
* @method Mage_XmlConnect_Model_History setApplicationId(int $value)
|
34 |
* @method string getCreatedAt()
|
45 |
* @method Mage_XmlConnect_Model_History setCode(string $value)
|
46 |
*
|
47 |
* @category Mage
|
48 |
+
* @package Mage_XmlConnect
|
49 |
* @author Magento Core Team <core@magentocommerce.com>
|
50 |
*/
|
51 |
class Mage_XmlConnect_Model_History extends Mage_Core_Model_Abstract
|
app/code/core/Mage/XmlConnect/Model/Images.php
CHANGED
@@ -226,7 +226,7 @@ class Mage_XmlConnect_Model_Images extends Mage_Core_Model_Abstract
|
|
226 |
$this->setApplicationId(Mage::helper('xmlconnect')->getApplicationId());
|
227 |
}
|
228 |
return $this->getCollection()->addApplicationToFilter($this->getApplicationId())->addImageTypeToFilter($type)
|
229 |
-
->setPositionOrder()->
|
230 |
}
|
231 |
|
232 |
/**
|
226 |
$this->setApplicationId(Mage::helper('xmlconnect')->getApplicationId());
|
227 |
}
|
228 |
return $this->getCollection()->addApplicationToFilter($this->getApplicationId())->addImageTypeToFilter($type)
|
229 |
+
->setPositionOrder()->fetchItem();
|
230 |
}
|
231 |
|
232 |
/**
|
app/code/core/Mage/XmlConnect/Model/Input/Filter/MaliciousCode.php
DELETED
@@ -1,100 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_XmlConnect
|
23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Filter for removing malicious code from HTML
|
29 |
-
*
|
30 |
-
* Current class is a copy of Mage_Core_Model_Input_Filter_MaliciousCode
|
31 |
-
* and added for back compatibility with older versions of Magento
|
32 |
-
* due to the fact that we use these code for packages in Magento Connect
|
33 |
-
*
|
34 |
-
* @category Mage
|
35 |
-
* @package Mage_XmlConnect
|
36 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
37 |
-
*/
|
38 |
-
class Mage_XmlConnect_Model_Input_Filter_MaliciousCode implements Zend_Filter_Interface
|
39 |
-
{
|
40 |
-
/**
|
41 |
-
* Regular expressions for cutting malicious code
|
42 |
-
*
|
43 |
-
* @var array
|
44 |
-
*/
|
45 |
-
protected $_expressions = array(
|
46 |
-
//comments, must be first
|
47 |
-
'/(\/\*.*\*\/)/Us',
|
48 |
-
//tabs
|
49 |
-
'/(\t)/',
|
50 |
-
//javasript prefix
|
51 |
-
'/(javascript\s*:)/Usi',
|
52 |
-
//import styles
|
53 |
-
'/(@import)/Usi',
|
54 |
-
//js in the style attribute
|
55 |
-
'/style=[^<]*((expression\s*?\([^<]*?\))|(behavior\s*:))[^<]*(?=\>)/Uis',
|
56 |
-
//js attributes
|
57 |
-
'/(ondblclick|onclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onload|onunload|onerror)=[^<]*(?=\>)/Uis',
|
58 |
-
//tags
|
59 |
-
'/<\/?(script|meta|link|frame|iframe).*>/Uis',
|
60 |
-
//base64 usage
|
61 |
-
'/src=[^<]*base64[^<]*(?=\>)/Uis',
|
62 |
-
);
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Filter value
|
66 |
-
*
|
67 |
-
* @param string|array $value
|
68 |
-
* @return string|array Filtered value
|
69 |
-
*/
|
70 |
-
public function filter($value)
|
71 |
-
{
|
72 |
-
return preg_replace($this->_expressions, '', $value);
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Add expression
|
77 |
-
*
|
78 |
-
* @param string $expression
|
79 |
-
* @return Mage_Core_Model_Input_Filter_MaliciousCode
|
80 |
-
*/
|
81 |
-
public function addExpression($expression)
|
82 |
-
{
|
83 |
-
if (!in_array($expression, $this->_expressions)) {
|
84 |
-
$this->_expressions[] = $expression;
|
85 |
-
}
|
86 |
-
return $this;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Set expressions
|
91 |
-
*
|
92 |
-
* @param array $expressions
|
93 |
-
* @return Mage_Core_Model_Input_Filter_MaliciousCode
|
94 |
-
*/
|
95 |
-
public function setExpressions(array $expressions)
|
96 |
-
{
|
97 |
-
$this->_expressions = $expressions;
|
98 |
-
return $this;
|
99 |
-
}
|
100 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/core/Mage/XmlConnect/Model/Mysql4/Cms/Page/Collection.php
CHANGED
@@ -27,9 +27,9 @@
|
|
27 |
/**
|
28 |
* Extended CMS page collection
|
29 |
*
|
30 |
-
* @category
|
31 |
-
* @package
|
32 |
-
* @author
|
33 |
*/
|
34 |
class Mage_XmlConnect_Model_Mysql4_Cms_Page_Collection extends Mage_XmlConnect_Model_Resource_Cms_Page_Collection
|
35 |
{
|
27 |
/**
|
28 |
* Extended CMS page collection
|
29 |
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
class Mage_XmlConnect_Model_Mysql4_Cms_Page_Collection extends Mage_XmlConnect_Model_Resource_Cms_Page_Collection
|
35 |
{
|
app/code/core/Mage/XmlConnect/Model/Mysql4/History/Collection.php
CHANGED
@@ -27,9 +27,9 @@
|
|
27 |
/**
|
28 |
* History resource collection
|
29 |
*
|
30 |
-
* @category
|
31 |
-
* @package
|
32 |
-
* @author
|
33 |
*/
|
34 |
class Mage_XmlConnect_Model_Mysql4_History_Collection
|
35 |
extends Mage_XmlConnect_Model_Resource_History_Collection
|
27 |
/**
|
28 |
* History resource collection
|
29 |
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
class Mage_XmlConnect_Model_Mysql4_History_Collection
|
35 |
extends Mage_XmlConnect_Model_Resource_History_Collection
|
app/code/core/Mage/XmlConnect/Model/OfflineCatalog.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_XmlConnect
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* XmlConnect offline catalog model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Xmlconnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_OfflineCatalog
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Category type
|
38 |
+
*/
|
39 |
+
const CATEGORY_TYPE = 'category';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Product type
|
43 |
+
*/
|
44 |
+
const PRODUCT_TYPE = 'product';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Home banners type
|
48 |
+
*/
|
49 |
+
const HOMEBANNERS_TYPE = 'homebanners';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Home page type
|
53 |
+
*/
|
54 |
+
const HOME_TYPE = 'home';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Config type
|
58 |
+
*/
|
59 |
+
const CONFIG_TYPE = 'config';
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Run export by type
|
63 |
+
*
|
64 |
+
* @param string $type
|
65 |
+
* @return Mage_XmlConnect_Model_OfflineCatalog
|
66 |
+
*/
|
67 |
+
protected function _runExport($type)
|
68 |
+
{
|
69 |
+
$exportModel = $this->_getExportModel($type);
|
70 |
+
if (null !== $exportModel) {
|
71 |
+
$exportModel->exportData();
|
72 |
+
}
|
73 |
+
return $this;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Export offline catalog data
|
78 |
+
*
|
79 |
+
* @return Mage_XmlConnect_Model_OfflineCatalog
|
80 |
+
*/
|
81 |
+
public function exportData()
|
82 |
+
{
|
83 |
+
Mage::helper('xmlconnect/offlineCatalog')->prepareResultDirectory();
|
84 |
+
$this->_runExport(self::CATEGORY_TYPE)->_runExport(self::PRODUCT_TYPE)->_runExport(self::HOMEBANNERS_TYPE)
|
85 |
+
->_runExport(self::HOME_TYPE)->_runExport(self::CONFIG_TYPE);
|
86 |
+
return $this;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get export model by type
|
91 |
+
*
|
92 |
+
* @param string $type
|
93 |
+
* @return Mage_Core_Model_Abstract|null
|
94 |
+
*/
|
95 |
+
protected function _getExportModel($type)
|
96 |
+
{
|
97 |
+
switch ($type) {
|
98 |
+
case self::CATEGORY_TYPE:
|
99 |
+
return Mage::getModel('xmlconnect/offlineCatalog_category');
|
100 |
+
break;
|
101 |
+
case self::PRODUCT_TYPE:
|
102 |
+
return Mage::getModel('xmlconnect/offlineCatalog_product');
|
103 |
+
break;
|
104 |
+
case self::HOMEBANNERS_TYPE:
|
105 |
+
return Mage::getModel('xmlconnect/offlineCatalog_homebanners');
|
106 |
+
break;
|
107 |
+
case self::HOME_TYPE:
|
108 |
+
return Mage::getModel('xmlconnect/offlineCatalog_home');
|
109 |
+
break;
|
110 |
+
case self::CONFIG_TYPE:
|
111 |
+
return Mage::getModel('xmlconnect/offlineCatalog_config');
|
112 |
+
break;
|
113 |
+
default:
|
114 |
+
return null;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Abstract.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_XmlConnect
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Xmlconnect offline catalog abstract model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
abstract class Mage_XmlConnect_Model_OfflineCatalog_Abstract extends Mage_Core_Model_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Return layout block
|
38 |
+
*
|
39 |
+
* @abstract
|
40 |
+
* @param Mage_XmlConnect_Helper_OfflineCatalog $exportHelper
|
41 |
+
* @return Mage_Core_Block_Abstract
|
42 |
+
*/
|
43 |
+
abstract public function getLayoutBlock($exportHelper);
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Return action url
|
47 |
+
*
|
48 |
+
* @abstract
|
49 |
+
* @return string
|
50 |
+
*/
|
51 |
+
abstract protected function _getActionUrl();
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Export offline catalog data
|
55 |
+
*
|
56 |
+
* @return Mage_XmlConnect_Model_OfflineCatalog_Home
|
57 |
+
*/
|
58 |
+
public function exportData()
|
59 |
+
{
|
60 |
+
/** @var $exportHelper Mage_XmlConnect_Helper_OfflineCatalog */
|
61 |
+
$exportHelper = Mage::helper('xmlconnect/offlineCatalog');
|
62 |
+
$currentBlock = $this->getLayoutBlock($exportHelper);
|
63 |
+
$exportHelper->addOfflineCatalogData($this->_getActionUrl(), $currentBlock->toHtml());
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
}
|
app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Category.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_XmlConnect
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Xmlconnect offline catalog category model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_OfflineCatalog_Category extends Mage_XmlConnect_Block_Catalog_Category
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Category url
|
38 |
+
*/
|
39 |
+
const URL_CATEGORY_DETAILS = 'xmlconnect/catalog/category/id/%1$s/';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Product count in category
|
43 |
+
*/
|
44 |
+
const PRODUCT_IN_CATEGORY = 10;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Request controller
|
48 |
+
*
|
49 |
+
* @var null|Mage_Core_Controller_Request_Http
|
50 |
+
*/
|
51 |
+
protected $_request;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @var array
|
55 |
+
*/
|
56 |
+
protected $_productIds = array();
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Initialize category model
|
60 |
+
*/
|
61 |
+
protected function _construct()
|
62 |
+
{
|
63 |
+
$this->setCategoryModel(Mage::getModel('xmlconnect/offlineCatalog_category_category'));
|
64 |
+
$this->setIndexCategoryModel(Mage::getModel('xmlconnect/offlineCatalog_category_indexCategory'));
|
65 |
+
$this->_request = Mage::app()->getRequest();
|
66 |
+
parent::_construct();
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Get request
|
71 |
+
*
|
72 |
+
* @return Mage_Core_Controller_Request_Http
|
73 |
+
*/
|
74 |
+
protected function _getRequest()
|
75 |
+
{
|
76 |
+
if (null === $this->_request) {
|
77 |
+
$this->_request = Mage::app()->getRequest();
|
78 |
+
}
|
79 |
+
return $this->_request;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Export category data
|
84 |
+
*
|
85 |
+
* @return Mage_XmlConnect_Model_OfflineCatalog_Category
|
86 |
+
*/
|
87 |
+
public function exportData()
|
88 |
+
{
|
89 |
+
$this->_getRequest()->setParam('id', null)->setParam('count', self::PRODUCT_IN_CATEGORY);
|
90 |
+
$this->getIndexCategoryModel()->exportData();
|
91 |
+
/** @var $helper Mage_Catalog_Helper_Category */
|
92 |
+
$helper = Mage::helper('catalog/category');
|
93 |
+
foreach ($helper->getStoreCategories() as $category) {
|
94 |
+
if (!$category->getIsActive()) {
|
95 |
+
continue;
|
96 |
+
}
|
97 |
+
$this->_exportCategory($category);
|
98 |
+
}
|
99 |
+
return $this;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Export category data
|
104 |
+
*
|
105 |
+
* @param Mage_Catalog_Model_Category $category
|
106 |
+
* @return Mage_XmlConnect_Model_OfflineCatalog_Category
|
107 |
+
*/
|
108 |
+
protected function _exportCategory($category)
|
109 |
+
{
|
110 |
+
/** @var $exportHelper Mage_XmlConnect_Helper_OfflineCatalog */
|
111 |
+
$exportHelper = Mage::helper('xmlconnect/offlineCatalog');
|
112 |
+
$this->_getRequest()->setParam('app_code', $exportHelper->getCurrentDeviceModel()->getCode());
|
113 |
+
|
114 |
+
$categoryId = $category->getId();
|
115 |
+
$this->getCategoryModel()->setCategoryId($categoryId);
|
116 |
+
$this->_getRequest()->setParam('id', $categoryId);
|
117 |
+
$this->getCategoryModel()->exportData();
|
118 |
+
return $this;
|
119 |
+
}
|
120 |
+
}
|
app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Category/Category.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_XmlConnect
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Xmlconnect offline catalog category model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_OfflineCatalog_Category_Category extends Mage_XmlConnect_Model_OfflineCatalog_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Category url
|
38 |
+
*/
|
39 |
+
const CATEGORY_URL = 'xmlconnect/catalog/category/id/%1$s/';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Return category block
|
43 |
+
*
|
44 |
+
* @param Mage_XmlConnect_Helper_OfflineCatalog $exportHelper
|
45 |
+
* @return Mage_Core_Block_Abstract
|
46 |
+
*/
|
47 |
+
public function getLayoutBlock($exportHelper)
|
48 |
+
{
|
49 |
+
return $exportHelper->getBlock('xmlconnect.catalog.category');
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Return category url
|
54 |
+
*
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
protected function _getActionUrl()
|
58 |
+
{
|
59 |
+
return sprintf(Mage::getBaseUrl() . self::CATEGORY_URL, $this->getCategoryId());
|
60 |
+
}
|
61 |
+
}
|
app/code/core/Mage/XmlConnect/Model/{Mysql4/CategorySearch/Collection.php → OfflineCatalog/Category/IndexCategory.php}
RENAMED
@@ -25,13 +25,37 @@
|
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
-
*
|
29 |
*
|
30 |
-
* @category
|
31 |
-
* @package
|
32 |
-
* @author
|
33 |
*/
|
34 |
-
class
|
35 |
-
extends Mage_XmlConnect_Model_Resource_CategorySearch_Collection
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
+
* Xmlconnect offline catalog index category model
|
29 |
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Model_OfflineCatalog_Category_IndexCategory extends Mage_XmlConnect_Model_OfflineCatalog_Abstract
|
|
|
35 |
{
|
36 |
+
/**
|
37 |
+
* Index category url
|
38 |
+
*/
|
39 |
+
const CATEGORY_INDEX_URL = 'xmlconnect/catalog/category/';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Return category block
|
43 |
+
*
|
44 |
+
* @param Mage_XmlConnect_Helper_OfflineCatalog $exportHelper
|
45 |
+
* @return Mage_Core_Block_Abstract
|
46 |
+
*/
|
47 |
+
public function getLayoutBlock($exportHelper)
|
48 |
+
{
|
49 |
+
return $exportHelper->getBlock('xmlconnect.catalog.category');
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Return index category url
|
54 |
+
*
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
protected function _getActionUrl()
|
58 |
+
{
|
59 |
+
return Mage::getBaseUrl() . self::CATEGORY_INDEX_URL;
|
60 |
+
}
|
61 |
}
|
app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Config.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_XmlConnect
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Xmlconnect offline catalog config model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_OfflineCatalog_Config extends Mage_XmlConnect_Model_OfflineCatalog_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Config url
|
38 |
+
*/
|
39 |
+
const CONFIG_URL = 'Configuration';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Export config data
|
43 |
+
*
|
44 |
+
* @return Mage_XmlConnect_Model_OfflineCatalog_Config
|
45 |
+
*/
|
46 |
+
public function exportData()
|
47 |
+
{
|
48 |
+
/** @var $exportHelper Mage_XmlConnect_Helper_OfflineCatalog */
|
49 |
+
$exportHelper = Mage::helper('xmlconnect/offlineCatalog');
|
50 |
+
Mage::app()->getRequest()->setParam('app_code', $exportHelper->getCurrentDeviceModel()->getCode());
|
51 |
+
$exportHelper->addOfflineCatalogData(
|
52 |
+
$this->_getActionUrl(), $this->getLayoutBlock($exportHelper)->toHtml()
|
53 |
+
);
|
54 |
+
return $this;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Return config block
|
59 |
+
*
|
60 |
+
* @param Mage_XmlConnect_Helper_OfflineCatalog $exportHelper
|
61 |
+
* @return Mage_Core_Block_Abstract
|
62 |
+
*/
|
63 |
+
public function getLayoutBlock($exportHelper)
|
64 |
+
{
|
65 |
+
return $exportHelper->getBlock('xmlconnect.configuration');
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Return action url
|
70 |
+
*
|
71 |
+
* @return string
|
72 |
+
*/
|
73 |
+
protected function _getActionUrl()
|
74 |
+
{
|
75 |
+
return self::CONFIG_URL;
|
76 |
+
}
|
77 |
+
}
|
app/code/core/Mage/XmlConnect/Model/{Mysql4/Images/Collection.php → OfflineCatalog/Home.php}
RENAMED
@@ -25,12 +25,37 @@
|
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
-
*
|
29 |
*
|
30 |
* @category Mage
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
+
* Xmlconnect offline catalog home model
|
29 |
*
|
30 |
* @category Mage
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Model_OfflineCatalog_Home extends Mage_XmlConnect_Model_OfflineCatalog_Abstract
|
35 |
{
|
36 |
+
/**
|
37 |
+
* Home url
|
38 |
+
*/
|
39 |
+
const HOME_URL = 'xmlconnect/index/index/';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Return home block
|
43 |
+
*
|
44 |
+
* @param Mage_XmlConnect_Helper_OfflineCatalog $exportHelper
|
45 |
+
* @return Mage_Core_Block_Abstract
|
46 |
+
*/
|
47 |
+
public function getLayoutBlock($exportHelper)
|
48 |
+
{
|
49 |
+
return $exportHelper->getBlock('xmlconnect.home');
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Return home url
|
54 |
+
*
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
protected function _getActionUrl()
|
58 |
+
{
|
59 |
+
return Mage::getBaseUrl() . self::HOME_URL;
|
60 |
+
}
|
61 |
}
|
app/code/core/Mage/XmlConnect/Model/{Mysql4/Images.php → OfflineCatalog/Homebanners.php}
RENAMED
@@ -25,12 +25,37 @@
|
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
-
*
|
29 |
*
|
30 |
* @category Mage
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
+
* Xmlconnect offline catalog homebanners model
|
29 |
*
|
30 |
* @category Mage
|
31 |
* @package Mage_XmlConnect
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_XmlConnect_Model_OfflineCatalog_Homebanners extends Mage_XmlConnect_Model_OfflineCatalog_Abstract
|
35 |
{
|
36 |
+
/**
|
37 |
+
* Home banners url
|
38 |
+
*/
|
39 |
+
const HOMEBANNES_URL = 'xmlconnect/homebanners';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Return home banners block
|
43 |
+
*
|
44 |
+
* @param Mage_XmlConnect_Helper_OfflineCatalog $exportHelper
|
45 |
+
* @return Mage_Core_Block_Abstract
|
46 |
+
*/
|
47 |
+
public function getLayoutBlock($exportHelper)
|
48 |
+
{
|
49 |
+
return $exportHelper->getBlock('xmlconnect.homebanners');
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Return home banners url
|
54 |
+
*
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
protected function _getActionUrl()
|
58 |
+
{
|
59 |
+
return Mage::getBaseUrl() . self::HOMEBANNES_URL;
|
60 |
+
}
|
61 |
}
|
app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_XmlConnect
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Xmlconnect offline catalog product model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_XmlConnect
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_XmlConnect_Model_OfflineCatalog_Product extends Mage_XmlConnect_Block_Catalog_Product_List
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Type product
|
38 |
+
*/
|
39 |
+
const TYPE_PRODUCT = 'product';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Type review
|
43 |
+
*/
|
44 |
+
const TYPE_REVIEW = 'review';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Type gallery
|
48 |
+
*/
|
49 |
+
const TYPE_GALLERY = 'gallery';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Export product data
|
53 |
+
*
|
54 |
+
* @return Mage_XmlConnect_Model_OfflineCatalog_Product
|
55 |
+
*/
|
56 |
+
public function exportData()
|
57 |
+
{
|
58 |
+
/** @var $helper Mage_Catalog_Helper_Category */
|
59 |
+
$helper = Mage::helper('catalog/category');
|
60 |
+
Mage::app()->getRequest()->setParam(
|
61 |
+
'count', Mage_XmlConnect_Model_OfflineCatalog_Category::PRODUCT_IN_CATEGORY
|
62 |
+
);
|
63 |
+
foreach ($helper->getStoreCategories() as $category) {
|
64 |
+
if (!$category->getIsActive()) {
|
65 |
+
continue;
|
66 |
+
}
|
67 |
+
$this->_exportProductCollection($category);
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Export product collection
|
73 |
+
*
|
74 |
+
* @param Varien_Data_Tree_Node $category
|
75 |
+
*/
|
76 |
+
protected function _exportProductCollection($category)
|
77 |
+
{
|
78 |
+
$categoryModel = Mage::getModel('catalog/category')->load($category->getId());
|
79 |
+
$this->setCategory($categoryModel)->setLayer(Mage::getSingleton('catalog/layer'));
|
80 |
+
foreach ($this->_getProductCollection() as $product) {
|
81 |
+
$product->load($product->getEntityId());
|
82 |
+
Mage::app()->getRequest()->setParam('id', $product->getId());
|
83 |
+
$this->_getExportModel(self::TYPE_PRODUCT)->setProduct($product)->exportData();
|
84 |
+
$this->_getExportModel(self::TYPE_GALLERY)->setProduct($product)->exportData();
|
85 |
+
$this->_getExportModel(self::TYPE_REVIEW)->setProduct($product)->exportData();
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get export model by type
|
91 |
+
*
|
92 |
+
* @param string $type
|
93 |
+
* @return Mage_Core_Model_Abstract|null
|
94 |
+
*/
|
95 |
+
protected function _getExportModel($type)
|
96 |
+
{
|
97 |
+
switch ($type) {
|
98 |
+
case self::TYPE_PRODUCT:
|
99 |
+
return Mage::getSingleton('xmlconnect/offlineCatalog_product_product');
|
100 |
+
break;
|
101 |
+
case self::TYPE_GALLERY:
|
102 |
+
return Mage::getSingleton('xmlconnect/offlineCatalog_product_gallery');
|
103 |
+
break;
|
104 |
+
case self::TYPE_REVIEW:
|
105 |
+
return Mage::getSingleton('xmlconnect/offlineCatalog_product_review');
|
106 |
+
break;
|
107 |
+
default:
|
108 |
+
return null;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
app/code/core/Mage/XmlConnect/Model/OfflineCatalog/Product/Gallery.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|