IcecatLive - Version 1.7.0

Version Notes

Bug fix:
- Fixed a bug "Show / Hide Icecat products".
- Fixed duplicate buttons Finish Import.
- Fixed display of Icecat attribute.
- Fixed a bug with a stucking process during the import
- Fixed a bug with the display of unique product attributes.
- Fixed loading of products specified language.
- Fixed Cron status in Noovias

Improvements:
- Improved procedure to run by Cron. Update starts every Sunday at 00:00 and imports each month 1st day of 00:00.
- Reduced the number of database tables. Save space in the database.
- Module placed in a separate menu item configuration.
- Reduced traffic
- Speed Improvements

New:
- Added Dashboard and Diagnostic pages
- Added more detailed information about product loading
- Added possibility to combine Icecat attributes with internal Magento attributes
- Added possibility to select attribute for showing on data-sheet
- Added grid table to dashboard to show status about non imported products
- Added function to update only new products
- Added setting "Loading type" with parameters From cache or Real-time.
- Added an IP address of the store to information dashboard.

Download this release

Release Info

Developer IceShop
Extension IcecatLive
Version 1.7.0
Comparing to
See all releases


Code changes from version 1.6.0 to 1.7.0

Files changed (64) hide show
  1. app/code/local/Iceshop/Icecatlive/Block/Adminhtml/Notifications.php +34 -0
  2. app/code/local/Iceshop/Icecatlive/Block/Adminhtml/Product/List/Grid.php +192 -0
  3. app/code/local/Iceshop/Icecatlive/Block/Adminhtml/System/Config/Form/Button.php +5 -5
  4. app/code/local/Iceshop/Icecatlive/Block/Adminhtml/System/Config/Form/UpdateButton.php +57 -0
  5. app/code/local/Iceshop/Icecatlive/Block/Attributes.php +164 -89
  6. app/code/local/Iceshop/Icecatlive/Block/Media.php +0 -41
  7. app/code/local/Iceshop/Icecatlive/Block/Product/List/Toolbar.php +57 -84
  8. app/code/local/Iceshop/Icecatlive/Block/Related.php +58 -58
  9. app/code/local/Iceshop/Icecatlive/Block/Upsell.php +50 -50
  10. app/code/local/Iceshop/Icecatlive/CatalogSearch/Block/Result.php +33 -34
  11. app/code/local/Iceshop/Icecatlive/Helper/Catalog/Image.php +0 -58
  12. app/code/local/Iceshop/Icecatlive/Helper/Data.php +77 -0
  13. app/code/local/Iceshop/Icecatlive/Helper/Db.php +221 -0
  14. app/code/local/Iceshop/Icecatlive/Helper/Format.php +252 -0
  15. app/code/local/Iceshop/Icecatlive/Helper/Getdata.php +211 -211
  16. app/code/local/Iceshop/Icecatlive/Helper/Image.php +0 -49
  17. app/code/local/Iceshop/Icecatlive/Helper/Output.php +179 -179
  18. app/code/local/Iceshop/Icecatlive/Helper/System/System.php +461 -0
  19. app/code/local/Iceshop/Icecatlive/Helper/System/Systemcheck.php +615 -0
  20. app/code/local/Iceshop/Icecatlive/Model/Catalog/Category.php +19 -18
  21. app/code/local/Iceshop/Icecatlive/Model/Catalog/Product.php +229 -237
  22. app/code/local/Iceshop/Icecatlive/Model/Catalog/Search.php +14 -14
  23. app/code/local/Iceshop/Icecatlive/Model/Imagescollection.php +0 -47
  24. app/code/local/Iceshop/Icecatlive/Model/Import.php +534 -616
  25. app/code/local/Iceshop/Icecatlive/Model/Observer.php +577 -493
  26. app/code/local/Iceshop/Icecatlive/Model/Relatedcollection.php +69 -69
  27. app/code/local/Iceshop/Icecatlive/Model/System/Config/Attributes.php +21 -20
  28. app/code/local/Iceshop/Icecatlive/Model/System/Config/Checksystem.php +11 -0
  29. app/code/local/Iceshop/Icecatlive/Model/System/Config/Descriptionpriority.php +14 -14
  30. app/code/local/Iceshop/Icecatlive/Model/System/Config/Iceshoplink.php +11 -0
  31. app/code/local/Iceshop/Icecatlive/Model/System/Config/Imagepriority.php +14 -14
  32. app/code/local/Iceshop/Icecatlive/Model/System/Config/LanguageList.xml +399 -399
  33. app/code/local/Iceshop/Icecatlive/Model/System/Config/Loadingtype.php +14 -0
  34. app/code/local/Iceshop/Icecatlive/Model/System/Config/Locales.php +50 -50
  35. app/code/local/Iceshop/Icecatlive/Model/System/Config/Namepriority.php +14 -14
  36. app/code/local/Iceshop/Icecatlive/Model/System/Config/Onlynewproducts.php +14 -0
  37. app/code/local/Iceshop/Icecatlive/Model/System/Config/Productpriority.php +14 -14
  38. app/code/local/Iceshop/Icecatlive/Model/System/Config/Shortdescrpriority.php +14 -14
  39. app/code/local/Iceshop/Icecatlive/Model/System/Config/Subscription.php +18 -18
  40. app/code/local/Iceshop/Icecatlive/Model/System/Config/Viewattributes.php +30 -0
  41. app/code/local/Iceshop/Icecatlive/controllers/Adminhtml/ImportproductController.php +12 -0
  42. app/code/local/Iceshop/Icecatlive/controllers/Adminhtml/ImportproductinfoController.php +16 -0
  43. app/code/local/Iceshop/Icecatlive/controllers/IcecatliveController.php +953 -0
  44. app/code/local/Iceshop/Icecatlive/controllers/ImageController.php +17 -17
  45. app/code/local/Iceshop/Icecatlive/etc/adminhtml.xml +32 -0
  46. app/code/local/Iceshop/Icecatlive/etc/config.xml +172 -185
  47. app/code/local/Iceshop/Icecatlive/etc/system.xml +249 -142
  48. app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/mysql4-install-1.6.0.php +0 -44
  49. app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/mysql4-install-1.7.0.php +40 -0
  50. app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/mysql4-upgrade-0.1.0-1.6.0.php +32 -44
  51. app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/mysql4-upgrade-0.1.1-1.6.0.php +17 -29
  52. app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/mysql4-upgrade-1.5.0-1.6.0.php +17 -29
  53. app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/mysql4-upgrade-1.6.0-1.7.0.php +40 -0
  54. app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/uninstall-old-version.php +2 -0
  55. app/design/adminhtml/default/default/layout/icecatlive.xml +19 -0
  56. app/design/adminhtml/default/default/template/iceshop/icecatlive/ajaxstatusimport.phtml +92 -53
  57. app/design/adminhtml/default/default/template/iceshop/icecatlive/notifications.phtml +10 -0
  58. app/design/frontend/default/default/template/iceshop/icecatlive/groupattributes.phtml +4 -6
  59. js/ICEshop/Icecatlive/jquery-1.9.1.min.js +4 -0
  60. js/ICEshop/Icecatlive/multi-lingual-store-field.js +244 -0
  61. js/ICEshop/Icecatlive/script.js +258 -0
  62. package.xml +30 -12
  63. skin/adminhtml/default/default/iceshop/icecatlive/images/iceshop_logo_small_16px.png +0 -0
  64. skin/adminhtml/default/default/iceshop/icecatlive/styles.css +125 -0
app/code/local/Iceshop/Icecatlive/Block/Adminhtml/Notifications.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Iceshop_Icecatlive_Block_Adminhtml_Notifications
5
+ */
6
+ class Iceshop_Icecatlive_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
7
+ {
8
+ /**
9
+ * @return array|string
10
+ */
11
+ public function getIcecatliveProblemsDigest()
12
+ {
13
+ $checker = Mage::helper('icecatlive/system_systemcheck')->init();
14
+ $problems_digest = $checker->getExtensionProblemsDigest();
15
+ $response = array();
16
+ if ($problems_digest->getCount() != 0) {
17
+ $problems = $problems_digest->getProblems();
18
+ foreach ($problems as $problem_name => $problem_value) {
19
+ $response[] = array($problem_name => $problem_value);
20
+ }
21
+ }
22
+ return $response;
23
+ }
24
+
25
+ /**
26
+ * Get index management url
27
+ *
28
+ * @return string
29
+ */
30
+ public function getManageUrl()
31
+ {
32
+ return Mage::helper("adminhtml")->getUrl("*/system_config/edit", array('section' => 'icecatlive_check_system'));
33
+ }
34
+ }
app/code/local/Iceshop/Icecatlive/Block/Adminhtml/Product/List/Grid.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iceshop_Icecatlive_Block_Adminhtml_Product_List_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('icecatliveGrid');
9
+ $this->setSaveParametersInSession(true);
10
+ $this->setUseAjax(true);
11
+ $this->setVarNameFilter('icecatlive_filter');
12
+ $this->_prepareCollection;
13
+ }
14
+
15
+ protected function _getStore()
16
+ {
17
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
18
+ return Mage::app()->getStore($storeId);
19
+ }
20
+
21
+ protected function _prepareCollection()
22
+ {
23
+ $store = $this->_getStore();
24
+ $collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSort('entity_id', 'DESC');
25
+
26
+ $collection->getSelect()->joinLeft( array('pt'=>Mage::getSingleton('core/resource')->getTableName('icecatlive/products_titles')),
27
+ 'entity_id = pt.prod_id', array('*'))->where("pt.prod_id IS NULL");
28
+
29
+ if($this->checkExistingAttribute('catalog_product', 'sku')){
30
+ $collection->addAttributeToSelect('sku');
31
+ }
32
+ if($this->checkExistingAttribute('catalog_product', 'name')){
33
+ $collection->addAttributeToSelect('name');
34
+ }
35
+ if($this->checkExistingAttribute('catalog_product', 'attribute_set_id')){
36
+ $collection->addAttributeToSelect('attribute_set_id');
37
+ }
38
+ if($this->checkExistingAttribute('catalog_product', 'type_id')){
39
+ $collection->addAttributeToSelect('type_id');
40
+ }
41
+
42
+ if ($store->getId()) {
43
+ $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
44
+ $collection->addStoreFilter($store);
45
+ if($this->checkExistingAttribute('catalog_product', 'name')){
46
+ $collection->joinAttribute(
47
+ 'name',
48
+ 'catalog_product/name',
49
+ 'entity_id',
50
+ null,
51
+ 'inner',
52
+ $adminStore
53
+ );
54
+ }
55
+ if($this->checkExistingAttribute('catalog_product', 'mpn')){
56
+ $collection->joinAttribute(
57
+ 'mpn',
58
+ 'catalog_product/mpn',
59
+ 'entity_id',
60
+ null,
61
+ 'inner',
62
+ $adminStore
63
+ );
64
+ }
65
+
66
+ if($this->checkExistingAttribute('catalog_product', 'ean')){
67
+ $collection->joinAttribute(
68
+ 'ean',
69
+ 'catalog_product/ean',
70
+ 'entity_id',
71
+ null,
72
+ 'inner',
73
+ $adminStore
74
+ );
75
+ }
76
+
77
+ $collection->joinAttribute(
78
+ 'custom_name',
79
+ 'catalog_product/name',
80
+ 'entity_id',
81
+ null,
82
+ 'inner',
83
+ $store->getId()
84
+ );
85
+ }
86
+ else {
87
+ if($this->checkExistingAttribute('catalog_product', 'price')){
88
+ $collection->addAttributeToSelect('price');
89
+ }
90
+ if($this->checkExistingAttribute('catalog_product', 'ean')){
91
+ $collection->joinAttribute('ean', 'catalog_product/ean', 'entity_id', null, 'inner');
92
+ }
93
+ if($this->checkExistingAttribute('catalog_product', 'mpn')){
94
+ $collection->joinAttribute('mpn', 'catalog_product/mpn', 'entity_id', null, 'inner');
95
+ }
96
+ if($this->checkExistingAttribute('catalog_product', 'status')){
97
+ $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
98
+ }
99
+ if($this->checkExistingAttribute('catalog_product', 'status')){
100
+ $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
101
+ }
102
+ }
103
+
104
+ $this->setCollection($collection);
105
+
106
+ parent::_prepareCollection();
107
+ $this->getCollection()->addWebsiteNamesToResult();
108
+ return $this;
109
+ }
110
+
111
+ public function checkExistingAttribute($group, $attribut){
112
+ $eav = Mage::getModel('eav/config');
113
+ $attribute = $eav->getAttribute($group, $attribut);
114
+ return $attribute->getId();
115
+ }
116
+
117
+
118
+ protected function _prepareColumns()
119
+ {
120
+
121
+ $this->addColumn('entity_id',
122
+ array(
123
+ 'header'=> Mage::helper('catalog')->__('ID'),
124
+ 'width' => '50px',
125
+ 'type' => 'number',
126
+ 'index' => 'entity_id',
127
+ ));
128
+ if($this->checkExistingAttribute('catalog_product', 'name')){
129
+ $this->addColumn('name',
130
+ array(
131
+ 'header'=> Mage::helper('catalog')->__('Name'),
132
+ 'index' => 'name',
133
+ ));
134
+
135
+ }
136
+
137
+ $store = $this->_getStore();
138
+ if ($store->getId()) {
139
+ $this->addColumn('custom_name',
140
+ array(
141
+ 'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
142
+ 'index' => 'custom_name',
143
+ ));
144
+ }
145
+
146
+ if($this->checkExistingAttribute('catalog_product', 'sku')){
147
+ $this->addColumn('sku',
148
+ array(
149
+ 'header'=> Mage::helper('catalog')->__('SKU'),
150
+ 'width' => '80px',
151
+ 'index' => 'sku',
152
+ ));
153
+ }
154
+
155
+ if($this->checkExistingAttribute('catalog_product', 'mpn')){
156
+ $this->addColumn('mpn',
157
+ array(
158
+ 'header'=> Mage::helper('catalog')->__('Manufacturer product number'),
159
+ 'width' => '80px',
160
+ 'index' => 'mpn',
161
+ ));
162
+ }
163
+
164
+ if($this->checkExistingAttribute('catalog_product', 'ean')){
165
+ $this->addColumn('ean',
166
+ array(
167
+ 'header'=> Mage::helper('catalog')->__('European Article Number '),
168
+ 'width' => '80px',
169
+ 'index' => 'ean',
170
+ ));
171
+ }
172
+
173
+
174
+ $this->addExportType('*/*/exportIcecatliveCsv', Mage::helper('icecatlive')->__('CSV'));
175
+ $this->addExportType('*/*/exportIcecatliveExcel', Mage::helper('icecatlive')->__('Excel XML'));
176
+
177
+ return parent::_prepareColumns();
178
+ }
179
+
180
+ public function getGridUrl()
181
+ {
182
+ return $this->getUrl('*/*/grid', array('_current'=>true));
183
+ }
184
+
185
+ public function getRowUrl($row)
186
+ {
187
+ return $this->getUrl('*/catalog_product/edit', array(
188
+ 'store'=>$this->getRequest()->getParam('store'),
189
+ 'id'=>$row->getId())
190
+ );
191
+ }
192
+ }
app/code/local/Iceshop/Icecatlive/Block/Adminhtml/System/Config/Form/Button.php CHANGED
@@ -42,14 +42,14 @@ class Iceshop_Icecatlive_Block_Adminhtml_System_Config_Form_Button extends Mage_
42
  $userLogin = Mage::getStoreConfig('icecat_root/icecat/login');
43
  $userPass = Mage::getStoreConfig('icecat_root/icecat/password');
44
  if (!empty($userLogin) && !empty($userPass)) {
45
- $button = $this->getLayout()->createBlock('adminhtml/widget_button')
46
  ->setData(array(
47
  'id' => 'icecatlive_button',
48
- 'label' => $this->helper('adminhtml')->__('Import'),
49
- 'onclick' => 'javascript:check(); return false;'
50
  ));
51
-
52
- return $button->toHtml();
53
  } else {
54
  return 'Please type your login and pass from IceCat and press Save Config button. After that you can see Import button, for start import data from IceCat to you DB.';
55
  }
42
  $userLogin = Mage::getStoreConfig('icecat_root/icecat/login');
43
  $userPass = Mage::getStoreConfig('icecat_root/icecat/password');
44
  if (!empty($userLogin) && !empty($userPass)) {
45
+ $prod_button = $this->getLayout()->createBlock('adminhtml/widget_button')
46
  ->setData(array(
47
  'id' => 'icecatlive_button',
48
+ 'label' => $this->helper('adminhtml')->__('Import product information'),
49
+ 'onclick' => 'javascript:import_prod_info(0, 1); return false;'
50
  ));
51
+ $buttons = $prod_button->toHtml();
52
+ return $buttons;
53
  } else {
54
  return 'Please type your login and pass from IceCat and press Save Config button. After that you can see Import button, for start import data from IceCat to you DB.';
55
  }
app/code/local/Iceshop/Icecatlive/Block/Adminhtml/System/Config/Form/UpdateButton.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iceshop_Icecatlive_Block_Adminhtml_System_Config_Form_UpdateButton extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ /*
5
+ * Set templated
6
+ */
7
+ protected function _construct()
8
+ {
9
+ parent::_construct();
10
+
11
+ $this->setTemplate('iceshop/icecatlive/ajaxstatusimport.phtml');
12
+ }
13
+
14
+ /**
15
+ * Return element html
16
+ *
17
+ * @param Varien_Data_Form_Element_Abstract $element
18
+ * @return string
19
+ */
20
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
21
+ {
22
+ return $this->_toHtml();
23
+ }
24
+
25
+ /**
26
+ * Return ajax url for button
27
+ *
28
+ * @return string
29
+ */
30
+ public function getAjaxCheckUrl()
31
+ {
32
+ return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_importdata/check');
33
+ }
34
+
35
+ /**
36
+ * Generate button html
37
+ *
38
+ * @return string
39
+ */
40
+ public function getButtonHtml()
41
+ {
42
+ $userLogin = Mage::getStoreConfig('icecat_root/icecat/login');
43
+ $userPass = Mage::getStoreConfig('icecat_root/icecat/password');
44
+ if (!empty($userLogin) && !empty($userPass)) {
45
+ $prod_button = $this->getLayout()->createBlock('adminhtml/widget_button')
46
+ ->setData(array(
47
+ 'id' => 'icecatlive_button',
48
+ 'label' => $this->helper('adminhtml')->__('Update new products'),
49
+ 'onclick' => 'javascript:import_prod_info(1); return false;'
50
+ ));
51
+ $buttons = $prod_button->toHtml();
52
+ return $buttons;
53
+ } else {
54
+ return 'Please type your login and pass from IceCat and press Save Config button. After that you can see Import button, for start import data from IceCat to you DB.';
55
+ }
56
+ }
57
+ }
app/code/local/Iceshop/Icecatlive/Block/Attributes.php CHANGED
@@ -1,89 +1,164 @@
1
- <?php
2
-
3
- class Iceshop_Icecatlive_Block_Attributes extends Mage_Core_Block_Template
4
- {
5
- public function getProduct()
6
- {
7
- if (!$this->_product) {
8
- $this->_product = Mage::registry('product');
9
- }
10
- return $this->_product;
11
- }
12
-
13
- public function getAdditionalData(array $excludeAttr = array())
14
- {
15
- //echo 'Its work';
16
- $data = $this->getAttributesArray();
17
-
18
- $data2 = array();
19
- foreach ($data as $_data) {
20
- if ($_data['label'] != '' && $_data['value'] != '' && $_data['label'] != 'id') {
21
- $value = $_data['value'];
22
- $group = 0;
23
- if ($tmp = $_data["id"]) {
24
- $group = $tmp;
25
- }
26
-
27
- $data2[$group]['items'][$_data['label']] = array(
28
- 'label' => $_data['label'],
29
- 'value' => $value,
30
- 'code' => $_data['label']
31
- );
32
-
33
- $data2[$group]['attrid'] = $_data["id"];
34
-
35
- } else if (!empty($_data['code']) && $_data['code'] == 'header') {
36
- $data2[$_data['id']]["title"] = $_data['value'];
37
- }
38
- }
39
-
40
- return $data2;
41
- }
42
-
43
- public function formatValue($value)
44
- {
45
- if ($value == "Y") {
46
- return '<img border="0" alt="" src="http://prf.icecat.biz/imgs/yes.gif"/>';
47
- } else if ($value == "N") {
48
- return '<img border="0" alt="" src="http://prf.icecat.biz/imgs/no.gif"/>';
49
- }
50
- return str_replace("\\n", "<br>", htmlspecialchars($value));
51
- }
52
-
53
- public function getAttributesArray()
54
- {
55
- $iceModel = Mage::getSingleton('icecatlive/import');
56
- $descriptionsListArray = $iceModel->getProductDescriptionList();
57
- $id = '';
58
- $arr = array();
59
- foreach ($descriptionsListArray as $key => $ma) {
60
- $id = $key;
61
- foreach ($ma as $key => $value) {
62
- $arr[$key] = $value;
63
- $arr[$key]["id"] = $id;
64
- }
65
- }
66
-
67
- $data = array();
68
- foreach ($arr as $key => $value) {
69
- //$attributes = Mage::getModel('catalog/product')->getAttributesFromIcecat($this->getProduct()->getEntityId(), $value);
70
- // @todo @someday @maybe make headers
71
- $data[] = array(
72
- 'label' => '',
73
- 'value' => $key,
74
- 'code' => 'header',
75
- 'id' => $value["id"]
76
- );
77
- $attributes = $value;
78
- foreach ($attributes as $attributeLabel => $attributeValue) {
79
- $data[] = array(
80
- 'label' => $attributeLabel,
81
- 'value' => $this->formatValue($attributeValue),
82
- 'code' => 'descript',
83
- 'id' => $value["id"]
84
- );
85
- }
86
- }
87
- return $data;
88
- }
89
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iceshop_Icecatlive_Block_Attributes extends Mage_Core_Block_Template
4
+ {
5
+ // public $_import_product;
6
+
7
+ public function __construct(array $args = array()) {
8
+ parent::__construct($args);
9
+ $import = new Iceshop_Icecatlive_Model_Observer();
10
+ $cache_file = $this->getCacheFile();
11
+ if(!file_exists($cache_file) && Mage::getStoreConfig('icecat_root/icecat/product_loadingtype')){
12
+ $this->_product = $import->loadProductInfoIntoCache((int)Mage::registry('current_product')->getId());
13
+ }
14
+ }
15
+
16
+
17
+ public function getCacheFile(){
18
+ $import = new Iceshop_Icecatlive_Model_Observer();
19
+ $locale = Mage::getStoreConfig('icecat_root/icecat/language');
20
+ if ($locale == '0') {
21
+ $systemLocale = explode("_", Mage::app()->getLocale()->getLocaleCode());
22
+ $locale = $systemLocale[0];
23
+ }
24
+ $this->_import_product = file_exists($cache_file);
25
+ return Mage::getBaseDir('var') . $import->_connectorCacheDir . 'iceshop_icecatlive_'. Mage::registry('current_product')->getId() .'_' . $locale;
26
+ }
27
+
28
+ public function getTemplateFile()
29
+ {
30
+ $config_template_file_path = Mage::getConfig()->getNode('default/icecatlive/patch')->template_file_path;
31
+ $templateName = parent::getTemplateFile();
32
+ return (preg_match('/product/', $templateName)) ? $config_template_file_path : $templateName;
33
+ }
34
+
35
+ public function getProduct()
36
+ {
37
+ if (!$this->_product) {
38
+ $this->_product = Mage::registry('product');
39
+ }
40
+ return $this->_product;
41
+ }
42
+
43
+ public function getAdditionalData(array $excludeAttr = array())
44
+ {
45
+ $data = $this->getAttributesArray();
46
+
47
+ $data2 = array();
48
+ foreach ($data as $_data) {
49
+ if ($_data['label'] != '' && $_data['value'] != '' && $_data['label'] != 'id') {
50
+ $value = $_data['value'];
51
+ $group = 0;
52
+ if ($tmp = $_data["id"]) {
53
+ $group = $tmp;
54
+ }
55
+
56
+ $data2[$group]['items'][$_data['label']] = array(
57
+ 'label' => $_data['label'],
58
+ 'value' => $value,
59
+ 'code' => $_data['label']
60
+ );
61
+
62
+ $data2[$group]['attrid'] = $_data["id"];
63
+
64
+ } else if (!empty($_data['code']) && $_data['code'] == 'header') {
65
+ $data2[$_data['id']]["title"] = $_data['value'];
66
+ }
67
+ }
68
+
69
+ return $data2;
70
+ }
71
+
72
+ public function formatValue($value)
73
+ {
74
+ if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
75
+ if ($value == "Y" || $value == "Yes" || $value == "YES") {
76
+ return '<img border="0" alt="" src="https://prf.icecat.biz/imgs/yes.gif"/>';
77
+ } else if ($value == "N" || $value == "NO" || $value == "No") {
78
+ return '<img border="0" alt="" src="https://prf.icecat.biz/imgs/no.gif"/>';
79
+ }
80
+ }else{
81
+ if ($value == "Y" || $value == "Yes" || $value == "YES") {
82
+ return '<img border="0" alt="" src="http://prf.icecat.biz/imgs/yes.gif"/>';
83
+ } else if ($value == "N" || $value == "NO" || $value == "No") {
84
+ return '<img border="0" alt="" src="http://prf.icecat.biz/imgs/no.gif"/>';
85
+ }
86
+ }
87
+ return str_replace("\\n", "<br>", htmlspecialchars($value));
88
+ }
89
+
90
+ public function getAttributesArray()
91
+ {
92
+ $iceModel = Mage::getSingleton('icecatlive/import');
93
+ $descriptionsListArray = $iceModel->getProductDescriptionList();
94
+ $id = '';
95
+ $arr = array();
96
+ foreach ($descriptionsListArray as $key => $ma) {
97
+ $id = $key;
98
+ foreach ($ma as $key => $value) {
99
+ $arr[$key] = $value;
100
+ $arr[$key]["id"] = $id;
101
+ }
102
+ }
103
+
104
+ $data = array();
105
+ $product = $this->getProduct();
106
+ $attributes_general = $product->getAttributes();
107
+ foreach ($attributes_general as $attribute) {
108
+ if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr)) {
109
+ $value = $attribute->getFrontend()->getValue($product);
110
+ if (!$product->hasData($attribute->getAttributeCode())) {
111
+ $value = Mage::helper('catalog')->__('N/A');
112
+ } elseif ((string)$value == '') {
113
+ $value = Mage::helper('catalog')->__('No');
114
+ } elseif ($attribute->getFrontendInput() == 'price' && is_string($value)) {
115
+ $value = Mage::app()->getStore()->convertPrice($value, true);
116
+ }
117
+ if (is_string($value) && strlen($value)) {
118
+ if(!$this->isAttributeView($attribute->getAttributeCode())){
119
+ $data[$attribute->getAttributeCode()] = array(
120
+ 'label' => $attribute->getStoreLabel(),
121
+ 'value' => $this->formatValue($value),
122
+ 'code' => $attribute->getAttributeCode()
123
+ );
124
+ }
125
+ }
126
+ }
127
+ }
128
+
129
+ foreach ($arr as $key => $value) {
130
+ // @todo @someday @maybe make headers
131
+ $data[] = array(
132
+ 'label' => '',
133
+ 'value' => $key,
134
+ 'code' => 'header',
135
+ 'id' => $value["id"]
136
+ );
137
+ $attributes = $value;
138
+ foreach ($attributes as $attributeLabel => $attributeValue) {
139
+ $data[] = array(
140
+ 'label' => $attributeLabel,
141
+ 'value' => $this->formatValue($attributeValue),
142
+ 'code' => 'descript',
143
+ 'id' => $value["id"]
144
+ );
145
+ }
146
+ }
147
+
148
+ return $data;
149
+ }
150
+
151
+ /**
152
+ * Return isset $attribute in not view attribute list
153
+ * @param String $attribute
154
+ * @return boolean
155
+ */
156
+ public function isAttributeView($attribute){
157
+ if(file_exists($this->getCacheFile())){
158
+ $view_product_attributes = explode(",",Mage::getStoreConfig('icecat_root/icecat/view_attributes'));
159
+ return in_array($attribute, $view_product_attributes);
160
+ }
161
+ return false;
162
+ }
163
+
164
+ }
app/code/local/Iceshop/Icecatlive/Block/Media.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
-
3
- class Iceshop_Icecatlive_Block_Media extends Mage_Catalog_Block_Product_View_Media
4
- {
5
- protected $_isGalleryDisabled;
6
-
7
- public function getGalleryImages()
8
- {
9
- if ($this->_isGalleryDisabled) {
10
- return array();
11
- }
12
- $iceCatModel = Mage::getSingleton('icecatlive/import');
13
- $icePhotos = $iceCatModel->getGalleryPhotos();
14
- $collection = $this->getProduct()->getMediaGalleryImages();
15
- $items = $collection->getItems();
16
- $Imagepriority = Mage::getStoreConfig('icecat_root/icecat/image_priority');
17
- if (!empty($icePhotos) && $Imagepriority != 'Db') {
18
- return Mage::getSingleton('Iceshop_Icecatlive_Model_Imagescollection', array(
19
- 'product' => $this->getProduct()
20
- ));
21
- } else if (count($items) == 1) {
22
- return array();
23
- } else {
24
- return $collection;
25
- }
26
- }
27
-
28
-
29
- public function getGalleryUrl($image = null)
30
- {
31
- $iceCatModel = Mage::getSingleton('icecatlive/import');
32
- $icePhotos = $iceCatModel->getGalleryPhotos();
33
- $Imagepriority = Mage::getStoreConfig('icecat_root/icecat/image_priority');
34
-
35
- if (!empty($icePhotos) && $Imagepriority != 'Db') {
36
- return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product/' . $image['file'];
37
- } else {
38
- return parent::getGalleryUrl($image);
39
- }
40
- }
41
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Iceshop/Icecatlive/Block/Product/List/Toolbar.php CHANGED
@@ -1,84 +1,57 @@
1
- <?php
2
-
3
- class Iceshop_Icecatlive_Block_Product_List_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar
4
- {
5
- public static $_productCollection = null;
6
- public static $_totalRecords = null;
7
-
8
- public function getCollection()
9
- {
10
- $ProductPriority = Mage::getStoreConfig('icecat_root/icecat/product_priority');
11
- $_productCollection = parent::getCollection();
12
-
13
- if (!$_productCollection->count() || $ProductPriority == 'Show') {
14
- return $_productCollection;
15
- } else {
16
- foreach ($_productCollection as $_product) {
17
- $icecat_prod = $this->CheckIcecatData($_product);
18
- if ($icecat_prod === false) {
19
- $_productCollection->removeItemByKey($_product->getId());
20
- }
21
- }
22
-
23
- self::$_productCollection = $_productCollection;
24
-
25
- return $_productCollection;
26
- }
27
- }
28
-
29
- public function getTotalNum()
30
- {
31
- if (self::$_productCollection === null) {
32
- return parent::getTotalNum();
33
- }
34
- self::$_totalRecords = count(self::$_productCollection->getItems());
35
- return intval(self::$_totalRecords);
36
- }
37
-
38
- public function CheckIcecatData($_product)
39
- {
40
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
41
- $mpn = Mage::getModel('catalog/product')->load($_product->getId())->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
42
- $ean = Mage::getModel('catalog/product')->load($_product->getId())->getData(Mage::getStoreConfig('icecat_root/icecat/ean_code'));
43
- $tableName = Mage::getSingleton('core/resource')->getTableName('icecatlive/data_products');
44
- if(!empty($mpn)){
45
- $selectCondition = $connection->select()
46
- ->from(array('connector' => $tableName), new Zend_Db_Expr('connector.prod_title'))
47
- ->where('connector.prod_id = ? ', $mpn);
48
- $icecatName = $connection->fetchOne($selectCondition);
49
- }
50
- if(empty($icecatName) && !empty($ean)){
51
- $selectCondition = $connection->select()
52
- ->from(array('connector' => $tableName), new Zend_Db_Expr('connector.prod_title'))
53
- ->where('connector.prod_ean = ? ', $ean);
54
- $icecatName = $connection->fetchOne($selectCondition);
55
- }
56
- if (!empty($icecatName)) {
57
- return true;
58
- } else {
59
- $tableName = Mage::getSingleton('core/resource')->getTableName('icecatlive/data');
60
- $mappingTable = Mage::getSingleton('core/resource')->getTableName('icecatlive/supplier_mapping');
61
- $manufacturer = Mage::getModel('catalog/product')->load($_product->getId())->getData(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
62
- if (isset($manufacturer) && !empty($manufacturer)) {
63
- $selectCondition = $connection->select()
64
- ->from(array('connector' => $tableName), new Zend_Db_Expr('connector.prod_img'))
65
- ->joinInner(array('supplier' => $mappingTable), "connector.supplier_id = supplier.supplier_id AND supplier.supplier_symbol = {$connection->quote($manufacturer)}")
66
- ->where('connector.prod_id = ?', $mpn);
67
- $imageURL = $connection->fetchOne($selectCondition);
68
- }
69
- if (empty($imageURL) && !empty($ean)) {
70
- $selectCondition = $connection->select()
71
- ->from(array('connector' => $tableName), new Zend_Db_Expr('connector.prod_img'))
72
- ->joinLeft(array('products' => $tableName . '_products'), "connector.prod_id = products.prod_id")
73
- ->where('products.prod_ean = ?', trim($ean));
74
- $imageURL = $connection->fetchOne($selectCondition);
75
- }
76
-
77
- $icecat_prod = !empty($imageURL) ? true : false;
78
- return $icecat_prod;
79
- }
80
- }
81
-
82
- }
83
-
84
- ?>
1
+ <?php
2
+
3
+ class Iceshop_Icecatlive_Block_Product_List_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar
4
+ {
5
+ public static $_productCollection = null;
6
+ public static $_totalRecords = null;
7
+
8
+ public function getCollection()
9
+ {
10
+
11
+ $ProductPriority = Mage::getStoreConfig('icecat_root/icecat/product_priority');
12
+ $_productCollection = parent::getCollection();
13
+
14
+
15
+ if (!$_productCollection->count() || $ProductPriority == 'Show') {
16
+ return $_productCollection;
17
+ } else {
18
+ foreach ($_productCollection as $_product) {
19
+ $icecat_prod = $this->CheckIcecatData($_product);
20
+ if ($icecat_prod === false) {
21
+ $_productCollection->removeItemByKey($_product->getId());
22
+ }
23
+ }
24
+
25
+ self::$_productCollection = $_productCollection;
26
+
27
+ return $_productCollection;
28
+ }
29
+ }
30
+
31
+ public function getTotalNum()
32
+ {
33
+ if (self::$_productCollection === null) {
34
+ return parent::getTotalNum();
35
+ }
36
+ self::$_totalRecords = count(self::$_productCollection->getItems());
37
+ return intval(self::$_totalRecords);
38
+ }
39
+
40
+ public function CheckIcecatData($_product)
41
+ {
42
+ $tablePrefix = '';
43
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
44
+ if (!empty($tPrefix)) {
45
+ $tablePrefix = $tPrefix[0];
46
+ }
47
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
48
+ $query = "SELECT `entity_id` FROM `" . $tablePrefix . "catalog_product_entity` LEFT JOIN `"
49
+ . $tablePrefix . "iceshop_icecatlive_products_titles` ON entity_id = prod_id WHERE prod_id IS NOT NULL";
50
+ $entity_id = $db_res->fetchAll($query);
51
+ return in_array(array('entity_id' => $_product->getID()), $entity_id);
52
+
53
+ }
54
+
55
+ }
56
+
57
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Iceshop/Icecatlive/Block/Related.php CHANGED
@@ -1,58 +1,58 @@
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_Catalog
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
-
28
- /**
29
- * Catalog product related items block
30
- *
31
- * @category Mage
32
- * @package Mage_Catalog
33
- * @author Magento Core Team <core@magentocommerce.com>
34
- */
35
- class Iceshop_Icecatlive_Block_Related extends Mage_Catalog_Block_Product_List_Related
36
- {
37
- protected function _prepareData()
38
- {
39
- $product = Mage::registry('product');
40
- $helper = Mage::helper('icecatlive/getdata');
41
- $relatedProducts = $helper->getRelatedProducts();
42
- if (!$relatedProducts) {
43
- return parent::_prepareData();
44
- }
45
-
46
- $tmp = Mage::getSingleton('Iceshop_Icecatlive_Model_Relatedcollection', $relatedProducts);
47
- $tmp = $tmp->getCollection();
48
- $this->_itemCollection = $tmp;
49
- $this->_addProductAttributesAndPrices($this->_itemCollection);
50
- Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_itemCollection);
51
- $this->_itemCollection->load();
52
- foreach ($this->_itemCollection as $product) {
53
- $product->setDoNotUseCategoryId(true);
54
- }
55
- return $this;
56
- }
57
-
58
- }
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_Catalog
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Catalog product related items block
30
+ *
31
+ * @category Mage
32
+ * @package Mage_Catalog
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Iceshop_Icecatlive_Block_Related extends Mage_Catalog_Block_Product_List_Related
36
+ {
37
+ protected function _prepareData()
38
+ {
39
+ $product = Mage::registry('product');
40
+ $helper = Mage::helper('icecatlive/getdata');
41
+ $relatedProducts = $helper->getRelatedProducts();
42
+ if (!$relatedProducts) {
43
+ return parent::_prepareData();
44
+ }
45
+
46
+ $tmp = Mage::getSingleton('Iceshop_Icecatlive_Model_Relatedcollection', $relatedProducts);
47
+ $tmp = $tmp->getCollection();
48
+ $this->_itemCollection = $tmp;
49
+ $this->_addProductAttributesAndPrices($this->_itemCollection);
50
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_itemCollection);
51
+ $this->_itemCollection->load();
52
+ foreach ($this->_itemCollection as $product) {
53
+ $product->setDoNotUseCategoryId(true);
54
+ }
55
+ return $this;
56
+ }
57
+
58
+ }
app/code/local/Iceshop/Icecatlive/Block/Upsell.php CHANGED
@@ -1,50 +1,50 @@
1
- <?php
2
- class Iceshop_Icecatlive_Block_Upsell extends Mage_Catalog_Block_Product_List_Upsell
3
- {
4
-
5
- protected function _prepareData()
6
- {
7
- $product = Mage::registry('product');
8
- /* @var $product Mage_Catalog_Model_Product */
9
- $this->_itemCollection = $product->getUpSellProductCollection()
10
- ->addAttributeToSort('position', 'asc')
11
- ->addStoreFilter();
12
- $skuField = Mage::getStoreConfig('icecat_root/icecat/sku_field');
13
- $this->_itemCollection->addAttributeToSelect($skuField);
14
-
15
- $manufacturerId = Mage::getStoreConfig('icecat_root/icecat/manufacturer');
16
- $this->_itemCollection->addAttributeToSelect($manufacturerId);
17
-
18
- Mage::getResourceSingleton('checkout/cart')->addExcludeProductFilter($this->_itemCollection,
19
- Mage::getSingleton('checkout/session')->getQuoteId()
20
- );
21
-
22
-
23
- $this->_addProductAttributesAndPrices($this->_itemCollection);
24
-
25
- // Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($this->_itemCollection);
26
- Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_itemCollection);
27
-
28
- if ($this->getItemLimit('upsell') > 0) {
29
- $this->_itemCollection->setPageSize($this->getItemLimit('upsell'));
30
- }
31
-
32
- $this->_itemCollection->load();
33
- /**
34
- * Updating collection with desired items
35
- */
36
- Mage::dispatchEvent('catalog_product_upsell', array(
37
- 'product' => $product,
38
- 'collection' => $this->_itemCollection,
39
- 'limit' => $this->getItemLimit()
40
- ));
41
-
42
- foreach ($this->_itemCollection as $product) {
43
- $product->setDoNotUseCategoryId(true);
44
- }
45
-
46
- return $this;
47
- }
48
-
49
-
50
- }
1
+ <?php
2
+ class Iceshop_Icecatlive_Block_Upsell extends Mage_Catalog_Block_Product_List_Upsell
3
+ {
4
+
5
+ protected function _prepareData()
6
+ {
7
+ $product = Mage::registry('product');
8
+ /* @var $product Mage_Catalog_Model_Product */
9
+ $this->_itemCollection = $product->getUpSellProductCollection()
10
+ ->addAttributeToSort('position', 'asc')
11
+ ->addStoreFilter();
12
+ $skuField = Mage::getStoreConfig('icecat_root/icecat/sku_field');
13
+ $this->_itemCollection->addAttributeToSelect($skuField);
14
+
15
+ $manufacturerId = Mage::getStoreConfig('icecat_root/icecat/manufacturer');
16
+ $this->_itemCollection->addAttributeToSelect($manufacturerId);
17
+
18
+ Mage::getResourceSingleton('checkout/cart')->addExcludeProductFilter($this->_itemCollection,
19
+ Mage::getSingleton('checkout/session')->getQuoteId()
20
+ );
21
+
22
+
23
+ $this->_addProductAttributesAndPrices($this->_itemCollection);
24
+
25
+ // Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($this->_itemCollection);
26
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_itemCollection);
27
+
28
+ if ($this->getItemLimit('upsell') > 0) {
29
+ $this->_itemCollection->setPageSize($this->getItemLimit('upsell'));
30
+ }
31
+
32
+ $this->_itemCollection->load();
33
+ /**
34
+ * Updating collection with desired items
35
+ */
36
+ Mage::dispatchEvent('catalog_product_upsell', array(
37
+ 'product' => $product,
38
+ 'collection' => $this->_itemCollection,
39
+ 'limit' => $this->getItemLimit()
40
+ ));
41
+
42
+ foreach ($this->_itemCollection as $product) {
43
+ $product->setDoNotUseCategoryId(true);
44
+ }
45
+
46
+ return $this;
47
+ }
48
+
49
+
50
+ }
app/code/local/Iceshop/Icecatlive/CatalogSearch/Block/Result.php CHANGED
@@ -1,34 +1,33 @@
1
- <?php
2
- class Iceshop_Icecatlive_CatalogSearch_Block_Result extends Mage_CatalogSearch_Block_Result
3
- {
4
-
5
- /**
6
- * Retrieve search result count
7
- *
8
- * @return string
9
- */
10
- public function getResultCount()
11
- {
12
- $ProductPriority = Mage::getStoreConfig('icecat_root/icecat/product_priority');
13
-
14
- if ($ProductPriority == 'Show') {
15
- return parent::getResultCount();
16
- }
17
-
18
- $products = $this->_getProductCollection();
19
- $toolbar = new Iceshop_Icecatlive_Block_Product_List_Toolbar();
20
- foreach ($products as $_product) {
21
- $icecat_prod = $toolbar->CheckIcecatData($_product);
22
- if ($icecat_prod === false) {
23
- $products->removeItemByKey($_product->getId());
24
- }
25
- }
26
- $size = count($products->getItems());
27
- $this->_getQuery()->setNumResults($size);
28
- $this->setResultCount($size);
29
- return $this->getData('result_count');
30
- }
31
-
32
- }
33
-
34
- ?>
1
+ <?php
2
+ class Iceshop_Icecatlive_CatalogSearch_Block_Result extends Mage_CatalogSearch_Block_Result
3
+ {
4
+ /**
5
+ * Retrieve search result count
6
+ *
7
+ * @return string
8
+ */
9
+ public function getResultCount()
10
+ {
11
+
12
+ $ProductPriority = Mage::getStoreConfig('icecat_root/icecat/product_priority');
13
+ if ($ProductPriority == 'Show') {
14
+ return parent::getResultCount();
15
+ }
16
+
17
+ $products = $this->_getProductCollection();
18
+ $toolbar = new Iceshop_Icecatlive_Block_Product_List_Toolbar();
19
+ foreach ($products as $_product) {
20
+ $icecat_prod = $toolbar->CheckIcecatData($_product);
21
+ if ($icecat_prod === false) {
22
+ $products->removeItemByKey($_product->getId());
23
+ }
24
+ }
25
+ $size = count($products->getItems());
26
+ $this->_getQuery()->setNumResults($size);
27
+ $this->setResultCount($size);
28
+ return $this->getData('result_count');
29
+ }
30
+
31
+ }
32
+
33
+ ?>
 
app/code/local/Iceshop/Icecatlive/Helper/Catalog/Image.php DELETED
@@ -1,58 +0,0 @@
1
- <?php
2
- /**
3
- * Overloaded catalog helper to substitute magento images
4
- *
5
- */
6
- class Iceshop_Icecatlive_Helper_Catalog_Image extends Mage_Catalog_Helper_Image
7
- {
8
-
9
- /**
10
- * Overriden method provides product with images from icecatlive data table
11
- * @param $product Mage_Catalog_Model_Product
12
- * @param $attributeName string
13
- * @param $imageFile string
14
- */
15
- public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile = null)
16
- {
17
-
18
- $current_page = Mage::app()->getFrontController()->getRequest()->getControllerName();
19
- $url = Mage::helper('core/url')->getCurrentUrl();
20
- $is_gallery = (int)strpos($url, 'catalog/product/gallery');
21
- $Imagepriority = Mage::getStoreConfig('icecat_root/icecat/image_priority');
22
- if ($Imagepriority == 'Db' || (($attributeName == 'thumbnail' && !empty($imageFile)
23
- && $current_page == 'product') || ($is_gallery > 0))
24
- ) {
25
- return parent::init($product, $attributeName, $imageFile);
26
- }
27
-
28
- if ($attributeName == 'image' && $imageFile == null) {
29
- $imageFile = mage::getsingleton('icecatlive/import')->getLowPicUrl();
30
-
31
- } else if ($attributeName == 'thumbnail' && $imageFile == null) {
32
- $imageFile = Mage::helper('icecatlive/image')->getImage($product);
33
-
34
- } else if ($attributeName == 'small_image' && $imageFile == null) {
35
- $imageFile = Mage::helper('icecatlive/image')->getImage($product);
36
- }
37
-
38
- return parent::init($product, $attributeName, $imageFile);
39
- }
40
-
41
- /**
42
- * Return icecat image URL if set
43
- */
44
-
45
- public function __toString()
46
- {
47
- $url = parent::__toString();
48
-
49
- if ($this->getImageFile() && strpos($this->getImageFile(), 'icecat.biz') && strpos($url, 'placeholder')) {
50
- $url = $this->getImageFile();
51
- }
52
-
53
- return $url;
54
- }
55
-
56
- }
57
-
58
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Iceshop/Icecatlive/Helper/Data.php CHANGED
@@ -1,4 +1,81 @@
1
  <?php
2
  class Iceshop_Icecatlive_Helper_Data extends Mage_Core_Helper_Abstract
3
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
1
  <?php
2
  class Iceshop_Icecatlive_Helper_Data extends Mage_Core_Helper_Abstract
3
  {
4
+
5
+ protected function _getButtonSettings($settings)
6
+ {
7
+ $default_settings = array(
8
+ 'getBeforeHtml' => '',
9
+ 'getId' => '',
10
+ 'getElementName' => '',
11
+ 'getTitle' => '',
12
+ 'getType' => '',
13
+ 'getClass' => '',
14
+ 'getOnClick' => '',
15
+ 'getStyle' => '',
16
+ 'getValue' => '',
17
+ 'getDisabled' => '',
18
+ 'getLabel' => '',
19
+ 'getAfterHtml' => ''
20
+ );
21
+ if (!empty($settings) && is_array($settings)) {
22
+ foreach ($settings as $key => $setting) {
23
+ $camel_key = str_replace(' ', '', ucwords(str_replace('_', ' ', $key)));
24
+ $default_settings['get' . $camel_key] = $setting;
25
+ }
26
+ }
27
+ return $default_settings;
28
+ }
29
+
30
+ /**
31
+ * @param $settings
32
+ * @return string
33
+ */
34
+ public function getButtonHtml($settings)
35
+ {
36
+ $settings = $this->_getButtonSettings($settings);
37
+ $html = $settings['getBeforeHtml'] . '<button '
38
+ . ($settings['getId'] ? ' id="' . $settings['getId'] . '"' : '')
39
+ . ($settings['getElementName'] ? ' name="' . $settings['getElementName'] . '"' : '')
40
+ . ' title="'
41
+ . htmlspecialchars($settings['getTitle'] ? $settings['getTitle'] : $settings['getLabel'], ENT_QUOTES, null, false)
42
+ . '"'
43
+ . ' type="' . $settings['getType'] . '"'
44
+ . ' class="scalable ' . $settings['getClass'] . ($settings['getDisabled'] ? ' disabled' : '') . '"'
45
+ . ' onclick="' . $settings['getOnClick'] . '"'
46
+ . ' style="' . $settings['getStyle'] . '"'
47
+ . ($settings['getValue'] ? ' value="' . $settings['getValue'] . '"' : '')
48
+ . ($settings['getDisabled'] ? ' disabled="disabled"' : '')
49
+ . '><span><span><span>' . $settings['getLabel'] . '</span></span></span></button>' . $settings['getAfterHtml'];
50
+
51
+ return $html;
52
+ }
53
+
54
+ /**
55
+ * Sorts a multi-dimensional array with the given values
56
+ *
57
+ * Seen and modified from: http://www.firsttube.com/read/sorting-a-multi-dimensional-array-with-php/
58
+ *
59
+ * @param array $arr Array to sort
60
+ * @param string $key Field to sort
61
+ * @param string $dir Direction to sort
62
+ * @return array Sorted array
63
+ */
64
+ public function sortMultiDimArr($arr, $key, $dir='ASC')
65
+ {
66
+ foreach ($arr as $k => $v) {
67
+ $b[$k] = strtolower($v[$key]);
68
+ }
69
+
70
+ if ($dir == 'ASC') {
71
+ asort($b);
72
+ } else {
73
+ arsort($b);
74
+ }
75
+ foreach ($b as $key => $val) {
76
+ $c[] = $arr[$key];
77
+ }
78
+
79
+ return $c;
80
+ }
81
  }
app/code/local/Iceshop/Icecatlive/Helper/Db.php ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Iceshop_Iceimport_Helper_Db
5
+ */
6
+ class Iceshop_Icecatlive_Helper_Db extends Mage_Core_Helper_Abstract {
7
+
8
+ /**
9
+ * @var object
10
+ */
11
+ private $_resource;
12
+
13
+ /**
14
+ * @var object
15
+ */
16
+ private $_reader;
17
+
18
+ /**
19
+ * @var object
20
+ */
21
+ private $_writer;
22
+
23
+ /**
24
+ * @var string
25
+ */
26
+ public $_prefix = '';
27
+
28
+ /**
29
+ *
30
+ */
31
+ public function __construct()
32
+ {
33
+ try {
34
+ $this->_resource = Mage::getSingleton('core/resource');
35
+ $this->_writer = $this->_resource->getConnection('core_write');
36
+ $this->_reader = $this->_resource->getConnection('core_read');
37
+ $prefix = Mage::getConfig()->getTablePrefix();
38
+ if (!empty($prefix[0])) {
39
+ $this->_prefix = $prefix[0];
40
+ }
41
+ return true;
42
+ } catch(Exception $e) {
43
+ return false;
44
+ }
45
+ return false;
46
+ }
47
+
48
+ /**
49
+ * @param $table_name
50
+ * @param bool|array $conditions
51
+ * @return mixed
52
+ */
53
+ public function getRowsCount($table_name, $conditions = false)
54
+ {
55
+ $sql = "SELECT COUNT(*) AS `row_count` FROM `{$table_name}`";
56
+ if (!empty($conditions) && is_array($conditions)) {
57
+ $sql .= ' WHERE ';
58
+ foreach ($conditions as $key => $condition) {
59
+ if (is_array($condition)) {
60
+ if ($key > 0) {
61
+ $sql .= ' ' . $condition['conjunction'] . ' ';
62
+ }
63
+ $sql .= $condition['field'] . ' ' . $condition['comparison'] . ' ';
64
+ switch ($condition['value_type']) {
65
+ case 'num':
66
+ $sql .= $condition['value'];
67
+ break;
68
+ case 'str':
69
+ $sql .= '\'' . $condition['value'] . '\'';
70
+ break;
71
+ }
72
+ } elseif (is_string($condition)) {
73
+ $sql .= $condition;
74
+ }
75
+ }
76
+
77
+ } elseif (!empty($conditions) && is_string($conditions)) {
78
+ $sql .= $conditions;
79
+ }
80
+ $result = $this->_reader->fetchAll($sql);
81
+ $result = array_shift($result);
82
+ return $result['row_count'];
83
+ }
84
+
85
+ /**
86
+ * @param $table_name
87
+ * @param $field_name
88
+ * @param bool|string $before_group
89
+ * @param bool|string $after_group
90
+ * @return mixed
91
+ */
92
+ public function getRowCountByField($table_name, $field_name, $before_group = false, $after_group = false)
93
+ {
94
+ $approved_before_group = '';
95
+ if ($before_group != false && is_string($before_group)) {
96
+ $approved_before_group = $before_group;
97
+ }
98
+ $approved_after_group = '';
99
+ if ($after_group != false && is_string($after_group)) {
100
+ $approved_after_group = $after_group;
101
+ }
102
+ // select is_default, count(is_default) from icecat_products_images group by is_default;
103
+ $sql = "SELECT `{$field_name}`, COUNT(`{$field_name}`) as `row_count` FROM `{$table_name}`{$approved_before_group} GROUP BY `{$field_name}`{$approved_after_group}";
104
+ $result = $this->_reader->fetchAll($sql);
105
+ return $result;
106
+ }
107
+
108
+ /**
109
+ * @param $table_name
110
+ * @param $field_name
111
+ * @return bool
112
+ */
113
+ public function checkIsFieldExists($table_name, $field_name)
114
+ {
115
+ if (!$this->_checkProcedureExists('FIELD_EXISTS')) {
116
+ //recreate the procedure FIELD_EXISTS
117
+ $this->_recreateFieldExistsProcedure();
118
+ }
119
+ $sql = "CALL FIELD_EXISTS(@_exists, '{$this->_prefix}{$table_name}', '{$field_name}', NULL);";
120
+ $this->_reader->query($sql);
121
+
122
+ $sql = "SELECT @_exists;";
123
+ $res = $this->_reader->fetchCol($sql);
124
+ if (!array_shift($res)) {
125
+ //field exists
126
+ return false;
127
+ }
128
+ return true;
129
+ }
130
+
131
+ private function _checkProcedureExists($procedure_name)
132
+ {
133
+ $sql = "SET @_exists = (SELECT COUNT(ROUTINE_NAME) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE' AND ROUTINE_SCHEMA = database() AND ROUTINE_NAME = '{$procedure_name}')";
134
+ $this->_reader->query($sql);
135
+
136
+ $sql = "SELECT @_exists;";
137
+ $res = $this->_reader->fetchCol($sql);
138
+ $res = array_shift($res);
139
+ if ($res > 0) {
140
+ //field exists
141
+ return true;
142
+ }
143
+ return false;
144
+ }
145
+
146
+ private function _recreateFieldExistsProcedure()
147
+ {
148
+ $sql = "CREATE PROCEDURE FIELD_EXISTS(
149
+ OUT _exists BOOLEAN, -- return value
150
+ IN tableName CHAR(255), -- name of table to look for
151
+ IN columnName CHAR(255), -- name of column to look for
152
+ IN dbName CHAR(255) -- optional specific db
153
+ ) BEGIN
154
+ -- try to lookup db if none provided
155
+ SET @_dbName := IF(dbName IS NULL, database(), dbName);
156
+
157
+ IF CHAR_LENGTH(@_dbName) = 0
158
+ THEN -- no specific or current db to check against
159
+ SELECT
160
+ FALSE
161
+ INTO _exists;
162
+ ELSE -- we have a db to work with
163
+ SELECT
164
+ IF(count(*) > 0, TRUE, FALSE)
165
+ INTO _exists
166
+ FROM information_schema.COLUMNS c
167
+ WHERE
168
+ c.TABLE_SCHEMA = @_dbName
169
+ AND c.TABLE_NAME = tableName
170
+ AND c.COLUMN_NAME = columnName;
171
+ END IF;
172
+ END;";
173
+ $this->_writer->query($sql);
174
+ }
175
+
176
+ /**
177
+ * @param $sql
178
+ * @return bool
179
+ */
180
+ public function readQuery($sql)
181
+ {
182
+ if (!empty($sql) && is_string($sql)) {
183
+ return $this->_reader->fetchAll($sql);
184
+ }
185
+ return false;
186
+ }
187
+ public function insetrtUpdateLogValue($key, $value)
188
+ {
189
+ if (!empty($key)) {
190
+ return $this->_writer->query('INSERT INTO `' . $this->_prefix . $productsIdTable = Mage::getConfig()->getNode('default/icecatlive/extensions_logs_tables')->table_name . '` (log_key, log_value)
191
+ VALUES ("'.$key.'", "'.$value.'")
192
+ ON DUPLICATE KEY UPDATE log_value = VALUES(log_value)
193
+ ');
194
+ }
195
+ return false;
196
+ }
197
+
198
+ public function getLogValue($key)
199
+ {
200
+ if (!empty($key)) {
201
+ $sql = "SELECT log_value FROM `" . $this->_prefix . $productsIdTable = Mage::getConfig()->getNode('default/icecatlive/extensions_logs_tables')->table_name . "` WHERE log_key = '".$key."'";
202
+ $value = $this->_reader->fetchAll($sql);
203
+ return $value[0]['log_value'];
204
+ }
205
+ return false;
206
+ }
207
+ public function deleteLogKey($key)
208
+ {
209
+ if (!empty($key)) {
210
+ return $this->_writer->query('DELETE FROM `' . $this->_prefix . $productsIdTable = Mage::getConfig()->getNode('default/icecatlive/extensions_logs_tables')->table_name . '` WHERE log_key = "'.$key.'"');
211
+ }
212
+ return false;
213
+ }
214
+ public function getTableName($table_name)
215
+ {
216
+ if (!empty($table_name) && is_string($table_name)) {
217
+ return $this->_resource->getTableName($table_name);
218
+ }
219
+ return false;
220
+ }
221
+ }
app/code/local/Iceshop/Icecatlive/Helper/Format.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /******************************************************************************
3
+ * Copyright (c) 2010 Jevon Wright and others.
4
+ * All rights reserved. This program and the accompanying materials
5
+ * are made available under the terms of the Eclipse Public License v1.0
6
+ * which accompanies this distribution, and is available at
7
+ * http://www.eclipse.org/legal/epl-v10.html
8
+ *
9
+ * Contributors:
10
+ * Jevon Wright - initial API and implementation
11
+ ****************************************************************************/
12
+
13
+ /**
14
+ * Tries to convert the given HTML into a plain text format - best suited for
15
+ * e-mail display, etc.
16
+ *
17
+ * <p>In particular, it tries to maintain the following features:
18
+ * <ul>
19
+ * <li>Links are maintained, with the 'href' copied over
20
+ * <li>Information in the &lt;head&gt; is lost
21
+ * </ul>
22
+ *
23
+ * @param html the input HTML
24
+ * @return the HTML converted, as best as possible, to text
25
+ */
26
+
27
+ class Iceshop_Icecatlive_Helper_Format extends Mage_Core_Helper_Abstract
28
+ {
29
+ /**
30
+ * @param $html
31
+ * @return mixed|string
32
+ */
33
+ public function convert_html_to_text($html)
34
+ {
35
+ $html = $this->fix_newlines($html);
36
+
37
+ $doc = new DOMDocument();
38
+ if (!$doc->loadHTML($html))
39
+ return "Could not load HTML - badly formed?";
40
+
41
+ $output = $this->iterate_over_node($doc);
42
+
43
+ // remove leading and trailing spaces on each line
44
+ $output = preg_replace("/[ \t]*\n[ \t]*/im", "\n", $output);
45
+
46
+ // remove leading and trailing whitespace
47
+ $output = trim($output);
48
+
49
+ return $output;
50
+ }
51
+
52
+ /**
53
+ * Unify newlines; in particular, \r\n becomes \n, and
54
+ * then \r becomes \n. This means that all newlines (Unix, Windows, Mac)
55
+ * all become \ns.
56
+ *
57
+ * @param text text with any number of \r, \r\n and \n combinations
58
+ * @return the fixed text
59
+ */
60
+ private function fix_newlines($text)
61
+ {
62
+ // replace \r\n to \n
63
+ $text = str_replace("\r\n", "\n", $text);
64
+ // remove \rs
65
+ $text = str_replace("\r", "\n", $text);
66
+
67
+ return $text;
68
+ }
69
+
70
+ /**
71
+ * @param $node
72
+ * @return null|string
73
+ */
74
+ private function next_child_name($node)
75
+ {
76
+ // get the next child
77
+ $nextNode = $node->nextSibling;
78
+ while ($nextNode != null) {
79
+ if ($nextNode instanceof DOMElement) {
80
+ break;
81
+ }
82
+ $nextNode = $nextNode->nextSibling;
83
+ }
84
+ $nextName = null;
85
+ if ($nextNode instanceof DOMElement && $nextNode != null) {
86
+ $nextName = strtolower($nextNode->nodeName);
87
+ }
88
+
89
+ return $nextName;
90
+ }
91
+
92
+ /**
93
+ * @param $node
94
+ * @return null|string
95
+ */
96
+ private function prev_child_name($node)
97
+ {
98
+ // get the previous child
99
+ $nextNode = $node->previousSibling;
100
+ while ($nextNode != null) {
101
+ if ($nextNode instanceof DOMElement) {
102
+ break;
103
+ }
104
+ $nextNode = $nextNode->previousSibling;
105
+ }
106
+ $nextName = null;
107
+ if ($nextNode instanceof DOMElement && $nextNode != null) {
108
+ $nextName = strtolower($nextNode->nodeName);
109
+ }
110
+
111
+ return $nextName;
112
+ }
113
+
114
+ /**
115
+ * @param $node
116
+ * @return mixed|string
117
+ */
118
+ private function iterate_over_node($node)
119
+ {
120
+ if ($node instanceof DOMText) {
121
+ return preg_replace("/\\s+/im", " ", $node->wholeText);
122
+ }
123
+ if ($node instanceof DOMDocumentType) {
124
+ // ignore
125
+ return "";
126
+ }
127
+
128
+ $nextName = $this->next_child_name($node);
129
+ $prevName = $this->prev_child_name($node);
130
+
131
+ $name = strtolower($node->nodeName);
132
+
133
+ // start whitespace
134
+ switch ($name) {
135
+ case "hr":
136
+ return "------\n";
137
+
138
+ case "style":
139
+ case "head":
140
+ case "title":
141
+ case "meta":
142
+ case "script":
143
+ // ignore these tags
144
+ return "";
145
+
146
+ case "h1":
147
+ case "h2":
148
+ case "h3":
149
+ case "h4":
150
+ case "h5":
151
+ case "h6":
152
+ // add two newlines
153
+ $output = "\n";
154
+ break;
155
+
156
+ case "p":
157
+ case "div":
158
+ // add one line
159
+ $output = "\n";
160
+ break;
161
+
162
+ default:
163
+ // print out contents of unknown tags
164
+ $output = "";
165
+ break;
166
+ }
167
+
168
+ // debug
169
+ //$output .= "[$name,$nextName]";
170
+
171
+ for ($i = 0; $i < $node->childNodes->length; $i++) {
172
+ $n = $node->childNodes->item($i);
173
+
174
+ $text = $this->iterate_over_node($n);
175
+
176
+ $output .= $text;
177
+ }
178
+
179
+ // end whitespace
180
+ switch ($name) {
181
+ case "style":
182
+ case "head":
183
+ case "title":
184
+ case "meta":
185
+ case "script":
186
+ // ignore these tags
187
+ return "";
188
+
189
+ case "tr":
190
+ case "h1":
191
+ case "h2":
192
+ case "h3":
193
+ case "h4":
194
+ case "h5":
195
+ case "h6":
196
+ $output .= "\n";
197
+ break;
198
+
199
+ case "td":
200
+ $output .= "\t";
201
+ break;
202
+
203
+ case "p":
204
+ case "br":
205
+ // add one line
206
+ if ($nextName != "div")
207
+ $output .= "\n";
208
+ break;
209
+
210
+ case "div":
211
+ // add one line only if the next child isn't a div
212
+ if ($nextName != "div" && $nextName != null)
213
+ $output .= "\n";
214
+ break;
215
+
216
+ case "a":
217
+ // links are returned in [text](link) format
218
+ $href = $node->getAttribute("href");
219
+ if ($href == null) {
220
+ // it doesn't link anywhere
221
+ if ($node->getAttribute("name") != null) {
222
+ $output = "[$output]";
223
+ }
224
+ } else {
225
+ if ($href == $output) {
226
+ // link to the same address: just use link
227
+ $output;
228
+ } else {
229
+ // replace it
230
+ $output = "[$output]($href)";
231
+ }
232
+ }
233
+
234
+ // does the next node require additional whitespace?
235
+ switch ($nextName) {
236
+ case "h1":
237
+ case "h2":
238
+ case "h3":
239
+ case "h4":
240
+ case "h5":
241
+ case "h6":
242
+ $output .= "\n";
243
+ break;
244
+ }
245
+
246
+ default:
247
+ // do nothing
248
+ }
249
+
250
+ return $output;
251
+ }
252
+ }
app/code/local/Iceshop/Icecatlive/Helper/Getdata.php CHANGED
@@ -1,211 +1,211 @@
1
- <?php
2
- /**
3
- *
4
- * Class achieves icecat description from Model by recieved SKU and manufacturer
5
- *
6
- */
7
- class Iceshop_Icecatlive_Helper_Getdata extends Mage_Core_Helper_Abstract
8
- {
9
- private $iceCatModel;
10
- private $error;
11
- private $systemError;
12
-
13
- /**
14
- * Gets product Data and delegates it to Model
15
- * @param Mage_Catalog_Model_Product $_product
16
- * @return Iceshop_Icecatlive_Helper_Getdata
17
- */
18
-
19
- public function getEntityTypeId()
20
- {
21
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
22
- $query = $connection->select()
23
- ->from(Mage::getSingleton('core/resource')
24
- ->getTableName('eav_entity_type'), 'entity_type_id')
25
- ->where('entity_type_code = ?', 'catalog_product')
26
- ->limit(1);
27
- $this->entityTypeId = $connection->fetchOne($query);
28
- return $this->entityTypeId;
29
- }
30
-
31
- public function getProductDescription($_product)
32
- {
33
- try {
34
- $entityId = $_product->getEntityId();
35
- $entity_type_id = $this->getEntityTypeId();
36
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
37
- $mpn = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
38
- $ean_code = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/ean_code'));
39
- $manufacturerId = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
40
- $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
41
- ->setCodeFilter(Mage::getStoreConfig('icecat_root/icecat/manufacturer'))
42
- ->setEntityTypeFilter($entity_type_id)
43
- ->getFirstItem();
44
- if ($attributeInfo->getData('backend_type') == 'int' ||
45
- ($attributeInfo->getData('frontend_input') == 'select' && $attributeInfo->getData('backend_type') == 'static')
46
- ) {
47
- $attribute = $attributeInfo->setEntity($_product->getResource());
48
- $manufacturer = $attribute->getSource()->getOptionText($manufacturerId);
49
- } else {
50
- $manufacturer = $manufacturerId;
51
- }
52
-
53
- $locale = Mage::getStoreConfig('icecat_root/icecat/language');
54
- if ($locale == '0') {
55
- $systemLocale = explode("_", Mage::app()->getLocale()->getLocaleCode());
56
- $locale = $systemLocale[0];
57
- }
58
- $userLogin = Mage::getStoreConfig('icecat_root/icecat/login');
59
- $userPass = Mage::getStoreConfig('icecat_root/icecat/password');
60
- $this->iceCatModel = Mage::getSingleton('icecatlive/import');
61
- if (!$this->iceCatModel->getProductDescription($mpn, $manufacturer, $locale, $userLogin, $userPass, $entityId, $ean_code)) {
62
- $this->error = $this->iceCatModel->getErrorMessage();
63
- $this->systemError = $this->iceCatModel->getSystemError();
64
- return $this;
65
- }
66
- } catch (Exception $e) {
67
- Mage::log('Icecat getProductDescription error' . $e);
68
- }
69
- return $this;
70
- }
71
-
72
- /**
73
- * returns true if error during data fetch occured else false
74
- */
75
- public function hasError()
76
- {
77
- if ($this->error || $this->systemError) {
78
- return true;
79
- }
80
- return false;
81
- }
82
-
83
- /**
84
- * return error message
85
- */
86
- public function getError()
87
- {
88
- }
89
-
90
- /**
91
- * return system error
92
- */
93
- public function hasSystemError()
94
- {
95
- if ($this->systemError) {
96
- return $this->systemError;
97
- }
98
- return false;
99
- }
100
-
101
- public function getProductDescriptionList()
102
- {
103
- return $this->iceCatModel->getProductDescriptionList();
104
- }
105
-
106
- public function getShortProductDescription()
107
- {
108
- return $this->iceCatModel->getShortProductDescription();
109
- }
110
-
111
- public function getLowPicUrl()
112
- {
113
- return $this->iceCatModel->getLowPicUrl();
114
- }
115
-
116
- public function getThumbPicture()
117
- {
118
- return $this->iceCatModel->getThumbPicture();
119
- }
120
-
121
- public function getGalleryPhotos()
122
- {
123
- return $this->iceCatModel->getGalleryPhotos();
124
- }
125
-
126
- public function getProductName()
127
- {
128
- return $this->iceCatModel->getProductName();
129
- }
130
-
131
- public function getVendor()
132
- {
133
- return $this->iceCatModel->getVendor();
134
- }
135
-
136
- public function getFullProductDescription()
137
- {
138
- return $this->iceCatModel->getFullProductDescription();
139
- }
140
-
141
- public function getMPN()
142
- {
143
- return $this->iceCatModel->getMPN();
144
- }
145
-
146
- public function getEAN()
147
- {
148
- return $this->iceCatModel->getEAN();
149
- }
150
-
151
- /**
152
- * Form related products list according to store products
153
- */
154
- public function getRelatedProducts()
155
- {
156
- if (!$this->iceCatModel) {
157
- $this->iceCatModel = Mage::getSingleton('icecatlive/import');
158
- }
159
- $relatedProducts = $this->iceCatModel->getRelatedProducts();
160
- if (empty($relatedProducts)) {
161
- return array();
162
- }
163
- $sku = Mage::getStoreConfig('icecat_root/icecat/sku_field');
164
- $collection = Mage::getModel('catalog/product')->getCollection();
165
- $filterArray = array();
166
- foreach ($relatedProducts as $mpn => $valueArray) {
167
- array_push($filterArray, array('attribute' => $sku, 'eq' => $mpn));
168
- }
169
- $collection->addFieldToFilter($filterArray);
170
- $collection->addAttributeToSelect($sku);
171
- $collection->addAttributeToSelect('category_ids');
172
- $relatedProductsList = array();
173
- foreach ($collection as $product) {
174
- $categoryIds = $product->getCategoryIds();
175
- if (!empty($categoryIds)) {
176
- if (is_array($categoryIds)) {
177
- $catogoriesArray = $categoryIds;
178
- }
179
- if (is_string($categoryIds)) {
180
- $catogoriesArray = explode(",", $product->getCategoryIds());
181
- }
182
- foreach ($catogoriesArray as $categoryId) {
183
- if (!array_key_exists($product->getData($sku), $relatedProducts)) {
184
- continue;
185
- }
186
- $relatedProductInfo = $relatedProducts[$product->getData($sku)];
187
- $relatedProductInfo['mpn'] = $product->getData($sku);
188
- $relatedProductInfo['url'] = preg_replace('/\/\d+\/$/', "/" . $categoryId . "/", $product->getProductUrl());;
189
- if (!array_key_exists($categoryId, $relatedProductsList)) {
190
- $relatedProductsList[$categoryId] = array();
191
- }
192
- array_push($relatedProductsList[$categoryId], $relatedProductInfo);
193
- }
194
- } else {
195
- if (!array_key_exists($product->getData($sku), $relatedProducts)) {
196
- continue;
197
- }
198
- $relatedProductInfo = $relatedProducts[$product->getData($sku)];
199
- $relatedProductInfo['mpn'] = $product->getData($sku);
200
- $relatedProductInfo['url'] = preg_replace('/category\/\d+\/$/', '', $product->getProductUrl());;
201
- if (!array_key_exists('a', $relatedProductsList)) {
202
- $relatedProductsList['a'] = array();
203
- }
204
- array_push($relatedProductsList['a'], $relatedProductInfo);
205
- }
206
- }
207
- return $relatedProductsList;
208
- }
209
- }
210
-
211
- ?>
1
+ <?php
2
+ /**
3
+ *
4
+ * Class achieves icecat description from Model by recieved SKU and manufacturer
5
+ *
6
+ */
7
+ class Iceshop_Icecatlive_Helper_Getdata extends Mage_Core_Helper_Abstract
8
+ {
9
+ private $iceCatModel;
10
+ private $error;
11
+ private $systemError;
12
+
13
+ /**
14
+ * Gets product Data and delegates it to Model
15
+ * @param Mage_Catalog_Model_Product $_product
16
+ * @return Iceshop_Icecatlive_Helper_Getdata
17
+ */
18
+
19
+ public function getEntityTypeId()
20
+ {
21
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
22
+ $query = $connection->select()
23
+ ->from(Mage::getSingleton('core/resource')
24
+ ->getTableName('eav_entity_type'), 'entity_type_id')
25
+ ->where('entity_type_code = ?', 'catalog_product')
26
+ ->limit(1);
27
+ $this->entityTypeId = $connection->fetchOne($query);
28
+ return $this->entityTypeId;
29
+ }
30
+
31
+ public function getProductDescription($_product)
32
+ {
33
+ try {
34
+ $entityId = $_product->getEntityId();
35
+ $entity_type_id = $this->getEntityTypeId();
36
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
37
+ $mpn = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
38
+ $ean_code = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/ean_code'));
39
+ $manufacturerId = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
40
+ $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
41
+ ->setCodeFilter(Mage::getStoreConfig('icecat_root/icecat/manufacturer'))
42
+ ->setEntityTypeFilter($entity_type_id)
43
+ ->getFirstItem();
44
+ if ($attributeInfo->getData('backend_type') == 'int' ||
45
+ ($attributeInfo->getData('frontend_input') == 'select' && $attributeInfo->getData('backend_type') == 'static')
46
+ ) {
47
+ $attribute = $attributeInfo->setEntity($_product->getResource());
48
+ $manufacturer = $attribute->getSource()->getOptionText($manufacturerId);
49
+ } else {
50
+ $manufacturer = $manufacturerId;
51
+ }
52
+
53
+ $locale = Mage::getStoreConfig('icecat_root/icecat/language');
54
+ if ($locale == '0') {
55
+ $systemLocale = explode("_", Mage::app()->getLocale()->getLocaleCode());
56
+ $locale = $systemLocale[0];
57
+ }
58
+ $userLogin = Mage::getStoreConfig('icecat_root/icecat/login');
59
+ $userPass = Mage::getStoreConfig('icecat_root/icecat/password');
60
+ $this->iceCatModel = Mage::getSingleton('icecatlive/import');
61
+ if (!$this->iceCatModel->getProductDescription($mpn, $manufacturer, $locale, $userLogin, $userPass, $entityId, $ean_code)) {
62
+ $this->error = $this->iceCatModel->getErrorMessage();
63
+ $this->systemError = $this->iceCatModel->getSystemError();
64
+ return $this;
65
+ }
66
+ } catch (Exception $e) {
67
+ Mage::log('Icecat getProductDescription error' . $e);
68
+ }
69
+ return $this;
70
+ }
71
+
72
+ /**
73
+ * returns true if error during data fetch occured else false
74
+ */
75
+ public function hasError()
76
+ {
77
+ if ($this->error || $this->systemError) {
78
+ return true;
79
+ }
80
+ return false;
81
+ }
82
+
83
+ /**
84
+ * return error message
85
+ */
86
+ public function getError()
87
+ {
88
+ }
89
+
90
+ /**
91
+ * return system error
92
+ */
93
+ public function hasSystemError()
94
+ {
95
+ if ($this->systemError) {
96
+ return $this->systemError;
97
+ }
98
+ return false;
99
+ }
100
+
101
+ public function getProductDescriptionList()
102
+ {
103
+ return $this->iceCatModel->getProductDescriptionList();
104
+ }
105
+
106
+ public function getShortProductDescription()
107
+ {
108
+ return $this->iceCatModel->getShortProductDescription();
109
+ }
110
+
111
+ public function getLowPicUrl()
112
+ {
113
+ return $this->iceCatModel->getLowPicUrl();
114
+ }
115
+
116
+ public function getThumbPicture()
117
+ {
118
+ return $this->iceCatModel->getThumbPicture();
119
+ }
120
+
121
+ public function getGalleryPhotos()
122
+ {
123
+ return $this->iceCatModel->getGalleryPhotos();
124
+ }
125
+
126
+ public function getProductName()
127
+ {
128
+ return $this->iceCatModel->getProductName();
129
+ }
130
+
131
+ public function getVendor()
132
+ {
133
+ return $this->iceCatModel->getVendor();
134
+ }
135
+
136
+ public function getFullProductDescription()
137
+ {
138
+ return $this->iceCatModel->getFullProductDescription();
139
+ }
140
+
141
+ public function getMPN()
142
+ {
143
+ return $this->iceCatModel->getMPN();
144
+ }
145
+
146
+ public function getEAN()
147
+ {
148
+ return $this->iceCatModel->getEAN();
149
+ }
150
+
151
+ /**
152
+ * Form related products list according to store products
153
+ */
154
+ public function getRelatedProducts()
155
+ {
156
+ if (!$this->iceCatModel) {
157
+ $this->iceCatModel = Mage::getSingleton('icecatlive/import');
158
+ }
159
+ $relatedProducts = $this->iceCatModel->getRelatedProducts();
160
+ if (empty($relatedProducts)) {
161
+ return array();
162
+ }
163
+ $sku = Mage::getStoreConfig('icecat_root/icecat/sku_field');
164
+ $collection = Mage::getModel('catalog/product')->getCollection();
165
+ $filterArray = array();
166
+ foreach ($relatedProducts as $mpn => $valueArray) {
167
+ array_push($filterArray, array('attribute' => $sku, 'eq' => $mpn));
168
+ }
169
+ $collection->addFieldToFilter($filterArray);
170
+ $collection->addAttributeToSelect($sku);
171
+ $collection->addAttributeToSelect('category_ids');
172
+ $relatedProductsList = array();
173
+ foreach ($collection as $product) {
174
+ $categoryIds = $product->getCategoryIds();
175
+ if (!empty($categoryIds)) {
176
+ if (is_array($categoryIds)) {
177
+ $catogoriesArray = $categoryIds;
178
+ }
179
+ if (is_string($categoryIds)) {
180
+ $catogoriesArray = explode(",", $product->getCategoryIds());
181
+ }
182
+ foreach ($catogoriesArray as $categoryId) {
183
+ if (!array_key_exists($product->getData($sku), $relatedProducts)) {
184
+ continue;
185
+ }
186
+ $relatedProductInfo = $relatedProducts[$product->getData($sku)];
187
+ $relatedProductInfo['mpn'] = $product->getData($sku);
188
+ $relatedProductInfo['url'] = preg_replace('/\/\d+\/$/', "/" . $categoryId . "/", $product->getProductUrl());;
189
+ if (!array_key_exists($categoryId, $relatedProductsList)) {
190
+ $relatedProductsList[$categoryId] = array();
191
+ }
192
+ array_push($relatedProductsList[$categoryId], $relatedProductInfo);
193
+ }
194
+ } else {
195
+ if (!array_key_exists($product->getData($sku), $relatedProducts)) {
196
+ continue;
197
+ }
198
+ $relatedProductInfo = $relatedProducts[$product->getData($sku)];
199
+ $relatedProductInfo['mpn'] = $product->getData($sku);
200
+ $relatedProductInfo['url'] = preg_replace('/category\/\d+\/$/', '', $product->getProductUrl());;
201
+ if (!array_key_exists('a', $relatedProductsList)) {
202
+ $relatedProductsList['a'] = array();
203
+ }
204
+ array_push($relatedProductsList['a'], $relatedProductInfo);
205
+ }
206
+ }
207
+ return $relatedProductsList;
208
+ }
209
+ }
210
+
211
+ ?>
app/code/local/Iceshop/Icecatlive/Helper/Image.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
- /**
3
- * Class retrieves images from icecatlive data table
4
- *
5
- */
6
- class Iceshop_Icecatlive_Helper_Image extends Mage_Core_Helper_Abstract
7
- {
8
- /**
9
- * Fetch Image URL from DB
10
- * @param Mage_Catalog_Model_Product $_product
11
- * @return string image URL
12
- */
13
- public function getImage($_product)
14
- {
15
-
16
- $_product = $_product->load($_product->getId());
17
- $sku = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
18
- $manufacturerId = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
19
-
20
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
21
- $query = $connection->select()
22
- ->from(Mage::getSingleton('core/resource')->getTableName('eav_entity_type'), 'entity_type_id')
23
- ->where('entity_type_code = ?', 'catalog_product')
24
- ->limit(1);
25
- $entityTypeId = $connection->fetchOne($query);
26
- $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
27
- ->setCodeFilter(Mage::getStoreConfig('icecat_root/icecat/manufacturer'))
28
- ->setEntityTypeFilter($_product->getResource()->getTypeId())
29
- ->getFirstItem();
30
- switch ($attributeInfo->getData('backend_type')) {
31
- case 'int':
32
- $attribute = $attributeInfo->setEntity($_product->getResource());
33
- $manufacturer = $attribute->getSource()->getOptionText($manufacturerId);
34
- break;
35
- default:
36
- $manufacturer = $manufacturerId;
37
- break;
38
- }
39
- $this->observer = Mage::getSingleton('icecatlive/observer');
40
-
41
- $url = $this->observer->getImageURL($sku, $manufacturer, $_product->getId());
42
- return $url;
43
- }
44
-
45
- public function getGallery()
46
- {
47
- return Mage::getSingleton('icecatlive/import')->getGalleryPhotos();
48
- }
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Iceshop/Icecatlive/Helper/Output.php CHANGED
@@ -1,179 +1,179 @@
1
- <?php
2
- class Iceshop_Icecatlive_Helper_Output extends Mage_Catalog_Helper_Output
3
- {
4
-
5
- private $iceCatModel;
6
- private $error = false;
7
- private $systemError;
8
-
9
- /**
10
- * @var isFirstTime spike for getProductDescription that is called many times from template
11
- */
12
- private $isFirstTime = true;
13
-
14
- /**
15
- * Prepare product attribute html output
16
- *
17
- * @param Mage_Catalog_Model_Product $product
18
- * @param string $attributeHtml
19
- * @param string $attributeName
20
- * @return string
21
- */
22
- public function productAttribute($product, $attributeHtml, $attributeName)
23
- {
24
- $productId = $product->getId();
25
-
26
- if (!mage::registry('product')) {
27
- Mage::register('product', $product);
28
- Mage::register('current_product', $product);
29
-
30
- }
31
-
32
- if ($attributeName == 'image') {
33
- return parent::productAttribute($product, $attributeHtml, $attributeName);
34
- }
35
-
36
- $productDescriptionPriority = Mage::getStoreConfig('icecat_root/icecat/descript_priority');
37
- $productShortDescrPriority = Mage::getStoreConfig('icecat_root/icecat/shortdescr_priority');
38
- $productNamePriority = Mage::getStoreConfig('icecat_root/icecat/name_priority');
39
-
40
-
41
- $dbDescriptionPriority = false;
42
- $dbShortDescriptionPriority = false;
43
- $current_page = Mage::app()->getFrontController()->getRequest()->getControllerName();
44
- if ($productDescriptionPriority == 'Db' && $attributeName == 'description') {
45
- $dbDescriptionPriority = true;
46
- }
47
- if ($productShortDescrPriority == 'Db' && $attributeName == 'short_description') {
48
- $dbShortDescriptionPriority = true;
49
- }
50
-
51
- if ($current_page == 'product') {
52
-
53
- $bin_prod = new Iceshop_Icecatlive_Model_Catalog_Product();
54
- if ($attributeName == 'description' || $attributeName == 'short_description') {
55
- $descr = $bin_prod->checkIcecatProdDescription($productId, $attributeName);
56
- }
57
- }
58
- $prod_source = Iceshop_Icecatlive_Model_Catalog_Product::$_product_source;
59
-
60
- if ($prod_source == 'DB' && empty($descr)) {
61
- $dbDescriptionPriority = true;
62
- $dbShortDescriptionPriority = true;
63
- }
64
-
65
- if ($dbShortDescriptionPriority || ($current_page != 'product'
66
- && $prod_source != 'DB') && $attributeName != 'name'
67
- ) {
68
- if ($attributeName == 'short_description') {
69
- $attributeHtml = $product->getData('short_description');
70
- }
71
-
72
- if ($attributeName == 'description' && $attributeHtml == 1) {
73
- $attributeHtml = $product->getData('description');
74
- }
75
- return parent::productAttribute($product, $attributeHtml, $attributeName);
76
- }
77
-
78
- $this->iceCatModel = Mage::getSingleton('icecatlive/import');
79
-
80
- if ($this->isFirstTime) {
81
- $helper = Mage::helper('icecatlive/getdata');
82
- $helper->getProductDescription($product);
83
-
84
- if ($helper->hasError() && $attributeName != 'name') {
85
- $this->error = true;
86
- }
87
- $this->isFirstTime = false;
88
- }
89
-
90
- if ($this->error) {
91
-
92
- if ($attributeName != 'description' && $attributeName != 'short_description') {
93
- return parent::productAttribute($product, $attributeHtml, $attributeName);
94
- } else {
95
- return '';
96
- }
97
-
98
- }
99
-
100
- $id = $product->getData('entity_id');
101
-
102
- if ($attributeName == 'name' && $productNamePriority != 'Db') {
103
- //if we on product page then mage::registry('product') exist
104
- if ($product->getId() == $this->iceCatModel->entityId && $name = $this->iceCatModel->getProductName()) {
105
- return $name;
106
- } else if (!empty($descr)) {
107
- return $descr;
108
- }
109
- $manufacturerId = Mage::getStoreConfig('icecat_root/icecat/manufacturer');
110
- $mpn = Mage::getStoreConfig('icecat_root/icecat/sku_field');
111
- $ean = Mage::getStoreConfig('icecat_root/icecat/ean_code');
112
- $collection = Mage::getResourceModel('catalog/product_collection');
113
- $collection->addAttributeToSelect($manufacturerId)->addAttributeToSelect($mpn)->addAttributeToSelect($ean)
114
- ->addAttributeToSelect('name')
115
- ->addAttributeToFilter('entity_id', array('eq' => $id));
116
- $product = $collection->getFirstItem();
117
- return $product->getName();
118
- }
119
-
120
- if ($attributeName == 'short_description' && !$dbShortDescriptionPriority) {
121
-
122
- $icecat_descr = $this->iceCatModel->getShortProductDescription();
123
- if (!empty($descr)) {
124
- return $descr;
125
- } else if (!empty($icecat_descr)) {
126
- return $icecat_descr;
127
- } else {
128
- $attributeHtml = $product->getData('short_description');
129
- return parent::productAttribute($product, $attributeHtml, $attributeName);
130
- }
131
- }
132
-
133
- if ($attributeName == 'description' && !$dbDescriptionPriority) {
134
-
135
- $icecat_full_descr = $this->iceCatModel->getFullProductDescription();
136
-
137
- if (!empty($icecat_full_descr)) {
138
- return str_replace("\\n", "<br>", $icecat_full_descr);
139
- } else {
140
- $attributeHtml = $product->getData('description');
141
- }
142
- }
143
- return parent::productAttribute($product, $attributeHtml, $attributeName);
144
- }
145
-
146
-
147
- public function getWarrantyInfo()
148
- {
149
- return $this->iceCatModel->getWarrantyInfo();
150
- }
151
-
152
- public function getShortSummaryDescription()
153
- {
154
- return $this->iceCatModel->getShortSummaryDescription();
155
- }
156
-
157
- public function getLongSummaryDescription()
158
- {
159
- return $this->iceCatModel->getLongSummaryDescription();
160
- }
161
-
162
- public function getManualPDF()
163
- {
164
- return $this->iceCatModel->getManualPDF();
165
- }
166
-
167
- public function getPDF()
168
- {
169
- return $this->iceCatModel->getPDF();
170
- }
171
-
172
- public function getIceCatMedia()
173
- {
174
- $media = (array)$this->iceCatModel->getIceCatMedia();
175
- return (array_key_exists('@attributes', $media)) ? $media['@attributes'] : array();
176
- }
177
- }
178
-
179
- ?>
1
+ <?php
2
+ class Iceshop_Icecatlive_Helper_Output extends Mage_Catalog_Helper_Output
3
+ {
4
+
5
+ private $iceCatModel;
6
+ private $error = false;
7
+ private $systemError;
8
+
9
+ /**
10
+ * @var isFirstTime spike for getProductDescription that is called many times from template
11
+ */
12
+ private $isFirstTime = true;
13
+
14
+ /**
15
+ * Prepare product attribute html output
16
+ *
17
+ * @param Mage_Catalog_Model_Product $product
18
+ * @param string $attributeHtml
19
+ * @param string $attributeName
20
+ * @return string
21
+ */
22
+ public function productAttribute($product, $attributeHtml, $attributeName)
23
+ {
24
+ $productId = $product->getId();
25
+
26
+ if (!mage::registry('product')) {
27
+ Mage::register('product', $product);
28
+ Mage::register('current_product', $product);
29
+
30
+ }
31
+
32
+ if ($attributeName == 'image') {
33
+ return parent::productAttribute($product, $attributeHtml, $attributeName);
34
+ }
35
+
36
+ $productDescriptionPriority = Mage::getStoreConfig('icecat_root/icecat/descript_priority');
37
+ $productShortDescrPriority = Mage::getStoreConfig('icecat_root/icecat/shortdescr_priority');
38
+ $productNamePriority = Mage::getStoreConfig('icecat_root/icecat/name_priority');
39
+
40
+
41
+ $dbDescriptionPriority = false;
42
+ $dbShortDescriptionPriority = false;
43
+ $current_page = Mage::app()->getFrontController()->getRequest()->getControllerName();
44
+ if ($productDescriptionPriority == 'Db' && $attributeName == 'description') {
45
+ $dbDescriptionPriority = true;
46
+ }
47
+ if ($productShortDescrPriority == 'Db' && $attributeName == 'short_description') {
48
+ $dbShortDescriptionPriority = true;
49
+ }
50
+
51
+ if ($current_page == 'product') {
52
+
53
+ $bin_prod = new Iceshop_Icecatlive_Model_Catalog_Product();
54
+ if ($attributeName == 'description' || $attributeName == 'short_description') {
55
+ $descr = $bin_prod->checkIcecatProdDescription($productId, $attributeName);
56
+ }
57
+ }
58
+ $prod_source = Iceshop_Icecatlive_Model_Catalog_Product::$_product_source;
59
+
60
+ if ($prod_source == 'DB' && empty($descr)) {
61
+ $dbDescriptionPriority = true;
62
+ $dbShortDescriptionPriority = true;
63
+ }
64
+
65
+ if ($dbShortDescriptionPriority || ($current_page != 'product'
66
+ && $prod_source != 'DB') && $attributeName != 'name'
67
+ ) {
68
+ if ($attributeName == 'short_description') {
69
+ $attributeHtml = $product->getData('short_description');
70
+ }
71
+
72
+ if ($attributeName == 'description' && $attributeHtml == 1) {
73
+ $attributeHtml = $product->getData('description');
74
+ }
75
+ return parent::productAttribute($product, $attributeHtml, $attributeName);
76
+ }
77
+
78
+ $this->iceCatModel = Mage::getSingleton('icecatlive/import');
79
+
80
+ if ($this->isFirstTime) {
81
+ $helper = Mage::helper('icecatlive/getdata');
82
+ $helper->getProductDescription($product);
83
+
84
+ if ($helper->hasError() && $attributeName != 'name') {
85
+ $this->error = true;
86
+ }
87
+ $this->isFirstTime = false;
88
+ }
89
+
90
+ if ($this->error) {
91
+
92
+ if ($attributeName != 'description' && $attributeName != 'short_description') {
93
+ return parent::productAttribute($product, $attributeHtml, $attributeName);
94
+ } else {
95
+ return '';
96
+ }
97
+
98
+ }
99
+
100
+ $id = $product->getData('entity_id');
101
+
102
+ if ($attributeName == 'name' && $productNamePriority != 'Db') {
103
+ //if we on product page then mage::registry('product') exist
104
+ if ($product->getId() == $this->iceCatModel->entityId && $name = $this->iceCatModel->getProductName()) {
105
+ return $name;
106
+ } else if (!empty($descr)) {
107
+ return $descr;
108
+ }
109
+ $manufacturerId = Mage::getStoreConfig('icecat_root/icecat/manufacturer');
110
+ $mpn = Mage::getStoreConfig('icecat_root/icecat/sku_field');
111
+ $ean = Mage::getStoreConfig('icecat_root/icecat/ean_code');
112
+ $collection = Mage::getResourceModel('catalog/product_collection');
113
+ $collection->addAttributeToSelect($manufacturerId)->addAttributeToSelect($mpn)->addAttributeToSelect($ean)
114
+ ->addAttributeToSelect('name')
115
+ ->addAttributeToFilter('entity_id', array('eq' => $id));
116
+ $product = $collection->getFirstItem();
117
+ return $product->getName();
118
+ }
119
+
120
+ if ($attributeName == 'short_description' && !$dbShortDescriptionPriority) {
121
+
122
+ $icecat_descr = $this->iceCatModel->getShortProductDescription();
123
+ if (!empty($descr)) {
124
+ return $descr;
125
+ } else if (!empty($icecat_descr)) {
126
+ return $icecat_descr;
127
+ } else {
128
+ $attributeHtml = $product->getData('short_description');
129
+ return parent::productAttribute($product, $attributeHtml, $attributeName);
130
+ }
131
+ }
132
+
133
+ if ($attributeName == 'description' && !$dbDescriptionPriority) {
134
+
135
+ $icecat_full_descr = $this->iceCatModel->getFullProductDescription();
136
+
137
+ if (!empty($icecat_full_descr)) {
138
+ return str_replace("\\n", "<br>", $icecat_full_descr);
139
+ } else {
140
+ $attributeHtml = $product->getData('description');
141
+ }
142
+ }
143
+ return parent::productAttribute($product, $attributeHtml, $attributeName);
144
+ }
145
+
146
+
147
+ public function getWarrantyInfo()
148
+ {
149
+ return $this->iceCatModel->getWarrantyInfo();
150
+ }
151
+
152
+ public function getShortSummaryDescription()
153
+ {
154
+ return $this->iceCatModel->getShortSummaryDescription();
155
+ }
156
+
157
+ public function getLongSummaryDescription()
158
+ {
159
+ return $this->iceCatModel->getLongSummaryDescription();
160
+ }
161
+
162
+ public function getManualPDF()
163
+ {
164
+ return $this->iceCatModel->getManualPDF();
165
+ }
166
+
167
+ public function getPDF()
168
+ {
169
+ return $this->iceCatModel->getPDF();
170
+ }
171
+
172
+ public function getIceCatMedia()
173
+ {
174
+ $media = (array)$this->iceCatModel->getIceCatMedia();
175
+ return (array_key_exists('@attributes', $media)) ? $media['@attributes'] : array();
176
+ }
177
+ }
178
+
179
+ ?>
app/code/local/Iceshop/Icecatlive/Helper/System/System.php ADDED
@@ -0,0 +1,461 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Iceshop_Icecatlive_Helper_System_System
5
+ */
6
+ class Iceshop_Icecatlive_Helper_System_System extends Mage_Core_Helper_Abstract
7
+ {
8
+ /**
9
+ * Sorts a multi-dimensional array with the given values
10
+ *
11
+ * Seen and modified from: http://www.firsttube.com/read/sorting-a-multi-dimensional-array-with-php/
12
+ *
13
+ * @param array $arr Array to sort
14
+ * @param string $key Field to sort
15
+ * @param string $dir Direction to sort
16
+ * @return array Sorted array
17
+ */
18
+ public function sortMultiDimArr($arr, $key, $dir = 'ASC')
19
+ {
20
+ foreach ($arr as $k => $v) {
21
+ $b[$k] = strtolower($v[$key]);
22
+ }
23
+
24
+ if ($dir == 'ASC') {
25
+ asort($b);
26
+ } else {
27
+ arsort($b);
28
+ }
29
+ foreach ($b as $key => $val) {
30
+ $c[] = $arr[$key];
31
+ }
32
+
33
+ return $c;
34
+ }
35
+
36
+ /**
37
+ * Activate/Deactivate a Magento module
38
+ *
39
+ * @param string $name
40
+ * @return string
41
+ */
42
+ public function deactivateModule($name)
43
+ {
44
+ $isDeactivationPossible = true;
45
+ foreach (Mage::getConfig()->getNode('modules')->children() as $moduleName => $item) {
46
+ if ($moduleName == $name) {
47
+ continue;
48
+ }
49
+ if ($item->depends) {
50
+ foreach ($item->depends->children() as $depend) {
51
+ if ($depend->getName() == $name) {
52
+ if ((string)Mage::getConfig()->getModuleConfig($moduleName)->is('active', 'true')) {
53
+ $isDeactivationPossible = false;
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+
60
+ if ($isDeactivationPossible) {
61
+ $xmlPath = Mage::getBaseDir() . DS . 'app' . DS . 'etc' . DS . 'modules' . DS . $name . '.xml';
62
+ if (file_exists($xmlPath)) {
63
+ $xmlObj = new Varien_Simplexml_Config($xmlPath);
64
+
65
+ $currentValue = (string)$xmlObj->getNode('modules/' . $name . '/active');
66
+ if ($currentValue == 'true') {
67
+ $value = false;
68
+ } else {
69
+ $value = true;
70
+ }
71
+
72
+ $xmlObj->setNode(
73
+ 'modules/' . $name . '/active',
74
+ $value ? 'true' : 'false'
75
+ );
76
+
77
+ if (is_writable($xmlPath)) {
78
+ $xmlData = $xmlObj->getNode()->asNiceXml();
79
+ @file_put_contents($xmlPath, $xmlData);
80
+ Mage::app()->getCacheInstance()->clean();
81
+ if ($value) {
82
+ $status = $this->__('The module "%s" has been successfully activated.', $name);
83
+ } else {
84
+ $status = $this->__('The module "%s" has been successfully deactivated.', $name);
85
+ }
86
+ } else {
87
+ $status = $this->__('File %s is not writable.', $xmlPath);
88
+ }
89
+ } else {
90
+ $status = $this->__(
91
+ 'Module %s is probably not installed. File %s does not exist.',
92
+ $name,
93
+ $xmlPath
94
+ );
95
+ }
96
+ } else {
97
+ $status = $this->__('Module can\'t be deactivated because it is a dependency of another module which is still active.');
98
+ }
99
+
100
+ return $status;
101
+ }
102
+
103
+ /**
104
+ * Retrieve a collection of all rewrites
105
+ *
106
+ * @return Varien_Data_Collection Collection
107
+ */
108
+ public function getRewriteCollection()
109
+ {
110
+ $collection = new Varien_Data_Collection();
111
+ $rewrites = $this->_loadRewrites();
112
+
113
+ foreach ($rewrites as $rewriteNodes) {
114
+ foreach ($rewriteNodes as $n) {
115
+ $nParent = $n->xpath('..');
116
+ $module = (string)$nParent[0]->getName();
117
+ $nSubParent = $nParent[0]->xpath('..');
118
+ $component = (string)$nSubParent[0]->getName();
119
+
120
+ if (!in_array($component, array('blocks', 'helpers', 'models'))) {
121
+ continue;
122
+ }
123
+
124
+ $pathNodes = $n->children();
125
+ foreach ($pathNodes as $pathNode) {
126
+ $path = (string)$pathNode->getName();
127
+ $completePath = $module . '/' . $path;
128
+
129
+ $rewriteClassName = (string)$pathNode;
130
+
131
+ $instance = Mage::getConfig()->getGroupedClassName(
132
+ substr($component, 0, -1),
133
+ $completePath
134
+ );
135
+
136
+ $collection->addItem(
137
+ new Varien_Object(
138
+ array(
139
+ 'path' => $completePath,
140
+ 'rewrite_class' => $rewriteClassName,
141
+ 'active_class' => $instance,
142
+ 'status' => ($instance == $rewriteClassName)
143
+ )
144
+ )
145
+ );
146
+ }
147
+ }
148
+ }
149
+
150
+ return $collection;
151
+ }
152
+
153
+ /**
154
+ * Return all rewrites
155
+ *
156
+ * @return array All rwrites
157
+ */
158
+ protected function _loadRewrites()
159
+ {
160
+ $fileName = 'config.xml';
161
+ $modules = Mage::getConfig()->getNode('modules')->children();
162
+
163
+ $return = array();
164
+ foreach ($modules as $modName => $module) {
165
+ if ($module->is('active')) {
166
+ $configFile = Mage::getConfig()->getModuleDir('etc', $modName) . DS . $fileName;
167
+ if (file_exists($configFile)) {
168
+ $xml = file_get_contents($configFile);
169
+ $xml = simplexml_load_string($xml);
170
+
171
+ if ($xml instanceof SimpleXMLElement) {
172
+ $return[$modName] = $xml->xpath('//rewrite');
173
+ }
174
+ }
175
+ }
176
+ }
177
+
178
+ return $return;
179
+ }
180
+
181
+ /**
182
+ * Retrieve a collection of all modules
183
+ *
184
+ * @return Varien_Data_Collection Collection
185
+ */
186
+ public function getModulesCollection()
187
+ {
188
+ $sortValue = Mage::app()->getRequest()->getParam('sort', 'name');
189
+ $sortValue = strtolower($sortValue);
190
+
191
+ $sortDir = Mage::app()->getRequest()->getParam('dir', 'ASC');
192
+ $sortDir = strtoupper($sortDir);
193
+
194
+ $modules = $this->_loadModules();
195
+ $modules = $this->sortMultiDimArr($modules, $sortValue, $sortDir);
196
+
197
+ $collection = new Varien_Data_Collection();
198
+ foreach ($modules as $val) {
199
+ $item = new Varien_Object($val);
200
+ $collection->addItem($item);
201
+ }
202
+
203
+ return $collection;
204
+ }
205
+
206
+ /**
207
+ * Loads the module configurations and checks for some criteria and
208
+ * returns an array with the current modules in the Magento instance.
209
+ *
210
+ * @return array Modules
211
+ */
212
+ protected function _loadModules()
213
+ {
214
+ $modules = array();
215
+ $config = Mage::getConfig();
216
+ foreach ($config->getNode('modules')->children() as $item) {
217
+ $active = ($item->active == 'true') ? true : false;
218
+ $codePool = (string)$config->getModuleConfig($item->getName())->codePool;
219
+ $path = $config->getOptions()->getCodeDir() . DS . $codePool . DS . uc_words($item->getName(), DS);
220
+ $pathExists = file_exists($path);
221
+ $pathExists = $pathExists ? true : false;
222
+ $configExists = file_exists($path . '/etc/config.xml');
223
+ $configExists = $configExists ? true : false;
224
+ $version = (string)$config->getModuleConfig($item->getName())->version;
225
+
226
+ $dependencies = '-';
227
+ if ($item->depends) {
228
+ $depends = array();
229
+ foreach ($item->depends->children() as $depend) {
230
+ $depends[] = $depend->getName();
231
+ }
232
+ if (is_array($depends) && count($depends) > 0) {
233
+ asort($depends);
234
+ $dependencies = implode("\n", $depends);
235
+ }
236
+ }
237
+
238
+ $modules[$item->getName()] = array(
239
+ 'name' => $item->getName(),
240
+ 'active' => $active,
241
+ 'code_pool' => $codePool,
242
+ 'path' => $path,
243
+ 'path_exists' => $pathExists,
244
+ 'config_exists' => $configExists,
245
+ 'version' => $version,
246
+ 'dependencies' => $dependencies
247
+ );
248
+ }
249
+
250
+ return $modules;
251
+ }
252
+
253
+ /**
254
+ * Retrieve a collection of all events
255
+ *
256
+ * @return Varien_Data_Collection Collection
257
+ */
258
+ public function getEventsCollection()
259
+ {
260
+ $sortValue = Mage::app()->getRequest()->getParam('sort', 'event');
261
+ $sortValue = strtolower($sortValue);
262
+
263
+ $sortDir = Mage::app()->getRequest()->getParam('dir', 'ASC');
264
+ $sortDir = strtoupper($sortDir);
265
+
266
+ $events = $this->_loadEvents();
267
+ $events = $this->sortMultiDimArr($events, $sortValue, $sortDir);
268
+
269
+ $collection = new Varien_Data_Collection();
270
+ foreach ($events as $item) {
271
+ $values = $item['children'];
272
+ if (is_array($values)) {
273
+ asort($values);
274
+ }
275
+
276
+ $val = array(
277
+ 'event' => $item['event'],
278
+ 'location' => implode("\n", $values)
279
+ );
280
+
281
+ $item = new Varien_Object($val);
282
+ $collection->addItem($item);
283
+ }
284
+
285
+ return $collection;
286
+ }
287
+
288
+ /**
289
+ * Return all events
290
+ *
291
+ * @return array All events
292
+ */
293
+ protected function _loadEvents()
294
+ {
295
+ $fileName = 'config.xml';
296
+ $modules = Mage::getConfig()->getNode('modules')->children();
297
+
298
+ $events = array();
299
+ foreach ($modules as $modName => $module) {
300
+ if ($module->is('active')) {
301
+ $configFile = Mage::getConfig()->getModuleDir('etc', $modName) . DS . $fileName;
302
+ if (file_exists($configFile)) {
303
+ $xml = file_get_contents($configFile);
304
+ $xml = simplexml_load_string($xml);
305
+
306
+ if ($xml instanceof SimpleXMLElement) {
307
+ $events[$modName] = $xml->xpath('//events');
308
+ }
309
+ }
310
+ }
311
+ }
312
+
313
+ $return = array();
314
+ foreach ($events as $eventNodes) {
315
+ foreach ($eventNodes as $n) {
316
+ $pathNodes = $n->children();
317
+
318
+ foreach ($pathNodes as $pathNode) {
319
+ $eventName = (string)$pathNode->getName();
320
+ $instance = $pathNode->xpath('observers/node()/class');
321
+ $instance = (string)current($instance);
322
+ $instance = Mage::getConfig()->getModelClassName($instance);
323
+
324
+ if (!array_key_exists($eventName, $return)) {
325
+ $return[$eventName] = array(
326
+ 'event' => $eventName,
327
+ 'children' => array()
328
+ );
329
+ }
330
+ if (!in_array($instance, $return[$eventName])) {
331
+ $return[$eventName]['children'][] = $instance;
332
+ }
333
+ }
334
+ }
335
+ }
336
+
337
+ return $return;
338
+ }
339
+
340
+ /**
341
+ * Checks if one or more caches are active
342
+ *
343
+ * @return string Cache Message
344
+ */
345
+ public function checkCaches()
346
+ {
347
+ $active = 0;
348
+ $inactive = 0;
349
+ foreach (Mage::app()->getCacheInstance()->getTypes() as $type) {
350
+ $tmp = $type->getData();
351
+ if ($tmp['status']) {
352
+ $active++;
353
+ } else {
354
+ $inactive++;
355
+ }
356
+ }
357
+
358
+ return $this->__(
359
+ '%s caches active, %s caches inactive',
360
+ $active,
361
+ $inactive
362
+ );
363
+ }
364
+
365
+ /**
366
+ * Checks if all indexes are up-to-date
367
+ *
368
+ * @return string Indexes Message
369
+ */
370
+ public function checkIndizes()
371
+ {
372
+ $ready = 0;
373
+ $processing = 0;
374
+ $reindex = 0;
375
+
376
+ $collection = Mage::getResourceModel('index/process_collection');
377
+ foreach ($collection as $item) {
378
+ $tmp = $item->getData();
379
+ if ($tmp['status'] == 'pending') {
380
+ $ready++;
381
+ } elseif ($tmp['status'] == 'working') {
382
+ $processing++;
383
+ } else {
384
+ $reindex++;
385
+ }
386
+ }
387
+
388
+ return $this->__(
389
+ '%s indexes are ready, %s indexes are working, %s indexes need reindex',
390
+ $ready,
391
+ $processing,
392
+ $reindex
393
+ );
394
+ }
395
+
396
+ /**
397
+ * Returns a small system check report with some essential properties
398
+ *
399
+ * @return array Extension Check Result
400
+ */
401
+ public function checkSystem()
402
+ {
403
+ return $this->_extensionCheck(
404
+ array(
405
+ 'curl',
406
+ 'dom',
407
+ 'gd',
408
+ 'hash',
409
+ 'iconv',
410
+ 'mcrypt',
411
+ 'pcre',
412
+ 'pdo',
413
+ 'pdo_mysql',
414
+ 'simplexml'
415
+ )
416
+ );
417
+ }
418
+
419
+ /**
420
+ * Checks some kind of essential properties
421
+ *
422
+ * @param string $extensions Extensions to check
423
+ * @return array Array with failed and passed checks
424
+ */
425
+ protected function _extensionCheck($extensions)
426
+ {
427
+ $fail = array();
428
+ $pass = array();
429
+
430
+ if (version_compare(phpversion(), '5.2.0', '<')) {
431
+ $fail[] = 'You need <strong>PHP 5.2.0</strong> (or greater)';
432
+ } else {
433
+ $pass[] = 'You have <strong>PHP 5.2.0</strong> (or greater)';
434
+ }
435
+
436
+ if (!ini_get('safe_mode')) {
437
+ $pass[] = 'Safe Mode is <strong>off</strong>';
438
+
439
+ $con = Mage::getSingleton('core/resource')->getConnection('core_read');
440
+ $version = $con->getServerVersion();
441
+
442
+ if (version_compare($version, '4.1.20', '<')) {
443
+ $fail[] = 'You need <strong>MySQL 4.1.20</strong> (or greater)';
444
+ } else {
445
+ $pass[] = 'You have <strong>MySQL 4.1.20</strong> (or greater)';
446
+ }
447
+ } else {
448
+ $fail[] = 'Safe Mode is <strong>on</strong>';
449
+ }
450
+
451
+ foreach ($extensions as $extension) {
452
+ if (!extension_loaded($extension)) {
453
+ $fail[] = 'You are missing the <strong>' . $extension . '</strong> extension';
454
+ } else {
455
+ $pass[] = 'You have the <strong>' . $extension . '</strong> extension';
456
+ }
457
+ }
458
+
459
+ return array('pass' => $pass, 'fail' => $fail);
460
+ }
461
+ }
app/code/local/Iceshop/Icecatlive/Helper/System/Systemcheck.php ADDED
@@ -0,0 +1,615 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Iceshop_Icecatlive_Helper_System_Systemcheck
5
+ */
6
+ class Iceshop_Icecatlive_Helper_System_Systemcheck extends Mage_Core_Helper_Abstract
7
+ {
8
+ /**
9
+ * @var Varien_Object
10
+ */
11
+ protected $_system;
12
+
13
+ protected function _getHelper()
14
+ {
15
+ return Mage::helper('icecatlive/system_system');
16
+ }
17
+
18
+ /**
19
+ * @return Varien_Db_Adapter_Pdo_Mysql
20
+ */
21
+ protected function _getDb()
22
+ {
23
+ return Mage::getSingleton('core/resource')->getConnection('core_read');
24
+ }
25
+
26
+ /**
27
+ * @return $this
28
+ */
29
+ public function init()
30
+ {
31
+ $system = new Varien_Object();
32
+
33
+ /*
34
+ * MAGENTO
35
+ */
36
+ $magento = array(
37
+ 'edition' => (method_exists('Mage', 'getEdition')) ? Mage::getEdition() : '',
38
+ 'version' => (method_exists('Mage', 'getVersion')) ? Mage::getVersion() : '',
39
+ 'developer_mode' => (method_exists('Mage', 'getIsDeveloperMode')) ? Mage::getIsDeveloperMode() : '',
40
+ 'secret_key' => (method_exists('Mage', 'getStoreConfigFlag')) ? Mage::getStoreConfigFlag('admin/security/use_form_key') : '',
41
+ 'flat_catalog_category' => (method_exists('Mage', 'getStoreConfigFlag')) ? Mage::getStoreConfigFlag('catalog/frontend/flat_catalog_category') : '',
42
+ 'flat_catalog_product' => (method_exists('Mage', 'getStoreConfigFlag')) ? Mage::getStoreConfigFlag('catalog/frontend/flat_catalog_product') : ''
43
+ );
44
+ try {
45
+ $magento['cache_status'] = $this->_getHelper()->checkCaches();
46
+ $magento['index_status'] = $this->_getHelper()->checkIndizes();
47
+ } catch (Exception $e) {
48
+ $magento['exception'][] = array(
49
+ 'line' => $e->getLine(),
50
+ 'file' => $e->getFile(),
51
+ 'message' => $e->getMessage()
52
+ );
53
+ }
54
+ $system->setData('magento', new Varien_Object($magento));
55
+
56
+ /*
57
+ * SERVER
58
+ */
59
+
60
+ $server = array(
61
+ 'domain' => isset($_SERVER['HTTP_HOST']) ? str_replace('www.', '', $_SERVER['HTTP_HOST']) : null,
62
+ 'ip' => isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : (isset($_SERVER['LOCAL_ADDR']) ? $_SERVER['LOCAL_ADDR'] : ''),
63
+ 'dir' => (method_exists('Mage', 'getBaseDir')) ? Mage::getBaseDir() : '',
64
+ 'info' => php_uname(),
65
+
66
+ );
67
+ $system->setData('server', new Varien_Object($server));
68
+
69
+ /*
70
+ * PHP
71
+ */
72
+
73
+ $php = array(
74
+ 'version' => @phpversion(),
75
+ 'server_api' => @php_sapi_name(),
76
+ 'memory_limit' => @ini_get('memory_limit'),
77
+ 'max_execution_time' => @ini_get('max_execution_time')
78
+ );
79
+ $system->setData('php', new Varien_Object($php));
80
+
81
+ /*
82
+ * MySQL
83
+ */
84
+
85
+ // Get MySQL Server API
86
+ $connection = $this->_getDb()->getConnection();
87
+ if ($connection instanceof PDO) {
88
+ $mysqlServerApi = $connection->getAttribute(PDO::ATTR_CLIENT_VERSION);
89
+ } else {
90
+ $mysqlServerApi = 'n/a';
91
+ }
92
+
93
+ // Get table prefix
94
+ $tablePrefix = (string)Mage::getConfig()->getTablePrefix();
95
+ if (empty($tablePrefix)) {
96
+ $tablePrefix = $this->__('Disabled');
97
+ }
98
+
99
+ // Get MySQL vars
100
+ $sqlQuery = "SHOW VARIABLES;";
101
+ $sqlResult = $this->_getDb()->fetchAll($sqlQuery);
102
+ $mysqlVars = array();
103
+ foreach ($sqlResult as $mysqlVar) {
104
+ $mysqlVars[$mysqlVar['Variable_name']] = $mysqlVar['Value'];
105
+ }
106
+
107
+ $mysql = array(
108
+ 'version' => $this->_getDb()->getServerVersion(),
109
+ 'server_api' => $mysqlServerApi,
110
+ 'database_name' => (string)Mage::getConfig()->getNode('global/resources/default_setup/connection/dbname'),
111
+ 'database_tables' => count($this->_getDb()->listTables()),
112
+ 'table_prefix' => $tablePrefix,
113
+ 'connection_timeout' => $mysqlVars['connect_timeout'] . ' sec.',
114
+ 'wait_timeout' => $mysqlVars['wait_timeout'] . ' sec.',
115
+ 'max_allowed_packet' => array(
116
+ 'current_value' => $mysqlVars['max_allowed_packet'] . ' bytes',
117
+ 'recommended_value' => '>= ' . (1 * 1024 * 1024),
118
+ 'result' => ($mysqlVars['max_allowed_packet'] >= (1 * 1024 * 1024)),
119
+ 'label' => 'Max Allowed Packet',
120
+ 'advice' => array(
121
+ 'label' => $this->__('The maximum size of one packet or any generated/intermediate string.'),
122
+ 'link' => 'https://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_max_allowed_packet'
123
+ )
124
+ ),
125
+ 'thread_stack' => array(
126
+ 'current_value' => $mysqlVars['thread_stack'] . ' bytes',
127
+ 'recommended_value' => '>= ' . (192 * 1024),
128
+ 'result' => ($mysqlVars['thread_stack'] >= (192 * 1024)),
129
+ 'label' => 'Thread Stack',
130
+ 'advice' => array(
131
+ 'label' => $this->__('The stack size for each thread.'),
132
+ 'link' => 'https://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_thread_stack'
133
+ )
134
+ )
135
+ );
136
+ $system->setData('mysql', new Varien_Object($mysql));
137
+ $system->setData('mysql_vars', new Varien_Object($mysqlVars));
138
+
139
+ /*
140
+ * System Requirements
141
+ */
142
+
143
+ if (version_compare($php['version'], '5.3.0', '>=')) {
144
+ $safeMode['current_value'] = 'Deprecated';
145
+ $safeMode['result'] = false;
146
+ } else {
147
+ $safeMode['result'] = (@ini_get('safe_mode')) ? true : false;
148
+ $safeMode['current_value'] = $this->renderBooleanField($safeMode['result']);
149
+ }
150
+ $memoryLimit = $php['memory_limit'];
151
+ $memoryLimit = substr($memoryLimit, 0, strlen($memoryLimit) - 1);
152
+ $phpCurl = @extension_loaded('curl');
153
+ $phpDom = @extension_loaded('dom');
154
+ $phpGd = @extension_loaded('gd');
155
+ $phpHash = @extension_loaded('hash');
156
+ $phpIconv = @extension_loaded('iconv');
157
+ $phpMcrypt = @extension_loaded('mcrypt');
158
+ $phpPcre = @extension_loaded('pcre');
159
+ $phpPdo = @extension_loaded('pdo');
160
+ $phpPdoMysql = @extension_loaded('pdo_mysql');
161
+ $phpSimplexml = @extension_loaded('simplexml');
162
+
163
+ $requirements = array(
164
+ 'php_version' => array(
165
+ 'label' => 'PHP Version',
166
+ 'recommended_value' => '>= 5.3.0',
167
+ 'current_value' => $php['version'],
168
+ 'result' => version_compare($php['version'], '5.3.0', '>='),
169
+ 'advice' => array(
170
+ 'label' => $this->__('PHP version at least 5.3.0 required, recommended to use latest stable release.'),
171
+ 'link' => 'http://php.net/downloads.php'
172
+ )
173
+ ),
174
+ 'mysql_version' => array(
175
+ 'label' => 'MySQL Version',
176
+ 'recommended_value' => '>= 4.1.20',
177
+ 'current_value' => $mysql['version'],
178
+ 'result' => version_compare($mysql['version'], '4.1.20', '>='),
179
+ 'advice' => array(
180
+ 'label' => $this->__('MySQL version at least 4.1.20 required, recommended to use latest stable release.'),
181
+ 'link' => 'http://dev.mysql.com/downloads/mysql/'
182
+ )
183
+ ),
184
+ 'safe_mode' => array(
185
+ 'label' => 'Safe Mode',
186
+ 'recommended_value' => $this->renderBooleanField(false),
187
+ 'current_value' => $safeMode['current_value'],
188
+ 'result' => !$safeMode['result'],
189
+ 'advice' => array(
190
+ 'label' => $this->__('The PHP safe mode is an attempt to solve the shared-server security problem. Deprecated since PHP 5.3.0'),
191
+ 'link' => 'http://www.php.net/manual/en/features.safe-mode.php'
192
+ )
193
+ ),
194
+ 'memory_limit' => array(
195
+ 'label' => 'Memory Limit',
196
+ 'recommended_value' => '>= 128M',
197
+ 'current_value' => $php['memory_limit'],
198
+ 'result' => ($memoryLimit >= 128),
199
+ 'advice' => array(
200
+ 'label' => $this->__('Maximum amount of memory in bytes that a script is allowed to allocate.'),
201
+ 'link' => 'http://ua2.php.net/manual/en/ini.core.php#ini.memory-limit'
202
+ )
203
+ ),
204
+ 'max_execution_time' => array(
205
+ 'label' => 'Max. Execution Time',
206
+ 'recommended_value' => '>= 30 sec.',
207
+ 'current_value' => $php['max_execution_time'],
208
+ 'result' => ($php['max_execution_time'] >= 30),
209
+ 'advice' => array(
210
+ 'label' => $this->__('This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.'),
211
+ 'link' => 'http://ua2.php.net/manual/en/info.configuration.php#ini.max-execution-time'
212
+ )
213
+ ),
214
+ 'curl' => array(
215
+ 'label' => 'curl',
216
+ 'recommended_value' => $this->renderBooleanField(true),
217
+ 'current_value' => $this->renderBooleanField($phpCurl),
218
+ 'result' => $phpCurl,
219
+ 'advice' => array(
220
+ 'label' => $this->__('CURL is a library that allows to connect and communicate via a variety of different protocols such as HTTP, HTTPS, FTP, Telnet etc.'),
221
+ 'link' => 'http://www.tomjepson.co.uk/enabling-curl-in-php-php-ini-wamp-xamp-ubuntu/'
222
+ )
223
+ ),
224
+ 'dom' => array(
225
+ 'label' => 'dom',
226
+ 'recommended_value' => $this->renderBooleanField(true),
227
+ 'current_value' => $this->renderBooleanField($phpDom),
228
+ 'result' => $phpDom,
229
+ 'advice' => array(
230
+ 'label' => $this->__('The DOM extension allows to operate on XML documents through the DOM API with PHP 5.'),
231
+ 'link' => 'http://www.php.net/manual/en/dom.setup.php'
232
+ )
233
+ ),
234
+ 'gd' => array(
235
+ 'label' => 'gd',
236
+ 'recommended_value' => $this->renderBooleanField(true),
237
+ 'current_value' => $this->renderBooleanField($phpGd),
238
+ 'result' => $phpGd,
239
+ 'advice' => array(
240
+ 'label' => $this->__('GD is a library which supports a variety of formats, below is a list of formats supported by GD and notes to their availability including read/write support.'),
241
+ 'link' => 'http://www.php.net/manual/en/image.installation.php'
242
+ )
243
+ ),
244
+ 'hash' => array(
245
+ 'label' => 'hash',
246
+ 'recommended_value' => $this->renderBooleanField(true),
247
+ 'current_value' => $this->renderBooleanField($phpHash),
248
+ 'result' => $phpHash,
249
+ 'advice' => array(
250
+ 'label' => $this->__('Hash is a library which allows direct or incremental processing of arbitrary length messages using a variety of hashing algorithms.'),
251
+ 'link' => 'http://www.php.net/manual/en/hash.setup.php'
252
+ )
253
+ ),
254
+ 'iconv' => array(
255
+ 'label' => 'iconv',
256
+ 'recommended_value' => $this->renderBooleanField(true),
257
+ 'current_value' => $this->renderBooleanField($phpIconv),
258
+ 'result' => $phpIconv,
259
+ 'advice' => array(
260
+ 'label' => $this->__('Iconv is a module which contains an interface to iconv character set conversion facility.'),
261
+ 'link' => 'http://ua1.php.net/manual/en/iconv.installation.php'
262
+ )
263
+ ),
264
+ 'mcrypt' => array(
265
+ 'label' => 'mcrypt',
266
+ 'recommended_value' => $this->renderBooleanField(true),
267
+ 'current_value' => $this->renderBooleanField($phpMcrypt),
268
+ 'result' => $phpMcrypt,
269
+ 'advice' => array(
270
+ 'label' => $this->__('Mcrypt library supports a wide variety of block algorithms such as DES, TripleDES, Blowfish (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and GOST in CBC, OFB, CFB and ECB cipher modes.'),
271
+ 'link' => 'http://www.php.net/manual/en/mcrypt.installation.php'
272
+ )
273
+ ),
274
+ 'pcre' => array(
275
+ 'label' => 'pcre',
276
+ 'recommended_value' => $this->renderBooleanField(true),
277
+ 'current_value' => $this->renderBooleanField($phpPcre),
278
+ 'result' => $phpPcre,
279
+ 'advice' => array(
280
+ 'label' => $this->__('The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5, with just a few differences.'),
281
+ 'link' => 'http://www.php.net/manual/en/pcre.installation.php'
282
+ )
283
+ ),
284
+ 'pdo' => array(
285
+ 'label' => 'pdo',
286
+ 'recommended_value' => $this->renderBooleanField(true),
287
+ 'current_value' => $this->renderBooleanField($phpPdo),
288
+ 'result' => $phpPdo,
289
+ 'advice' => array(
290
+ 'label' => $this->__('The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP.'),
291
+ 'link' => 'http://www.php.net/manual/en/pdo.installation.php'
292
+ )
293
+ ),
294
+ 'pdo_mysql' => array(
295
+ 'label' => 'pdo_mysql',
296
+ 'recommended_value' => $this->renderBooleanField(true),
297
+ 'current_value' => $this->renderBooleanField($phpPdoMysql),
298
+ 'result' => $phpPdoMysql,
299
+ 'advice' => array(
300
+ 'label' => $this->__('PDO_MYSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MySQL 3.x, 4.x and 5.x databases.'),
301
+ 'link' => 'http://ua1.php.net/pdo_mysql#ref.pdo-mysql.installation'
302
+ )
303
+ ),
304
+ 'simplexml' => array(
305
+ 'label' => 'simplexml',
306
+ 'recommended_value' => $this->renderBooleanField(true),
307
+ 'current_value' => $this->renderBooleanField($phpSimplexml),
308
+ 'result' => $phpSimplexml,
309
+ 'advice' => array(
310
+ 'label' => $this->__('The SimpleXML extension provides a very simple and easily usable toolset to convert XML to an object that can be processed with normal property selectors and array iterators.'),
311
+ 'link' => 'http://www.php.net/manual/en/simplexml.installation.php'
312
+ )
313
+ )
314
+ );
315
+ $system->setData('requirements', new Varien_Object($requirements));
316
+
317
+ $magento_api = array();
318
+ $magento_api['charset'] = Mage::getStoreConfig("api/config/charset");
319
+ $magento_api_session_timeout = Mage::getStoreConfig('api/config/session_timeout');
320
+ $magento_api['session_timeout'] = array(
321
+ 'result' => ($magento_api_session_timeout >= 3600),
322
+ 'current_value' => $magento_api_session_timeout,
323
+ 'label' => 'Client Session Timeout (sec.)',
324
+ 'recommended_value' => '>= 3600',
325
+ 'advice' => array(
326
+ 'label' => $this->__('This sets the maximum time in seconds a script is allowed to use Magento Core API using one session ID.'),
327
+ 'link' => 'http://www.magentocommerce.com/boards/viewthread/19445/'
328
+ )
329
+ );
330
+ $magento_api['compliance_wsi'] = Mage::getStoreConfig(Mage_Api_Helper_Data::XML_PATH_API_WSI);;
331
+ $magento_api['wsdl_cache_enabled'] = Mage::getStoreConfig('api/config/wsdl_cache_enabled');
332
+ $system->setData('magento_api', new Varien_Object($magento_api));
333
+
334
+ $this->_system = $system;
335
+
336
+ return $this;
337
+ }
338
+
339
+ /**
340
+ * @return Varien_Object
341
+ */
342
+ public function getSystem()
343
+ {
344
+ return $this->_system;
345
+ }
346
+
347
+ /**
348
+ * @param boolean $value
349
+ * @return string
350
+ */
351
+ public function renderBooleanField($value)
352
+ {
353
+ if ($value) {
354
+ return $this->__('Enabled');
355
+ }
356
+ return $this->__('Disabled');
357
+ }
358
+
359
+ /**
360
+ * @param $result
361
+ * @return string
362
+ */
363
+ public function renderRequirementValue($result)
364
+ {
365
+ if ($result) {
366
+ return 'requirement-passed';
367
+ }
368
+ return 'requirement-failed';
369
+ }
370
+
371
+ /**
372
+ * @param $result
373
+ * @return string
374
+ */
375
+ public function renderStatusField($value)
376
+ {
377
+ if ($value) {
378
+ return $this->__('Ok');
379
+ }
380
+ return $this->__('Error');
381
+ }
382
+ public function renderAdvice($value)
383
+ {
384
+ if (!empty($value) && !empty($value['advice'])) {
385
+ return '<a ' . (!empty($value['advice']['link']) ? 'href="' . $value['advice']['link'] . '" target="_blank"' : 'href="#"') . '" class="iceimport-advice" title="' . $value['advice']['label'] . '"></a>';
386
+ }
387
+ return '';
388
+ }
389
+
390
+ /**
391
+ * Retrieve a collection of all modules
392
+ *
393
+ * @return Varien_Data_Collection Collection
394
+ */
395
+ public function getModulesCollection($exact = false)
396
+ {
397
+ $sortValue = Mage::app()->getRequest()->getParam('sort', 'name');
398
+ $sortValue = strtolower($sortValue);
399
+
400
+ $sortDir = Mage::app()->getRequest()->getParam('dir', 'ASC');
401
+ $sortDir = strtoupper($sortDir);
402
+
403
+ $modules = $this->_loadModules($exact);
404
+ $modules = Mage::helper('icecatlive')->sortMultiDimArr($modules, $sortValue, $sortDir);
405
+
406
+
407
+ $collection = new Varien_Data_Collection();
408
+ foreach ($modules as $key => $val) {
409
+ $item = new Varien_Object($val);
410
+ $collection->addItem($item);
411
+ }
412
+
413
+ return $collection;
414
+ }
415
+
416
+ /**
417
+ * Loads the module configurations and checks for some criteria and
418
+ * returns an array with the current modules in the Magento instance.
419
+ *
420
+ * @return array Modules
421
+ */
422
+ protected function _loadModules($exact = false)
423
+ {
424
+ $modules = array();
425
+ $config = Mage::getConfig();
426
+ foreach ($config->getNode('modules')->children() as $moduleName => $item) {
427
+ if (!empty($exact) && strlen($exact) != 0) {
428
+ if (strpos(strtolower($moduleName), strtolower($exact)) === false) {
429
+ continue;
430
+ }
431
+ }
432
+
433
+
434
+ $active = ($item->active == 'true') ? true : false;
435
+ $codePool = (string) $config->getModuleConfig($item->getName())->codePool;
436
+ $path = $config->getOptions()->getCodeDir() . DS . $codePool . DS . uc_words($item->getName(), DS);
437
+ $pathExists = file_exists($path);
438
+ $pathExists = $pathExists ? true : false;
439
+ $configExists = file_exists($path . '/etc/config.xml');
440
+ $configExists = $configExists ? true : false;
441
+ $version = (string) $config->getModuleConfig($item->getName())->version;
442
+ $dependencies = '-';
443
+ if ($item->depends) {
444
+ $depends = array();
445
+ foreach ($item->depends->children() as $depend) {
446
+ $depends[] = $depend->getName();
447
+ }
448
+ if (is_array($depends) && count($depends) > 0) {
449
+ asort($depends);
450
+ $dependencies = implode("\n", $depends);
451
+ }
452
+ }
453
+
454
+ $modules[$item->getName()] = array(
455
+ 'name' => $item->getName(),
456
+ 'active' => $active,
457
+ 'code_pool' => $codePool,
458
+ 'path' => $path,
459
+ 'path_exists' => $pathExists,
460
+ 'config_exists' => $configExists,
461
+ 'version' => $version,
462
+ 'dependencies' => $dependencies
463
+ );
464
+ }
465
+ return $modules;
466
+ }
467
+
468
+
469
+ /**
470
+ * Retrieve a collection of all rewrites
471
+ *
472
+ * @return Varien_Data_Collection Collection
473
+ */
474
+ public function getRewriteCollection($exact = false)
475
+ {
476
+ $collection = new Varien_Data_Collection();
477
+ $rewrites = $this->_loadRewrites();
478
+
479
+ foreach ($rewrites as $rewriteNodes) {
480
+ foreach ($rewriteNodes as $n) {
481
+ $nParent = $n->xpath('..');
482
+ $module = (string) $nParent[0]->getName();
483
+ $nSubParent = $nParent[0]->xpath('..');
484
+ $component = (string) $nSubParent[0]->getName();
485
+
486
+ if (!in_array($component, array('blocks', 'helpers', 'models'))) {
487
+ continue;
488
+ }
489
+
490
+ $pathNodes = $n->children();
491
+ foreach ($pathNodes as $pathNode) {
492
+ $path = (string) $pathNode->getName();
493
+ $completePath = $module.'/'.$path;
494
+ $rewriteClassName = (string) $pathNode;
495
+
496
+ if (!empty($exact) && strlen($exact) != 0) {
497
+ if ((strpos(strtolower($completePath), strtolower($exact)) === false)
498
+ && (strpos(strtolower($rewriteClassName), strtolower($exact)) === false)) {
499
+ continue;
500
+ }
501
+ }
502
+
503
+ $instance = Mage::getConfig()->getGroupedClassName(
504
+ substr($component, 0, -1),
505
+ $completePath
506
+ );
507
+
508
+ $collection->addItem(
509
+ new Varien_Object(
510
+ array(
511
+ 'path' => $completePath,
512
+ 'rewrite_class' => $rewriteClassName,
513
+ 'active_class' => $instance,
514
+ 'status' => ($instance == $rewriteClassName)
515
+ )
516
+ )
517
+ );
518
+ }
519
+ }
520
+ }
521
+
522
+ return $collection;
523
+ }
524
+
525
+ /**
526
+ * Return all rewrites
527
+ *
528
+ * @return array All rwrites
529
+ */
530
+ protected function _loadRewrites()
531
+ {
532
+ $fileName = 'config.xml';
533
+ $modules = Mage::getConfig()->getNode('modules')->children();
534
+
535
+ $return = array();
536
+ foreach ($modules as $modName => $module) {
537
+ if ($module->is('active')) {
538
+ $configFile = Mage::getConfig()->getModuleDir('etc', $modName) . DS . $fileName;
539
+ if (file_exists($configFile)) {
540
+ $xml = file_get_contents($configFile);
541
+ $xml = simplexml_load_string($xml);
542
+
543
+ if ($xml instanceof SimpleXMLElement) {
544
+ $return[$modName] = $xml->xpath('//rewrite');
545
+ }
546
+ }
547
+ }
548
+ }
549
+
550
+ return $return;
551
+ }
552
+
553
+ /**
554
+ * @return Varien_Object
555
+ */
556
+ public function getExtensionProblemsDigest()
557
+ {
558
+ $problems = array();
559
+ $count = 0;
560
+ //extension problems
561
+ // $check_module = $this->getModulesCollection(Mage::app()->getRequest()->getModuleName());
562
+ $check_module = $this->getModulesCollection('Iceshop_Icecatlive');
563
+ $check_module = $check_module->getLastItem()->getData();
564
+
565
+ if (!$check_module['path_exists']) {
566
+ // $problems['extension']['path_exists'] = $check_module['path_exists'];
567
+ $problems['extension']['path_exists'][] = $check_module['path'];
568
+ $count++;
569
+ }
570
+ if (!$check_module['config_exists']) {
571
+ // $problems['extension']['config_exists'] = $check_module['config_exists'];
572
+ $problems['extension']['config_exists'][] = $check_module['path'] . '/etc/config.xml';
573
+ $count++;
574
+ }
575
+ //extension rewrites problems
576
+ // $check_rewrites = $this->getRewriteCollection(Mage::app()->getRequest()->getModuleName());
577
+ $check_rewrites = $this->getRewriteCollection('Iceshop_Icecatlive');
578
+
579
+ foreach ($check_rewrites as $rewrite) {
580
+ if (!$rewrite['status']) {
581
+ $problems['rewrite'][] = $rewrite;
582
+ $count++;
583
+ }
584
+ }
585
+
586
+ //system requirements (for magento/extension)
587
+ $requirements = $this->getSystem()->getRequirements()->getData();
588
+ foreach ($requirements as $requirement) {
589
+ if (!$requirement['result']) {
590
+ $problems['requirement'][] = $requirement;
591
+ $count++;
592
+ }
593
+ }
594
+
595
+ //magento API problems
596
+ $magento_api_session_timeout = $this->getSystem()->getMagentoApi()->getSessionTimeout();
597
+ if (!$magento_api_session_timeout['result']) {
598
+ $problems['api']['timeout'] = $magento_api_session_timeout;
599
+ $count++;
600
+ }
601
+
602
+ $mysql = $this->getSystem()->getMysql()->getData();
603
+ foreach ($mysql as $mysql_param_name => $mysql_param_value) {
604
+ if (is_array($mysql_param_value) && !$mysql_param_value['result']) {
605
+ $problems['mysql'][$mysql_param_name] = $mysql_param_value;
606
+ $count++;
607
+ }
608
+ }
609
+
610
+ $problems_digest = new Varien_Object();
611
+ $problems_digest->setData('problems', $problems);
612
+ $problems_digest->setData('count', $count);
613
+ return $problems_digest;
614
+ }
615
+ }
app/code/local/Iceshop/Icecatlive/Model/Catalog/Category.php CHANGED
@@ -1,19 +1,20 @@
1
- <?php
2
- /**
3
- * class overrides category getProductCollection function to provide products with needed attributes
4
- *
5
- */
6
- class Iceshop_Icecatlive_Model_Catalog_Category extends Mage_Catalog_Model_Category
7
- {
8
- /**
9
- * add product manufacturer attribute to category collection
10
- */
11
- public function getProductCollection()
12
- {
13
- $collection = parent::getProductCollection();
14
- $collection->addAttributeToSelect(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
15
- return $collection;
16
- }
17
- }
18
-
 
19
  ?>
1
+ <?php
2
+ /**
3
+ * class overrides category getProductCollection function to provide products with needed attributes
4
+ *
5
+ */
6
+ class Iceshop_Icecatlive_Model_Catalog_Category extends Mage_Catalog_Model_Category
7
+ {
8
+ /**
9
+ * add product manufacturer attribute to category collection
10
+ */
11
+ public function getProductCollection()
12
+ {
13
+ $collection = parent::getProductCollection();
14
+
15
+ $collection->addAttributeToSelect(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
16
+ return $collection;
17
+ }
18
+ }
19
+
20
  ?>
app/code/local/Iceshop/Icecatlive/Model/Catalog/Product.php CHANGED
@@ -1,237 +1,229 @@
1
- <?php
2
- /**
3
- * Class overrides base Product Model to provide products icecat data
4
- *
5
- */
6
- class Iceshop_Icecatlive_Model_Catalog_Product extends Mage_Catalog_Model_Product
7
- {
8
-
9
- public function getName()
10
- {
11
-
12
- $productNamePriority = Mage::getStoreConfig('icecat_root/icecat/name_priority');
13
- if ($productNamePriority == 'Db') {
14
- return parent::getName();
15
- }
16
-
17
- try {
18
- self::$_product_source = '';
19
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
20
- $manufacturerId = $this->getData(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
21
- $mpn = $this->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
22
- $ean_code = $this->getData(Mage::getStoreConfig('icecat_root/icecat/ean_code'));
23
-
24
-
25
- $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
26
- ->setCodeFilter(Mage::getStoreConfig('icecat_root/icecat/manufacturer'))
27
- ->setEntityTypeFilter($this->getResource()->getTypeId())
28
- ->getFirstItem();
29
- switch ($attributeInfo->getData('backend_type')) {
30
- case 'int':
31
- $attribute = $attributeInfo->setEntity($this->getResource());
32
- $manufacturer = $attribute->getSource()->getOptionText($manufacturerId);
33
- break;
34
- default:
35
- $manufacturer = $manufacturerId;
36
- break;
37
- }
38
- if(!empty($mpn) && !empty($manufacturer)){
39
- $tableName = Mage::getSingleton('core/resource')->getTableName('icecatlive/data_products');
40
- $selectCondition = $connection->select()
41
- ->from(array('connector' => $tableName), new Zend_Db_Expr('connector.prod_title'))
42
- ->where('connector.prod_id = ? ', $mpn)->where('connector.supplier_symbol = ? ', $manufacturer);
43
- $icecatName = $connection->fetchOne($selectCondition);
44
- }
45
- if(empty($icecatName) && !empty($ean_code)){
46
- $tableName = Mage::getSingleton('core/resource')->getTableName('icecatlive/data_products');
47
- $selectCondition = $connection->select()
48
- ->from(array('connector' => $tableName), new Zend_Db_Expr('connector.prod_title'))
49
- ->where('connector.prod_ean = ? ', $ean_code);
50
- $icecatName = $connection->fetchOne($selectCondition);
51
- }
52
- } catch (Exception $e) {
53
- Mage::log('Icecat getName error' . $e);
54
- }
55
-
56
- $product_name = !empty($icecatName) ? $icecatName : parent::getName();
57
-
58
- return $product_name;
59
- }
60
-
61
-
62
- public function getImage()
63
- {
64
- if (!parent::getImage() || parent::getImage() == 'no_selection') {
65
- return "true";
66
- } else {
67
- return parent::getImage();
68
- }
69
- }
70
-
71
- public function getShortDescription()
72
- {
73
-
74
- if (!isset(self::$_product_source)) {
75
- $this->checkIcecatProdDescription();
76
- }
77
-
78
- $source = self::$_product_source;
79
-
80
- if ('Icecat' == Mage::getStoreConfig('icecat_root/icecat/descript_priority') and $source != 'DB') {
81
- return true;
82
- } else {
83
- return parent::getShortDescription();
84
- }
85
- }
86
-
87
- public function getDescription()
88
- {
89
-
90
- if (!isset(self::$_product_source)) {
91
- $this->checkIcecatProdDescription();
92
- }
93
-
94
- $source = self::$_product_source;
95
-
96
-
97
- if ('Icecat' == Mage::getStoreConfig('icecat_root/icecat/descript_priority') and $source != 'DB') {
98
- return true;
99
- } else {
100
- return parent::getDescription();
101
- }
102
- }
103
-
104
- public function checkIcecatProdDescription($productId = '', $attributeName = '')
105
- {
106
-
107
- $iceImport = new Iceshop_Icecatlive_Model_Import();
108
-
109
- if (empty($productId)) {
110
- $productId = Mage::registry('current_product')->getId();
111
- }
112
-
113
-
114
- $model = Mage::getModel('catalog/product');
115
- $_product = $model->load($productId);
116
-
117
- $mpn = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
118
- $ean_code = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/ean_code'));
119
- $manufacturerId = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
120
- $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
121
- ->setCodeFilter(Mage::getStoreConfig('icecat_root/icecat/manufacturer'))
122
- ->setEntityTypeFilter($this->getResource()->getTypeId())
123
- ->getFirstItem();
124
-
125
- if ($attributeInfo->getData('backend_type') == 'int' ||
126
- ($attributeInfo->getData('frontend_input') == 'select' && $attributeInfo->getData('backend_type') == 'static')
127
- ) {
128
- $attribute = $attributeInfo->setEntity($_product->getResource());
129
- $manufacturer = $attribute->getSource()->getOptionText($manufacturerId);
130
- } else {
131
- $manufacturer = $manufacturerId;
132
- }
133
- $locale = Mage::getStoreConfig('icecat_root/icecat/language');
134
- if ($locale == '0') {
135
- $systemLocale = explode("_", Mage::app()->getLocale()->getLocaleCode());
136
- $locale = $systemLocale[0];
137
- }
138
- $userLogin = Mage::getStoreConfig('icecat_root/icecat/login');
139
- $userPass = Mage::getStoreConfig('icecat_root/icecat/password');
140
- $entityId = $_product->getEntityId();
141
-
142
- $descr[1] = false;
143
- $descr[0] = $iceImport->getProductDescription($mpn, $manufacturer, $locale, $userLogin, $userPass, $entityId, $ean_code);
144
-
145
- if (!empty($iceImport->simpleDoc)) {
146
-
147
- $productTag = $iceImport->simpleDoc->Product;
148
- $descr[1] = (string)$productTag->ProductDescription['ShortDesc'];
149
- } else if (!empty($descr[0]) && $attributeName == 'short_description') {
150
- $descr[1] = $iceImport->getShortProductDescription();
151
- }
152
- if ($descr[0] == false and $descr[1] == false) {
153
- self::$_product_source = 'DB';
154
- } else if ($attributeName == 'short_description') {
155
- self::$_product_source = '';
156
- return $descr[1];
157
- } else if ($attributeName == 'name') {
158
- self::$_product_source = '';
159
- return $iceImport->getProductName();
160
- } else {
161
- self::$_product_source = '';
162
- }
163
- }
164
-
165
-
166
- /**
167
- * Entity code.
168
- * Can be used as part of method name for entity processing
169
- */
170
- const ENTITY = 'catalog_product';
171
-
172
- const CACHE_TAG = 'catalog_product';
173
- protected $_cacheTag = 'catalog_product';
174
- protected $_eventPrefix = 'catalog_product';
175
- protected $_eventObject = 'product';
176
- protected $_canAffectOptions = false;
177
-
178
- /**
179
- * Product type instance
180
- *
181
- * @var Mage_Catalog_Model_Product_Type_Abstract
182
- */
183
- protected $_typeInstance = null;
184
-
185
- /**
186
- * Product type instance as singleton
187
- */
188
- protected $_typeInstanceSingleton = null;
189
-
190
- /**
191
- * Product link instance
192
- *
193
- * @var Mage_Catalog_Model_Product_Link
194
- */
195
- protected $_linkInstance;
196
-
197
- /**
198
- * Product object customization (not stored in DB)
199
- *
200
- * @var array
201
- */
202
- protected $_customOptions = array();
203
-
204
- /**
205
- * Product Url Instance
206
- *
207
- * @var Mage_Catalog_Model_Product_Url
208
- */
209
- protected $_urlModel = null;
210
- protected static $_url;
211
- protected static $_urlRewrite;
212
- protected $_errors = array();
213
- protected $_optionInstance;
214
- protected $_options = array();
215
-
216
- /**
217
- * Product reserved attribute codes
218
- */
219
- protected $_reservedAttributes;
220
-
221
- /**
222
- * Flag for available duplicate function
223
- *
224
- * @var boolean
225
- */
226
- protected $_isDuplicable = true;
227
-
228
- /**
229
- * Source of product data
230
- *
231
- * @var string
232
- */
233
- public static $_product_source = '';
234
-
235
- }
236
-
237
- ?>
1
+ <?php
2
+ /**
3
+ * Class overrides base Product Model to provide products icecat data
4
+ *
5
+ */
6
+ class Iceshop_Icecatlive_Model_Catalog_Product extends Mage_Catalog_Model_Product
7
+ {
8
+
9
+ public function getName()
10
+ {
11
+ $productNamePriority = Mage::getStoreConfig('icecat_root/icecat/name_priority');
12
+ if ($productNamePriority == 'Db') {
13
+ return parent::getName();
14
+ }
15
+
16
+ try {
17
+ self::$_product_source = '';
18
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
19
+ $entity_id = $this->getId();
20
+ $manufacturerId = $this->getData(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
21
+ $mpn = $this->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
22
+ $ean_code = $this->getData(Mage::getStoreConfig('icecat_root/icecat/ean_code'));
23
+
24
+
25
+ $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
26
+ ->setCodeFilter(Mage::getStoreConfig('icecat_root/icecat/manufacturer'))
27
+ ->setEntityTypeFilter($this->getResource()->getTypeId())
28
+ ->getFirstItem();
29
+ switch ($attributeInfo->getData('backend_type')) {
30
+ case 'int':
31
+ $attribute = $attributeInfo->setEntity($this->getResource());
32
+ $manufacturer = $attribute->getSource()->getOptionText($manufacturerId);
33
+ break;
34
+ default:
35
+ $manufacturer = $manufacturerId;
36
+ break;
37
+ }
38
+ if(!empty($entity_id)){
39
+ $tableName = Mage::getSingleton('core/resource')->getTableName('icecatlive/products_titles');
40
+ $selectCondition = $connection->select()
41
+ ->from(array('connector' => $tableName), new Zend_Db_Expr('connector.prod_title'))
42
+ ->where('connector.prod_id = ? ', $entity_id);
43
+ $icecatName = $connection->fetchOne($selectCondition);
44
+ }
45
+ } catch (Exception $e) {
46
+ Mage::log('Icecat getName error' . $e);
47
+ }
48
+ $product_name = !empty($icecatName) ? $icecatName : parent::getName();
49
+
50
+ return $product_name;
51
+ }
52
+
53
+
54
+ public function getImage()
55
+ {
56
+ if (!parent::getImage() || parent::getImage() == 'no_selection') {
57
+ return "true";
58
+ } else {
59
+ return parent::getImage();
60
+ }
61
+ }
62
+
63
+ public function getShortDescription()
64
+ {
65
+
66
+ if (!isset(self::$_product_source)) {
67
+ $this->checkIcecatProdDescription();
68
+ }
69
+
70
+ $source = self::$_product_source;
71
+
72
+ if ('Icecat' == Mage::getStoreConfig('icecat_root/icecat/descript_priority') and $source != 'DB') {
73
+ return true;
74
+ } else {
75
+ return parent::getShortDescription();
76
+ }
77
+ }
78
+
79
+ public function getDescription()
80
+ {
81
+
82
+ if (!isset(self::$_product_source)) {
83
+ $this->checkIcecatProdDescription();
84
+ }
85
+
86
+ $source = self::$_product_source;
87
+
88
+
89
+ if ('Icecat' == Mage::getStoreConfig('icecat_root/icecat/descript_priority') and $source != 'DB') {
90
+ return true;
91
+ } else {
92
+ return parent::getDescription();
93
+ }
94
+ }
95
+
96
+ public function checkIcecatProdDescription($productId = '', $attributeName = '')
97
+ {
98
+
99
+ $iceImport = new Iceshop_Icecatlive_Model_Import();
100
+
101
+ if (empty($productId)) {
102
+ $productId = Mage::registry('current_product')->getId();
103
+ }
104
+
105
+
106
+ $model = Mage::getModel('catalog/product');
107
+ $_product = $model->load($productId);
108
+
109
+ $mpn = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
110
+ $ean_code = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/ean_code'));
111
+ $manufacturerId = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
112
+ $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
113
+ ->setCodeFilter(Mage::getStoreConfig('icecat_root/icecat/manufacturer'))
114
+ ->setEntityTypeFilter($this->getResource()->getTypeId())
115
+ ->getFirstItem();
116
+
117
+ if ($attributeInfo->getData('backend_type') == 'int' ||
118
+ ($attributeInfo->getData('frontend_input') == 'select' && $attributeInfo->getData('backend_type') == 'static')
119
+ ) {
120
+ $attribute = $attributeInfo->setEntity($_product->getResource());
121
+ $manufacturer = $attribute->getSource()->getOptionText($manufacturerId);
122
+ } else {
123
+ $manufacturer = $manufacturerId;
124
+ }
125
+ $locale = Mage::getStoreConfig('icecat_root/icecat/language');
126
+ if ($locale == '0') {
127
+ $systemLocale = explode("_", Mage::app()->getLocale()->getLocaleCode());
128
+ $locale = $systemLocale[0];
129
+ }
130
+ $userLogin = Mage::getStoreConfig('icecat_root/icecat/login');
131
+ $userPass = Mage::getStoreConfig('icecat_root/icecat/password');
132
+ $entityId = $_product->getEntityId();
133
+
134
+ $descr[1] = false;
135
+ $descr[0] = $iceImport->getProductDescription($mpn, $manufacturer, $locale, $userLogin, $userPass, $entityId, $ean_code);
136
+
137
+ if (!empty($iceImport->simpleDoc)) {
138
+
139
+ $productTag = $iceImport->simpleDoc->Product;
140
+ $descr[1] = (string)$productTag->ProductDescription['ShortDesc'];
141
+ } else if (!empty($descr[0]) && $attributeName == 'short_description') {
142
+ $descr[1] = $iceImport->getShortProductDescription();
143
+ }
144
+ if ($descr[0] == false and $descr[1] == false) {
145
+ self::$_product_source = 'DB';
146
+ } else if ($attributeName == 'short_description') {
147
+ self::$_product_source = '';
148
+ return $descr[1];
149
+ } else if ($attributeName == 'name') {
150
+ self::$_product_source = '';
151
+ return $iceImport->getProductName();
152
+ } else {
153
+ self::$_product_source = '';
154
+ }
155
+ }
156
+
157
+
158
+ /**
159
+ * Entity code.
160
+ * Can be used as part of method name for entity processing
161
+ */
162
+ const ENTITY = 'catalog_product';
163
+
164
+ const CACHE_TAG = 'catalog_product';
165
+ protected $_cacheTag = 'catalog_product';
166
+ protected $_eventPrefix = 'catalog_product';
167
+ protected $_eventObject = 'product';
168
+ protected $_canAffectOptions = false;
169
+
170
+ /**
171
+ * Product type instance
172
+ *
173
+ * @var Mage_Catalog_Model_Product_Type_Abstract
174
+ */
175
+ protected $_typeInstance = null;
176
+
177
+ /**
178
+ * Product type instance as singleton
179
+ */
180
+ protected $_typeInstanceSingleton = null;
181
+
182
+ /**
183
+ * Product link instance
184
+ *
185
+ * @var Mage_Catalog_Model_Product_Link
186
+ */
187
+ protected $_linkInstance;
188
+
189
+ /**
190
+ * Product object customization (not stored in DB)
191
+ *
192
+ * @var array
193
+ */
194
+ protected $_customOptions = array();
195
+
196
+ /**
197
+ * Product Url Instance
198
+ *
199
+ * @var Mage_Catalog_Model_Product_Url
200
+ */
201
+ protected $_urlModel = null;
202
+ protected static $_url;
203
+ protected static $_urlRewrite;
204
+ protected $_errors = array();
205
+ protected $_optionInstance;
206
+ protected $_options = array();
207
+
208
+ /**
209
+ * Product reserved attribute codes
210
+ */
211
+ protected $_reservedAttributes;
212
+
213
+ /**
214
+ * Flag for available duplicate function
215
+ *
216
+ * @var boolean
217
+ */
218
+ protected $_isDuplicable = true;
219
+
220
+ /**
221
+ * Source of product data
222
+ *
223
+ * @var string
224
+ */
225
+ public static $_product_source = '';
226
+
227
+ }
228
+
229
+ ?>
 
 
 
 
 
 
 
 
app/code/local/Iceshop/Icecatlive/Model/Catalog/Search.php CHANGED
@@ -1,15 +1,15 @@
1
- <?php
2
- /**
3
- * class overrides search getProductCollection function to provide products with needed attributes
4
- *
5
- */
6
- class Iceshop_Icecatlive_Model_Catalog_Search extends Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
7
- {
8
- public function _beforeLoad()
9
- {
10
- $this->addAttributeToSelect(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
11
- return parent::_beforeLoad();
12
- }
13
- }
14
-
15
  ?>
1
+ <?php
2
+ /**
3
+ * class overrides search getProductCollection function to provide products with needed attributes
4
+ *
5
+ */
6
+ class Iceshop_Icecatlive_Model_Catalog_Search extends Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
7
+ {
8
+ public function _beforeLoad()
9
+ {
10
+ $this->addAttributeToSelect(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
11
+ return parent::_beforeLoad();
12
+ }
13
+ }
14
+
15
  ?>
app/code/local/Iceshop/Icecatlive/Model/Imagescollection.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
-
3
- class Iceshop_Icecatlive_Model_Imagescollection extends Varien_Data_Collection
4
- {
5
-
6
- protected $_data = array();
7
-
8
- public function __construct()
9
- {
10
- parent::__construct();
11
-
12
- // not extends Varien_Object
13
- $args = func_get_args();
14
- if (empty($args[0])) {
15
- $args[0] = array();
16
- }
17
- $this->_data = $args[0];
18
- if (isset($this->_data['product'])) {
19
-
20
- $helper = new Iceshop_Icecatlive_Helper_Image();
21
- if (isset($this->_data['is_media']) && $this->_data['is_media']) {
22
- // add product main image also
23
- // @todo @someday if needed add product image also
24
- }
25
- $gallery = $helper->getGallery();
26
-
27
- foreach ($gallery as $item) {
28
- $this->addItem($this->convertIcecatImageToVarienObject($item));
29
- }
30
-
31
- }
32
- }
33
-
34
- private function convertIcecatImageToVarienObject($image)
35
- {
36
-
37
- $data = array(
38
- 'file' => $image['pic'],
39
- );
40
- $item = new Varien_Object();
41
- $item->addData($data);
42
- return $item;
43
- }
44
-
45
- }
46
-
47
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Iceshop/Icecatlive/Model/Import.php CHANGED
@@ -1,616 +1,534 @@
1
- <?php
2
- /**
3
- * Class performs Curl request to ICEcat and fetches xml data with product description
4
- *
5
- */
6
- class Iceshop_Icecatlive_Model_Import extends Mage_Core_Model_Abstract
7
- {
8
-
9
- public $entityId;
10
- private $productDescriptionList = array();
11
- private $productDescription;
12
- private $fullProductDescription;
13
- private $lowPicUrl;
14
- private $highPicUrl;
15
- private $errorMessage;
16
- private $galleryPhotos = array();
17
- private $productName;
18
- private $relatedProducts = array();
19
- private $thumb;
20
- private $errorSystemMessage; //depricated
21
- private $_cacheKey = 'iceshop_icecatlive_';
22
-
23
- private $_warrantyInfo = '';
24
- private $_shortSummaryDesc = '';
25
- private $_longSummaryDesc = '';
26
-
27
- private $_manualPdfUrl = '';
28
- private $_pdfUrl = '';
29
- private $_multimedia = '';
30
-
31
- protected function _construct()
32
- {
33
- $this->_init('icecatlive/import');
34
- }
35
-
36
- /**
37
- * Perform Curl request with corresponding param check and error processing
38
- * @param int $productId
39
- * @param string $vendorName
40
- * @param string $locale
41
- * @param string $userName
42
- * @param string $userPass
43
- */
44
- public function getProductDescription($productId, $vendorName, $locale, $userName, $userPass, $entityId, $ean_code)
45
- {
46
- $current_page = Mage::app()->getFrontController()->getRequest()->getControllerName();
47
-
48
- if($current_page == 'product'){
49
-
50
- $this->entityId = $entityId;
51
- $error = '';
52
- if (null === $this->simpleDoc) {
53
-
54
- if (!$cacheDataXml = Mage::app()->getCache()->load($this->_cacheKey . $entityId . '_' . $locale)) {
55
-
56
- $dataUrl = 'http://data.icecat.biz/xml_s3/xml_server3.cgi';
57
- $successRespondByMPNVendorFlag = false;
58
- if (empty($userName)) {
59
- $this->errorMessage = "No ICEcat login provided";
60
- return false;
61
- }
62
- if (empty($userPass)) {
63
- $this->errorMessage = "No ICEcat password provided";
64
- return false;
65
- }
66
- if (empty($locale)) {
67
- $this->errorMessage = "Please specify product description locale";
68
- return false;
69
- }
70
- if ((empty($productId) && empty($ean_code))
71
- || (empty($vendorName) && empty($ean_code))
72
- ) {
73
- $this->errorMessage = 'Given product has invalid IceCat data';
74
- return false;
75
- }
76
-
77
- if (!empty($productId) && !empty($vendorName)) {
78
-
79
- $resultString = $this->_getIceCatData($userName, $userPass, $dataUrl, array(
80
- "prod_id" => $productId,
81
- "lang" => $locale,
82
- "vendor" => $vendorName,
83
- "output" => 'productxml'
84
- ));
85
-
86
- if ($this->parseXml($resultString)) {
87
- if (!$this->checkIcecatResponse()) {
88
- $successRespondByMPNVendorFlag = true;
89
- }
90
- }
91
-
92
- }
93
- // if get data by MPN & brand name wrong => trying by Ean code
94
- if (!$successRespondByMPNVendorFlag) {
95
- if (!empty($ean_code)) {
96
- $resultString = $this->_getIceCatData($userName, $userPass, $dataUrl, array(
97
- 'ean_upc' => trim($ean_code),
98
- 'lang' => $locale,
99
- 'output' => 'productxml'
100
- ));
101
- if (!$this->parseXml($resultString)) {
102
- $error = true;
103
- $this->simpleDoc = null;
104
- }
105
- if ($this->checkIcecatResponse()) {
106
- $error = true;
107
- $this->simpleDoc = null;
108
- }
109
- } else {
110
- $error = true;
111
- }
112
- if ($error) {
113
- $this->errorMessage = 'Given product has invalid IceCat data';
114
- return false;
115
- }
116
- }
117
-
118
- Mage::app()->getCache()->save($resultString, $this->_cacheKey . $entityId . '_' . $locale);
119
- } else {
120
- $resultString = $cacheDataXml;
121
-
122
- if (!$this->parseXml($resultString)) {
123
- return false;
124
- }
125
- if ($this->checkIcecatResponse()) {
126
- return false;
127
- }
128
- }
129
-
130
- $this->loadProductDescriptionList();
131
- $this->loadOtherProductParams($productId);
132
- $this->loadGalleryPhotos();
133
- Varien_Profiler::start('Iceshop FILE RELATED');
134
- $this->loadRelatedProducts();
135
- Varien_Profiler::stop('Iceshop FILE RELATED');
136
- }
137
- return true;
138
- }
139
- }
140
-
141
- private function _getIceCatData($userName, $userPass, $dataUrl, $productAttributes)
142
- {
143
- try {
144
-
145
- $webClient = new Zend_Http_Client();
146
- $webClient->setUri($dataUrl);
147
- $webClient->setMethod(Zend_Http_Client::GET);
148
- $webClient->setHeaders('Content-Type: text/xml; charset=UTF-8');
149
- $webClient->setParameterGet($productAttributes);
150
- $webClient->setAuth($userName, $userPass, Zend_Http_CLient::AUTH_BASIC);
151
- $response = $webClient->request();
152
- if ($response->isError()) {
153
- $this->errorMessage = 'Response Status: ' . $response->getStatus() . " Response Message: " . $response->getMessage();
154
- return false;
155
- }
156
- } catch (Exception $e) {
157
- $this->errorMessage = "Warning: cannot connect to ICEcat. {$e->getMessage()}";
158
- return false;
159
- }
160
- return $response->getBody();
161
- }
162
-
163
- public function getSystemError()
164
- {
165
- return $this->errorSystemMessage;
166
- }
167
-
168
- public function getProductName()
169
- {
170
- return $this->productName;
171
- }
172
-
173
- public function getGalleryPhotos()
174
- {
175
-
176
- return $this->galleryPhotos;
177
- }
178
-
179
- public function getThumbPicture()
180
- {
181
- return $this->thumb;
182
- }
183
-
184
- public function getImg($productId)
185
- {
186
-
187
- $model = Mage::getModel('catalog/product');
188
- $_product = $model->load($productId);
189
- $entity_id = $_product->getEntityId();
190
- $ean_code = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/ean_code'));
191
- $vendorName = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
192
- $locale = Mage::getStoreConfig('icecat_root/icecat/language');
193
- if ($locale == '0') {
194
- $systemLocale = explode("_", Mage::app()->getLocale()->getLocaleCode());
195
- $locale = $systemLocale[0];
196
- }
197
- $userLogin = Mage::getStoreConfig('icecat_root/icecat/login');
198
- $userPass = Mage::getStoreConfig('icecat_root/icecat/password');
199
- $mpn = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
200
- $this->getProductDescription($mpn, $vendorName, $locale, $userLogin, $userPass, $entity_id, $ean_code);
201
- if ($this->simpleDoc) {
202
- return $this->highPicUrl;
203
- }
204
- }
205
-
206
- /**
207
- * load Gallery array from XML
208
- */
209
- private function loadGalleryPhotos()
210
- {
211
- $Imagepriority = Mage::getStoreConfig('icecat_root/icecat/image_priority');
212
- if($Imagepriority != 'Db'){
213
- $galleryPhotos = $this->simpleDoc->Product->ProductGallery->ProductPicture;
214
- if (!count($galleryPhotos)) {
215
- return false;
216
- }
217
- foreach ($galleryPhotos as $photo) {
218
- if ($photo["Size"] > 0) {
219
- $picUrl = (string)$photo["Pic"];
220
- if (!empty($picUrl) && strpos($picUrl, 'feature_logo') <= 0) {
221
- $picHeight = (int)$photo["PicHeight"];
222
- $picWidth = (int)$photo["PicWidth"];
223
- $product_id = $this->entityId;
224
- $image_saved_file = $this->saveImg($product_id, $picUrl, 'file');
225
-
226
- array_push($this->galleryPhotos, array(
227
- 'height' => $picHeight,
228
- 'width' => $picWidth,
229
- 'pic' => $image_saved_file
230
- ));
231
- }
232
- }
233
- }
234
- }
235
- }
236
-
237
- public function getErrorMessage()
238
- {
239
- return $this->errorMessage;
240
- }
241
-
242
- /**
243
- * Checks response XML for error messages
244
- */
245
- private function checkIcecatResponse()
246
- {
247
- $errorMessage = $this->simpleDoc->Product['ErrorMessage'];
248
- if ($errorMessage != '') {
249
- if (preg_match('/^No xml data/', $errorMessage)) {
250
- $this->errorSystemMessage = $errorMessage;
251
- return true;
252
- }
253
- if (preg_match('/^The specified vendor does not exist$/', $errorMessage)) {
254
- $this->errorSystemMessage = $errorMessage;
255
- return true;
256
- }
257
- $this->errorMessage = "Ice Cat Error: " . $errorMessage;
258
- return true;
259
- }
260
- return false;
261
- }
262
-
263
- public function getProductDescriptionList()
264
- {
265
- return $this->productDescriptionList;
266
- }
267
-
268
- public function getShortProductDescription()
269
- {
270
- return $this->productDescription;
271
- }
272
-
273
- public function getFullProductDescription()
274
- {
275
- return $this->fullProductDescription;
276
- }
277
-
278
- public function getLowPicUrl()
279
- {
280
- return $this->highPicUrl;
281
- }
282
-
283
- public function getRelatedProducts()
284
- {
285
- return $this->relatedProducts;
286
- }
287
-
288
- public function getVendor()
289
- {
290
- return $this->vendor;
291
- }
292
-
293
- public function getMPN()
294
- {
295
- return $this->productId;
296
- }
297
-
298
- public function getEAN()
299
- {
300
- return $this->EAN;
301
- }
302
-
303
- public function getWarrantyInfo()
304
- {
305
- return $this->_warrantyInfo;
306
- }
307
-
308
- public function getShortSummaryDescription()
309
- {
310
- return $this->_shortSummaryDesc;
311
- }
312
-
313
- public function getLongSummaryDescription()
314
- {
315
- return $this->_longSummaryDesc;
316
- }
317
-
318
- public function getManualPDF()
319
- {
320
- return $this->_manualPdfUrl;
321
- }
322
-
323
- public function getPDF()
324
- {
325
- return $this->_pdfUrl;
326
- }
327
-
328
- public function getIceCatMedia()
329
- {
330
- return $this->_multimedia;
331
- }
332
-
333
- /**
334
- * Form related products Array
335
- */
336
- private function loadRelatedProducts()
337
- {
338
- $relatedProductsArray = $this->simpleDoc->Product->ProductRelated;
339
- if (count($relatedProductsArray)) {
340
- foreach ($relatedProductsArray as $product) {
341
- $productArray = array();
342
- $productNS = $product->Product;
343
- $productArray['name'] = (string)$productNS['Name'];
344
- $productArray['thumb'] = (string)$productNS['ThumbPic'];
345
- $mpn = (string)$productNS['Prod_id'];
346
- $productSupplier = $productNS->Supplier;
347
- $productSupplierId = (int)$productSupplier['ID'];
348
- $productArray['supplier_thumb'] = 'http://images2.icecat.biz/thumbs/SUP' . $productSupplierId . '.jpg';
349
- $productArray['supplier_name'] = (string)$productSupplier['Name'];
350
- $this->relatedProducts[$mpn] = $productArray;
351
- }
352
- }
353
- }
354
-
355
- /**
356
- * Form product feature Arrray
357
- */
358
- private function loadProductDescriptionList()
359
- {
360
- $descriptionArray = array();
361
- $specGroups = $this->simpleDoc->Product->CategoryFeatureGroup;
362
- $specFeatures = $this->simpleDoc->Product->ProductFeature;
363
- foreach ($specFeatures as $feature) {
364
- $id = (int)$feature['CategoryFeatureGroup_ID'];
365
- $featureText = (string)$feature["Presentation_Value"];
366
- $featureValue = (string)$feature["Value"];
367
- $featureName = (string)$feature->Feature->Name["Value"];
368
- if ($featureValue == 'Y' || $featureValue == 'N') {
369
- $featureText = $featureValue;
370
- }
371
- foreach ($specGroups as $group) {
372
- $groupId = (int)$group["ID"];
373
- if ($groupId == $id) {
374
- $groupName = (string)$group->FeatureGroup->Name["Value"];
375
- $rating = (int)$group['No'];
376
- $descriptionArray[$rating][$groupName][$featureName] = $featureText;
377
- break;
378
- }
379
- }
380
- }
381
- krsort($descriptionArray);
382
- $this->productDescriptionList = $descriptionArray;
383
- }
384
-
385
- /**
386
- * Form Array of non feature-value product params
387
- */
388
- private function loadOtherProductParams($productId)
389
- {
390
- $productTag = $this->simpleDoc->Product;
391
- $this->productDescription = (string)$productTag->ProductDescription['ShortDesc'];
392
- $this->fullProductDescription = (string)$productTag->ProductDescription['LongDesc'];
393
- $this->_warrantyInfo = (string)$productTag->ProductDescription['WarrantyInfo'];
394
- $this->_shortSummaryDesc = (string)$productTag->SummaryDescription->ShortSummaryDescription;
395
- $this->_longSummaryDesc = (string)$productTag->SummaryDescription->LongSummaryDescription;
396
- $this->_manualPdfUrl = (string)$productTag->ProductDescription['ManualPDFURL'];
397
- $this->_pdfUrl = (string)$productTag->ProductDescription['PDFURL'];
398
- $this->_multimedia = $productTag->ProductMultimediaObject->MultimediaObject;
399
-
400
- $Imagepriority = Mage::getStoreConfig('icecat_root/icecat/image_priority');
401
- if ($Imagepriority != 'Db') {
402
- if (!empty($productTag["HighPic"])) {
403
- $this->highPicUrl = $this->saveImg($this->entityId, (string)$productTag["HighPic"], 'image');
404
- } else if (!empty($productTag["LowPic"])) {
405
- $this->lowPicUrl = $this->saveImg($this->entityId, (string)$productTag["LowPic"], 'small');
406
- } else {
407
- $this->thumb = $this->saveImg($this->entityId, (string)$productTag["ThumbPic"], 'thumb');
408
- }
409
- }
410
- $this->productName = (string)$productTag["Title"];
411
- $this->productId = (string)$productTag['Prod_id'];
412
- $this->vendor = (string)$productTag->Supplier['Name'];
413
- $prodEAN = $productTag->EANCode;
414
- $EANstr = '';
415
- $EANarr = null;
416
- $j = 0; //counter
417
- foreach ($prodEAN as $ellEAN) {
418
- $EANarr[] = $ellEAN['EAN'];
419
- $j++;
420
- }
421
- $i = 0;
422
- $str = '';
423
- for ($i = 0; $i < $j; $i++) {
424
- $g = $i % 2;
425
- if ($g == '0') {
426
- if ($j == 1) {
427
- $str .= $EANarr[$i] . '<br>';
428
- } else {
429
- $str .= $EANarr[$i] . ', ';
430
- }
431
- } else {
432
- if ($i != $j - 1) {
433
- $str .= $EANarr[$i] . ', <br>';
434
- } else {
435
- $str .= $EANarr[$i] . ' <br>';
436
- }
437
- }
438
- }
439
- $this->EAN = $str;
440
- }
441
-
442
- /**
443
- * parse response XML: to SimpleXml
444
- * @param string $stringXml
445
- */
446
- private function parseXml($stringXml)
447
- {
448
- $current_page = Mage::app()->getFrontController()->getRequest()->getControllerName();
449
-
450
- if($current_page == 'product'){
451
- libxml_use_internal_errors(true);
452
- $this->simpleDoc = simplexml_load_string($stringXml);
453
- if ($this->simpleDoc) {
454
- return true;
455
- }
456
- $this->simpleDoc = simplexml_load_string(utf8_encode($stringXml));
457
- if ($this->simpleDoc) {
458
- return true;
459
- }
460
- }
461
- return false;
462
- }
463
-
464
- /**
465
- * save icecat img
466
- * @param int $productId
467
- * @param string $img_url
468
- * @param string $img_type
469
- */
470
- public function saveImg($productId, $img_url, $imgtype = '')
471
- {
472
- $pathinfo = pathinfo($img_url);
473
- $img_type = $pathinfo["extension"];
474
-
475
- if (strpos($img_url, 'high') > 0) {
476
- $img_name = str_replace("http://images.icecat.biz/img/norm/high/", "", $img_url);
477
- $img_name = md5($img_name);
478
- } else if (strpos($img_url, 'low') > 0) {
479
- $img_name = str_replace("http://images.icecat.biz/img/norm/low/", "", $img_url);
480
- $img_name = md5($img_name);
481
- } else {
482
- $img_name = md5($img_url);
483
- }
484
-
485
- $img = $img_name . "." . $img_type;
486
- $baseDir = Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath() . '/';
487
- $local_img = strstr($img_url, Mage::getStoreConfig('web/unsecure/base_url'));
488
-
489
- if (!file_exists($baseDir . $img) && !$local_img) {
490
- $client = new Zend_Http_Client($img_url);
491
- $content = $client->request();
492
- if ($content->isError()) {
493
- return $img_url;
494
- }
495
- $file = file_put_contents($baseDir . $img, $content->getBody());
496
- if ($file) {
497
- $this->addProductImageQuery($productId, $img, $imgtype);
498
- return $img;
499
- } else {
500
- return $img_url;
501
- }
502
- } else if ($local_img) {
503
- return $img_url;
504
- } else {
505
-
506
- $db = Mage::getSingleton('core/resource')->getConnection('core_write');
507
- $tablePrefix = (array)Mage::getConfig()->getTablePrefix();
508
- if (!empty($tablePrefix[0])) {
509
- $tablePrefix = $tablePrefix[0];
510
- } else {
511
- $tablePrefix = '';
512
- }
513
- $attr_query = "SELECT @product_entity_type_id := `entity_type_id` FROM `" . $tablePrefix . "eav_entity_type` WHERE
514
- entity_type_code = 'catalog_product';
515
- SELECT @attribute_set_id := `entity_type_id` FROM `" . $tablePrefix . "eav_entity_type` WHERE
516
- entity_type_code = 'catalog_product';
517
- SELECT @gallery := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
518
- `attribute_code` = 'media_gallery' AND entity_type_id = @product_entity_type_id;
519
- SELECT @base := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE `attribute_code` = 'image' AND entity_type_id = @product_entity_type_id;
520
- SELECT @small := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
521
- `attribute_code` = 'small_image' AND entity_type_id = @product_entity_type_id;
522
- SELECT @thumb := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
523
- `attribute_code` = 'thumbnail' AND entity_type_id = @product_entity_type_id;";
524
-
525
- $attr_set = Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId();
526
-
527
- $db->query($attr_query, array(':attribute_set' => $attr_set));
528
-
529
- $img_check = $db->fetchAll("SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity_varchar`
530
- WHERE attribute_id IN (@base ,@small,@thumb)
531
- AND entity_id =:entity_id AND value =:img ", array(
532
- ':entity_id' => $productId,
533
- ':img' => $img));
534
-
535
- $gal_check = $db->fetchAll("SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity_media_gallery`
536
- WHERE attribute_id = @gallery AND entity_id =:entity_id AND value =:img ", array(
537
- ':entity_id' => $productId,
538
- ':img' => $img));
539
- if ((isset($img_check[0]["COUNT(*)"]) && isset($gal_check[0]["COUNT(*)"]))
540
- && ($img_check[0]["COUNT(*)"] == 0 && $gal_check[0]["COUNT(*)"] == 0)
541
- ) {
542
- $this->addProductImageQuery($productId, $img, $imgtype);
543
- }
544
- return $img;
545
- }
546
- }
547
-
548
- public function addProductImageQuery($productId, $img, $type = '')
549
- {
550
- $db = Mage::getSingleton('core/resource')->getConnection('core_write');
551
- $tablePrefix = (array)Mage::getConfig()->getTablePrefix();
552
- if (!empty($tablePrefix[0])) {
553
- $tablePrefix = $tablePrefix[0];
554
- } else {
555
- $tablePrefix = '';
556
- }
557
-
558
- $attr_query = "SELECT @product_entity_type_id := `entity_type_id` FROM `" . $tablePrefix . "eav_entity_type` WHERE
559
- entity_type_code = 'catalog_product';
560
- SELECT @attribute_set_id := `entity_type_id` FROM `" . $tablePrefix . "eav_entity_type` WHERE
561
- entity_type_code = 'catalog_product';
562
- SELECT @gallery := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
563
- `attribute_code` = 'media_gallery' AND entity_type_id = @product_entity_type_id;
564
- SELECT @base := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE `attribute_code` = 'image' AND entity_type_id = @product_entity_type_id;
565
- SELECT @small := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
566
- `attribute_code` = 'small_image' AND entity_type_id = @product_entity_type_id;
567
- SELECT @thumb := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
568
- `attribute_code` = 'thumbnail' AND entity_type_id = @product_entity_type_id;";
569
-
570
- $db->query($attr_query, array(':attribute_set' => Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId()));
571
-
572
- $DefaultStoreId = 0;
573
-
574
- if (empty($type) || $type == 'image') {
575
-
576
- $db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
577
- (entity_type_id,attribute_id,store_id,entity_id,value)
578
- VALUES(@product_entity_type_id,@base,:store_id,:entity_id,:img )
579
- ON DUPLICATE KEY UPDATE value = :img", array(
580
- ':store_id' => $DefaultStoreId,
581
- ':entity_id' => $productId,
582
- ':img' => $img));
583
-
584
- $db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
585
- (entity_type_id,attribute_id,store_id,entity_id,value)
586
- VALUES(@product_entity_type_id,@small,:store_id,:entity_id,:img )
587
- ON DUPLICATE KEY UPDATE value = :img", array(
588
- ':store_id' => $DefaultStoreId,
589
- ':entity_id' => $productId,
590
- ':img' => $img));
591
-
592
- $db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
593
- (entity_type_id,attribute_id,store_id,entity_id,value)
594
- VALUES(@product_entity_type_id,@thumb,:store_id,:entity_id,:img )
595
- ON DUPLICATE KEY UPDATE value = :img", array(
596
- ':store_id' => $DefaultStoreId,
597
- ':entity_id' => $productId,
598
- ':img' => $img));
599
- }
600
-
601
-
602
- $db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_media_gallery` (attribute_id,entity_id,value)
603
- VALUES(@gallery,:entity_id,:img )", array(
604
- ':entity_id' => $productId,
605
- ':img' => $img));
606
- $db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_media_gallery_value`
607
- (value_id,store_id,label,position,disabled)
608
- VALUES(LAST_INSERT_ID(),:store_id,'',1,0 )", array(
609
- ':store_id' => $DefaultStoreId));
610
-
611
-
612
- }
613
-
614
- }
615
-
616
- ?>
1
+ <?php
2
+ /**
3
+ * Class performs Curl request to ICEcat and fetches xml data with product description
4
+ *
5
+ */
6
+ class Iceshop_Icecatlive_Model_Import extends Mage_Core_Model_Abstract
7
+ {
8
+
9
+ public $entityId;
10
+ private $productDescriptionList = array();
11
+ private $productDescription;
12
+ private $fullProductDescription;
13
+ private $lowPicUrl;
14
+ private $highPicUrl;
15
+ private $errorMessage;
16
+ private $galleryPhotos = array();
17
+ private $productName;
18
+ private $relatedProducts = array();
19
+ private $thumb;
20
+ private $errorSystemMessage; //depricated
21
+ public $_cacheKey = 'iceshop_icecatlive_';
22
+ public $_connectorCacheDir = '/iceshop/icecatlive/cache/';
23
+ public $simpleDoc;
24
+
25
+ private $_warrantyInfo = '';
26
+ private $_shortSummaryDesc = '';
27
+ private $_longSummaryDesc = '';
28
+
29
+ private $_manualPdfUrl = '';
30
+ private $_pdfUrl = '';
31
+ private $_multimedia = '';
32
+
33
+ protected function _construct()
34
+ {
35
+ $this->_init('icecatlive/import');
36
+ }
37
+
38
+ /**
39
+ * Perform Curl request with corresponding param check and error processing
40
+ * @param int $productId
41
+ * @param string $vendorName
42
+ * @param string $locale
43
+ * @param string $userName
44
+ * @param string $userPass
45
+ */
46
+ public function getProductDescription($productId, $vendorName, $locale, $userName, $userPass, $entityId, $ean_code)
47
+ {
48
+ $current_page = Mage::app()->getFrontController()->getRequest()->getControllerName();
49
+
50
+ if($current_page == 'product'){
51
+
52
+ $this->entityId = $entityId;
53
+ $error = '';
54
+ if (null === $this->simpleDoc) {
55
+ $cacheDataXml = $this->_getXmlIcecatLiveCache($this->entityId, $locale);
56
+ if(empty($cacheDataXml)){
57
+ $cacheDataXml = Mage::app()->getCache()->load($this->_cacheKey . $entityId . '_' . $locale);
58
+ }
59
+ if (!empty($cacheDataXml)) {
60
+
61
+ $resultString = $cacheDataXml;
62
+
63
+ if (!$this->parseXml($resultString)) {
64
+ return false;
65
+ }
66
+ if ($this->checkIcecatResponse($this->simpleDoc->Product['ErrorMessage'])) {
67
+ return false;
68
+ }
69
+ }
70
+
71
+ $this->loadProductDescriptionList();
72
+ $this->loadOtherProductParams($productId);
73
+ Varien_Profiler::start('Iceshop FILE RELATED');
74
+ $this->loadRelatedProducts();
75
+ Varien_Profiler::stop('Iceshop FILE RELATED');
76
+ }
77
+ return true;
78
+ }
79
+ }
80
+ public function _getXmlIcecatLiveCache($entity_id, $locale){
81
+ $current_prodCacheXml = Mage::getBaseDir('var') . $this->_connectorCacheDir . 'iceshop_icecatlive_' . $entity_id . '_' . $locale;
82
+ $current_prodCache = file_get_contents($current_prodCacheXml);
83
+ return $current_prodCache;
84
+ }
85
+ public function _getIceCatData($userName, $userPass, $dataUrl, $productAttributes)
86
+ {
87
+ try {
88
+ $webClient = new Zend_Http_Client();
89
+ $webClient->setUri($dataUrl);
90
+ $webClient->setMethod(Zend_Http_Client::GET);
91
+ $webClient->setHeaders('Content-Type: text/xml; charset=UTF-8');
92
+ $webClient->setParameterGet($productAttributes);
93
+ $webClient->setAuth($userName, $userPass, Zend_Http_CLient::AUTH_BASIC);
94
+ $response = $webClient->request();
95
+ if ($response->isError()) {
96
+ $this->errorMessage = 'Response Status: ' . $response->getStatus() . " Response Message: " . $response->getMessage();
97
+ return false;
98
+ }
99
+ } catch (Exception $e) {
100
+ $this->errorMessage = "Warning: cannot connect to ICEcat. {$e->getMessage()}";
101
+ return false;
102
+ }
103
+ return $response->getBody();
104
+ }
105
+
106
+ public function getSystemError()
107
+ {
108
+ return $this->errorSystemMessage;
109
+ }
110
+
111
+ public function getProductName()
112
+ {
113
+ return $this->productName;
114
+ }
115
+ public function getThumbPicture()
116
+ {
117
+ return $this->thumb;
118
+ }
119
+ /**
120
+ * load Gallery array from XML
121
+ */
122
+ public function loadGalleryPhotos($galleryPhotos)
123
+ {
124
+ $Imagepriority = Mage::getStoreConfig('icecat_root/icecat/image_priority');
125
+ if($Imagepriority != 'Db'){
126
+ if (!count($galleryPhotos)) {
127
+ return false;
128
+ }
129
+
130
+ foreach ($galleryPhotos as $photo) {
131
+ if ($photo["Size"] > 0) {
132
+ $picUrl = $this->changeHostsImages((string)$photo["Pic"]);
133
+ if (!empty($picUrl) && strpos($picUrl, 'feature_logo') <= 0) {
134
+ $product_id = $this->entityId;
135
+ $this->saveImg($product_id, $picUrl, 'file');
136
+ }
137
+ }
138
+
139
+ }
140
+ }
141
+ }
142
+
143
+
144
+
145
+ public function _saveProductCatalogImage($entityId, $productTag){
146
+ $Imagepriority = Mage::getStoreConfig('icecat_root/icecat/image_priority');
147
+ if ($Imagepriority != 'Db') {
148
+ if (!empty($productTag["HighPic"])) {
149
+ $this->highPicUrl = $this->saveImg($entityId, $this->changeHostsImages((string)$productTag["HighPic"]), 'image');
150
+ } else if (!empty($productTag["LowPic"])) {
151
+ $this->lowPicUrl = $this->saveImg($entityId, $this->changeHostsImages((string)$productTag["LowPic"]), 'image');
152
+ } else {
153
+ $this->thumb = $this->saveImg($entityId, $this->changeHostsImages((string)$productTag["ThumbPic"]), 'image');
154
+ }
155
+ }
156
+ }
157
+
158
+ public function changeHostsImages($productTag){
159
+ $image_path = str_replace("http:", "https:", $productTag);
160
+ return $image_path;
161
+ }
162
+
163
+ public function getErrorMessage()
164
+ {
165
+ return $this->errorMessage;
166
+ }
167
+
168
+ /**
169
+ * Checks response XML for error messages
170
+ */
171
+ public function checkIcecatResponse($errorMessage)
172
+ {
173
+ if ($errorMessage != '') {
174
+ if (preg_match('/^No xml data/', $errorMessage)) {
175
+ $this->errorSystemMessage = (string)$errorMessage;
176
+ return true;
177
+ }
178
+ if (preg_match('/^The specified vendor does not exist$/', $errorMessage)) {
179
+ $this->errorSystemMessage = (string)$errorMessage;
180
+ return true;
181
+ }
182
+ if (preg_match('/^You are not allowed to have Full ICEcat access$/', $errorMessage)) {
183
+ $this->errorMessage = "Warning: " . $errorMessage;
184
+ return true;
185
+ }
186
+ $this->errorMessage = "Ice Cat Error: " . $errorMessage;
187
+ return true;
188
+ }
189
+ return false;
190
+ }
191
+
192
+ public function getProductDescriptionList()
193
+ {
194
+ return $this->productDescriptionList;
195
+ }
196
+
197
+ public function getShortProductDescription()
198
+ {
199
+ return $this->productDescription;
200
+ }
201
+
202
+ public function getFullProductDescription()
203
+ {
204
+ return $this->fullProductDescription;
205
+ }
206
+
207
+ public function getLowPicUrl()
208
+ {
209
+ return $this->highPicUrl;
210
+ }
211
+
212
+ public function getRelatedProducts()
213
+ {
214
+ return $this->relatedProducts;
215
+ }
216
+
217
+ public function getVendor()
218
+ {
219
+ return $this->vendor;
220
+ }
221
+
222
+ public function getMPN()
223
+ {
224
+ return $this->productId;
225
+ }
226
+
227
+ public function getEAN()
228
+ {
229
+ return $this->EAN;
230
+ }
231
+
232
+ public function getWarrantyInfo()
233
+ {
234
+ return $this->_warrantyInfo;
235
+ }
236
+
237
+ public function getShortSummaryDescription()
238
+ {
239
+ return $this->_shortSummaryDesc;
240
+ }
241
+
242
+ public function getLongSummaryDescription()
243
+ {
244
+ return $this->_longSummaryDesc;
245
+ }
246
+
247
+ public function getManualPDF()
248
+ {
249
+ return $this->_manualPdfUrl;
250
+ }
251
+
252
+ public function getPDF()
253
+ {
254
+ return $this->_pdfUrl;
255
+ }
256
+
257
+ public function getIceCatMedia()
258
+ {
259
+ return $this->_multimedia;
260
+ }
261
+
262
+ /**
263
+ * Form related products Array
264
+ */
265
+ private function loadRelatedProducts()
266
+ {
267
+ $relatedProductsArray = $this->simpleDoc->Product->ProductRelated;
268
+ if (count($relatedProductsArray)) {
269
+ foreach ($relatedProductsArray as $product) {
270
+ $productArray = array();
271
+ $productNS = $product->Product;
272
+ $productArray['name'] = (string)$productNS['Name'];
273
+ $productArray['thumb'] = (string)$productNS['ThumbPic'];
274
+ $mpn = (string)$productNS['Prod_id'];
275
+ $productSupplier = $productNS->Supplier;
276
+ $productSupplierId = (int)$productSupplier['ID'];
277
+ $productArray['supplier_thumb'] = 'http://images2.icecat.biz/thumbs/SUP' . $productSupplierId . '.jpg';
278
+ $productArray['supplier_name'] = (string)$productSupplier['Name'];
279
+ $this->relatedProducts[$mpn] = $productArray;
280
+ }
281
+ }
282
+ }
283
+
284
+ /**
285
+ * Form product feature Arrray
286
+ */
287
+ private function loadProductDescriptionList()
288
+ {
289
+ $descriptionArray = array();
290
+ $specGroups = $this->simpleDoc->Product->CategoryFeatureGroup;
291
+ $specFeatures = $this->simpleDoc->Product->ProductFeature;
292
+ foreach ($specFeatures as $feature) {
293
+ $id = (int)$feature['CategoryFeatureGroup_ID'];
294
+ $featureText = (string)$feature["Presentation_Value"];
295
+ $featureValue = (string)$feature["Value"];
296
+ $featureName = (string)$feature->Feature->Name["Value"];
297
+ if ($featureValue == 'Y' || $featureValue == 'N') {
298
+ $featureText = $featureValue;
299
+ }
300
+ foreach ($specGroups as $group) {
301
+ $groupId = (int)$group["ID"];
302
+ if ($groupId == $id) {
303
+ $groupName = (string)$group->FeatureGroup->Name["Value"];
304
+ $rating = (int)$group['No'];
305
+ $descriptionArray[$rating][$groupName][$featureName] = $featureText;
306
+ break;
307
+ }
308
+ }
309
+ }
310
+ krsort($descriptionArray);
311
+ $this->productDescriptionList = $descriptionArray;
312
+ }
313
+
314
+ /**
315
+ * Form Array of non feature-value product params
316
+ */
317
+ private function loadOtherProductParams($productId)
318
+ {
319
+ $productTag = $this->simpleDoc->Product;
320
+ $this->productDescription = (string)$productTag->ProductDescription['ShortDesc'];
321
+ $this->fullProductDescription = (string)$productTag->ProductDescription['LongDesc'];
322
+ $this->_warrantyInfo = (string)$productTag->ProductDescription['WarrantyInfo'];
323
+ $this->_shortSummaryDesc = (string)$productTag->SummaryDescription->ShortSummaryDescription;
324
+ $this->_longSummaryDesc = (string)$productTag->SummaryDescription->LongSummaryDescription;
325
+ $this->_manualPdfUrl = (string)$productTag->ProductDescription['ManualPDFURL'];
326
+ $this->_pdfUrl = (string)$productTag->ProductDescription['PDFURL'];
327
+ $this->_multimedia = $productTag->ProductMultimediaObject->MultimediaObject;
328
+
329
+ $this->productName = (string)$productTag["Title"];
330
+ $this->productId = (string)$productTag['Prod_id'];
331
+ $this->vendor = (string)$productTag->Supplier['Name'];
332
+ $prodEAN = $productTag->EANCode;
333
+ $EANstr = '';
334
+ $EANarr = null;
335
+ $j = 0; //counter
336
+ foreach ($prodEAN as $ellEAN) {
337
+ $EANarr[] = $ellEAN['EAN'];
338
+ $j++;
339
+ }
340
+ $i = 0;
341
+ $str = '';
342
+ for ($i = 0; $i < $j; $i++) {
343
+ $g = $i % 2;
344
+ if ($g == '0') {
345
+ if ($j == 1) {
346
+ $str .= $EANarr[$i] . '<br>';
347
+ } else {
348
+ $str .= $EANarr[$i] . ', ';
349
+ }
350
+ } else {
351
+ if ($i != $j - 1) {
352
+ $str .= $EANarr[$i] . ', <br>';
353
+ } else {
354
+ $str .= $EANarr[$i] . ' <br>';
355
+ }
356
+ }
357
+ }
358
+ $this->EAN = $str;
359
+ }
360
+
361
+ /**
362
+ * parse response XML: to SimpleXml
363
+ * @param string $stringXml
364
+ */
365
+ public function parseXml($stringXml)
366
+ {
367
+ $current_page = Mage::app()->getFrontController()->getRequest()->getControllerName();
368
+
369
+ if($current_page == 'product'){
370
+ libxml_use_internal_errors(true);
371
+ $this->simpleDoc = simplexml_load_string($stringXml);
372
+ if ($this->simpleDoc) {
373
+ return true;
374
+ }
375
+ $this->simpleDoc = simplexml_load_string(utf8_encode($stringXml));
376
+ if ($this->simpleDoc) {
377
+ return true;
378
+ }
379
+ }
380
+ return false;
381
+ }
382
+
383
+ /**
384
+ * save icecat img
385
+ * @param int $productId
386
+ * @param string $img_url
387
+ * @param string $img_type
388
+ */
389
+ public function saveImg($productId, $img_url, $imgtype = '')
390
+ {
391
+ $pathinfo = pathinfo($img_url);
392
+ $img_type = $pathinfo["extension"];
393
+
394
+ if (strpos($img_url, 'high') > 0) {
395
+ $img_name = str_replace("http://images.icecat.biz/img/norm/high/", "", $img_url);
396
+ $img_name = md5($img_name);
397
+ } else if (strpos($img_url, 'low') > 0) {
398
+ $img_name = str_replace("http://images.icecat.biz/img/norm/low/", "", $img_url);
399
+ $img_name = md5($img_name);
400
+ } else {
401
+ $img_name = md5($img_url);
402
+ }
403
+
404
+ $img = $img_name . "." . $img_type;
405
+ $baseDir = Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath() . '/';
406
+ $local_img = strstr($img_url, Mage::getStoreConfig('web/unsecure/base_url'));
407
+
408
+ if (!file_exists($baseDir . $img) && !$local_img) {
409
+ $client = new Zend_Http_Client($img_url);
410
+ $content = $client->request();
411
+ if ($content->isError()) {
412
+ return $img_url;
413
+ }
414
+ $file = file_put_contents($baseDir . $img, $content->getBody());
415
+ if ($file) {
416
+ $this->addProductImageQuery($productId, $img, $imgtype);
417
+ return $img;
418
+ } else {
419
+ return $img_url;
420
+ }
421
+ } else if ($local_img) {
422
+ return $img_url;
423
+ } else {
424
+
425
+ $db = Mage::getSingleton('core/resource')->getConnection('core_write');
426
+ $tablePrefix = (array)Mage::getConfig()->getTablePrefix();
427
+ if (!empty($tablePrefix[0])) {
428
+ $tablePrefix = $tablePrefix[0];
429
+ } else {
430
+ $tablePrefix = '';
431
+ }
432
+ $attr_query = "SELECT @product_entity_type_id := `entity_type_id` FROM `" . $tablePrefix . "eav_entity_type` WHERE
433
+ entity_type_code = 'catalog_product';
434
+ SELECT @attribute_set_id := `entity_type_id` FROM `" . $tablePrefix . "eav_entity_type` WHERE
435
+ entity_type_code = 'catalog_product';
436
+ SELECT @gallery := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
437
+ `attribute_code` = 'media_gallery' AND entity_type_id = @product_entity_type_id;
438
+ SELECT @base := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE `attribute_code` = 'image' AND entity_type_id = @product_entity_type_id;
439
+ SELECT @small := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
440
+ `attribute_code` = 'small_image' AND entity_type_id = @product_entity_type_id;
441
+ SELECT @thumb := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
442
+ `attribute_code` = 'thumbnail' AND entity_type_id = @product_entity_type_id;";
443
+
444
+ $attr_set = Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId();
445
+
446
+ $db->query($attr_query, array(':attribute_set' => $attr_set));
447
+
448
+ $img_check = $db->fetchAll("SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity_varchar`
449
+ WHERE attribute_id IN (@base ,@small,@thumb)
450
+ AND entity_id =:entity_id AND value =:img ", array(
451
+ ':entity_id' => $productId,
452
+ ':img' => $img));
453
+
454
+ $gal_check = $db->fetchAll("SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity_media_gallery`
455
+ WHERE attribute_id = @gallery AND entity_id =:entity_id AND value =:img ", array(
456
+ ':entity_id' => $productId,
457
+ ':img' => $img));
458
+ if ((isset($img_check[0]["COUNT(*)"]) && isset($gal_check[0]["COUNT(*)"]))
459
+ && ($img_check[0]["COUNT(*)"] == 0 && $gal_check[0]["COUNT(*)"] == 0)
460
+ ) {
461
+ $this->addProductImageQuery($productId, $img, $imgtype);
462
+ }
463
+ return $img;
464
+ }
465
+ }
466
+ public function addProductImageQuery($productId, $img, $type = '')
467
+ {
468
+ $db = Mage::getSingleton('core/resource')->getConnection('core_write');
469
+ $tablePrefix = (array)Mage::getConfig()->getTablePrefix();
470
+ if (!empty($tablePrefix[0])) {
471
+ $tablePrefix = $tablePrefix[0];
472
+ } else {
473
+ $tablePrefix = '';
474
+ }
475
+
476
+ $attr_query = "SELECT @product_entity_type_id := `entity_type_id` FROM `" . $tablePrefix . "eav_entity_type` WHERE
477
+ entity_type_code = 'catalog_product';
478
+ SELECT @attribute_set_id := `entity_type_id` FROM `" . $tablePrefix . "eav_entity_type` WHERE
479
+ entity_type_code = 'catalog_product';
480
+ SELECT @gallery := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
481
+ `attribute_code` = 'media_gallery' AND entity_type_id = @product_entity_type_id;
482
+ SELECT @base := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE `attribute_code` = 'image' AND entity_type_id = @product_entity_type_id;
483
+ SELECT @small := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
484
+ `attribute_code` = 'small_image' AND entity_type_id = @product_entity_type_id;
485
+ SELECT @thumb := `attribute_id` FROM `" . $tablePrefix . "eav_attribute` WHERE
486
+ `attribute_code` = 'thumbnail' AND entity_type_id = @product_entity_type_id;";
487
+
488
+ $db->query($attr_query, array(':attribute_set' => Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId()));
489
+
490
+ $DefaultStoreId = 0;
491
+
492
+ if (empty($type) || $type == 'image') {
493
+
494
+ $db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
495
+ (entity_type_id,attribute_id,store_id,entity_id,value)
496
+ VALUES(@product_entity_type_id,@base,:store_id,:entity_id,:img )
497
+ ON DUPLICATE KEY UPDATE value = :img", array(
498
+ ':store_id' => $DefaultStoreId,
499
+ ':entity_id' => $productId,
500
+ ':img' => $img));
501
+
502
+ $db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
503
+ (entity_type_id,attribute_id,store_id,entity_id,value)
504
+ VALUES(@product_entity_type_id,@small,:store_id,:entity_id,:img )
505
+ ON DUPLICATE KEY UPDATE value = :img", array(
506
+ ':store_id' => $DefaultStoreId,
507
+ ':entity_id' => $productId,
508
+ ':img' => $img));
509
+
510
+ $db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_varchar`
511
+ (entity_type_id,attribute_id,store_id,entity_id,value)
512
+ VALUES(@product_entity_type_id,@thumb,:store_id,:entity_id,:img )
513
+ ON DUPLICATE KEY UPDATE value = :img", array(
514
+ ':store_id' => $DefaultStoreId,
515
+ ':entity_id' => $productId,
516
+ ':img' => $img));
517
+ }
518
+
519
+
520
+ $db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_media_gallery` (attribute_id,entity_id,value)
521
+ VALUES(@gallery,:entity_id,:img )", array(
522
+ ':entity_id' => $productId,
523
+ ':img' => $img));
524
+ $db->query(" INSERT INTO `" . $tablePrefix . "catalog_product_entity_media_gallery_value`
525
+ (value_id,store_id,label,position,disabled)
526
+ VALUES(LAST_INSERT_ID(),:store_id,'',1,0 )", array(
527
+ ':store_id' => $DefaultStoreId));
528
+
529
+
530
+ }
531
+
532
+ }
533
+
534
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Iceshop/Icecatlive/Model/Observer.php CHANGED
@@ -1,493 +1,577 @@
1
- <?php
2
- /**
3
- * Class provides category page with images, cron processing
4
- *
5
- *
6
- */
7
- class Iceshop_Icecatlive_Model_Observer
8
- {
9
- /**
10
- * Our process ID.
11
- */
12
- private $process_id = 'iceshop_icecat';
13
- private $indexProcess;
14
-
15
-
16
- private $errorMessage;
17
- private $connection;
18
- private $freeExportURLs = 'http://data.icecat.biz/export/freeurls/export_urls_rich.txt.gz';
19
- private $fullExportURLs = 'http://data.icecat.biz/export/export_urls_rich.txt.gz';
20
- private $productinfoUrL = 'http://data.icecat.biz/prodid/prodid_d.txt.gz';
21
- protected $_supplierMappingUrl = 'http://data.icecat.biz/export/freeurls/supplier_mapping.xml';
22
- protected $_connectorDir = '/iceshop/icecatlive/';
23
- protected $_productFile;
24
- protected $_supplierFile;
25
-
26
- protected function _construct()
27
- {
28
- $this->_init('icecatlive/observer');
29
- }
30
-
31
- /**
32
- * root method for uploading images to DB
33
- */
34
- public function load()
35
- {
36
-
37
-
38
- $loadUrl = $this->getLoadURL();
39
- ini_set('max_execution_time', 0);
40
- try {
41
- $this->indexProcess = new Mage_Index_Model_Process();
42
- $this->indexProcess->setId($this->process_id);
43
-
44
- if ($this->indexProcess->isLocked()) {
45
- throw new Exception('Error! Another icecat module cron process is running!');
46
- }
47
-
48
- $this->indexProcess->lockAndBlock();
49
-
50
- $this->_productFile = $this->_prepareFile(basename($loadUrl));
51
- $this->_supplierFile = $this->_prepareFile(basename($this->_supplierMappingUrl));
52
- $importlogFile = Mage::getBaseDir('var') . $this->_connectorDir . 'import.log';
53
- $importlogHandler = fopen($importlogFile, "w");
54
-
55
- fwrite($importlogHandler, "Downloading product data file (export_urls_rich.txt.gz)\n");
56
- $this->downloadFile($this->_productFile, $loadUrl);
57
-
58
- fwrite($importlogHandler, "Downloading supplier mapping file (supplier_mapping.xml)\n");
59
- $this->downloadFile($this->_supplierFile, $this->_supplierMappingUrl);
60
- $this->XMLfile = Mage::getBaseDir('var') . $this->_connectorDir . basename($loadUrl, ".gz");
61
-
62
- fwrite($importlogHandler, "Unzipping files\n");
63
- $this->unzipFile();
64
-
65
- fwrite($importlogHandler, "Importing supplier mapping (supplier_mapping.xml) to database\n");
66
- $this->_loadSupplierListToDb();
67
-
68
- fwrite($importlogHandler, "Importing products data (export_urls_rich.txt) to database\n");
69
- $this->loadFileToDb();
70
-
71
- //Start load product data file
72
- $loadUrl = $this->productinfoUrL;
73
- $this->_productFile = $this->_prepareFile(basename($loadUrl));
74
-
75
- fwrite($importlogHandler, "Downloading additional product data file (prodid_d.txt.gz)\n");
76
- $this->downloadFile($this->_productFile, $loadUrl);
77
-
78
- fwrite($importlogHandler, "Unzipping additional product data file\n");
79
- $this->unzipFile();
80
-
81
- fwrite($importlogHandler, "Importing additional product data (prodid_d.txt.gz) to database\n");
82
- $this->loadInfoFileToDb();
83
- fwrite($importlogHandler, "Import process complete.\n");
84
-
85
- $this->indexProcess->unlock();
86
- fclose ($importlogHandler);
87
- } catch (Exception $e) {
88
- echo $e->getMessage();
89
- Mage::log($e->getMessage());
90
- }
91
- }
92
-
93
- /**
94
- * parse given XML to SIMPLE XML
95
- * @param string $stringXml
96
- */
97
- protected function _parseXml($stringXml)
98
- {
99
- libxml_use_internal_errors(true);
100
- $simpleDoc = simplexml_load_string($stringXml);
101
- if ($simpleDoc) {
102
- return $simpleDoc;
103
- }
104
- $simpleDoc = simplexml_load_string(utf8_encode($stringXml));
105
- if ($simpleDoc) {
106
- return $simpleDoc;
107
- }
108
- return false;
109
- }
110
-
111
- /**
112
- * Upload supplier mapping list to Database
113
- */
114
- protected function _loadSupplierListToDb()
115
- {
116
- $connection = $this->getDbConnection();
117
- $mappingTable = Mage::getSingleton('core/resource')->getTableName('icecatlive/supplier_mapping');
118
- try {
119
- $connection->beginTransaction();
120
- $xmlString = file_get_contents($this->_supplierFile);
121
- $xmlDoc = $this->_parseXml($xmlString);
122
- if ($xmlDoc) {
123
- $connection->query("DROP TABLE IF EXISTS `" . $mappingTable . "_temp`");
124
- $connection->query("
125
- CREATE TABLE `" . $mappingTable . "_temp` (
126
- `supplier_id` int(11) NOT NULL,
127
- `supplier_symbol` varchar(255) DEFAULT NULL,
128
- KEY `supplier_id` (`supplier_id`)
129
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8
130
- ");
131
- $sql = '';
132
- $counter = 1;
133
- $max_counter = 1000;
134
- $supplierList = $xmlDoc->SupplierMappings->SupplierMapping;
135
- foreach ($supplierList as $supplier) {
136
- $supplierSymbolList = $supplier->Symbol;
137
- $supplierId = $supplier['supplier_id'];
138
- $supplierName = addslashes((string)$supplier['name']);
139
- if ($counter == 1) {
140
- $sql = " INSERT INTO " . $mappingTable . "_temp ( supplier_id, supplier_symbol ) VALUES('" . $supplierId . "', '" . $supplierName . "') ";
141
- } else if ($counter % $max_counter == 0) {
142
- $connection->query($sql);
143
- $sql = " INSERT INTO " . $mappingTable . "_temp ( supplier_id, supplier_symbol ) VALUES('" . $supplierId . "', '" . $supplierName . "') ";
144
- } else {
145
- $sql .= " , ('" . $supplierId . "', '" . $supplierName . "') ";
146
- }
147
- foreach ($supplierSymbolList as $symbol) {
148
- $symbolName = addslashes((string)$symbol);
149
- if ($counter == 1) {
150
- $sql = " INSERT INTO " . $mappingTable . "_temp ( supplier_id, supplier_symbol ) VALUES('" . $supplierId . "', '" . $symbolName . "') ";
151
- } else if ($counter % $max_counter == 0) {
152
- $connection->query($sql);
153
- $sql = " INSERT INTO " . $mappingTable . "_temp ( supplier_id, supplier_symbol ) VALUES('" . $supplierId . "', '" . $symbolName . "') ";
154
- } else {
155
- $sql .= " , ('" . $supplierId . "', '" . $symbolName . "') ";
156
- }
157
- $counter++;
158
- }
159
- $counter++;
160
- }
161
- $connection->query($sql);
162
- $connection->query("DROP TABLE IF EXISTS `" . $mappingTable . "_old`");
163
- $connection->query("rename table `" . $mappingTable . "` to `" . $mappingTable . "_old`, `" . $mappingTable . "_temp` to " . $mappingTable);
164
- $connection->query("DROP TABLE IF EXISTS `" . $mappingTable . "_old`");
165
- $connection->commit();
166
- } else {
167
- throw new Exception('Unable to process supplier file');
168
- }
169
- } catch (Exception $e) {
170
- $connection->rollBack();
171
- throw new Exception("Icecat Import Terminated: {$e->getMessage()}");
172
- }
173
- }
174
-
175
- /**
176
- * retrieve URL of data file that corresponds ICEcat account
177
- */
178
- private function getLoadURL()
179
- {
180
- $subscripionLevel = Mage::getStoreConfig('icecat_root/icecat/icecat_type');
181
-
182
- if ($subscripionLevel === 'full') {
183
- return $this->fullExportURLs;
184
- } else {
185
- return $this->freeExportURLs;
186
- }
187
- }
188
-
189
- /**
190
- * return error messages
191
- */
192
- public function getErrorMessage()
193
- {
194
- return $this->errorMessage;
195
- }
196
-
197
- /**
198
- * getImage URL from DB
199
- * @param string $productSku
200
- * @param string $productManufacturer
201
- */
202
- public function getImageURL($productSku, $productManufacturer, $productId = '')
203
- {
204
-
205
- $connection = $this->getDbConnection();
206
- try {
207
-
208
- $dataTable = Mage::getSingleton('core/resource')->getTableName('icecatlive/data');
209
- $data_productsTable = Mage::getSingleton('core/resource')->getTableName('icecatlive/data_products');
210
- $mappingTable = Mage::getSingleton('core/resource')->getTableName('icecatlive/supplier_mapping');
211
- $model = Mage::getModel('catalog/product');
212
- $_product = $model->load($productId);
213
- $ean_code = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/ean_code'));
214
- $imageURL = '';
215
-
216
- if (isset($productManufacturer) && !empty($productManufacturer)) {
217
- $selectCondition = $connection->select()
218
- ->from(array('connector' => $dataTable), new Zend_Db_Expr('connector.prod_img'))
219
- ->joinInner(array('supplier' => $mappingTable), "connector.supplier_id = supplier.supplier_id AND supplier.supplier_symbol = {$this->connection->quote($productManufacturer)}")
220
- ->where('connector.prod_id = ?', $productSku);
221
- $imageURL = $connection->fetchOne($selectCondition);
222
- }
223
- if (empty($imageURL) && !empty($ean_code)) {
224
- $selectCondition = $connection->select()
225
- ->from(array('connector' => $dataTable), new Zend_Db_Expr('connector.prod_img'))
226
- ->joinLeft(array('products' => $data_productsTable), "connector.prod_id = products.prod_id")
227
- ->where('products.prod_ean = ?', trim($ean_code));
228
- $imageURL = $connection->fetchOne($selectCondition);
229
- }
230
-
231
- if (!empty($imageURL)) {
232
- $iceCatModel = Mage::getSingleton('icecatlive/import');
233
-
234
- if (isset($productId) && !empty($productId)) {
235
- $imageURL = $iceCatModel->saveImg($productId, $imageURL, 'image');
236
- }
237
- }
238
-
239
- if (empty($imageURL)) {
240
- $this->errorMessage = "Given product id is not present in database";
241
- return $imageURL;
242
- }
243
- return $imageURL;
244
- } catch (Exception $e) {
245
- $this->errorMessage = "DB ERROR: {$e->getMessage()}";
246
- return false;
247
- }
248
- }
249
-
250
- /**
251
- * Singletong for DB connection
252
- */
253
- private function getDbConnection()
254
- {
255
- if ($this->connection) {
256
- return $this->connection;
257
- }
258
- $this->connection = Mage::getSingleton('core/resource')->getConnection('core_read');
259
-
260
- return $this->connection;
261
- }
262
-
263
- /**
264
- * Upload Data file to DP
265
- */
266
- private function loadFileToDb()
267
- {
268
- $connection = $this->getDbConnection();
269
- $dataTable = Mage::getSingleton('core/resource')->getTableName('icecatlive/data');
270
-
271
- $max_counter = 1000;
272
- try {
273
- $connection->beginTransaction();
274
- $fileHandler = fopen($this->XMLfile, "r");
275
- if ($fileHandler) {
276
- $connection->query("DROP TABLE IF EXISTS `" . $dataTable . "_temp`");
277
- $connection->query("
278
- CREATE TABLE `" . $dataTable . "_temp` (
279
- `prod_id` varchar(255) NOT NULL,
280
- `supplier_id` int(11) DEFAULT NULL,
281
- `prod_name` varchar(255) DEFAULT NULL,
282
- `prod_img` varchar(255) DEFAULT NULL,
283
- KEY `PRODUCT_MPN` (`prod_id`),
284
- KEY `supplier_id` (`supplier_id`)
285
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8
286
- ");
287
-
288
- $counter = 0;
289
- $sql = "";
290
- while (!feof($fileHandler)) {
291
- $row = fgets($fileHandler);
292
- $oneLine = explode("\t", $row);
293
-
294
- if ($oneLine[0] != 'product_id' && $oneLine[0] != '') {
295
-
296
- try {
297
-
298
- $prod_id = (!empty($oneLine[1])) ? addslashes($oneLine[1]) : '';
299
- if(!empty($oneLine[5])){
300
- $prod_img = addslashes($oneLine[5]);
301
- }elseif(!empty($oneLine[6])){
302
- $prod_img = addslashes($oneLine[6]);
303
- }elseif(!empty($oneLine[7])){
304
- $prod_img = addslashes($oneLine[7]);
305
- }else{
306
- $prod_img = '';
307
- }
308
- $prod_name = (!empty($oneLine[12])) ? addslashes($oneLine[12]) : '';
309
- $supplier_id = (!empty($oneLine[4])) ? addslashes($oneLine[4]) : '';
310
-
311
- if ($counter == 1) {
312
- $sql = " INSERT INTO " . $dataTable . "_temp ( prod_id, supplier_id, prod_name, prod_img ) VALUES('" . $prod_id . "', '" . $supplier_id . "', '" . $prod_name . "', '" . $prod_img . "') ";
313
- } else if ($counter % $max_counter == 0) {
314
- $connection->query($sql);
315
- $sql = " INSERT INTO " . $dataTable . "_temp ( prod_id, supplier_id, prod_name, prod_img ) VALUES('" . $prod_id . "', '" . $supplier_id . "', '" . $prod_name . "', '" . $prod_img . "') ";
316
- } else {
317
- $sql .= " , ('" . $prod_id . "', '" . $supplier_id . "', '" . $prod_name . "', '" . $prod_img . "') ";
318
- }
319
-
320
- } catch (Exception $e) {
321
- Mage::log("connector issue: {$e->getMessage()}");
322
- }
323
- }
324
- $counter++;
325
- }
326
- $connection->query($sql);
327
- $connection->query("DROP TABLE IF EXISTS `" . $dataTable . "_old`");
328
- $connection->query("RENAME TABLE `" . $dataTable . "` TO `" . $dataTable . "_old`, `" . $dataTable . "_temp` TO " . $dataTable);
329
- $connection->query("DROP TABLE IF EXISTS `" . $dataTable . "_old`");
330
- $connection->commit();
331
- fclose($fileHandler);
332
- }
333
- } catch (Exception $e) {
334
- $connection->rollBack();
335
- throw new Exception("Icecat Import Terminated: {$e->getMessage()}");
336
- }
337
- }
338
-
339
- /**
340
- * Upload Data file to DP
341
- */
342
- private function loadInfoFileToDb()
343
- {
344
- $connection = $this->getDbConnection();
345
- $data_productsTable = Mage::getSingleton('core/resource')->getTableName('icecatlive/data_products');
346
- $max_counter = 1000;
347
- try {
348
- $connection->beginTransaction();
349
- $fileHandler = fopen($this->XMLfile, "r");
350
- if ($fileHandler) {
351
-
352
- $connection->query("DROP TABLE IF EXISTS `" . $data_productsTable . "`");
353
- $connection->query("
354
- CREATE TABLE `" . $data_productsTable . "` (
355
- `prod_id` varchar(255) NOT NULL,
356
- `supplier_symbol` varchar(255) DEFAULT NULL,
357
- `prod_title` varchar(255) DEFAULT NULL,
358
- `prod_ean` varchar(255) NOT NULL,
359
- KEY `prod_id` (`prod_id`),
360
- KEY `PRODUCT_EAN` (`prod_ean`),
361
- INDEX `mpn_brand` (`prod_id`, `supplier_symbol`)
362
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8
363
- ");
364
-
365
- $counter = 1;
366
- $sql = "";
367
- while (!feof($fileHandler)) {
368
- $row = fgets($fileHandler);
369
- $oneLine = explode("\t", $row);
370
-
371
- if ($oneLine[0] != 'Part number') {
372
- try {
373
- $oneLine3 = trim($oneLine[3]);
374
- $oneLine15 = trim($oneLine[15]);
375
- $oneLine24 = trim($oneLine[24]);
376
- if (!empty($oneLine15)) {
377
- $eans = explode(';', $oneLine15);
378
- }
379
- $prod_id = (!empty($oneLine[0])) ? addslashes(str_replace("\t", '', $oneLine[0])) : '';
380
- $brand = (!empty($oneLine3)) ? addslashes(str_replace("\t", '', $oneLine3)) : '';
381
- $title = (!empty($oneLine24)) ? addslashes(str_replace("\t", '', $oneLine24)) : '';
382
- if (is_array($eans) && !empty($eans)){
383
- foreach($eans as $prod_ean){
384
- if ($counter == 1) {
385
- $sql .= " INSERT INTO " . $data_productsTable . " ( prod_id, supplier_symbol, prod_title, prod_ean ) VALUES('" . $prod_id . "', '" . $brand . "', '" . $title. "', '" . $prod_ean . "') ";
386
- } else if ($counter % $max_counter == 0) {
387
- $connection->query($sql);
388
- $sql = " INSERT INTO " . $data_productsTable . " ( prod_id, supplier_symbol, prod_title, prod_ean ) VALUES('" . $prod_id . "', '" . $brand . "', '" . $title . "', '" . $prod_ean . "') ";
389
- } else {
390
- $sql .= " , ('" . $prod_id . "', '" . $brand . "', '" . $title . "', '" . $prod_ean . "') ";
391
- }
392
- $counter++;
393
- }
394
- }else{
395
- $prod_ean = !empty($eans) ? $eans : '';
396
- if ($counter == 1) {
397
- $sql .= " INSERT INTO " . $data_productsTable . " ( prod_id, supplier_symbol, prod_title, prod_ean ) VALUES('" . $prod_id . "', '" . $brand . "', '" . $title. "', '" . $prod_ean . "') ";
398
- } else if ($counter % $max_counter == 0) {
399
- $connection->query($sql);
400
- $sql = " INSERT INTO " . $data_productsTable . " ( prod_id, supplier_symbol, prod_title, prod_ean ) VALUES('" . $prod_id . "', '" . $brand . "', '" . $title . "', '" . $prod_ean . "') ";
401
- } else {
402
- $sql .= " , ('" . $prod_id . "', '" . $brand . "', '" . $title . "', '" . $prod_ean . "') ";
403
- }
404
- $counter++;
405
- }
406
- } catch (Exception $e) {
407
- Mage::log("connector issue: {$e->getMessage()}");
408
- }
409
- }
410
- }
411
- $connection->query($sql);
412
- $connection->commit();
413
- fclose($fileHandler);
414
- }
415
- } catch (Exception $e) {
416
- $connection->rollBack();
417
- throw new Exception("Icecat Import Terminated: {$e->getMessage()}");
418
- }
419
- }
420
-
421
- /**
422
- * unzip Uploaded file
423
- */
424
- private function unzipFile()
425
- {
426
- $gz = gzopen($this->_productFile, 'rb');
427
- if (file_exists($this->XMLfile)) {
428
- unlink($this->XMLfile);
429
- }
430
- $fileToWrite = @fopen($this->XMLfile, 'w+');
431
- if (!$fileToWrite) {
432
- $this->errorMessage = 'Unable to open output txt file. Please remove all *.txt files from ' .
433
- Mage::getBaseDir('var') . $this->_connectorDir . 'folder';
434
- return false;
435
- }
436
- while (!gzeof($gz)) {
437
- $buffer = gzgets($gz, 100000);
438
- fputs($fileToWrite, $buffer);
439
- }
440
- gzclose($gz);
441
- fclose($fileToWrite);
442
- }
443
-
444
- /**
445
- * Process downloading files
446
- * @param string $destinationFile
447
- * @param string $loadUrl
448
- */
449
- private function downloadFile($destinationFile, $loadUrl)
450
- {
451
- $userName = Mage::getStoreConfig('icecat_root/icecat/login');
452
- $userPass = Mage::getStoreConfig('icecat_root/icecat/password');
453
- $fileToWrite = @fopen($destinationFile, 'w+');
454
-
455
- try {
456
- $webClient = new Zend_Http_Client();
457
- $webClient->setUri($loadUrl);
458
- $webClient->setConfig(array('maxredirects' => 0, 'timeout' => 60));
459
- $webClient->setMethod(Zend_Http_Client::GET);
460
- $webClient->setHeaders('Content-Type: text/xml; charset=UTF-8');
461
- $webClient->setAuth($userName, $userPass, Zend_Http_CLient::AUTH_BASIC);
462
- $response = $webClient->request('GET');
463
- if ($response->isError()) {
464
- throw new Exception("\nERROR Occured.\nResponse Status: " . $response->getStatus() . "\nResponse Message: " . $response->getMessage() ."\nResponse Body: " . $response->getBody() .
465
- "\nPlease, make sure that you added correct icecat username and password to Icecat Live! configuration and you have your webshop's correct IP in Allowed IP addresses field in your icecat account.");
466
- }
467
- } catch (Exception $e) {
468
- throw new Exception("Warning: cannot connect to ICEcat. {$e->getMessage()}");
469
- }
470
- $resultString = $response->getBody();
471
- fwrite($fileToWrite, $resultString);
472
- fclose($fileToWrite);
473
- }
474
-
475
- /**
476
- * Prepares file and folder for futur download
477
- * @param string $fileName
478
- */
479
- protected function _prepareFile($fileName)
480
- {
481
- $varDir = Mage::getBaseDir('var') . $this->_connectorDir;
482
- $filePath = $varDir . $fileName;
483
- if (!is_dir($varDir)) {
484
- mkdir($varDir, 0777, true);
485
- }
486
- if (file_exists($filePath)) {
487
- unlink($filePath);
488
- }
489
- return $filePath;
490
- }
491
- }
492
-
493
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class provides category page with images, cron processing
4
+ *
5
+ *
6
+ */
7
+ class Iceshop_Icecatlive_Model_Observer
8
+ {
9
+ /**
10
+ * Our process ID.
11
+ */
12
+ private $connection;
13
+
14
+
15
+ protected $_connectorDir = '/iceshop/icecatlive/';
16
+ public $_connectorCacheDir = '/iceshop/icecatlive/cache/';
17
+ protected $_productFile;
18
+ protected $_supplierFile;
19
+
20
+ protected function _construct()
21
+ {
22
+ $this->_init('icecatlive/observer');
23
+ }
24
+ public function loadProductInfoIntoCache($import_id = 0, $crone=0){
25
+ $product_onlynewproducts = Mage::getStoreConfig('icecat_root/icecat/product_onlynewproducts');
26
+ $import_info = array();
27
+
28
+ $DB_loger = Mage::helper('icecatlive/db');
29
+ if(!$import_id){
30
+ if($_GET['full_import'] == 1){
31
+ $DB_loger->deleteLogKey('icecatlive_full_icecat_product_temp');
32
+ $DB_loger->deleteLogKey('icecatlive_current_product_temp');
33
+ $DB_loger->deleteLogKey('icecatlive_error_imported_product_temp');
34
+ $DB_loger->deleteLogKey('icecatlive_success_imported_product_temp');
35
+ $DB_loger->deleteLogKey('icecatlive_count_products_temp');
36
+ $DB_loger->deleteLogKey('import_icecat_server_error_message');
37
+ }
38
+ $import_info['current_product'] = $DB_loger->getLogValue('icecatlive_current_product_temp');
39
+ $import_info['count_products'] = $DB_loger->getLogValue('icecatlive_count_products_temp');
40
+
41
+
42
+
43
+ if(empty($import_info['count_products'])){
44
+ if($_GET['update'] != 1 && !$import_id){
45
+ $DB_loger->deleteLogKey('icecatlive_enddate_imported_product');
46
+ $DB_loger->deleteLogKey('icecatlive_startdate_update_product');
47
+ $DB_loger->deleteLogKey('icecatlive_enddate_update_product');
48
+ $DB_loger->insetrtUpdateLogValue('icecatlive_startdate_imported_product', date('Y-m-d H:i:s'));
49
+ } elseif (!$import_id) {
50
+ $DB_loger->deleteLogKey('icecatlive_enddate_update_product');
51
+ $DB_loger->insetrtUpdateLogValue('icecatlive_startdate_update_product', date('Y-m-d H:i:s'));
52
+ }
53
+ }
54
+ $import_info['success_imported_product'] = $DB_loger->getLogValue('icecatlive_success_imported_product_temp');
55
+ $import_info['error_imported_product'] = $DB_loger->getLogValue('icecatlive_error_imported_product_temp');
56
+ $import_info['full_icecat_product'] = $DB_loger->getLogValue('icecatlive_full_icecat_product_temp');
57
+ if(empty($import_info['current_product'])){
58
+ $import_info['current_product'] = 1;
59
+ $DB_loger->insetrtUpdateLogValue('icecatlive_current_product_temp', $import_info['current_product']);
60
+ }else{
61
+ if($_GET['error_import'] != 1){
62
+ $import_info['current_product'] = $import_info['current_product'] + 1;
63
+ }
64
+ $DB_loger->insetrtUpdateLogValue('icecatlive_current_product_temp', $import_info['current_product']);
65
+ }
66
+ }
67
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
68
+ $catalog_product_model = Mage::getModel('catalog/product');
69
+ $userName = Mage::getStoreConfig('icecat_root/icecat/login');
70
+ $userPass = Mage::getStoreConfig('icecat_root/icecat/password');
71
+ $locale = Mage::getStoreConfig('icecat_root/icecat/language');
72
+ if ($locale == '0') {
73
+ $systemLocale = explode("_", Mage::app()->getLocale()->getLocaleCode());
74
+ $locale = $systemLocale[0];
75
+ }
76
+ $tablePrefix = '';
77
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
78
+ if (!empty($tPrefix)) {
79
+ $tablePrefix = $tPrefix[0];
80
+ }
81
+ if(!$import_id){
82
+ if(empty($import_info['count_products'])){
83
+ if($_GET['update'] != 1){
84
+ if(!$product_onlynewproducts){
85
+ $query = "SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity`";
86
+ } else {
87
+ $query = "SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity` AS cpe
88
+ LEFT JOIN `" . $tablePrefix . "iceshop_icecatlive_noimport_products_id` AS iinp
89
+ ON cpe.`entity_id` = iinp.`prod_id`
90
+ WHERE iinp.`prod_id` IS NULL;";
91
+ }
92
+ $count_products = $db_res->fetchRow($query);
93
+ $import_info['count_products'] = $count_products['COUNT(*)'];
94
+ $DB_loger->insetrtUpdateLogValue('icecatlive_count_products_temp', $import_info['count_products']);
95
+
96
+ }else{
97
+ if(!$product_onlynewproducts){
98
+ $query = "SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity` LEFT JOIN `" . $tablePrefix . "iceshop_icecatlive_products_titles` ON entity_id = prod_id WHERE prod_id IS NULL";
99
+ } else {
100
+ $query = "SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity` AS cpe
101
+ LEFT JOIN `" . $tablePrefix . "iceshop_icecatlive_products_titles` AS iipt
102
+ ON cpe.`entity_id`= iipt.`prod_id`
103
+ LEFT JOIN `" . $tablePrefix . "iceshop_icecatlive_noimport_products_id` AS iinpi
104
+ ON iinpi.`prod_id` = cpe.`entity_id`
105
+ WHERE iipt.`prod_id` IS NULL AND iinpi.`prod_id` IS NULL;";
106
+ }
107
+ $count_products = $db_res->fetchRow($query);
108
+ $import_info['count_products'] = $count_products['COUNT(*)'];
109
+ $DB_loger->insetrtUpdateLogValue('icecatlive_count_products_temp', $import_info['count_products']);
110
+ }
111
+ }
112
+
113
+ if($_GET['update'] != 1){
114
+ $prev_current_product = $import_info['current_product'] - 1;
115
+ if(!$product_onlynewproducts){
116
+ $query = "SELECT `entity_id` FROM `" . $tablePrefix . "catalog_product_entity` LIMIT ". $prev_current_product .", 1";
117
+ } else {
118
+ $query = "SELECT `entity_id` FROM `" . $tablePrefix . "catalog_product_entity` AS cpe
119
+ LEFT JOIN `" . $tablePrefix . "iceshop_icecatlive_noimport_products_id` AS iinpi
120
+ ON cpe.`entity_id` = iinpi.`prod_id`
121
+ WHERE iinpi.`prod_id` IS NULL LIMIT ". $prev_current_product .", 1";
122
+ }
123
+ $entity_id = $db_res->fetchRow($query);
124
+ $entity_id = $entity_id['entity_id'];
125
+ }else{
126
+ $prev_current_product = $import_info['current_product'] - 1;
127
+ if(!$product_onlynewproducts){
128
+ $query = "SELECT `entity_id` FROM `" . $tablePrefix . "catalog_product_entity` LEFT JOIN `" . $tablePrefix . "iceshop_icecatlive_products_titles` ON entity_id = prod_id WHERE prod_id IS NULL LIMIT ". $prev_current_product .", 1";
129
+ } else {
130
+ $query = "SELECT `entity_id` FROM `" . $tablePrefix . "catalog_product_entity` AS cpe
131
+ LEFT JOIN `" . $tablePrefix . "iceshop_icecatlive_products_titles` AS iipt
132
+ ON cpe.`entity_id` = iipt.`prod_id`
133
+ LEFT JOIN `" . $tablePrefix . "iceshop_icecatlive_noimport_products_id` AS iinpi
134
+ ON iinpi.`prod_id` = cpe.`entity_id`
135
+ WHERE iipt.`prod_id` IS NULL AND iinpi.`prod_id` IS NULL LIMIT ". $prev_current_product .", 1";
136
+ }
137
+ $entity_id = $db_res->fetchRow($query);
138
+ $entity_id = $entity_id['entity_id'];
139
+ }
140
+ }
141
+ if($import_id){
142
+ $entity_id = $import_id;
143
+ }
144
+
145
+ if(!empty($entity_id)){
146
+ $_product = $catalog_product_model->load($entity_id);
147
+ $ean_code = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/ean_code'));
148
+ $vendorName = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/manufacturer'));
149
+ $mpn = $_product->getData(Mage::getStoreConfig('icecat_root/icecat/sku_field'));
150
+ $dataUrl = 'https://data.icecat.biz/xml_s3/xml_server3.cgi';
151
+
152
+ $icecatliveImportModel = new Iceshop_Icecatlive_Model_Import();
153
+ $icecatliveImportModel->entityId = $entity_id;
154
+
155
+ if (!empty($mpn) && !empty($vendorName)) {
156
+ $resultString = $icecatliveImportModel->_getIceCatData($userName, $userPass, $dataUrl, array(
157
+ "prod_id" => $mpn,
158
+ "lang" => $locale,
159
+ "vendor" => $vendorName,
160
+ "output" => 'productxml'
161
+ ));
162
+
163
+ if ($xml_result = $this->_parseXml($resultString)) {
164
+ if (!$icecatliveImportModel->checkIcecatResponse($xml_result->Product['ErrorMessage'])) {
165
+ $successRespondByMPNVendorFlag = true;
166
+ }
167
+ }
168
+
169
+ }
170
+ // if get data by MPN & brand name wrong => trying by Ean code
171
+ if (!$successRespondByMPNVendorFlag) {
172
+ if (!empty($ean_code)) {
173
+ $resultString = $icecatliveImportModel->_getIceCatData($userName, $userPass, $dataUrl, array(
174
+ 'ean_upc' => trim($ean_code),
175
+ 'lang' => $locale,
176
+ 'output' => 'productxml'
177
+ ));
178
+ if ($xml_result = $this->_parseXml($resultString)) {
179
+ if ($icecatliveImportModel->checkIcecatResponse($xml_result->Product['ErrorMessage'])) {
180
+ $error = true;
181
+ }
182
+ }
183
+ } else {
184
+ $error = true;
185
+ }
186
+ }
187
+ if(!$error){
188
+ if(!$import_id){
189
+ if(empty($import_info['success_imported_product'])){
190
+ $import_info['success_imported_product'] = 1;
191
+ $DB_loger->insetrtUpdateLogValue('icecatlive_success_imported_product_temp', $import_info['success_imported_product']);
192
+ }else{
193
+ $import_info['success_imported_product'] += 1;
194
+ $DB_loger->insetrtUpdateLogValue('icecatlive_success_imported_product_temp', $import_info['success_imported_product']);
195
+ }
196
+ }
197
+ $this->_prepareCacheDir();
198
+ $this->_saveXmltoIcecatLiveCache($resultString, $entity_id, $locale);
199
+ $prod_title = (string)$xml_result->Product['Title'];
200
+
201
+ $this->_saveProductTitle($entity_id, $prod_title);
202
+ $icecatliveImportModel->_saveProductCatalogImage($entity_id, $xml_result->Product);
203
+ $icecatliveImportModel->loadGalleryPhotos($xml_result->Product->ProductGallery->ProductPicture);
204
+ $this->_saveImportMessage($entity_id, 'Success imported product from Icecat.');
205
+
206
+ if($import_id){
207
+ return $_product = $catalog_product_model->load($entity_id);
208
+ }
209
+
210
+ }else{
211
+ $this->deleteIdProductTitles($entity_id);
212
+ if($import_id){
213
+ return false;
214
+ }
215
+ // insert not import product id in table
216
+ if($this->_saveNotImportProductID($entity_id)){
217
+ if($product_onlynewproducts){
218
+ $import_info['current_product'] -= 1;
219
+ $DB_loger->insetrtUpdateLogValue('icecatlive_current_product_temp', $import_info['current_product']);
220
+ $import_info['count_products'] = $import_info['count_products'] - 1;
221
+ $DB_loger->insetrtUpdateLogValue('icecatlive_count_products_temp', $import_info['count_products']);
222
+ }
223
+ }
224
+ $import_info['error'] = $icecatliveImportModel->getErrorMessage();
225
+ $import_info['system_error'] = $icecatliveImportModel->getSystemError();
226
+ $this->_saveImportMessage($entity_id, $import_info['error'].$import_info['system_error']);
227
+ if (preg_match('/^Warning: You are not allowed to have Full ICEcat access$/', $import_info['error'])) {
228
+ if(empty($import_info['full_icecat_product'])){
229
+ $import_info['full_icecat_product'] = 1;
230
+ $DB_loger->insetrtUpdateLogValue('icecatlive_full_icecat_product_temp', $import_info['full_icecat_product']);
231
+ }else{
232
+ $import_info['full_icecat_product'] += 1;
233
+ $DB_loger->insetrtUpdateLogValue('icecatlive_full_icecat_product_temp', $import_info['full_icecat_product']);
234
+ }
235
+ }
236
+ if(empty($import_info['error_imported_product'])){
237
+ $import_info['error_imported_product'] = 1;
238
+ $DB_loger->insetrtUpdateLogValue('icecatlive_error_imported_product_temp', $import_info['error_imported_product']);
239
+ }else{
240
+ $import_info['error_imported_product'] += 1;
241
+ $DB_loger->insetrtUpdateLogValue('icecatlive_error_imported_product_temp', $import_info['error_imported_product']);
242
+ }
243
+ }
244
+ }else{
245
+ $import_info['current_product'] = 0;
246
+ $import_info['count_products'] = $this->getCountProducts($product_onlynewproducts);
247
+ if($import_info['count_products']){
248
+ $DB_loger->insetrtUpdateLogValue('icecatlive_current_product_temp',$import_info['current_product']);
249
+ $import_info['success_imported_product'] = 0;
250
+ $DB_loger->insetrtUpdateLogValue('icecatlive_success_imported_product', $import_info['success_imported_product']);
251
+ $DB_loger->insetrtUpdateLogValue('icecatlive_success_imported_product_temp', $import_info['success_imported_product']);
252
+ $DB_loger->insetrtUpdateLogValue('icecatlive_count_products_temp', $import_info['count_products']);
253
+ $import_info['error_imported_product'] = 0;
254
+ $DB_loger->insetrtUpdateLogValue('icecatlive_error_imported_product_temp', $import_info['error_imported_product']);
255
+ }
256
+ }
257
+
258
+ if($import_info['current_product'] == $import_info['count_products']){
259
+ $import_info['done'] = 1;
260
+ $DB_loger->insetrtUpdateLogValue('icecatlive_error_imported_product', $import_info['error_imported_product']);
261
+ $DB_loger->insetrtUpdateLogValue('icecatlive_success_imported_product', $import_info['success_imported_product']);
262
+ $DB_loger->insetrtUpdateLogValue('icecatlive_full_icecat_product', $import_info['full_icecat_product']);
263
+ $DB_loger->deleteLogKey('icecatlive_full_icecat_product_temp');
264
+ $DB_loger->deleteLogKey('icecatlive_current_product_temp');
265
+ $DB_loger->deleteLogKey('icecatlive_error_imported_product_temp');
266
+ $DB_loger->deleteLogKey('icecatlive_success_imported_product_temp');
267
+ $DB_loger->deleteLogKey('icecatlive_count_products_temp');
268
+ if($_GET['update'] != 1 && !$import_id){
269
+ $DB_loger->insetrtUpdateLogValue('icecatlive_enddate_imported_product', date('Y-m-d H:i:s'));
270
+ } elseif (!$import_id) {
271
+ $DB_loger->insetrtUpdateLogValue('icecatlive_enddate_update_product', date('Y-m-d H:i:s'));
272
+ }
273
+ if($crone){
274
+ return $import_info;
275
+ }
276
+ echo json_encode($import_info);
277
+ }else{
278
+ $DB_loger->insetrtUpdateLogValue('icecatlive_error_imported_product', $import_info['error_imported_product']);
279
+ $DB_loger->insetrtUpdateLogValue('icecatlive_success_imported_product', $import_info['success_imported_product']);
280
+ $DB_loger->insetrtUpdateLogValue('icecatlive_full_icecat_product', $import_info['full_icecat_product']);
281
+ $import_info['done'] = 0;
282
+ if($crone){
283
+ return $import_info;
284
+ }
285
+ echo json_encode($import_info);
286
+ }
287
+
288
+ }
289
+
290
+ public function _saveProductTitle($prod_id, $prod_title){
291
+ $connection = $this->getDbConnection();
292
+ $productsTitleTable = Mage::getSingleton('core/resource')->getTableName('icecatlive/products_titles');
293
+ try{
294
+ $sql = " INSERT INTO " . $productsTitleTable . " ( prod_id, prod_title)
295
+ VALUES('" . $prod_id . "', '" . $prod_title . "')
296
+ ON DUPLICATE KEY UPDATE
297
+ prod_title = VALUES(prod_title)";
298
+
299
+ $connection->query($sql);
300
+ } catch (Exception $e) {
301
+ Mage::log("connector issue: {$e->getMessage()}");
302
+ }
303
+ }
304
+
305
+ /**
306
+ * Return count product for imports
307
+ * @param integer $product_onlynewproducts
308
+ * @return integer
309
+ */
310
+ public function getCountProducts($product_onlynewproducts = 0) {
311
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
312
+ $tablePrefix = '';
313
+ $tPrefix = (array) Mage::getConfig()->getTablePrefix();
314
+ if (!empty($tPrefix)) {
315
+ $tablePrefix = $tPrefix[0];
316
+ }
317
+ $productsTitleTable = Mage::getSingleton('core/resource')->getTableName('icecatlive/products_titles');
318
+ $productsIdTable = Mage::getConfig()->getNode('default/icecatlive/noimportid_tables')->table_name;
319
+ $productsIdTable = $tablePrefix . $productsIdTable;
320
+ if (!$product_onlynewproducts) {
321
+ $query = "SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity` LEFT JOIN `" . $tablePrefix . $productsTitleTable ."` ON entity_id = prod_id WHERE prod_id IS NULL";
322
+ } else {
323
+ $query = "SELECT COUNT(*) FROM `" . $tablePrefix . "catalog_product_entity` AS cpe
324
+ LEFT JOIN `" . $tablePrefix . $productsTitleTable . "` AS iipt
325
+ ON cpe.`entity_id`= iipt.`prod_id`
326
+ LEFT JOIN `" . $productsIdTable . "` AS iinpi
327
+ ON iinpi.`prod_id` = cpe.`entity_id`
328
+ WHERE iipt.`prod_id` IS NULL AND iinpi.`prod_id` IS NULL;";
329
+ }
330
+ $count_products = $db_res->fetchRow($query);
331
+ return $count_products['COUNT(*)'];
332
+ }
333
+
334
+ /**
335
+ * Insert to table noimport_product_id this prod_id
336
+ * @param integer $prod_id
337
+ */
338
+ public function _saveNotImportProductID($prod_id){
339
+ $connection = $this->getDbConnection();
340
+
341
+ $tablePrefix = '';
342
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
343
+ if (!empty($tPrefix)) {
344
+ $tablePrefix = $tPrefix[0];
345
+ }
346
+ $productsIdTable = Mage::getConfig()->getNode('default/icecatlive/noimportid_tables')->table_name;
347
+ $productsIdTable = $tablePrefix . $productsIdTable;
348
+
349
+ try{
350
+ $sql = " INSERT INTO `" . $productsIdTable . "` ( prod_id )
351
+ VALUES(" . $prod_id . ")";
352
+ $connection->query($sql);
353
+ } catch (Exception $e) {
354
+ Mage::log("connector issue: {$e->getMessage()}");
355
+ }
356
+ return true;
357
+ }
358
+
359
+
360
+ public function _saveImportMessage($entity_id, $message){
361
+
362
+ $connection = $this->getDbConnection();
363
+ $tablePrefix = '';
364
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
365
+ if (!empty($tPrefix)) {
366
+ $tablePrefix = $tPrefix[0];
367
+ }
368
+ $query = '';
369
+ try{
370
+ $sql = 'SELECT ea.`attribute_id`, eea.`entity_type_id`, eea.`attribute_set_id` FROM eav_attribute AS ea
371
+ LEFT JOIN eav_entity_attribute AS eea
372
+ ON eea.`attribute_id` = ea.`attribute_id`
373
+ WHERE ea.`attribute_code`="icecatlive_import";';
374
+ $query = $connection->fetchRow($sql);
375
+ $attribute_id = $query['attribute_id'];
376
+ $entity_type_id = $query['entity_type_id'];
377
+ $attribute_set_id = $query['attribute_set_id'];
378
+
379
+ $sql = 'SELECT cpev.`store_id` FROM eav_attribute AS ea
380
+ LEFT JOIN catalog_product_entity_varchar AS cpev
381
+ ON ea.`attribute_id` = cpev.`attribute_id`
382
+ WHERE cpev.`entity_id`=' . $entity_id . ' AND (ea.`attribute_code` = "sku_type" OR ea.`attribute_code` = "mpn" OR ea.`attribute_code` = "ean" )
383
+ GROUP BY cpev.`entity_id`;';
384
+ $query = $connection->fetchRow($sql);
385
+ $store_id = $query['store_id'];
386
+
387
+ $sql = "DELETE FROM catalog_product_entity_varchar WHERE entity_id=".$entity_id.
388
+ " AND attribute_id=".$attribute_id." AND store_id=".$store_id.";";
389
+ $connection->query($sql);
390
+
391
+ $sql = "INSERT INTO `catalog_product_entity_varchar` ( value_id, entity_type_id, attribute_id, store_id, entity_id, value)
392
+ VALUES(NULL, " . $entity_type_id . ", " .$attribute_id. ", ".$store_id. ", " .$entity_id.", '".$message. "')";
393
+ $connection->query($sql);
394
+ } catch (Exception $e) {
395
+ Mage::log("connector issue: {$e->getMessage()}");
396
+ }
397
+ }
398
+
399
+
400
+ public function _saveXmltoIcecatLiveCache($resultString, $entity_id, $locale){
401
+ $current_prodCacheXml = Mage::getBaseDir('var') . $this->_connectorCacheDir . 'iceshop_icecatlive_' . $entity_id . '_' . $locale;
402
+ $current_prodCacheHandler = fopen($current_prodCacheXml, "w");
403
+ fwrite($current_prodCacheHandler, $resultString);
404
+ fclose ($current_prodCacheHandler);
405
+ }
406
+ /**
407
+ * parse given XML to SIMPLE XML
408
+ * @param string $stringXml
409
+ */
410
+ protected function _parseXml($stringXml)
411
+ {
412
+ libxml_use_internal_errors(true);
413
+ $simpleDoc = simplexml_load_string($stringXml);
414
+ if ($simpleDoc) {
415
+ return $simpleDoc;
416
+ }
417
+ $simpleDoc = simplexml_load_string(utf8_encode($stringXml));
418
+ if ($simpleDoc) {
419
+ return $simpleDoc;
420
+ }
421
+ return false;
422
+ }
423
+
424
+ /**
425
+ * Singletong for DB connection
426
+ */
427
+ private function getDbConnection()
428
+ {
429
+ if ($this->connection) {
430
+ return $this->connection;
431
+ }
432
+ $this->connection = Mage::getSingleton('core/resource')->getConnection('core_read');
433
+
434
+ return $this->connection;
435
+ }
436
+
437
+ /**
438
+ * Prepares file and folder for futur download
439
+ * @param string $fileName
440
+ */
441
+ protected function _prepareFile($fileName)
442
+ {
443
+ $varDir = Mage::getBaseDir('var') . $this->_connectorDir;
444
+ $filePath = $varDir . $fileName;
445
+ if (!is_dir($varDir)) {
446
+ mkdir($varDir, 0777, true);
447
+ }
448
+ return $filePath;
449
+ }
450
+ protected function _prepareCacheDir()
451
+ {
452
+ $varDir = Mage::getBaseDir('var') . $this->_connectorCacheDir;
453
+ if (!is_dir($varDir)) {
454
+ mkdir($varDir, 0777, true);
455
+ }
456
+ }
457
+
458
+ /**
459
+ * Method run import data in crontab jobs
460
+ * @param int $update param set update or import data
461
+ * @param bool $full_import_stat flag for set full_import
462
+ */
463
+ public function load($update = 0, $full_import_stat = false, $error_import = 0, $crone_start=1)
464
+ {
465
+ if($crone_start){
466
+ $date_crone_start = date('Y-m-d H:i:s');
467
+ $this->setCroneStatus('running',$date_crone_start,'icecatlive_load_data');
468
+ }
469
+ $DB_loger = Mage::helper('icecatlive/db');
470
+ try{
471
+ $DB_loger = Mage::helper('icecatlive/db');
472
+ if(!$full_import_stat){
473
+ $_GET['full_import'] = 1;
474
+ } else {
475
+ $_GET['full_import'] = '';
476
+ }
477
+ $_GET['error_import'] = $error_import;
478
+ $_GET['update'] = 0;
479
+ $result = $this->loadProductInfoIntoCache(0,1);
480
+ if($result['done'] != 1){
481
+ $this->load(0, true, 0, 0);
482
+ }
483
+ $DB_loger->insetrtUpdateLogValue('icecatlive_enddate_imported_product', date('Y-m-d H:i:s'));
484
+ } catch (Exception $e) {
485
+ $DB_loger->insetrtUpdateLogValue('import_icecat_server_error_message', $e->getMessage());
486
+ $this->load(0, true, 1, 0);
487
+ }
488
+ }
489
+
490
+ /**
491
+ * Method run updata in crontab jobs
492
+ */
493
+ public function loadUpdate($error_import = 0, $crone_start=1)
494
+ {
495
+ if($crone_start){
496
+ $date_crone_start = date('Y-m-d H:i:s');
497
+ $this->setCroneStatus('running',$date_crone_start,'icecatlive_load_updata');
498
+ }
499
+ $DB_loger = Mage::helper('icecatlive/db');
500
+ try{
501
+ $_GET['update'] = 1;
502
+ $_GET['error_import'] = $error_import;
503
+ $result = $this->loadProductInfoIntoCache(0,1);
504
+ if($result['done'] != 1){
505
+ $this->loadUpdate(0,0);
506
+ }
507
+ $DB_loger->deleteLogKey('import_icecat_server_error_message_update');
508
+ $DB_loger->insetrtUpdateLogValue('icecatlive_enddate_update_product', date('Y-m-d H:i:s'));
509
+ } catch (Exception $e) {
510
+ $DB_loger->insetrtUpdateLogValue('import_icecat_server_error_message_update', $e->getMessage());
511
+ $this->loadUpdate(1,0);
512
+ }
513
+ }
514
+
515
+ /**
516
+ * Delete row from products_titles tables
517
+ * if Icecat return error to this product
518
+ * @param integer $entity_id
519
+ */
520
+ public function deleteIdProductTitles($entity_id){
521
+ $connection = $this->getDbConnection();
522
+ $tablePrefix = '';
523
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
524
+ if (!empty($tPrefix)) {
525
+ $tablePrefix = $tPrefix[0];
526
+ }
527
+ $query = '';
528
+ try{
529
+ $sql = "DELETE FROM `".$tablePrefix."iceshop_icecatlive_products_titles` WHERE prod_id=".$entity_id.";";
530
+ $connection->query($sql);
531
+ $this->deleteCacheFile($entity_id);
532
+ } catch (Exception $e) {
533
+ Mage::log("connector issue: {$e->getMessage()}");
534
+ }
535
+ }
536
+
537
+ /**
538
+ * Delete product import file from cache folder
539
+ * @param integer $entity_id
540
+ */
541
+ public function deleteCacheFile($entity_id){
542
+ $import = new Iceshop_Icecatlive_Model_Observer();
543
+ $locale = Mage::getStoreConfig('icecat_root/icecat/language');
544
+ if ($locale == '0') {
545
+ $systemLocale = explode("_", Mage::app()->getLocale()->getLocaleCode());
546
+ $locale = $systemLocale[0];
547
+ }
548
+ $cache_file =Mage::getBaseDir('var') . $import->_connectorCacheDir . 'iceshop_icecatlive_'.$entity_id .'_' . $locale;
549
+ if(file_exists($cache_file)){
550
+ unlink($cache_file);
551
+ }
552
+ }
553
+
554
+
555
+ /**
556
+ * Change crone status in table `cron_schedule`
557
+ * @param string $status
558
+ * @param string $date_crone_start
559
+ * @param string $job_code
560
+ */
561
+ public function setCroneStatus($status = 'pending',$date_crone_start, $job_code){
562
+ try{
563
+ $db_res = Mage::getSingleton('core/resource')->getConnection('core_write');
564
+ $tablePrefix = '';
565
+ $tPrefix = (array)Mage::getConfig()->getTablePrefix();
566
+ if (!empty($tPrefix)) {
567
+ $tablePrefix = $tPrefix[0];
568
+ }
569
+ $db_res->query("UPDATE `{$tablePrefix}cron_schedule` SET status='$status' WHERE job_code = '$job_code' AND executed_at='$date_crone_start'");
570
+ } catch (Exception $e){
571
+
572
+ }
573
+ }
574
+
575
+ }
576
+
577
+ ?>
app/code/local/Iceshop/Icecatlive/Model/Relatedcollection.php CHANGED
@@ -1,69 +1,69 @@
1
- <?php
2
- class Iceshop_Icecatlive_Model_Relatedcollection extends Varien_Data_Collection
3
- {
4
-
5
- protected $_data = array();
6
- protected $_collection;
7
-
8
- public function __construct()
9
- {
10
- parent::__construct();
11
-
12
- // not extends Varien_Object
13
- $args = func_get_args();
14
- if (empty($args[0])) {
15
- $args[0] = array();
16
- }
17
- $this->_data = $args[0];
18
- }
19
-
20
- public function getCollection()
21
- {
22
- $sku = Mage::getStoreConfig('icecat_root/icecat/sku_field');
23
- $model = Mage::getModel('catalog/product');
24
- $collection = $model->getCollection();
25
-
26
- $filterArray = array();
27
- $rel = array();
28
- foreach ($this->_data as $res) {
29
- foreach ($res as $r) {
30
- $rel[] = $r;
31
- }
32
- }
33
- foreach ($rel as $item) {
34
- array_push($filterArray, array('attribute' => $sku, 'eq' => $item['mpn']));
35
- }
36
- $collection->addFieldToFilter($filterArray);
37
-
38
- $collection->joinField('is_in_stock',
39
- 'cataloginventory/stock_item',
40
- 'is_in_stock',
41
- 'product_id=entity_id',
42
- 'is_in_stock=1',
43
- '{{table}}.stock_id=1',
44
- 'left');
45
-
46
- $myCollection = clone $collection;
47
- $relCnt = count($rel);
48
- foreach ($myCollection as &$col) {
49
- $model->load($col->getId());
50
- $price = $model->getPrice();
51
- $mpn = $col->getData($sku);
52
- $specialPrice = $model->getSpecialPrice();
53
-
54
- for ($i = 0; $i < $relCnt; $i++) {
55
- if ($rel[$i]['mpn'] == $mpn) {
56
- $col->setData('name', $rel[$i]['name']);
57
- $col->setData('thumbnail', $rel[$i]['thumb']);
58
- $col->setData('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
59
- $col->setData('price', $price);
60
- $col->setData('special_price', $specialPrice);
61
- }
62
- }
63
- }
64
- return $myCollection;
65
-
66
- }
67
- }
68
-
69
- ?>
1
+ <?php
2
+ class Iceshop_Icecatlive_Model_Relatedcollection extends Varien_Data_Collection
3
+ {
4
+
5
+ protected $_data = array();
6
+ protected $_collection;
7
+
8
+ public function __construct()
9
+ {
10
+ parent::__construct();
11
+
12
+ // not extends Varien_Object
13
+ $args = func_get_args();
14
+ if (empty($args[0])) {
15
+ $args[0] = array();
16
+ }
17
+ $this->_data = $args[0];
18
+ }
19
+
20
+ public function getCollection()
21
+ {
22
+ $sku = Mage::getStoreConfig('icecat_root/icecat/sku_field');
23
+ $model = Mage::getModel('catalog/product');
24
+ $collection = $model->getCollection();
25
+
26
+ $filterArray = array();
27
+ $rel = array();
28
+ foreach ($this->_data as $res) {
29
+ foreach ($res as $r) {
30
+ $rel[] = $r;
31
+ }
32
+ }
33
+ foreach ($rel as $item) {
34
+ array_push($filterArray, array('attribute' => $sku, 'eq' => $item['mpn']));
35
+ }
36
+ $collection->addFieldToFilter($filterArray);
37
+
38
+ $collection->joinField('is_in_stock',
39
+ 'cataloginventory/stock_item',
40
+ 'is_in_stock',
41
+ 'product_id=entity_id',
42
+ 'is_in_stock=1',
43
+ '{{table}}.stock_id=1',
44
+ 'left');
45
+
46
+ $myCollection = clone $collection;
47
+ $relCnt = count($rel);
48
+ foreach ($myCollection as &$col) {
49
+ $model->load($col->getId());
50
+ $price = $model->getPrice();
51
+ $mpn = $col->getData($sku);
52
+ $specialPrice = $model->getSpecialPrice();
53
+
54
+ for ($i = 0; $i < $relCnt; $i++) {
55
+ if ($rel[$i]['mpn'] == $mpn) {
56
+ $col->setData('name', $rel[$i]['name']);
57
+ $col->setData('thumbnail', $rel[$i]['thumb']);
58
+ $col->setData('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
59
+ $col->setData('price', $price);
60
+ $col->setData('special_price', $specialPrice);
61
+ }
62
+ }
63
+ }
64
+ return $myCollection;
65
+
66
+ }
67
+ }
68
+
69
+ ?>
app/code/local/Iceshop/Icecatlive/Model/System/Config/Attributes.php CHANGED
@@ -1,21 +1,22 @@
1
- <?php
2
- /**
3
- * Class Provides product Attributes for BO menu
4
- *
5
- */
6
- class Iceshop_Icecatlive_Model_System_Config_Attributes
7
- {
8
- public function toOptionArray()
9
- {
10
- $attributesArray = Mage::getResourceModel('eav/entity_attribute_collection')
11
- ->setAttributeSetFilter(Mage::getResourceSingleton('catalog/product')->getEntityType()->getDefaultAttributeSetId());
12
- $outputAttributeArray = array();
13
- foreach ($attributesArray as $attribute) {
14
- $outputAttributeArray[$attribute['attribute_code']] = $attribute['attribute_code'];
15
- }
16
- ksort($outputAttributeArray);
17
- return $outputAttributeArray;
18
- }
19
- }
20
-
 
21
  ?>
1
+ <?php
2
+ /**
3
+ * Class Provides product Attributes for BO menu
4
+ *
5
+ */
6
+ class Iceshop_Icecatlive_Model_System_Config_Attributes
7
+ {
8
+ public function toOptionArray()
9
+ {
10
+ $attributesArray = Mage::getResourceModel('eav/entity_attribute_collection')
11
+ ->setAttributeSetFilter(Mage::getResourceSingleton('catalog/product')->getEntityType()->getDefaultAttributeSetId());
12
+ $outputAttributeArray = array();
13
+ $i = 0;
14
+ foreach ($attributesArray as $attribute) {
15
+ $outputAttributeArray[$attribute['attribute_code']] = $attribute['attribute_code'];
16
+ }
17
+ ksort($outputAttributeArray);
18
+ return $outputAttributeArray;
19
+ }
20
+ }
21
+
22
  ?>
app/code/local/Iceshop/Icecatlive/Model/System/Config/Checksystem.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iceshop_Icecatlive_Model_System_Config_Checksystem
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ 0 => base64_encode(Mage::getSingleton('adminhtml/url')->getUrl("adminhtml/icecatlive/system/"))
9
+ );
10
+ }
11
+ }
app/code/local/Iceshop/Icecatlive/Model/System/Config/Descriptionpriority.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
- class Iceshop_Icecatlive_Model_System_Config_Descriptionpriority
3
- {
4
- public function toOptionArray()
5
- {
6
- return array(
7
- 'Icecat' => 'From Icecat',
8
- 'Db' => 'From Database'
9
- );
10
-
11
- }
12
- }
13
-
14
- ?>
1
+ <?php
2
+ class Iceshop_Icecatlive_Model_System_Config_Descriptionpriority
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ 'Icecat' => 'From Icecat',
8
+ 'Db' => 'From Database'
9
+ );
10
+
11
+ }
12
+ }
13
+
14
+ ?>
app/code/local/Iceshop/Icecatlive/Model/System/Config/Iceshoplink.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iceshop_Icecatlive_Model_System_Config_Iceshoplink
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ 0 => base64_encode('http://www.iceshop.nl/contact/')
9
+ );
10
+ }
11
+ }
app/code/local/Iceshop/Icecatlive/Model/System/Config/Imagepriority.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
- class Iceshop_Icecatlive_Model_System_Config_Imagepriority
3
- {
4
- public function toOptionArray()
5
- {
6
- return array(
7
- 'Icecat' => 'From Icecat',
8
- 'Db' => 'From Database'
9
- );
10
-
11
- }
12
- }
13
-
14
- ?>
1
+ <?php
2
+ class Iceshop_Icecatlive_Model_System_Config_Imagepriority
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ 'Icecat' => 'From Icecat',
8
+ 'Db' => 'From Database'
9
+ );
10
+
11
+ }
12
+ }
13
+
14
+ ?>
app/code/local/Iceshop/Icecatlive/Model/System/Config/LanguageList.xml CHANGED
@@ -1,399 +1,399 @@
1
- <?xml version="1.0"?>
2
- <!DOCTYPE ICECAT-interface SYSTEM "http://data.icecat.biz/dtd/ICECAT-interface_response.dtd">
3
- <!-- source: ICEcat.biz 2009 -->
4
- <ICECAT-interface>
5
- <Response ID="50564949" Status="1" Date="Thu Oct 22 04:26:04 2009" Request_ID="1256178364">
6
- <LanguageList>
7
- <Language Code="portuguese" ID="11" ShortCode="PT" Sid="6184">
8
- <Name ID="40191" Value="Portuguese-Portuguese" langid="1"/>
9
- <Name ID="40192" Value="Portuguese-Portuguese" langid="2"/>
10
- <Name ID="40193" Value="Portuguese-Portuguese" langid="3"/>
11
- <Name ID="40194" Value="Portuguese-Portuguese" langid="4"/>
12
- <Name ID="40195" Value="Portuguese-Portuguese" langid="5"/>
13
- <Name ID="40196" Value="Portuguese-Portuguese" langid="6"/>
14
- <Name ID="198032" Value="Португальский-португальский" langid="8"/>
15
- <Name ID="50889" Value="" langid="12"/>
16
- <Name ID="205069" Value="Португальcька-Португалія" langid="25"/>
17
- </Language>
18
- <Language Code="bulgarian" ID="21" ShortCode="BG" Sid="9218">
19
- <Name ID="147616" Value="Bulgarian" langid="1"/>
20
- <Name ID="198042" Value="Болгарский" langid="8"/>
21
- <Name ID="205079" Value="Болгарська" langid="25"/>
22
- </Language>
23
- <Language Code="danish" ID="7" ShortCode="DK" Sid="6058">
24
- <Name ID="39312" Value="Danish" langid="1"/>
25
- <Name ID="39313" Value="Danish" langid="2"/>
26
- <Name ID="39314" Value="Danish" langid="3"/>
27
- <Name ID="39315" Value="Danish" langid="4"/>
28
- <Name ID="39316" Value="Danish" langid="5"/>
29
- <Name ID="39317" Value="Danish" langid="6"/>
30
- <Name ID="39318" Value="Danish" langid="7"/>
31
- <Name ID="198028" Value="Датский" langid="8"/>
32
- <Name ID="40294" Value="Danish" langid="9"/>
33
- <Name ID="40295" Value="Danish" langid="10"/>
34
- <Name ID="40296" Value="Danish" langid="11"/>
35
- <Name ID="40297" Value="Danish" langid="12"/>
36
- <Name ID="40298" Value="Danish" langid="13"/>
37
- <Name ID="40299" Value="Danish" langid="14"/>
38
- <Name ID="40300" Value="Danish" langid="15"/>
39
- <Name ID="40301" Value="Danish" langid="16"/>
40
- <Name ID="40302" Value="Danish" langid="17"/>
41
- <Name ID="205065" Value="Датська" langid="25"/>
42
- </Language>
43
- <Language Code="japanese" ID="26" ShortCode="JA" Sid="9635">
44
- <Name ID="224188" Value="Japanese" langid="1"/>
45
- <Name ID="224189" Value="Japanese" langid="2"/>
46
- <Name ID="224190" Value="Japanese" langid="3"/>
47
- <Name ID="224191" Value="Japanese" langid="4"/>
48
- <Name ID="224192" Value="Japanese" langid="5"/>
49
- <Name ID="224193" Value="Japanese" langid="6"/>
50
- <Name ID="224194" Value="Японский" langid="8"/>
51
- <Name ID="224195" Value="Японська" langid="25"/>
52
- <Name ID="224196" Value="Japanese" langid="26"/>
53
- </Language>
54
- <Language Code="finnish" ID="17" ShortCode="FI" Sid="6190">
55
- <Name ID="40227" Value="Finnish" langid="1"/>
56
- <Name ID="40228" Value="Finnish" langid="2"/>
57
- <Name ID="40229" Value="Finnish" langid="3"/>
58
- <Name ID="40230" Value="Finnish" langid="4"/>
59
- <Name ID="40231" Value="Finnish" langid="5"/>
60
- <Name ID="40232" Value="Finnish" langid="6"/>
61
- <Name ID="198038" Value="Финский" langid="8"/>
62
- <Name ID="50895" Value="" langid="12"/>
63
- <Name ID="205075" Value="Фінська" langid="25"/>
64
- </Language>
65
- <Language Code="dutch" ID="2" ShortCode="NL" Sid="3">
66
- <Name ID="3" Value="Dutch" langid="1"/>
67
- <Name ID="4" Value="Dutch" langid="2"/>
68
- <Name ID="6074" Value="Dutch" langid="3"/>
69
- <Name ID="14099" Value="Dutch" langid="4"/>
70
- <Name ID="18231" Value="Dutch" langid="5"/>
71
- <Name ID="22363" Value="Dutch" langid="6"/>
72
- <Name ID="34054" Value="Hollandsk" langid="7"/>
73
- <Name ID="198023" Value="Голландский" langid="8"/>
74
- <Name ID="40244" Value="Dutch" langid="9"/>
75
- <Name ID="40245" Value="Dutch" langid="10"/>
76
- <Name ID="40246" Value="Dutch" langid="11"/>
77
- <Name ID="40247" Value="Dutch" langid="12"/>
78
- <Name ID="40248" Value="Dutch" langid="13"/>
79
- <Name ID="40249" Value="Dutch" langid="14"/>
80
- <Name ID="40250" Value="Dutch" langid="15"/>
81
- <Name ID="40251" Value="Dutch" langid="16"/>
82
- <Name ID="40252" Value="Dutch" langid="17"/>
83
- <Name ID="205060" Value="Голландська" langid="25"/>
84
- </Language>
85
- <Language Code="georgian" ID="22" ShortCode="KA" Sid="9271">
86
- <Name ID="154954" Value="Georgian" langid="1"/>
87
- <Name ID="198043" Value="Грузинский" langid="8"/>
88
- <Name ID="205080" Value="Грузинська" langid="25"/>
89
- </Language>
90
- <Language Code="english" ID="1" ShortCode="EN" Sid="2">
91
- <Name ID="1" Value="English" langid="1"/>
92
- <Name ID="2" Value="English" langid="2"/>
93
- <Name ID="6073" Value="English" langid="3"/>
94
- <Name ID="14098" Value="English" langid="4"/>
95
- <Name ID="18230" Value="English" langid="5"/>
96
- <Name ID="22362" Value="English" langid="6"/>
97
- <Name ID="34053" Value="Engelsk" langid="7"/>
98
- <Name ID="198022" Value="Английский" langid="8"/>
99
- <Name ID="40234" Value="English" langid="9"/>
100
- <Name ID="40235" Value="English" langid="10"/>
101
- <Name ID="40236" Value="English" langid="11"/>
102
- <Name ID="40237" Value="English" langid="12"/>
103
- <Name ID="40238" Value="English" langid="13"/>
104
- <Name ID="40239" Value="English" langid="14"/>
105
- <Name ID="40240" Value="English" langid="15"/>
106
- <Name ID="40241" Value="English" langid="16"/>
107
- <Name ID="40242" Value="English" langid="17"/>
108
- <Name ID="205059" Value="Англійська" langid="25"/>
109
- </Language>
110
- <Language Code="greek" ID="18" ShortCode="EL" Sid="8587">
111
- <Name ID="113508" Value="Greek" langid="1"/>
112
- <Name ID="113509" Value="Greek" langid="2"/>
113
- <Name ID="113510" Value="Greek" langid="3"/>
114
- <Name ID="113511" Value="Greek" langid="4"/>
115
- <Name ID="113512" Value="Greek" langid="5"/>
116
- <Name ID="113513" Value="Greek" langid="6"/>
117
- <Name ID="198039" Value="Греческий" langid="8"/>
118
- <Name ID="205076" Value="Грецька" langid="25"/>
119
- </Language>
120
- <Language Code="romanian" ID="23" ShortCode="RO" Sid="9390">
121
- <Name ID="169100" Value="Romanian" langid="1"/>
122
- <Name ID="169101" Value="Romanian" langid="2"/>
123
- <Name ID="169102" Value="Romanian" langid="3"/>
124
- <Name ID="169103" Value="Romanian" langid="4"/>
125
- <Name ID="169104" Value="Romanian" langid="5"/>
126
- <Name ID="169105" Value="Romanian" langid="6"/>
127
- <Name ID="198044" Value="Румынский" langid="8"/>
128
- <Name ID="205081" Value="Румунська" langid="25"/>
129
- </Language>
130
- <Language Code="hungarian" ID="16" ShortCode="HU" Sid="6189">
131
- <Name ID="40221" Value="Hungarian" langid="1"/>
132
- <Name ID="40222" Value="Hungarian" langid="2"/>
133
- <Name ID="40223" Value="Hungarian" langid="3"/>
134
- <Name ID="40224" Value="Hungarian" langid="4"/>
135
- <Name ID="40225" Value="Hungarian" langid="5"/>
136
- <Name ID="40226" Value="Hungarian" langid="6"/>
137
- <Name ID="198037" Value="Венгерский" langid="8"/>
138
- <Name ID="50894" Value="" langid="12"/>
139
- <Name ID="205074" Value="Угорська" langid="25"/>
140
- </Language>
141
- <Language Code="swedish" ID="13" ShortCode="SE" Sid="6186">
142
- <Name ID="40203" Value="Swedish" langid="1"/>
143
- <Name ID="40204" Value="Swedish" langid="2"/>
144
- <Name ID="40205" Value="Swedish" langid="3"/>
145
- <Name ID="40206" Value="Swedish" langid="4"/>
146
- <Name ID="40207" Value="Swedish" langid="5"/>
147
- <Name ID="40208" Value="Swedish" langid="6"/>
148
- <Name ID="198034" Value="Шведский" langid="8"/>
149
- <Name ID="50891" Value="" langid="12"/>
150
- <Name ID="205071" Value="Швецька" langid="25"/>
151
- </Language>
152
- <Language Code="croatian" ID="29" ShortCode="HR" Sid="10132">
153
- <Name ID="270273" Value="Croatian" langid="1"/>
154
- <Name ID="270274" Value="Croatian" langid="2"/>
155
- <Name ID="270275" Value="Croatian" langid="3"/>
156
- <Name ID="270276" Value="Croatian" langid="4"/>
157
- <Name ID="270277" Value="Croatian" langid="5"/>
158
- <Name ID="270278" Value="Croatian" langid="6"/>
159
- <Name ID="270280" Value="Hrvatski" langid="29"/>
160
- </Language>
161
- <Language Code="catalan" ID="27" ShortCode="CA" Sid="9662">
162
- <Name ID="231955" Value="Catalan" langid="1"/>
163
- <Name ID="231956" Value="Catalan" langid="2"/>
164
- <Name ID="231957" Value="Catalan" langid="3"/>
165
- <Name ID="231958" Value="Catalan" langid="4"/>
166
- <Name ID="231959" Value="Catalan" langid="5"/>
167
- <Name ID="231960" Value="Catalan" langid="6"/>
168
- <Name ID="231962" Value="Каталанский" langid="8"/>
169
- <Name ID="231963" Value="Каталанська" langid="25"/>
170
- <Name ID="231961" Value="Català" langid="27"/>
171
- </Language>
172
- <Language Code="ukrainian" ID="25" ShortCode="UK" Sid="9577">
173
- <Name ID="198046" Value="Ukrainian" langid="1"/>
174
- <Name ID="198047" Value="Ukrainian" langid="2"/>
175
- <Name ID="198048" Value="Ukrainian" langid="3"/>
176
- <Name ID="198049" Value="Ukrainian" langid="4"/>
177
- <Name ID="198050" Value="Ukrainian" langid="5"/>
178
- <Name ID="198051" Value="Ukrainian" langid="6"/>
179
- <Name ID="198052" Value="Украинский" langid="8"/>
180
- <Name ID="198053" Value="Українська" langid="25"/>
181
- </Language>
182
- <Language Code="spanish" ID="6" ShortCode="ES" Sid="4797">
183
- <Name ID="14094" Value="Spanish" langid="1"/>
184
- <Name ID="14095" Value="Spanish" langid="2"/>
185
- <Name ID="14096" Value="Spanish" langid="3"/>
186
- <Name ID="18228" Value="Spanish" langid="4"/>
187
- <Name ID="106485" Value="Processo di simulazione dell'alba (intensità 0)" langid="5"/>
188
- <Name ID="26492" Value="Spanish" langid="6"/>
189
- <Name ID="38094" Value="Spansk" langid="7"/>
190
- <Name ID="198027" Value="Испанский" langid="8"/>
191
- <Name ID="40284" Value="Spanish" langid="9"/>
192
- <Name ID="40285" Value="Spanish" langid="10"/>
193
- <Name ID="40286" Value="Spanish" langid="11"/>
194
- <Name ID="40287" Value="Spanish" langid="12"/>
195
- <Name ID="40288" Value="Spanish" langid="13"/>
196
- <Name ID="40289" Value="Spanish" langid="14"/>
197
- <Name ID="40290" Value="Spanish" langid="15"/>
198
- <Name ID="40291" Value="Spanish" langid="16"/>
199
- <Name ID="40292" Value="Spanish" langid="17"/>
200
- <Name ID="205064" Value="Іспанська" langid="25"/>
201
- </Language>
202
- <Language Code="argentinian-spanish" ID="28" ShortCode="AR" Sid="9835">
203
- <Name ID="244259" Value="Argentinian-Spanish" langid="1"/>
204
- <Name ID="244260" Value="Argentinian-Spanish" langid="2"/>
205
- <Name ID="244261" Value="Argentinian-Spanish" langid="3"/>
206
- <Name ID="244262" Value="Argentinian-Spanish" langid="4"/>
207
- <Name ID="244263" Value="Argentinian-Spanish" langid="5"/>
208
- <Name ID="244264" Value="Argentinian-Spanish" langid="6"/>
209
- <Name ID="244265" Value="Argentinian-Spanish" langid="7"/>
210
- <Name ID="244266" Value="Argentinian-Spanish" langid="8"/>
211
- <Name ID="244267" Value="Argentinian-Spanish" langid="9"/>
212
- <Name ID="244268" Value="Argentinian-Spanish" langid="10"/>
213
- <Name ID="244269" Value="Argentinian-Spanish" langid="11"/>
214
- <Name ID="244270" Value="Argentinian-Spanish" langid="12"/>
215
- <Name ID="244271" Value="Argentinian-Spanish" langid="13"/>
216
- <Name ID="244272" Value="Argentinian-Spanish" langid="14"/>
217
- <Name ID="244273" Value="Argentinian-Spanish" langid="15"/>
218
- <Name ID="244274" Value="Argentinian-Spanish" langid="16"/>
219
- <Name ID="244275" Value="Argentinian-Spanish" langid="17"/>
220
- <Name ID="244276" Value="Argentinian-Spanish" langid="18"/>
221
- <Name ID="244277" Value="Argentinian-Spanish" langid="19"/>
222
- <Name ID="244278" Value="Argentinian-Spanish" langid="20"/>
223
- <Name ID="244279" Value="Argentinian-Spanish" langid="21"/>
224
- <Name ID="244280" Value="Argentinian-Spanish" langid="22"/>
225
- <Name ID="244281" Value="Argentinian-Spanish" langid="23"/>
226
- <Name ID="244282" Value="Argentinian-Spanish" langid="24"/>
227
- <Name ID="244283" Value="Argentinian-Spanish" langid="25"/>
228
- <Name ID="244284" Value="Argentinian-Spanish" langid="26"/>
229
- <Name ID="244285" Value="Argentinian-Spanish" langid="27"/>
230
- <Name ID="244286" Value="Argentinian-Spanish" langid="28"/>
231
- </Language>
232
- <Language Code="french" ID="3" ShortCode="FR" Sid="3036">
233
- <Name ID="6071" Value="French" langid="1"/>
234
- <Name ID="6072" Value="French" langid="2"/>
235
- <Name ID="8815" Value="French" langid="3"/>
236
- <Name ID="16579" Value="French" langid="4"/>
237
- <Name ID="103145" Value="Rapporto di compressione" langid="5"/>
238
- <Name ID="24843" Value="French" langid="6"/>
239
- <Name ID="36551" Value="Fransk" langid="7"/>
240
- <Name ID="198024" Value="Французский" langid="8"/>
241
- <Name ID="40254" Value="French" langid="9"/>
242
- <Name ID="40255" Value="French" langid="10"/>
243
- <Name ID="40256" Value="French" langid="11"/>
244
- <Name ID="40257" Value="French" langid="12"/>
245
- <Name ID="40258" Value="French" langid="13"/>
246
- <Name ID="40259" Value="French" langid="14"/>
247
- <Name ID="40260" Value="French" langid="15"/>
248
- <Name ID="40261" Value="French" langid="16"/>
249
- <Name ID="40262" Value="French" langid="17"/>
250
- <Name ID="205061" Value="Французька" langid="25"/>
251
- </Language>
252
- <Language Code="us english" ID="9" ShortCode="US" Sid="6182">
253
- <Name ID="40179" Value="US English" langid="1"/>
254
- <Name ID="40180" Value="US English" langid="2"/>
255
- <Name ID="40181" Value="US English" langid="3"/>
256
- <Name ID="40182" Value="US English" langid="4"/>
257
- <Name ID="40183" Value="US English" langid="5"/>
258
- <Name ID="40184" Value="US English" langid="6"/>
259
- <Name ID="198030" Value="Американский английский" langid="8"/>
260
- <Name ID="50887" Value="" langid="12"/>
261
- <Name ID="205067" Value="Англійська США" langid="25"/>
262
- </Language>
263
- <Language Code="chinese" ID="12" ShortCode="ZH" Sid="6185">
264
- <Name ID="40197" Value="Chinese" langid="1"/>
265
- <Name ID="40198" Value="Chinese" langid="2"/>
266
- <Name ID="40199" Value="Chinese" langid="3"/>
267
- <Name ID="40200" Value="Chinese" langid="4"/>
268
- <Name ID="40201" Value="Chinese" langid="5"/>
269
- <Name ID="40202" Value="Chinese" langid="6"/>
270
- <Name ID="198033" Value="Китайский" langid="8"/>
271
- <Name ID="50890" Value="" langid="12"/>
272
- <Name ID="205070" Value="Китайська" langid="25"/>
273
- </Language>
274
- <Language Code="turkish" ID="20" ShortCode="TR" Sid="8665">
275
- <Name ID="118819" Value="Turkish" langid="1"/>
276
- <Name ID="118820" Value="Turkish" langid="2"/>
277
- <Name ID="118821" Value="Turkish" langid="3"/>
278
- <Name ID="118822" Value="Turkish" langid="4"/>
279
- <Name ID="118823" Value="Turkish" langid="5"/>
280
- <Name ID="118824" Value="Turkish" langid="6"/>
281
- <Name ID="198041" Value="Турецкий" langid="8"/>
282
- <Name ID="205078" Value="Турецька" langid="25"/>
283
- </Language>
284
- <Language Code="polish" ID="14" ShortCode="PL" Sid="6187">
285
- <Name ID="40209" Value="Polish" langid="1"/>
286
- <Name ID="40210" Value="Polish" langid="2"/>
287
- <Name ID="40211" Value="Polish" langid="3"/>
288
- <Name ID="40212" Value="Polish" langid="4"/>
289
- <Name ID="40213" Value="Polish" langid="5"/>
290
- <Name ID="40214" Value="Polish" langid="6"/>
291
- <Name ID="198035" Value="Польский" langid="8"/>
292
- <Name ID="50892" Value="" langid="12"/>
293
- <Name ID="205072" Value="Польська" langid="25"/>
294
- </Language>
295
- <Language Code="czech" ID="15" ShortCode="CZ" Sid="6188">
296
- <Name ID="40215" Value="Czech" langid="1"/>
297
- <Name ID="40216" Value="Czech" langid="2"/>
298
- <Name ID="40217" Value="Czech" langid="3"/>
299
- <Name ID="40218" Value="Czech" langid="4"/>
300
- <Name ID="40219" Value="Czech" langid="5"/>
301
- <Name ID="40220" Value="Czech" langid="6"/>
302
- <Name ID="198036" Value="Чешский" langid="8"/>
303
- <Name ID="50893" Value="" langid="12"/>
304
- <Name ID="205073" Value="Чеська" langid="25"/>
305
- </Language>
306
- <Language Code="russian" ID="8" ShortCode="RU" Sid="6181">
307
- <Name ID="40173" Value="Russian" langid="1"/>
308
- <Name ID="40174" Value="Russian" langid="2"/>
309
- <Name ID="40175" Value="Russian" langid="3"/>
310
- <Name ID="40176" Value="Russian" langid="4"/>
311
- <Name ID="40177" Value="Russian" langid="5"/>
312
- <Name ID="40178" Value="Russian" langid="6"/>
313
- <Name ID="40303" Value="Russian" langid="7"/>
314
- <Name ID="198029" Value="Русский" langid="8"/>
315
- <Name ID="40305" Value="Russian" langid="9"/>
316
- <Name ID="40306" Value="Russian" langid="10"/>
317
- <Name ID="40307" Value="Russian" langid="11"/>
318
- <Name ID="40308" Value="Russian" langid="12"/>
319
- <Name ID="40309" Value="Russian" langid="13"/>
320
- <Name ID="40310" Value="Russian" langid="14"/>
321
- <Name ID="40311" Value="Russian" langid="15"/>
322
- <Name ID="40312" Value="Russian" langid="16"/>
323
- <Name ID="40313" Value="Russian" langid="17"/>
324
- <Name ID="205066" Value="Російська" langid="25"/>
325
- </Language>
326
- <Language Code="german" ID="4" ShortCode="DE" Sid="4795">
327
- <Name ID="14088" Value="German" langid="1"/>
328
- <Name ID="14089" Value="German" langid="2"/>
329
- <Name ID="14090" Value="German" langid="3"/>
330
- <Name ID="18226" Value="German" langid="4"/>
331
- <Name ID="104573" Value="Luce per una lettura agevole" langid="5"/>
332
- <Name ID="26490" Value="German" langid="6"/>
333
- <Name ID="38092" Value="Tysk" langid="7"/>
334
- <Name ID="198025" Value="Немецкий" langid="8"/>
335
- <Name ID="40264" Value="German" langid="9"/>
336
- <Name ID="40265" Value="German" langid="10"/>
337
- <Name ID="40266" Value="German" langid="11"/>
338
- <Name ID="40267" Value="German" langid="12"/>
339
- <Name ID="40268" Value="German" langid="13"/>
340
- <Name ID="40269" Value="German" langid="14"/>
341
- <Name ID="40270" Value="German" langid="15"/>
342
- <Name ID="40271" Value="German" langid="16"/>
343
- <Name ID="40272" Value="German" langid="17"/>
344
- <Name ID="205062" Value="Німецька" langid="25"/>
345
- </Language>
346
- <Language Code="serbian" ID="24" ShortCode="SR" Sid="9443">
347
- <Name ID="170887" Value="Serbian" langid="1"/>
348
- <Name ID="170888" Value="Serbian" langid="2"/>
349
- <Name ID="170889" Value="Serbian" langid="3"/>
350
- <Name ID="170890" Value="Serbian" langid="4"/>
351
- <Name ID="170891" Value="Serbian" langid="5"/>
352
- <Name ID="170892" Value="Serbian" langid="6"/>
353
- <Name ID="198045" Value="Сербский" langid="8"/>
354
- <Name ID="205082" Value="Сербська" langid="25"/>
355
- </Language>
356
- <Language Code="norwegian" ID="19" ShortCode="NO" Sid="8664">
357
- <Name ID="118813" Value="Norwegian" langid="1"/>
358
- <Name ID="118814" Value="Norwegian" langid="2"/>
359
- <Name ID="118815" Value="Norwegian" langid="3"/>
360
- <Name ID="118816" Value="Norwegian" langid="4"/>
361
- <Name ID="118817" Value="Norwegian" langid="5"/>
362
- <Name ID="118818" Value="Norwegian" langid="6"/>
363
- <Name ID="198040" Value="Норвежский" langid="8"/>
364
- <Name ID="205077" Value="Норвезька" langid="25"/>
365
- </Language>
366
- <Language Code="brazilian-portuguese" ID="10" ShortCode="BR" Sid="6183">
367
- <Name ID="40185" Value="Brazilian-Portuguese" langid="1"/>
368
- <Name ID="40186" Value="Brazilian-Portuguese" langid="2"/>
369
- <Name ID="40187" Value="Brazilian-Portuguese" langid="3"/>
370
- <Name ID="40188" Value="Brazilian-Portuguese" langid="4"/>
371
- <Name ID="40189" Value="Brazilian-Portuguese" langid="5"/>
372
- <Name ID="40190" Value="Brazilian-Portuguese" langid="6"/>
373
- <Name ID="198031" Value="Бразильский-португальский" langid="8"/>
374
- <Name ID="50888" Value="" langid="12"/>
375
- <Name ID="205068" Value="Португальська-Бразилія" langid="25"/>
376
- </Language>
377
- <Language Code="italian" ID="5" ShortCode="IT" Sid="4796">
378
- <Name ID="14091" Value="Italian" langid="1"/>
379
- <Name ID="14092" Value="Italian" langid="2"/>
380
- <Name ID="14093" Value="Italian" langid="3"/>
381
- <Name ID="18227" Value="Italian" langid="4"/>
382
- <Name ID="104579" Value="Funzione di on/off luce" langid="5"/>
383
- <Name ID="26491" Value="Italian" langid="6"/>
384
- <Name ID="38093" Value="Italiensk" langid="7"/>
385
- <Name ID="198026" Value="Итальянский" langid="8"/>
386
- <Name ID="40274" Value="Italian" langid="9"/>
387
- <Name ID="40275" Value="Italian" langid="10"/>
388
- <Name ID="40276" Value="Italian" langid="11"/>
389
- <Name ID="40277" Value="Italian" langid="12"/>
390
- <Name ID="40278" Value="Italian" langid="13"/>
391
- <Name ID="40279" Value="Italian" langid="14"/>
392
- <Name ID="40280" Value="Italian" langid="15"/>
393
- <Name ID="40281" Value="Italian" langid="16"/>
394
- <Name ID="40282" Value="Italian" langid="17"/>
395
- <Name ID="205063" Value="Італійська" langid="25"/>
396
- </Language>
397
- </LanguageList>
398
- </Response>
399
- </ICECAT-interface>
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE ICECAT-interface SYSTEM "http://data.icecat.biz/dtd/ICECAT-interface_response.dtd">
3
+ <!-- source: ICEcat.biz 2009 -->
4
+ <ICECAT-interface>
5
+ <Response ID="50564949" Status="1" Date="Thu Oct 22 04:26:04 2009" Request_ID="1256178364">
6
+ <LanguageList>
7
+ <Language Code="portuguese" ID="11" ShortCode="PT" Sid="6184">
8
+ <Name ID="40191" Value="Portuguese-Portuguese" langid="1"/>
9
+ <Name ID="40192" Value="Portuguese-Portuguese" langid="2"/>
10
+ <Name ID="40193" Value="Portuguese-Portuguese" langid="3"/>
11
+ <Name ID="40194" Value="Portuguese-Portuguese" langid="4"/>
12
+ <Name ID="40195" Value="Portuguese-Portuguese" langid="5"/>
13
+ <Name ID="40196" Value="Portuguese-Portuguese" langid="6"/>
14
+ <Name ID="198032" Value="Португальский-португальский" langid="8"/>
15
+ <Name ID="50889" Value="" langid="12"/>
16
+ <Name ID="205069" Value="Португальcька-Португалія" langid="25"/>
17
+ </Language>
18
+ <Language Code="bulgarian" ID="21" ShortCode="BG" Sid="9218">
19
+ <Name ID="147616" Value="Bulgarian" langid="1"/>
20
+ <Name ID="198042" Value="Болгарский" langid="8"/>
21
+ <Name ID="205079" Value="Болгарська" langid="25"/>
22
+ </Language>
23
+ <Language Code="danish" ID="7" ShortCode="DK" Sid="6058">
24
+ <Name ID="39312" Value="Danish" langid="1"/>
25
+ <Name ID="39313" Value="Danish" langid="2"/>
26
+ <Name ID="39314" Value="Danish" langid="3"/>
27
+ <Name ID="39315" Value="Danish" langid="4"/>
28
+ <Name ID="39316" Value="Danish" langid="5"/>
29
+ <Name ID="39317" Value="Danish" langid="6"/>
30
+ <Name ID="39318" Value="Danish" langid="7"/>
31
+ <Name ID="198028" Value="Датский" langid="8"/>
32
+ <Name ID="40294" Value="Danish" langid="9"/>
33
+ <Name ID="40295" Value="Danish" langid="10"/>
34
+ <Name ID="40296" Value="Danish" langid="11"/>
35
+ <Name ID="40297" Value="Danish" langid="12"/>
36
+ <Name ID="40298" Value="Danish" langid="13"/>
37
+ <Name ID="40299" Value="Danish" langid="14"/>
38
+ <Name ID="40300" Value="Danish" langid="15"/>
39
+ <Name ID="40301" Value="Danish" langid="16"/>
40
+ <Name ID="40302" Value="Danish" langid="17"/>
41
+ <Name ID="205065" Value="Датська" langid="25"/>
42
+ </Language>
43
+ <Language Code="japanese" ID="26" ShortCode="JA" Sid="9635">
44
+ <Name ID="224188" Value="Japanese" langid="1"/>
45
+ <Name ID="224189" Value="Japanese" langid="2"/>
46
+ <Name ID="224190" Value="Japanese" langid="3"/>
47
+ <Name ID="224191" Value="Japanese" langid="4"/>
48
+ <Name ID="224192" Value="Japanese" langid="5"/>
49
+ <Name ID="224193" Value="Japanese" langid="6"/>
50
+ <Name ID="224194" Value="Японский" langid="8"/>
51
+ <Name ID="224195" Value="Японська" langid="25"/>
52
+ <Name ID="224196" Value="Japanese" langid="26"/>
53
+ </Language>
54
+ <Language Code="finnish" ID="17" ShortCode="FI" Sid="6190">
55
+ <Name ID="40227" Value="Finnish" langid="1"/>
56
+ <Name ID="40228" Value="Finnish" langid="2"/>
57
+ <Name ID="40229" Value="Finnish" langid="3"/>
58
+ <Name ID="40230" Value="Finnish" langid="4"/>
59
+ <Name ID="40231" Value="Finnish" langid="5"/>
60
+ <Name ID="40232" Value="Finnish" langid="6"/>
61
+ <Name ID="198038" Value="Финский" langid="8"/>
62
+ <Name ID="50895" Value="" langid="12"/>
63
+ <Name ID="205075" Value="Фінська" langid="25"/>
64
+ </Language>
65
+ <Language Code="dutch" ID="2" ShortCode="NL" Sid="3">
66
+ <Name ID="3" Value="Dutch" langid="1"/>
67
+ <Name ID="4" Value="Dutch" langid="2"/>
68
+ <Name ID="6074" Value="Dutch" langid="3"/>
69
+ <Name ID="14099" Value="Dutch" langid="4"/>
70
+ <Name ID="18231" Value="Dutch" langid="5"/>
71
+ <Name ID="22363" Value="Dutch" langid="6"/>
72
+ <Name ID="34054" Value="Hollandsk" langid="7"/>
73
+ <Name ID="198023" Value="Голландский" langid="8"/>
74
+ <Name ID="40244" Value="Dutch" langid="9"/>
75
+ <Name ID="40245" Value="Dutch" langid="10"/>
76
+ <Name ID="40246" Value="Dutch" langid="11"/>
77
+ <Name ID="40247" Value="Dutch" langid="12"/>
78
+ <Name ID="40248" Value="Dutch" langid="13"/>
79
+ <Name ID="40249" Value="Dutch" langid="14"/>
80
+ <Name ID="40250" Value="Dutch" langid="15"/>
81
+ <Name ID="40251" Value="Dutch" langid="16"/>
82
+ <Name ID="40252" Value="Dutch" langid="17"/>
83
+ <Name ID="205060" Value="Голландська" langid="25"/>
84
+ </Language>
85
+ <Language Code="georgian" ID="22" ShortCode="KA" Sid="9271">
86
+ <Name ID="154954" Value="Georgian" langid="1"/>
87
+ <Name ID="198043" Value="Грузинский" langid="8"/>
88
+ <Name ID="205080" Value="Грузинська" langid="25"/>
89
+ </Language>
90
+ <Language Code="english" ID="1" ShortCode="EN" Sid="2">
91
+ <Name ID="1" Value="English" langid="1"/>
92
+ <Name ID="2" Value="English" langid="2"/>
93
+ <Name ID="6073" Value="English" langid="3"/>
94
+ <Name ID="14098" Value="English" langid="4"/>
95
+ <Name ID="18230" Value="English" langid="5"/>
96
+ <Name ID="22362" Value="English" langid="6"/>
97
+ <Name ID="34053" Value="Engelsk" langid="7"/>
98
+ <Name ID="198022" Value="Английский" langid="8"/>
99
+ <Name ID="40234" Value="English" langid="9"/>
100
+ <Name ID="40235" Value="English" langid="10"/>
101
+ <Name ID="40236" Value="English" langid="11"/>
102
+ <Name ID="40237" Value="English" langid="12"/>
103
+ <Name ID="40238" Value="English" langid="13"/>
104
+ <Name ID="40239" Value="English" langid="14"/>
105
+ <Name ID="40240" Value="English" langid="15"/>
106
+ <Name ID="40241" Value="English" langid="16"/>
107
+ <Name ID="40242" Value="English" langid="17"/>
108
+ <Name ID="205059" Value="Англійська" langid="25"/>
109
+ </Language>
110
+ <Language Code="greek" ID="18" ShortCode="EL" Sid="8587">
111
+ <Name ID="113508" Value="Greek" langid="1"/>
112
+ <Name ID="113509" Value="Greek" langid="2"/>
113
+ <Name ID="113510" Value="Greek" langid="3"/>
114
+ <Name ID="113511" Value="Greek" langid="4"/>
115
+ <Name ID="113512" Value="Greek" langid="5"/>
116
+ <Name ID="113513" Value="Greek" langid="6"/>
117
+ <Name ID="198039" Value="Греческий" langid="8"/>
118
+ <Name ID="205076" Value="Грецька" langid="25"/>
119
+ </Language>
120
+ <Language Code="romanian" ID="23" ShortCode="RO" Sid="9390">
121
+ <Name ID="169100" Value="Romanian" langid="1"/>
122
+ <Name ID="169101" Value="Romanian" langid="2"/>
123
+ <Name ID="169102" Value="Romanian" langid="3"/>
124
+ <Name ID="169103" Value="Romanian" langid="4"/>
125
+ <Name ID="169104" Value="Romanian" langid="5"/>
126
+ <Name ID="169105" Value="Romanian" langid="6"/>
127
+ <Name ID="198044" Value="Румынский" langid="8"/>
128
+ <Name ID="205081" Value="Румунська" langid="25"/>
129
+ </Language>
130
+ <Language Code="hungarian" ID="16" ShortCode="HU" Sid="6189">
131
+ <Name ID="40221" Value="Hungarian" langid="1"/>
132
+ <Name ID="40222" Value="Hungarian" langid="2"/>
133
+ <Name ID="40223" Value="Hungarian" langid="3"/>
134
+ <Name ID="40224" Value="Hungarian" langid="4"/>
135
+ <Name ID="40225" Value="Hungarian" langid="5"/>
136
+ <Name ID="40226" Value="Hungarian" langid="6"/>
137
+ <Name ID="198037" Value="Венгерский" langid="8"/>
138
+ <Name ID="50894" Value="" langid="12"/>
139
+ <Name ID="205074" Value="Угорська" langid="25"/>
140
+ </Language>
141
+ <Language Code="swedish" ID="13" ShortCode="SE" Sid="6186">
142
+ <Name ID="40203" Value="Swedish" langid="1"/>
143
+ <Name ID="40204" Value="Swedish" langid="2"/>
144
+ <Name ID="40205" Value="Swedish" langid="3"/>
145
+ <Name ID="40206" Value="Swedish" langid="4"/>
146
+ <Name ID="40207" Value="Swedish" langid="5"/>
147
+ <Name ID="40208" Value="Swedish" langid="6"/>
148
+ <Name ID="198034" Value="Шведский" langid="8"/>
149
+ <Name ID="50891" Value="" langid="12"/>
150
+ <Name ID="205071" Value="Швецька" langid="25"/>
151
+ </Language>
152
+ <Language Code="croatian" ID="29" ShortCode="HR" Sid="10132">
153
+ <Name ID="270273" Value="Croatian" langid="1"/>
154
+ <Name ID="270274" Value="Croatian" langid="2"/>
155
+ <Name ID="270275" Value="Croatian" langid="3"/>
156
+ <Name ID="270276" Value="Croatian" langid="4"/>
157
+ <Name ID="270277" Value="Croatian" langid="5"/>
158
+ <Name ID="270278" Value="Croatian" langid="6"/>
159
+ <Name ID="270280" Value="Hrvatski" langid="29"/>
160
+ </Language>
161
+ <Language Code="catalan" ID="27" ShortCode="CA" Sid="9662">
162
+ <Name ID="231955" Value="Catalan" langid="1"/>
163
+ <Name ID="231956" Value="Catalan" langid="2"/>
164
+ <Name ID="231957" Value="Catalan" langid="3"/>
165
+ <Name ID="231958" Value="Catalan" langid="4"/>
166
+ <Name ID="231959" Value="Catalan" langid="5"/>
167
+ <Name ID="231960" Value="Catalan" langid="6"/>
168
+ <Name ID="231962" Value="Каталанский" langid="8"/>
169
+ <Name ID="231963" Value="Каталанська" langid="25"/>
170
+ <Name ID="231961" Value="Català" langid="27"/>
171
+ </Language>
172
+ <Language Code="ukrainian" ID="25" ShortCode="UK" Sid="9577">
173
+ <Name ID="198046" Value="Ukrainian" langid="1"/>
174
+ <Name ID="198047" Value="Ukrainian" langid="2"/>
175
+ <Name ID="198048" Value="Ukrainian" langid="3"/>
176
+ <Name ID="198049" Value="Ukrainian" langid="4"/>
177
+ <Name ID="198050" Value="Ukrainian" langid="5"/>
178
+ <Name ID="198051" Value="Ukrainian" langid="6"/>
179
+ <Name ID="198052" Value="Украинский" langid="8"/>
180
+ <Name ID="198053" Value="Українська" langid="25"/>
181
+ </Language>
182
+ <Language Code="spanish" ID="6" ShortCode="ES" Sid="4797">
183
+ <Name ID="14094" Value="Spanish" langid="1"/>
184
+ <Name ID="14095" Value="Spanish" langid="2"/>
185
+ <Name ID="14096" Value="Spanish" langid="3"/>
186
+ <Name ID="18228" Value="Spanish" langid="4"/>
187
+ <Name ID="106485" Value="Processo di simulazione dell'alba (intensità 0)" langid="5"/>
188
+ <Name ID="26492" Value="Spanish" langid="6"/>
189
+ <Name ID="38094" Value="Spansk" langid="7"/>
190
+ <Name ID="198027" Value="Испанский" langid="8"/>
191
+ <Name ID="40284" Value="Spanish" langid="9"/>
192
+ <Name ID="40285" Value="Spanish" langid="10"/>
193
+ <Name ID="40286" Value="Spanish" langid="11"/>
194
+ <Name ID="40287" Value="Spanish" langid="12"/>
195
+ <Name ID="40288" Value="Spanish" langid="13"/>
196
+ <Name ID="40289" Value="Spanish" langid="14"/>
197
+ <Name ID="40290" Value="Spanish" langid="15"/>
198
+ <Name ID="40291" Value="Spanish" langid="16"/>
199
+ <Name ID="40292" Value="Spanish" langid="17"/>
200
+ <Name ID="205064" Value="Іспанська" langid="25"/>
201
+ </Language>
202
+ <Language Code="argentinian-spanish" ID="28" ShortCode="AR" Sid="9835">
203
+ <Name ID="244259" Value="Argentinian-Spanish" langid="1"/>
204
+ <Name ID="244260" Value="Argentinian-Spanish" langid="2"/>
205
+ <Name ID="244261" Value="Argentinian-Spanish" langid="3"/>
206
+ <Name ID="244262" Value="Argentinian-Spanish" langid="4"/>
207
+ <Name ID="244263" Value="Argentinian-Spanish" langid="5"/>
208
+ <Name ID="244264" Value="Argentinian-Spanish" langid="6"/>
209
+ <Name ID="244265" Value="Argentinian-Spanish" langid="7"/>
210
+ <Name ID="244266" Value="Argentinian-Spanish" langid="8"/>
211
+ <Name ID="244267" Value="Argentinian-Spanish" langid="9"/>
212
+ <Name ID="244268" Value="Argentinian-Spanish" langid="10"/>
213
+ <Name ID="244269" Value="Argentinian-Spanish" langid="11"/>
214
+ <Name ID="244270" Value="Argentinian-Spanish" langid="12"/>
215
+ <Name ID="244271" Value="Argentinian-Spanish" langid="13"/>
216
+ <Name ID="244272" Value="Argentinian-Spanish" langid="14"/>
217
+ <Name ID="244273" Value="Argentinian-Spanish" langid="15"/>
218
+ <Name ID="244274" Value="Argentinian-Spanish" langid="16"/>
219
+ <Name ID="244275" Value="Argentinian-Spanish" langid="17"/>
220
+ <Name ID="244276" Value="Argentinian-Spanish" langid="18"/>
221
+ <Name ID="244277" Value="Argentinian-Spanish" langid="19"/>
222
+ <Name ID="244278" Value="Argentinian-Spanish" langid="20"/>
223
+ <Name ID="244279" Value="Argentinian-Spanish" langid="21"/>
224
+ <Name ID="244280" Value="Argentinian-Spanish" langid="22"/>
225
+ <Name ID="244281" Value="Argentinian-Spanish" langid="23"/>
226
+ <Name ID="244282" Value="Argentinian-Spanish" langid="24"/>
227
+ <Name ID="244283" Value="Argentinian-Spanish" langid="25"/>
228
+ <Name ID="244284" Value="Argentinian-Spanish" langid="26"/>
229
+ <Name ID="244285" Value="Argentinian-Spanish" langid="27"/>
230
+ <Name ID="244286" Value="Argentinian-Spanish" langid="28"/>
231
+ </Language>
232
+ <Language Code="french" ID="3" ShortCode="FR" Sid="3036">
233
+ <Name ID="6071" Value="French" langid="1"/>
234
+ <Name ID="6072" Value="French" langid="2"/>
235
+ <Name ID="8815" Value="French" langid="3"/>
236
+ <Name ID="16579" Value="French" langid="4"/>
237
+ <Name ID="103145" Value="Rapporto di compressione" langid="5"/>
238
+ <Name ID="24843" Value="French" langid="6"/>
239
+ <Name ID="36551" Value="Fransk" langid="7"/>
240
+ <Name ID="198024" Value="Французский" langid="8"/>
241
+ <Name ID="40254" Value="French" langid="9"/>
242
+ <Name ID="40255" Value="French" langid="10"/>
243
+ <Name ID="40256" Value="French" langid="11"/>
244
+ <Name ID="40257" Value="French" langid="12"/>
245
+ <Name ID="40258" Value="French" langid="13"/>
246
+ <Name ID="40259" Value="French" langid="14"/>
247
+ <Name ID="40260" Value="French" langid="15"/>
248
+ <Name ID="40261" Value="French" langid="16"/>
249
+ <Name ID="40262" Value="French" langid="17"/>
250
+ <Name ID="205061" Value="Французька" langid="25"/>
251
+ </Language>
252
+ <Language Code="us english" ID="9" ShortCode="US" Sid="6182">
253
+ <Name ID="40179" Value="US English" langid="1"/>
254
+ <Name ID="40180" Value="US English" langid="2"/>
255
+ <Name ID="40181" Value="US English" langid="3"/>
256
+ <Name ID="40182" Value="US English" langid="4"/>
257
+ <Name ID="40183" Value="US English" langid="5"/>
258
+ <Name ID="40184" Value="US English" langid="6"/>
259
+ <Name ID="198030" Value="Американский английский" langid="8"/>
260
+ <Name ID="50887" Value="" langid="12"/>
261
+ <Name ID="205067" Value="Англійська США" langid="25"/>
262
+ </Language>
263
+ <Language Code="chinese" ID="12" ShortCode="ZH" Sid="6185">
264
+ <Name ID="40197" Value="Chinese" langid="1"/>
265
+ <Name ID="40198" Value="Chinese" langid="2"/>
266
+ <Name ID="40199" Value="Chinese" langid="3"/>
267
+ <Name ID="40200" Value="Chinese" langid="4"/>
268
+ <Name ID="40201" Value="Chinese" langid="5"/>
269
+ <Name ID="40202" Value="Chinese" langid="6"/>
270
+ <Name ID="198033" Value="Китайский" langid="8"/>
271
+ <Name ID="50890" Value="" langid="12"/>
272
+ <Name ID="205070" Value="Китайська" langid="25"/>
273
+ </Language>
274
+ <Language Code="turkish" ID="20" ShortCode="TR" Sid="8665">
275
+ <Name ID="118819" Value="Turkish" langid="1"/>
276
+ <Name ID="118820" Value="Turkish" langid="2"/>
277
+ <Name ID="118821" Value="Turkish" langid="3"/>
278
+ <Name ID="118822" Value="Turkish" langid="4"/>
279
+ <Name ID="118823" Value="Turkish" langid="5"/>
280
+ <Name ID="118824" Value="Turkish" langid="6"/>
281
+ <Name ID="198041" Value="Турецкий" langid="8"/>
282
+ <Name ID="205078" Value="Турецька" langid="25"/>
283
+ </Language>
284
+ <Language Code="polish" ID="14" ShortCode="PL" Sid="6187">
285
+ <Name ID="40209" Value="Polish" langid="1"/>
286
+ <Name ID="40210" Value="Polish" langid="2"/>
287
+ <Name ID="40211" Value="Polish" langid="3"/>
288
+ <Name ID="40212" Value="Polish" langid="4"/>
289
+ <Name ID="40213" Value="Polish" langid="5"/>
290
+ <Name ID="40214" Value="Polish" langid="6"/>
291
+ <Name ID="198035" Value="Польский" langid="8"/>
292
+ <Name ID="50892" Value="" langid="12"/>
293
+ <Name ID="205072" Value="Польська" langid="25"/>
294
+ </Language>
295
+ <Language Code="czech" ID="15" ShortCode="CZ" Sid="6188">
296
+ <Name ID="40215" Value="Czech" langid="1"/>
297
+ <Name ID="40216" Value="Czech" langid="2"/>
298
+ <Name ID="40217" Value="Czech" langid="3"/>
299
+ <Name ID="40218" Value="Czech" langid="4"/>
300
+ <Name ID="40219" Value="Czech" langid="5"/>
301
+ <Name ID="40220" Value="Czech" langid="6"/>
302
+ <Name ID="198036" Value="Чешский" langid="8"/>
303
+ <Name ID="50893" Value="" langid="12"/>
304
+ <Name ID="205073" Value="Чеська" langid="25"/>
305
+ </Language>
306
+ <Language Code="russian" ID="8" ShortCode="RU" Sid="6181">
307
+ <Name ID="40173" Value="Russian" langid="1"/>
308
+ <Name ID="40174" Value="Russian" langid="2"/>
309
+ <Name ID="40175" Value="Russian" langid="3"/>
310
+ <Name ID="40176" Value="Russian" langid="4"/>
311
+ <Name ID="40177" Value="Russian" langid="5"/>
312
+ <Name ID="40178" Value="Russian" langid="6"/>
313
+ <Name ID="40303" Value="Russian" langid="7"/>
314
+ <Name ID="198029" Value="Русский" langid="8"/>
315
+ <Name ID="40305" Value="Russian" langid="9"/>
316
+ <Name ID="40306" Value="Russian" langid="10"/>
317
+ <Name ID="40307" Value="Russian" langid="11"/>
318
+ <Name ID="40308" Value="Russian" langid="12"/>
319
+ <Name ID="40309" Value="Russian" langid="13"/>
320
+ <Name ID="40310" Value="Russian" langid="14"/>
321
+ <Name ID="40311" Value="Russian" langid="15"/>
322
+ <Name ID="40312" Value="Russian" langid="16"/>
323
+ <Name ID="40313" Value="Russian" langid="17"/>
324
+ <Name ID="205066" Value="Російська" langid="25"/>
325
+ </Language>
326
+ <Language Code="german" ID="4" ShortCode="DE" Sid="4795">
327
+ <Name ID="14088" Value="German" langid="1"/>
328
+ <Name ID="14089" Value="German" langid="2"/>
329
+ <Name ID="14090" Value="German" langid="3"/>
330
+ <Name ID="18226" Value="German" langid="4"/>
331
+ <Name ID="104573" Value="Luce per una lettura agevole" langid="5"/>
332
+ <Name ID="26490" Value="German" langid="6"/>
333
+ <Name ID="38092" Value="Tysk" langid="7"/>
334
+ <Name ID="198025" Value="Немецкий" langid="8"/>
335
+ <Name ID="40264" Value="German" langid="9"/>
336
+ <Name ID="40265" Value="German" langid="10"/>
337
+ <Name ID="40266" Value="German" langid="11"/>
338
+ <Name ID="40267" Value="German" langid="12"/>
339
+ <Name ID="40268" Value="German" langid="13"/>
340
+ <Name ID="40269" Value="German" langid="14"/>
341
+ <Name ID="40270" Value="German" langid="15"/>
342
+ <Name ID="40271" Value="German" langid="16"/>
343
+ <Name ID="40272" Value="German" langid="17"/>
344
+ <Name ID="205062" Value="Німецька" langid="25"/>
345
+ </Language>
346
+ <Language Code="serbian" ID="24" ShortCode="SR" Sid="9443">
347
+ <Name ID="170887" Value="Serbian" langid="1"/>
348
+ <Name ID="170888" Value="Serbian" langid="2"/>
349
+ <Name ID="170889" Value="Serbian" langid="3"/>
350
+ <Name ID="170890" Value="Serbian" langid="4"/>
351
+ <Name ID="170891" Value="Serbian" langid="5"/>
352
+ <Name ID="170892" Value="Serbian" langid="6"/>
353
+ <Name ID="198045" Value="Сербский" langid="8"/>
354
+ <Name ID="205082" Value="Сербська" langid="25"/>
355
+ </Language>
356
+ <Language Code="norwegian" ID="19" ShortCode="NO" Sid="8664">
357
+ <Name ID="118813" Value="Norwegian" langid="1"/>
358
+ <Name ID="118814" Value="Norwegian" langid="2"/>
359
+ <Name ID="118815" Value="Norwegian" langid="3"/>
360
+ <Name ID="118816" Value="Norwegian" langid="4"/>
361
+ <Name ID="118817" Value="Norwegian" langid="5"/>
362
+ <Name ID="118818" Value="Norwegian" langid="6"/>
363
+ <Name ID="198040" Value="Норвежский" langid="8"/>
364
+ <Name ID="205077" Value="Норвезька" langid="25"/>
365
+ </Language>
366
+ <Language Code="brazilian-portuguese" ID="10" ShortCode="BR" Sid="6183">
367
+ <Name ID="40185" Value="Brazilian-Portuguese" langid="1"/>
368
+ <Name ID="40186" Value="Brazilian-Portuguese" langid="2"/>
369
+ <Name ID="40187" Value="Brazilian-Portuguese" langid="3"/>
370
+ <Name ID="40188" Value="Brazilian-Portuguese" langid="4"/>
371
+ <Name ID="40189" Value="Brazilian-Portuguese" langid="5"/>
372
+ <Name ID="40190" Value="Brazilian-Portuguese" langid="6"/>
373
+ <Name ID="198031" Value="Бразильский-португальский" langid="8"/>
374
+ <Name ID="50888" Value="" langid="12"/>
375
+ <Name ID="205068" Value="Португальська-Бразилія" langid="25"/>
376
+ </Language>
377
+ <Language Code="italian" ID="5" ShortCode="IT" Sid="4796">
378
+ <Name ID="14091" Value="Italian" langid="1"/>
379
+ <Name ID="14092" Value="Italian" langid="2"/>
380
+ <Name ID="14093" Value="Italian" langid="3"/>
381
+ <Name ID="18227" Value="Italian" langid="4"/>
382
+ <Name ID="104579" Value="Funzione di on/off luce" langid="5"/>
383
+ <Name ID="26491" Value="Italian" langid="6"/>
384
+ <Name ID="38093" Value="Italiensk" langid="7"/>
385
+ <Name ID="198026" Value="Итальянский" langid="8"/>
386
+ <Name ID="40274" Value="Italian" langid="9"/>
387
+ <Name ID="40275" Value="Italian" langid="10"/>
388
+ <Name ID="40276" Value="Italian" langid="11"/>
389
+ <Name ID="40277" Value="Italian" langid="12"/>
390
+ <Name ID="40278" Value="Italian" langid="13"/>
391
+ <Name ID="40279" Value="Italian" langid="14"/>
392
+ <Name ID="40280" Value="Italian" langid="15"/>
393
+ <Name ID="40281" Value="Italian" langid="16"/>
394
+ <Name ID="40282" Value="Italian" langid="17"/>
395
+ <Name ID="205063" Value="Італійська" langid="25"/>
396
+ </Language>
397
+ </LanguageList>
398
+ </Response>
399
+ </ICECAT-interface>
app/code/local/Iceshop/Icecatlive/Model/System/Config/Loadingtype.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iceshop_Icecatlive_Model_System_Config_Loadingtype
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ '0' => 'From cache',
8
+ '1' => "Realtime (If cache doesn't exist)"
9
+ );
10
+
11
+ }
12
+ }
13
+
14
+ ?>
app/code/local/Iceshop/Icecatlive/Model/System/Config/Locales.php CHANGED
@@ -1,50 +1,50 @@
1
- <?php
2
- /**
3
- * Class Provides locales list for Magento BO
4
- *
5
- */
6
- class Iceshop_Icecatlive_Model_System_Config_Locales
7
- {
8
- private $domDoc;
9
-
10
- public function toOptionArray()
11
- {
12
- $pathToFile = Mage::getRoot() . '/code/local/Iceshop/Icecatlive/Model/System/Config/';
13
- $fileContent = file_get_contents($pathToFile . 'LanguageList.xml');
14
- if (!$this->parseXml(utf8_encode($fileContent))) {
15
- return false;
16
- }
17
-
18
- $values = $this->parseLocaleValues();
19
- return $values;
20
- }
21
-
22
- private function parseLocaleValues()
23
- {
24
- $languageArray = $this->domDoc->getElementsByTagName('Language');
25
- $resultArray = array();
26
- foreach ($languageArray as $language) {
27
- $languageShortCode = strtolower($language->getAttribute('ShortCode'));
28
- $languageCode = ucfirst($language->getAttribute('Code'));
29
- $resultArray[$languageShortCode] = $languageCode;
30
- }
31
- ksort($resultArray);
32
- array_unshift($resultArray, 'Use Store Locale');
33
- return $resultArray;
34
- }
35
-
36
- private function parseXml($stringXml)
37
- {
38
-
39
- $this->domDoc = new DOMDocument();
40
- $result = $this->domDoc->loadXML($stringXml);
41
- return true;
42
- if (!$this->domDoc->validate()) {
43
- echo "Document is not Valid<br>";
44
- return false;
45
- }
46
- return true;
47
- }
48
- }
49
-
50
- ?>
1
+ <?php
2
+ /**
3
+ * Class Provides locales list for Magento BO
4
+ *
5
+ */
6
+ class Iceshop_Icecatlive_Model_System_Config_Locales
7
+ {
8
+ private $domDoc;
9
+
10
+ public function toOptionArray()
11
+ {
12
+ $pathToFile = Mage::getRoot() . '/code/local/Iceshop/Icecatlive/Model/System/Config/';
13
+ $fileContent = file_get_contents($pathToFile . 'LanguageList.xml');
14
+ if (!$this->parseXml(utf8_encode($fileContent))) {
15
+ return false;
16
+ }
17
+
18
+ $values = $this->parseLocaleValues();
19
+ return $values;
20
+ }
21
+
22
+ private function parseLocaleValues()
23
+ {
24
+ $languageArray = $this->domDoc->getElementsByTagName('Language');
25
+ $resultArray = array();
26
+ foreach ($languageArray as $language) {
27
+ $languageShortCode = strtolower($language->getAttribute('ShortCode'));
28
+ $languageCode = ucfirst($language->getAttribute('Code'));
29
+ $resultArray[$languageShortCode] = $languageCode;
30
+ }
31
+ ksort($resultArray);
32
+ array_unshift($resultArray, 'Use Store Locale');
33
+ return $resultArray;
34
+ }
35
+
36
+ private function parseXml($stringXml)
37
+ {
38
+
39
+ $this->domDoc = new DOMDocument();
40
+ $result = $this->domDoc->loadXML($stringXml);
41
+ return true;
42
+ if (!$this->domDoc->validate()) {
43
+ echo "Document is not Valid<br>";
44
+ return false;
45
+ }
46
+ return true;
47
+ }
48
+ }
49
+
50
+ ?>
app/code/local/Iceshop/Icecatlive/Model/System/Config/Namepriority.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
- class Iceshop_Icecatlive_Model_System_Config_Namepriority
3
- {
4
- public function toOptionArray()
5
- {
6
- return array(
7
- 'Icecat' => 'From Icecat',
8
- 'Db' => 'From Database'
9
- );
10
-
11
- }
12
- }
13
-
14
- ?>
1
+ <?php
2
+ class Iceshop_Icecatlive_Model_System_Config_Namepriority
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ 'Icecat' => 'From Icecat',
8
+ 'Db' => 'From Database'
9
+ );
10
+
11
+ }
12
+ }
13
+
14
+ ?>
app/code/local/Iceshop/Icecatlive/Model/System/Config/Onlynewproducts.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iceshop_Icecatlive_Model_System_Config_Onlynewproducts
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ '0' => "No",
8
+ '1' => 'Yes'
9
+ );
10
+
11
+ }
12
+ }
13
+
14
+ ?>
app/code/local/Iceshop/Icecatlive/Model/System/Config/Productpriority.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
- class Iceshop_Icecatlive_Model_System_Config_Productpriority
3
- {
4
- public function toOptionArray()
5
- {
6
- return array(
7
- 'Show' => 'Show all products',
8
- 'Hide' => 'Hide products not from Icecat'
9
- );
10
-
11
- }
12
- }
13
-
14
- ?>
1
+ <?php
2
+ class Iceshop_Icecatlive_Model_System_Config_Productpriority
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ 'Show' => 'Show all products',
8
+ 'Hide' => 'Hide products not from Icecat'
9
+ );
10
+
11
+ }
12
+ }
13
+
14
+ ?>
app/code/local/Iceshop/Icecatlive/Model/System/Config/Shortdescrpriority.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
- class Iceshop_Icecatlive_Model_System_Config_Shortdescrpriority
3
- {
4
- public function toOptionArray()
5
- {
6
- return array(
7
- 'Icecat' => 'From Icecat',
8
- 'Db' => 'From Database'
9
- );
10
-
11
- }
12
- }
13
-
14
- ?>
1
+ <?php
2
+ class Iceshop_Icecatlive_Model_System_Config_Shortdescrpriority
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ 'Icecat' => 'From Icecat',
8
+ 'Db' => 'From Database'
9
+ );
10
+
11
+ }
12
+ }
13
+
14
+ ?>
app/code/local/Iceshop/Icecatlive/Model/System/Config/Subscription.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
- /**
3
- * Class provides data for Magento BO
4
- *
5
- */
6
- class Iceshop_Icecatlive_Model_System_Config_Subscription
7
- {
8
- public function toOptionArray()
9
- {
10
- $paramsArray = array(
11
- 'free' => 'OpenIcecat XML',
12
- 'full' => 'FullIcecat XML'
13
- );
14
- return $paramsArray;
15
- }
16
- }
17
-
18
- ?>
1
+ <?php
2
+ /**
3
+ * Class provides data for Magento BO
4
+ *
5
+ */
6
+ class Iceshop_Icecatlive_Model_System_Config_Subscription
7
+ {
8
+ public function toOptionArray()
9
+ {
10
+ $paramsArray = array(
11
+ 'free' => 'OpenIcecat XML',
12
+ 'full' => 'FullIcecat XML'
13
+ );
14
+ return $paramsArray;
15
+ }
16
+ }
17
+
18
+ ?>
app/code/local/Iceshop/Icecatlive/Model/System/Config/Viewattributes.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Provides product Attributes for BO menu
4
+ *
5
+ */
6
+ class Iceshop_Icecatlive_Model_System_Config_Viewattributes
7
+ {
8
+ public function toOptionArray()
9
+ {
10
+ $attributesArray = Mage::getResourceModel('eav/entity_attribute_collection')
11
+ ->setAttributeSetFilter(Mage::getResourceSingleton('catalog/product')->getEntityType()->getDefaultAttributeSetId());
12
+ $outputAttributeArray = array();
13
+ $i = 1;
14
+ $outputAttributeArray[0] = array('value' => '', 'label' => '');
15
+ foreach ($attributesArray as $attribute) {
16
+ $outputAttributeArray[$i] = array('value' => $attribute['attribute_code'], 'label' => $attribute['attribute_code']);
17
+ $i++;
18
+ }
19
+ ksort($outputAttributeArray);
20
+ return $outputAttributeArray;
21
+ }
22
+ }
23
+
24
+ ?><?php
25
+
26
+ /*
27
+ * To change this template, choose Tools | Templates
28
+ * and open the template in the editor.
29
+ */
30
+ ?>
app/code/local/Iceshop/Icecatlive/controllers/Adminhtml/ImportproductController.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iceshop_Icecatlive_Adminhtml_ImportproductController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function getGridTable()
7
+ {
8
+ return $this->getResponse()->setBody(
9
+ $this->getLayout()->createBlock('icecatlive/adminhtml_product_list_grid')->toHtml()
10
+ );
11
+ }
12
+ }
app/code/local/Iceshop/Icecatlive/controllers/Adminhtml/ImportproductinfoController.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iceshop_Icecatlive_Adminhtml_ImportproductinfoController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ /**
5
+ * Return some checking result
6
+ *
7
+ * @return void
8
+ */
9
+ public function checkAction()
10
+ {
11
+
12
+ $result = Mage::getModel('icecatlive/observer')->loadProductInfoIntoCache();
13
+
14
+ Mage::app()->getResponse()->setBody($result);
15
+ }
16
+ }
app/code/local/Iceshop/Icecatlive/controllers/IcecatliveController.php ADDED
@@ -0,0 +1,953 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Adminhtml/ImportproductController.php';
3
+ class Iceshop_Icecatlive_IcecatliveController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public $_gridTables = NULL;
6
+
7
+ public function _construct() {
8
+ $this->_gridTables = new Iceshop_Icecatlive_Adminhtml_ImportproductController($this->getRequest(), $this->getResponse());
9
+ parent::_construct();
10
+ }
11
+
12
+ /**
13
+ * indexAction
14
+ *
15
+ * @return void
16
+ *
17
+ * TODO prevent hardcoded html structure
18
+ */
19
+ public function systemAction()
20
+ {
21
+
22
+ $checker = Mage::helper('icecatlive/system_systemcheck')->init();
23
+ $helper = Mage::helper('icecatlive');
24
+ ob_start();
25
+ ?>
26
+ <?php
27
+ //Problems Digest
28
+ $problems_digest = $checker->getExtensionProblemsDigest();
29
+ $problems = $problems_digest->getProblems();
30
+ ?>
31
+ <div class="entry-edit" id="icecatlive-digest">
32
+ <div class="entry-edit-head collapseable">
33
+ <a href="#" class="section-toggler-icecatlive open">
34
+ Problems Digest
35
+ </a>
36
+ </div>
37
+
38
+ <?php if(count($problems)){ ?>
39
+ <div class="fieldset">
40
+ <?php } else { ?>
41
+ <div class="fieldset icecatlive-hidden">
42
+ <?php } ?>
43
+ <div class="hor-scroll">
44
+ <table class="form-list" cellspacing="0" cellpadding="0">
45
+ <?php print sprintf($helper->__('To guarantee the correct functioning of the Icecat Live module you need to solve the following %s problems:'), '<strong class="requirement-failed">' . $problems_digest->getCount() . '</strong>'); ?>
46
+ <?php
47
+ $i = 1;
48
+ foreach ($problems as $problem_section_name => $problem_section) {
49
+ foreach($problem_section as $problem_name => $problem_value) {
50
+ if($problem_name == 'config_exists'){
51
+ print '<tr><td class="label"><label class="problem-digest">' . $helper->__('Problem') . " " . $i . ':</label>';
52
+ print '</td><td class="value">Some required files are missed:';
53
+ print '<ul>';
54
+ foreach($problem_value as $problem_value_key => $problem_value_path) {
55
+ print '<li>' . $problem_value_path . '</li>';
56
+ }
57
+ print '</ul></td></tr>';
58
+ } elseif($problem_name == 'path_exists'){
59
+ print '<tr><td class="label"><label class="problem-digest">' . $helper->__('Problem') . " " . $i . ':</label>';
60
+ print '</td><td class="value">Some path error:<ul>';
61
+ foreach($problem_value as $problem_value_key => $problem_value_path) {
62
+ print '<li>' . $problem_value_path . '</li>';
63
+ }
64
+ print '</ul></td></tr>';
65
+ } else{
66
+ print '<tr><td class="label"><label class="problem-digest">' . $helper->__('Problem') . " " . $i . ':</label>';
67
+ print '</td><td class="value"><span class="requirement-passed">"'
68
+ . $problem_value['label'] . '"</span> ' . $helper->__('current value is') . ' <span class="requirement-failed">"'
69
+ . $problem_value['current_value'] . '"</span> ' . $helper->__('and recommended value is') . ' <span class="requirement-passed">"'
70
+ . (!empty($problem_value['recommended_value']) ? $problem_value['recommended_value'] : '') . '"</span>. '
71
+ . $helper->__(' Check this parameter in') . ' <a class="section-toggler-trigger requirement-passed" data-href="#'
72
+ . $problem_section_name . '-section" href="#' . $problem_section_name . '-section">'
73
+ . ucfirst($problem_section_name) . '</a> ' . $helper->__('section') . '.';
74
+ print '</td></tr>';
75
+ }
76
+ $i++;
77
+ }
78
+ }
79
+ ?>
80
+ <tr>
81
+ <td class="label col1">
82
+ <label><?php print $helper->__("Report"); ?></label>
83
+ </td>
84
+ <td class="value col2" colspan="2">
85
+ <a href="<?php print Mage::helper("adminhtml")->getUrl("adminhtml/icecatlive/report/") ?>"
86
+ target="_blank">&raquo;<?php print $helper->__('Click to generate'); ?></a>
87
+ <p class="note"><?php print $helper->__("Use this report for more info on found problems or send it to Iceshop B.V. to help analyzing the problem to speed up solution of any issues."); ?></p>
88
+ </td>
89
+ </tr>
90
+ </table>
91
+ </div>
92
+ </div>
93
+ </div>
94
+ <?php
95
+
96
+ //Check module
97
+ $DB_loger = Mage::helper('icecatlive/db');
98
+ $import_info['startdate_imported_product'] = $DB_loger->getLogValue('icecatlive_startdate_imported_product');
99
+ $import_info['startdate_update_product'] = $DB_loger->getLogValue('icecatlive_startdate_update_product');
100
+
101
+ $import_info['endtdate_imported_product'] = $DB_loger->getLogValue('icecatlive_enddate_imported_product');
102
+ $import_info['enddate_update_product'] = $DB_loger->getLogValue('icecatlive_enddate_update_product');
103
+
104
+
105
+ $import_info['success_imported_product'] = $DB_loger->getLogValue('icecatlive_success_imported_product');
106
+ $import_info['error_imported_product'] = $DB_loger->getLogValue('icecatlive_error_imported_product');
107
+ $import_info['full_icecat_product'] = $DB_loger->getLogValue('icecatlive_full_icecat_product');
108
+ $count_products = $DB_loger->readQuery("SELECT COUNT(*) FROM `" . $DB_loger->_prefix . "catalog_product_entity` LEFT JOIN `" . $DB_loger->_prefix . "iceshop_icecatlive_products_titles` ON entity_id = prod_id WHERE prod_id IS NULL");
109
+ $import_info['count_not_updated_products'] = $count_products[0]['COUNT(*)'];
110
+ $cache_files = scandir(Mage::getBaseDir('var') .'/iceshop/icecatlive/cache/');
111
+ $count_cache_files = count($cache_files) - 2;
112
+ ?>
113
+ <div class="entry-edit">
114
+ <div class="entry-edit-head collapseable">
115
+ <a href="#" class="open section-toggler-icecatlive">
116
+ Icecatlive Info
117
+ </a>
118
+ </div>
119
+
120
+ <div class="fieldset icecatlive-hidden">
121
+ <div class="hor-scroll">
122
+ <table class="form-list" cellspacing="0" cellpadding="0">
123
+ <tr>
124
+ <td colspan="2" class="label">
125
+ <label class="icecatlive-label-uppercase icecatlive-label-bold">
126
+ <?php print $helper->__('Icecatlive statistic'); ?>
127
+ </label>
128
+ </td>
129
+ </tr>
130
+ <tr>
131
+ <td class="label"><label><?php print $helper->__("Sucess imported last time"); ?>:</label></td>
132
+ <td class="value">
133
+ <?php
134
+ if($import_info['success_imported_product']){
135
+ echo $import_info['success_imported_product'];
136
+ }else{
137
+ echo '0';
138
+ }
139
+ ?>
140
+ </td>
141
+ </tr>
142
+ <tr>
143
+ <td class="label"><label><?php print $helper->__("Not updated products"); ?>:</label></td>
144
+ <td class="value">
145
+ <?php
146
+ if($import_info['count_not_updated_products']){
147
+ echo $import_info['count_not_updated_products'];
148
+ }else{
149
+ echo '0';
150
+ }
151
+ ?>
152
+ </td>
153
+ </tr>
154
+ <tr>
155
+ <td class="label"><label><?php print $helper->__("Not imported last time"); ?>:</label></td>
156
+ <td class="value">
157
+ <?php
158
+ if($import_info['error_imported_product']){
159
+ echo $import_info['error_imported_product'];
160
+ }else{
161
+ echo '0';
162
+ }
163
+ ?>
164
+ <label style="margin: 0 5px;"><?php print $helper->__("of them full icecat products"); ?>:</label>
165
+ <?php
166
+ if($import_info['full_icecat_product']){
167
+ echo $import_info['full_icecat_product'];
168
+ }else{
169
+ echo '0';
170
+ }
171
+ ?>
172
+ </td>
173
+ </tr>
174
+ <tr>
175
+ <td class="label"><label><?php print $helper->__("Files in cache"); ?>:</label></td>
176
+ <td class="value">
177
+ <?php
178
+ if($count_cache_files){
179
+ echo $count_cache_files;
180
+ }else{
181
+ echo '0';
182
+ }
183
+ ?>
184
+ </td>
185
+ </tr>
186
+ <tr>
187
+ <td class="label"><label><?php print $helper->__("Start import time"); ?>:</label></td>
188
+ <td class="value">
189
+ <?php
190
+ if($import_info['startdate_imported_product']){
191
+ echo $import_info['startdate_imported_product'];
192
+ }else{
193
+ echo 'Import was not running';
194
+ }
195
+ ?>
196
+ </td>
197
+ </tr>
198
+ <tr>
199
+ <td class="label"><label><?php print $helper->__("End import time"); ?>:</label></td>
200
+ <td class="value">
201
+ <?php
202
+ if($import_info['endtdate_imported_product']){
203
+ echo $import_info['endtdate_imported_product'];
204
+ }else{
205
+ echo 'Import was not completed';
206
+ }
207
+ ?>
208
+ </td>
209
+ </tr>
210
+ <tr>
211
+ <td class="label"><label><?php print $helper->__("Start update time"); ?>:</label></td>
212
+ <td class="value">
213
+ <?php
214
+ if($import_info['startdate_update_product']){
215
+ echo $import_info['startdate_update_product'];
216
+ }else{
217
+ echo 'Update was not running.';
218
+ }
219
+ ?>
220
+ </td>
221
+ </tr>
222
+ <tr>
223
+ <td class="label"><label><?php print $helper->__("End update time"); ?>:</label></td>
224
+ <td class="value">
225
+ <?php
226
+ if($import_info['enddate_update_product']){
227
+ echo $import_info['enddate_update_product'];
228
+ }else{
229
+ echo 'Update was not completed.';
230
+ }
231
+ ?>
232
+ </td>
233
+ </tr>
234
+ </table>
235
+ </div>
236
+ </div>
237
+ </div>
238
+
239
+ <?php
240
+ //Check module
241
+ $check_module = $checker->getModulesCollection('Iceshop_Icecatlive');
242
+ $check_module = $check_module->getLastItem()->getData();
243
+ ?>
244
+ <span id="extension-section"></span>
245
+ <div class="entry-edit">
246
+ <div class="entry-edit-head collapseable">
247
+ <a href="#" class="section-toggler-icecatlive"><?php print $helper->__('Extension Diagnostic Info'); ?></a>
248
+ </div>
249
+ <div class="fieldset icecatlive-hidden">
250
+ <div class="hor-scroll">
251
+ <table class="form-list" cellspacing="0" cellpadding="0">
252
+ <tr>
253
+ <td class="label"><label><?php print $helper->__('Name'); ?>:</label></td>
254
+ <td class="value"><?php echo $check_module['name']; ?></td>
255
+ </tr>
256
+ <tr>
257
+ <td class="label"><label><?php print $helper->__('Version'); ?>:</label></td>
258
+ <td class="value"><?php echo $check_module['version']; ?></td>
259
+ </tr>
260
+ <tr>
261
+ <td class="label"><label><?php print $helper->__('Code Pool'); ?>:</label></td>
262
+ <td class="value"><?php echo $check_module['code_pool']; ?></td>
263
+ </tr>
264
+ <tr>
265
+ <td class="label"><label><?php print $helper->__('Path'); ?>:</label></td>
266
+ <td class="value"><?php echo $check_module['path']; ?></td>
267
+ </tr>
268
+ <tr>
269
+ <td class="label"><label><?php print $helper->__('Path Exists'); ?>:</label></td>
270
+ <td class="value <?php echo $checker->renderRequirementValue($check_module['path_exists']); ?>">
271
+ <?php echo $checker->renderBooleanField($check_module['path_exists']); ?>
272
+ </td>
273
+ </tr>
274
+ <tr>
275
+ <td class="label"><label><?php print $helper->__('Config Exists'); ?>:</label></td>
276
+ <td class="value <?php echo $checker->renderRequirementValue($check_module['config_exists']); ?>">
277
+ <?php echo $checker->renderBooleanField($check_module['config_exists']); ?>
278
+ </td>
279
+ </tr>
280
+ <tr>
281
+ <td class="label"><label><?php print $helper->__('Dependencies'); ?>:</label></td>
282
+ <td class="value"><?php echo $check_module['dependencies']; ?></td>
283
+ </tr>
284
+ </table>
285
+ </div>
286
+ </div>
287
+ </div>
288
+
289
+ <?php
290
+ //Check rewrites
291
+ $check_rewrites = $checker->getRewriteCollection('Iceshop_Icecatlive');
292
+ ?>
293
+ <span id="rewrite-section"></span>
294
+ <div class="entry-edit">
295
+ <div class="entry-edit-head collapseable">
296
+ <a href="#" class="section-toggler-icecatlive"><?php print $helper->__('Extension Rewrites Status'); ?></a>
297
+ </div>
298
+
299
+ <div class="fieldset icecatlive-hidden">
300
+ <div class="hor-scroll">
301
+ <table class="form-list" cellspacing="0" cellpadding="0">
302
+ <tbody>
303
+ <?php
304
+ foreach ($check_rewrites as $rewrite) {
305
+ ?>
306
+ <tr>
307
+ <td>
308
+ <span class="icecatlive-label-bold icecatlive-label-rewrite"><?php print $helper->__('Path'); ?>:</span>
309
+ <span><?php echo $rewrite['path']; ?></span>
310
+ <br/>
311
+ <span class="icecatlive-label-bold icecatlive-label-rewrite"><?php print $helper->__('Rewrite Class'); ?>:</span>
312
+ <span><?php echo $rewrite['rewrite_class']; ?></span>
313
+ <br/>
314
+ <span class="icecatlive-label-bold icecatlive-label-rewrite"><?php print $helper->__('Active Class'); ?>:</span>
315
+ <span><?php echo $rewrite['active_class']; ?></span>
316
+ <br/>
317
+ <span class="icecatlive-label-bold icecatlive-label-rewrite"><?php print $helper->__('Status'); ?>:</span>
318
+ <span
319
+ class="<?php echo $checker->renderRequirementValue($rewrite['status']); ?>">
320
+ <?php echo $checker->renderStatusField($rewrite['status']); ?>
321
+ </span>
322
+ <br/>
323
+ <br/>
324
+ </td>
325
+ </tr>
326
+ <?php
327
+ }
328
+ ?>
329
+ </tbody>
330
+ </table>
331
+ </div>
332
+ </div>
333
+ </div>
334
+
335
+ <span id="requirement-section"></span>
336
+ <div class="entry-edit">
337
+ <div class="entry-edit-head collapseable">
338
+ <a class="section-toggler-icecatlive" href="#"><?php print $helper->__('System Requirements'); ?></a>
339
+ </div>
340
+
341
+ <?php $requirements = $checker->getSystem()->getRequirements()->getData(); ?>
342
+ <div class="fieldset icecatlive-hidden">
343
+ <div class="hor-scroll">
344
+ <table class="form-list firegento-settings-table" cellspacing="0" cellpadding="0">
345
+ <thead>
346
+ <tr>
347
+ <th class="label col1"><?php print $helper->__('Requirement'); ?></th>
348
+ <th class="value col2"><?php print $helper->__('Current Value'); ?></th>
349
+ <th class="value col3"><?php print $helper->__('Recommended Value'); ?></th>
350
+ </tr>
351
+ </thead>
352
+ <tbody>
353
+ <?php foreach ($requirements as $requirement): ?>
354
+ <tr>
355
+ <td class="label col1">
356
+ <label><span class="icecatlive-pad-label"><?php echo $requirement['label']; ?></span><?php print $checker->renderAdvice($requirement); ?>:</label>
357
+ </td>
358
+ <td class="value col2 <?php echo $checker->renderRequirementValue($requirement['result']) ?>">
359
+ <?php echo $requirement['current_value'] ?>
360
+ </td>
361
+ <td class="value col3"><?php echo $requirement['recommended_value'] ?></td>
362
+ </tr>
363
+ <?php endforeach; ?>
364
+ <tr>
365
+ <td class="label col1"><label>phpinfo()</label>
366
+ </td>
367
+ <td class="value col2" colspan="2">
368
+ <a href="<?php print Mage::helper("adminhtml")->getUrl("adminhtml/icecatlive/phpinfo/") ?>"
369
+ target="_blank">&raquo;<?php print $helper->__('More info'); ?></a>
370
+ </td>
371
+ </tr>
372
+ <?php ?>
373
+ </tbody>
374
+ </table>
375
+ </div>
376
+ </div>
377
+ </div>
378
+
379
+ <div class="entry-edit">
380
+ <div class="entry-edit-head collapseable">
381
+ <a href="#" class="open section-toggler-icecatlive">Magento Info</a>
382
+ </div>
383
+
384
+ <div class="fieldset icecatlive-hidden">
385
+ <div class="hor-scroll">
386
+ <table class="form-list" cellspacing="0" cellpadding="0">
387
+ <tr>
388
+ <td class="label"><label>Edition:</label></td>
389
+ <td class="value"><?php echo $checker->getSystem()->getMagento()->getEdition() ?></td>
390
+ </tr>
391
+ <tr>
392
+ <td class="label"><label>Version:</label></td>
393
+ <td class="value"><?php echo $checker->getSystem()->getMagento()->getVersion() ?></td>
394
+ </tr>
395
+ <tr>
396
+ <td class="label"><label>Developer Mode:</label></td>
397
+ <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagento()->getDeveloperMode()) ?></td>
398
+ </tr>
399
+ <tr>
400
+ <td class="label"><label>Add Secret Key to URLs:</label></td>
401
+ <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagento()->getSecretKey()) ?></td>
402
+ </tr>
403
+ <tr>
404
+ <td class="label"><label>Use Flat Catalog Category:</label></td>
405
+ <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagento()->getFlatCatalogCategory()) ?></td>
406
+ </tr>
407
+ <tr>
408
+ <td class="label"><label>Use Flat Catalog Product:</label></td>
409
+ <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagento()->getFlatCatalogProduct()) ?></td>
410
+ </tr>
411
+ <tr>
412
+ <td class="label"><label>Cache status:</label></td>
413
+ <td class="value">
414
+ <?php echo $checker->getSystem()->getMagento()->getCacheStatus() ?><br/>
415
+ <a href="<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/cache/') ?>">&raquo;Cache
416
+ Management</a>
417
+ </td>
418
+ </tr>
419
+ <tr>
420
+ <td class="label"><label>Index status:</label></td>
421
+ <td class="value">
422
+ <?php echo $checker->getSystem()->getMagento()->getIndexStatus() ?><br/>
423
+ <a href="<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/process/list') ?>">&raquo;Index
424
+ Management</a>
425
+ </td>
426
+ </tr>
427
+ </table>
428
+ </div>
429
+ </div>
430
+ </div>
431
+
432
+ <div class="entry-edit">
433
+ <div class="entry-edit-head collapseable">
434
+ <a href="#" class="open section-toggler-icecatlive">Magento Core API Info</a>
435
+ </div>
436
+
437
+ <div class="fieldset icecatlive-hidden">
438
+ <div class="hor-scroll">
439
+ <table class="form-list" cellspacing="0" cellpadding="0">
440
+ <tr>
441
+ <td class="label"><label>Default Response Charset:</label></td>
442
+ <td class="value"><?php echo $checker->getSystem()->getMagentoApi()->getCharset() ?></td>
443
+ </tr>
444
+ <tr>
445
+ <td class="label"><label>Client Session Timeout (sec.):</label></td>
446
+ <?php $magento_api_session_timeout = $checker->getSystem()->getMagentoApi()->getSessionTimeout() ?>
447
+ <td class="value <?php echo $checker->renderRequirementValue($magento_api_session_timeout['result']) ?>"><?php echo $magento_api_session_timeout['current_value'] ?></td>
448
+ </tr>
449
+ <tr>
450
+ <td class="label"><label>WS-I Compliance:</label></td>
451
+ <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagentoApi()->getComplianceWsi()) ?></td>
452
+ </tr>
453
+ <tr>
454
+ <td class="label"><label>WSDL Cache:</label></td>
455
+ <td class="value"><?php echo $checker->renderBooleanField($checker->getSystem()->getMagentoApi()->getWsdlCacheEnabled()) ?></td>
456
+ </tr>
457
+ </table>
458
+ </div>
459
+ </div>
460
+ </div>
461
+ <div class="entry-edit">
462
+ <div class="entry-edit-head collapseable">
463
+ <a href="#" class="open section-toggler-icecatlive">PHP Info</a>
464
+ </div>
465
+
466
+ <div class="fieldset icecatlive-hidden">
467
+ <div class="hor-scroll">
468
+ <table class="form-list" cellspacing="0" cellpadding="0">
469
+ <tr>
470
+ <td class="label"><label>Version:</label></td>
471
+ <td class="value"><?php echo $checker->getSystem()->getPhp()->getVersion() ?></td>
472
+ </tr>
473
+ <tr>
474
+ <td class="label"><label>Server API:</label></td>
475
+ <td class="value"><?php echo $checker->getSystem()->getPhp()->getServerApi() ?></td>
476
+ </tr>
477
+ <tr>
478
+ <td class="label"><label>Memory Limit:</label></td>
479
+ <td class="value"><?php echo $checker->getSystem()->getPhp()->getMemoryLimit() ?></td>
480
+ </tr>
481
+ <tr>
482
+ <td class="label"><label>Max. Execution Time:</label></td>
483
+ <td class="value"><?php echo $checker->getSystem()->getPhp()->getMaxExecutionTime() ?></td>
484
+ </tr>
485
+ </table>
486
+ </div>
487
+ </div>
488
+ </div>
489
+ <div class="entry-edit">
490
+ <div class="entry-edit-head collapseable">
491
+ <a href="#" class="open section-toggler-icecatlive">MySQL Info</a>
492
+ </div>
493
+
494
+ <div class="fieldset icecatlive-hidden">
495
+ <div class="hor-scroll">
496
+ <table class="form-list" cellspacing="0" cellpadding="0">
497
+ <tr>
498
+ <td class="label"><label>Version:</label></td>
499
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getVersion() ?></td>
500
+ </tr>
501
+ <tr>
502
+ <td class="label"><label>Server API:</label></td>
503
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getServerApi() ?></td>
504
+ </tr>
505
+ <tr>
506
+ <td class="label"><label>Database Name:</label></td>
507
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getDatabaseName() ?></td>
508
+ </tr>
509
+ <tr>
510
+ <td class="label"><label>Database Tables:</label></td>
511
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getDatabaseTables() ?></td>
512
+ </tr>
513
+ <tr>
514
+ <td class="label"><label>Database Table Prefix:</label></td>
515
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getTablePrefix() ?></td>
516
+ </tr>
517
+ <tr>
518
+ <td class="label"><label>Connection Timeout:</label></td>
519
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getConnectionTimeout() ?></td>
520
+ </tr>
521
+ <tr>
522
+ <td class="label"><label>Wait Timeout:</label></td>
523
+ <td class="value"><?php echo $checker->getSystem()->getMysql()->getWaitTimeout() ?></td>
524
+ </tr>
525
+ <tr>
526
+ <td class="label"><label>Thread stack:</label></td>
527
+ <?php $thread_stack = $checker->getSystem()->getMysql()->getThreadStack(); ?>
528
+ <td class="value <?php echo $checker->renderRequirementValue($thread_stack['result']) ?>"><?php echo $thread_stack['current_value'] ?></td>
529
+ </tr>
530
+ <tr>
531
+ <td class="label"><label>Max Allowed Packet:</label></td>
532
+ <?php $max_allowed_packet = $checker->getSystem()->getMysql()->getMaxAllowedPacket(); ?>
533
+ <td class="value <?php echo $checker->renderRequirementValue($max_allowed_packet['result']) ?>"><?php echo $max_allowed_packet['current_value'] ?></td>
534
+ </tr>
535
+ </table>
536
+ </div>
537
+ </div>
538
+ </div>
539
+
540
+ <div class="entry-edit">
541
+ <div class="entry-edit-head collapseable">
542
+ <a href="#" class="open section-toggler-icecatlive">MySQL Configuration</a>
543
+ </div>
544
+
545
+ <div class="fieldset icecatlive-hidden">
546
+ <div class="hor-scroll">
547
+ <table class="form-list" cellspacing="0" cellpadding="0">
548
+ <?php
549
+ $mysql_vars = $checker->getSystem()->getMysqlVars()->getData();
550
+ foreach ($mysql_vars as $mysql_var_key => $mysql_var_value) {
551
+ print '<tr>';
552
+ print '<td><strong>' . $mysql_var_key . ':</strong></td>';
553
+ print '<td class="value">' . $mysql_var_value . '</td>';
554
+ print '</tr>';
555
+ }
556
+ ?>
557
+ </table>
558
+ </div>
559
+ </div>
560
+ </div>
561
+
562
+ <div class="entry-edit">
563
+ <div class="entry-edit-head collapseable">
564
+ <a href="#" class="open section-toggler-icecatlive">Server Info</a>
565
+ </div>
566
+
567
+ <div class="fieldset icecatlive-hidden">
568
+ <div class="hor-scroll">
569
+ <table class="form-list" cellspacing="0" cellpadding="0">
570
+ <tr>
571
+ <td class="label"><label>Info:</label></td>
572
+ <td class="value"><?php echo $checker->getSystem()->getServer()->getInfo() ?></td>
573
+ </tr>
574
+ <tr>
575
+ <td class="label"><label>Domain:</label></td>
576
+ <td class="value"><?php echo $checker->getSystem()->getServer()->getDomain() ?></td>
577
+ </tr>
578
+ <tr>
579
+ <td class="label"><label>Server IP:</label></td>
580
+ <td class="value"><?php echo $checker->getSystem()->getServer()->getIp() ?></td>
581
+ </tr>
582
+ <tr>
583
+ <td class="label"><label>Server Directory:</label></td>
584
+ <td class="value"><?php echo $checker->getSystem()->getServer()->getDir() ?></td>
585
+ </tr>
586
+ </table>
587
+ </div>
588
+ </div>
589
+ </div>
590
+ <div class="entry-edit">
591
+ <div class="entry-edit-head collapseable">
592
+ <a href="#" class="open section-toggler-icecatlive">Webshop IP address</a>
593
+ </div>
594
+
595
+ <div class="fieldset icecatlive-hidden">
596
+ <div class="hor-scroll">
597
+ <table class="form-list" cellspacing="0" cellpadding="0">
598
+ <tr>
599
+ <td class="label"><label>Webshop IP:</label></td>
600
+ <td class="value"><?php echo $this->getCorectIP(); ?></td>
601
+ </tr>
602
+ </table>
603
+ </div>
604
+ </div>
605
+ </div>
606
+ <div class="entry-edit">
607
+ <div class="entry-edit-head collapseable">
608
+ <a href="#" class="open section-toggler-icecatlive">Not Import Product List</a>
609
+ </div>
610
+ <div class="fieldset icecatlive-hidden">
611
+ <div id="gridActionClener" class="hor-scroll">
612
+ <?php echo $this->_gridTables->getGridTable(); ?>
613
+ </div>
614
+ </div>
615
+ </div>
616
+ <style>
617
+ .requirement-passed {
618
+ color: green;
619
+ }
620
+
621
+ .requirement-failed {
622
+ color: red;
623
+ }
624
+ </style>
625
+ <?php
626
+ $system_check_content = ob_get_contents();
627
+ ob_end_clean();
628
+
629
+ $reset_button_html = $helper->getButtonHtml(array(
630
+ 'id' => 'icecatlive_check_system_refresh',
631
+ 'element_name' => 'icecatlive_check_system_refresh',
632
+ 'title' => Mage::helper('catalog')->__('Refresh'),
633
+ 'type' => 'reset',
634
+ 'class' => 'save',
635
+ 'label' => Mage::helper('catalog')->__('Refresh'),
636
+ 'OnClick' => 'refreshIcecatliveSystemCheck(\'' . base64_encode(Mage::helper("adminhtml")->getUrl("adminhtml/icecatlive/system/")) . '\');'
637
+ ));
638
+
639
+ $jsonData = json_encode(array('structure' => $system_check_content, 'refresh_btn' => $reset_button_html));
640
+ $this->getResponse()->setHeader('Content-type', 'application/json');
641
+ $this->getResponse()->setBody($jsonData);
642
+ }
643
+
644
+ /**
645
+ * Method return server IP address
646
+ * @return string
647
+ */
648
+ function getCorectIP() {
649
+ $host= gethostname();
650
+ return gethostbyname($host);
651
+ }
652
+
653
+ public function phpinfoAction()
654
+ {
655
+ phpinfo(-1);
656
+ }
657
+
658
+ public function reportAction()
659
+ {
660
+ header("Content-Type: text/plain; charset=utf-8");
661
+ $report_filename = 'icecatlive-report' . (string)Mage::getConfig()->getNode()->modules->Iceshop_Icecatlive->version . '.txt';
662
+ header("Content-disposition: attachment; filename={$report_filename}");
663
+ header("Content-Transfer-Encoding: binary");
664
+ header("Pragma: no-cache");
665
+ header("Expires: 0");
666
+
667
+ //TODO add report content
668
+ $checker = Mage::helper('icecatlive/system_systemcheck')->init();
669
+ $helper = Mage::helper('icecatlive');
670
+
671
+ //========================================
672
+ //Problems Digest
673
+ //========================================
674
+ $problems_digest = $checker->getExtensionProblemsDigest();
675
+ if ($problems_digest->getCount() != 0) {
676
+ $problems = $problems_digest->getProblems();
677
+ print str_pad('', 100, '=') . "\n";
678
+ print 'Problems Digest' . "\n";
679
+ print str_pad('', 100, '=') . "\n";
680
+ foreach ($problems as $problem_name => $problem_value) {
681
+ print $problem_name . "\n";
682
+ print_r($problem_value);
683
+ }
684
+ print str_pad('', 100, '=') . "\n";
685
+ print "\n";
686
+ }
687
+ //========================================
688
+
689
+ //========================================
690
+ //Check module
691
+ //========================================
692
+ $check_module = $checker->getModulesCollection(Mage::app()->getRequest()->getModuleName());
693
+ $check_module = $check_module->getLastItem()->getData();
694
+ print str_pad('', 100, '=') . "\n";
695
+ print 'Extension Diagnostic Info' . "\n";
696
+ print str_pad('', 100, '=') . "\n";
697
+ print str_pad('Name', 50) . ':' . str_pad('', 5);
698
+ print $check_module['name'] . "\n";
699
+
700
+ print str_pad('Version', 50) . ':' . str_pad('', 5);
701
+ print $check_module['version'] . "\n";
702
+
703
+ print str_pad('Code Pool', 50) . ':' . str_pad('', 5);
704
+ print $check_module['code_pool'] . "\n";
705
+
706
+ print str_pad('Path', 50) . ':' . str_pad('', 5);
707
+ print $check_module['path'] . "\n";
708
+
709
+ print str_pad('Path Exists', 50) . ':' . str_pad('', 5);
710
+ print $checker->renderBooleanField($check_module['path_exists']) . "\n";
711
+
712
+ print str_pad('Config Exists', 50) . ':' . str_pad('', 5);
713
+ print $checker->renderBooleanField($check_module['config_exists']) . "\n";
714
+
715
+ print str_pad('Dependencies', 50) . ':' . str_pad('', 5);
716
+ print $check_module['dependencies'] . "\n";
717
+ print str_pad('', 100, '=') . "\n";
718
+ print "\n";
719
+ //========================================
720
+
721
+
722
+ //========================================
723
+ //Check rewrites
724
+ //========================================
725
+ $check_rewrites = $checker->getRewriteCollection(Mage::app()->getRequest()->getModuleName());
726
+ print str_pad('', 100, '=') . "\n";
727
+ print 'Extension Rewrites Status' . "\n";
728
+ print str_pad('', 100, '=') . "\n";
729
+ foreach ($check_rewrites as $rewrite) {
730
+ print str_pad('Path', 50) . ':' . str_pad('', 5);
731
+ print $rewrite['path'] . "\n";
732
+
733
+ print str_pad('Rewrite Class', 50) . ':' . str_pad('', 5);
734
+ print $rewrite['rewrite_class'] . "\n";
735
+
736
+ print str_pad('Active Class', 50) . ':' . str_pad('', 5);
737
+ print $rewrite['active_class'] . "\n";
738
+
739
+ print str_pad('Status', 50) . ':' . str_pad('', 5);
740
+ print $checker->renderStatusField($rewrite['status']) . "\n";
741
+ }
742
+ print str_pad('', 100, '=') . "\n";
743
+ print "\n";
744
+ //========================================
745
+
746
+ //========================================
747
+ //System Requirements
748
+ //========================================
749
+ $requirements = $checker->getSystem()->getRequirements()->getData();
750
+ print str_pad('', 100, '=') . "\n";
751
+ print 'System Requirements' . "\n";
752
+ print str_pad('', 100, '=') . "\n";
753
+ foreach ($requirements as $requirement) {
754
+ print str_pad($requirement['label'], 50) . ':' . str_pad('', 5);
755
+ print str_pad($requirement['recommended_value'], 30);
756
+ print $requirement['current_value'] . "\n";
757
+ }
758
+ print str_pad('', 100, '=') . "\n";
759
+ print "\n";
760
+ //========================================
761
+
762
+ //========================================
763
+ //Magento Info
764
+ //========================================
765
+ print str_pad('', 100, '=') . "\n";
766
+ print 'Magento Info' . "\n";
767
+ print str_pad('', 100, '=') . "\n";
768
+ print str_pad('Edition', 50) . ':' . str_pad('', 5);
769
+ print $checker->getSystem()->getMagento()->getEdition() . "\n";
770
+
771
+ print str_pad('Version', 50) . ':' . str_pad('', 5);
772
+ print $checker->getSystem()->getMagento()->getVersion() . "\n";
773
+
774
+ print str_pad('Developer Mode', 50) . ':' . str_pad('', 5);
775
+ print $checker->renderBooleanField($checker->getSystem()->getMagento()->getDeveloperMode()) . "\n";
776
+
777
+ print str_pad('Add Secret Key to URLs', 50) . ':' . str_pad('', 5);
778
+ print print $checker->renderBooleanField($checker->getSystem()->getMagento()->getSecretKey()) . "\n";
779
+
780
+ print str_pad('Use Flat Catalog Category', 50) . ':' . str_pad('', 5);
781
+ print $checker->renderBooleanField($checker->getSystem()->getMagento()->getFlatCatalogCategory()) . "\n";
782
+
783
+ print str_pad('Use Flat Catalog Product', 50) . ':' . str_pad('', 5);
784
+ print print $checker->renderBooleanField($checker->getSystem()->getMagento()->getFlatCatalogProduct()) . "\n";
785
+ print str_pad('', 100, '=') . "\n";
786
+ print "\n";
787
+ //========================================
788
+
789
+ //========================================
790
+ //Magento Core API Info
791
+ //========================================
792
+ print str_pad('', 100, '=') . "\n";
793
+ print 'Magento Core API Info' . "\n";
794
+ print str_pad('', 100, '=') . "\n";
795
+ print str_pad('Default Response Charset', 50) . ':' . str_pad('', 5);
796
+ print print $checker->getSystem()->getMagentoApi()->getCharset() . "\n";
797
+
798
+ print str_pad('Client Session Timeout (sec.)', 50) . ':' . str_pad('', 5);
799
+ $magento_api_session_timeout = $checker->getSystem()->getMagentoApi()->getSessionTimeout();
800
+ print $magento_api_session_timeout['current_value'] . "\n";
801
+
802
+ print str_pad('WS-I Compliance', 50) . ':' . str_pad('', 5);
803
+ print $checker->renderBooleanField($checker->getSystem()->getMagentoApi()->getComplianceWsi()) . "\n";
804
+
805
+ print str_pad('WSDL Cache', 50) . ':' . str_pad('', 5);
806
+ print $checker->renderBooleanField($checker->getSystem()->getMagentoApi()->getWsdlCacheEnabled()) . "\n";
807
+ print str_pad('', 100, '=') . "\n";
808
+ print "\n";
809
+ //========================================
810
+
811
+ //========================================
812
+ //PHP Info
813
+ //========================================
814
+ print str_pad('', 100, '=') . "\n";
815
+ print 'PHP Info' . "\n";
816
+ print str_pad('', 100, '=') . "\n";
817
+ print str_pad('Version', 50) . ':' . str_pad('', 5);
818
+ print $checker->getSystem()->getPhp()->getVersion() . "\n";
819
+
820
+ print str_pad('Server API', 50) . ':' . str_pad('', 5);
821
+ print $checker->getSystem()->getPhp()->getServerApi() . "\n";
822
+
823
+ print str_pad('Memory Limit', 50) . ':' . str_pad('', 5);
824
+ print $checker->getSystem()->getPhp()->getMemoryLimit() . "\n";
825
+
826
+ print str_pad('Max. Execution Time', 50) . ':' . str_pad('', 5);
827
+ print $checker->getSystem()->getPhp()->getMaxExecutionTime() . "\n";
828
+ print str_pad('', 100, '=') . "\n";
829
+ print "\n";
830
+ //========================================
831
+
832
+ //========================================
833
+ //MySQL Info
834
+ //========================================
835
+ print str_pad('', 100, '=') . "\n";
836
+ print 'MySQL Info' . "\n";
837
+ print str_pad('', 100, '=') . "\n";
838
+ print str_pad('Version', 50) . ':' . str_pad('', 5);
839
+ print $checker->getSystem()->getMysql()->getVersion() . "\n";
840
+
841
+ print str_pad('Server API', 50) . ':' . str_pad('', 5);
842
+ print $checker->getSystem()->getMysql()->getServerApi() . "\n";
843
+
844
+ print str_pad('Database Name', 50) . ':' . str_pad('', 5);
845
+ print $checker->getSystem()->getMysql()->getDatabaseName() . "\n";
846
+
847
+ print str_pad('Database Tables', 50) . ':' . str_pad('', 5);
848
+ print $checker->getSystem()->getMysql()->getDatabaseTables() . "\n";
849
+
850
+ print str_pad('Database Table Prefix', 50) . ':' . str_pad('', 5);
851
+ print $checker->getSystem()->getMysql()->getTablePrefix() . "\n";
852
+
853
+ print str_pad('Connection Timeout', 50) . ':' . str_pad('', 5);
854
+ print $checker->getSystem()->getMysql()->getConnectionTimeout() . "\n";
855
+
856
+ print str_pad('Wait Timeout', 50) . ':' . str_pad('', 5);
857
+ print $checker->getSystem()->getMysql()->getWaitTimeout() . "\n";
858
+
859
+ print str_pad('Thread stack', 50) . ':' . str_pad('', 5);
860
+ $thread_stack = $checker->getSystem()->getMysql()->getThreadStack();
861
+ print $thread_stack['current_value'] . "\n";
862
+
863
+ print str_pad('Max Allowed Packet', 50) . ':' . str_pad('', 5);
864
+ $max_allowed_packet = $checker->getSystem()->getMysql()->getMaxAllowedPacket();
865
+ print $max_allowed_packet['current_value'] . "\n";
866
+ print str_pad('', 100, '=') . "\n";
867
+ print "\n";
868
+ //========================================
869
+
870
+ //========================================
871
+ //Server Info
872
+ //========================================
873
+ print str_pad('', 100, '=') . "\n";
874
+ print 'Server Info' . "\n";
875
+ print str_pad('', 100, '=') . "\n";
876
+ print str_pad('Info', 50) . ':' . str_pad('', 5);
877
+ print $checker->getSystem()->getServer()->getInfo() . "\n";
878
+
879
+ print str_pad('Domain', 50) . ':' . str_pad('', 5);
880
+ print $checker->getSystem()->getServer()->getDomain() . "\n";
881
+
882
+ print str_pad('Server IP', 50) . ':' . str_pad('', 5);
883
+ print $checker->getSystem()->getServer()->getIp() . "\n";
884
+
885
+ print str_pad('Server Directory', 50) . ':' . str_pad('', 5);
886
+ print $checker->getSystem()->getServer()->getDir() . "\n";
887
+ print str_pad('', 100, '=') . "\n";
888
+ //========================================
889
+
890
+
891
+ //========================================
892
+ //phpinfo() full overview
893
+ //========================================
894
+ $formatter = Mage::helper('icecatlive/format');
895
+ ob_start();
896
+ phpinfo();
897
+ $phpinfo = ob_get_contents();
898
+ ob_end_clean();
899
+
900
+ try {
901
+ print str_pad('', 100, '=') . "\n";
902
+ print 'phpinfo() full overview' . "\n";
903
+ print str_pad('', 100, '=') . "\n";
904
+ print $formatter->convert_html_to_text($phpinfo) . "\n";
905
+ print str_pad('', 100, '=') . "\n";
906
+ print "\n";
907
+ } catch(Exception $e) {}
908
+ //========================================
909
+
910
+
911
+ //========================================
912
+ //MySQL Configuration
913
+ //========================================
914
+ print str_pad('', 100, '=') . "\n";
915
+ print 'MySQL Vars' . "\n";
916
+ print str_pad('', 100, '=') . "\n";
917
+ $mysql_vars = $checker->getSystem()->getMysqlVars()->getData();
918
+ foreach ($mysql_vars as $mysql_var_key => $mysql_var_value) {
919
+ print str_pad($mysql_var_key, 50) . ':' . str_pad('', 5);
920
+ print $mysql_var_value . "\n";
921
+ }
922
+ print str_pad('', 100, '=') . "\n";
923
+ //========================================
924
+ }
925
+
926
+ /**
927
+ * Product grid for AJAX request
928
+ */
929
+ public function gridAction()
930
+ {
931
+ $this->_gridTables->getGridTable();
932
+ }
933
+
934
+ /**
935
+ * Method for export to csv file
936
+ */
937
+ public function exportIcecatliveCsvAction()
938
+ {
939
+ $fileName = 'notimport_product.csv';
940
+ $grid = $this->getLayout()->createBlock('icecatlive/adminhtml_product_list_grid');
941
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
942
+ }
943
+
944
+ /**
945
+ * Method for export to excel file
946
+ */
947
+ public function exportIcecatliveExcelAction()
948
+ {
949
+ $fileName = 'notimport_product.xml';
950
+ $grid = $this->getLayout()->createBlock('icecatlive/adminhtml_product_list_grid');
951
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
952
+ }
953
+ }
app/code/local/Iceshop/Icecatlive/controllers/ImageController.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
- /**
3
- * Class provides controller for import image debug
4
- *
5
- */
6
- class Iceshop_Icecatlive_ImageController extends Mage_Adminhtml_Controller_Action
7
- {
8
-
9
- /**
10
- * Action calls load method which uploads data to iceshop connector data table
11
- */
12
- public function viewAction()
13
- {
14
- $result = Mage::getModel('icecatlive/observer')->load();
15
- }
16
- }
17
-
18
  ?>
1
+ <?php
2
+ /**
3
+ * Class provides controller for import image debug
4
+ *
5
+ */
6
+ class Iceshop_Icecatlive_ImageController extends Mage_Adminhtml_Controller_Action
7
+ {
8
+
9
+ /**
10
+ * Action calls load method which uploads data to iceshop connector data table
11
+ */
12
+ public function viewAction()
13
+ {
14
+ $result = Mage::getModel('icecatlive/observer')->load();
15
+ }
16
+ }
17
+
18
  ?>
app/code/local/Iceshop/Icecatlive/etc/adminhtml.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <icecat_root>
12
+ <title>Settings</title>
13
+ <sort_order>0</sort_order>
14
+ <!-- Used in resources tree -->
15
+ </icecat_root>
16
+ <icecatlive_information>
17
+ <title>Check System</title>
18
+ <sort_order>30</sort_order>
19
+ </icecatlive_information>
20
+ <iceshop_about>
21
+ <title>Iceshop Info</title>
22
+ <sort_order>40</sort_order>
23
+ </iceshop_about>
24
+ </children>
25
+ </config>
26
+ </children>
27
+ </system>
28
+ </children>
29
+ </admin>
30
+ </resources>
31
+ </acl>
32
+ </config>
app/code/local/Iceshop/Icecatlive/etc/config.xml CHANGED
@@ -1,185 +1,172 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Iceshop_Icecatlive>
5
- <version>1.6.0</version>
6
- </Iceshop_Icecatlive>
7
- </modules>
8
- <global>
9
- <helpers>
10
- <icecatlive>
11
- <class>Iceshop_Icecatlive_Helper</class>
12
- </icecatlive>
13
- <catalog>
14
- <rewrite>
15
- <image>Iceshop_Icecatlive_Helper_Catalog_Image</image>
16
- <output>Iceshop_Icecatlive_Helper_Output</output>
17
- </rewrite>
18
- </catalog>
19
- </helpers>
20
- <blocks>
21
- <Iceshop_Icecatlive>
22
- <class>Iceshop_Icecatlive_Block</class>
23
- </Iceshop_Icecatlive>
24
- <catalog>
25
- <rewrite>
26
- <product_view_attributes>Iceshop_Icecatlive_Block_Attributes</product_view_attributes>
27
- <product_view_media>Iceshop_Icecatlive_Block_Media</product_view_media>
28
- <product_list_related>Iceshop_Icecatlive_Block_Related</product_list_related>
29
- <product_list_upsell>Iceshop_Icecatlive_Block_Upsell</product_list_upsell>
30
- <product_list_toolbar>Iceshop_Icecatlive_Block_Product_List_Toolbar</product_list_toolbar>
31
- </rewrite>
32
- </catalog>
33
- <catalogsearch>
34
- <rewrite>
35
- <result>Iceshop_Icecatlive_CatalogSearch_Block_Result</result>
36
- </rewrite>
37
- </catalogsearch>
38
- </blocks>
39
- <models>
40
- <icecatlive>
41
- <class>Iceshop_Icecatlive_Model</class>
42
- <resourceModel>icecatlive_resource_eav_mysql4</resourceModel>
43
- </icecatlive>
44
- <icecatlive_resource_eav_mysql4>
45
- <entities>
46
- <data>
47
- <table>iceshop_icecatlive_connector_data</table>
48
- </data>
49
- <data_products>
50
- <table>iceshop_icecatlive_connector_data_products</table>
51
- </data_products>
52
- <supplier_mapping>
53
- <table>iceshop_icecatlive_supplier_mapping</table>
54
- </supplier_mapping>
55
- </entities>
56
- </icecatlive_resource_eav_mysql4>
57
- <catalog>
58
- <rewrite>
59
- <product>Iceshop_Icecatlive_Model_Catalog_Product</product>
60
- <category>Iceshop_Icecatlive_Model_Catalog_Category</category>
61
- </rewrite>
62
- </catalog>
63
- <catalogsearch_mysql4>
64
- <rewrite>
65
- <fulltext_collection>Iceshop_Icecatlive_Model_Catalog_Search</fulltext_collection>
66
- </rewrite>
67
- </catalogsearch_mysql4>
68
- </models>
69
- <!--
70
- <routers>
71
- <catalog>
72
- <rewrite>
73
- <product>
74
- <to>Iceshop_Icecatlive/product</to>
75
- <override_actions>false</override_actions>
76
- <actions>
77
- <view><to>Iceshop_Icecatlive/product/view</to></view>
78
- </actions>
79
- </product>
80
- </rewrite>
81
- </catalog>
82
- </routers>
83
- -->
84
- <resources>
85
- <icecatlive_setup>
86
- <setup>
87
- <module>Iceshop_Icecatlive</module>
88
- </setup>
89
- <connection>
90
- <use>core_setup</use>
91
- </connection>
92
- </icecatlive_setup>
93
- </resources>
94
- </global>
95
- <admin>
96
- <routers>
97
- <adminhtml>
98
- <args>
99
- <modules>
100
- <icecatlive after="Mage_Adminhtml">Iceshop_Icecatlive</icecatlive>
101
- </modules>
102
- </args>
103
- </adminhtml>
104
- </routers>
105
- </admin>
106
- <frontend>
107
- <routers>
108
- <icecatlive>
109
- <use>standard</use>
110
- <args>
111
- <module>Iceshop_Icecatlive</module>
112
- <frontName>icecatlive</frontName>
113
- </args>
114
- </icecatlive>
115
- </routers>
116
- <layout>
117
- <updates>
118
- <icecatlive>
119
- <file>iceshop/icecatlive/groupattributes.xml</file>
120
- </icecatlive>
121
- </updates>
122
- </layout>
123
- <translate>
124
- <modules>
125
- <icecatlive>
126
- <files>
127
- <default>Iceshop_Icecatlive.csv</default>
128
- </files>
129
- </icecatlive>
130
- </modules>
131
- </translate>
132
- </frontend>
133
- <adminhtml>
134
- <acl>
135
- <resources>
136
- <admin>
137
- <children>
138
- <system>
139
- <children>
140
- <config>
141
- <children>
142
- <icecat_root translate="title" module="customer">
143
- <title>Ice Cat Module powered by Iceshop company</title>
144
- <sort_order>200</sort_order>
145
- </icecat_root>
146
- </children>
147
- </config>
148
- </children>
149
- </system>
150
- </children>
151
- </admin>
152
- </resources>
153
- </acl>
154
- <events></events>
155
- <layout>
156
- <updates>
157
- <icecatlive>
158
- <file>icecatlive.xml</file>
159
- </icecatlive>
160
- </updates>
161
- </layout>
162
- <translate>
163
- <modules>
164
- <mage_adminhtml>
165
- <files>
166
- <icecatlive>Iceshop_Icecatlive.csv</icecatlive>
167
- </files>
168
- </mage_adminhtml>
169
- </modules>
170
- </translate>
171
- </adminhtml>
172
-
173
- <crontab>
174
- <jobs>
175
- <icecatlive>
176
- <schedule>
177
- <cron_expr>0 0 * * 0</cron_expr>
178
- </schedule>
179
- <run>
180
- <model>icecatlive/observer::load</model>
181
- </run>
182
- </icecatlive>
183
- </jobs>
184
- </crontab>
185
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Iceshop_Icecatlive>
5
+ <version>1.7.0</version>
6
+ </Iceshop_Icecatlive>
7
+ </modules>
8
+ <default>
9
+ <icecatlive>
10
+ <patch>
11
+ <template_file_path><![CDATA[frontend/default/default/template/iceshop/icecatlive/groupattributes.phtml]]></template_file_path>
12
+ </patch>
13
+ <noimportid_tables>
14
+ <table_name>iceshop_icecatlive_noimport_products_id</table_name>
15
+ </noimportid_tables>
16
+ <extensions_logs_tables>
17
+ <table_name>iceshop_icecatlive_extensions_logs</table_name>
18
+ </extensions_logs_tables>
19
+ </icecatlive>
20
+ </default>
21
+ <global>
22
+ <helpers>
23
+ <icecatlive>
24
+ <class>Iceshop_Icecatlive_Helper</class>
25
+ </icecatlive>
26
+ <catalog>
27
+ <rewrite>
28
+ <output>Iceshop_Icecatlive_Helper_Output</output>
29
+ </rewrite>
30
+ </catalog>
31
+ </helpers>
32
+ <blocks>
33
+ <icecatlive>
34
+ <class>Iceshop_Icecatlive_Block</class>
35
+ </icecatlive>
36
+ <catalog>
37
+ <rewrite>
38
+ <product_view_attributes>Iceshop_Icecatlive_Block_Attributes</product_view_attributes>
39
+ <product_list_related>Iceshop_Icecatlive_Block_Related</product_list_related>
40
+ <product_list_upsell>Iceshop_Icecatlive_Block_Upsell</product_list_upsell>
41
+ <product_list_toolbar>Iceshop_Icecatlive_Block_Product_List_Toolbar</product_list_toolbar>
42
+ </rewrite>
43
+ </catalog>
44
+ <catalogsearch>
45
+ <rewrite>
46
+ <result>Iceshop_Icecatlive_CatalogSearch_Block_Result</result>
47
+ </rewrite>
48
+ </catalogsearch>
49
+ </blocks>
50
+ <models>
51
+ <icecatlive>
52
+ <class>Iceshop_Icecatlive_Model</class>
53
+ <resourceModel>icecatlive_resource_eav_mysql4</resourceModel>
54
+ </icecatlive>
55
+ <icecatlive_resource_eav_mysql4>
56
+ <entities>
57
+ <products_titles>
58
+ <table>iceshop_icecatlive_products_titles</table>
59
+ </products_titles>
60
+ </entities>
61
+ </icecatlive_resource_eav_mysql4>
62
+ <catalog>
63
+ <rewrite>
64
+ <product>Iceshop_Icecatlive_Model_Catalog_Product</product>
65
+ <category>Iceshop_Icecatlive_Model_Catalog_Category</category>
66
+ </rewrite>
67
+ </catalog>
68
+ <catalogsearch_mysql4>
69
+ <rewrite>
70
+ <fulltext_collection>Iceshop_Icecatlive_Model_Catalog_Search</fulltext_collection>
71
+ </rewrite>
72
+ </catalogsearch_mysql4>
73
+ </models>
74
+ <resources>
75
+ <icecatlive_setup>
76
+ <setup>
77
+ <module>Iceshop_Icecatlive</module>
78
+ </setup>
79
+ <connection>
80
+ <use>core_setup</use>
81
+ </connection>
82
+ </icecatlive_setup>
83
+ </resources>
84
+ </global>
85
+ <admin>
86
+ <routers>
87
+ <adminhtml>
88
+ <args>
89
+ <modules>
90
+ <icecatlive after="Mage_Adminhtml">Iceshop_Icecatlive</icecatlive>
91
+ </modules>
92
+ </args>
93
+ </adminhtml>
94
+ </routers>
95
+ </admin>
96
+ <frontend>
97
+ <routers>
98
+ <icecatlive>
99
+ <use>standard</use>
100
+ <args>
101
+ <module>Iceshop_Icecatlive</module>
102
+ <frontName>icecatlive</frontName>
103
+ </args>
104
+ </icecatlive>
105
+ </routers>
106
+ <layout>
107
+ <updates>
108
+ <icecatlive>
109
+ <file>iceshop/icecatlive/groupattributes.xml</file>
110
+ </icecatlive>
111
+ </updates>
112
+ </layout>
113
+ <translate>
114
+ <modules>
115
+ <icecatlive>
116
+ <files>
117
+ <default>Iceshop_Icecatlive.csv</default>
118
+ </files>
119
+ </icecatlive>
120
+ </modules>
121
+ </translate>
122
+ </frontend>
123
+ <adminhtml>
124
+ <events>
125
+ <adminhtml_cache_refresh_type>
126
+ <observers>
127
+ <iceshop_icecatlive_model_observer>
128
+ <type>singleton</type>
129
+ <class>Iceshop_Icecatlive_Model_Observer</class>
130
+ <method>adminhtml_cache_refresh_type</method>
131
+ </iceshop_icecatlive_model_observer>
132
+ </observers>
133
+ </adminhtml_cache_refresh_type>
134
+ </events>
135
+ <layout>
136
+ <updates>
137
+ <icecatlive>
138
+ <file>icecatlive.xml</file>
139
+ </icecatlive>
140
+ </updates>
141
+ </layout>
142
+ <translate>
143
+ <modules>
144
+ <mage_adminhtml>
145
+ <files>
146
+ <icecatlive>Iceshop_Icecatlive.csv</icecatlive>
147
+ </files>
148
+ </mage_adminhtml>
149
+ </modules>
150
+ </translate>
151
+ </adminhtml>
152
+ <crontab>
153
+ <jobs>
154
+ <icecatlive_load_data>
155
+ <schedule>
156
+ <cron_expr>0 0 1 * *</cron_expr>
157
+ </schedule>
158
+ <run>
159
+ <model>icecatlive/observer::load</model>
160
+ </run>
161
+ </icecatlive_load_data>
162
+ <icecatlive_load_updata>
163
+ <schedule>
164
+ <cron_expr>0 0 * * 0</cron_expr>
165
+ </schedule>
166
+ <run>
167
+ <model>icecatlive/observer::loadUpdate</model>
168
+ </run>
169
+ </icecatlive_load_updata>
170
+ </jobs>
171
+ </crontab>
172
+ </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Iceshop/Icecatlive/etc/system.xml CHANGED
@@ -1,142 +1,249 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <sections>
4
- <icecat_root translate="label" module="catalog">
5
- <class>separator-top</class>
6
- <label>Icecat Live!</label>
7
- <tab>catalog</tab>
8
- <frontend_type>text</frontend_type>
9
- <sort_order>200</sort_order>
10
- <show_in_default>1</show_in_default>
11
- <show_in_website>1</show_in_website>
12
- <show_in_store>1</show_in_store>
13
- <groups>
14
- <icecat translate="label">
15
- <label>Icecat Live! Settings</label>
16
- <frontend_type>text</frontend_type>
17
- <sort_order>50</sort_order>
18
- <show_in_default>1</show_in_default>
19
- <show_in_website>1</show_in_website>
20
- <show_in_store>1</show_in_store>
21
- <fields>
22
- <login translate="label">
23
- <label>Icecat User name</label>
24
- <frontend_type>text</frontend_type>
25
- <sort_order>10</sort_order>
26
- <show_in_default>1</show_in_default>
27
- <show_in_website>1</show_in_website>
28
- <show_in_store>1</show_in_store>
29
- </login>
30
- <password translate="label">
31
- <label>Icecat Password</label>
32
- <frontend_type>text</frontend_type>
33
- <sort_order>20</sort_order>
34
- <show_in_default>1</show_in_default>
35
- <show_in_website>1</show_in_website>
36
- <show_in_store>1</show_in_store>
37
- </password>
38
- <icecat_type translate="label">
39
- <label>Subscription level</label>
40
- <frontend_type>select</frontend_type>
41
- <source_model>icecatlive/system_config_subscription</source_model>
42
- <sort_order>25</sort_order>
43
- <show_in_default>1</show_in_default>
44
- <show_in_website>1</show_in_website>
45
- <show_in_store>1</show_in_store>
46
- </icecat_type>
47
- <language translate="label">
48
- <label>Language</label>
49
- <frontend_type>select</frontend_type>
50
- <source_model>icecatlive/system_config_locales</source_model>
51
- <sort_order>30</sort_order>
52
- <show_in_default>1</show_in_default>
53
- <show_in_website>1</show_in_website>
54
- <show_in_store>1</show_in_store>
55
- </language>
56
- <sku_field translate="label">
57
- <label>MPN</label>
58
- <frontend_type>select</frontend_type>
59
- <source_model>icecatlive/system_config_attributes</source_model>
60
- <sort_order>40</sort_order>
61
- <show_in_default>1</show_in_default>
62
- <show_in_website>1</show_in_website>
63
- <show_in_store>1</show_in_store>
64
- </sku_field>
65
- <manufacturer translate="label">
66
- <label>Manufacturer Name</label>
67
- <frontend_type>select</frontend_type>
68
- <source_model>icecatlive/system_config_attributes</source_model>
69
- <sort_order>50</sort_order>
70
- <show_in_default>1</show_in_default>
71
- <show_in_website>1</show_in_website>
72
- <show_in_store>1</show_in_store>
73
- </manufacturer>
74
- <ean_code translate="label">
75
- <label>Ean Code</label>
76
- <frontend_type>select</frontend_type>
77
- <source_model>icecatlive/system_config_attributes</source_model>
78
- <sort_order>60</sort_order>
79
- <show_in_default>1</show_in_default>
80
- <show_in_website>1</show_in_website>
81
- <show_in_store>1</show_in_store>
82
- </ean_code>
83
- <descript_priority translate="label">
84
- <label>Use Description from</label>
85
- <frontend_type>select</frontend_type>
86
- <source_model>icecatlive/system_config_descriptionpriority</source_model>
87
- <sort_order>70</sort_order>
88
- <show_in_default>1</show_in_default>
89
- <show_in_website>1</show_in_website>
90
- <show_in_store>1</show_in_store>
91
- </descript_priority>
92
- <shortdescr_priority translate="label">
93
- <label>Use Short description from</label>
94
- <frontend_type>select</frontend_type>
95
- <source_model>icecatlive/system_config_shortdescrpriority</source_model>
96
- <sort_order>70</sort_order>
97
- <show_in_default>1</show_in_default>
98
- <show_in_website>1</show_in_website>
99
- <show_in_store>1</show_in_store>
100
- </shortdescr_priority>
101
- <name_priority translate="label">
102
- <label>Use Product Name from</label>
103
- <frontend_type>select</frontend_type>
104
- <source_model>icecatlive/system_config_namepriority</source_model>
105
- <sort_order>70</sort_order>
106
- <show_in_default>1</show_in_default>
107
- <show_in_website>1</show_in_website>
108
- <show_in_store>1</show_in_store>
109
- </name_priority>
110
- <image_priority translate="label">
111
- <label>Use Product Image from</label>
112
- <frontend_type>select</frontend_type>
113
- <source_model>icecatlive/system_config_imagepriority</source_model>
114
- <sort_order>70</sort_order>
115
- <show_in_default>1</show_in_default>
116
- <show_in_website>1</show_in_website>
117
- <show_in_store>1</show_in_store>
118
- </image_priority>
119
- <product_priority translate="label">
120
- <label>Show/Hide products not presented at icecat</label>
121
- <frontend_type>select</frontend_type>
122
- <source_model>icecatlive/system_config_productpriority</source_model>
123
- <sort_order>70</sort_order>
124
- <show_in_default>1</show_in_default>
125
- <show_in_website>1</show_in_website>
126
- <show_in_store>1</show_in_store>
127
- </product_priority>
128
- <import_data translate="label">
129
- <label>Import data</label>
130
- <frontend_type>submit</frontend_type>
131
- <frontend_model>Iceshop_Icecatlive/adminhtml_system_config_form_button</frontend_model>
132
- <sort_order>75</sort_order>
133
- <show_in_default>1</show_in_default>
134
- <show_in_website>1</show_in_website>
135
- <show_in_store>1</show_in_store>
136
- </import_data>
137
- </fields>
138
- </icecat>
139
- </groups>
140
- </icecat_root>
141
- </sections>
142
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <iceshop translate="label" module="icecatlive">
5
+ <label>Iceshop</label>
6
+ <sort_order>150</sort_order>
7
+ </iceshop>
8
+ </tabs>
9
+ <sections>
10
+ <icecat_root translate="label" module="icecatlive">
11
+ <class>separator-top</class>
12
+ <label>Icecatlive Settings</label>
13
+ <tab>iceshop</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>10</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <icecat translate="label">
21
+ <label>Icecat Live! Settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>50</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+ <login translate="label">
29
+ <label>Icecat User name</label>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>10</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </login>
36
+ <password translate="label">
37
+ <label>Icecat Password</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>20</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </password>
44
+ <icecat_type translate="label">
45
+ <label>Subscription level</label>
46
+ <frontend_type>select</frontend_type>
47
+ <source_model>icecatlive/system_config_subscription</source_model>
48
+ <sort_order>25</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ </icecat_type>
53
+ <language translate="label">
54
+ <label>Language</label>
55
+ <frontend_type>select</frontend_type>
56
+ <source_model>icecatlive/system_config_locales</source_model>
57
+ <sort_order>30</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ </language>
62
+ <sku_field translate="label">
63
+ <label>MPN</label>
64
+ <frontend_type>select</frontend_type>
65
+ <source_model>icecatlive/system_config_attributes</source_model>
66
+ <sort_order>40</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ </sku_field>
71
+ <manufacturer translate="label">
72
+ <label>Manufacturer Name</label>
73
+ <frontend_type>select</frontend_type>
74
+ <source_model>icecatlive/system_config_attributes</source_model>
75
+ <sort_order>50</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ </manufacturer>
80
+ <ean_code translate="label">
81
+ <label>Ean Code</label>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>icecatlive/system_config_attributes</source_model>
84
+ <sort_order>60</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </ean_code>
89
+ <descript_priority translate="label">
90
+ <label>Use Description from</label>
91
+ <frontend_type>select</frontend_type>
92
+ <source_model>icecatlive/system_config_descriptionpriority</source_model>
93
+ <sort_order>70</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ </descript_priority>
98
+ <shortdescr_priority translate="label">
99
+ <label>Use Short description from</label>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>icecatlive/system_config_shortdescrpriority</source_model>
102
+ <sort_order>70</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ </shortdescr_priority>
107
+ <name_priority translate="label">
108
+ <label>Use Product Name from</label>
109
+ <frontend_type>select</frontend_type>
110
+ <source_model>icecatlive/system_config_namepriority</source_model>
111
+ <sort_order>70</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </name_priority>
116
+ <image_priority translate="label">
117
+ <label>Use Product Image from</label>
118
+ <frontend_type>select</frontend_type>
119
+ <source_model>icecatlive/system_config_imagepriority</source_model>
120
+ <sort_order>70</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ </image_priority>
125
+ <product_priority translate="label">
126
+ <label>Show/Hide products not presented at icecat</label>
127
+ <frontend_type>select</frontend_type>
128
+ <source_model>icecatlive/system_config_productpriority</source_model>
129
+ <sort_order>70</sort_order>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_website>1</show_in_website>
132
+ <show_in_store>1</show_in_store>
133
+ </product_priority>
134
+ <product_loadingtype translate="label">
135
+ <label>Loading type:</label>
136
+ <frontend_type>select</frontend_type>
137
+ <source_model>icecatlive/system_config_loadingtype</source_model>
138
+ <sort_order>71</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ </product_loadingtype>
143
+ <view_attributes translate="label">
144
+ <label>Not view attribute in product</label>
145
+ <frontend_type>multiselect</frontend_type>
146
+ <source_model>icecatlive/system_config_viewattributes</source_model>
147
+ <sort_order>71</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ </view_attributes>
152
+ <product_onlynewproducts translate="label">
153
+ <label>Import ONLY new products:</label>
154
+ <frontend_type>select</frontend_type>
155
+ <source_model>icecatlive/system_config_onlynewproducts</source_model>
156
+ <sort_order>72</sort_order>
157
+ <show_in_default>1</show_in_default>
158
+ <show_in_website>1</show_in_website>
159
+ <show_in_store>1</show_in_store>
160
+ </product_onlynewproducts>
161
+ <import_data translate="label">
162
+ <label>Full import data</label>
163
+ <frontend_type>submit</frontend_type>
164
+ <frontend_model>icecatlive/adminhtml_system_config_form_button</frontend_model>
165
+ <sort_order>75</sort_order>
166
+ <show_in_default>1</show_in_default>
167
+ <show_in_website>1</show_in_website>
168
+ <show_in_store>1</show_in_store>
169
+ </import_data>
170
+ <update_data translate="label">
171
+ <label>Update information on new products</label>
172
+ <frontend_type>submit</frontend_type>
173
+ <frontend_model>icecatlive/adminhtml_system_config_form_UpdateButton</frontend_model>
174
+ <sort_order>76</sort_order>
175
+ <show_in_default>1</show_in_default>
176
+ <show_in_website>1</show_in_website>
177
+ <show_in_store>1</show_in_store>
178
+ </update_data>
179
+ </fields>
180
+ </icecat>
181
+ </groups>
182
+ </icecat_root>
183
+ <icecatlive_information translate="label" module="icecatlive">
184
+ <label>Icecatlive Information</label>
185
+ <tab>iceshop</tab>
186
+ <sort_order>20</sort_order>
187
+ <show_in_default>1</show_in_default>
188
+ <show_in_website>1</show_in_website>
189
+ <show_in_store>1</show_in_store>
190
+ <comment><![CDATA[]]></comment>
191
+ <groups>
192
+ <dashboard translate="label comment">
193
+ <label>Dashboard</label>
194
+ <sort_order>50</sort_order>
195
+ <show_in_default>1</show_in_default>
196
+ <show_in_website>1</show_in_website>
197
+ <show_in_store>1</show_in_store>
198
+ <comment><![CDATA[<span style="color: grey;">Loading...</span>]]></comment>
199
+ <fields>
200
+ <check_system_hidden translate="label comment">
201
+ <label></label>
202
+ <comment></comment>
203
+ <frontend_type>select</frontend_type>
204
+ <source_model>icecatlive/system_config_checksystem</source_model>
205
+ <sort_order>10</sort_order>
206
+ <show_in_default>1</show_in_default>
207
+ <show_in_website>1</show_in_website>
208
+ <show_in_store>1</show_in_store>
209
+ </check_system_hidden>
210
+ </fields>
211
+ </dashboard>
212
+ </groups>
213
+ </icecatlive_information>
214
+ <iceshop_about translate="label" module="icecatlive">
215
+ <label>Iceshop</label>
216
+ <tab>iceshop</tab>
217
+ <class>iceshop-info-section</class>
218
+ <header_css>iceshop-info-header</header_css>
219
+ <frontend_type>text</frontend_type>
220
+ <sort_order>100</sort_order>
221
+ <show_in_default>1</show_in_default>
222
+ <show_in_website>1</show_in_website>
223
+ <show_in_store>1</show_in_store>
224
+ <comment><![CDATA[]]></comment>
225
+ <groups>
226
+ <iceshop_iframe translate="label comment">
227
+ <label>More about Iceshop</label>
228
+ <sort_order>50</sort_order>
229
+ <show_in_default>1</show_in_default>
230
+ <show_in_website>1</show_in_website>
231
+ <show_in_store>1</show_in_store>
232
+ <comment><![CDATA[<span style="color: grey;">Loading...</span>]]></comment>
233
+ <fields>
234
+ <iceshop_iframe_hidden translate="label comment">
235
+ <label></label>
236
+ <comment></comment>
237
+ <frontend_type>select</frontend_type>
238
+ <source_model>icecatlive/system_config_iceshoplink</source_model>
239
+ <sort_order>10</sort_order>
240
+ <show_in_default>1</show_in_default>
241
+ <show_in_website>1</show_in_website>
242
+ <show_in_store>1</show_in_store>
243
+ </iceshop_iframe_hidden>
244
+ </fields>
245
+ </iceshop_iframe>
246
+ </groups>
247
+ </iceshop_about>
248
+ </sections>
249
+ </config>
app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/mysql4-install-1.6.0.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
- include_once 'uninstall-old-version.php';
3
- $unistaller_old_version = new Uninstall_Bintime_Icecatlive();
4
- $unistaller_old_version->uninstall();
5
- $installer = $this;
6
- /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
7
-
8
- $installer->startSetup();
9
- $installer->run("
10
- DROP TABLE IF EXISTS `bintime_connector_data`;
11
- DROP TABLE IF EXISTS `bintime_connector_data_old`;
12
- DROP TABLE IF EXISTS `bintime_connector_data_products`;
13
- DROP TABLE IF EXISTS `bintime_supplier_mapping`;
14
- DROP TABLE IF EXISTS `bintime_supplier_mapping_old`;
15
- DROP TABLE IF EXISTS {$this->getTable('icecatlive/data')};
16
- CREATE TABLE {$this->getTable('icecatlive/data')} (
17
- `prod_id` varchar(255) NOT NULL,
18
- `supplier_id` int(11) DEFAULT NULL,
19
- `prod_name` varchar(255) DEFAULT NULL,
20
- `prod_img` varchar(255) DEFAULT NULL,
21
- KEY `PRODUCT_MPN` (`prod_id`),
22
- KEY `supplier_id` (`supplier_id`)
23
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product image table';
24
-
25
- DROP TABLE IF EXISTS {$this->getTable('icecatlive/supplier_mapping')};
26
- CREATE TABLE {$this->getTable('icecatlive/supplier_mapping')} (
27
- `supplier_id` int(11) NOT NULL,
28
- `supplier_symbol` VARCHAR(255),
29
- KEY `supplier_id` (`supplier_id`)
30
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector supplier mapping table';
31
-
32
- DROP TABLE IF EXISTS {$this->getTable('icecatlive/data_products')};
33
- CREATE TABLE {$this->getTable('icecatlive/data_products')} (
34
- `prod_id` VARCHAR(255) NOT NULL,
35
- `supplier_symbol` varchar(255) DEFAULT NULL,
36
- `prod_title` VARCHAR(255) NULL DEFAULT NULL,
37
- `prod_ean` VARCHAR(255) NOT NULL,
38
- KEY `prod_id` (`prod_id`),
39
- KEY `PRODUCT_EAN` (`prod_ean`),
40
- INDEX `mpn_brand` (`prod_id`, `supplier_symbol`)
41
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product ean table';
42
- ");
43
-
44
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/mysql4-install-1.7.0.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ include_once 'uninstall-old-version.php';
3
+ $unistaller_old_version = new Uninstall_Bintime_Icecatlive();
4
+ $unistaller_old_version->uninstall();
5
+ $installer = $this;
6
+ /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
7
+
8
+ $installer->startSetup();
9
+ $installer->run("
10
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data')};
11
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data_old')};
12
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data_products')};
13
+ DROP TABLE IF EXISTS {$this->getTable('bintime_supplier_mapping')};
14
+ DROP TABLE IF EXISTS {$this->getTable('bintime_supplier_mapping_old')};
15
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_connector_data')};
16
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_supplier_mapping')};
17
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_connector_data_products')} ;
18
+
19
+ CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_icecatlive_noimport_products_id')} (
20
+ `prod_id` INT(255) UNSIGNED NOT NULL,
21
+ UNIQUE KEY (`prod_id`)
22
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector not import products from icecat';
23
+
24
+ CREATE TABLE IF NOT EXISTS {$this->getTable('icecatlive/products_titles')} (
25
+ `prod_id` INT(255) UNSIGNED NOT NULL,
26
+ `prod_title` VARCHAR(255) NULL DEFAULT NULL,
27
+ UNIQUE KEY (prod_id),
28
+ FOREIGN KEY (prod_id)
29
+ REFERENCES catalog_product_entity(entity_id)
30
+ ON DELETE CASCADE
31
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product titles';
32
+
33
+ CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_icecatlive_extensions_logs')} (
34
+ `log_key` VARCHAR(255) NOT NULL,
35
+ `log_value` varchar(255) DEFAULT NULL,
36
+ UNIQUE KEY (`log_key`)
37
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
38
+ ");
39
+
40
+ $installer->endSetup();
app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/mysql4-upgrade-0.1.0-1.6.0.php CHANGED
@@ -1,45 +1,33 @@
1
- <?php
2
- include_once 'uninstall-old-version.php';
3
- $unistaller_old_version = new Uninstall_Bintime_Icecatlive();
4
- $unistaller_old_version->uninstall();
5
- $installer = $this;
6
- /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
7
-
8
- $installer->startSetup();
9
-
10
- $installer->run("
11
- DROP TABLE IF EXISTS `bintime_connector_data`;
12
- DROP TABLE IF EXISTS `bintime_connector_data_old`;
13
- DROP TABLE IF EXISTS `bintime_connector_data_products`;
14
- DROP TABLE IF EXISTS `bintime_supplier_mapping`;
15
- DROP TABLE IF EXISTS `bintime_supplier_mapping_old`;
16
- DROP TABLE IF EXISTS {$this->getTable('icecatlive/data')};
17
- CREATE TABLE {$this->getTable('icecatlive/data')} (
18
- `prod_id` varchar(255) NOT NULL,
19
- `supplier_id` int(11) DEFAULT NULL,
20
- `prod_name` varchar(255) DEFAULT NULL,
21
- `prod_img` varchar(255) DEFAULT NULL,
22
- KEY `PRODUCT_MPN` (`prod_id`),
23
- KEY `supplier_id` (`supplier_id`)
24
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product image table';
25
-
26
- DROP TABLE IF EXISTS {$this->getTable('icecatlive/supplier_mapping')};
27
- CREATE TABLE {$this->getTable('icecatlive/supplier_mapping')} (
28
- `supplier_id` int(11) NOT NULL,
29
- `supplier_symbol` VARCHAR(255),
30
- KEY `supplier_id` (`supplier_id`)
31
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector supplier mapping table';
32
-
33
- DROP TABLE IF EXISTS {$this->getTable('icecatlive/data_products')};
34
- CREATE TABLE {$this->getTable('icecatlive/data_products')} (
35
- `prod_id` VARCHAR(255) NOT NULL,
36
- `supplier_symbol` varchar(255) DEFAULT NULL,
37
- `prod_title` VARCHAR(255) NULL DEFAULT NULL,
38
- `prod_ean` VARCHAR(255) NOT NULL,
39
- KEY `prod_id` (`prod_id`),
40
- KEY `PRODUCT_EAN` (`prod_ean`),
41
- INDEX `mpn_brand` (`prod_id`, `supplier_symbol`)
42
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product ean table';
43
- ");
44
-
45
  $installer->endSetup();
1
+ <?php
2
+ include_once 'uninstall-old-version.php';
3
+ $unistaller_old_version = new Uninstall_Bintime_Icecatlive();
4
+ $unistaller_old_version->uninstall();
5
+ $installer = $this;
6
+ /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
7
+
8
+ $installer->startSetup();
9
+
10
+ $installer->run("
11
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data')};
12
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data_old')};
13
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data_products')};
14
+ DROP TABLE IF EXISTS {$this->getTable('bintime_supplier_mapping')};
15
+ DROP TABLE IF EXISTS {$this->getTable('bintime_supplier_mapping_old')};
16
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_connector_data')};
17
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_supplier_mapping')};
18
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_connector_data_products')} ;
19
+
20
+ CREATE TABLE IF NOT EXISTS {$this->getTable('icecatlive/products_titles')} (
21
+ `prod_id` VARCHAR(255) NOT NULL,
22
+ `prod_title` VARCHAR(255) NULL DEFAULT NULL,
23
+ UNIQUE KEY (`prod_id`)
24
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product titles';
25
+
26
+ CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_extensions_logs')} (
27
+ `log_key` VARCHAR(255) NOT NULL,
28
+ `log_value` varchar(255) DEFAULT NULL,
29
+ UNIQUE KEY (`log_key`)
30
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
31
+ ");
32
+
 
 
 
 
 
 
 
 
 
 
 
 
33
  $installer->endSetup();
app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/mysql4-upgrade-0.1.1-1.6.0.php CHANGED
@@ -8,38 +8,26 @@ $installer = $this;
8
  $installer->startSetup();
9
 
10
  $installer->run("
11
- DROP TABLE IF EXISTS `bintime_connector_data`;
12
- DROP TABLE IF EXISTS `bintime_connector_data_old`;
13
- DROP TABLE IF EXISTS `bintime_connector_data_products`;
14
- DROP TABLE IF EXISTS `bintime_supplier_mapping`;
15
- DROP TABLE IF EXISTS `bintime_supplier_mapping_old`;
16
- DROP TABLE IF EXISTS {$this->getTable('icecatlive/data')};
17
- CREATE TABLE {$this->getTable('icecatlive/data')} (
18
- `prod_id` varchar(255) NOT NULL,
19
- `supplier_id` int(11) DEFAULT NULL,
20
- `prod_name` varchar(255) DEFAULT NULL,
21
- `prod_img` varchar(255) DEFAULT NULL,
22
- KEY `PRODUCT_MPN` (`prod_id`),
23
- KEY `supplier_id` (`supplier_id`)
24
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product image table';
25
 
26
- DROP TABLE IF EXISTS {$this->getTable('icecatlive/supplier_mapping')};
27
- CREATE TABLE {$this->getTable('icecatlive/supplier_mapping')} (
28
- `supplier_id` int(11) NOT NULL,
29
- `supplier_symbol` VARCHAR(255),
30
- KEY `supplier_id` (`supplier_id`)
31
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector supplier mapping table';
32
-
33
- DROP TABLE IF EXISTS {$this->getTable('icecatlive/data_products')};
34
- CREATE TABLE {$this->getTable('icecatlive/data_products')} (
35
  `prod_id` VARCHAR(255) NOT NULL,
36
- `supplier_symbol` varchar(255) DEFAULT NULL,
37
  `prod_title` VARCHAR(255) NULL DEFAULT NULL,
38
- `prod_ean` VARCHAR(255) NOT NULL,
39
- KEY `prod_id` (`prod_id`),
40
- KEY `PRODUCT_EAN` (`prod_ean`),
41
- INDEX `mpn_brand` (`prod_id`, `supplier_symbol`)
42
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product ean table';
 
 
 
43
  ");
44
 
45
  $installer->endSetup();
8
  $installer->startSetup();
9
 
10
  $installer->run("
11
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data')};
12
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data_old')};
13
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data_products')};
14
+ DROP TABLE IF EXISTS {$this->getTable('bintime_supplier_mapping')};
15
+ DROP TABLE IF EXISTS {$this->getTable('bintime_supplier_mapping_old')};
16
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_connector_data')};
17
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_supplier_mapping')};
18
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_connector_data_products')} ;
 
 
 
 
 
 
19
 
20
+ CREATE TABLE IF NOT EXISTS {$this->getTable('icecatlive/products_titles')} (
 
 
 
 
 
 
 
 
21
  `prod_id` VARCHAR(255) NOT NULL,
 
22
  `prod_title` VARCHAR(255) NULL DEFAULT NULL,
23
+ UNIQUE KEY (`prod_id`)
24
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product titles';
25
+
26
+ CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_extensions_logs')} (
27
+ `log_key` VARCHAR(255) NOT NULL,
28
+ `log_value` varchar(255) DEFAULT NULL,
29
+ UNIQUE KEY (`log_key`)
30
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
31
  ");
32
 
33
  $installer->endSetup();
app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/mysql4-upgrade-1.5.0-1.6.0.php CHANGED
@@ -8,38 +8,26 @@ $installer = $this;
8
  $installer->startSetup();
9
 
10
  $installer->run("
11
- DROP TABLE IF EXISTS `bintime_connector_data`;
12
- DROP TABLE IF EXISTS `bintime_connector_data_old`;
13
- DROP TABLE IF EXISTS `bintime_connector_data_products`;
14
- DROP TABLE IF EXISTS `bintime_connector_data_products`;
15
- DROP TABLE IF EXISTS `bintime_supplier_mapping_old`;
16
- DROP TABLE IF EXISTS {$this->getTable('icecatlive/data')};
17
- CREATE TABLE {$this->getTable('icecatlive/data')} (
18
- `prod_id` varchar(255) NOT NULL,
19
- `supplier_id` int(11) DEFAULT NULL,
20
- `prod_name` varchar(255) DEFAULT NULL,
21
- `prod_img` varchar(255) DEFAULT NULL,
22
- KEY `PRODUCT_MPN` (`prod_id`),
23
- KEY `supplier_id` (`supplier_id`)
24
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product image table';
25
 
26
- DROP TABLE IF EXISTS {$this->getTable('icecatlive/supplier_mapping')};
27
- CREATE TABLE {$this->getTable('icecatlive/supplier_mapping')} (
28
- `supplier_id` int(11) NOT NULL,
29
- `supplier_symbol` VARCHAR(255),
30
- KEY `supplier_id` (`supplier_id`)
31
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector supplier mapping table';
32
-
33
- DROP TABLE IF EXISTS {$this->getTable('icecatlive/data_products')};
34
- CREATE TABLE {$this->getTable('icecatlive/data_products')} (
35
  `prod_id` VARCHAR(255) NOT NULL,
36
- `supplier_symbol` varchar(255) DEFAULT NULL,
37
  `prod_title` VARCHAR(255) NULL DEFAULT NULL,
38
- `prod_ean` VARCHAR(255) NOT NULL,
39
- KEY `prod_id` (`prod_id`),
40
- KEY `PRODUCT_EAN` (`prod_ean`),
41
- INDEX `mpn_brand` (`prod_id`, `supplier_symbol`)
42
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product ean table';
 
 
 
43
  ");
44
 
45
  $installer->endSetup();
8
  $installer->startSetup();
9
 
10
  $installer->run("
11
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data')};
12
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data_old')};
13
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data_products')};
14
+ DROP TABLE IF EXISTS {$this->getTable('bintime_supplier_mapping')};
15
+ DROP TABLE IF EXISTS {$this->getTable('bintime_supplier_mapping_old')};
16
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_connector_data')};
17
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_supplier_mapping')};
18
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_connector_data_products')} ;
 
 
 
 
 
 
19
 
20
+ CREATE TABLE IF NOT EXISTS {$this->getTable('icecatlive/products_titles')} (
 
 
 
 
 
 
 
 
21
  `prod_id` VARCHAR(255) NOT NULL,
 
22
  `prod_title` VARCHAR(255) NULL DEFAULT NULL,
23
+ UNIQUE KEY (`prod_id`)
24
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product titles';
25
+
26
+ CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_extensions_logs')} (
27
+ `log_key` VARCHAR(255) NOT NULL,
28
+ `log_value` varchar(255) DEFAULT NULL,
29
+ UNIQUE KEY (`log_key`)
30
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
31
  ");
32
 
33
  $installer->endSetup();
app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/mysql4-upgrade-1.6.0-1.7.0.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ include_once 'uninstall-old-version.php';
3
+ $unistaller_old_version = new Uninstall_Bintime_Icecatlive();
4
+ $unistaller_old_version->uninstall();
5
+ $installer = $this;
6
+ /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
7
+
8
+ $installer->startSetup();
9
+ $installer->run("
10
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data')};
11
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data_old')};
12
+ DROP TABLE IF EXISTS {$this->getTable('bintime_connector_data_products')};
13
+ DROP TABLE IF EXISTS {$this->getTable('bintime_supplier_mapping')};
14
+ DROP TABLE IF EXISTS {$this->getTable('bintime_supplier_mapping_old')};
15
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_connector_data')};
16
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_supplier_mapping')};
17
+ DROP TABLE IF EXISTS {$this->getTable('iceshop_icecatlive_connector_data_products')} ;
18
+
19
+ CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_icecatlive_noimport_products_id')} (
20
+ `prod_id` INT(255) UNSIGNED NOT NULL,
21
+ UNIQUE KEY (`prod_id`)
22
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector not import products from icecat';
23
+
24
+ CREATE TABLE IF NOT EXISTS {$this->getTable('icecatlive/products_titles')} (
25
+ `prod_id` INT(255) UNSIGNED NOT NULL,
26
+ `prod_title` VARCHAR(255) NULL DEFAULT NULL,
27
+ UNIQUE KEY (prod_id),
28
+ FOREIGN KEY (prod_id)
29
+ REFERENCES catalog_product_entity(entity_id)
30
+ ON DELETE CASCADE
31
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector product titles';
32
+
33
+ CREATE TABLE IF NOT EXISTS {$this->getTable('iceshop_icecatlive_extensions_logs')} (
34
+ `log_key` VARCHAR(255) NOT NULL,
35
+ `log_value` varchar(255) DEFAULT NULL,
36
+ UNIQUE KEY (`log_key`)
37
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Iceshop Connector logs';
38
+ ");
39
+
40
+ $installer->endSetup();
app/code/local/Iceshop/Icecatlive/sql/icecatlive_setup/uninstall-old-version.php CHANGED
@@ -11,7 +11,9 @@ class Uninstall_Bintime_Icecatlive
11
  $template_dir = Mage::getBaseDir('app') . '/design/frontend/base/default/template/icecatlive';
12
  $etc_bintime_xml = Mage::getBaseDir('app') . '/etc/modules/Bintime_Icecatimport.xml';
13
  $package_bintime_xml = Mage::getBaseDir('var') . '/package/IcecatLive-1.5.0.xml';
 
14
 
 
15
  $this->remove_dir($code_dir);
16
  $this->remove_dir($template_dir);
17
  $this->remove_file($design_layout);
11
  $template_dir = Mage::getBaseDir('app') . '/design/frontend/base/default/template/icecatlive';
12
  $etc_bintime_xml = Mage::getBaseDir('app') . '/etc/modules/Bintime_Icecatimport.xml';
13
  $package_bintime_xml = Mage::getBaseDir('var') . '/package/IcecatLive-1.5.0.xml';
14
+ $cache_iceshop_dir = Mage::getBaseDir('var') . '/iceshop';
15
 
16
+ $this->remove_dir($cache_iceshop_dir);
17
  $this->remove_dir($code_dir);
18
  $this->remove_dir($template_dir);
19
  $this->remove_file($design_layout);
app/design/adminhtml/default/default/layout/icecatlive.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <adminhtml_system_config_edit>
4
+ <reference name="head">
5
+ <action method="addCss"><stylesheet>iceshop/icecatlive/styles.css</stylesheet></action>
6
+ <action method="addJs"><script>ICEshop/Icecatlive/jquery-1.9.1.min.js</script></action>
7
+ <action method="addJs"><script>ICEshop/Icecatlive/multi-lingual-store-field.js</script></action>
8
+ <action method="addJs"><script>ICEshop/Icecatlive/script.js</script></action>
9
+ </reference>
10
+ </adminhtml_system_config_edit>
11
+ <default>
12
+ <reference name="notifications">
13
+ <reference name="head">
14
+ <action method="addCss"><stylesheet>iceshop/icecatlive/styles.css</stylesheet></action>
15
+ </reference>
16
+ <block type="icecatlive/adminhtml_notifications" name="icecatlive_notifications" template="iceshop/icecatlive/notifications.phtml"/>
17
+ </reference>
18
+ </default>
19
+ </layout>
app/design/adminhtml/default/default/template/iceshop/icecatlive/ajaxstatusimport.phtml CHANGED
@@ -1,39 +1,13 @@
1
  <script type="text/javascript">
2
- function importStatusMonitor(){
3
- new Ajax.Request('<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_importprogress/check'); ?>', {
4
- method: 'get',
5
- onSuccess: function(transport){
6
- var response = "";
7
- var step = transport.responseJSON.size();
8
- transport.responseJSON.forEach(function(element, index, array){
9
- index = index+1;
10
- response += "<p>"+index+". "+element+"</p>";
11
- });
12
- if($('loading_mask_loader').select('#icecatlive-response').size() == 0){
13
- $('loading_mask_loader').insert({bottom: '<div id="icecatlive-response" style="text-align: left">'+response+'</div>'});
14
- }else{
15
- $('icecatlive-response').replace('<div id="icecatlive-response" style="text-align: left">'+response+'</div>');
16
- }
17
- if($('loading_mask_loader').select('#icecatlive-curstep-response').size() == 0){
18
- $('icecatlive-response').insert({before: '<p id="icecatlive-curstep-response">Current step: '+step+'/9</div>'});
19
- }else{
20
- $('icecatlive-curstep-response').replace('<p id="icecatlive-curstep-response">Current step: '+step+'/9</div>');
21
- }
22
- if(step == 9){
23
- $$('#loading_mask_loader > img')[0].setStyle({
24
- 'display': 'none'
25
- });
26
- var str = $('loading_mask_loader').innerHTML;
27
- str = str.replace('<br>Please wait...', '');
28
- $('loading_mask_loader').innerHTML = str;
29
- $('icecatlive-response').replace('<div id="icecatlive-response" style="text-align: left">'+response+'</div><br><button id="icecatlive_button_finish" onclick="javascript:hide_progress_popup(); return false;" title="Finish import" type="button" class="scalable " style=""><span><span><span>Finish import</span></span></span></button>');
30
- clearInterval(timerId);
31
- }
32
-
33
- }
34
  });
35
  }
36
- function check() {
 
37
  $('loading_mask_loader').setStyle({
38
  width: '430px',
39
  marginLeft: '-235px',
@@ -45,34 +19,98 @@
45
  $$('#loading_mask_loader > img')[0].setStyle({
46
  'display': 'inline'
47
  });
48
- timerId = setInterval("importStatusMonitor()", 5000);
49
- new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
50
  method: 'get',
 
51
  onSuccess: function(transport){
52
- if (transport.responseText){
53
- alert(transport.responseText);
54
- clearInterval(timerId);
55
- $('loading-mask').setStyle({
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  'display': 'none'
57
  });
 
 
 
58
  }
59
  },
60
- onComplete: function(transport){
61
- clearInterval(timerId);
62
- $('loading_mask').setStyle({
63
- 'display': 'block'
64
- });
 
 
65
  }
66
  });
67
  }
68
- function hide_progress_popup(){
69
- $('loading-mask').setStyle({
70
- display: 'none'
71
- });
72
- $('icecatlive-curstep-response').remove();
73
- $('icecatlive-response').remove();
74
- $('icecatlive_button_finish').remove();
75
- }
76
  $('config_edit_form').on('change', '.input-text, .select', function(event) {
77
  if(!$('icecatlive-saveconfig')){
78
  $('icecatlive_button').writeAttribute('disabled', 'disabled');
@@ -80,5 +118,6 @@
80
  $('icecatlive_button').insert({before: '<p id="icecatlive-saveconfig">Please save configuration, and after start import</p>'});
81
  }
82
  });
 
83
  </script>
84
- <?php echo $this->getButtonHtml(); ?>
1
  <script type="text/javascript">
2
+ function hide_progress_popup(){
3
+ document.getElementById("icecatlive_button_finish").remove();
4
+ document.getElementById('icecatlive-response').innerHTML = '';
5
+ $('loading-mask').setStyle({
6
+ display: 'none'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  });
8
  }
9
+
10
+ function import_prod_info(update, full_import, error_import){
11
  $('loading_mask_loader').setStyle({
12
  width: '430px',
13
  marginLeft: '-235px',
19
  $$('#loading_mask_loader > img')[0].setStyle({
20
  'display': 'inline'
21
  });
22
+ new Ajax.Request('<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_importproductinfo/check'); ?>', {
 
23
  method: 'get',
24
+ parameters: {update: update, full_import: full_import, error_import: error_import},
25
  onSuccess: function(transport){
26
+ var import_info = JSON.parse(transport.responseText);
27
+ var count_products = '<p> Found products in shop: '+import_info.count_products+'</p>';
28
+ var current_products = '<p> Current product: '+import_info.current_product+'</p>';
29
+ var error = '';
30
+ var success_imported = '';
31
+ var full_icecat_product = '';
32
+ var error_imported = '';
33
+ var system_error = '';
34
+ if(import_info.error){
35
+ error = '<p class="icecatlive_error">'+import_info.error+'</p>';
36
+ }
37
+ if(import_info.success_imported_product){
38
+ success_imported = '<p> Imported information for products: '+import_info.success_imported_product+'</p>';
39
+ }
40
+ if(import_info.error_imported_product){
41
+ error_imported = '<p> Did not imported information for products: '+import_info.error_imported_product+'</p>';
42
+ }
43
+ if(import_info.full_icecat_product){
44
+ full_icecat_product = '<p> Full icecat products: '+import_info.full_icecat_product+'</p>';
45
+ }
46
+ if(import_info.system_error){
47
+ system_error = '<p class="icecatlive_error"> System error: '+import_info.system_error+'</p>';
48
+ }
49
+ if(import_info.done != 1){
50
+ if($('loading_mask_loader').select('#icecatlive-response').size() == 0){
51
+ $('loading_mask_loader').insert({bottom: '<div id="icecatlive-response" style="text-align: left">'
52
+ +count_products
53
+ +current_products
54
+ +success_imported
55
+ +full_icecat_product
56
+ +error_imported
57
+ +error
58
+ +system_error
59
+ +'</div>'});
60
+ }else{
61
+ $('icecatlive-response').replace('<div id="icecatlive-response" style="text-align: left">'
62
+ +count_products
63
+ +current_products
64
+ +success_imported
65
+ +full_icecat_product
66
+ +error_imported
67
+ +error
68
+ +system_error
69
+ +'</div>');
70
+ }
71
+ import_prod_info(update);
72
+ }else{
73
+ if($('loading_mask_loader').select('#icecatlive-response').size() == 0){
74
+ $('loading_mask_loader').insert({bottom: '<div id="icecatlive-response" style="text-align: left">'
75
+ +count_products
76
+ +current_products
77
+ +success_imported
78
+ +full_icecat_product
79
+ +error_imported
80
+ +error
81
+ +system_error
82
+ +'</div>'
83
+ +'<button id="icecatlive_button_finish" onclick="javascript:hide_progress_popup(); return false;" title="Finish import" type="button" class="scalable " style=""><span><span><span>Finish import</span></span></span></button>'});
84
+ }else{
85
+ $('icecatlive-response').replace('<div id="icecatlive-response" style="text-align: left">'
86
+ +count_products
87
+ +current_products
88
+ +success_imported
89
+ +full_icecat_product
90
+ +error_imported
91
+ +error
92
+ +system_error
93
+ +'</div>'
94
+ +'<button id="icecatlive_button_finish" onclick="javascript:hide_progress_popup(); return false;" title="Finish import" type="button" class="scalable " style=""><span><span><span>Finish import</span></span></span></button>');
95
+ }
96
+ $$('#loading_mask_loader > img')[0].setStyle({
97
  'display': 'none'
98
  });
99
+ var str = $('loading_mask_loader').innerHTML;
100
+ str = str.replace('<br>Please wait...', '');
101
+ $('loading_mask_loader').innerHTML = str;
102
  }
103
  },
104
+ onComplete: function(){
105
+ $('loading_mask').setStyle({
106
+ display: 'block'
107
+ });
108
+ },
109
+ onFailure: function() {
110
+ setTimeout(function(){ import_prod_info(update,0,1); }, 500);
111
  }
112
  });
113
  }
 
 
 
 
 
 
 
 
114
  $('config_edit_form').on('change', '.input-text, .select', function(event) {
115
  if(!$('icecatlive-saveconfig')){
116
  $('icecatlive_button').writeAttribute('disabled', 'disabled');
118
  $('icecatlive_button').insert({before: '<p id="icecatlive-saveconfig">Please save configuration, and after start import</p>'});
119
  }
120
  });
121
+
122
  </script>
123
+ <?php echo $this->getButtonHtml(); ?>
app/design/adminhtml/default/default/template/iceshop/icecatlive/notifications.phtml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_problems = $this->getIcecatliveProblemsDigest(); ?>
2
+ <?php if(!empty($_problems) && is_array($_problems) && count($_problems) > 0):?>
3
+ <div class="notification-global">
4
+ <span class="f-right">
5
+ <a href="<?php print $this->getManageUrl(); ?>" target="_blank"><?php echo $this->helper('icecatlive')->__('Go to system check section'); ?></a>
6
+ </span>
7
+ <strong class="label"><?php echo $this->helper('icecatlive')->__('Warning'); ?>:</strong>
8
+ The Icecatlive extensions doesn't work properly, please go to configuration page and check the problems.
9
+ </div>
10
+ <?php endif;?>
app/design/frontend/default/default/template/iceshop/icecatlive/groupattributes.phtml CHANGED
@@ -1,11 +1,9 @@
1
- <?php
2
- $_helper = $this->helper('catalog/output');
3
- $_product = $this->getProduct();
4
- ?>
5
  <?php if($_additionalgroup = $this->getAdditionalData()): ?>
6
  <div class="box-collateral box-additional">
7
  <h2><?php echo $this->__('Additional Information') ?></h2>
8
-
9
  <?php $i=0; foreach ($_additionalgroup as $_additional): $i++; ?>
10
  <h3><?php echo $this->__( $_additional['title'] )?></h3>
11
  <table class="data-table" id="product-attribute-specs-table-<?php echo $i?>">
@@ -22,6 +20,6 @@
22
  </table>
23
  <script type="text/javascript">decorateTable('product-attribute-specs-table-<?php echo $i?>')</script>
24
  <?php endforeach; ?>
25
-
26
  </div>
27
  <?php endif;?>
1
+ <?php $_helper = $this->helper('catalog/output'); ?>
2
+ <?php $_product = $this->getProduct(); ?>
 
 
3
  <?php if($_additionalgroup = $this->getAdditionalData()): ?>
4
  <div class="box-collateral box-additional">
5
  <h2><?php echo $this->__('Additional Information') ?></h2>
6
+
7
  <?php $i=0; foreach ($_additionalgroup as $_additional): $i++; ?>
8
  <h3><?php echo $this->__( $_additional['title'] )?></h3>
9
  <table class="data-table" id="product-attribute-specs-table-<?php echo $i?>">
20
  </table>
21
  <script type="text/javascript">decorateTable('product-attribute-specs-table-<?php echo $i?>')</script>
22
  <?php endforeach; ?>
23
+
24
  </div>
25
  <?php endif;?>
js/ICEshop/Icecatlive/jquery-1.9.1.min.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license */
2
+ (function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
3
+ return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&&gt(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
4
+ }b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
js/ICEshop/Icecatlive/multi-lingual-store-field.js ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ *
3
+ * @param configObj
4
+ * @returns {*}
5
+ * @constructor
6
+ */
7
+ function MultiLingualStoreField(configObj) {
8
+ var self = this;
9
+ if (typeof configObj != 'undefined') {
10
+ jQuery.extend(self.config, configObj);
11
+ }
12
+ return this;
13
+ };
14
+
15
+ /**
16
+ *
17
+ * @type {{storeViewsEl: null, languagesEl: null, mainEl: null, rowIdentifier: string}}
18
+ */
19
+ MultiLingualStoreField.prototype.config = {
20
+ storeViewsEl: null,
21
+ languagesEl: null,
22
+ mainEl: null,
23
+ fieldsSet: null,
24
+ visibilityToggler: null,
25
+ temporaryStorage: {},
26
+ emptyRowHtml: '<tr><td class="label"><label for=""></label></td><td class="value"></td><td></td><td></td></tr>',
27
+ rowIdentifier: 'row_'
28
+ };
29
+
30
+ MultiLingualStoreField.prototype.languageField = {
31
+ label: null,
32
+ html: null
33
+ };
34
+
35
+ MultiLingualStoreField.prototype.stores = [
36
+ {
37
+ id: 9999,
38
+ label: 'Insurance language'
39
+ }
40
+ ];
41
+
42
+ /**
43
+ *
44
+ */
45
+ MultiLingualStoreField.prototype.buildForm = function () {
46
+ var self = this;
47
+ //return this;
48
+ self.rebuldMainField();
49
+ self.fetchLanguageField();
50
+ self.fetchStores();
51
+
52
+ self.generateFields();
53
+ self.bindHandler();
54
+
55
+ return this;
56
+ };
57
+
58
+ /**
59
+ *
60
+ * @returns {*}
61
+ */
62
+ MultiLingualStoreField.prototype.rebuldMainField = function () {
63
+ var self = this;
64
+ var handler = self.config.mainEl;
65
+ if (handler != null) {
66
+ //run rebuilding main field
67
+ handler.hide(0);
68
+ }
69
+ return this;
70
+ };
71
+
72
+ /**
73
+ *
74
+ * @returns {*}
75
+ */
76
+ MultiLingualStoreField.prototype.fetchLanguageField = function () {
77
+ var self = this;
78
+ var handler = self.config.languagesEl;
79
+ if (handler != null) {
80
+ var field_handler = handler.find('#' + handler.attr('id').slice(self.config.rowIdentifier.length)).clone();
81
+ field_handler.attr({class: null, name: null, id: null});
82
+ self.languageField.html = field_handler[0].outerHTML;
83
+ self.languageField.label = handler.find('td.label').text();
84
+ handler.hide(0);
85
+ }
86
+ return this;
87
+ };
88
+
89
+ /**
90
+ *
91
+ * @returns {*}
92
+ */
93
+ MultiLingualStoreField.prototype.fetchStores = function () {
94
+ var self = this;
95
+ var handler = self.config.storeViewsEl;
96
+ if (handler != null) {
97
+ var options_handler = handler.find('#' + handler.attr('id').slice(self.config.rowIdentifier.length) + ' option');
98
+
99
+ var options = jQuery.map(options_handler, function (option) {
100
+ var joption = jQuery(option);
101
+ return {
102
+ id: joption.attr('value'),
103
+ label: joption.text()
104
+ };
105
+ });
106
+ jQuery.merge(self.stores, options);
107
+ handler.hide(0);
108
+ }
109
+ return this;
110
+ };
111
+
112
+ /**
113
+ *
114
+ * @returns {*}
115
+ */
116
+ MultiLingualStoreField.prototype.generateFields = function () {
117
+ var self = this;
118
+ if (self.stores.length > 0 && self.config.fieldsSet != null) {
119
+ var saved_values = self.config.mainEl.find('input:text').val();
120
+ if (saved_values.length > 0) {
121
+ saved_values = jQuery.parseJSON(saved_values);
122
+ }
123
+
124
+ var visibility = self.checkMultilingualVisibility();
125
+ for (var i = 0; i < self.stores.length; i++) {
126
+ //TODO build fields
127
+ var store_item = self.stores[i];
128
+ var new_element = jQuery(self.config.emptyRowHtml);
129
+
130
+ new_element
131
+ .find('td.value')
132
+ .html(self.languageField.html)
133
+ .find('select')
134
+ .attr({id: 'store-' + store_item.id});
135
+
136
+ if (visibility == false) {
137
+ new_element.css('display', 'none');
138
+ }
139
+
140
+ if (typeof saved_values != 'undefined') {
141
+ var result = jQuery.grep(saved_values, function(el){ return el.store_id == store_item.id });
142
+ if (result.length > 0) {
143
+ new_element
144
+ .find('select')
145
+ .val(result[0]['value']);
146
+ }
147
+ }
148
+
149
+ new_element
150
+ .find('label')
151
+ .text(store_item.label)
152
+ .end()
153
+ .attr({id: 'store-' + store_item.id});
154
+
155
+ self.config.fieldsSet
156
+ .find('tbody')
157
+ .append(new_element);
158
+ }
159
+ }
160
+ return this;
161
+ };
162
+
163
+ /**
164
+ *
165
+ * @returns {boolean}
166
+ */
167
+ MultiLingualStoreField.prototype.checkMultilingualVisibility = function () {
168
+ return (parseInt(this.config.visibilityToggler.find('select').val()) != 0);
169
+ };
170
+
171
+ /**
172
+ *
173
+ * @returns {*}
174
+ */
175
+ MultiLingualStoreField.prototype.bindHandler = function () {
176
+ var self = this;
177
+ self
178
+ .config
179
+ .visibilityToggler
180
+ .find('#' + self.config.visibilityToggler.attr('id').slice(self.config.rowIdentifier.length))
181
+ .on('change', jQuery.proxy(self.visibilityChangeHandler, null, self.config));
182
+
183
+ self.config.fieldsSet
184
+ .find('tbody')
185
+ .find('select[id^=store-]')
186
+ .on('change', jQuery.proxy(self.changeHandler, null, self.config));
187
+ return this;
188
+ };
189
+
190
+ MultiLingualStoreField.prototype.visibilityChangeHandler = function (config, e) {
191
+ var visibility = jQuery(this).val();
192
+ if (visibility == 0) {
193
+ config.temporaryStorage.mainVal = config.mainEl.find('input:text').val();
194
+ config.mainEl.find('input:text').val(null);
195
+
196
+ //if value - 0, hide all custom fields
197
+ config.fieldsSet
198
+ .find('tbody')
199
+ .find('tr[id^=store-]')
200
+ .hide(0);
201
+ } else {
202
+ //if value - 1, hide all service fields
203
+ config.fieldsSet
204
+ .find('tbody')
205
+ .find('select[id^=store-]')
206
+ .attr('disabled', null)
207
+ .end()
208
+ .find('tr[id^=store-]')
209
+ .show(0);
210
+
211
+ config.mainEl.find('input:text').val(config.temporaryStorage.mainVal);
212
+
213
+ config.mainEl.hide(0);
214
+ config.languagesEl.hide(0);
215
+ config.storeViewsEl.hide(0);
216
+
217
+ //TODO prevent using hardcode
218
+ config.fieldsSet.find('select[id^=store-]').each(function(i, el){
219
+ var handler = jQuery(this);
220
+ handler.trigger('change');
221
+ return false;
222
+ });
223
+ }
224
+
225
+ e.preventDefault();
226
+ };
227
+
228
+ /**
229
+ *
230
+ * @param config
231
+ * @param e
232
+ */
233
+ MultiLingualStoreField.prototype.changeHandler = function (config, e) {
234
+ var values_field_container = config.mainEl;
235
+ var values = jQuery.map(config.fieldsSet.find('select[id^=store-]'), function (element) {
236
+ var el_handler = jQuery(element);
237
+ return {
238
+ store_id: parseInt(el_handler.attr('id').slice('store-'.length)),
239
+ value: el_handler.val()
240
+ };
241
+ });
242
+ values_field_container.find('input:text').val(JSON.stringify(values));
243
+ e.preventDefault();
244
+ };
js/ICEshop/Icecatlive/script.js ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //prevent conflict of Prototype and jQuery libraries
2
+ jQuery.noConflict();
3
+
4
+ //script which starts after page is loaded
5
+ jQuery(document).ready(function () {
6
+
7
+ jQuery('div#content').on('click', 'a.section-toggler-icecatlive', function(e){
8
+ toggleIcecatliveFieldset(this);
9
+ e.preventDefault();
10
+ });
11
+
12
+ jQuery('div#content').on('click.go-to-section', 'a.section-toggler-trigger', function(e){
13
+ var handler = jQuery(this);
14
+ var section = handler.data('href');
15
+ if (typeof section != 'undefined') {
16
+ toggleIcecatliveFieldset(jQuery(section).next('.entry-edit').find('.section-toggler'), 'open');
17
+ }
18
+ });
19
+
20
+ var storeViewsEl = jQuery('#row_icecatlive_settings_languages_mapping_dependant_multilingual_store_selector');
21
+
22
+ if (storeViewsEl.length > 0) {
23
+ var multilingual_field = new MultiLingualStoreField({
24
+ storeViewsEl: storeViewsEl,
25
+ languagesEl: jQuery('#row_icecatlive_settings_languages_mapping_dependant_multilingual_languages_values'),
26
+ mainEl: jQuery('#row_icecatlive_settings_languages_mapping_dependant_multilingual_values'),
27
+ visibilityToggler: jQuery('#row_icecatlive_settings_languages_mapping_is_multilingual_boolean'),
28
+ fieldsSet: jQuery('fieldset#icecatlive_settings_languages_mapping')
29
+ }).buildForm();
30
+ }
31
+
32
+ refreshIcecatliveSystemCheck();
33
+
34
+ buildIceshopInfo();
35
+ });
36
+
37
+ function buildIceshopInfo()
38
+ {
39
+ var iceshop_info_handler = jQuery('#iceshop_about_iceshop_iframe');
40
+ if (iceshop_info_handler.length > 0) {
41
+ var iceshop_info_el = jQuery('#iceshop_about_iceshop_iframe_iceshop_iframe_hidden', iceshop_info_handler);
42
+ var iceshop_info_url = Base64.decode(iceshop_info_el.find('option')[0].innerHTML);
43
+ var wrapper = iceshop_info_el.closest('form#config_edit_form div.entry-edit');
44
+ wrapper.find('div.section-config').remove();
45
+ var iceshop_info_iframe_el = jQuery('<iframe></iframe>')
46
+ .attr('src', iceshop_info_url)
47
+ .attr('width', '100%')
48
+ .attr('height', '1000')
49
+ .text('Your browser doesn\'t work with iframe elements');
50
+ iceshop_info_iframe_el.appendTo(wrapper);
51
+ jQuery('div.entry-edit').closest('div.main-col-inner').find('div.content-header').find('table td.form-buttons').hide();
52
+ jQuery('div.content-header-floating').find('table td.form-buttons').html(hide);
53
+ }
54
+ }
55
+
56
+ function refreshIcecatliveSystemCheck(url_string) {
57
+ if (typeof url_string == 'undefined') {
58
+ var checking_dashboard = jQuery('#icecatlive_information_dashboard');
59
+ if (checking_dashboard.length > 0) {
60
+ //we're on dashboard page, lod the code
61
+ var request_url_el = jQuery('#icecatlive_information_dashboard_check_system_hidden', checking_dashboard);
62
+ var request_url = Base64.decode(request_url_el.find('option')[0].innerHTML);
63
+ request_url_el.closest('table').remove();
64
+ jQuery.getJSON(
65
+ request_url,
66
+ function (response) {
67
+ if (typeof response.structure != 'undefined') {
68
+ jQuery('div.entry-edit').html(response.structure);
69
+ }
70
+ if (typeof response.refresh_btn != 'undefined') {
71
+ jQuery('div.entry-edit').closest('div.main-col-inner').find('div.content-header').find('table td.form-buttons').html(response.refresh_btn);
72
+ jQuery('div.content-header-floating').find('table td.form-buttons').html(response.refresh_btn);
73
+ }
74
+ }
75
+ );
76
+ }
77
+ } else {
78
+ jQuery.getJSON(
79
+ Base64.decode(url_string),
80
+ function (response) {
81
+ if (typeof response.structure != 'undefined') {
82
+ jQuery('div.entry-edit').html(response.structure);
83
+ }
84
+ if (typeof response.refresh_btn != 'undefined') {
85
+ jQuery('div.entry-edit').closest('div.main-col-inner').find('div.content-header').find('table td.form-buttons').html(response.refresh_btn);
86
+ jQuery('div.content-header-floating').find('table td.form-buttons').html(response.refresh_btn);
87
+ }
88
+ }
89
+ );
90
+ }
91
+ }
92
+
93
+ function toggleIcecatliveFieldset(element, action_type)
94
+ {
95
+ if (typeof element != 'undefined') {
96
+ if (typeof action_type != 'undefined') {
97
+ switch(action_type) {
98
+ case 'open':
99
+ var handler = jQuery(element);
100
+ if (!handler.hasClass('open')) {
101
+ handler.toggleClass('open');
102
+ handler.closest('.entry-edit').find('div.fieldset').toggleClass('icecatlive-hidden');
103
+ }
104
+ return true;
105
+ break;
106
+ case 'close':
107
+ var handler = jQuery(element);
108
+ if (handler.hasClass('open')) {
109
+ handler.toggleClass('open');
110
+ handler.closest('.entry-edit').find('div.fieldset').toggleClass('icecatlive-hidden');
111
+ }
112
+ return true;
113
+ break;
114
+ }
115
+ } else {
116
+ var handler = jQuery(element);
117
+ handler.toggleClass('open');
118
+ handler.closest('.entry-edit').find('div.fieldset').toggleClass('icecatlive-hidden');
119
+ return true;
120
+ }
121
+ }
122
+ return false;
123
+ }
124
+
125
+ var Base64 = {
126
+ // private property
127
+ _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
128
+
129
+ // public method for encoding
130
+ encode: function (input) {
131
+ var output = "";
132
+ var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
133
+ var i = 0;
134
+
135
+ input = Base64._utf8_encode(input);
136
+
137
+ while (i < input.length) {
138
+
139
+ chr1 = input.charCodeAt(i++);
140
+ chr2 = input.charCodeAt(i++);
141
+ chr3 = input.charCodeAt(i++);
142
+
143
+ enc1 = chr1 >> 2;
144
+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
145
+ enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
146
+ enc4 = chr3 & 63;
147
+
148
+ if (isNaN(chr2)) {
149
+ enc3 = enc4 = 64;
150
+ } else if (isNaN(chr3)) {
151
+ enc4 = 64;
152
+ }
153
+
154
+ output = output +
155
+ Base64._keyStr.charAt(enc1) + Base64._keyStr.charAt(enc2) +
156
+ Base64._keyStr.charAt(enc3) + Base64._keyStr.charAt(enc4);
157
+
158
+ }
159
+
160
+ return output;
161
+ },
162
+
163
+ // public method for decoding
164
+ decode: function (input) {
165
+ var output = "";
166
+ var chr1, chr2, chr3;
167
+ var enc1, enc2, enc3, enc4;
168
+ var i = 0;
169
+
170
+ input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
171
+
172
+ while (i < input.length) {
173
+
174
+ enc1 = Base64._keyStr.indexOf(input.charAt(i++));
175
+ enc2 = Base64._keyStr.indexOf(input.charAt(i++));
176
+ enc3 = Base64._keyStr.indexOf(input.charAt(i++));
177
+ enc4 = Base64._keyStr.indexOf(input.charAt(i++));
178
+
179
+ chr1 = (enc1 << 2) | (enc2 >> 4);
180
+ chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
181
+ chr3 = ((enc3 & 3) << 6) | enc4;
182
+
183
+ output = output + String.fromCharCode(chr1);
184
+
185
+ if (enc3 != 64) {
186
+ output = output + String.fromCharCode(chr2);
187
+ }
188
+ if (enc4 != 64) {
189
+ output = output + String.fromCharCode(chr3);
190
+ }
191
+
192
+ }
193
+
194
+ output = Base64._utf8_decode(output);
195
+
196
+ return output;
197
+
198
+ },
199
+
200
+ // private method for UTF-8 encoding
201
+ _utf8_encode: function (string) {
202
+ string = string.replace(/\r\n/g, "\n");
203
+ var utftext = "";
204
+
205
+ for (var n = 0; n < string.length; n++) {
206
+
207
+ var c = string.charCodeAt(n);
208
+
209
+ if (c < 128) {
210
+ utftext += String.fromCharCode(c);
211
+ }
212
+ else if ((c > 127) && (c < 2048)) {
213
+ utftext += String.fromCharCode((c >> 6) | 192);
214
+ utftext += String.fromCharCode((c & 63) | 128);
215
+ }
216
+ else {
217
+ utftext += String.fromCharCode((c >> 12) | 224);
218
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
219
+ utftext += String.fromCharCode((c & 63) | 128);
220
+ }
221
+
222
+ }
223
+
224
+ return utftext;
225
+ },
226
+
227
+ // private method for UTF-8 decoding
228
+ _utf8_decode: function (utftext) {
229
+ var string = "";
230
+ var i = 0;
231
+ var c = 0;
232
+ var c2 = 0;
233
+ var c3 = 0;
234
+
235
+ while (i < utftext.length) {
236
+
237
+ c = utftext.charCodeAt(i);
238
+
239
+ if (c < 128) {
240
+ string += String.fromCharCode(c);
241
+ i++;
242
+ }
243
+ else if ((c > 191) && (c < 224)) {
244
+ c2 = utftext.charCodeAt(i + 1);
245
+ string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
246
+ i += 2;
247
+ }
248
+ else {
249
+ c2 = utftext.charCodeAt(i + 1);
250
+ c3 = utftext.charCodeAt(i + 2);
251
+ string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
252
+ i += 3;
253
+ }
254
+
255
+ }
256
+ return string;
257
+ }
258
+ }
package.xml CHANGED
@@ -1,24 +1,42 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>IcecatLive</name>
4
- <version>1.6.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v.3</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>ICEcat to Magento Open Source Connector</summary>
10
- <description>ICEcat to Magento Open Source Connector - rich content in your magento shop</description>
11
- <notes>- Changed namespaces, renamed Bintime to Iceshop&#xD;
12
- - Fixed cache mechanizm &#xD;
13
- - Fixed mapping via EAN&#xD;
14
- - Fixed images display with CloudZoom&#xD;
15
- - Fixed mapping with Brand (if the attribute type Pulldown)&#xD;
16
- - Added import button to module settings, and possibility to run import via admin part&#xD;
17
- - Added log file, administrator of the shop can see what is going on with import.</notes>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  <authors><author><name>IceShop</name><user>IceShop</user><email>support@iceshop.nl</email></author></authors>
19
- <date>2013-11-07</date>
20
- <time>19:09:10</time>
21
- <contents><target name="magelocal"><dir name="Iceshop"><dir name="Icecatlive"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="060e727229ea7fe0116d894375e46ccc"/></dir></dir></dir></dir><file name="Attributes.php" hash="c6415d3dd62928e8363ac562d1509eda"/><file name="Media.php" hash="eac711e0b5a0cb5eee87b035dc6b6584"/><dir name="Product"><dir name="List"><file name="Toolbar.php" hash="827cc9425dcf53f0eab287c584342a2f"/></dir></dir><file name="Related.php" hash="305e30364ffec05257ecb7956470f2ce"/><file name="Upsell.php" hash="8370215562ea0684f44ec25a6bbf7634"/></dir><dir name="CatalogSearch"><dir name="Block"><file name="Result.php" hash="e9eabb74fe9c4ad4cb8e138899af2fd4"/></dir></dir><dir name="Helper"><dir name="Catalog"><file name="Image.php" hash="c12cb636446736b4eb8c9c5010089cd9"/></dir><file name="Data.php" hash="2debdcd5ae800419c9b658ef01a75fa8"/><file name="Getdata.php" hash="6ddbbb71f5063ffb5bef171fe04fa163"/><file name="Image.php" hash="192111886575c50ab56c69e1fb1e99b0"/><file name="Output.php" hash="d47c10493a2daa756c4287d31913bdf2"/></dir><dir name="Model"><dir name="Catalog"><file name="Category.php" hash="6d7a1b0bff06cc7f3d4b12c281313e16"/><file name="Product.php" hash="2e5a8a4e979cd47e9f864c8a9a168652"/><file name="Search.php" hash="d5dc1e71739dc3d818b1ba18a1c4cbd8"/></dir><file name="Imagescollection.php" hash="1276b565a520302e1ab328bbc4f45fa4"/><file name="Import.php" hash="dd5a72c9645e581c52bbb77e6037dead"/><file name="Observer.php" hash="912cb2184418740f6f1f49e84151cf8c"/><file name="Relatedcollection.php" hash="9c5998f5be9bfaefaa4445fd28243611"/><dir name="System"><dir name="Config"><file name="Attributes.php" hash="24ec7ed5c52243d17f9569b02d89d0be"/><file name="Descriptionpriority.php" hash="0be58ba20705c1366973e2ce0c4ed697"/><file name="Imagepriority.php" hash="6a0ca72cb1609cfc3de185b265f5314e"/><file name="Importdata.php" hash="25196649542ccc4df2da39f6cc1ec043"/><file name="LanguageList.xml" hash="2db6d2299b1f23fb01cb0a0a44cc2bdd"/><file name="Locales.php" hash="2ddd740afacf4940aae1c39e91360aef"/><file name="Namepriority.php" hash="c1ee76d38fb206e624b0cff4bf237cf8"/><file name="Productpriority.php" hash="5044f2ab2a240841ea2854f452cc590a"/><file name="Shortdescrpriority.php" hash="df10c1a81411671500633ee776f0ca8f"/><file name="Subscription.php" hash="e919a1840cb7aa93a695b85d164efea0"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ImportdataController.php" hash="c4874ee811ce4d3d446835ddc6cb2f94"/><file name="ImportprogressController.php" hash="a9212979beb0aa57447d7d70f3297a28"/></dir><file name="ImageController.php" hash="16c6234143705c6a97b492e5a87256bd"/></dir><dir name="etc"><file name="config.xml" hash="7afdccc2672d80938dc38d7048d2fe39"/><file name="system.xml" hash="154160edd2fdab042e66f6b21f1d1ce0"/></dir><dir name="sql"><dir name="icecatlive_setup"><file name="mysql4-install-1.6.0.php" hash="72b3756955758e2bdf2fad03145a203f"/><file name="mysql4-upgrade-0.1.0-1.6.0.php" hash="4ae2830d9e1a2d452ec8c131ca6e4d8f"/><file name="mysql4-upgrade-0.1.1-1.6.0.php" hash="22949a2edd4e47b3308a579819f0ce54"/><file name="mysql4-upgrade-1.5.0-1.6.0.php" hash="a09bf3687fd9eea2fd8a5bd01e1325d6"/><file name="uninstall-old-version.php" hash="92c247b6eebe23a2ccc3f0ec1627f15f"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="iceshop"><dir name="icecatlive"><file name="groupattributes.xml" hash="29fb1f5d19c04221f668485dccace23d"/></dir></dir></dir><dir name="template"><dir name="iceshop"><dir name="icecatlive"><file name="groupattributes.phtml" hash="15eca455effeba48b3453b39ee887245"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="iceshop"><dir name="icecatlive"><file name="ajaxstatusimport.phtml" hash="b902e3ce605ff29b024ad43ee8f3990e"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iceshop_Icecatlive.xml" hash="b097c8e9a31651d1ab43ff1db9f30d56"/></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
24
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>IcecatLive</name>
4
+ <version>1.7.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v.3</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>ICEcat to Magento Open Source Connector</summary>
10
+ <description>Edit Extension Package Extensions Magento Connect System Magento Admin</description>
11
+ <notes>Bug fix:&#xD;
12
+ - Fixed a bug "Show / Hide Icecat products".&#xD;
13
+ - Fixed duplicate buttons Finish Import.&#xD;
14
+ - Fixed display of Icecat attribute.&#xD;
15
+ - Fixed a bug with a stucking process during the import&#xD;
16
+ - Fixed a bug with the display of unique product attributes.&#xD;
17
+ - Fixed loading of products specified language.&#xD;
18
+ - Fixed Cron status in Noovias&#xD;
19
+ &#xD;
20
+ Improvements:&#xD;
21
+ - Improved procedure to run by Cron. Update starts every Sunday at 00:00 and imports each month 1st day of 00:00.&#xD;
22
+ - Reduced the number of database tables. Save space in the database.&#xD;
23
+ - Module placed in a separate menu item configuration.&#xD;
24
+ - Reduced traffic&#xD;
25
+ - Speed Improvements&#xD;
26
+ &#xD;
27
+ New:&#xD;
28
+ - Added Dashboard and Diagnostic pages&#xD;
29
+ - Added more detailed information about product loading&#xD;
30
+ - Added possibility to combine Icecat attributes with internal Magento attributes&#xD;
31
+ - Added possibility to select attribute for showing on data-sheet&#xD;
32
+ - Added grid table to dashboard to show status about non imported products&#xD;
33
+ - Added function to update only new products&#xD;
34
+ - Added setting "Loading type" with parameters From cache or Real-time.&#xD;
35
+ - Added an IP address of the store to information dashboard.</notes>
36
  <authors><author><name>IceShop</name><user>IceShop</user><email>support@iceshop.nl</email></author></authors>
37
+ <date>2015-03-04</date>
38
+ <time>11:21:37</time>
39
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="icecatlive.xml" hash="d1654d4bcbc4f11b58b728d5c269c704"/></dir><dir name="template"><dir name="iceshop"><dir name="icecatlive"><file name="ajaxstatusimport.phtml" hash="a6c269a0d41be3fcadcec7c80ba8cb18"/><file name="notifications.phtml" hash="90fe6df8ae9655f6f3c6c77685540c08"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="iceshop"><dir name="icecatlive"><file name="groupattributes.xml" hash="29fb1f5d19c04221f668485dccace23d"/></dir></dir></dir><dir name="template"><dir name="iceshop"><dir name="icecatlive"><file name="groupattributes.phtml" hash="8e6af73275f851c58f1e615d8002c482"/></dir></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Iceshop"><dir name="Icecatlive"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="3a0dfe93ead9f74b1f648d16f75c58f8"/><dir name="Product"><dir name="List"><file name="Grid.php" hash="05fd6fcae7bda3b28a1ea9947460d425"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="b9112e6539624cc88c215aecf88cef00"/><file name="UpdateButton.php" hash="78bb6e863c1c2f53720c50a0c2ec65e7"/></dir></dir></dir></dir><file name="Attributes.php" hash="c98dcf1b8629bc5ede2ef40a4f8f7ccb"/><dir name="Product"><dir name="List"><file name="Toolbar.php" hash="03f6259ebb44b41df7d03581bbd9c84a"/></dir></dir><file name="Related.php" hash="1bbac689a628d86ba9704a7b752df286"/><file name="Upsell.php" hash="0dfaba7ae6bc688215a56065101b4544"/></dir><dir name="CatalogSearch"><dir name="Block"><file name="Result.php" hash="199bd394ca894bf82964805270318f09"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b06f19391dba03ecaef4742a42f71902"/><file name="Db.php" hash="30ee856f7f1f42b7fd55660ef14a8106"/><file name="Format.php" hash="ac13e6bb5cdc5919bfad215e1fca4a7b"/><file name="Getdata.php" hash="85dd7bf14c9b232ccf078a99241add1c"/><file name="Output.php" hash="5698b83f62043e95c5f33d603ccbc03a"/><dir name="System"><file name="System.php" hash="ea277a89745de7b28993509f8dee2bab"/><file name="Systemcheck.php" hash="c26d63ea23958012d9fccb0cea339b08"/></dir></dir><dir name="Model"><dir name="Catalog"><file name="Category.php" hash="e4ab9f04ded0059e3f9b7e568586d903"/><file name="Product.php" hash="03794cce61bf0e924ae33593a850d7ea"/><file name="Search.php" hash="8d5c8b59c35a8449c8e4a8e30285d38b"/></dir><file name="Import.php" hash="86103d78b081e615dd4e3833db68b405"/><file name="Observer.php" hash="c0ce0e083254c75e606119f2d14de8bf"/><file name="Relatedcollection.php" hash="82a0585c3404d94dcb4e3a1606bae546"/><dir name="System"><dir name="Config"><file name="Attributes.php" hash="85b2cacd4ef51fa5bb166c4394fdf6f8"/><file name="Checksystem.php" hash="782d1861c87717a347e9aeafb533cabb"/><file name="Descriptionpriority.php" hash="4facaa955e0799b94bf8c7e5e60f64d5"/><file name="Iceshoplink.php" hash="0342f048a75aa382fae42082618218f4"/><file name="Imagepriority.php" hash="ef7a85c5b4ed0562b75096e569720173"/><file name="Importdata.php" hash="25196649542ccc4df2da39f6cc1ec043"/><file name="LanguageList.xml" hash="52aaea2acd5acd2c0d4f63de4f4621bc"/><file name="Loadingtype.php" hash="35ef5c60a7fb1c81852c6e04d066f79f"/><file name="Locales.php" hash="604a6087f75a4dddbf271ac2145356a8"/><file name="Namepriority.php" hash="05e06b1e0fe303d5efc4d4f24dd1df01"/><file name="Onlynewproducts.php" hash="6e758f07cd5d5f16237b45df3492b9e7"/><file name="Productpriority.php" hash="62b5912d7af4a8c7ff5f92c887c70128"/><file name="Shortdescrpriority.php" hash="946c34829295aa50b79f1e8fa7d48eaa"/><file name="Subscription.php" hash="6c4e8895b28fdcaab6001ac2a8fa995b"/><file name="Viewattributes.php" hash="8f0ac7b0091adb1a15564f2a7b9c6b04"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ImportdataController.php" hash="c4874ee811ce4d3d446835ddc6cb2f94"/><file name="ImportproductController.php" hash="5693e28bf5ef3804ed82a9c81f820538"/><file name="ImportproductinfoController.php" hash="5f6fc5b5517b22d796e1b5a81cb199c4"/><file name="ImportprogressController.php" hash="a9212979beb0aa57447d7d70f3297a28"/></dir><file name="IcecatliveController.php" hash="df125f5a2a662bd4cb76ce387a85650f"/><file name="ImageController.php" hash="35e08758e0dfdae450e9aaa342a6b777"/></dir><dir name="etc"><file name="adminhtml.xml" hash="bbfbb08ba646a3f4f3fb38873858930b"/><file name="config.xml" hash="a8a26dc50769f26d43e5971b291e7df5"/><file name="system.xml" hash="106e4eca7100934fef289c95e2a6e7dc"/></dir><dir name="sql"><dir name="icecatlive_setup"><file name="mysql4-install-1.7.0.php" hash="d4a9c36d50f080209df067f09b6294fb"/><file name="mysql4-upgrade-0.1.0-1.6.0.php" hash="3eabfeabdd60bbea11ef1c53251de5a8"/><file name="mysql4-upgrade-0.1.1-1.6.0.php" hash="3eabfeabdd60bbea11ef1c53251de5a8"/><file name="mysql4-upgrade-1.5.0-1.6.0.php" hash="3eabfeabdd60bbea11ef1c53251de5a8"/><file name="mysql4-upgrade-1.6.0-1.7.0.php" hash="30009c76252e7e5f93f6e67084f87200"/><file name="uninstall-old-version.php" hash="ad30e3ae29ba1d7fdfe61dc05476a1d3"/></dir></dir></dir></dir></target><target name="mage"><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iceshop"><dir name="icecatlive"><dir name="images"><file name="iceshop_logo_small_16px.png" hash="4ef632b4b89a047789307b301b9dfb6e"/></dir><file name="styles.css" hash="9bfab144d8ddfd445fe3bbaecac9cc53"/></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="ICEshop"><dir name="Icecatlive"><file name="jquery-1.9.1.min.js" hash="fee4c9e0129fb2b8830a3c17638c44b0"/><file name="multi-lingual-store-field.js" hash="b99ce2b343cc5dbca86bb9165bcc444d"/><file name="script.js" hash="a66a957b7956f895a5065d8c9c5a12f8"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iceshop_Icecatlive.xml" hash="b097c8e9a31651d1ab43ff1db9f30d56"/></dir></target></contents>
40
  <compatible/>
41
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
42
  </package>
skin/adminhtml/default/default/iceshop/icecatlive/images/iceshop_logo_small_16px.png ADDED
Binary file
skin/adminhtml/default/default/iceshop/icecatlive/styles.css ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #icecatlive-warning {
2
+ background-color: #ef672f;
3
+ background-image: none;
4
+ border-bottom: none;
5
+ border-color: #c14800;
6
+ border-top: none;
7
+ color: #ffffff;
8
+ font-weight: bold;
9
+ }
10
+
11
+ #icecatlive-warning .f-right {
12
+ background-color: #31302b;
13
+ display: inline-block;
14
+ height: 17px;
15
+ margin: -5px 0 -5px 0;
16
+ padding: 5px 10px 5px 10px;
17
+ }
18
+
19
+ #icecatlive-warning .f-right a {
20
+ color: #ffffff;
21
+ font-weight: bold;
22
+ text-decoration: none;
23
+ }
24
+
25
+ #icecatlive-warning .f-right a:hover {
26
+ color: #ef672f;
27
+ }
28
+
29
+ #icecatlive-warning strong {
30
+ background-color: #31302b;
31
+ color: #ffffff;
32
+ display: inline-block;
33
+ font-weight: bold;
34
+ height: 17px;
35
+ margin: -5px 10px -5px 0;
36
+ padding: 5px 10px 5px 10px;
37
+ text-transform: uppercase;
38
+ }
39
+
40
+ .icecatlive-hidden {
41
+ display: none;
42
+ }
43
+
44
+ #icecatlive-digest td.label {
45
+ width: 105px;
46
+ }
47
+
48
+ #icecatlive-digest td.label label {
49
+ width: 70px;
50
+ }
51
+
52
+ #icecatlive-digest td.label label.problem-digest {
53
+ background: url(../../images/error_msg_icon.gif) 0px 1px no-repeat;
54
+ color: #ef672f;
55
+ font-weight: bold;
56
+ padding-left: 20px;
57
+ }
58
+
59
+ #icecatlive-digest td.value {
60
+ width: 100%;
61
+ }
62
+
63
+ .icecatlive-label-bold {
64
+ font-weight: bold;
65
+ }
66
+
67
+ .icecatlive-label-uppercase {
68
+ text-transform: uppercase;
69
+ }
70
+
71
+ .icecatlive-label-rewrite {
72
+ display: inline-block;
73
+ width: 120px;
74
+ }
75
+
76
+ .requirement-passed {
77
+ color: green;
78
+ }
79
+
80
+ .requirement-failed {
81
+ color: #ef672f;
82
+ }
83
+
84
+ a.icecatlive-advice {
85
+ background: url(../../images/fam_help.gif) 0px 0px no-repeat;
86
+ display: inline-block;
87
+ height: 16px;
88
+ margin: -4px 0 -4px 4px;
89
+ width: 16px;
90
+ }
91
+
92
+ span.icecatlive-pad-label {
93
+ display: inline-block;
94
+ width: 120px;
95
+ }
96
+
97
+ ul.tabs a.iceshop-info-section,
98
+ ul.tabs a.iceshop-info-section:hover {
99
+ border-bottom: none;
100
+ padding: 0.5em 0.5em 0.28em 1.5em;
101
+ }
102
+
103
+ ul.tabs a.iceshop-info-section:hover {
104
+ background-color: #d8e6e6;
105
+ }
106
+
107
+ ul.tabs a.iceshop-info-section.active, ul.tabs a.iceshop-info-section.active:hover {
108
+ background-color: #fff;
109
+ }
110
+
111
+ ul.tabs a.iceshop-info-section span,
112
+ ul.tabs a.iceshop-info-section:hover span {
113
+ background: url(./images/iceshop_logo_small_16px.png) no-repeat 0 0;
114
+ height: 0;
115
+ overflow: hidden;
116
+ padding: 16px 0 0;
117
+ width: 65px;
118
+ }
119
+
120
+ #row_iceshop_about_iceshop_iframe_iceshop_iframe_hidden {
121
+ display: none;
122
+ }
123
+ #icecatlive-response .icecatlive_error{
124
+ color: red;
125
+ }