Quarticon_Quartic - Version 1.3.1

Version Notes

1.3.1 release QON

Download this release

Release Info

Developer QuarticON
Extension Quarticon_Quartic
Version 1.3.1
Comparing to
See all releases


Code changes from version 1.0.8 to 1.3.1

Files changed (124) hide show
  1. app/code/community/Quarticon/Quartic/Block/Adminhtml/Api/Dump.php +25 -25
  2. app/code/community/Quarticon/Quartic/Block/Adminhtml/History.php +21 -21
  3. app/code/community/Quarticon/Quartic/Block/Adminhtml/History/Grid.php +50 -50
  4. app/code/community/Quarticon/Quartic/Block/Adminhtml/Maps.php +21 -21
  5. app/code/community/Quarticon/Quartic/Block/Adminhtml/Maps/Grid.php +50 -51
  6. app/code/community/Quarticon/Quartic/Block/Adminhtml/Maps/Renderer/Input.php +5 -5
  7. app/code/community/Quarticon/Quartic/Block/Adminhtml/Maps/Renderer/Select.php +29 -29
  8. app/code/community/Quarticon/Quartic/Block/Adminhtml/System/Config/Form/Field/Button.php +29 -29
  9. app/code/community/Quarticon/Quartic/Block/Adminhtml/System/Config/Form/Field/Placement.php +0 -26
  10. app/code/community/Quarticon/Quartic/Block/Adminhtml/System/Config/Form/Field/Register.php +60 -60
  11. app/code/community/Quarticon/Quartic/Block/Adminhtml/System/Config/Form/Field/Text.php +24 -35
  12. app/code/community/Quarticon/Quartic/Block/Adminhtml/System/Config/Form/Fieldset.php +55 -55
  13. app/code/community/Quarticon/Quartic/Block/Adminhtml/System/Config/Form/Iframe.php +8 -0
  14. app/code/community/Quarticon/Quartic/Block/Adminhtml/Urls.php +21 -21
  15. app/code/community/Quarticon/Quartic/Block/Adminhtml/Urls/Grid.php +60 -60
  16. app/code/community/Quarticon/Quartic/Block/Box.php +24 -24
  17. app/code/community/Quarticon/Quartic/Block/Cart.php +35 -0
  18. app/code/community/Quarticon/Quartic/Block/Frame/Cart.php +58 -58
  19. app/code/community/Quarticon/Quartic/Block/Frame/Category.php +86 -86
  20. app/code/community/Quarticon/Quartic/Block/Frame/Home.php +43 -43
  21. app/code/community/Quarticon/Quartic/Block/Frame/Product.php +48 -48
  22. app/code/community/Quarticon/Quartic/Block/Getter/Cart.php +47 -47
  23. app/code/community/Quarticon/Quartic/Block/Getter/Order.php +46 -46
  24. app/code/community/Quarticon/Quartic/Block/Getter/Product.php +73 -35
  25. app/code/community/Quarticon/Quartic/Block/Products.php +59 -59
  26. app/code/community/Quarticon/Quartic/Block/Script.php +25 -20
  27. app/code/community/Quarticon/Quartic/Helper/Data.php +271 -2
  28. app/code/community/Quarticon/Quartic/Model/Adapter/Writer.php +19 -19
  29. app/code/community/Quarticon/Quartic/Model/Attribute.php +49 -49
  30. app/code/community/Quarticon/Quartic/Model/Catalog.php +99 -99
  31. app/code/community/Quarticon/Quartic/Model/Client/AbstractCurl.php +118 -101
  32. app/code/community/Quarticon/Quartic/Model/Client/Api.php +176 -157
  33. app/code/community/Quarticon/Quartic/Model/Client/Resource/Curl.php +210 -206
  34. app/code/community/Quarticon/Quartic/Model/Config.php +177 -128
  35. app/code/community/Quarticon/Quartic/Model/Cron.php +49 -165
  36. app/code/community/Quarticon/Quartic/Model/Feed.php +105 -0
  37. app/code/community/Quarticon/Quartic/Model/Frame.php +66 -84
  38. app/code/community/Quarticon/Quartic/Model/History.php +11 -11
  39. app/code/community/Quarticon/Quartic/Model/Insert.php +79 -117
  40. app/code/community/Quarticon/Quartic/Model/Insert/Cart.php +52 -52
  41. app/code/community/Quarticon/Quartic/Model/Insert/Category.php +54 -54
  42. app/code/community/Quarticon/Quartic/Model/Insert/Home.php +37 -37
  43. app/code/community/Quarticon/Quartic/Model/Insert/Product.php +52 -52
  44. app/code/community/Quarticon/Quartic/Model/Maps.php +11 -11
  45. app/code/community/Quarticon/Quartic/Model/Mysql4/History.php +10 -10
  46. app/code/community/Quarticon/Quartic/Model/Mysql4/History/Collection.php +10 -10
  47. app/code/community/Quarticon/Quartic/Model/Mysql4/Maps.php +10 -10
  48. app/code/community/Quarticon/Quartic/Model/Mysql4/Maps/Collection.php +10 -10
  49. app/code/community/Quarticon/Quartic/Model/Mysql4/Placement.php +10 -10
  50. app/code/community/Quarticon/Quartic/Model/Mysql4/Placement/Collection.php +29 -29
  51. app/code/community/Quarticon/Quartic/Model/Observer/Adminhtml.php +216 -198
  52. app/code/community/Quarticon/Quartic/Model/Observer/Frontend.php +92 -92
  53. app/code/community/Quarticon/Quartic/Model/Order.php +140 -108
  54. app/code/community/Quarticon/Quartic/Model/Placement.php +0 -166
  55. app/code/community/Quarticon/Quartic/Model/Placement/Cart.php +0 -24
  56. app/code/community/Quarticon/Quartic/Model/Placement/Category.php +0 -24
  57. app/code/community/Quarticon/Quartic/Model/Placement/Home.php +0 -24
  58. app/code/community/Quarticon/Quartic/Model/Placement/Product.php +0 -24
  59. app/code/community/Quarticon/Quartic/Model/Product.php +620 -582
  60. app/code/community/Quarticon/Quartic/Model/System/Config/Source/Configurablechildimage.php +17 -17
  61. app/code/community/Quarticon/Quartic/Model/System/Config/Source/Configurablechildprice.php +17 -17
  62. app/code/community/Quarticon/Quartic/Model/System/Config/Source/Configurablechilds.php +17 -17
  63. app/code/community/Quarticon/Quartic/Model/System/Config/Source/Configurableprice.php +19 -19
  64. app/code/community/Quarticon/Quartic/Model/System/Config/Source/Groupedchildimage.php +17 -17
  65. app/code/community/Quarticon/Quartic/Model/System/Config/Source/Groupedprice.php +17 -17
  66. app/code/community/Quarticon/Quartic/Model/System/Config/Source/Visibility.php +19 -19
  67. app/code/community/Quarticon/Quartic/controllers/ActiveController.php +26 -0
  68. app/code/community/Quarticon/Quartic/controllers/Adminhtml/ApiController.php +0 -128
  69. app/code/community/Quarticon/Quartic/controllers/Adminhtml/IndexController.php +18 -23
  70. app/code/community/Quarticon/Quartic/controllers/Adminhtml/MapsController.php +28 -33
  71. app/code/community/Quarticon/Quartic/controllers/FeedController.php +193 -159
  72. app/code/community/Quarticon/Quartic/controllers/FrameController.php +16 -16
  73. app/code/community/Quarticon/Quartic/data/quartic_setup/data-install-1.2.3.php +19 -0
  74. app/code/community/Quarticon/Quartic/data/quartic_setup/data-install-1.3.1.php +19 -0
  75. app/code/community/Quarticon/Quartic/data/quartic_setup/data-upgrade-1.2.2-1.2.3.php +16 -0
  76. app/code/community/Quarticon/Quartic/data/quartic_setup/data-upgrade-1.2.9-1.3.0.php +7 -0
  77. app/code/community/Quarticon/Quartic/etc/adminhtml.xml +36 -30
  78. app/code/community/Quarticon/Quartic/etc/config.xml +217 -224
  79. app/code/community/Quarticon/Quartic/etc/system.xml +162 -604
  80. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-install-0.1.0.php +18 -0
  81. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-install-0.1.4.php +32 -32
  82. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.1.0-0.1.4.php +30 -30
  83. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.1.7-0.2.0.php +79 -79
  84. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.2.1-0.2.2.php +21 -21
  85. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.2.2-0.2.3.php +45 -45
  86. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.2.3-0.2.4.php +21 -21
  87. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.2.5-0.2.6.php +38 -38
  88. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.3.1-0.3.2.php +26 -26
  89. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.3.2-0.3.3.php +16 -0
  90. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.3.3-0.3.4.php +16 -0
  91. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.3.4-0.3.5.php +16 -0
  92. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.3.5-0.3.6.php +16 -0
  93. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-1.0.2-1.0.3.php +48 -48
  94. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-1.0.3-1.0.8.php +0 -47
  95. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-1.1.1-1.2.0.php +15 -0
  96. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-1.2.0-1.2.3.php +15 -0
  97. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-1.2.3-1.3.0.0.php +15 -0
  98. app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-1.3.0.0-1.3.1.0.php +18 -0
  99. app/design/adminhtml/default/default/layout/quartic.xml +24 -29
  100. app/design/adminhtml/default/default/template/quartic/api/dump.phtml +10 -10
  101. app/design/adminhtml/default/default/template/quartic/history.phtml +9 -9
  102. app/design/adminhtml/default/default/template/quartic/maps.phtml +17 -17
  103. app/design/adminhtml/default/default/template/quartic/system/config/button_register.phtml +9 -9
  104. app/design/adminhtml/default/default/template/quartic/urls.phtml +10 -10
  105. app/design/frontend/base/default/layout/quartic.xml +27 -17
  106. app/design/frontend/base/default/template/quartic/cart.phtml +7 -0
  107. app/design/frontend/base/default/template/quartic/frame/cart.phtml +2 -2
  108. app/design/frontend/base/default/template/quartic/frame/category.phtml +2 -2
  109. app/design/frontend/base/default/template/quartic/frame/home.phtml +2 -2
  110. app/design/frontend/base/default/template/quartic/frame/product.phtml +5 -5
  111. app/design/frontend/base/default/template/quartic/getter/order.phtml +17 -16
  112. app/design/frontend/base/default/template/quartic/getter/product.phtml +42 -10
  113. app/design/frontend/base/default/template/quartic/products.phtml +89 -89
  114. app/design/frontend/base/default/template/quartic/products/slt_cart.phtml +0 -0
  115. app/design/frontend/base/default/template/quartic/products/slt_category.phtml +0 -0
  116. app/design/frontend/base/default/template/quartic/products/slt_home.phtml +0 -0
  117. app/design/frontend/base/default/template/quartic/products/slt_product.phtml +0 -0
  118. app/design/frontend/base/default/template/quartic/script.phtml +70 -27
  119. app/etc/modules/Quarticon_Quartic.xml +8 -8
  120. app/locale/pl_PL/Quarticon_Quartic.csv +1 -0
  121. package.xml +11 -11
  122. skin/adminhtml/default/default/images/quarticon-icon.png +0 -0
  123. skin/adminhtml/default/default/quartic.css +7 -7
  124. skin/frontend/base/default/quartic.css +3 -0
app/code/community/Quarticon/Quartic/Block/Adminhtml/Api/Dump.php CHANGED
@@ -1,25 +1,25 @@
1
- <?php
2
-
3
- /**
4
- * Block used to debug api results.
5
- * Do not use in release code.
6
- */
7
- class Quarticon_Quartic_Block_Adminhtml_Api_Dump extends Mage_Adminhtml_Block_Widget_Container
8
- {
9
-
10
- public function __construct()
11
- {
12
- parent::__construct();
13
- $this->setTemplate('quartic/api/dump.phtml');
14
- }
15
-
16
- public function getResult()
17
- {
18
- return array();
19
-
20
- //$status_array = Mage::getStoreConfig("quartic/frames", Mage::app()->getStore());
21
- /* @var $frames Quarticon_Quartic_Model_Placement */
22
- //$frames = Mage::getModel('quartic/placement');
23
- //return $frames->apiLoad();
24
- }
25
- }
1
+ <?php
2
+
3
+ /**
4
+ * Block used to debug api results.
5
+ * Do not use in release code.
6
+ */
7
+ class Quarticon_Quartic_Block_Adminhtml_Api_Dump extends Mage_Adminhtml_Block_Widget_Container
8
+ {
9
+
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+ $this->setTemplate('quartic/api/dump.phtml');
14
+ }
15
+
16
+ public function getResult()
17
+ {
18
+ return array();
19
+
20
+ //$status_array = Mage::getStoreConfig("quartic/frames", Mage::app()->getStore());
21
+ /* @var $frames Quarticon_Quartic_Model_Placement */
22
+ //$frames = Mage::getModel('quartic/placement');
23
+ //return $frames->apiLoad();
24
+ }
25
+ }
app/code/community/Quarticon/Quartic/Block/Adminhtml/History.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
- class Quarticon_Quartic_Block_Adminhtml_History extends Mage_Adminhtml_Block_Widget_Container
3
- {
4
-
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setTemplate('quartic/history.phtml');
9
- }
10
-
11
- protected function _prepareLayout()
12
- {
13
- $this->setChild('grid', $this->getLayout()->createBlock('quartic/adminhtml_history_grid', 'quartic_history_grid'));
14
- return parent::_prepareLayout();
15
- }
16
-
17
- public function getGridHtml()
18
- {
19
- return $this->getChildHtml('grid');
20
- }
21
- }
1
+ <?php
2
+ class Quarticon_Quartic_Block_Adminhtml_History extends Mage_Adminhtml_Block_Widget_Container
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate('quartic/history.phtml');
9
+ }
10
+
11
+ protected function _prepareLayout()
12
+ {
13
+ $this->setChild('grid', $this->getLayout()->createBlock('quartic/adminhtml_history_grid', 'quartic_history_grid'));
14
+ return parent::_prepareLayout();
15
+ }
16
+
17
+ public function getGridHtml()
18
+ {
19
+ return $this->getChildHtml('grid');
20
+ }
21
+ }
app/code/community/Quarticon/Quartic/Block/Adminhtml/History/Grid.php CHANGED
@@ -1,50 +1,50 @@
1
- <?php
2
- class Quarticon_Quartic_Block_Adminhtml_History_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setId('quartic_history_grid');
9
- $this->setDefaultSort('name');
10
- $this->setDefaultDir('asc');
11
- }
12
-
13
- protected function getConfig()
14
- {
15
- return Mage::getModel('quartic/config');
16
- }
17
-
18
- protected function _prepareCollection()
19
- {
20
- $collection = Mage::getModel('quartic/history')->getCollection();
21
- foreach ($collection as &$item) {
22
- $item->setQuarticProductsUrl($item->getUrl('quartic/feed/products', array('hash' => $this->getConfig()->getHash())));
23
- $item->setQuarticOrdersUrl($item->getUrl('quartic/feed/orders', array('hash' => $this->getConfig()->getHash())));
24
- }
25
- $this->setCollection($collection);
26
- return parent::_prepareCollection();
27
- }
28
-
29
- protected function _prepareColumns()
30
- {
31
- $this->addColumn('store_id', array(
32
- 'header' => Mage::helper('quartic')->__('Store ID'),
33
- 'align' => 'right',
34
- 'width' => '50px',
35
- 'index' => 'store_id',
36
- ));
37
- $this->addColumn('date', array(
38
- 'header' => Mage::helper('quartic')->__('Transaction date'),
39
- 'align' => 'left',
40
- 'width' => '200px',
41
- 'index' => 'date',
42
- ));
43
- return parent::_prepareColumns();
44
- }
45
-
46
- public function getRowUrl($row)
47
- {
48
- //return $row->getCeneoUrl();
49
- }
50
- }
1
+ <?php
2
+ class Quarticon_Quartic_Block_Adminhtml_History_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('quartic_history_grid');
9
+ $this->setDefaultSort('name');
10
+ $this->setDefaultDir('asc');
11
+ }
12
+
13
+ protected function getConfig()
14
+ {
15
+ return Mage::getModel('quartic/config');
16
+ }
17
+
18
+ protected function _prepareCollection()
19
+ {
20
+ $collection = Mage::getModel('quartic/history')->getCollection();
21
+ foreach ($collection as &$item) {
22
+ $item->setQuarticProductsUrl($item->getUrl('quartic/feed/products', array('hash' => $this->getConfig()->getHash())));
23
+ $item->setQuarticOrdersUrl($item->getUrl('quartic/feed/orders', array('hash' => $this->getConfig()->getHash())));
24
+ }
25
+ $this->setCollection($collection);
26
+ return parent::_prepareCollection();
27
+ }
28
+
29
+ protected function _prepareColumns()
30
+ {
31
+ $this->addColumn('store_id', array(
32
+ 'header' => Mage::helper('quartic')->__('Store ID'),
33
+ 'align' => 'right',
34
+ 'width' => '50px',
35
+ 'index' => 'store_id',
36
+ ));
37
+ $this->addColumn('date', array(
38
+ 'header' => Mage::helper('quartic')->__('Transaction date'),
39
+ 'align' => 'left',
40
+ 'width' => '200px',
41
+ 'index' => 'date',
42
+ ));
43
+ return parent::_prepareColumns();
44
+ }
45
+
46
+ public function getRowUrl($row)
47
+ {
48
+ //return $row->getCeneoUrl();
49
+ }
50
+ }
app/code/community/Quarticon/Quartic/Block/Adminhtml/Maps.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
- class Quarticon_Quartic_Block_Adminhtml_Maps extends Mage_Adminhtml_Block_Widget_Container
3
- {
4
-
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setTemplate('quartic/maps.phtml');
9
- }
10
-
11
- protected function _prepareLayout()
12
- {
13
- $this->setChild('grid', $this->getLayout()->createBlock('quartic/adminhtml_maps_grid', 'quartic_maps_grid'));
14
- return parent::_prepareLayout();
15
- }
16
-
17
- public function getGridHtml()
18
- {
19
- return $this->getChildHtml('grid');
20
- }
21
- }
1
+ <?php
2
+ class Quarticon_Quartic_Block_Adminhtml_Maps extends Mage_Adminhtml_Block_Widget_Container
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate('quartic/maps.phtml');
9
+ }
10
+
11
+ protected function _prepareLayout()
12
+ {
13
+ $this->setChild('grid', $this->getLayout()->createBlock('quartic/adminhtml_maps_grid', 'quartic_maps_grid'));
14
+ return parent::_prepareLayout();
15
+ }
16
+
17
+ public function getGridHtml()
18
+ {
19
+ return $this->getChildHtml('grid');
20
+ }
21
+ }
app/code/community/Quarticon/Quartic/Block/Adminhtml/Maps/Grid.php CHANGED
@@ -1,51 +1,50 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Block_Adminhtml_Maps_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
- {
5
-
6
- public function __construct()
7
- {
8
- parent::__construct();
9
- $this->setId('quartic_maps_grid');
10
- $this->setDefaultSort('name');
11
- $this->setDefaultDir('asc');
12
- }
13
-
14
- protected function getConfig()
15
- {
16
- return Mage::getModel('quartic/config');
17
- }
18
-
19
- protected function _prepareCollection()
20
- {
21
- $collection = Mage::getModel('quartic/maps')->getCollection();
22
- $collection->addFieldToFilter('quartic_attribute',array('nlike' => '%price')); //hide price mapping
23
- $this->setCollection($collection);
24
- return parent::_prepareCollection();
25
- }
26
-
27
- protected function _prepareColumns()
28
- {
29
- $this->addColumn('id', array(
30
- 'header' => Mage::helper('quartic')->__('ID'),
31
- 'align' => 'right',
32
- 'width' => '50px',
33
- 'index' => 'id',
34
- ));
35
- $this->addColumn('quartic_attribute', array(
36
- 'header' => Mage::helper('quartic')->__('Quartic Attribute'),
37
- 'align' => 'left',
38
- 'width' => '200px',
39
- 'index' => 'quartic_attribute',
40
- ));
41
-
42
- $this->addColumn('magento_attribute', array(
43
- 'header' => Mage::helper('quartic')->__('Magento Attribute'),
44
- 'align' => 'left',
45
- 'renderer' => 'quartic/adminhtml_maps_renderer_select',
46
- 'index' => 'magento_attribute'
47
- ));
48
-
49
- return parent::_prepareColumns();
50
- }
51
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Block_Adminhtml_Maps_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('quartic_maps_grid');
10
+ $this->setDefaultSort('name');
11
+ $this->setDefaultDir('asc');
12
+ }
13
+
14
+ protected function getConfig()
15
+ {
16
+ return Mage::getModel('quartic/config');
17
+ }
18
+
19
+ protected function _prepareCollection()
20
+ {
21
+ $collection = Mage::getModel('quartic/maps')->getCollection();
22
+ $this->setCollection($collection);
23
+ return parent::_prepareCollection();
24
+ }
25
+
26
+ protected function _prepareColumns()
27
+ {
28
+ $this->addColumn('id', array(
29
+ 'header' => Mage::helper('quartic')->__('ID'),
30
+ 'align' => 'right',
31
+ 'width' => '50px',
32
+ 'index' => 'id',
33
+ ));
34
+ $this->addColumn('quartic_attribute', array(
35
+ 'header' => Mage::helper('quartic')->__('Quartic Attribute'),
36
+ 'align' => 'left',
37
+ 'width' => '200px',
38
+ 'index' => 'quartic_attribute',
39
+ ));
40
+
41
+ $this->addColumn('magento_attribute', array(
42
+ 'header' => Mage::helper('quartic')->__('Magento Attribute'),
43
+ 'align' => 'left',
44
+ 'renderer' => 'quartic/adminhtml_maps_renderer_select',
45
+ 'index' => 'magento_attribute'
46
+ ));
47
+
48
+ return parent::_prepareColumns();
49
+ }
50
+ }
 
app/code/community/Quarticon/Quartic/Block/Adminhtml/Maps/Renderer/Input.php CHANGED
@@ -1,5 +1,5 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Block_Adminhtml_Maps_Renderer_Input extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Input
4
- {
5
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Block_Adminhtml_Maps_Renderer_Input extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Input
4
+ {
5
+ }
app/code/community/Quarticon/Quartic/Block/Adminhtml/Maps/Renderer/Select.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Block_Adminhtml_Maps_Renderer_Select extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Input
4
- {
5
-
6
- /**
7
- * Render select for mapping grid
8
- */
9
- public function render(Varien_Object $row)
10
- {
11
-
12
- $value = $row->getData($this->getColumn()->getIndex());
13
- $data = $row->getData();
14
- $id = $data['id'];
15
- $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->getItems();
16
- $html = '<select name="mapped[' . $id . ']" style="width: 100%">';
17
- $html .= '<option value="">--</option>';
18
- foreach ($attributes as $attribute) {
19
- $selected = '';
20
- if ($attribute->getAttributecode() == $value) {
21
- $selected = "selected";
22
- }
23
- $html .= '<option value="' . $attribute->getAttributecode() . '" ' . $selected . '>' . $attribute->getAttributecode() . '</option>';
24
- }
25
- $html .= "</select>";
26
-
27
- return $html;
28
- }
29
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Block_Adminhtml_Maps_Renderer_Select extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Input
4
+ {
5
+
6
+ /**
7
+ * Render select for mapping grid
8
+ */
9
+ public function render(Varien_Object $row)
10
+ {
11
+
12
+ $value = $row->getData($this->getColumn()->getIndex());
13
+ $data = $row->getData();
14
+ $id = $data['id'];
15
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->getItems();
16
+ $html = '<select name="mapped[' . $id . ']" style="width: 100%">';
17
+ $html .= '<option value="">--</option>';
18
+ foreach ($attributes as $attribute) {
19
+ $selected = '';
20
+ if ($attribute->getAttributecode() == $value) {
21
+ $selected = "selected";
22
+ }
23
+ $html .= '<option value="' . $attribute->getAttributecode() . '" ' . $selected . '>' . $attribute->getAttributecode() . '</option>';
24
+ }
25
+ $html .= "</select>";
26
+
27
+ return $html;
28
+ }
29
+ }
app/code/community/Quarticon/Quartic/Block/Adminhtml/System/Config/Form/Field/Button.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
-
3
- /**
4
- * Used in fields that require registration to show
5
- */
6
- class Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Field_Button extends Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Field_Text
7
- {
8
-
9
- /**
10
- * Return element html
11
- *
12
- * @param Varien_Data_Form_Element_Abstract $element
13
- * @return string
14
- */
15
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
16
- {
17
- $this->setElement($element);
18
- $store = $this->getRequest()->getParam('store');
19
- $website = $this->getRequest()->getParam('website');
20
- $url = $this->getUrl($element->getFieldConfig()->button_url, array('store'=>$store,'website' => $website));
21
- $html = $this->getLayout()->createBlock('adminhtml/widget_button')
22
- ->setType('button')
23
- ->setLabel($element->getData('label'))
24
- ->setOnClick("setLocation('{$url}')")
25
- ->toHtml();
26
-
27
- return $html;
28
- }
29
- }
1
+ <?php
2
+
3
+ /**
4
+ * Used in fields that require registration to show
5
+ */
6
+ class Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Field_Button extends Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Field_Text
7
+ {
8
+
9
+ /**
10
+ * Return element html
11
+ *
12
+ * @param Varien_Data_Form_Element_Abstract $element
13
+ * @return string
14
+ */
15
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
16
+ {
17
+ $this->setElement($element);
18
+ $store = $this->getRequest()->getParam('store');
19
+ $website = $this->getRequest()->getParam('website');
20
+ $url = $this->getUrl($element->getFieldConfig()->button_url, array('store'=>$store,'website' => $website));
21
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
22
+ ->setType('button')
23
+ ->setLabel($element->getData('label'))
24
+ ->setOnClick("setLocation('{$url}')")
25
+ ->toHtml();
26
+
27
+ return $html;
28
+ }
29
+ }
app/code/community/Quarticon/Quartic/Block/Adminhtml/System/Config/Form/Field/Placement.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Used in fields that require registration to show
5
- */
6
- class Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Field_Placement extends Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Field_Text
7
- {
8
-
9
- protected function quarticStatus()
10
- {
11
- // TODO: przenieść pobieranie storeId do helpera
12
- $params = Mage::app()->getRequest()->getParams();
13
- if(isset($params['store'])) {
14
- $storeId = (is_numeric($params['store'])) ? (int)$params['store'] : Mage::getModel('core/store')->load($params['store'], 'code')->getId();
15
- } elseif(isset($params['website'])) {
16
- $website = (is_numeric($params['website'])) ? Mage::getModel('core/website')->load($params['website']) : Mage::getModel('core/website')->load($params['website'], 'code');
17
- $storeId = $website->getDefaultGroup()->getDefaultStoreId();
18
- } else {
19
- $storeId = Mage::app()->getStore()->getId();
20
- }
21
-
22
- $status_api = (bool) Mage::getStoreConfig("quartic/config/status", $storeId);
23
- $status_placements = (bool) Mage::getStoreConfig("quartic/config/modified_placements", $storeId);
24
- return $status_api && $status_placements;
25
- }
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/Block/Adminhtml/System/Config/Form/Field/Register.php CHANGED
@@ -1,60 +1,60 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Field_Register extends Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Field_Text
4
- {
5
- /*
6
- * Set template
7
- */
8
-
9
- protected function _construct()
10
- {
11
- parent::_construct();
12
- $this->setTemplate('quartic/system/config/button_register.phtml');
13
- }
14
-
15
- /**
16
- * Return element html
17
- *
18
- * @param Varien_Data_Form_Element_Abstract $element
19
- * @return string
20
- */
21
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
22
- {
23
- return $this->_toHtml();
24
- }
25
-
26
- /**
27
- * Return ajax url for button
28
- *
29
- * @return string
30
- */
31
- public function getRegisterUrl()
32
- {
33
- return 'http://www.quarticon.com/magento/';
34
- }
35
-
36
- /**
37
- * Generate button html
38
- *
39
- * @return string
40
- */
41
- public function getButtonHtml()
42
- {
43
- $button = $this->getLayout()->createBlock('adminhtml/widget_button')
44
- ->setData(
45
- array(
46
- 'id' => 'quartic_register',
47
- 'label' => $this->helper('adminhtml')->__('Register'),
48
- 'onclick' => 'javascript:qon_check(); return false;'
49
- )
50
- );
51
-
52
- return $button->toHtml();
53
- }
54
-
55
- protected function quarticStatus()
56
- {
57
- $status = !(parent::quarticStatus());
58
- return $status;
59
- }
60
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Field_Register extends Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Field_Text
4
+ {
5
+ /*
6
+ * Set template
7
+ */
8
+
9
+ protected function _construct()
10
+ {
11
+ parent::_construct();
12
+ $this->setTemplate('quartic/system/config/button_register.phtml');
13
+ }
14
+
15
+ /**
16
+ * Return element html
17
+ *
18
+ * @param Varien_Data_Form_Element_Abstract $element
19
+ * @return string
20
+ */
21
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
22
+ {
23
+ return $this->_toHtml();
24
+ }
25
+
26
+ /**
27
+ * Return ajax url for button
28
+ *
29
+ * @return string
30
+ */
31
+ public function getRegisterUrl()
32
+ {
33
+ return 'http://www.quarticon.com/magento/';
34
+ }
35
+
36
+ /**
37
+ * Generate button html
38
+ *
39
+ * @return string
40
+ */
41
+ public function getButtonHtml()
42
+ {
43
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
44
+ ->setData(
45
+ array(
46
+ 'id' => 'quartic_register',
47
+ 'label' => $this->helper('adminhtml')->__('Register'),
48
+ 'onclick' => 'javascript:qon_check(); return false;'
49
+ )
50
+ );
51
+
52
+ return $button->toHtml();
53
+ }
54
+
55
+ protected function quarticStatus()
56
+ {
57
+ $status = !(parent::quarticStatus());
58
+ return $status;
59
+ }
60
+ }
app/code/community/Quarticon/Quartic/Block/Adminhtml/System/Config/Form/Field/Text.php CHANGED
@@ -1,35 +1,24 @@
1
- <?php
2
-
3
- /**
4
- * Used in fields that require registration to show
5
- */
6
- class Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Field_Text extends Mage_Adminhtml_Block_System_Config_Form_Field
7
- {
8
-
9
- public function render(Varien_Data_Form_Element_Abstract $element)
10
- {
11
- $post = $element->getId();
12
- $status = $this->quarticStatus();
13
- if (!empty($status)) {
14
- return parent::render($element);
15
- } else {
16
- return '';
17
- }
18
- }
19
-
20
- protected function quarticStatus()
21
- {
22
- // TODO: przenieść pobieranie storeId do helpera
23
- $params = Mage::app()->getRequest()->getParams();
24
- if(isset($params['store'])) {
25
- $storeId = (is_numeric($params['store'])) ? (int)$params['store'] : Mage::getModel('core/store')->load($params['store'], 'code')->getId();
26
- } elseif(isset($params['website'])) {
27
- $website = (is_numeric($params['website'])) ? Mage::getModel('core/website')->load($params['website']) : Mage::getModel('core/website')->load($params['website'], 'code');
28
- $storeId = $website->getDefaultGroup()->getDefaultStoreId();
29
- } else {
30
- $storeId = Mage::app()->getStore()->getId();
31
- }
32
-
33
- return (bool) Mage::getStoreConfig("quartic/config/status", $storeId);
34
- }
35
- }
1
+ <?php
2
+
3
+ /**
4
+ * Used in fields that require registration to show
5
+ */
6
+ class Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Field_Text extends Mage_Adminhtml_Block_System_Config_Form_Field
7
+ {
8
+
9
+ public function render(Varien_Data_Form_Element_Abstract $element)
10
+ {
11
+ $post = $element->getId();
12
+ $status = $this->quarticStatus();
13
+ if (!empty($status)) {
14
+ return parent::render($element);
15
+ } else {
16
+ return '';
17
+ }
18
+ }
19
+
20
+ protected function quarticStatus()
21
+ {
22
+ return (bool) Mage::getStoreConfig("quartic/config/status", Mage::app()->getStore());
23
+ }
24
+ }
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/Block/Adminhtml/System/Config/Form/Fieldset.php CHANGED
@@ -1,55 +1,55 @@
1
- <?php
2
-
3
- /**
4
- * Config form fieldset renderer
5
- *
6
- * @category Mage
7
- * @package Mage_Adminhtml
8
- * @author Magento Core Team <core@magentocommerce.com>
9
- */
10
- class Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Fieldset extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
11
- {
12
-
13
- /**
14
- * Render fieldset html
15
- *
16
- * @param Varien_Data_Form_Element_Abstract $element
17
- * @return string
18
- */
19
- public function render(Varien_Data_Form_Element_Abstract $element)
20
- {
21
- $this->setElement($element);
22
- $html = $this->_getHeaderHtml($element);
23
-
24
- /**
25
- * Empty check begin
26
- */
27
- $fields = $this->_getFieldsHtml($element);
28
- if (empty($fields)) {
29
- return '';
30
- }
31
- $html .= $fields;
32
- unset($fields);
33
- /**
34
- * Empty check end
35
- */
36
- $html .= $this->_getFooterHtml($element);
37
-
38
- return $html;
39
- }
40
-
41
- /**
42
- * Return rendered fields of an element
43
- *
44
- * @param Varien_Data_Form_Element_Abstract $element
45
- * @return string
46
- */
47
- protected function _getFieldsHtml(Varien_Data_Form_Element_Abstract $element)
48
- {
49
- $html = '';
50
- foreach ($element->getSortedElements() as $field) {
51
- $html.= $field->toHtml();
52
- }
53
- return $html;
54
- }
55
- }
1
+ <?php
2
+
3
+ /**
4
+ * Config form fieldset renderer
5
+ *
6
+ * @category Mage
7
+ * @package Mage_Adminhtml
8
+ * @author Magento Core Team <core@magentocommerce.com>
9
+ */
10
+ class Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Fieldset extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
11
+ {
12
+
13
+ /**
14
+ * Render fieldset html
15
+ *
16
+ * @param Varien_Data_Form_Element_Abstract $element
17
+ * @return string
18
+ */
19
+ public function render(Varien_Data_Form_Element_Abstract $element)
20
+ {
21
+ $this->setElement($element);
22
+ $html = $this->_getHeaderHtml($element);
23
+
24
+ /**
25
+ * Empty check begin
26
+ */
27
+ $fields = $this->_getFieldsHtml($element);
28
+ if (empty($fields)) {
29
+ return '';
30
+ }
31
+ $html .= $fields;
32
+ unset($fields);
33
+ /**
34
+ * Empty check end
35
+ */
36
+ $html .= $this->_getFooterHtml($element);
37
+
38
+ return $html;
39
+ }
40
+
41
+ /**
42
+ * Return rendered fields of an element
43
+ *
44
+ * @param Varien_Data_Form_Element_Abstract $element
45
+ * @return string
46
+ */
47
+ protected function _getFieldsHtml(Varien_Data_Form_Element_Abstract $element)
48
+ {
49
+ $html = '';
50
+ foreach ($element->getSortedElements() as $field) {
51
+ $html.= $field->toHtml();
52
+ }
53
+ return $html;
54
+ }
55
+ }
app/code/community/Quarticon/Quartic/Block/Adminhtml/System/Config/Form/Iframe.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Quarticon_Quartic_Block_Adminhtml_System_Config_Form_Iframe extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
3
+ {
4
+ public function render(Varien_Data_Form_Element_Abstract $element) {
5
+ $url = Mage::helper('quartic')->getAdminPageLink();
6
+ return '<iframe style="border: 0;" src="'.$url.'" frameborder="0" width="100%" height="640px"></iframe>';
7
+ }
8
+ }
app/code/community/Quarticon/Quartic/Block/Adminhtml/Urls.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
- class Quarticon_Quartic_Block_Adminhtml_Urls extends Mage_Adminhtml_Block_Widget_Container
3
- {
4
-
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setTemplate('quartic/urls.phtml');
9
- }
10
-
11
- protected function _prepareLayout()
12
- {
13
- $this->setChild('grid', $this->getLayout()->createBlock('quartic/adminhtml_urls_grid', 'quartic_urls_grid'));
14
- return parent::_prepareLayout();
15
- }
16
-
17
- public function getGridHtml()
18
- {
19
- return $this->getChildHtml('grid');
20
- }
21
- }
1
+ <?php
2
+ class Quarticon_Quartic_Block_Adminhtml_Urls extends Mage_Adminhtml_Block_Widget_Container
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setTemplate('quartic/urls.phtml');
9
+ }
10
+
11
+ protected function _prepareLayout()
12
+ {
13
+ $this->setChild('grid', $this->getLayout()->createBlock('quartic/adminhtml_urls_grid', 'quartic_urls_grid'));
14
+ return parent::_prepareLayout();
15
+ }
16
+
17
+ public function getGridHtml()
18
+ {
19
+ return $this->getChildHtml('grid');
20
+ }
21
+ }
app/code/community/Quarticon/Quartic/Block/Adminhtml/Urls/Grid.php CHANGED
@@ -1,60 +1,60 @@
1
- <?php
2
- class Quarticon_Quartic_Block_Adminhtml_Urls_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setId('quartic_urls_grid');
9
- $this->setDefaultSort('name');
10
- $this->setDefaultDir('asc');
11
- }
12
-
13
- protected function getConfig()
14
- {
15
- return Mage::getModel('quartic/config');
16
- }
17
-
18
- protected function _prepareCollection()
19
- {
20
- $collection = Mage::getModel('core/store')->getCollection();
21
- foreach ($collection as &$item) {
22
- $item->setQuarticProductsUrl($item->getUrl('quartic/feed/products', array('hash' => $this->getConfig()->getHash())));
23
- $item->setQuarticOrdersUrl($item->getUrl('quartic/feed/orders', array('hash' => $this->getConfig()->getHash())));
24
- }
25
- $this->setCollection($collection);
26
- return parent::_prepareCollection();
27
- }
28
-
29
- protected function _prepareColumns()
30
- {
31
- $this->addColumn('store_id', array(
32
- 'header' => Mage::helper('quartic')->__('Store ID'),
33
- 'align' => 'right',
34
- 'width' => '50px',
35
- 'index' => 'store_id',
36
- ));
37
- $this->addColumn('name', array(
38
- 'header' => Mage::helper('quartic')->__('Store Name'),
39
- 'align' => 'left',
40
- 'width' => '200px',
41
- 'index' => 'name',
42
- ));
43
- $this->addColumn('quartic_products_url', array(
44
- 'header' => Mage::helper('quartic')->__('Quartic Products URL'),
45
- 'align' => 'left',
46
- 'index' => 'quartic_products_url',
47
- ));
48
- $this->addColumn('quartic_orders_url', array(
49
- 'header' => Mage::helper('quartic')->__('Quartic Orders URL'),
50
- 'align' => 'left',
51
- 'index' => 'quartic_orders_url',
52
- ));
53
- return parent::_prepareColumns();
54
- }
55
-
56
- public function getRowUrl($row)
57
- {
58
- //return $row->getCeneoUrl();
59
- }
60
- }
1
+ <?php
2
+ class Quarticon_Quartic_Block_Adminhtml_Urls_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('quartic_urls_grid');
9
+ $this->setDefaultSort('name');
10
+ $this->setDefaultDir('asc');
11
+ }
12
+
13
+ protected function getConfig()
14
+ {
15
+ return Mage::getModel('quartic/config');
16
+ }
17
+
18
+ protected function _prepareCollection()
19
+ {
20
+ $collection = Mage::getModel('core/store')->getCollection();
21
+ foreach ($collection as &$item) {
22
+ $item->setQuarticProductsUrl($item->getUrl('quartic/feed/products', array('hash' => $this->getConfig()->getHash())));
23
+ $item->setQuarticOrdersUrl($item->getUrl('quartic/feed/orders', array('hash' => $this->getConfig()->getHash())));
24
+ }
25
+ $this->setCollection($collection);
26
+ return parent::_prepareCollection();
27
+ }
28
+
29
+ protected function _prepareColumns()
30
+ {
31
+ $this->addColumn('store_id', array(
32
+ 'header' => Mage::helper('quartic')->__('Store ID'),
33
+ 'align' => 'right',
34
+ 'width' => '50px',
35
+ 'index' => 'store_id',
36
+ ));
37
+ $this->addColumn('name', array(
38
+ 'header' => Mage::helper('quartic')->__('Store Name'),
39
+ 'align' => 'left',
40
+ 'width' => '200px',
41
+ 'index' => 'name',
42
+ ));
43
+ $this->addColumn('quartic_products_url', array(
44
+ 'header' => Mage::helper('quartic')->__('Quartic Products URL'),
45
+ 'align' => 'left',
46
+ 'index' => 'quartic_products_url',
47
+ ));
48
+ $this->addColumn('quartic_orders_url', array(
49
+ 'header' => Mage::helper('quartic')->__('Quartic Orders URL'),
50
+ 'align' => 'left',
51
+ 'index' => 'quartic_orders_url',
52
+ ));
53
+ return parent::_prepareColumns();
54
+ }
55
+
56
+ public function getRowUrl($row)
57
+ {
58
+ //return $row->getCeneoUrl();
59
+ }
60
+ }
app/code/community/Quarticon/Quartic/Block/Box.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
- class Quarticon_Quartic_Block_Box extends Mage_Core_Block_Template
3
- {
4
-
5
- protected function getConfig()
6
- {
7
- return Mage::getModel('quartic/config');
8
- }
9
-
10
- public function isActive()
11
- {
12
- return $this->getConfig()->isActive();
13
- }
14
-
15
- public function getCustomer()
16
- {
17
- return $this->getConfig()->getCustomer();
18
- }
19
-
20
- public function getUser()
21
- {
22
- return $this->getConfig()->getSession()->getCustomer()->getId();
23
- }
24
- }
1
+ <?php
2
+ class Quarticon_Quartic_Block_Box extends Mage_Core_Block_Template
3
+ {
4
+
5
+ protected function getConfig()
6
+ {
7
+ return Mage::getModel('quartic/config');
8
+ }
9
+
10
+ public function isActive()
11
+ {
12
+ return $this->getConfig()->isActive();
13
+ }
14
+
15
+ public function getCustomer()
16
+ {
17
+ return $this->getConfig()->getCustomer();
18
+ }
19
+
20
+ public function getUser()
21
+ {
22
+ return $this->getConfig()->getSession()->getCustomer()->getId();
23
+ }
24
+ }
app/code/community/Quarticon/Quartic/Block/Cart.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Block_Cart extends Mage_Core_Block_Template
4
+ {
5
+
6
+ protected function getConfig()
7
+ {
8
+ return Mage::getModel('quartic/config');
9
+ }
10
+
11
+ public function isActive()
12
+ {
13
+ return $this->getConfig()->isActive();
14
+ }
15
+
16
+ public function getCustomer()
17
+ {
18
+ return $this->getConfig()->getCustomer();
19
+ }
20
+
21
+ public function getStoreName()
22
+ {
23
+ return $this->getConfig()->getStoreName();
24
+ }
25
+
26
+ public function getProducts() {
27
+ $quote = Mage::helper('checkout/cart')->getCart()->getQuote();
28
+ $items = $quote->getAllVisibleItems();
29
+ $ids = array();
30
+ foreach($items as $item) {
31
+ $ids[] = $item->getProductId();
32
+ }
33
+ return implode(',', $ids);
34
+ }
35
+ }
app/code/community/Quarticon/Quartic/Block/Frame/Cart.php CHANGED
@@ -1,58 +1,58 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Block_Frame_Cart extends Mage_Checkout_Block_Cart
4
- {
5
-
6
- protected $frame = null;
7
-
8
- protected function getFrame()
9
- {
10
- if (is_null($this->frame)) {
11
- $this->frame = Mage::getModel('quartic/frame');
12
- $this->frame->setFrameName('cart');
13
- $this->frame->setPlacement($this->getPlacement());
14
- $this->frame->setFrameDivId('slt_cart');
15
- }
16
- return $this->frame;
17
- }
18
-
19
- public function isActive()
20
- {
21
- return $this->getFrame()->isActive();
22
- }
23
-
24
- public function getCustomer()
25
- {
26
- return $this->getFrame()->getCustomer();
27
- }
28
-
29
- public function getUser()
30
- {
31
- return $this->getFrame()->getUser();
32
- }
33
-
34
- public function getSnippetBody()
35
- {
36
- return $this->getFrame()->getSnippetBody();
37
- }
38
-
39
- public function getSnippetId()
40
- {
41
- return $this->getFrame()->getSnippetId();
42
- }
43
-
44
- public function getProducts()
45
- {
46
- $items = $this->getQuote()->getAllItems();
47
- $products = array();
48
- foreach ($items as $item) {
49
- if (!$item->getParentItemId()) {
50
- $product = Mage::helper('quartic')->getProduct($item);
51
- if (!in_array($product, $products)) {
52
- $products[] = $product;
53
- }
54
- }
55
- }
56
- return implode(',', $products);
57
- }
58
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Block_Frame_Cart extends Mage_Checkout_Block_Cart
4
+ {
5
+
6
+ protected $frame = null;
7
+
8
+ protected function getFrame()
9
+ {
10
+ if (is_null($this->frame)) {
11
+ $this->frame = Mage::getModel('quartic/frame');
12
+ $this->frame->setFrameName('cart');
13
+ $this->frame->setPlacement($this->getPlacement());
14
+ $this->frame->setFrameDivId('slt_cart');
15
+ }
16
+ return $this->frame;
17
+ }
18
+
19
+ public function isActive()
20
+ {
21
+ return $this->getFrame()->isActive();
22
+ }
23
+
24
+ public function getCustomer()
25
+ {
26
+ return $this->getFrame()->getCustomer();
27
+ }
28
+
29
+ public function getUser()
30
+ {
31
+ return $this->getFrame()->getUser();
32
+ }
33
+
34
+ public function getSnippetBody()
35
+ {
36
+ return $this->getFrame()->getSnippetBody();
37
+ }
38
+
39
+ public function getSnippetId()
40
+ {
41
+ return $this->getFrame()->getSnippetId();
42
+ }
43
+
44
+ public function getProducts()
45
+ {
46
+ $items = $this->getQuote()->getAllItems();
47
+ $products = array();
48
+ foreach ($items as $item) {
49
+ if (!$item->getParentItemId()) {
50
+ $product = Mage::helper('quartic')->getProduct($item);
51
+ if (!in_array($product, $products)) {
52
+ $products[] = $product;
53
+ }
54
+ }
55
+ }
56
+ return implode(',', $products);
57
+ }
58
+ }
app/code/community/Quarticon/Quartic/Block/Frame/Category.php CHANGED
@@ -1,86 +1,86 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Block_Frame_Category extends Mage_Catalog_Block_Category_View
4
- {
5
-
6
- protected $frame = null;
7
-
8
- protected function _construct()
9
- {
10
- if ($this->getConfig()->shouldUseProductFrameInCategory()) {
11
- $this->setTemplate('quartic/frame/product.phtml');
12
- } else {
13
- $this->setTemplate('quartic/frame/category.phtml');
14
- }
15
- }
16
-
17
- protected function getConfig()
18
- {
19
- return Mage::getModel('quartic/config');
20
- }
21
-
22
- protected function getFrame()
23
- {
24
- if (is_null($this->frame)) {
25
- $this->frame = Mage::getModel('quartic/frame');
26
- $this->frame->setFrameName('category');
27
- $this->frame->setPlacement($this->getPlacement());
28
- $this->frame->setFrameDivId('slt_category');
29
- }
30
- return $this->frame;
31
- }
32
-
33
- public function isActive()
34
- {
35
- return $this->getFrame()->isActive();
36
- }
37
-
38
- public function getCustomer()
39
- {
40
- return $this->getFrame()->getCustomer();
41
- }
42
-
43
- public function getUser()
44
- {
45
- return $this->getFrame()->getUser();
46
- }
47
-
48
- public function getSnippetBody()
49
- {
50
- return $this->getFrame()->getSnippetBody();
51
- }
52
-
53
- public function getSnippetId()
54
- {
55
- return $this->getFrame()->getSnippetId();
56
- }
57
-
58
- /**
59
- * Gets SKU/id of random product in the current category.
60
- *
61
- * @return string
62
- */
63
- public function getProductId()
64
- {
65
- return Mage::helper('quartic')->getProduct($this->getRandomProduct());
66
- }
67
-
68
- /**
69
- * Gets random product from current category
70
- *
71
- * @return Mage_Catalog_Model_Product
72
- */
73
- public function getRandomProduct()
74
- {
75
- $category = Mage::getModel('catalog/category')->load($this->getCurrentCategory()->getId());
76
- $count = $category->getProductCount();
77
- if ($count) {
78
- $randomIndex = rand(0, $count - 1);
79
- $productCollection = $category->getProductCollection()
80
- ->setPageSize(1)
81
- ->setCurPage($randomIndex);
82
- return $productCollection->getFirstItem();
83
- }
84
- return null;
85
- }
86
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Block_Frame_Category extends Mage_Catalog_Block_Category_View
4
+ {
5
+
6
+ protected $frame = null;
7
+
8
+ protected function _construct()
9
+ {
10
+ if ($this->getConfig()->shouldUseProductFrameInCategory()) {
11
+ $this->setTemplate('quartic/frame/product.phtml');
12
+ } else {
13
+ $this->setTemplate('quartic/frame/category.phtml');
14
+ }
15
+ }
16
+
17
+ protected function getConfig()
18
+ {
19
+ return Mage::getModel('quartic/config');
20
+ }
21
+
22
+ protected function getFrame()
23
+ {
24
+ if (is_null($this->frame)) {
25
+ $this->frame = Mage::getModel('quartic/frame');
26
+ $this->frame->setFrameName('category');
27
+ $this->frame->setPlacement($this->getPlacement());
28
+ $this->frame->setFrameDivId('slt_category');
29
+ }
30
+ return $this->frame;
31
+ }
32
+
33
+ public function isActive()
34
+ {
35
+ return $this->getFrame()->isActive();
36
+ }
37
+
38
+ public function getCustomer()
39
+ {
40
+ return $this->getFrame()->getCustomer();
41
+ }
42
+
43
+ public function getUser()
44
+ {
45
+ return $this->getFrame()->getUser();
46
+ }
47
+
48
+ public function getSnippetBody()
49
+ {
50
+ return $this->getFrame()->getSnippetBody();
51
+ }
52
+
53
+ public function getSnippetId()
54
+ {
55
+ return $this->getFrame()->getSnippetId();
56
+ }
57
+
58
+ /**
59
+ * Gets SKU/id of random product in the current category.
60
+ *
61
+ * @return string
62
+ */
63
+ public function getProductId()
64
+ {
65
+ return Mage::helper('quartic')->getProduct($this->getRandomProduct());
66
+ }
67
+
68
+ /**
69
+ * Gets random product from current category
70
+ *
71
+ * @return Mage_Catalog_Model_Product
72
+ */
73
+ public function getRandomProduct()
74
+ {
75
+ $category = Mage::getModel('catalog/category')->load($this->getCurrentCategory()->getId());
76
+ $count = $category->getProductCount();
77
+ if ($count) {
78
+ $randomIndex = rand(0, $count - 1);
79
+ $productCollection = $category->getProductCollection()
80
+ ->setPageSize(1)
81
+ ->setCurPage($randomIndex);
82
+ return $productCollection->getFirstItem();
83
+ }
84
+ return null;
85
+ }
86
+ }
app/code/community/Quarticon/Quartic/Block/Frame/Home.php CHANGED
@@ -1,43 +1,43 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Block_Frame_Home extends Mage_Core_Block_Template
4
- {
5
-
6
- protected $frame = null;
7
-
8
- protected function getFrame()
9
- {
10
- if (is_null($this->frame)) {
11
- $this->frame = Mage::getModel('quartic/frame');
12
- $this->frame->setFrameName('homepage');
13
- $this->frame->setPlacement($this->getPlacement());
14
- $this->frame->setFrameDivId('slt_home');
15
- }
16
- return $this->frame;
17
- }
18
-
19
- public function isActive()
20
- {
21
- return $this->getFrame()->isActive();
22
- }
23
-
24
- public function getCustomer()
25
- {
26
- return $this->getFrame()->getCustomer();
27
- }
28
-
29
- public function getUser()
30
- {
31
- return $this->getFrame()->getUser();
32
- }
33
-
34
- public function getSnippetBody()
35
- {
36
- return $this->getFrame()->getSnippetBody();
37
- }
38
-
39
- public function getSnippetId()
40
- {
41
- return $this->getFrame()->getSnippetId();
42
- }
43
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Block_Frame_Home extends Mage_Core_Block_Template
4
+ {
5
+
6
+ protected $frame = null;
7
+
8
+ protected function getFrame()
9
+ {
10
+ if (is_null($this->frame)) {
11
+ $this->frame = Mage::getModel('quartic/frame');
12
+ $this->frame->setFrameName('homepage');
13
+ $this->frame->setPlacement($this->getPlacement());
14
+ $this->frame->setFrameDivId('slt_home');
15
+ }
16
+ return $this->frame;
17
+ }
18
+
19
+ public function isActive()
20
+ {
21
+ return $this->getFrame()->isActive();
22
+ }
23
+
24
+ public function getCustomer()
25
+ {
26
+ return $this->getFrame()->getCustomer();
27
+ }
28
+
29
+ public function getUser()
30
+ {
31
+ return $this->getFrame()->getUser();
32
+ }
33
+
34
+ public function getSnippetBody()
35
+ {
36
+ return $this->getFrame()->getSnippetBody();
37
+ }
38
+
39
+ public function getSnippetId()
40
+ {
41
+ return $this->getFrame()->getSnippetId();
42
+ }
43
+ }
app/code/community/Quarticon/Quartic/Block/Frame/Product.php CHANGED
@@ -1,48 +1,48 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Block_Frame_Product extends Mage_Catalog_Block_Product_View
4
- {
5
-
6
- protected $frame = null;
7
-
8
- protected function getFrame()
9
- {
10
- if (is_null($this->frame)) {
11
- $this->frame = Mage::getModel('quartic/frame');
12
- $this->frame->setFrameName('product');
13
- $this->frame->setPlacement($this->getPlacement());
14
- $this->frame->setFrameDivId('slt_product');
15
- }
16
- return $this->frame;
17
- }
18
-
19
- public function isActive()
20
- {
21
- return $this->getFrame()->isActive();
22
- }
23
-
24
- public function getCustomer()
25
- {
26
- return $this->getFrame()->getCustomer();
27
- }
28
-
29
- public function getUser()
30
- {
31
- return $this->getFrame()->getUser();
32
- }
33
-
34
- public function getSnippetBody()
35
- {
36
- return $this->getFrame()->getSnippetBody();
37
- }
38
-
39
- public function getSnippetId()
40
- {
41
- return $this->getFrame()->getSnippetId();
42
- }
43
-
44
- public function getProductId()
45
- {
46
- return Mage::helper('quartic')->getProduct($this->getProduct());
47
- }
48
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Block_Frame_Product extends Mage_Catalog_Block_Product_View
4
+ {
5
+
6
+ protected $frame = null;
7
+
8
+ protected function getFrame()
9
+ {
10
+ if (is_null($this->frame)) {
11
+ $this->frame = Mage::getModel('quartic/frame');
12
+ $this->frame->setFrameName('product');
13
+ $this->frame->setPlacement($this->getPlacement());
14
+ $this->frame->setFrameDivId('slt_product');
15
+ }
16
+ return $this->frame;
17
+ }
18
+
19
+ public function isActive()
20
+ {
21
+ return $this->getFrame()->isActive();
22
+ }
23
+
24
+ public function getCustomer()
25
+ {
26
+ return $this->getFrame()->getCustomer();
27
+ }
28
+
29
+ public function getUser()
30
+ {
31
+ return $this->getFrame()->getUser();
32
+ }
33
+
34
+ public function getSnippetBody()
35
+ {
36
+ return $this->getFrame()->getSnippetBody();
37
+ }
38
+
39
+ public function getSnippetId()
40
+ {
41
+ return $this->getFrame()->getSnippetId();
42
+ }
43
+
44
+ public function getProductId()
45
+ {
46
+ return Mage::helper('quartic')->getProduct($this->getProduct());
47
+ }
48
+ }
app/code/community/Quarticon/Quartic/Block/Getter/Cart.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Block_Getter_Cart extends Quarticon_Quartic_Block_Script
4
- {
5
-
6
- protected $_quote = null;
7
-
8
- protected function getConfig()
9
- {
10
- return Mage::getModel('quartic/config');
11
- }
12
-
13
- public function isActive()
14
- {
15
- return $this->getConfig()->isActive();
16
- }
17
-
18
- public function getCustomer()
19
- {
20
- return $this->getConfig()->getCustomer();
21
- }
22
-
23
- public function getUser()
24
- {
25
- return $this->getConfig()->getSession()->getCustomer()->getId();
26
- }
27
-
28
- public function getQuote()
29
- {
30
- if (null === $this->_quote) {
31
- $this->_quote = Mage::getSingleton('checkout/session')->getQuote();
32
- }
33
- return $this->_quote;
34
- }
35
-
36
- public function getProductsCsv()
37
- {
38
- $items = $this->getQuote()->getAllItems();
39
- $products = array();
40
- foreach ($items as $item) {
41
- if (!$item->getParentItemId()) {
42
- $products[] = Mage::helper('quartic')->getProduct($item);
43
- }
44
- }
45
- return implode(',', $products);
46
- }
47
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Block_Getter_Cart extends Quarticon_Quartic_Block_Script
4
+ {
5
+
6
+ protected $_quote = null;
7
+
8
+ protected function getConfig()
9
+ {
10
+ return Mage::getModel('quartic/config');
11
+ }
12
+
13
+ public function isActive()
14
+ {
15
+ return $this->getConfig()->isActive();
16
+ }
17
+
18
+ public function getCustomer()
19
+ {
20
+ return $this->getConfig()->getCustomer();
21
+ }
22
+
23
+ public function getUser()
24
+ {
25
+ return $this->getConfig()->getSession()->getCustomer()->getId();
26
+ }
27
+
28
+ public function getQuote()
29
+ {
30
+ if (null === $this->_quote) {
31
+ $this->_quote = Mage::getSingleton('checkout/session')->getQuote();
32
+ }
33
+ return $this->_quote;
34
+ }
35
+
36
+ public function getProductsCsv()
37
+ {
38
+ $items = $this->getQuote()->getAllItems();
39
+ $products = array();
40
+ foreach ($items as $item) {
41
+ if (!$item->getParentItemId()) {
42
+ $products[] = Mage::helper('quartic')->getProduct($item);
43
+ }
44
+ }
45
+ return implode(',', $products);
46
+ }
47
+ }
app/code/community/Quarticon/Quartic/Block/Getter/Order.php CHANGED
@@ -1,46 +1,46 @@
1
- <?php
2
- class Quarticon_Quartic_Block_Getter_Order extends Quarticon_Quartic_Block_Script
3
- {
4
-
5
- protected function getConfig()
6
- {
7
- return Mage::getModel('quartic/config');
8
- }
9
-
10
- public function isActive()
11
- {
12
- return $this->getConfig()->isActive();
13
- }
14
-
15
- public function getCustomer()
16
- {
17
- return $this->getConfig()->getCustomer();
18
- }
19
-
20
- public function getUser()
21
- {
22
- return $this->getConfig()->getSession()->getCustomer()->getId();
23
- }
24
-
25
- public function getOrder()
26
- {
27
- return Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
28
- }
29
-
30
- public function getProducts()
31
- {
32
- $items = $this->getOrder()->getAllItems();
33
- $products = array();
34
- foreach ($items as $item) {
35
- if (!$item->getParentItemId()) {
36
- $product = Mage::helper('quartic')->getProduct($item);
37
- $products[] = array(
38
- 'product' => $product,
39
- 'price' => $item->getPriceInclTax(),
40
- 'quantity' => (int)$item->getQtyOrdered()
41
- );
42
- }
43
- }
44
- return $products;
45
- }
46
- }
1
+ <?php
2
+ class Quarticon_Quartic_Block_Getter_Order extends Quarticon_Quartic_Block_Script
3
+ {
4
+
5
+ protected function getConfig()
6
+ {
7
+ return Mage::getModel('quartic/config');
8
+ }
9
+
10
+ public function isActive()
11
+ {
12
+ return $this->getConfig()->isActive();
13
+ }
14
+
15
+ public function getCustomer()
16
+ {
17
+ return $this->getConfig()->getCustomer();
18
+ }
19
+
20
+ public function getUser()
21
+ {
22
+ return $this->getConfig()->getSession()->getCustomer()->getId();
23
+ }
24
+
25
+ public function getOrder()
26
+ {
27
+ return Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
28
+ }
29
+
30
+ public function getProducts()
31
+ {
32
+ $items = $this->getOrder()->getAllItems();
33
+ $products = array();
34
+ foreach ($items as $item) {
35
+ if (!$item->getParentItemId()) {
36
+ $product = Mage::helper('quartic')->getProduct($item);
37
+ $products[] = array(
38
+ 'product' => $product,
39
+ 'price' => $item->getPriceInclTax(),
40
+ 'quantity' => (int)$item->getQtyOrdered()
41
+ );
42
+ }
43
+ }
44
+ return $products;
45
+ }
46
+ }
app/code/community/Quarticon/Quartic/Block/Getter/Product.php CHANGED
@@ -1,35 +1,73 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Block_Getter_Product extends Quarticon_Quartic_Block_Script
4
- {
5
-
6
- protected function getConfig()
7
- {
8
- return Mage::getModel('quartic/config');
9
- }
10
-
11
- public function isActive()
12
- {
13
- return $this->getConfig()->isActive();
14
- }
15
-
16
- public function getCustomer()
17
- {
18
- return $this->getConfig()->getCustomer();
19
- }
20
-
21
- public function getUser()
22
- {
23
- return $this->getConfig()->getSession()->getCustomer()->getId();
24
- }
25
-
26
- public function getProduct()
27
- {
28
- $product = $this->getData('product');
29
- if (empty($product)) {
30
- $product = Mage::registry('current_product');
31
- $this->setProduct($product);
32
- }
33
- return $product;
34
- }
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Block_Getter_Product extends Quarticon_Quartic_Block_Script
4
+ {
5
+
6
+ protected function getConfig()
7
+ {
8
+ return Mage::getModel('quartic/config');
9
+ }
10
+
11
+ public function isActive()
12
+ {
13
+ return $this->getConfig()->isActive();
14
+ }
15
+
16
+ public function getCustomer()
17
+ {
18
+ return $this->getConfig()->getCustomer();
19
+ }
20
+
21
+ public function getUser()
22
+ {
23
+ return $this->getConfig()->getSession()->getCustomer()->getId();
24
+ }
25
+
26
+ /**
27
+ * returns current page product
28
+ * @return Mage_Catalog_Model_Product
29
+ */
30
+ public function getProduct()
31
+ {
32
+ $product = $this->getData('product');
33
+ if (empty($product)) {
34
+ $product = Mage::registry('current_product');
35
+ $this->setProduct($product);
36
+ }
37
+ return $product;
38
+ }
39
+
40
+ /**
41
+ * returns products prices for tags
42
+ * @param Mage_Catalog_Model_Product $product
43
+ * @return array
44
+ */
45
+ public function getProductPrices($product) {
46
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
47
+ $price_old = 0;
48
+ $price = $product->getPriceModel()->getTotalPrices($product, 'min', true);
49
+ } else {
50
+ $price_old = Mage::helper('tax')->getPrice($product, $product->getPrice(), true);
51
+ $price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true);
52
+ }
53
+ return array(
54
+ 'price_old' => $price_old,
55
+ 'price' => $price
56
+ );
57
+ }
58
+
59
+ /**
60
+ * if show quartic tags
61
+ * @param Mage_Catalog_Model_Product $product
62
+ * @return bool
63
+ */
64
+ public function showQuarticTags($product) {
65
+ return in_array($product->getTypeId(), array(
66
+ Mage_Catalog_Model_Product_Type::TYPE_BUNDLE,
67
+ Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
68
+ Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE,
69
+ Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL,
70
+ 'downloadable'
71
+ ));
72
+ }
73
+ }
app/code/community/Quarticon/Quartic/Block/Products.php CHANGED
@@ -1,59 +1,59 @@
1
- <?php
2
- class Quarticon_Quartic_Block_Products extends Mage_Catalog_Block_Product_List
3
- {
4
-
5
- protected function getConfig()
6
- {
7
- return Mage::getSingleton('quartic/config');
8
- }
9
-
10
- public function getLoadedProductCollection()
11
- {
12
-
13
- $use_sku = $this->getConfig()->isUsingSkuEnabled(); /* SKU or ID */
14
- $request = $this->getRequest();
15
- $collection = Mage::getModel('catalog/product')->getCollection()
16
- ->addAttributeToSelect('*');
17
-
18
- if ($use_sku) {
19
- $sku_array = $request->getParam('sku');
20
- $collection->addFieldToFilter('sku', array('in' => $sku_array));
21
- } else {
22
- $id_array = $request->getParam('sku');
23
- $collection->addFieldToFilter('entity_id', array('in' => $id_array));
24
- }
25
- if ($this->getConfig()->showOnlyInStock()) {
26
- $collection->joinField(
27
- 'qty',
28
- 'cataloginventory/stock_item',
29
- 'qty',
30
- 'product_id=entity_id',
31
- '{{table}}.stock_id=1',
32
- 'left'
33
- )
34
- ->addAttributeToFilter('qty', array('gt' => 0));
35
- }
36
- return $collection;
37
- }
38
-
39
- public function getQuarticUrl($product)
40
- {
41
- $use_sku = $this->getConfig()->isUsingSkuEnabled(); /* SKU or ID */
42
- if ($use_sku) {
43
- $skuid = $product->getSku();
44
- } else {
45
- $skuid = $product->getId();
46
- }
47
- $request = $this->getRequest();
48
- $skuid_array = $request->getParam('sku');
49
- $url_array = $request->getParam('url');
50
- $i = array_search($skuid, $skuid_array);
51
- $quartic_url = $url_array[$i] ? $url_array[$i] : $product->getProductUrl();
52
- return $quartic_url;
53
- }
54
-
55
- public function getQuarticAddToCartUrl($product)
56
- {
57
- return $this->getAddToCartUrl($product);
58
- }
59
- }
1
+ <?php
2
+ class Quarticon_Quartic_Block_Products extends Mage_Catalog_Block_Product_List
3
+ {
4
+
5
+ protected function getConfig()
6
+ {
7
+ return Mage::getSingleton('quartic/config');
8
+ }
9
+
10
+ public function getLoadedProductCollection()
11
+ {
12
+
13
+ $use_sku = $this->getConfig()->isUsingSkuEnabled(); /* SKU or ID */
14
+ $request = $this->getRequest();
15
+ $collection = Mage::getModel('catalog/product')->getCollection()
16
+ ->addAttributeToSelect('*');
17
+
18
+ if ($use_sku) {
19
+ $sku_array = $request->getParam('sku');
20
+ $collection->addFieldToFilter('sku', array('in' => $sku_array));
21
+ } else {
22
+ $id_array = $request->getParam('sku');
23
+ $collection->addFieldToFilter('entity_id', array('in' => $id_array));
24
+ }
25
+ if ($this->getConfig()->showOnlyInStock()) {
26
+ $collection->joinField(
27
+ 'qty',
28
+ 'cataloginventory/stock_item',
29
+ 'qty',
30
+ 'product_id=entity_id',
31
+ '{{table}}.stock_id=1',
32
+ 'left'
33
+ )
34
+ ->addAttributeToFilter('qty', array('gt' => 0));
35
+ }
36
+ return $collection;
37
+ }
38
+
39
+ public function getQuarticUrl($product)
40
+ {
41
+ $use_sku = $this->getConfig()->isUsingSkuEnabled(); /* SKU or ID */
42
+ if ($use_sku) {
43
+ $skuid = $product->getSku();
44
+ } else {
45
+ $skuid = $product->getId();
46
+ }
47
+ $request = $this->getRequest();
48
+ $skuid_array = $request->getParam('sku');
49
+ $url_array = $request->getParam('url');
50
+ $i = array_search($skuid, $skuid_array);
51
+ $quartic_url = $url_array[$i] ? $url_array[$i] : $product->getProductUrl();
52
+ return $quartic_url;
53
+ }
54
+
55
+ public function getQuarticAddToCartUrl($product)
56
+ {
57
+ return $this->getAddToCartUrl($product);
58
+ }
59
+ }
app/code/community/Quarticon/Quartic/Block/Script.php CHANGED
@@ -1,20 +1,25 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Block_Script extends Mage_Core_Block_Template
4
- {
5
-
6
- protected function getConfig()
7
- {
8
- return Mage::getModel('quartic/config');
9
- }
10
-
11
- public function isActive()
12
- {
13
- return $this->getConfig()->isActive();
14
- }
15
-
16
- public function getCustomer()
17
- {
18
- return $this->getConfig()->getCustomer();
19
- }
20
- }
 
 
 
 
 
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Block_Script extends Mage_Core_Block_Template
4
+ {
5
+
6
+ protected function getConfig()
7
+ {
8
+ return Mage::getModel('quartic/config');
9
+ }
10
+
11
+ public function isActive()
12
+ {
13
+ return $this->getConfig()->isActive();
14
+ }
15
+
16
+ public function getCustomer()
17
+ {
18
+ return $this->getConfig()->getCustomer();
19
+ }
20
+
21
+ public function getStoreName()
22
+ {
23
+ return $this->getConfig()->getStoreName();
24
+ }
25
+ }
app/code/community/Quarticon/Quartic/Helper/Data.php CHANGED
@@ -5,18 +5,33 @@ class Quarticon_Quartic_Helper_Data extends Mage_Core_Helper_Abstract
5
 
6
  protected $_debug;
7
 
8
- public function log($content = '')
 
 
 
 
 
 
 
9
  {
10
  if ($this->getDebug()) {
11
- Mage::log($content, null, 'quartic.log');
12
  }
13
  }
14
 
 
 
 
 
15
  protected function getConfig()
16
  {
17
  return Mage::getModel('quartic/config');
18
  }
19
 
 
 
 
 
20
  protected function getDebug()
21
  {
22
  if (is_null($this->_debug)) {
@@ -66,4 +81,258 @@ class Quarticon_Quartic_Helper_Data extends Mage_Core_Helper_Abstract
66
  return $item->getSku();
67
  }
68
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  }
5
 
6
  protected $_debug;
7
 
8
+ protected $preparedClientData = array();
9
+
10
+ /**
11
+ * Output log to file
12
+ * @param string $content
13
+ * @param string $filename
14
+ */
15
+ public function log($content = '', $filename = 'quartic.log')
16
  {
17
  if ($this->getDebug()) {
18
+ Mage::log($content, null, $filename);
19
  }
20
  }
21
 
22
+ /**
23
+ * Get config object
24
+ * @return Quarticon_Quartic_Model_Config
25
+ */
26
  protected function getConfig()
27
  {
28
  return Mage::getModel('quartic/config');
29
  }
30
 
31
+ /**
32
+ * Is debug enabled?
33
+ * @return bool
34
+ */
35
  protected function getDebug()
36
  {
37
  if (is_null($this->_debug)) {
81
  return $item->getSku();
82
  }
83
  }
84
+
85
+ /**
86
+ * Get link to quartic admin page
87
+ * @return string
88
+ */
89
+ public function getAdminPageLink() {
90
+ $iframeLink = Mage::getStoreConfig('quartic/config/iframe_link');
91
+ return $iframeLink.'?'.$this->getAuthQuery();
92
+ }
93
+
94
+ /**
95
+ * Get store name hash for given scope
96
+ * @return string
97
+ */
98
+ private function getStoreNameHash() {
99
+ $scope = $this->getScopeDetails();
100
+ $name = Mage::getStoreConfig('quartic/config/storeName');
101
+ if ($scope['scope'] != 'default') {
102
+ $name .= '_'.$scope['scopeId'];
103
+ }
104
+ return $name;
105
+ }
106
+
107
+ /**
108
+ * Get plugin authentication url query
109
+ * @return string
110
+ */
111
+ public function getAuthQuery() {
112
+ $version = Mage::getConfig()->getModuleConfig("Quarticon_Quartic")->version;
113
+ $secret = Mage::getStoreConfig('quartic/config/secret');
114
+ $storeName = $this->getStoreNameHash();
115
+ $key = time();
116
+ $hash = hash_hmac('sha512', $secret, $key);
117
+ $params = array(
118
+ 'storeName' => $storeName,
119
+ 'hash' => $hash,
120
+ 'key' => $key,
121
+ 'ver' => reset($version),
122
+ 'locale' => Mage::app()->getLocale()->getLocaleCode(),
123
+ 'storeConfig' => base64_encode(json_encode(array(
124
+ 'currency' => Mage::app()->getStore()->getCurrentCurrencyCode(),
125
+ 'country' => Mage::getStoreConfig('general/locale/code', Mage::app()->getStore()->getId())
126
+ )))
127
+ );
128
+ return http_build_query($params);
129
+ }
130
+
131
+ /**
132
+ * Send upgrade request for every initialized shopview
133
+ */
134
+ public function sendUpgradeEvent() {
135
+ $secret = Mage::getStoreConfig('quartic/config/secret');
136
+ $name = Mage::getStoreConfig('quartic/config/storeName');
137
+
138
+ $ss = Mage::getStoreConfig("quartic/config/storeScopes");
139
+ if ($ss) {
140
+ $scopes = json_decode($ss, true);
141
+ foreach ($scopes as $storeId => $data) {
142
+ if (isset($data['shopInit']) && $data['shopInit']) {
143
+ $this->log('upgrade for store: '.$storeId);
144
+ $storeName = ($storeId == 0) ? $name : $name . '_' . $storeId;
145
+ Mage::helper('quartic')->sendEventStoreInit($storeName, $secret);
146
+ }
147
+ }
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Store first init action
153
+ * @param $name store name identifier
154
+ * @param $secret store secret
155
+ */
156
+ public function sendEventStoreInit($name, $secret) {
157
+ $this->log('sendEventStoreInit');
158
+ $eventName = 'store.init';
159
+ $params = array(
160
+ 'storeName' => $name,
161
+ 'secret' => $secret,
162
+ 'storeUrl' => Mage::getStoreConfig('web/secure/base_url'),
163
+ 'pluginVersion' => reset(Mage::getConfig()->getModuleConfig("Quarticon_Quartic")->version),
164
+ 'storeVersion' => Mage::getVersion()
165
+ );
166
+
167
+ $this->sendEvent($eventName, $params);
168
+ }
169
+
170
+ /**
171
+ * Send event to quartic webhook
172
+ * @param $eventName event name
173
+ * @param $params data
174
+ */
175
+ private function sendEvent($eventName, $params) {
176
+ $this->log('sendEvent');
177
+ $url = Mage::getStoreConfig('quartic/config/webhook_link');
178
+ $curl = Mage::getModel('quartic/client_resource_curl');
179
+ $curl->addHeader('x-webhook-name', $eventName);
180
+ $curl->post('', $params, $url);
181
+ }
182
+
183
+ /**
184
+ * Set data for given scope
185
+ * @param $scopeId
186
+ * @param $key
187
+ * @param $val
188
+ * @param $reset
189
+ */
190
+ public function setStoreScopeData($scopeId, $key, $val, $reset = false) {
191
+ $data = array();
192
+ $ss = Mage::getStoreConfig("quartic/config/storeScopes");
193
+ if ($ss) {
194
+ $data = json_decode($ss, true);
195
+ }
196
+ if (!isset($data[$scopeId])) {
197
+ $data[$scopeId] = array();
198
+ }
199
+ $data[$scopeId][$key] = $val;
200
+ $this->setStoreConfig('quartic/config/storeScopes', json_encode($data), true);
201
+ if ($reset) {
202
+ Mage::app()->getStore()->resetConfig();
203
+ }
204
+ }
205
+
206
+ /**
207
+ * Get data from scope
208
+ * @param $scopeId
209
+ * @param $key
210
+ * @return null
211
+ */
212
+ public function getStoreScopeData($scopeId, $key) {
213
+ $ss = Mage::getStoreConfig("quartic/config/storeScopes");
214
+ if (!$ss) {
215
+ return null;
216
+ }
217
+ $data = json_decode($ss, true);
218
+ if (isset($data[$scopeId][$key])) {
219
+ return $data[$scopeId][$key];
220
+ }
221
+ return null;
222
+ }
223
+
224
+ /**
225
+ * Init quartic shop for current scope in Quartic
226
+ */
227
+ public function initQuarticShop() {
228
+ $scope = $this->getScopeDetails();
229
+ if ($this->getStoreScopeData($scope['scopeId'], 'shopInit')) {
230
+ $this->log('Shop already initialized for scope: '.$scope['scopeId']);
231
+ return;
232
+ }
233
+ if ($scope['scope'] != 'default') {
234
+ $storeName = $this->getStoreNameHash();
235
+ $this->sendEventStoreInit($storeName, $secret = Mage::getStoreConfig('quartic/config/secret'));
236
+ $this->setStoreConfig('quartic/config/storeName', $storeName);
237
+ }
238
+ $this->setStoreScopeData($scope['scopeId'], 'shopInit', true);
239
+ }
240
+
241
+ /**
242
+ * If not set already tries to retrieve customer data from quartic
243
+ * @return bool true if customer data retreived
244
+ */
245
+ public function prepareCustomerData() {
246
+ $scope = $this->getScopeDetails();
247
+ if ($this->getStoreScopeData($scope['scopeId'], 'custData')) {
248
+ $this->log('Customers data already retrieved: '.$scope['scopeId']);
249
+ return;
250
+ }
251
+ $this->log('prepareCustomerData for scope: '.json_encode($scope));
252
+
253
+ $url = Mage::getStoreConfig('quartic/config/clientData_link') . '?' . $this->getAuthQuery();
254
+ $curl = Mage::getModel('quartic/client_resource_curl');
255
+ $result = $curl->get('', array(), $url);
256
+
257
+ if (is_array($result['body']) && isset($result['body']['found']) && $result['body']['found']) {
258
+ $this->log('store customer data in config: '.json_encode($result['body']));
259
+ $this->setStoreConfig('quartic/config/api_key', $result['body']['api_key']);
260
+ $this->setStoreConfig('quartic/config/customer', $result['body']['symbol']);
261
+ $this->setStoreConfig('quartic/config/status', 1, true);
262
+ $this->setStoreConfig('quartic/config/active', 1);
263
+
264
+ // flush config
265
+ Mage::app()->getStore()->resetConfig();
266
+
267
+ // order history api call
268
+ $_order = Mage::getModel('quartic/order');
269
+ $_order->sendTransacionsEvent($scope['scopeId']);
270
+
271
+ // set catalog link api call
272
+ $feed = Mage::getModel('quartic/feed');
273
+ $feed->sendCatalogEvent($scope['scopeId']);
274
+
275
+ $this->setStoreScopeData($scope['scopeId'], 'custData', true);
276
+ return true;
277
+ }
278
+ return false;
279
+ }
280
+
281
+ /**
282
+ * Stores config in databases
283
+ * @param $key
284
+ * @param $val
285
+ * @param bool $default save to default scope?
286
+ */
287
+ public function setStoreConfig($key, $val, $default = false) {
288
+ $scope = $this->getScopeDetails();
289
+ if ($default) {
290
+ $scope['scope'] = 'default';
291
+ $scope['scopeId'] = 0;
292
+ }
293
+ Mage::getModel('core/config')->saveConfig($key, $val, $scope['scope'], $scope['scopeId']);
294
+ }
295
+
296
+ /**
297
+ * Get scope and scope id
298
+ * @return array
299
+ */
300
+ public function getScopeDetails() {
301
+ $website = Mage::app()
302
+ ->getWebsite(true);
303
+ $defaultStoreId = 0;
304
+ if ($website) {
305
+ $defaultStoreId = $website
306
+ ->getDefaultGroup()
307
+ ->getDefaultStoreId();
308
+ }
309
+
310
+ $params = Mage::app()->getRequest()->getParams();
311
+ if (isset($params['store']) && !empty($params['store']) && is_numeric($params['store'])) {
312
+ if ($params['store'] != $defaultStoreId) {
313
+ return array('scope' => 'stores', 'scopeId' => $params['store']);
314
+ }
315
+ } elseif (strlen($code = Mage::getSingleton('adminhtml/config_data')->getStore())) {
316
+ $store_id = Mage::getModel('core/store')->load($code)->getId();
317
+ if ($store_id != $defaultStoreId) {
318
+ return array('scope' => 'stores', 'scopeId' => $store_id);
319
+ }
320
+ } elseif (strlen($code = Mage::getSingleton('adminhtml/config_data')->getWebsite())) {
321
+ $website_id = Mage::getModel('core/website')->load($code)->getId();
322
+ $store_id = Mage::app()->getWebsite($website_id)->getDefaultStore()->getId();
323
+ if ($store_id != $defaultStoreId) {
324
+ return array('scope' => 'websites', 'scopeId' => $store_id);
325
+ }
326
+ }
327
+ return array('scope' => 'default', 'scopeId' => 0);
328
+ }
329
+
330
+ /**
331
+ * Get store id from request
332
+ * @return int
333
+ */
334
+ public function getStoreId() {
335
+ $scope = $this->getScopeDetails();
336
+ return $scope['scopeId'];
337
+ }
338
  }
app/code/community/Quarticon/Quartic/Model/Adapter/Writer.php CHANGED
@@ -1,19 +1,19 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Adapter_Writer extends XMLWriter
4
- {
5
-
6
- /**
7
- *
8
- * Prepares raw element to be written
9
- *
10
- * @param string $content
11
- * @return true or false
12
- *
13
- */
14
- function WriteRaw($content)
15
- {
16
- $content = str_replace('&', '&amp;', $content);
17
- parent::WriteRaw($content);
18
- }
19
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Adapter_Writer extends XMLWriter
4
+ {
5
+
6
+ /**
7
+ *
8
+ * Prepares raw element to be written
9
+ *
10
+ * @param string $content
11
+ * @return true or false
12
+ *
13
+ */
14
+ function WriteRaw($content)
15
+ {
16
+ $content = str_replace('&', '&amp;', $content);
17
+ parent::WriteRaw($content);
18
+ }
19
+ }
app/code/community/Quarticon/Quartic/Model/Attribute.php CHANGED
@@ -1,49 +1,49 @@
1
- <?php
2
- class Quarticon_Quartic_Model_Attribute extends Mage_Core_Model_Abstract
3
- {
4
-
5
- protected function _construct()
6
- {
7
- $this->_init('quartic/attribute');
8
- }
9
-
10
- public function toOptionArray()
11
- {
12
- $attributes_collection = Mage::getModel('catalog/entity_attribute')->getCollection()
13
- ->addFieldToFilter('entity_type_id', $this->_getEntityTypeId());
14
- $res = array();
15
- foreach ($attributes_collection as $attribute) {
16
- $res[$attribute->getAttributeCode()] = array(
17
- 'label' => $attribute->getAttributeCode(),
18
- 'value' => $attribute->getAttributeCode()
19
- );
20
- }
21
- ksort($res);
22
- return array_merge(array(array('label' => '', 'value' => '')), $res);
23
- }
24
-
25
- public function getOptionsByCode($code)
26
- {
27
- $attr = Mage::getModel('eav/config')->getAttribute('catalog_product', $code);
28
- $options = $attr->getSource()->getAllOptions();
29
- $res = array();
30
- foreach ($options as $option) {
31
- $res[$option['value']] = $option['label'];
32
- }
33
- unset($res['']);
34
- return $res;
35
- }
36
-
37
- /**
38
- * Gets catalog product EAV entity type id.
39
- *
40
- * @return string
41
- */
42
- protected function _getEntityTypeId()
43
- {
44
- $collection = Mage::getModel('eav/entity_type')->getCollection()
45
- ->addFieldToFilter('entity_type_code', 'catalog_product');
46
- $item = $collection->getFirstItem();
47
- return $item->getId();
48
- }
49
- }
1
+ <?php
2
+ class Quarticon_Quartic_Model_Attribute extends Mage_Core_Model_Abstract
3
+ {
4
+
5
+ protected function _construct()
6
+ {
7
+ $this->_init('quartic/attribute');
8
+ }
9
+
10
+ public function toOptionArray()
11
+ {
12
+ $attributes_collection = Mage::getModel('catalog/entity_attribute')->getCollection()
13
+ ->addFieldToFilter('entity_type_id', $this->_getEntityTypeId());
14
+ $res = array();
15
+ foreach ($attributes_collection as $attribute) {
16
+ $res[$attribute->getAttributeCode()] = array(
17
+ 'label' => $attribute->getAttributeCode(),
18
+ 'value' => $attribute->getAttributeCode()
19
+ );
20
+ }
21
+ ksort($res);
22
+ return array_merge(array(array('label' => '', 'value' => '')), $res);
23
+ }
24
+
25
+ public function getOptionsByCode($code)
26
+ {
27
+ $attr = Mage::getModel('eav/config')->getAttribute('catalog_product', $code);
28
+ $options = $attr->getSource()->getAllOptions();
29
+ $res = array();
30
+ foreach ($options as $option) {
31
+ $res[$option['value']] = $option['label'];
32
+ }
33
+ unset($res['']);
34
+ return $res;
35
+ }
36
+
37
+ /**
38
+ * Gets catalog product EAV entity type id.
39
+ *
40
+ * @return string
41
+ */
42
+ protected function _getEntityTypeId()
43
+ {
44
+ $collection = Mage::getModel('eav/entity_type')->getCollection()
45
+ ->addFieldToFilter('entity_type_code', 'catalog_product');
46
+ $item = $collection->getFirstItem();
47
+ return $item->getId();
48
+ }
49
+ }
app/code/community/Quarticon/Quartic/Model/Catalog.php CHANGED
@@ -1,99 +1,99 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Catalog extends Mage_Core_Model_Abstract
4
- {
5
-
6
- protected $_options;
7
-
8
- /**
9
- * Return options for select field in configuration
10
- *
11
- * @param bool $isMultiselect
12
- * @return array
13
- */
14
- public function toOptionArray($isMultiselect = false)
15
- {
16
- if (!$this->_options) {
17
- $this->_options = $this->prepareOptionArray();
18
- }
19
-
20
- $options = $this->_options;
21
- if (!$isMultiselect) {
22
- array_unshift($options, array('value' => '-1', 'label' => Mage::helper('quartic')->__("--Create new--")));
23
- array_unshift($options, array('value' => '0', 'label' => Mage::helper('quartic')->__("--Don't sync--")));
24
- }
25
-
26
- return $options;
27
- }
28
-
29
- /**
30
- * Return collection for toOptionArray function
31
- *
32
- * @return array
33
- */
34
- protected function prepareOptionArray()
35
- {
36
- $storeCode = Mage::app()->getRequest()->getParam('store');
37
- $storeId = Mage::getModel('core/store')->load($storeCode, 'code')->getId();
38
- $cache = Mage::app()->getCacheInstance();
39
- $catalogs = $cache->load('quartic-catalogs-list-' . $storeId);
40
- if ($catalogs !== false) {
41
- return unserialize($catalogs);
42
- } else {
43
- return $this->apiLoad();
44
- }
45
- }
46
-
47
- /**
48
- * Label used in configuration form
49
- *
50
- * @return type
51
- */
52
- public function getLabel()
53
- {
54
- return "{$this->getParentName()} - {$this->getName()} ({$this->getDivId()})";
55
- }
56
-
57
- /**
58
- * Request placements from API
59
- *
60
- * @return array
61
- */
62
- public function apiLoad()
63
- {
64
- try {
65
- /* @var $api Quarticon_Quartic_Model_Client_Api */
66
- $api = Mage::getModel('quartic/client_api');
67
- $ret = $api->get('catalogs');
68
- } catch (Exception $e) {
69
- return array(
70
- 'status' => 'error',
71
- 'message' => $e->getMessage()
72
- );
73
- }
74
- return $this->apiLoaded($ret['body']['data']);
75
- }
76
-
77
- /**
78
- * Insert or update placements returned from API
79
- *
80
- * @param array $data Decoded from json
81
- * @return array Ids of placements: qon_id=>magento_id
82
- */
83
- protected function apiLoaded($data = array())
84
- {
85
- $storeCode = Mage::app()->getRequest()->getParam('store');
86
- $storeId = Mage::getModel('core/store')->load($storeCode, 'code')->getId();
87
- $cache = Mage::app()->getCacheInstance();
88
- $cache->save(serialize($data), 'quartic-catalogs-' . $storeId, array(), 30 * 24 * 3600);
89
- $list = array();
90
- foreach ($data as $catalog) {
91
- $list[] = array(
92
- 'value' => $catalog['id'],
93
- 'label' => $catalog['name'],
94
- );
95
- }
96
- $cache->save(serialize($list), 'quartic-catalogs-list-' . $storeId, array(), 30 * 24 * 3600);
97
- return $list;
98
- }
99
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Catalog extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ protected $_options;
7
+
8
+ /**
9
+ * Return options for select field in configuration
10
+ *
11
+ * @param bool $isMultiselect
12
+ * @return array
13
+ */
14
+ public function toOptionArray($isMultiselect = false)
15
+ {
16
+ if (!$this->_options) {
17
+ $this->_options = $this->prepareOptionArray();
18
+ }
19
+
20
+ $options = $this->_options;
21
+ if (!$isMultiselect) {
22
+ array_unshift($options, array('value' => '-1', 'label' => Mage::helper('quartic')->__("--Create new--")));
23
+ array_unshift($options, array('value' => '0', 'label' => Mage::helper('quartic')->__("--Don't sync--")));
24
+ }
25
+
26
+ return $options;
27
+ }
28
+
29
+ /**
30
+ * Return collection for toOptionArray function
31
+ *
32
+ * @return array
33
+ */
34
+ protected function prepareOptionArray()
35
+ {
36
+ $storeCode = Mage::app()->getRequest()->getParam('store');
37
+ $storeId = Mage::getModel('core/store')->load($storeCode, 'code')->getId();
38
+ $cache = Mage::app()->getCacheInstance();
39
+ $catalogs = $cache->load('quartic-catalogs-list-' . $storeId);
40
+ if ($catalogs !== false) {
41
+ return unserialize($catalogs);
42
+ } else {
43
+ return $this->apiLoad();
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Label used in configuration form
49
+ *
50
+ * @return type
51
+ */
52
+ public function getLabel()
53
+ {
54
+ return "{$this->getParentName()} - {$this->getName()} ({$this->getDivId()})";
55
+ }
56
+
57
+ /**
58
+ * Request placements from API
59
+ *
60
+ * @return array
61
+ */
62
+ public function apiLoad()
63
+ {
64
+ try {
65
+ /* @var $api Quarticon_Quartic_Model_Client_Api */
66
+ $api = Mage::getModel('quartic/client_api');
67
+ $ret = $api->get('catalogs');
68
+ } catch (Exception $e) {
69
+ return array(
70
+ 'status' => 'error',
71
+ 'message' => $e->getMessage()
72
+ );
73
+ }
74
+ return $this->apiLoaded($ret['body']['data']);
75
+ }
76
+
77
+ /**
78
+ * Insert or update placements returned from API
79
+ *
80
+ * @param array $data Decoded from json
81
+ * @return array Ids of placements: qon_id=>magento_id
82
+ */
83
+ protected function apiLoaded($data = array())
84
+ {
85
+ $storeCode = Mage::app()->getRequest()->getParam('store');
86
+ $storeId = Mage::getModel('core/store')->load($storeCode, 'code')->getId();
87
+ $cache = Mage::app()->getCacheInstance();
88
+ $cache->save(serialize($data), 'quartic-catalogs-' . $storeId, array(), 30 * 24 * 3600);
89
+ $list = array();
90
+ foreach ($data as $catalog) {
91
+ $list[] = array(
92
+ 'value' => $catalog['id'],
93
+ 'label' => $catalog['name'],
94
+ );
95
+ }
96
+ $cache->save(serialize($list), 'quartic-catalogs-list-' . $storeId, array(), 30 * 24 * 3600);
97
+ return $list;
98
+ }
99
+ }
app/code/community/Quarticon/Quartic/Model/Client/AbstractCurl.php CHANGED
@@ -1,101 +1,118 @@
1
- <?php
2
-
3
- abstract class Quarticon_Quartic_Model_Client_AbstractCurl
4
- {
5
-
6
- /**
7
- * @var Quarticon_Quartic_Model_Client_Resource_Curl
8
- */
9
- protected $_client;
10
-
11
- /**
12
- * @var string
13
- */
14
- protected $_token;
15
-
16
- /**
17
- * @var array
18
- */
19
- protected static $_counter = array();
20
-
21
- /**
22
- * @return Quarticon_Quartic_Model_Client_Resource_Curl
23
- */
24
- public function getClient()
25
- {
26
- if (!$this->_client) {
27
- $this->_client = Mage::getModel('quartic/client_resource_curl');
28
- }
29
- return $this->_client;
30
- }
31
-
32
- /**
33
- *
34
- * @param string $resource
35
- * @return array
36
- */
37
- public function get($resource)
38
- {
39
- return $this->getClient()->get($resource);
40
- }
41
-
42
- /**
43
- *
44
- * @param string $resource
45
- * @param array $params
46
- * @return array
47
- */
48
- public function post($resource, $params = array())
49
- {
50
- return $this->getClient()->post($resource, $params);
51
- }
52
-
53
- /**
54
- *
55
- * @return string
56
- */
57
- protected function getToken()
58
- {
59
- $storeCode = Mage::app()->getRequest()->getParam('store');
60
- $storeId = Mage::getModel('core/store')->load($storeCode, 'code')->getId();
61
- if (is_null($this->_token)) {
62
- $temp = Mage::getSingleton('core/session')->getQuarticApiToken();
63
- $this->_token = isset($temp[$storeId]) ? $temp[$storeId] : null;
64
- }
65
- if (!is_null($this->_token)) {
66
- $temp2 = Mage::getSingleton('core/session')->getQuarticApiTokenExpires();
67
- $end = $temp2[$storeId];
68
- if ($end < Mage::getModel('core/date')->timestamp()) {
69
- return null;
70
- }
71
- }
72
- return $this->_token;
73
- }
74
-
75
- /**
76
- * Request new token if session have expired
77
- *
78
- * @return string
79
- * @throws \Exception
80
- */
81
- protected function setToken($value, $end, $storeId)
82
- {
83
- $this->_token = $value;
84
-
85
- $token = Mage::getSingleton('core/session')->getQuarticApiToken();
86
- $token[$storeId] = $value;
87
- Mage::getSingleton('core/session')->setQuarticApiToken($token);
88
-
89
- $tokenExp = Mage::getSingleton('core/session')->setQuarticApiTokenExpires();
90
- $tokenExp[$storeId] = $end;
91
- Mage::getSingleton('core/session')->setQuarticApiTokenExpires($token);
92
- }
93
-
94
- /**
95
- *
96
- */
97
- protected function requestToken()
98
- {
99
- return null;
100
- }
101
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Quarticon_Quartic_Model_Client_AbstractCurl
4
+ {
5
+
6
+ /**
7
+ * @var Quarticon_Quartic_Model_Client_Resource_Curl
8
+ */
9
+ protected $_client;
10
+
11
+ /**
12
+ * @var string
13
+ */
14
+ protected $_token;
15
+
16
+ /**
17
+ * Helper
18
+ * @var Quarticon_Quartic_Helper_Data
19
+ */
20
+ protected $helper = null;
21
+
22
+ /**
23
+ * @var array
24
+ */
25
+ protected static $_counter = array();
26
+
27
+ /**
28
+ * Get helper object
29
+ * @return Quarticon_Quartic_Helper_Data
30
+ */
31
+ protected function getHelper() {
32
+ if ($this->helper == null) {
33
+ $this->helper = Mage::helper('quartic');
34
+ }
35
+ return $this->helper;
36
+ }
37
+
38
+ /**
39
+ * @return Quarticon_Quartic_Model_Client_Resource_Curl
40
+ */
41
+ public function getClient()
42
+ {
43
+ if (!$this->_client) {
44
+ $this->_client = Mage::getModel('quartic/client_resource_curl');
45
+ }
46
+ return $this->_client;
47
+ }
48
+
49
+ /**
50
+ *
51
+ * @param string $resource
52
+ * @return array
53
+ */
54
+ public function get($resource)
55
+ {
56
+ return $this->getClient()->get($resource);
57
+ }
58
+
59
+ /**
60
+ *
61
+ * @param string $resource
62
+ * @param array $params
63
+ * @return array
64
+ */
65
+ public function post($resource, $params = array())
66
+ {
67
+ return $this->getClient()->post($resource, $params);
68
+ }
69
+
70
+ /**
71
+ *
72
+ * @return string
73
+ */
74
+ protected function getToken()
75
+ {
76
+ $storeId = $this->getHelper()->getStoreId();
77
+
78
+ if (is_null($this->_token)) {
79
+ $temp = Mage::getSingleton('core/session')->getQuarticApiToken();
80
+ $this->_token = isset($temp[$storeId]) ? $temp[$storeId] : null;
81
+ }
82
+ if (!is_null($this->_token)) {
83
+ $temp2 = Mage::getSingleton('core/session')->getQuarticApiTokenExpires();
84
+ $end = $temp2[$storeId];
85
+ if ($end < Mage::getModel('core/date')->timestamp()) {
86
+ return null;
87
+ }
88
+ }
89
+ return $this->_token;
90
+ }
91
+
92
+ /**
93
+ * Request new token if session have expired
94
+ *
95
+ * @return string
96
+ * @throws \Exception
97
+ */
98
+ protected function setToken($value, $end, $storeId)
99
+ {
100
+ $this->_token = $value;
101
+
102
+ $token = Mage::getSingleton('core/session')->getQuarticApiToken();
103
+ $token[$storeId] = $value;
104
+ Mage::getSingleton('core/session')->setQuarticApiToken($token);
105
+
106
+ $tokenExp = Mage::getSingleton('core/session')->setQuarticApiTokenExpires();
107
+ $tokenExp[$storeId] = $end;
108
+ Mage::getSingleton('core/session')->setQuarticApiTokenExpires($tokenExp);
109
+ }
110
+
111
+ /**
112
+ *
113
+ */
114
+ protected function requestToken()
115
+ {
116
+ return null;
117
+ }
118
+ }
app/code/community/Quarticon/Quartic/Model/Client/Api.php CHANGED
@@ -1,157 +1,176 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Client_Api extends Quarticon_Quartic_Model_Client_AbstractCurl
4
- {
5
-
6
- protected $_user_symbol;
7
- protected $_user_key;
8
-
9
- /**
10
- * GET resource from API
11
- *
12
- * @param string $resource
13
- * @return array
14
- */
15
- public function get($resource,$storeId = false)
16
- {
17
- $token = $this->getToken();
18
- if (empty($token)) {
19
- $token = $this->requestToken($storeId);
20
- }
21
- $ret = $this->getClient()->get($resource . '?token=' . $token);
22
- if (empty($ret)) {
23
- throw new Exception('Quartic Api returned empty result.');
24
- }
25
- if (!isset($ret['body']['status']) || strtolower($ret['body']['status']) != 'ok') {
26
- Mage::log(var_export($ret, true), null, 'quartic.log');
27
- if (isset($ret['body']['data']['error_code'])) {
28
- throw new Exception('Quartic Api returned error: ' . $ret['body']['data']['error_message']);
29
- } else {
30
- throw new Exception('Quartic Api returned error: ' . print_r($ret['body'], true));
31
- }
32
- }
33
- return $ret;
34
- }
35
-
36
- /**
37
- * POST new resource into API
38
- *
39
- * @param string $resource
40
- * @param string $id
41
- * @param mixed $data
42
- * @return array
43
- */
44
- public function post($resource, $data = array())
45
- {
46
- $token = $this->getToken();
47
- if (empty($token)) {
48
- $token = $this->requestToken();
49
- }
50
- $data['token'] = $token;
51
- $ret = $this->getClient()->post("{$resource}", $data);
52
- //$ret = $this->getClient()->post("{$resource}?token=" . $token, $data);
53
- if (empty($ret)) {
54
- throw new Exception('Quartic Api returned empty result.');
55
- }
56
- if (!isset($ret['body']['status']) || strtolower($ret['body']['status']) != 'ok') {
57
- Mage::log(var_export("{$resource}", true), null, 'quartic.log');
58
- Mage::log(var_export($data, true), null, 'quartic.log');
59
- Mage::log(var_export($ret, true), null, 'quartic.log');
60
- if (isset($ret['body']['data']['error_code'])) {
61
- throw new Exception('Quartic Api returned error: ' . $ret['body']['data']['error_message']);
62
- } else {
63
- throw new Exception('Quartic Api returned error: ' . print_r($ret['body'], true));
64
- }
65
- }
66
- return $ret;
67
- }
68
-
69
- /**
70
- * PUT updated resource into API
71
- *
72
- * @param string $resource
73
- * @param string $id
74
- * @param mixed $data
75
- * @return array
76
- */
77
- public function put($resource, $id, $data = array())
78
- {
79
- $token = $this->getToken();
80
- if (empty($token)) {
81
- $token = $this->requestToken();
82
- }
83
- $data['token'] = $token;
84
- $ret = $this->getClient()->put("{$resource}/{$id}", $data);
85
- //$ret = $this->getClient()->put("{$resource}/{$id}?token=" . $token, $data);
86
- if (empty($ret)) {
87
- throw new Exception('Quartic Api returned empty result.');
88
- }
89
- if (!isset($ret['body']['status']) || strtolower($ret['body']['status']) != 'ok') {
90
- Mage::log(var_export("{$resource}/{$id}", true), null, 'quartic.log');
91
- Mage::log(var_export($data, true), null, 'quartic.log');
92
- Mage::log(var_export($ret, true), null, 'quartic.log');
93
- if (isset($ret['body']['data']['error_code'])) {
94
- throw new Exception('Quartic Api returned error: ' . $ret['body']['data']['error_message']);
95
- } else {
96
- throw new Exception('Quartic Api returned error: ' . print_r($ret['body'], true));
97
- }
98
- }
99
- return $ret;
100
- }
101
-
102
- /**
103
- * Request new token if session have expired
104
- *
105
- * @return string
106
- * @throws \Exception
107
- */
108
- public function requestToken($storeId = false)
109
- {
110
- // TODO: przenieść pobieranie storeId do helpera
111
- $params = Mage::app()->getRequest()->getParams();
112
- if(isset($params['store'])) {
113
- $storeId = (is_numeric($params['store'])) ? (int)$params['store'] : Mage::getModel('core/store')->load($params['store'], 'code')->getId();
114
- } elseif(isset($params['website'])) {
115
- $website = (is_numeric($params['website'])) ? Mage::getModel('core/website')->load($params['website']) : Mage::getModel('core/website')->load($params['website'], 'code');
116
- $storeId = $website->getDefaultGroup()->getDefaultStoreId();
117
- } else {
118
- $storeId = Mage::app()->getStore()->getId();
119
- }
120
- if($storeId == 0) $storeId = Mage::app()->getDefaultStoreView()->getStoreId();
121
-
122
-
123
- $symbol = Mage::getStoreConfig("quartic/config/customer", $storeId);
124
- $key = Mage::getStoreConfig("quartic/config/api_key", $storeId);
125
-
126
- $ret = $this->getClient()
127
- ->post('login', array(
128
- 'symbol' => $symbol,
129
- 'key' => $key,
130
- ));
131
- if (isset($ret['body']['data']['token'])) {
132
- /**
133
- * TODO: wymyśl coś z datą, którą dostajemy z api
134
- */
135
- //$end = Mage::getModel('core/date')->timestamp($ret['body']['data']['end_date']);
136
- $end = Mage::getModel('core/date')->timestamp('+5 minutes');
137
- $this->setToken($ret['body']['data']['token'], $end, $storeId);
138
- return $ret['body']['data']['token'];
139
- } else {
140
- throw new \Exception('Could not get token.');
141
- }
142
- }
143
-
144
- /**
145
- * Remove token to force re-login on ext request
146
- */
147
- public function dropToken($storeId)
148
- {
149
- $end = Mage::getModel('core/date')->timestamp('-1 year');
150
- $this->setToken(null, $end,$storeId);
151
- }
152
-
153
- public function catalogType()
154
- {
155
- return 4;
156
- }
157
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Client_Api extends Quarticon_Quartic_Model_Client_AbstractCurl
4
+ {
5
+
6
+ protected $_user_symbol;
7
+ protected $_user_key;
8
+
9
+ /**
10
+ * GET resource from API
11
+ *
12
+ * @param string $resource
13
+ * @return array
14
+ */
15
+ public function get($resource, $storeId = false)
16
+ {
17
+ $token = $this->getToken();
18
+ if (empty($token)) {
19
+ $token = $this->requestToken($storeId);
20
+ }
21
+ $ret = $this->getClient()->get($resource . '?token=' . $token);
22
+ if (empty($ret)) {
23
+ throw new Exception('Quartic Api returned empty result.');
24
+ }
25
+ if (!isset($ret['body']['status']) || strtolower($ret['body']['status']) != 'ok') {
26
+ $this->getHelper()->log(var_export($ret, true));
27
+ if (isset($ret['body']['data']['error_code'])) {
28
+ throw new Exception('Quartic Api returned error: ' . $ret['body']['data']['error_message']);
29
+ } else {
30
+ throw new Exception('Quartic Api returned error: ' . print_r($ret['body'], true));
31
+ }
32
+ }
33
+ return $ret;
34
+ }
35
+
36
+ /**
37
+ * POST new resource into API
38
+ *
39
+ * @param string $resource
40
+ * @param string $id
41
+ * @param mixed $data
42
+ * @return array
43
+ */
44
+ public function post($resource, $data = array())
45
+ {
46
+ $token = $this->getToken();
47
+ if (empty($token)) {
48
+ $token = $this->requestToken();
49
+ }
50
+ $data['token'] = $token;
51
+ $ret = $this->getClient()->post("{$resource}", $data);
52
+ //$ret = $this->getClient()->post("{$resource}?token=" . $token, $data);
53
+ if (empty($ret)) {
54
+ throw new Exception('Quartic Api returned empty result.');
55
+ }
56
+ if (!isset($ret['body']['status']) || strtolower($ret['body']['status']) != 'ok') {
57
+ $this->getHelper()->log(var_export("{$resource}", true));
58
+ $this->getHelper()->log(var_export($data, true));
59
+ $this->getHelper()->log(var_export($ret, true));
60
+ if (isset($ret['body']['data']['error_code'])) {
61
+ throw new Exception('Quartic Api returned error: ' . $ret['body']['data']['error_message']);
62
+ } else {
63
+ throw new Exception('Quartic Api returned error: ' . print_r($ret['body'], true));
64
+ }
65
+ }
66
+ return $ret;
67
+ }
68
+
69
+ /**
70
+ * PUT updated resource into API
71
+ *
72
+ * @param string $resource
73
+ * @param string $id
74
+ * @param mixed $data
75
+ * @return array
76
+ */
77
+ public function put($resource, $id, $data = array())
78
+ {
79
+ $token = $this->getToken();
80
+ if (empty($token)) {
81
+ $token = $this->requestToken();
82
+ }
83
+ $data['token'] = $token;
84
+ $ret = $this->getClient()->put("{$resource}/{$id}", $data);
85
+ //$ret = $this->getClient()->put("{$resource}/{$id}?token=" . $token, $data);
86
+ if (empty($ret)) {
87
+ throw new Exception('Quartic Api returned empty result.');
88
+ }
89
+ if (!isset($ret['body']['status']) || strtolower($ret['body']['status']) != 'ok') {
90
+ $this->getHelper()->log(var_export("{$resource}/{$id}", true));
91
+ $this->getHelper()->log(var_export($data, true));
92
+ $this->getHelper()->log(var_export($ret, true));
93
+ if (isset($ret['body']['data']['error_code'])) {
94
+ throw new Exception('Quartic Api returned error: ' . $ret['body']['data']['error_message']);
95
+ } else {
96
+ throw new Exception('Quartic Api returned error: ' . print_r($ret['body'], true));
97
+ }
98
+ }
99
+ return $ret;
100
+ }
101
+
102
+ /**
103
+ * Request new token if session have expired
104
+ *
105
+ * @return string
106
+ * @throws \Exception
107
+ */
108
+ public function requestToken($storeId = false)
109
+ {
110
+ if ($storeId === false) {
111
+ $storeId = $this->getHelper()->getStoreId();
112
+ }
113
+
114
+ $symbol = Mage::getStoreConfig("quartic/config/customer", $storeId);
115
+ $key = Mage::getStoreConfig("quartic/config/api_key", $storeId);
116
+
117
+ $data = array(
118
+ 'symbol' => $symbol,
119
+ 'key' => $key,
120
+ );
121
+ $this->getHelper()->log('Login data: '.var_export($data, true));
122
+ $ret = $this->getClient()
123
+ ->post('login', $data);
124
+ if (isset($ret['body']['data']['token'])) {
125
+ /**
126
+ * TODO: wymyśl coś z datą, którą dostajemy z api
127
+ */
128
+ //$end = Mage::getModel('core/date')->timestamp($ret['body']['data']['end_date']);
129
+ $end = Mage::getModel('core/date')->timestamp('+5 minutes');
130
+ $this->setToken($ret['body']['data']['token'], $end, $storeId);
131
+ return $ret['body']['data']['token'];
132
+ } else {
133
+ throw new \Exception('Could not get token.');
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Remove token to force re-login on ext request
139
+ */
140
+ public function dropToken($storeId)
141
+ {
142
+ $end = Mage::getModel('core/date')->timestamp('-1 year');
143
+ $this->setToken(null, $end, $storeId);
144
+ }
145
+
146
+ /**
147
+ * Get catalog type
148
+ * @param string $name catalog type name
149
+ * @return int
150
+ */
151
+ public function catalogType($name = null)
152
+ {
153
+ $defaultId = 4;
154
+ if ($name == null) {
155
+ // default quartic xml - backward compatibility
156
+ return $defaultId;
157
+ }
158
+
159
+ try {
160
+ $result = $this->get('catalogTypes');
161
+ } catch (Exception $e) {
162
+ return array(
163
+ 'status' => 'error',
164
+ 'message' => $e->getMessage()
165
+ );
166
+ }
167
+
168
+ $types = $result['body']['data'];
169
+ foreach ($types as $type) {
170
+ if ($type['name'] == $name) {
171
+ return $type['id'];
172
+ }
173
+ }
174
+ return $defaultId;
175
+ }
176
+ }
app/code/community/Quarticon/Quartic/Model/Client/Resource/Curl.php CHANGED
@@ -1,206 +1,210 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Client_Resource_Curl extends Mage_HTTP_Client_Curl
4
- {
5
-
6
- const CURL_API_URL = 'http://api.quarticon.com/api/v1/';
7
- const CURL_API_INPUT = 'application/json';
8
- const CURL_API_OUTPUT = 'json';
9
-
10
- /**
11
- * Make GET request
12
- *
13
- * @param string $uri uri relative to host, ex. "/index.php"
14
- */
15
- public function get($uri)
16
- {
17
- $this->makeRequest("GET", $uri);
18
- return $this->returnResponse();
19
- }
20
-
21
- /**
22
- * Make POST request
23
- * @see lib/Mage/HTTP/Mage_HTTP_Client#post($uri, $params)
24
- */
25
- public function post($uri, $params)
26
- {
27
- $this->makeRequest("POST", $uri, $params);
28
- return $this->returnResponse();
29
- }
30
-
31
- /**
32
- * Make POST request
33
- * @see lib/Mage/HTTP/Mage_HTTP_Client#post($uri, $params)
34
- */
35
- public function put($uri, $params)
36
- {
37
- $this->makeRequest("PUT", $uri, $params);
38
- return $this->returnResponse();
39
- }
40
-
41
- /**
42
- *
43
- * @return array
44
- */
45
- protected function returnResponse()
46
- {
47
- $ret = array(
48
- 'status' => $this->getStatus(),
49
- 'headers' => $this->getHeaders(),
50
- );
51
-
52
- if (isset($ret['headers']['Content-Type'])) {
53
- $sep = strpos($ret['headers']['Content-Type'], ';');
54
- if ($sep !== false) {
55
- $contentType = trim(substr($ret['headers']['Content-Type'], 0, $sep));
56
- } else {
57
- $contentType = trim($ret['headers']['Content-Type']);
58
- }
59
- } else {
60
- $contentType = self::CURL_API_OUTPUT;
61
- }
62
- $ret['type'] = $contentType;
63
-
64
- $response = $this->getBody();
65
-
66
- if ($contentType == 'application/json') {
67
- $ret['body'] = json_decode($response, true);
68
- } else {
69
- $ret['body'] = $response;
70
- }
71
- return $ret;
72
- }
73
-
74
- /**
75
- * Make request
76
- * Rewrite parent, for "PUT" requests
77
- *
78
- * @param string $method
79
- * @param string $uri
80
- * @param array $params
81
- * @return null
82
- */
83
- protected function makeRequest($method, $uri, $params = array())
84
- {
85
- $uri = self::CURL_API_URL . $uri;
86
- Mage::log($method . ' ' . $uri, null, 'quartic.log');
87
- $this->_ch = curl_init();
88
- $this->curlOption(CURLOPT_URL, $uri);
89
- $postfields = null;
90
- $postfile = null;
91
- if ($method == 'POST') {
92
- $this->curlOption(CURLOPT_POST, 1);
93
- //$postfields = http_build_query($params);
94
- $postfields = json_encode($params);
95
- $this->_headers['Content-Type'] = 'application/json';
96
- } elseif ($method == 'PUT') {
97
- $this->curlOption(CURLOPT_PUT, 1);
98
- $postfile = json_encode($params);
99
- $this->_headers['Content-Type'] = 'application/json';
100
- } elseif ($method == "GET") {
101
- $this->curlOption(CURLOPT_HTTPGET, 1);
102
- } else {
103
- $this->curlOption(CURLOPT_CUSTOMREQUEST, $method);
104
- }
105
- if (!is_null($postfields)) {
106
- $this->curlOption(CURLOPT_POSTFIELDS, $postfields);
107
- }
108
- if (!is_null($postfile)) {
109
- $fp = fopen('php://temp/maxmemory:256000', 'w');
110
-
111
- if (!$fp) {
112
- throw new \Exception('Could not open temp memory data');
113
- }
114
-
115
- fwrite($fp, $postfile);
116
- fseek($fp, 0);
117
-
118
- $this->curlOption(CURLOPT_BINARYTRANSFER, true);
119
- $this->curlOption(CURLOPT_INFILE, $fp); // file pointer
120
- $this->curlOption(CURLOPT_INFILESIZE, strlen($postfile));
121
- }
122
-
123
- //var_dump($this->_headers);
124
- if (count($this->_headers)) {
125
- $heads = array();
126
- foreach ($this->_headers as $k => $v) {
127
- $heads[] = $k . ': ' . $v;
128
- }
129
- $this->curlOption(CURLOPT_HTTPHEADER, $heads);
130
- }
131
-
132
- if (count($this->_cookies)) {
133
- $cookies = array();
134
- foreach ($this->_cookies as $k => $v) {
135
- $cookies[] = "$k=$v";
136
- }
137
- $this->curlOption(CURLOPT_COOKIE, implode(";", $cookies));
138
- }
139
-
140
- if ($this->_timeout) {
141
- $this->curlOption(CURLOPT_TIMEOUT, $this->_timeout);
142
- }
143
-
144
- if ($this->_port != 80) {
145
- $this->curlOption(CURLOPT_PORT, $this->_port);
146
- }
147
-
148
- $this->curlOption(CURLINFO_HEADER_OUT, 1);
149
-
150
- //$this->curlOption(CURLOPT_HEADER, 1);
151
- $this->curlOption(CURLOPT_RETURNTRANSFER, 1);
152
- $this->curlOption(CURLOPT_HEADERFUNCTION, array($this, 'parseHeaders'));
153
-
154
-
155
- if (count($this->_curlUserOptions)) {
156
- foreach ($this->_curlUserOptions as $k => $v) {
157
- $this->curlOption($k, $v);
158
- }
159
- }
160
-
161
- $this->_headerCount = 0;
162
- $this->_responseHeaders = array();
163
- $this->_responseBody = curl_exec($this->_ch);
164
- $err = curl_errno($this->_ch);
165
- if ($err) {
166
- $this->doError(curl_error($this->_ch));
167
- }
168
- //var_dump($postfields);
169
- //var_dump(curl_getinfo($this->_ch));
170
- curl_close($this->_ch);
171
- }
172
-
173
- /**
174
- * Set headers from hash
175
-
176
- * @param array $headers
177
- */
178
- public function setHeaders($headers)
179
- {
180
- parent::setHeaders($headers);
181
- return $this;
182
- }
183
-
184
- /**
185
- * Add header
186
- *
187
- * @param $name name, ex. "Location"
188
- * @param $value value ex. "http://google.com"
189
- */
190
- public function addHeader($name, $value)
191
- {
192
- parent::addHeader($name, $value);
193
- return $this;
194
- }
195
-
196
- /**
197
- * Remove specified header
198
- *
199
- * @param string $name
200
- */
201
- public function removeHeader($name)
202
- {
203
- parent::removeHeader($name);
204
- return $this;
205
- }
206
- }
 
 
 
 
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Client_Resource_Curl extends Mage_HTTP_Client_Curl
4
+ {
5
+
6
+ const CURL_API_URL = 'https://api.quarticon.com/api/v1/';
7
+ const CURL_API_INPUT = 'application/json';
8
+ const CURL_API_OUTPUT = 'json';
9
+
10
+ /**
11
+ * Make GET request
12
+ *
13
+ * @param string $uri uri relative to host, ex. "/index.php"
14
+ */
15
+ public function get($uri, $params=array(), $url = null)
16
+ {
17
+ $this->makeRequest("GET", $uri, $params, $url);
18
+ return $this->returnResponse();
19
+ }
20
+
21
+ /**
22
+ * Make POST request
23
+ * @see lib/Mage/HTTP/Mage_HTTP_Client#post($uri, $params)
24
+ */
25
+ public function post($uri, $params, $url = null)
26
+ {
27
+ $this->makeRequest("POST", $uri, $params, $url);
28
+ return $this->returnResponse();
29
+ }
30
+
31
+ /**
32
+ * Make POST request
33
+ * @see lib/Mage/HTTP/Mage_HTTP_Client#post($uri, $params)
34
+ */
35
+ public function put($uri, $params)
36
+ {
37
+ $this->makeRequest("PUT", $uri, $params);
38
+ return $this->returnResponse();
39
+ }
40
+
41
+ /**
42
+ *
43
+ * @return array
44
+ */
45
+ protected function returnResponse()
46
+ {
47
+ $ret = array(
48
+ 'status' => $this->getStatus(),
49
+ 'headers' => $this->getHeaders(),
50
+ );
51
+
52
+ if (isset($ret['headers']['Content-Type'])) {
53
+ $sep = strpos($ret['headers']['Content-Type'], ';');
54
+ if ($sep !== false) {
55
+ $contentType = trim(substr($ret['headers']['Content-Type'], 0, $sep));
56
+ } else {
57
+ $contentType = trim($ret['headers']['Content-Type']);
58
+ }
59
+ } else {
60
+ $contentType = self::CURL_API_OUTPUT;
61
+ }
62
+ $ret['type'] = $contentType;
63
+
64
+ $response = $this->getBody();
65
+
66
+ if ($contentType == 'application/json') {
67
+ $ret['body'] = json_decode($response, true);
68
+ } else {
69
+ $ret['body'] = $response;
70
+ }
71
+ return $ret;
72
+ }
73
+
74
+ /**
75
+ * Make request
76
+ * Rewrite parent, for "PUT" requests
77
+ *
78
+ * @param string $method
79
+ * @param string $uri
80
+ * @param array $params
81
+ * @param string $url (optional) base url
82
+ * @return null
83
+ */
84
+ protected function makeRequest($method, $uri, $params = array(), $url = null)
85
+ {
86
+ if (!$url) {
87
+ $url = self::CURL_API_URL;
88
+ }
89
+ $uri = $url . $uri;
90
+ Mage::log($method . ' ' . $uri, null, 'quartic.log');
91
+ $this->_ch = curl_init();
92
+ $this->curlOption(CURLOPT_URL, $uri);
93
+ $postfields = null;
94
+ $postfile = null;
95
+ if ($method == 'POST') {
96
+ $this->curlOption(CURLOPT_POST, 1);
97
+ //$postfields = http_build_query($params);
98
+ $postfields = json_encode($params);
99
+ $this->_headers['Content-Type'] = 'application/json';
100
+ } elseif ($method == 'PUT') {
101
+ $this->curlOption(CURLOPT_PUT, 1);
102
+ $postfile = json_encode($params);
103
+ $this->_headers['Content-Type'] = 'application/json';
104
+ } elseif ($method == "GET") {
105
+ $this->curlOption(CURLOPT_HTTPGET, 1);
106
+ } else {
107
+ $this->curlOption(CURLOPT_CUSTOMREQUEST, $method);
108
+ }
109
+ if (!is_null($postfields)) {
110
+ $this->curlOption(CURLOPT_POSTFIELDS, $postfields);
111
+ }
112
+ if (!is_null($postfile)) {
113
+ $fp = fopen('php://temp/maxmemory:256000', 'w');
114
+
115
+ if (!$fp) {
116
+ throw new \Exception('Could not open temp memory data');
117
+ }
118
+
119
+ fwrite($fp, $postfile);
120
+ fseek($fp, 0);
121
+
122
+ $this->curlOption(CURLOPT_BINARYTRANSFER, true);
123
+ $this->curlOption(CURLOPT_INFILE, $fp); // file pointer
124
+ $this->curlOption(CURLOPT_INFILESIZE, strlen($postfile));
125
+ }
126
+
127
+ //var_dump($this->_headers);
128
+ if (count($this->_headers)) {
129
+ $heads = array();
130
+ foreach ($this->_headers as $k => $v) {
131
+ $heads[] = $k . ': ' . $v;
132
+ }
133
+ $this->curlOption(CURLOPT_HTTPHEADER, $heads);
134
+ }
135
+
136
+ if (count($this->_cookies)) {
137
+ $cookies = array();
138
+ foreach ($this->_cookies as $k => $v) {
139
+ $cookies[] = "$k=$v";
140
+ }
141
+ $this->curlOption(CURLOPT_COOKIE, implode(";", $cookies));
142
+ }
143
+
144
+ if ($this->_timeout) {
145
+ $this->curlOption(CURLOPT_TIMEOUT, $this->_timeout);
146
+ }
147
+
148
+ if ($this->_port != 80) {
149
+ $this->curlOption(CURLOPT_PORT, $this->_port);
150
+ }
151
+
152
+ $this->curlOption(CURLINFO_HEADER_OUT, 1);
153
+
154
+ //$this->curlOption(CURLOPT_HEADER, 1);
155
+ $this->curlOption(CURLOPT_RETURNTRANSFER, 1);
156
+ $this->curlOption(CURLOPT_HEADERFUNCTION, array($this, 'parseHeaders'));
157
+
158
+
159
+ if (count($this->_curlUserOptions)) {
160
+ foreach ($this->_curlUserOptions as $k => $v) {
161
+ $this->curlOption($k, $v);
162
+ }
163
+ }
164
+
165
+ $this->_headerCount = 0;
166
+ $this->_responseHeaders = array();
167
+ $this->_responseBody = curl_exec($this->_ch);
168
+ $err = curl_errno($this->_ch);
169
+ if ($err) {
170
+ $this->doError(curl_error($this->_ch));
171
+ }
172
+ //var_dump($postfields);
173
+ //var_dump(curl_getinfo($this->_ch));
174
+ curl_close($this->_ch);
175
+ }
176
+
177
+ /**
178
+ * Set headers from hash
179
+
180
+ * @param array $headers
181
+ */
182
+ public function setHeaders($headers)
183
+ {
184
+ parent::setHeaders($headers);
185
+ return $this;
186
+ }
187
+
188
+ /**
189
+ * Add header
190
+ *
191
+ * @param $name name, ex. "Location"
192
+ * @param $value value ex. "http://google.com"
193
+ */
194
+ public function addHeader($name, $value)
195
+ {
196
+ parent::addHeader($name, $value);
197
+ return $this;
198
+ }
199
+
200
+ /**
201
+ * Remove specified header
202
+ *
203
+ * @param string $name
204
+ */
205
+ public function removeHeader($name)
206
+ {
207
+ parent::removeHeader($name);
208
+ return $this;
209
+ }
210
+ }
app/code/community/Quarticon/Quartic/Model/Config.php CHANGED
@@ -1,128 +1,177 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Config extends Mage_Core_Model_Config
4
- {
5
-
6
- public function getSession()
7
- {
8
- return Mage::getSingleton('customer/session');
9
- }
10
-
11
- public function saveHash($area = 'default',$id = 0)
12
- {
13
- $hash = md5(microtime());
14
- Mage::getModel('core/config')->saveConfig('quartic/config/hash', $hash, $area, $id);
15
- }
16
-
17
- public function getHash($store_id = null)
18
- {
19
- return Mage::getStoreConfig('quartic/config/hash', $store_id);
20
- }
21
-
22
- public function isDebug($store_id = null)
23
- {
24
- return (bool) Mage::getStoreConfig('quartic/config/debug', $store_id);
25
- }
26
-
27
- public function isActive($store_id = null)
28
- {
29
- return (bool) Mage::getStoreConfig('quartic/config/active', $store_id);
30
- }
31
-
32
- public function isFrameEnabled($frame, $store_id = null)
33
- {
34
- $frame = Mage::getStoreConfig('quartic/frames/' . $frame, $store_id);
35
- return !empty($frame);
36
- }
37
-
38
- public function getFrameId($frame, $store_id = null)
39
- {
40
- return (string) Mage::getStoreConfig('quartic/frames/' . $frame, $store_id);
41
- }
42
-
43
- public function getCustomer($store_id = null)
44
- {
45
- return Mage::getStoreConfig('quartic/config/customer', $store_id);
46
- }
47
-
48
- public function isUsingSkuEnabled($store_id = null)
49
- {
50
- return (bool) Mage::getStoreConfig('quartic/config/use_sku', $store_id);
51
- }
52
-
53
- public function showOnlyInStock($store_id = null)
54
- {
55
- return (bool) Mage::getStoreConfig('quartic/config/only_in_stock', $store_id);
56
- }
57
-
58
- public function addThumbs($store_id = null)
59
- {
60
- return (bool) Mage::getStoreConfig('quartic/config/add_thumbs', $store_id);
61
- }
62
-
63
- public function showDisabledProducts($store_id = null)
64
- {
65
- return (bool) Mage::getStoreConfig('quartic/config/show_disabled_products', $store_id);
66
- }
67
-
68
- public function shouldUseProductFrameInCategory($store_id = null)
69
- {
70
- return (bool) Mage::getStoreConfig('quartic/frames/category_use_product_frame', $store_id);
71
- }
72
-
73
- /**
74
- * Gets minimum quantity for which a product status should be set to 1 in XML feed.
75
- *
76
- * @param int $store_id
77
- * @return int
78
- */
79
- public function getMinQty($store_id = null)
80
- {
81
- return (int) Mage::getStoreConfig('quartic/config/min_qty', $store_id);
82
- }
83
-
84
- public function getVisibility($store_id = null)
85
- {
86
- return explode(',',Mage::getStoreConfig('quartic/config/visibility', $store_id));
87
- }
88
-
89
- public function getConfigurablePrice($store_id = null)
90
- {
91
- return (int) Mage::getStoreConfig('quartic/composite/configurable_price', $store_id);
92
- }
93
-
94
- public function getShowConfigurableChilds($store_id = null)
95
- {
96
- return (int) Mage::getStoreConfig('quartic/composite/configurable_childs', $store_id);
97
- }
98
-
99
- public function getConfigurableChildImage($store_id = null)
100
- {
101
- return (int) Mage::getStoreConfig('quartic/composite/configurable_child_image', $store_id);
102
- }
103
-
104
- public function getConfigurableChildPrice($store_id = null)
105
- {
106
- return (int) Mage::getStoreConfig('quartic/composite/configurable_child_price', $store_id);
107
- }
108
-
109
- public function getConfigurableChildRedirect($store_id = null)
110
- {
111
- return (int) Mage::getStoreConfig('quartic/composite/configurable_child_redirect', $store_id);
112
- }
113
-
114
- public function getGroupedChildImage($store_id = null)
115
- {
116
- return (int) Mage::getStoreConfig('quartic/composite/grouped_child_image', $store_id);
117
- }
118
-
119
- public function getGroupedChildPrice($store_id = null)
120
- {
121
- return (int) Mage::getStoreConfig('quartic/composite/grouped_child_price', $store_id);
122
- }
123
-
124
- public function getGroupedChildRedirect($store_id = null)
125
- {
126
- return (int) Mage::getStoreConfig('quartic/composite/grouped_child_redirect', $store_id);
127
- }
128
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Config extends Mage_Core_Model_Config
4
+ {
5
+
6
+ public function getSession()
7
+ {
8
+ return Mage::getSingleton('customer/session');
9
+ }
10
+
11
+ /**
12
+ * Generate store name identifier
13
+ * @return string
14
+ * @throws Exception
15
+ */
16
+ public function savePluginStoreName() {
17
+ if ($name = Mage::getStoreConfig('quartic/config/storeName')) {
18
+ return $name;
19
+ }
20
+
21
+ $name = md5(Mage::getStoreConfig('web/secure/base_url').Mage::getStoreConfig('general/store_information/email_address').time());
22
+ Mage::helper('quartic')->setStoreConfig('quartic/config/storeName', $name);
23
+ return $name;
24
+ }
25
+
26
+ /**
27
+ * Returns store name generated by quartic plugin
28
+ * @param int $store_id
29
+ * @return mixed
30
+ */
31
+ public function getStoreName($store_id = null) {
32
+ return Mage::getStoreConfig('quartic/config/storeName', $store_id);
33
+ }
34
+
35
+ /**
36
+ * Generate secret key
37
+ * @return string
38
+ * @throws Exception
39
+ */
40
+ public function saveSecret()
41
+ {
42
+ if ($secret = Mage::getStoreConfig('quartic/config/secret')) {
43
+ return $secret;
44
+ }
45
+
46
+ $secret = md5(Mage::getStoreConfig('web/secure/base_url').Mage::getStoreConfig('general/store_information/email_address').time());
47
+ $apiKey = Mage::getStoreConfig('quartic/config/api_key').microtime();
48
+ if ($apiKey) {
49
+ $secret = md5('qrt'.$apiKey.'hash');
50
+ }
51
+ Mage::helper('quartic')->setStoreConfig('quartic/config/secret', $secret);
52
+ return $secret;
53
+ }
54
+
55
+ public function saveHash($area = 'default',$id = 0)
56
+ {
57
+ $hash = md5(microtime());
58
+ Mage::helper('quartic')->setStoreConfig('quartic/config/hash', $hash);
59
+ }
60
+
61
+ public function getHash($store_id = null)
62
+ {
63
+ return Mage::getStoreConfig('quartic/config/hash', $store_id);
64
+ }
65
+
66
+ public function isDebug($store_id = null)
67
+ {
68
+ return (bool) Mage::getStoreConfig('quartic/config/debug', $store_id);
69
+ }
70
+
71
+ public function isActive($store_id = null)
72
+ {
73
+ return (bool) Mage::getStoreConfig('quartic/config/active', $store_id);
74
+ }
75
+
76
+ public function isFrameEnabled($frame, $store_id = null)
77
+ {
78
+ $frame = Mage::getStoreConfig('quartic/frames/' . $frame, $store_id);
79
+ return !empty($frame);
80
+ }
81
+
82
+ public function getFrameId($frame, $store_id = null)
83
+ {
84
+ return (string) Mage::getStoreConfig('quartic/frames/' . $frame, $store_id);
85
+ }
86
+
87
+ /**
88
+ * Customer symbol
89
+ * @param null|int $store_id
90
+ * @return string
91
+ */
92
+ public function getCustomer($store_id = null)
93
+ {
94
+ return Mage::getStoreConfig('quartic/config/customer', $store_id);
95
+ }
96
+
97
+ public function isUsingSkuEnabled($store_id = null)
98
+ {
99
+ return (bool) Mage::getStoreConfig('quartic/config/use_sku', $store_id);
100
+ }
101
+
102
+ public function showOnlyInStock($store_id = null)
103
+ {
104
+ return (bool) Mage::getStoreConfig('quartic/config/only_in_stock', $store_id);
105
+ }
106
+
107
+ public function addThumbs($store_id = null)
108
+ {
109
+ return (bool) Mage::getStoreConfig('quartic/config/add_thumbs', $store_id);
110
+ }
111
+
112
+ public function showDisabledProducts($store_id = null)
113
+ {
114
+ return (bool) Mage::getStoreConfig('quartic/config/show_disabled_products', $store_id);
115
+ }
116
+
117
+ public function shouldUseProductFrameInCategory($store_id = null)
118
+ {
119
+ return (bool) Mage::getStoreConfig('quartic/frames/category_use_product_frame', $store_id);
120
+ }
121
+
122
+ /**
123
+ * Gets minimum quantity for which a product status should be set to 1 in XML feed.
124
+ *
125
+ * @param int $store_id
126
+ * @return int
127
+ */
128
+ public function getMinQty($store_id = null)
129
+ {
130
+ return (int) Mage::getStoreConfig('quartic/config/min_qty', $store_id);
131
+ }
132
+
133
+ public function getVisibility($store_id = null)
134
+ {
135
+ return explode(',',Mage::getStoreConfig('quartic/config/visibility', $store_id));
136
+ }
137
+
138
+ public function getConfigurablePrice($store_id = null)
139
+ {
140
+ return (int) Mage::getStoreConfig('quartic/composite/configurable_price', $store_id);
141
+ }
142
+
143
+ public function getShowConfigurableChilds($store_id = null)
144
+ {
145
+ return (int) Mage::getStoreConfig('quartic/composite/configurable_childs', $store_id);
146
+ }
147
+
148
+ public function getConfigurableChildImage($store_id = null)
149
+ {
150
+ return (int) Mage::getStoreConfig('quartic/composite/configurable_child_image', $store_id);
151
+ }
152
+
153
+ public function getConfigurableChildPrice($store_id = null)
154
+ {
155
+ return (int) Mage::getStoreConfig('quartic/composite/configurable_child_price', $store_id);
156
+ }
157
+
158
+ public function getConfigurableChildRedirect($store_id = null)
159
+ {
160
+ return (int) Mage::getStoreConfig('quartic/composite/configurable_child_redirect', $store_id);
161
+ }
162
+
163
+ public function getGroupedChildImage($store_id = null)
164
+ {
165
+ return (int) Mage::getStoreConfig('quartic/composite/grouped_child_image', $store_id);
166
+ }
167
+
168
+ public function getGroupedChildPrice($store_id = null)
169
+ {
170
+ return (int) Mage::getStoreConfig('quartic/composite/grouped_child_price', $store_id);
171
+ }
172
+
173
+ public function getGroupedChildRedirect($store_id = null)
174
+ {
175
+ return (int) Mage::getStoreConfig('quartic/composite/grouped_child_redirect', $store_id);
176
+ }
177
+ }
app/code/community/Quarticon/Quartic/Model/Cron.php CHANGED
@@ -1,166 +1,50 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Cron {
4
-
5
- public function refreshProductsFeed()
6
- {
7
- $log = false;
8
- if($log) Mage::log('Start',null,'quartic_cron.log',true);
9
-
10
- $stores = $this->getStoresFeedEnabled();
11
- foreach($stores as $storeId) {
12
- $this->refreshFeed($storeId,$log);
13
- }
14
- }
15
-
16
- public function refreshFeed($storeId, $log = false)
17
- {
18
- $appEmulation = Mage::getSingleton('core/app_emulation');
19
- $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
20
-
21
- if($log) Mage::log('$storeId: ' . $storeId,null,'quartic_cron.log',true);
22
- $filename = 'xmlOutput_' . $storeId . '.xml';
23
- $filepath = Mage::getBaseDir('var') . "/quartic/" . $filename;
24
-
25
- ob_start();
26
-
27
- $writer = new Quarticon_Quartic_Model_Adapter_Writer();
28
- $writer->openUri('php://output');
29
- $writer->startDocument('1.0', 'UTF-8');
30
- $writer->setIndent(true);
31
- $mem_writer = new Quarticon_Quartic_Model_Adapter_Writer();
32
- $mem_writer->openMemory();
33
- $mem_writer->setIndent(true);
34
- $writer->startElement('products');
35
- $writer->writeAttribute('xmlns', "http://alpha.quarticon.com/docs/catalog/1.0/schema");
36
- $writer->writeAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance");
37
- $writer->writeAttribute('xsi:schemaLocation', "http://quartic.pl/catalog/1.0/schema http://alpha.quarticon.com/docs/catalog/1.0/schema/quartic_catalog_1.0.xsd");
38
-
39
- $time = microtime(true);
40
- $products = array();
41
-
42
- $data = array();
43
- // for proper products data in collection set current store by param
44
- Mage::app()->setCurrentStore($storeId);
45
- /**
46
- * @var Quarticon_Quartic_Model_Product $_product
47
- */
48
- $_product = Mage::getModel('quartic/product');
49
- $count = $_product->getCollectionCount();
50
- if($log) Mage::log('$count: ' . $count,null,'quartic_cron.log',true);
51
-
52
- $steps = ceil($count / $_product->getIterationStep($storeId));
53
- if($log) Mage::log('$steps: ' . $steps,null,'quartic_cron.log',true);
54
- for ($step = 1; $step <= $steps; $step++) {
55
- if($log) Mage::log('$step1: ' . $step,null,'quartic_cron.log',true);
56
- $products[$step] = $_product->getAll($step, $_product->getIterationStep($storeId));
57
- }
58
- $data['steps'] = $steps;
59
- $data['products'] = $products;
60
- $data['time'] = $time;
61
-
62
- $cache = $data;
63
-
64
-
65
- $steps = $cache['steps'];
66
- $products = $cache['products'];
67
- for ($step = 1; $step <= $steps; $step++) {
68
- if($log) Mage::log('$step2: ' . $step,null,'quartic_cron.log',true);
69
- $collection = $products[$step];
70
- foreach ($collection as &$p) {
71
- if($log) Mage::log('$productId: ' . $p['id'],null,'quartic_cron.log',true);
72
- $mem_writer->startElement('product');
73
- $mem_writer->writeElement('id', $p['id']);
74
- $mem_writer->startElement('title');
75
- $mem_writer->writeCData($p['title']);
76
- $mem_writer->endElement();
77
- $mem_writer->startElement('link');
78
- $mem_writer->writeCData($p['link']);
79
- $mem_writer->endElement();
80
- if (isset($p['thumb'])) {
81
- $mem_writer->startElement('thumb');
82
- $mem_writer->writeCData($p['thumb']);
83
- $mem_writer->endElement();
84
- }
85
- $mem_writer->writeElement('price', $p['price']);
86
- if (isset($p['old_price'])) {
87
- $mem_writer->writeElement('old_price', $p['old_price']);
88
- }
89
- if (isset($p['author'])) {
90
- $mem_writer->startElement('author');
91
- $mem_writer->writeCData($p['author']);
92
- $mem_writer->endElement();
93
- }
94
- $mem_writer->writeElement('status', !empty($p['status']) ? '1' : '0');
95
- $i = 0;
96
- foreach ($p['categories'] as $categoryId => $categoryName) {
97
- $i++;
98
- $mem_writer->startElement('category_' . $i);
99
- $mem_writer->writeAttribute('id', $categoryId);
100
- $mem_writer->writeRaw($categoryName);
101
- $mem_writer->endElement();
102
- }
103
-
104
- $i = 1;
105
- while ($i <= 5) {
106
- if (isset($p['custom' . $i])) {
107
- $mem_writer->writeElement('custom' . $i, $p['custom' . $i]);
108
- }
109
- $i++;
110
- }
111
-
112
- $mem_writer->endElement();
113
- unset($p);
114
- }
115
-
116
- $batch_xml_string = $mem_writer->outputMemory(true);
117
- $writer->writeRaw($batch_xml_string);
118
- unset($collection);
119
- }
120
-
121
- unset($mem_writer);
122
- $writer->endElement();
123
- $writer->endDocument();
124
-
125
-
126
- $xmlContent = ob_get_contents();
127
- ob_end_clean();
128
- if($log) Mage::log('przed zapisem',null,'quartic_cron.log',true);
129
- file_put_contents($filepath,$xmlContent);
130
- if($log) Mage::log('po zapisie',null,'quartic_cron.log',true);
131
- $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
132
- }
133
-
134
- public function getStoresFeedEnabled()
135
- {
136
- $core_resource = Mage::getSingleton('core/resource');
137
- $tablename = $core_resource->getTableName('core_config_data');
138
- $connection = $core_resource->getConnection('core_read');
139
- $select = $connection->select()->from($tablename, array('scope', 'scope_id', 'path', 'value'));
140
- $select->where('path="quartic/config/active"');
141
-
142
- $result = array();
143
- $rowset = $connection->fetchAll($select);
144
- foreach($rowset as $row) {
145
- if($row['value'] == 1) {
146
-
147
- switch ($row['scope']) {
148
- case 'default':
149
- $result[] = Mage::app()->getDefaultStoreView()->getStoreId();
150
- break;
151
-
152
- case 'websites':
153
- $result[] = Mage::app()->getWebsite($row['scope_id'])->getDefaultGroup()->getDefaultStoreId();
154
- break;
155
-
156
- default:
157
- $result[] = $row['scope_id'];
158
- break;
159
- }
160
- }
161
- }
162
- $result = array_unique($result);
163
- return $result;
164
- }
165
-
166
  }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Cron
4
+ {
5
+ /**
6
+ * Refresh product feeds for all stores
7
+ */
8
+ public function refreshProductsFeed()
9
+ {
10
+ $stores = $this->getStoresFeedEnabled();
11
+ $feed = Mage::getModel('quartic/feed');
12
+ foreach($stores as $storeId) {
13
+ $feed->refreshProductsFeed($storeId);
14
+ }
15
+ }
16
+
17
+ /**
18
+ * Get possible stores
19
+ * @return array
20
+ */
21
+ public function getStoresFeedEnabled()
22
+ {
23
+ $core_resource = Mage::getSingleton('core/resource');
24
+ $tablename = $core_resource->getTableName('core_config_data');
25
+ $connection = $core_resource->getConnection('core_read');
26
+ $select = $connection->select()->from($tablename, array('scope', 'scope_id', 'path', 'value'));
27
+ $select->where('path="quartic/config/active"');
28
+
29
+ $result = array();
30
+ $rowset = $connection->fetchAll($select);
31
+ foreach($rowset as $row) {
32
+ if($row['value'] == 1) {
33
+ switch ($row['scope']) {
34
+ case 'default':
35
+ $result[] = Mage::app()->getDefaultStoreView()->getStoreId();
36
+ break;
37
+ case 'websites':
38
+ $result[] = Mage::app()->getWebsite($row['scope_id'])->getDefaultGroup()->getDefaultStoreId();
39
+ break;
40
+ default:
41
+ $result[] = $row['scope_id'];
42
+ break;
43
+ }
44
+ }
45
+ }
46
+ $result = array_unique($result);
47
+ return $result;
48
+ }
49
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  }
app/code/community/Quarticon/Quartic/Model/Feed.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Feed
4
+ {
5
+ /**
6
+ * helper
7
+ * @var Quarticon_Quartic_Helper_Data
8
+ */
9
+ private $helper;
10
+
11
+ /**
12
+ * Log text
13
+ * @var $txt
14
+ */
15
+ private function log($txt)
16
+ {
17
+ $this->helper->log($txt);
18
+ }
19
+
20
+ /**
21
+ * Generate store product feed
22
+ * @param $storeId
23
+ */
24
+ public function refreshProductsFeed($storeId)
25
+ {
26
+ $this->helper = Mage::helper('quartic');
27
+ $this->log('Start, storeId: ' . $storeId);
28
+
29
+ $dir = Mage::getBaseDir('var') . '/quartic';
30
+ $filename = 'csvFeed_' . $storeId . '.csv';
31
+ if (!file_exists($dir)) {
32
+ mkdir($dir, 0775, true);
33
+ }
34
+ $filepath = $dir . '/' . $filename;
35
+ $products = array();
36
+ file_put_contents($filepath, '"id";"link"');
37
+
38
+ // for proper products data in collection set current store by param
39
+ Mage::app()->setCurrentStore($storeId);
40
+ $_product = Mage::getModel('quartic/product');
41
+ $count = $_product->getCollectionCount(true);
42
+ $this->log('collection count: ' . $count);
43
+
44
+ $steps = ceil($count / $_product->getIterationStep($storeId));
45
+ $this->log('steps: ' . $steps);
46
+
47
+ // pobierz produkty paczkami
48
+ $this->log('iteration step: ' . $_product->getIterationStep($storeId));
49
+ for ($step = 1; $step <= $steps; $step++) {
50
+ $this->log('step: ' . $step);
51
+ $products[$step] = $_product->getSimpleProductList($step, $_product->getIterationStep($storeId));
52
+
53
+ // po pobraniu paczki wypisz do pliku
54
+ $collection = $products[$step];
55
+ foreach ($collection as &$p) {
56
+ $this->log('productId: ' . $p['id']);
57
+ file_put_contents($filepath, "\n" . '"' . $p['id'] . '";"' . $p['link'] . '"', FILE_APPEND);
58
+ unset($p);
59
+ }
60
+ unset($collection);
61
+ }
62
+
63
+ $this->log('Koniec');
64
+ }
65
+
66
+ /**
67
+ * Send event "products catalog is ready" to quartic
68
+ * @param bool|int $storeId
69
+ */
70
+ public function sendCatalogEvent($storeId = false)
71
+ {
72
+ $helper = Mage::helper('quartic');
73
+ $api = Mage::getModel('quartic/client_api');
74
+ if (!$storeId) {
75
+ $storeId = 0;
76
+ }
77
+ $helper->log('sendCatalogEvent, storeId: ' . $storeId);
78
+ if ($helper->getStoreScopeData($storeId, 'catalog')) {
79
+ $this->log('Catalog url already sent: ' . $storeId);
80
+ return;
81
+ }
82
+
83
+ // get catalog type
84
+ $catalogTypeId = $api->catalogType('Crawler (csv)');
85
+ $helper->log('Detected catalog type id: ' . $catalogTypeId);
86
+
87
+ // $hash = Mage::getStoreConfig("quartic/config/hash", $storeId);
88
+ $data = array(
89
+ 'name' => 'Magento crawler url',
90
+ 'url' => Mage::getUrl('quartic/feed/csv', array('store' => $storeId)),
91
+ 'typeId' => $catalogTypeId,
92
+ );
93
+
94
+ // send catalog url
95
+ try {
96
+ $result = $api->post('catalogs', array('data' => $data));
97
+ } catch (Exception $e) {
98
+ return array(
99
+ 'status' => 'error',
100
+ 'message' => $e->getMessage()
101
+ );
102
+ }
103
+ $helper->setStoreScopeData($storeId, 'catalog', true, true);
104
+ }
105
+ }
app/code/community/Quarticon/Quartic/Model/Frame.php CHANGED
@@ -1,84 +1,66 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Frame extends Mage_Core_Model_Abstract
4
- {
5
-
6
- protected function getConfig()
7
- {
8
- return Mage::getModel('quartic/config');
9
- }
10
-
11
- public function isActive()
12
- {
13
- return true;
14
- //return $this->getConfig()->isActive() && $this->getConfig()->isFrameEnabled($this->getFrameName());
15
- }
16
-
17
- public function getCustomer()
18
- {
19
- return $this->getConfig()->getCustomer();
20
- }
21
-
22
- public function getUser()
23
- {
24
- return $this->getConfig()->getSession()->getCustomer()->getId();
25
- }
26
-
27
- public function getSnippetBody()
28
- {
29
- $frame = $this->getData('frame');
30
- if (empty($frame)) {
31
- $frame = $this->getPlacementFrame();
32
- $this->setData('frame', $frame);
33
- }
34
-
35
- if($this->getFrameName() == 'cart') {
36
- $quote = Mage::helper('checkout/cart')->getCart()->getQuote();
37
- $items = $quote->getItemsCollection();
38
- $ids = '';
39
- foreach($items as $item) {
40
- $ids .= ',' . $item->getProduct()->getId();
41
- }
42
- $frame['body'] = str_replace('class="','data-product="' . substr($ids,1) . '" class="',$frame['body']);
43
- }
44
- return $frame['body'];
45
- }
46
-
47
- public function getSnippetId()
48
- {
49
- $frame = $this->getData('frame');
50
- if (empty($frame)) {
51
- $frame = $this->getPlacementFrame();
52
- $this->setData('frame', $frame);
53
- }
54
- return $frame['div_id'];
55
- }
56
-
57
- public function getPlacementFrame()
58
- {
59
- $placement = $this->getPlacement();
60
- $frame = Mage::getModel('quartic/placement')
61
- ->getCollection()
62
- ->addFilter('id', array('eq' => $placement['frame_id']))
63
- //->addFilter('parent_name', array('eq' => $placement['frame_parent']))
64
- ->getFirstItem()
65
- ;
66
- $check = $frame->getId();
67
- if (empty($check)) {
68
- return $this->getDefaultFrame();
69
- }
70
- return array(
71
- 'div_id' => $frame->getDivId(),
72
- 'body' => $frame->getSnippet()
73
- );
74
- }
75
-
76
- public function getDefaultFrame()
77
- {
78
- $div_id = $this->getFrameDivId();
79
- return array(
80
- 'div_id' => $div_id,
81
- 'body' => "<div id=\"" . $div_id . "\"></div>"
82
- );
83
- }
84
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Frame extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ protected function getConfig()
7
+ {
8
+ return Mage::getModel('quartic/config');
9
+ }
10
+
11
+ public function isActive()
12
+ {
13
+ return $this->getConfig()->isActive();
14
+ }
15
+
16
+ public function getCustomer()
17
+ {
18
+ return $this->getConfig()->getCustomer();
19
+ }
20
+
21
+ public function getUser()
22
+ {
23
+ return $this->getConfig()->getSession()->getCustomer()->getId();
24
+ }
25
+
26
+ public function getSnippetBody()
27
+ {
28
+ $frame = $this->getData('frame');
29
+ if (empty($frame)) {
30
+ $frame = $this->getPlacementFrame();
31
+ $this->setData('frame', $frame);
32
+ }
33
+ return $frame['body'];
34
+ }
35
+
36
+ public function getSnippetId()
37
+ {
38
+ $frame = $this->getData('frame');
39
+ if (empty($frame)) {
40
+ $frame = $this->getPlacementFrame();
41
+ $this->setData('frame', $frame);
42
+ }
43
+ return $frame['div_id'];
44
+ }
45
+
46
+ public function getPlacementFrame()
47
+ {
48
+ $placement = $this->getPlacement();
49
+ $div_id = '_qON_'.$placement['frame_parent'].'_'.$placement['frame_id'].'_'.$placement['block_position'];
50
+
51
+
52
+ return array(
53
+ 'div_id' => $div_id,
54
+ 'body' => "<div id=\"" . $div_id . "\" class=\"qON_placeholder\"></div>"
55
+ );
56
+ }
57
+
58
+ public function getDefaultFrame()
59
+ {
60
+ $div_id = $this->getFrameDivId();
61
+ return array(
62
+ 'div_id' => $div_id,
63
+ 'body' => "<div id=\"" . $div_id . "\"></div>"
64
+ );
65
+ }
66
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/Model/History.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_History extends Mage_Core_Model_Abstract
4
- {
5
-
6
- protected function _construct()
7
- {
8
-
9
- $this->_init("quartic/history");
10
- }
11
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_History extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+
9
+ $this->_init("quartic/history");
10
+ }
11
+ }
app/code/community/Quarticon/Quartic/Model/Insert.php CHANGED
@@ -1,117 +1,79 @@
1
- <?php
2
-
3
- /**
4
- * Frame placements - common
5
- *
6
- * For example data:
7
- * @see Quarticon_Quartic_Model_Insert_Home
8
- * For insertion code:
9
- * @see Quarticon_Quartic_Model_Observer_Frontend
10
- */
11
- class Quarticon_Quartic_Model_Insert extends Mage_Core_Model_Abstract
12
- {
13
-
14
- protected $_options;
15
-
16
- /**
17
- * Return options for select field in configuration
18
- *
19
- * @param bool $isMultiselect
20
- * @return array
21
- */
22
- public function toOptionArray($isMultiselect = false)
23
- {
24
- if (!$this->_options) {
25
- $places = $this->getData('places');
26
- foreach ($places as $key => $data) {
27
- $this->_options[] = array(
28
- 'value' => $key,
29
- 'label' => $data['label'],
30
- );
31
- }
32
- }
33
-
34
- $options = $this->_options;
35
- if (!$isMultiselect) {
36
- array_unshift($options, array('value' => '', 'label' => Mage::helper('quartic')->__('--No Frame--')));
37
- }
38
-
39
- return $options;
40
- }
41
-
42
- /**
43
- * Return array with configuration for custom block
44
- *
45
- * @param string $config Config path with placement id
46
- * @param string $model_insert Name of insert model - extending this class
47
- * @return array block_name => data
48
- */
49
- public function loadPlace($config, $model_insert)
50
- {
51
- $place_id = Mage::getStoreConfig($config, Mage::app()->getStore());
52
- if (!empty($place_id)) {
53
- $place = Mage::getModel($model_insert)->getData('places/' . $place_id);
54
- if (!empty($place['block_name'])) {
55
- return array($place['block_name'] => $place);
56
- }
57
- }
58
- return array();
59
- }
60
-
61
- /**
62
- * Return array with configuration for custom block
63
- *
64
- * @param string $config Config path with placement id
65
- * @param string $model_insert Name of insert model - extending this class
66
- * @return array block_name => data
67
- */
68
- public function loadPlaces($config, $model_insert, $places = array())
69
- {
70
- /**
71
- * Load config from magento
72
- */
73
- $places_config_raw = Mage::getStoreConfig($config, Mage::app()->getStore());
74
- /**
75
- * Convert it
76
- */
77
- $places_config = array();
78
- if(is_array($places_config_raw)) foreach ($places_config_raw as $k => $v) {
79
- if (strpos($k, '_enabled') !== false) {
80
- $k = str_replace('_enabled', '', $k);
81
- $nk = 'enabled';
82
- } else {
83
- $nk = 'frame';
84
- }
85
- if (!isset($places_config[$k])) {
86
- $places_config[$k] = array(//$k - where the placement will be used
87
- 'frame' => $k, //which placement will be used
88
- 'enabled' => 0, //should we display it
89
- );
90
- }
91
- $places_config[$k][$nk] = $v;
92
- }
93
- foreach ($places_config as $key => $place_config) {
94
- if (!$place_config['enabled']) {
95
- //ignore disabled places
96
- continue;
97
- }
98
- if (empty($place_config['frame'])) {
99
- //ignore places where template was not selected
100
- continue;
101
- }
102
- //where the placement will be used
103
- $place = Mage::getModel($model_insert)->getData('places/' . $key);
104
- if (!empty($place['block_name'])) {
105
- //which frame will be used (from select field)
106
- $place['frame_id'] = $place_config['frame'];
107
- //layout data
108
- $place['frame_parent'] = Mage::getModel($model_insert)->getData('frame_parent');
109
- if (!isset($places[$place['block_name']])) {
110
- $places[$place['block_name']] = array();
111
- }
112
- $places[$place['block_name']][] = $place;
113
- }
114
- }
115
- return $places;
116
- }
117
- }
1
+ <?php
2
+
3
+ /**
4
+ * Frame placements - common
5
+ *
6
+ * For example data:
7
+ * @see Quarticon_Quartic_Model_Insert_Home
8
+ * For insertion code:
9
+ * @see Quarticon_Quartic_Model_Observer_Frontend
10
+ */
11
+ class Quarticon_Quartic_Model_Insert extends Mage_Core_Model_Abstract
12
+ {
13
+
14
+ protected $_options;
15
+
16
+ /**
17
+ * Return options for select field in configuration
18
+ *
19
+ * @param bool $isMultiselect
20
+ * @return array
21
+ */
22
+ public function toOptionArray($isMultiselect = false)
23
+ {
24
+ if (!$this->_options) {
25
+ $places = $this->getData('places');
26
+ foreach ($places as $key => $data) {
27
+ $this->_options[] = array(
28
+ 'value' => $key,
29
+ 'label' => $data['label'],
30
+ );
31
+ }
32
+ }
33
+
34
+ $options = $this->_options;
35
+ if (!$isMultiselect) {
36
+ array_unshift($options, array('value' => '', 'label' => Mage::helper('quartic')->__('--No Frame--')));
37
+ }
38
+
39
+ return $options;
40
+ }
41
+
42
+ /**
43
+ * Return array with configuration for custom block
44
+ *
45
+ * @param string $config Config path with placement id
46
+ * @param string $model_insert Name of insert model - extending this class
47
+ * @return array block_name => data
48
+ */
49
+ public function loadPlace($config, $model_insert)
50
+ {
51
+ $place_id = Mage::getStoreConfig($config, Mage::app()->getStore());
52
+ if (!empty($place_id)) {
53
+ $place = Mage::getModel($model_insert)->getData('places/' . $place_id);
54
+ if (!empty($place['block_name'])) {
55
+ return array($place['block_name'] => $place);
56
+ }
57
+ }
58
+ return array();
59
+ }
60
+
61
+ /**
62
+ * Return array with configuration for custom block
63
+ *
64
+ * @param string $config Config path with placement id
65
+ * @param string $model_insert Name of insert model - extending this class
66
+ * @return array block_name => data
67
+ */
68
+ public function loadPlaces($config, $model_insert, $places = array())
69
+ {
70
+ $allPlaces = Mage::getModel($model_insert)->getData('places');
71
+ $parent = Mage::getModel($model_insert)->getData('frame_parent');
72
+ foreach($allPlaces as $frameId => $place) {
73
+ $place['frame_id'] = $frameId;
74
+ $place['frame_parent'] = $parent;
75
+ $places[$place['block_name']][] = $place;
76
+ }
77
+ return $places;
78
+ }
79
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/Model/Insert/Cart.php CHANGED
@@ -1,52 +1,52 @@
1
- <?php
2
-
3
- /**
4
- * Frame placements - product view
5
- */
6
- class Quarticon_Quartic_Model_Insert_Cart extends Quarticon_Quartic_Model_Insert
7
- {
8
-
9
- /**
10
- * Places for possible custom block insertion
11
- *
12
- * Place selected in configuration will be modified on page's render
13
- * Our custom block's html will be put before of after the original/parent block's output
14
- *
15
- * For commented example
16
- * @see Quarticon_Quartic_Model_Insert_Home
17
- */
18
- public function __construct()
19
- {
20
- $this->setData('frame_parent', 'CartPage');
21
- $this->setData('places', array(
22
- 'top' => array(
23
- 'label' => Mage::helper('quartic')->__('Top'),
24
- 'block_name' => 'checkout.cart.form.before',
25
- 'block_position' => 'before',
26
- 'frame_block' => 'quartic/frame_cart',
27
- 'frame_template' => 'quartic/frame/cart.phtml',
28
- ),
29
- 'bottom' => array(
30
- 'label' => Mage::helper('quartic')->__('Bottom'),
31
- 'block_name' => 'checkout.cart',
32
- 'block_position' => 'after',
33
- 'frame_block' => 'quartic/frame_cart',
34
- 'frame_template' => 'quartic/frame/cart.phtml',
35
- ),
36
- 'right' => array(
37
- 'label' => Mage::helper('quartic')->__('Right'),
38
- 'block_name' => 'checkout.cart.shipping',
39
- 'block_position' => 'before',
40
- 'frame_block' => 'quartic/frame_cart',
41
- 'frame_template' => 'quartic/frame/cart.phtml',
42
- ),
43
- 'middle' => array(
44
- 'label' => Mage::helper('quartic')->__('Middle'),
45
- 'block_name' => 'checkout.cart.crosssell',
46
- 'block_position' => 'after',
47
- 'frame_block' => 'quartic/frame_cart',
48
- 'frame_template' => 'quartic/frame/cart.phtml',
49
- ),
50
- ));
51
- }
52
- }
1
+ <?php
2
+
3
+ /**
4
+ * Frame placements - product view
5
+ */
6
+ class Quarticon_Quartic_Model_Insert_Cart extends Quarticon_Quartic_Model_Insert
7
+ {
8
+
9
+ /**
10
+ * Places for possible custom block insertion
11
+ *
12
+ * Place selected in configuration will be modified on page's render
13
+ * Our custom block's html will be put before of after the original/parent block's output
14
+ *
15
+ * For commented example
16
+ * @see Quarticon_Quartic_Model_Insert_Home
17
+ */
18
+ public function __construct()
19
+ {
20
+ $this->setData('frame_parent', 'CartPage');
21
+ $this->setData('places', array(
22
+ 'top' => array(
23
+ 'label' => Mage::helper('quartic')->__('Top'),
24
+ 'block_name' => 'checkout.cart.form.before',
25
+ 'block_position' => 'before',
26
+ 'frame_block' => 'quartic/frame_cart',
27
+ 'frame_template' => 'quartic/frame/cart.phtml',
28
+ ),
29
+ 'bottom' => array(
30
+ 'label' => Mage::helper('quartic')->__('Bottom'),
31
+ 'block_name' => 'checkout.cart',
32
+ 'block_position' => 'after',
33
+ 'frame_block' => 'quartic/frame_cart',
34
+ 'frame_template' => 'quartic/frame/cart.phtml',
35
+ ),
36
+ 'right' => array(
37
+ 'label' => Mage::helper('quartic')->__('Right'),
38
+ 'block_name' => 'checkout.cart.shipping',
39
+ 'block_position' => 'before',
40
+ 'frame_block' => 'quartic/frame_cart',
41
+ 'frame_template' => 'quartic/frame/cart.phtml',
42
+ ),
43
+ 'middle' => array(
44
+ 'label' => Mage::helper('quartic')->__('Middle'),
45
+ 'block_name' => 'checkout.cart.crosssell',
46
+ 'block_position' => 'after',
47
+ 'frame_block' => 'quartic/frame_cart',
48
+ 'frame_template' => 'quartic/frame/cart.phtml',
49
+ ),
50
+ ));
51
+ }
52
+ }
app/code/community/Quarticon/Quartic/Model/Insert/Category.php CHANGED
@@ -1,54 +1,54 @@
1
- <?php
2
-
3
- /**
4
- * Frame placements - product view
5
- */
6
- class Quarticon_Quartic_Model_Insert_Category extends Quarticon_Quartic_Model_Insert
7
- {
8
-
9
- /**
10
- * Places for possible custom block insertion
11
- *
12
- * Place selected in configuration will be modified on page's render
13
- * Our custom block's html will be put before of after the original/parent block's output
14
- *
15
- * For commented example
16
- * @see Quarticon_Quartic_Model_Insert_Home
17
- */
18
- public function __construct()
19
- {
20
- $this->setData('frame_parent', 'CategoryPage');
21
- $this->setData('places', array(
22
- 'top' => array(
23
- 'label' => Mage::helper('quartic')->__('Top'),
24
- 'block_name' => 'category.products',
25
- 'block_position' => 'before',
26
- 'frame_block' => 'quartic/frame_category',
27
- 'frame_template' => 'quartic/frame/category.phtml',
28
- ),
29
- 'bottom' => array(
30
- 'label' => Mage::helper('quartic')->__('Bottom'),
31
- 'block_name' => 'category.products',
32
- 'block_position' => 'after',
33
- 'frame_block' => 'quartic/frame_category',
34
- 'frame_template' => 'quartic/frame/category.phtml',
35
- ),
36
- 'left' => array(
37
- 'label' => Mage::helper('quartic')->__('Left'),
38
- 'block_name' => 'left',
39
- 'block_layout' => 'catalog_category_view',
40
- 'block_position' => 'after',
41
- 'frame_block' => 'quartic/frame_category',
42
- 'frame_template' => 'quartic/frame/category.phtml',
43
- ),
44
- 'right' => array(
45
- 'label' => Mage::helper('quartic')->__('Right'),
46
- 'block_name' => 'right',
47
- 'block_layout' => 'catalog_category_view',
48
- 'block_position' => 'after',
49
- 'frame_block' => 'quartic/frame_category',
50
- 'frame_template' => 'quartic/frame/category.phtml',
51
- ),
52
- ));
53
- }
54
- }
1
+ <?php
2
+
3
+ /**
4
+ * Frame placements - product view
5
+ */
6
+ class Quarticon_Quartic_Model_Insert_Category extends Quarticon_Quartic_Model_Insert
7
+ {
8
+
9
+ /**
10
+ * Places for possible custom block insertion
11
+ *
12
+ * Place selected in configuration will be modified on page's render
13
+ * Our custom block's html will be put before of after the original/parent block's output
14
+ *
15
+ * For commented example
16
+ * @see Quarticon_Quartic_Model_Insert_Home
17
+ */
18
+ public function __construct()
19
+ {
20
+ $this->setData('frame_parent', 'CategoryPage');
21
+ $this->setData('places', array(
22
+ 'top' => array(
23
+ 'label' => Mage::helper('quartic')->__('Top'),
24
+ 'block_name' => 'category.products',
25
+ 'block_position' => 'before',
26
+ 'frame_block' => 'quartic/frame_category',
27
+ 'frame_template' => 'quartic/frame/category.phtml',
28
+ ),
29
+ 'bottom' => array(
30
+ 'label' => Mage::helper('quartic')->__('Bottom'),
31
+ 'block_name' => 'category.products',
32
+ 'block_position' => 'after',
33
+ 'frame_block' => 'quartic/frame_category',
34
+ 'frame_template' => 'quartic/frame/category.phtml',
35
+ ),
36
+ 'left' => array(
37
+ 'label' => Mage::helper('quartic')->__('Left'),
38
+ 'block_name' => 'left',
39
+ 'block_layout' => 'catalog_category_view',
40
+ 'block_position' => 'after',
41
+ 'frame_block' => 'quartic/frame_category',
42
+ 'frame_template' => 'quartic/frame/category.phtml',
43
+ ),
44
+ 'right' => array(
45
+ 'label' => Mage::helper('quartic')->__('Right'),
46
+ 'block_name' => 'right',
47
+ 'block_layout' => 'catalog_category_view',
48
+ 'block_position' => 'after',
49
+ 'frame_block' => 'quartic/frame_category',
50
+ 'frame_template' => 'quartic/frame/category.phtml',
51
+ ),
52
+ ));
53
+ }
54
+ }
app/code/community/Quarticon/Quartic/Model/Insert/Home.php CHANGED
@@ -1,37 +1,37 @@
1
- <?php
2
-
3
- /**
4
- * Frame placements - product view
5
- */
6
- class Quarticon_Quartic_Model_Insert_Home extends Quarticon_Quartic_Model_Insert
7
- {
8
-
9
- /**
10
- * Places for possible custom block insertion
11
- *
12
- * Place selected in configuration will be modified on page's render
13
- * Our custom block's html will be put before of after the original/parent block's output
14
- */
15
- public function __construct()
16
- {
17
- $this->setData('frame_parent', 'HomePage');
18
- $this->setData('places', array(
19
- 'top' => array(//'top' - key used in config
20
- 'label' => Mage::helper('quartic')->__('Top'), //Label used in configuration form
21
- 'block_name' => 'content', //Original block's name in layout
22
- 'block_layout' => 'cms_index_index', //[optional] If set, our block will be inserted only on pages with this layout hadle
23
- 'block_position' => 'before', //'before' - prepend custom block's html; 'after' - append it
24
- 'frame_block' => 'quartic/frame_home', //Class of our custom block
25
- 'frame_template' => 'quartic/frame/home.phtml', //Template of our custom block
26
- ),
27
- 'bottom' => array(
28
- 'label' => Mage::helper('quartic')->__('Bottom'),
29
- 'block_name' => 'content',
30
- 'block_layout' => 'cms_index_index',
31
- 'block_position' => 'after',
32
- 'frame_block' => 'quartic/frame_home',
33
- 'frame_template' => 'quartic/frame/home.phtml',
34
- ),
35
- ));
36
- }
37
- }
1
+ <?php
2
+
3
+ /**
4
+ * Frame placements - product view
5
+ */
6
+ class Quarticon_Quartic_Model_Insert_Home extends Quarticon_Quartic_Model_Insert
7
+ {
8
+
9
+ /**
10
+ * Places for possible custom block insertion
11
+ *
12
+ * Place selected in configuration will be modified on page's render
13
+ * Our custom block's html will be put before of after the original/parent block's output
14
+ */
15
+ public function __construct()
16
+ {
17
+ $this->setData('frame_parent', 'HomePage');
18
+ $this->setData('places', array(
19
+ 'top' => array(//'top' - key used in config
20
+ 'label' => Mage::helper('quartic')->__('Top'), //Label used in configuration form
21
+ 'block_name' => 'content', //Original block's name in layout
22
+ 'block_layout' => 'cms_index_index', //[optional] If set, our block will be inserted only on pages with this layout hadle
23
+ 'block_position' => 'before', //'before' - prepend custom block's html; 'after' - append it
24
+ 'frame_block' => 'quartic/frame_home', //Class of our custom block
25
+ 'frame_template' => 'quartic/frame/home.phtml', //Template of our custom block
26
+ ),
27
+ 'bottom' => array(
28
+ 'label' => Mage::helper('quartic')->__('Bottom'),
29
+ 'block_name' => 'content',
30
+ 'block_layout' => 'cms_index_index',
31
+ 'block_position' => 'after',
32
+ 'frame_block' => 'quartic/frame_home',
33
+ 'frame_template' => 'quartic/frame/home.phtml',
34
+ ),
35
+ ));
36
+ }
37
+ }
app/code/community/Quarticon/Quartic/Model/Insert/Product.php CHANGED
@@ -1,52 +1,52 @@
1
- <?php
2
-
3
- /**
4
- * Frame placements - product view
5
- */
6
- class Quarticon_Quartic_Model_Insert_Product extends Quarticon_Quartic_Model_Insert
7
- {
8
-
9
- /**
10
- * Places for possible custom block insertion
11
- *
12
- * Place selected in configuration will be modified on page's render
13
- * Our custom block's html will be put before of after the original/parent block's output
14
- *
15
- * For commented example
16
- * @see Quarticon_Quartic_Model_Insert_Home
17
- */
18
- public function __construct()
19
- {
20
- $this->setData('frame_parent', 'ProductPage');
21
- $this->setData('places', array(
22
- 'top' => array(//'top' - key used in config
23
- 'label' => Mage::helper('quartic')->__('Top'), //Label used in configuration form
24
- 'block_name' => 'product.info', //Original block's name in layout
25
- 'block_position' => 'before', //'before' - prepend custom block's html; 'after' - append it
26
- 'frame_block' => 'quartic/frame_product', //Class of our custom block
27
- 'frame_template' => 'quartic/frame/product.phtml', //Template of our custom block
28
- ),
29
- 'bottom' => array(
30
- 'label' => Mage::helper('quartic')->__('Bottom'),
31
- 'block_name' => 'product.info.upsell',
32
- 'block_position' => 'before',
33
- 'frame_block' => 'quartic/frame_product',
34
- 'frame_template' => 'quartic/frame/product.phtml',
35
- ),
36
- 'right' => array(
37
- 'label' => Mage::helper('quartic')->__('Right'),
38
- 'block_name' => 'product.info.addtocart',
39
- 'block_position' => 'after',
40
- 'frame_block' => 'quartic/frame_product',
41
- 'frame_template' => 'quartic/frame/product.phtml',
42
- ),
43
- 'middle' => array(
44
- 'label' => Mage::helper('quartic')->__('Middle'),
45
- 'block_name' => 'product.description',
46
- 'block_position' => 'after',
47
- 'frame_block' => 'quartic/frame_product',
48
- 'frame_template' => 'quartic/frame/product.phtml',
49
- ),
50
- ));
51
- }
52
- }
1
+ <?php
2
+
3
+ /**
4
+ * Frame placements - product view
5
+ */
6
+ class Quarticon_Quartic_Model_Insert_Product extends Quarticon_Quartic_Model_Insert
7
+ {
8
+
9
+ /**
10
+ * Places for possible custom block insertion
11
+ *
12
+ * Place selected in configuration will be modified on page's render
13
+ * Our custom block's html will be put before of after the original/parent block's output
14
+ *
15
+ * For commented example
16
+ * @see Quarticon_Quartic_Model_Insert_Home
17
+ */
18
+ public function __construct()
19
+ {
20
+ $this->setData('frame_parent', 'ProductPage');
21
+ $this->setData('places', array(
22
+ 'top' => array(//'top' - key used in config
23
+ 'label' => Mage::helper('quartic')->__('Top'), //Label used in configuration form
24
+ 'block_name' => 'product.info', //Original block's name in layout
25
+ 'block_position' => 'before', //'before' - prepend custom block's html; 'after' - append it
26
+ 'frame_block' => 'quartic/frame_product', //Class of our custom block
27
+ 'frame_template' => 'quartic/frame/product.phtml', //Template of our custom block
28
+ ),
29
+ 'bottom' => array(
30
+ 'label' => Mage::helper('quartic')->__('Bottom'),
31
+ 'block_name' => 'product.info.upsell',
32
+ 'block_position' => 'before',
33
+ 'frame_block' => 'quartic/frame_product',
34
+ 'frame_template' => 'quartic/frame/product.phtml',
35
+ ),
36
+ 'right' => array(
37
+ 'label' => Mage::helper('quartic')->__('Right'),
38
+ 'block_name' => 'product.info.addtocart',
39
+ 'block_position' => 'after',
40
+ 'frame_block' => 'quartic/frame_product',
41
+ 'frame_template' => 'quartic/frame/product.phtml',
42
+ ),
43
+ 'middle' => array(
44
+ 'label' => Mage::helper('quartic')->__('Middle'),
45
+ 'block_name' => 'product.description',
46
+ 'block_position' => 'after',
47
+ 'frame_block' => 'quartic/frame_product',
48
+ 'frame_template' => 'quartic/frame/product.phtml',
49
+ ),
50
+ ));
51
+ }
52
+ }
app/code/community/Quarticon/Quartic/Model/Maps.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Maps extends Mage_Core_Model_Abstract
4
- {
5
-
6
- protected function _construct()
7
- {
8
-
9
- $this->_init("quartic/maps");
10
- }
11
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Maps extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+
9
+ $this->_init("quartic/maps");
10
+ }
11
+ }
app/code/community/Quarticon/Quartic/Model/Mysql4/History.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Mysql4_History extends Mage_Core_Model_Mysql4_Abstract
4
- {
5
-
6
- protected function _construct()
7
- {
8
- $this->_init("quartic/history", "id");
9
- }
10
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Mysql4_History extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+ $this->_init("quartic/history", "id");
9
+ }
10
+ }
app/code/community/Quarticon/Quartic/Model/Mysql4/History/Collection.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Mysql4_History_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
- {
5
-
6
- public function _construct()
7
- {
8
- $this->_init("quartic/history");
9
- }
10
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Mysql4_History_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ $this->_init("quartic/history");
9
+ }
10
+ }
app/code/community/Quarticon/Quartic/Model/Mysql4/Maps.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Mysql4_Maps extends Mage_Core_Model_Mysql4_Abstract
4
- {
5
-
6
- protected function _construct()
7
- {
8
- $this->_init("quartic/maps", "id");
9
- }
10
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Mysql4_Maps extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+ $this->_init("quartic/maps", "id");
9
+ }
10
+ }
app/code/community/Quarticon/Quartic/Model/Mysql4/Maps/Collection.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Mysql4_Maps_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
- {
5
-
6
- public function _construct()
7
- {
8
- $this->_init("quartic/maps");
9
- }
10
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Mysql4_Maps_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ $this->_init("quartic/maps");
9
+ }
10
+ }
app/code/community/Quarticon/Quartic/Model/Mysql4/Placement.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Mysql4_Placement extends Mage_Core_Model_Mysql4_Abstract
4
- {
5
-
6
- protected function _construct()
7
- {
8
- $this->_init('quartic/placement', 'id');
9
- }
10
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Mysql4_Placement extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+ $this->_init('quartic/placement', 'id');
9
+ }
10
+ }
app/code/community/Quarticon/Quartic/Model/Mysql4/Placement/Collection.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Mysql4_Placement_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
- {
5
-
6
- protected function _construct()
7
- {
8
- parent::_construct();
9
- $this->_init('quartic/placement');
10
- }
11
-
12
- /**
13
- * Convert to option array
14
- *
15
- * @return array
16
- */
17
- public function toOptionArray()
18
- {
19
- $res = array();
20
-
21
- foreach ($this as $item) {
22
- $res[] = array(
23
- 'value' => strtolower($item->getData('id')),
24
- 'label' => $item->getLabel(),
25
- );
26
- }
27
- return $res;
28
- }
29
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Mysql4_Placement_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+
6
+ protected function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->_init('quartic/placement');
10
+ }
11
+
12
+ /**
13
+ * Convert to option array
14
+ *
15
+ * @return array
16
+ */
17
+ public function toOptionArray()
18
+ {
19
+ $res = array();
20
+
21
+ foreach ($this as $item) {
22
+ $res[] = array(
23
+ 'value' => strtolower($item->getData('id')),
24
+ 'label' => $item->getLabel(),
25
+ );
26
+ }
27
+ return $res;
28
+ }
29
+ }
app/code/community/Quarticon/Quartic/Model/Observer/Adminhtml.php CHANGED
@@ -1,198 +1,216 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Observer_Adminhtml
4
- {
5
-
6
- /**
7
- * Verify api keys entered by user
8
- * Run after configuration is saved
9
- *
10
- * @param Varien_Event_Observer $observer
11
- * @throws Mage_Core_Exception
12
- */
13
- public function handle_adminSystemConfigChangedSection(Varien_Event_Observer $observer)
14
- {
15
- $helper = Mage::helper('quartic');
16
- /* @var $api Mage_Core_Model_Config */
17
- $config = Mage::getModel('core/config');
18
- /* @var $api Quarticon_Quartic_Model_Client_Api */
19
- $api = Mage::getModel('quartic/client_api');
20
- $currentArea = 'default';
21
- $currentAreaId = 0;
22
- if($observer->getStore()) {
23
- $storeId = Mage::getModel('core/store')->load($observer->getStore(), 'code')->getId();
24
- $currentArea = 'stores';
25
- $currentAreaId = $storeId;
26
- } elseif($observer->getWebsite()) {
27
- $websiteId = Mage::getModel('core/website')->load($observer->getWebsite(), 'code')->getId();
28
- $storeId = Mage::app()->getWebsite($websiteId)->getDefaultGroup()->getDefaultStoreId();
29
- $currentArea = 'websites';
30
- $currentAreaId = $websiteId;
31
- } else {
32
- $storeId = Mage::app()->getDefaultStoreView()->getStoreId();
33
- }
34
- /**
35
- * Clean products feed cache
36
- */
37
- $cache = Mage::app()->getCacheInstance();
38
- $cache->cleanType('quartic-products-' . $storeId);
39
-
40
- /**
41
- * Verify api connection
42
- */
43
- if($currentArea == 'websites') {
44
- $status_array = Mage::app()->getWebsite($currentAreaId)->getConfig('quartic/config');
45
- } else {
46
- $status_array = Mage::getStoreConfig("quartic/config", $observer->getStore());
47
- }
48
-
49
- foreach($status_array as $key => $value) $status_array[$key] = (string)$value;
50
-
51
- $status = (
52
- !empty($status_array['active']) &&
53
- !empty($status_array['customer']) &&
54
- !empty($status_array['hash'])
55
- );
56
-
57
- /**
58
- * Only if fields are filled
59
- */
60
- if ($status) {
61
- try {
62
- /**
63
- * Force fresh login
64
- */
65
- $api->dropToken($observer->getStore());
66
- $ret = $api->requestToken();
67
- } catch (Exception $e) {
68
- /**
69
- * If login failed, return error
70
- */
71
-
72
- $config->saveConfig('quartic/config/status', 0, $currentArea, $currentAreaId);
73
- Mage::app()->getCacheInstance()->cleanType('config');
74
- throw new Mage_Core_Exception(Mage::helper('quartic')->__('Could not log in. Check your credentials and try again.'));
75
- }
76
- }
77
-
78
- /**
79
- * Set module status based on config and result
80
- */
81
- $config->saveConfig('quartic/config/status', (int) $status, $currentArea, $currentAreaId);
82
- $cache->cleanType('config');
83
-
84
- if ($status) {
85
- $cleared = $this->markRegistered($observer, $status_array['customer'], $currentArea, $currentAreaId);
86
- } else {
87
- $cleared = false;
88
- }
89
-
90
- /**
91
- * Registration
92
- */
93
- if ($status) {
94
- $registered = Mage::getStoreConfig("quartic/config/registered/c_{$status_array['customer']}", $observer->getStore());
95
- if (empty($registered)) {
96
- try {
97
- $helper->log('POST pluginActivation');
98
- $data = array(
99
- 'platform' => 56 //hardcoded magento platform code
100
- );
101
- $helper->log(var_export(array('data' => $data), true));
102
- $helper->log(var_export($api->post('pluginActivation', array('data' => $data)), true));
103
- $config->saveConfig("quartic/config/registered/c_{$status_array['customer']}", 1, $currentArea, $currentAreaId);
104
- Mage::app()->getCacheInstance()->cleanType('config');
105
- } catch (Exception $e) {
106
- $helper->log("Quartic activation failed: " . $e->getMessage());
107
- }
108
- }
109
- }
110
- /**
111
- * Catalogs
112
- */
113
- if ($status && !$cleared) {
114
- $catalog_id = isset($status_array['catalog_id']) ? (int) $status_array['catalog_id'] : 0;
115
- if ($catalog_id > 0) {
116
- /**
117
- * Synchronizuj katalog
118
- */
119
- $cache->cleanType('quartic-products-' . $storeId);
120
- $data = array();
121
- $data['url'] = Mage::getUrl('quartic/feed/products', array('hash' => $status_array['hash'],'store' => $storeId,'_nosid' => true,'_store' => $storeId,'_type' =>'direct_link'));
122
- $helper->log('PUT catalog');
123
- $helper->log(var_export(array('data' => $data), true));
124
- $helper->log(var_export($api->put('catalogs', $catalog_id, array('data' => $data)), true));
125
- } elseif ($catalog_id == -1) {
126
- /**
127
- * Utwórz nowy
128
- */
129
- $cache->cleanType('quartic-products-' . $storeId);
130
- $data = array(
131
- 'url' => Mage::getUrl('quartic/feed/products', array('hash' => $status_array['hash'],'store' => $storeId,'_nosid' => true,'_store' => $storeId,'_type' =>'direct_link')),
132
- 'name' => 'magento_' . time(),
133
- 'typeId' => $api->catalogType(),
134
- );
135
- $helper->log('POST catalog');
136
- $helper->log(var_export(array('data' => $data), true));
137
- $new_catalog = $api->post('catalogs', array('data' => $data));
138
- $helper->log(var_export($new_catalog, true));
139
- $retData = current($new_catalog['body']['data']);
140
- $config->saveConfig('quartic/config/catalog_id', $retData['id'], $currentArea, $currentAreaId);
141
- $cache->cleanType('config');
142
- }
143
- }
144
- }
145
-
146
- /**
147
- *
148
- * @param Varien_Event_Observer $observer
149
- * @param string $qcustomer QON account login
150
- * @return boolean True if data was cleared
151
- */
152
- public function markRegistered(Varien_Event_Observer $observer, $qcustomer, $currentArea, $currentAreaId)
153
- {
154
- if($currentArea == 'websites') {
155
- $registered = Mage::app()->getWebsite($currentAreaId)->getConfig('quartic/config/registered/current');
156
- } else {
157
- $registered = Mage::getStoreConfig("quartic/config/registered/current", $currentAreaId);
158
- }
159
- $cache = Mage::app()->getCacheInstance();
160
- /* @var $api Mage_Core_Model_Config */
161
- $config = Mage::getModel('core/config');
162
-
163
- /**
164
- * First login - save id
165
- */
166
- if (empty($registered)) {
167
- $config->saveConfig('quartic/config/registered/current', $qcustomer, $currentArea, $currentAreaId);
168
- return false;
169
- }
170
- /*
171
- * Changed accounts - clean previous data
172
- */
173
- if ($registered !== $qcustomer) {
174
- /**
175
- * Remove frames
176
- */
177
- /*
178
- $frames = Mage::getModel('quartic/placement');
179
- $collection = $frames->getCollection();
180
- $collection->addFieldToFilter('api_name', $qcustomer);
181
- foreach ($collection as $item) {
182
- $item->delete();
183
- }*/
184
-
185
- $config->deleteConfig('quartic/config/modified_placements', $qcustomer);
186
- $config->deleteConfig('quartic/config/catalog_id', $qcustomer);
187
- $config->deleteConfig('quartic/frames_homepage', $qcustomer);
188
- $config->deleteConfig('quartic/frames_category', $qcustomer);
189
- $config->deleteConfig('quartic/frames_product', $qcustomer);
190
- $config->deleteConfig('quartic/frames_cart', $qcustomer);
191
-
192
- $config->saveConfig('quartic/config/registered/current', $qcustomer, $currentArea, $currentAreaId);
193
-
194
- $cache->cleanType('config');
195
- return true;
196
- }
197
- }
198
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Observer_Adminhtml
4
+ {
5
+
6
+ /**
7
+ * Akcja wykonywana przed zaladowaniem kazdej strony backendu
8
+ * @param Varien_Event_Observer $observer
9
+ */
10
+ public function adminPageBefore(Varien_Event_Observer $observer)
11
+ {
12
+ if (Mage::app()->getRequest()->getControllerName() == 'system_config') {
13
+ $params = Mage::app()->getRequest()->getParams();
14
+ if (isset($params['section']) && in_array($params['section'], array('quartic', 'plugin'))) {
15
+ $helper = Mage::helper('quartic');
16
+
17
+ // jesli brakuje sprobuj utworzyc shop
18
+ $helper->initQuarticShop();
19
+
20
+ // sprawdz czy jest powiazanie z customerem
21
+ $helper->prepareCustomerData();
22
+ }
23
+ }
24
+ }
25
+
26
+ /**
27
+ * Verify api keys entered by user
28
+ * Run after configuration is saved
29
+ *
30
+ * @param Varien_Event_Observer $observer
31
+ * @throws Mage_Core_Exception
32
+ */
33
+ public function handle_adminSystemConfigChangedSection(Varien_Event_Observer $observer)
34
+ {
35
+ $helper = Mage::helper('quartic');
36
+ /* @var $api Mage_Core_Model_Config */
37
+ $config = Mage::getModel('core/config');
38
+ /* @var $api Quarticon_Quartic_Model_Client_Api */
39
+ $api = Mage::getModel('quartic/client_api');
40
+ $currentArea = 'default';
41
+ $currentAreaId = 0;
42
+ if($observer->getStore()) {
43
+ $storeId = Mage::getModel('core/store')->load($observer->getStore(), 'code')->getId();
44
+ $currentArea = 'stores';
45
+ $currentAreaId = $storeId;
46
+ } elseif($observer->getWebsite()) {
47
+ $websiteId = Mage::getModel('core/website')->load($observer->getWebsite(), 'code')->getId();
48
+ $storeId = Mage::app()->getWebsite($websiteId)->getDefaultGroup()->getDefaultStoreId();
49
+ $currentArea = 'websites';
50
+ $currentAreaId = $websiteId;
51
+ } else {
52
+ $storeId = Mage::app()->getDefaultStoreView()->getStoreId();
53
+ }
54
+ /**
55
+ * Clean products feed cache
56
+ */
57
+ $cache = Mage::app()->getCacheInstance();
58
+ $cache->cleanType('quartic-products-' . $storeId);
59
+
60
+ /**
61
+ * Verify api connection
62
+ */
63
+ if($currentArea == 'websites') {
64
+ $status_array = Mage::app()->getWebsite($currentAreaId)->getConfig('quartic/config');
65
+ } else {
66
+ $status_array = Mage::getStoreConfig("quartic/config", $observer->getStore());
67
+ }
68
+
69
+ $status = (
70
+ !empty($status_array['active']) &&
71
+ !empty($status_array['customer']) &&
72
+ !empty($status_array['hash'])
73
+ );
74
+
75
+ /**
76
+ * Only if fields are filled
77
+ */
78
+ if ($status) {
79
+ try {
80
+ /**
81
+ * Force fresh login
82
+ */
83
+ $api->dropToken($observer->getStore());
84
+ $ret = $api->requestToken();
85
+ } catch (Exception $e) {
86
+ /**
87
+ * If login failed, return error
88
+ */
89
+
90
+ $config->saveConfig('quartic/config/status', 0, $currentArea, $currentAreaId);
91
+ Mage::app()->getCacheInstance()->cleanType('config');
92
+ throw new Mage_Core_Exception(Mage::helper('quartic')->__('Could not log in. Check your credentials and try again.'));
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Set module status based on config and result
98
+ */
99
+ $config->saveConfig('quartic/config/status', (int) $status, $currentArea, $currentAreaId);
100
+ $cache->cleanType('config');
101
+
102
+ if ($status) {
103
+ $cleared = $this->markRegistered($observer, $status_array['customer'], $currentArea, $currentAreaId);
104
+ } else {
105
+ $cleared = false;
106
+ }
107
+
108
+ /**
109
+ * Registration
110
+ */
111
+ if ($status) {
112
+ $registered = Mage::getStoreConfig("quartic/config/registered/c_{$status_array['customer']}", $observer->getStore());
113
+ if (empty($registered)) {
114
+ try {
115
+ $helper->log('POST pluginActivation');
116
+ $data = array(
117
+ 'platform' => 56 //hardcoded magento platform code
118
+ );
119
+ $helper->log(var_export(array('data' => $data), true));
120
+ $helper->log(var_export($api->post('pluginActivation', array('data' => $data)), true));
121
+ $config->saveConfig("quartic/config/registered/c_{$status_array['customer']}", 1, $currentArea, $currentAreaId);
122
+ Mage::app()->getCacheInstance()->cleanType('config');
123
+ } catch (Exception $e) {
124
+ $helper->log("Quartic activation failed: " . $e->getMessage());
125
+ }
126
+ }
127
+ }
128
+ /**
129
+ * Catalogs
130
+ */
131
+ if ($status && !$cleared) {
132
+ $catalog_id = isset($status_array['catalog_id']) ? (int) $status_array['catalog_id'] : 0;
133
+ if ($catalog_id > 0) {
134
+ /**
135
+ * Synchronizuj katalog
136
+ */
137
+ $cache->cleanType('quartic-products-' . $storeId);
138
+ $data = array();
139
+ $data['url'] = Mage::getUrl('quartic/feed/products', array('hash' => $status_array['hash'],'store' => $storeId,'_nosid' => true,'_store' => $storeId,'_type' =>'direct_link'));
140
+ $helper->log('PUT catalog');
141
+ $helper->log(var_export(array('data' => $data), true));
142
+ $helper->log(var_export($api->put('catalogs', $catalog_id, array('data' => $data)), true));
143
+ } elseif ($catalog_id == -1) {
144
+ /**
145
+ * Utwórz nowy
146
+ */
147
+ $cache->cleanType('quartic-products-' . $storeId);
148
+ $data = array(
149
+ 'url' => Mage::getUrl('quartic/feed/products', array('hash' => $status_array['hash'],'store' => $storeId,'_nosid' => true,'_store' => $storeId,'_type' =>'direct_link')),
150
+ 'name' => 'magento_' . time(),
151
+ 'typeId' => $api->catalogType(),
152
+ );
153
+ $helper->log('POST catalog');
154
+ $helper->log(var_export(array('data' => $data), true));
155
+ $new_catalog = $api->post('catalogs', array('data' => $data));
156
+ $helper->log(var_export($new_catalog, true));
157
+ $retData = current($new_catalog['body']['data']);
158
+ $config->saveConfig('quartic/config/catalog_id', $retData['id'], $currentArea, $currentAreaId);
159
+ $cache->cleanType('config');
160
+ }
161
+ }
162
+ }
163
+
164
+ /**
165
+ *
166
+ * @param Varien_Event_Observer $observer
167
+ * @param string $qcustomer QON account login
168
+ * @return boolean True if data was cleared
169
+ */
170
+ public function markRegistered(Varien_Event_Observer $observer, $qcustomer, $currentArea, $currentAreaId)
171
+ {
172
+ if($currentArea == 'websites') {
173
+ $registered = Mage::app()->getWebsite($currentAreaId)->getConfig('quartic/config/registered/current');
174
+ } else {
175
+ $registered = Mage::getStoreConfig("quartic/config/registered/current", $currentAreaId);
176
+ }
177
+ $cache = Mage::app()->getCacheInstance();
178
+ /* @var $api Mage_Core_Model_Config */
179
+ $config = Mage::getModel('core/config');
180
+
181
+ /**
182
+ * First login - save id
183
+ */
184
+ if (empty($registered)) {
185
+ $config->saveConfig('quartic/config/registered/current', $qcustomer, $currentArea, $currentAreaId);
186
+ return false;
187
+ }
188
+ /*
189
+ * Changed accounts - clean previous data
190
+ */
191
+ if ($registered !== $qcustomer) {
192
+ /**
193
+ * Remove frames
194
+ */
195
+ /*
196
+ $frames = Mage::getModel('quartic/placement');
197
+ $collection = $frames->getCollection();
198
+ $collection->addFieldToFilter('api_name', $qcustomer);
199
+ foreach ($collection as $item) {
200
+ $item->delete();
201
+ }*/
202
+
203
+ $config->deleteConfig('quartic/config/modified_placements', $qcustomer);
204
+ $config->deleteConfig('quartic/config/catalog_id', $qcustomer);
205
+ $config->deleteConfig('quartic/frames_homepage', $qcustomer);
206
+ $config->deleteConfig('quartic/frames_category', $qcustomer);
207
+ $config->deleteConfig('quartic/frames_product', $qcustomer);
208
+ $config->deleteConfig('quartic/frames_cart', $qcustomer);
209
+
210
+ $config->saveConfig('quartic/config/registered/current', $qcustomer, $currentArea, $currentAreaId);
211
+
212
+ $cache->cleanType('config');
213
+ return true;
214
+ }
215
+ }
216
+ }
app/code/community/Quarticon/Quartic/Model/Observer/Frontend.php CHANGED
@@ -1,92 +1,92 @@
1
- <?php
2
-
3
- /**
4
- * Frontend events observer
5
- * Used to insert our custom blocks anywhere
6
- */
7
- class Quarticon_Quartic_Model_Observer_Frontend
8
- {
9
-
10
- /**
11
- * Places loaded in constructor
12
- * @var array
13
- */
14
- protected $places = array();
15
-
16
- /**
17
- * Constructor method.
18
- * Load configured insertion places and get places data from models
19
- *
20
- * TODO: Add some caching there and drop the cache on backend action
21
- */
22
- public function __construct()
23
- {
24
- /* @var $insert_model Quarticon_Quartic_Model_Insert */
25
- $insert_model = Mage::getModel('quartic/insert');
26
-
27
- $this->places = array();
28
- $this->places = $insert_model->loadPlaces('quartic/frames_homepage', 'quartic/insert_home', $this->places);
29
- $this->places = $insert_model->loadPlaces('quartic/frames_product', 'quartic/insert_product', $this->places);
30
- $this->places = $insert_model->loadPlaces('quartic/frames_cart', 'quartic/insert_cart', $this->places);
31
- $this->places = $insert_model->loadPlaces('quartic/frames_category', 'quartic/insert_category', $this->places);
32
- //var_dump($this->places);
33
- }
34
-
35
- /**
36
- * Insert quartic blocks where necessary
37
- *
38
- * @param type $observer
39
- */
40
- public function blockAbstractToHtmlAfter($observer)
41
- {
42
- $event = $observer->getEvent();
43
- /*
44
- * Observed block
45
- */
46
- $block_name = $event->getBlock()->getNameInLayout();
47
- /*
48
- * Check if it was selected in config
49
- */
50
- if (isset($this->places[$block_name])) {
51
- foreach ($this->places[$block_name] as $placement) {
52
- /**
53
- * Optional layout handle requirement
54
- */
55
- if (isset($placement['block_layout'])) {
56
- $handles = $event->getBlock()->getLayout()->getUpdate()->getHandles();
57
- if (!in_array($placement['block_layout'], $handles)) {
58
- return;
59
- }
60
- }
61
- /*
62
- * Get block html
63
- */
64
- $html = $event->getTransport()->getHtml();
65
- /*
66
- * Get QON frame html
67
- */
68
- //var_dump($placement);
69
- $frame = $event->getBlock()->getLayout()
70
- ->createBlock($placement['frame_block'])
71
- ->setTemplate($placement['frame_template'])
72
- ->setPlacement($placement)
73
- ->toHtml()
74
- ;
75
- /*
76
- * Combine htmls and insert them
77
- */
78
- if ($placement['block_position'] == 'before') {
79
- $event->getTransport()->setHtml($frame . $html);
80
- } else {
81
- $event->getTransport()->setHtml($html . $frame);
82
- }
83
- }
84
- }
85
- }
86
-
87
- public function controllerFrontSendResponseBefore($observer)
88
- {
89
- $front = $observer->getFront();
90
- $front->getResponse()->setHeader('Access-Control-Allow-Origin','api.quarticon.com,api.quartic.pl');
91
- }
92
- }
1
+ <?php
2
+
3
+ /**
4
+ * Frontend events observer
5
+ * Used to insert our custom blocks anywhere
6
+ */
7
+ class Quarticon_Quartic_Model_Observer_Frontend
8
+ {
9
+
10
+ /**
11
+ * Places loaded in constructor
12
+ * @var array
13
+ */
14
+ protected $places = array();
15
+
16
+ /**
17
+ * Constructor method.
18
+ * Load configured insertion places and get places data from models
19
+ *
20
+ * TODO: Add some caching there and drop the cache on backend action
21
+ */
22
+ public function __construct()
23
+ {
24
+ /* @var $insert_model Quarticon_Quartic_Model_Insert */
25
+ $insert_model = Mage::getModel('quartic/insert');
26
+
27
+ $this->places = array();
28
+ $this->places = $insert_model->loadPlaces('quartic/frames_homepage', 'quartic/insert_home', $this->places);
29
+ $this->places = $insert_model->loadPlaces('quartic/frames_product', 'quartic/insert_product', $this->places);
30
+ $this->places = $insert_model->loadPlaces('quartic/frames_cart', 'quartic/insert_cart', $this->places);
31
+ $this->places = $insert_model->loadPlaces('quartic/frames_category', 'quartic/insert_category', $this->places);
32
+ //var_dump($this->places);
33
+ }
34
+
35
+ /**
36
+ * Insert quartic blocks where necessary
37
+ *
38
+ * @param type $observer
39
+ */
40
+ public function blockAbstractToHtmlAfter($observer)
41
+ {
42
+ $event = $observer->getEvent();
43
+ /*
44
+ * Observed block
45
+ */
46
+ $block_name = $event->getBlock()->getNameInLayout();
47
+ /*
48
+ * Check if it was selected in config
49
+ */
50
+ if (isset($this->places[$block_name])) {
51
+ foreach ($this->places[$block_name] as $placement) {
52
+ /**
53
+ * Optional layout handle requirement
54
+ */
55
+ if (isset($placement['block_layout'])) {
56
+ $handles = $event->getBlock()->getLayout()->getUpdate()->getHandles();
57
+ if (!in_array($placement['block_layout'], $handles)) {
58
+ return;
59
+ }
60
+ }
61
+ /*
62
+ * Get block html
63
+ */
64
+ $html = $event->getTransport()->getHtml();
65
+ /*
66
+ * Get QON frame html
67
+ */
68
+ //var_dump($placement);
69
+ $frame = $event->getBlock()->getLayout()
70
+ ->createBlock($placement['frame_block'])
71
+ ->setTemplate($placement['frame_template'])
72
+ ->setPlacement($placement)
73
+ ->toHtml()
74
+ ;
75
+ /*
76
+ * Combine htmls and insert them
77
+ */
78
+ if ($placement['block_position'] == 'before') {
79
+ $event->getTransport()->setHtml($frame . $html);
80
+ } else {
81
+ $event->getTransport()->setHtml($html . $frame);
82
+ }
83
+ }
84
+ }
85
+ }
86
+
87
+ public function controllerFrontSendResponseBefore($observer)
88
+ {
89
+ $front = $observer->getFront();
90
+ $front->getResponse()->setHeader('Access-Control-Allow-Origin','api.quarticon.com,api.quartic.pl');
91
+ }
92
+ }
app/code/community/Quarticon/Quartic/Model/Order.php CHANGED
@@ -1,108 +1,140 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Order extends Mage_Core_Model_Abstract
4
- {
5
-
6
- const ITERATION_STEP = 1000;
7
-
8
- protected $_db = null;
9
- protected $_orders_table = null;
10
- protected $_order_items_table = null;
11
- protected $_products_table = null;
12
- protected $_store_id = null;
13
-
14
- protected function getConfig()
15
- {
16
- return Mage::getModel('quartic/config');
17
- }
18
-
19
- protected function _getStoreId()
20
- {
21
- if (!$this->_store_id) {
22
- $store = Mage::app()->getStore();
23
- $this->_store_id = $store->getStoreId();
24
- }
25
- return $this->_store_id;
26
- }
27
-
28
- protected function _getDB()
29
- {
30
- if (!$this->_db) {
31
- $this->_db = Mage::getSingleton('core/resource')->getConnection('core_read');
32
- }
33
- return $this->_db;
34
- }
35
-
36
- protected function _getOrdersTable()
37
- {
38
- if (!$this->_orders_table) {
39
- $this->_orders_table = $this->_getDB()->getTableName('sales_flat_order');
40
- }
41
- return $this->_orders_table;
42
- }
43
-
44
- protected function _getOrderItemsTable()
45
- {
46
- if (!$this->_order_items_table) {
47
- $this->_order_items_table = $this->_getDB()->getTableName('sales_flat_order_item');
48
- }
49
- return $this->_order_items_table;
50
- }
51
-
52
- protected function _getProductsTable()
53
- {
54
- if (!$this->_products_table) {
55
- $this->_products_table = $this->_getDB()->getTableName('catalog_product_entity');
56
- }
57
- return $this->_products_table;
58
- }
59
-
60
- public function getCollectionCount($storeId = false)
61
- {
62
- $sql = 'select count(*) as c from ' . $this->_getOrdersTable() . ' as o '
63
- . 'left join ' . $this->_getOrderItemsTable() . ' as i '
64
- . 'on(i.order_id = o.entity_id and i.parent_item_id is null) '
65
- ;
66
- if($storeId) {
67
- $storeId = (int)$storeId;
68
- $sql .= 'where o.store_id = ' . $storeId;
69
- }
70
-
71
- $q = $this->_getDB()->fetchRow($sql);
72
- return $q['c'];
73
- }
74
-
75
- public function getAll($page_num = 1, $page_size = 10, $storeId = false)
76
- {
77
- $sql = 'select o.increment_id, o.created_at, o.customer_id, i.product_id, i.sku, i.qty_ordered, i.price_incl_tax, i.product_type, p.sku as real_sku from ' . $this->_getOrdersTable() . ' as o '
78
- . 'left join ' . $this->_getOrderItemsTable() . ' as i on(i.order_id = o.entity_id and i.parent_item_id is null) '
79
- . 'left join ' . $this->_getProductsTable() . ' as p on(i.product_id = p.entity_id)';
80
-
81
- if($storeId) {
82
- $storeId = (int)$storeId;
83
- $sql .= ' where o.store_id = ' . $storeId;
84
- }
85
-
86
- $sql . ' order by i.item_id limit ' . (($page_num - 1) * $page_size) . ', ' . $page_size;
87
- $collection = $this->_getDB()->fetchAll($sql);
88
- foreach ($collection as $order) {
89
- $o = array(
90
- 'id' => $order['increment_id'],
91
- 'timestamp' => $order['created_at'],
92
- 'user' => $order['customer_id'] ? $order['customer_id'] : '',
93
- 'product' => Mage::helper('quartic')->getProduct($order),
94
- 'quantity' => $order['qty_ordered'] * 1,
95
- 'price' => $order['price_incl_tax']
96
- );
97
- $orders[] = $o;
98
- unset($o);
99
- }
100
- unset($collection);
101
- return $orders;
102
- }
103
-
104
- public function getFilePath()
105
- {
106
- return 'var/cache/quartic_order_feed.xml';
107
- }
108
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Model_Order extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ const ITERATION_STEP = 1000;
7
+
8
+ protected $_resource = null;
9
+ protected $_db = null;
10
+ protected $_orders_table = null;
11
+ protected $_order_items_table = null;
12
+ protected $_products_table = null;
13
+ protected $_store_id = null;
14
+
15
+ protected function getConfig()
16
+ {
17
+ return Mage::getModel('quartic/config');
18
+ }
19
+
20
+ protected function _getStoreId()
21
+ {
22
+ if (!$this->_store_id) {
23
+ $store = Mage::app()->getStore();
24
+ $this->_store_id = $store->getStoreId();
25
+ }
26
+ return $this->_store_id;
27
+ }
28
+
29
+ protected function _getResource()
30
+ {
31
+ if (!$this->_resource) {
32
+ $this->_resource = Mage::getSingleton('core/resource');
33
+ }
34
+ return $this->_resource;
35
+ }
36
+
37
+ protected function _getDB()
38
+ {
39
+ if (!$this->_db) {
40
+ $this->_db = $this->_getResource()->getConnection('core_read');
41
+ }
42
+ return $this->_db;
43
+ }
44
+
45
+ protected function _getOrdersTable()
46
+ {
47
+ if (!$this->_orders_table) {
48
+ $this->_orders_table = $this->_getResource()->getTableName('sales_flat_order');
49
+ }
50
+ return $this->_orders_table;
51
+ }
52
+
53
+ protected function _getOrderItemsTable()
54
+ {
55
+ if (!$this->_order_items_table) {
56
+ $this->_order_items_table = $this->_getResource()->getTableName('sales_flat_order_item');
57
+ }
58
+ return $this->_order_items_table;
59
+ }
60
+
61
+ protected function _getProductsTable()
62
+ {
63
+ if (!$this->_products_table) {
64
+ $this->_products_table = $this->_getResource()->getTableName('catalog_product_entity');
65
+ }
66
+ return $this->_products_table;
67
+ }
68
+
69
+ public function getCollectionCount($storeId = false)
70
+ {
71
+ $sql = 'select count(*) as c from ' . $this->_getOrdersTable() . ' as o '
72
+ . 'left join ' . $this->_getOrderItemsTable() . ' as i '
73
+ . 'on(i.order_id = o.entity_id and i.parent_item_id is null) '
74
+ ;
75
+ if($storeId) {
76
+ $storeId = (int)$storeId;
77
+ $sql .= 'where o.store_id = ' . $storeId;
78
+ }
79
+
80
+ $q = $this->_getDB()->fetchRow($sql);
81
+ return $q['c'];
82
+ }
83
+
84
+ public function getAll($page_num = 1, $page_size = 10, $storeId = false)
85
+ {
86
+ $sql = 'select o.increment_id, o.created_at, o.customer_id, i.product_id, i.sku, i.qty_ordered, i.price_incl_tax, i.product_type, p.sku as real_sku from ' . $this->_getOrdersTable() . ' as o '
87
+ . 'left join ' . $this->_getOrderItemsTable() . ' as i on(i.order_id = o.entity_id and i.parent_item_id is null) '
88
+ . 'left join ' . $this->_getProductsTable() . ' as p on(i.product_id = p.entity_id)';
89
+
90
+ if($storeId) {
91
+ $storeId = (int)$storeId;
92
+ $sql .= ' where o.store_id = ' . $storeId;
93
+ }
94
+
95
+ $sql . ' order by i.item_id limit ' . (($page_num - 1) * $page_size) . ', ' . $page_size;
96
+ $collection = $this->_getDB()->fetchAll($sql);
97
+ foreach ($collection as $order) {
98
+ $o = array(
99
+ 'id' => $order['increment_id'],
100
+ 'timestamp' => $order['created_at'],
101
+ 'user' => $order['customer_id'] ? $order['customer_id'] : '',
102
+ 'product' => Mage::helper('quartic')->getProduct($order),
103
+ 'quantity' => $order['qty_ordered'] * 1,
104
+ 'price' => $order['price_incl_tax']
105
+ );
106
+ $orders[] = $o;
107
+ unset($o);
108
+ }
109
+ unset($collection);
110
+ return $orders;
111
+ }
112
+
113
+ public function getFilePath()
114
+ {
115
+ return 'var/cache/quartic_order_feed.xml';
116
+ }
117
+
118
+ /**
119
+ * Send event "order history is ready" to quartic
120
+ * @param bool|int $storeId
121
+ */
122
+ public function sendTransacionsEvent($storeId = false) {
123
+ $helper = Mage::helper('quartic');
124
+ $api = Mage::getModel('quartic/client_api');
125
+ if (!$storeId) {
126
+ $storeId = 0;
127
+ }
128
+ $helper->log('sendTransacionsEvent, storeId: '.$storeId);
129
+ if ($helper->getStoreScopeData($storeId, 'orders')) {
130
+ $this->log('Orders history already sent: '.$storeId);
131
+ return;
132
+ }
133
+
134
+ $data = array(
135
+ 'url' => Mage::getUrl('quartic/feed/orders', array('store' => $storeId)),
136
+ );
137
+ $result = $api->post('transactions', array('data' => $data));
138
+ $helper->setStoreScopeData($storeId, 'orders', true, true);
139
+ }
140
+ }
app/code/community/Quarticon/Quartic/Model/Placement.php DELETED
@@ -1,166 +0,0 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Placement extends Mage_Core_Model_Abstract
4
- {
5
-
6
- protected $_options;
7
-
8
- protected function _construct()
9
- {
10
- $this->_init('quartic/placement');
11
- }
12
-
13
- /**
14
- * Return options for select field in configuration
15
- *
16
- * @param bool $isMultiselect
17
- * @return array
18
- */
19
- public function toOptionArray($isMultiselect = false)
20
- {
21
- if (!$this->_options) {
22
- $this->_options = $this->prepareOptionArray();
23
- }
24
-
25
- $options = $this->_options;
26
- if (!$isMultiselect) {
27
- array_unshift($options, array('value' => '', 'label' => Mage::helper('quartic')->__('--No Frame--')));
28
- }
29
-
30
- return $options;
31
- }
32
-
33
- /**
34
- * Return collection for toOptionArray function
35
- *
36
- * @return array
37
- */
38
- protected function prepareOptionArray()
39
- {
40
- return $this->getCollection()
41
- ->loadData()
42
- ->toOptionArray(false);
43
- }
44
-
45
- /**
46
- * Label used in configuration form
47
- *
48
- * @return type
49
- */
50
- public function getLabel()
51
- {
52
- return "{$this->getParentName()} - {$this->getName()} ({$this->getDivId()})";
53
- }
54
-
55
- /**
56
- * Request placements from API
57
- *
58
- * @return array
59
- */
60
- public function apiLoad($storeId)
61
- {
62
- try {
63
- /* @var $api Quarticon_Quartic_Model_Client_Api */
64
- $api = Mage::getModel('quartic/client_api');
65
-
66
- $ret = $api->get('placements',$storeId);
67
- } catch (Exception $e) {
68
- return array(
69
- 'status' => 'error',
70
- 'message' => $e->getMessage()
71
- );
72
- }
73
- return $this->apiLoaded($ret['body']['data'], $storeId);
74
- }
75
-
76
- /**
77
- * Insert or update placements returned from API
78
- *
79
- * @param array $data Decoded from json
80
- * @return array Ids of placements: qon_id=>magento_id
81
- */
82
- protected function apiLoaded($data = array(), $storeId)
83
- {
84
- $ret = array();
85
- foreach ($data as $placement) {
86
- try {
87
- $ret[$placement['id']] = $this->saveReplace($placement, $storeId);
88
- } catch (Exception $e) {
89
- Mage::logException($e);
90
- }
91
- }
92
- Mage::getModel('core/config')->saveConfig('quartic/config/modified_placements',
93
- Mage::getModel('core/date')->timestamp(), 'default', 0);
94
- Mage::app()->getCacheInstance()->cleanType('config');
95
- return $ret;
96
- }
97
-
98
- /**
99
- * FIXME: Updates
100
- * @param type $placement
101
- * @return type
102
- */
103
- protected function saveReplace($placement, $storeId)
104
- {
105
- $apiName = Mage::getStoreConfig("quartic/config/customer", $storeId);
106
- $check = $this->getCollection()
107
- ->addFieldToFilter('api_name', $apiName)
108
- ->addFieldToFilter('qon_id', $placement['id'])
109
- ->getFirstItem();
110
-
111
- $entity = $this;
112
- $entity
113
- ->setData(array(
114
- 'id' => $check->getId(),
115
- 'api_name' => $apiName,
116
- 'qon_id' => $placement['id'],
117
- 'qon_parent_id' => $placement['parent_id'],
118
- 'parent_name' => $placement['parent_name'],
119
- 'name' => $placement['name'],
120
- 'div_id' => $placement['div_id'],
121
- 'snippet' => $placement['snippet'],
122
- ));
123
-
124
- $entity->save();
125
-
126
- $entity->save();
127
- return $entity->getId();
128
- }
129
-
130
- public function getStoreId($allowAdmin = true)
131
- {
132
- $params = Mage::app()->getRequest()->getParams();
133
- if(isset($params['store'])) {
134
- $storeId = (is_numeric($params['store'])) ? (int)$params['store'] : Mage::getModel('core/store')->load($params['store'], 'code')->getId();
135
- } elseif(isset($params['website'])) {
136
- $website = (is_numeric($params['website'])) ? Mage::getModel('core/website')->load($params['website']) : Mage::getModel('core/website')->load($params['website'], 'code');
137
- $storeId = $website->getDefaultGroup()->getDefaultStoreId();
138
- } else {
139
- $storeId = Mage::app()->getStore()->getId();
140
- }
141
- if($storeId == 0 && !$allowAdmin) $storeId = Mage::app()->getDefaultStoreView()->getStoreId();
142
-
143
- return $storeId;
144
- }
145
-
146
- public function deleteAll($apiName = false)
147
- {
148
- $collection = $this->getCollection();
149
- if($apiName) {
150
- $collection->addFieldToFilter('api_name', $apiName);
151
- }
152
-
153
- try {
154
- foreach ($collection as $item) {
155
- $item->delete();
156
- }
157
- } catch (Exception $e) {
158
- return array(
159
- 'status' => 'error',
160
- 'message' => $e->getMessage()
161
- );
162
- }
163
-
164
- return true;
165
- }
166
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/Model/Placement/Cart.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Placement_Cart extends Quarticon_Quartic_Model_Placement
4
- {
5
-
6
- /**
7
- * Return collection for toOptionArray function
8
- *
9
- * @return array
10
- */
11
- protected function prepareOptionArray()
12
- {
13
- $storeId = $this->getStoreId();
14
- $apiName = Mage::getStoreConfig("quartic/config/customer", $storeId);
15
-
16
- $options = $this->getCollection()
17
- ->addFieldToSelect('*')
18
- ->addFieldToFilter('api_name', $apiName)
19
- ->addFieldToFilter('parent_name', array('eq' => 'CartPage'))
20
- ->loadData()
21
- ->toOptionArray(false);
22
- return $options;
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/Model/Placement/Category.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Placement_Category extends Quarticon_Quartic_Model_Placement
4
- {
5
-
6
- /**
7
- * Return collection for toOptionArray function
8
- *
9
- * @return array
10
- */
11
- protected function prepareOptionArray()
12
- {
13
- $storeId = $this->getStoreId();
14
- $apiName = Mage::getStoreConfig("quartic/config/customer", $storeId);
15
-
16
- $options = $this->getCollection()
17
- ->addFieldToSelect('*')
18
- ->addFieldToFilter('api_name', $apiName)
19
- ->addFilter('parent_name', array('eq' => 'CategoryPage'))
20
- ->loadData()
21
- ->toOptionArray(false);
22
- return $options;
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/Model/Placement/Home.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Placement_Home extends Quarticon_Quartic_Model_Placement
4
- {
5
-
6
- /**
7
- * Return collection for toOptionArray function
8
- *
9
- * @return array
10
- */
11
- protected function prepareOptionArray()
12
- {
13
- $storeId = $this->getStoreId();
14
- $apiName = Mage::getStoreConfig("quartic/config/customer", $storeId);
15
-
16
- $options = $this->getCollection()
17
- ->addFieldToSelect('*')
18
- ->addFieldToFilter('api_name', $apiName)
19
- ->addFilter('parent_name', array('eq' => 'HomePage'))
20
- ->loadData()
21
- ->toOptionArray(false);
22
- return $options;
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/Model/Placement/Product.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Model_Placement_Product extends Quarticon_Quartic_Model_Placement
4
- {
5
-
6
- /**
7
- * Return collection for toOptionArray function
8
- *
9
- * @return array
10
- */
11
- protected function prepareOptionArray()
12
- {
13
- $storeId = $this->getStoreId();
14
- $apiName = Mage::getStoreConfig("quartic/config/customer", $storeId);
15
-
16
- $options = $this->getCollection()
17
- ->addFieldToSelect('*')
18
- ->addFieldToFilter('api_name', $apiName)
19
- ->addFilter('parent_name', array('eq' => 'ProductPage'))
20
- ->loadData()
21
- ->toOptionArray(false);
22
- return $options;
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/Model/Product.php CHANGED
@@ -1,582 +1,620 @@
1
- <?php
2
-
3
- // TODO: $product->getFinalPrice() zapycha pamięć.
4
-
5
- class Quarticon_Quartic_Model_Product extends Mage_Core_Model_Abstract
6
- {
7
-
8
- const ITERATION_STEP_DEFAULT = 250;
9
- const CASTEGORIES_LIMIT = 6;
10
-
11
- protected $default_attribute_set_id = null;
12
- protected $_categories = array();
13
- protected $_imagesUrl = null;
14
- protected $_minQty = false;
15
- protected $_config = null;
16
- protected $_collectedConfigurablePrices = array();
17
- protected $_collectedGroupedPrices = array();
18
- protected $joinType = 'inner';
19
- protected $iterationStep = null;
20
- protected $mapping = null;
21
-
22
- protected function getConfig()
23
- {
24
- if (is_null($this->_config)) {
25
- $this->_config = Mage::getModel('quartic/config');
26
- }
27
- return $this->_config;
28
- }
29
-
30
- /**
31
- * Number of products per feed query
32
- * @param integer $store_id
33
- */
34
- public function getIterationStep($store_id = null)
35
- {
36
- if (is_null($this->iterationStep)) {
37
- $this->iterationStep = (int) Mage::getStoreConfig('quartic/config/feed/product/iteration_step', $store_id);
38
- }
39
- if (empty($this->iterationStep)) {
40
- $this->iterationStep = self::ITERATION_STEP_DEFAULT;
41
- }
42
- return $this->iterationStep;
43
- }
44
-
45
- protected function _getCollection()
46
- {
47
- $_product = Mage::getModel('catalog/product');
48
- $storeId = $this->_getStoreId();
49
-
50
- $collection = $_product
51
- ->setStoreId($storeId)
52
- ->getCollection()
53
- ->addStoreFilter($storeId)
54
- ;
55
- $updated = Mage::app()->getRequest()->getParam('updated');
56
- if ($updated) {
57
- $collection->addAttributeToFilter('updated_at', array('gteq' => $updated));
58
- }
59
- $productIds = Mage::app()->getRequest()->getParam('product');
60
- if ($productIds) {
61
- $collection->addAttributeToFilter('entity_id', explode(',',$productIds));
62
- }
63
- $websiteId = Mage::getModel('core/store')->load($storeId)->getWebsiteId();
64
- $collection->addPriceData(null,$websiteId);
65
- $collection = $this->_addQtyField($collection);
66
- $collection = $this->_addDisableFilters($collection);
67
- return $collection;
68
- }
69
-
70
- protected function _addDisableFilters($collection)
71
- {
72
- if (!$this->getConfig()->showDisabledProducts()) {
73
- $collection->addFieldToFilter('status', array('eq' => 1));
74
- }
75
-
76
- // $allowVisibility = $this->getConfig()->getVisibility();
77
- // $collection->addAttributeToFilter('visibility',array('in' => $allowVisibility));
78
-
79
- return $collection;
80
- }
81
-
82
- /**
83
- * If "min_qty" config value is greater than zero, qty is added to the products collection.
84
- */
85
- protected function _addQtyField($collection)
86
- {
87
- $storeId = $this->_getStoreId();
88
- $websiteId = ($storeId == 0) ? 1 : Mage::app()->getStore($storeId)->getWebsiteId();
89
- if ($this->getConfig()->getMinQty()) {
90
- $collection->joinField(
91
- 'qty', 'cataloginventory/stock_item', 'qty', 'product_id=entity_id', null, 'left'
92
- );
93
- }
94
- $collection->joinField('stock_status','cataloginventory/stock_status','stock_status',
95
- 'product_id=entity_id', array(
96
- 'stock_status' => Mage_CatalogInventory_Model_Stock_Status::STATUS_IN_STOCK,
97
- 'website_id' => $websiteId
98
- ));
99
- return $collection;
100
- }
101
-
102
- public function getCollectionCount()
103
- {
104
- return $this->_getCollection()->getSize();
105
- }
106
- /*
107
- * Get's product collection with attribute mapping
108
- */
109
-
110
- protected function _getFinalCollection($page_num = 1, $page_size = 10, $product_id = false)
111
- {
112
- $joinType = $this->joinType;
113
-
114
- $additional_attributes = $this->getMapping();
115
-
116
- $collection = $this->_getCollection()
117
- ->setPage($page_num, $page_size)
118
- ->addAttributeToSelect('price', $joinType)
119
- ->addAttributeToSelect('special_price', $joinType)
120
- ->addAttributeToSelect('name', $joinType)
121
- // ->addAttributeToSelect('category_ids', $joinType)
122
- ->addAttributeToSelect('visibility', $joinType)
123
- ->addAttributeToSelect('status', $joinType)
124
- ->addAttributeToSelect('url_path', $joinType)
125
- ->addAttributeToSelect('sku', $joinType);
126
- foreach ($additional_attributes as $code => $option) {
127
- //Join type does not work here
128
- $collection->addAttributeToSelect($option);
129
- }
130
- if ($product_id) {
131
- $collection->addFieldToFilter('entity_id', $product_id);
132
- }
133
- if ($this->getConfig()->addThumbs()) {
134
- $collection->addAttributeToSelect('image', $joinType);
135
- }
136
- $collection = $this->_addAdditionalAttributes($collection);
137
- $collection = $this->addImageAttributeToCollection($collection);
138
-
139
- return $collection;
140
- }
141
-
142
- public function getAll($page_num = 1, $page_size = 10)
143
- {
144
- $additional_attributes = $this->getMapping();
145
- $collection = $this->_getFinalCollection($page_num, $page_size, false);
146
- $offers = array();
147
- $product_items = $collection->getItems();
148
-
149
- $showConfigurableChilds = $this->getConfig()->getShowConfigurableChilds();
150
- $configurableChildPrice = $this->getConfig()->getConfigurableChildPrice();
151
- $configurableChildImage = $this->getConfig()->getConfigurableChildImage();
152
- $configurableChildRedirect = $this->getConfig()->getConfigurableChildRedirect();
153
- $map = $this->getMapping();
154
- $groupedChildPrice = $this->getConfig()->getGroupedChildPrice();
155
- $groupedChildImage = $this->getConfig()->getGroupedChildImage();
156
- $groupedChildRedirect = $this->getConfig()->getGroupedChildRedirect();
157
- foreach ($product_items as $id => $product) {
158
- if($product->getTypeId() == 'simple') {
159
- $configurable_id = $this->getConfigurableIdByChildId($product->getId());
160
- if ($configurable_id !== 0) {
161
- if($showConfigurableChilds == 0) { //$showConfigurableChilds == 0 - do not show child products of configurable
162
- continue;
163
- } elseif($configurableChildPrice == 1) { //$configurableChildPrice == 1 - get child product price from parent config
164
- if(!isset($this->_collectedConfigurablePrices[$configurable_id])) {
165
- $configurableProduct = Mage::getModel('catalog/product')->load($configurable_id);
166
- $this->_collectedConfigurablePrices[$configurable_id] = $this->getFinalPriceIncludingTax($configurableProduct,true);
167
- }
168
- // temporary force price for simple product that should show price from it's parent configurable
169
- $configurablePriceType = $this->getConfig()->getConfigurablePrice();
170
- $collectedPrice = $this->_collectedConfigurablePrices[$configurable_id];
171
- if(is_array($collectedPrice)) {
172
- if($configurablePriceType == 1) {
173
- $forcedFinalPrice = $collectedPrice['minPrice'];
174
- } elseif($configurablePriceType == 2) {
175
- $forcedFinalPrice = $collectedPrice['maxPrice'];
176
- }
177
- $product->setFinalPrice($forcedFinalPrice);
178
- } else {
179
- $product->setFinalPrice($this->_collectedConfigurablePrices[$configurable_id]);
180
- }
181
- $product->setSpecialPrice(null);
182
- $product->setData($map['old_price'],null);
183
- }
184
- if($configurableChildImage == 1) {
185
- if(!isset($configurableProduct)) $configurableProduct = Mage::getModel('catalog/product')->load($configurable_id);
186
- // temporary force image for simple product that should show image from it's parent configurable
187
- $product->setData('image',$configurableProduct->getData('image'));
188
- }
189
- if($configurableChildRedirect == 1) {
190
- if(!isset($configurableProduct)) $configurableProduct = Mage::getModel('catalog/product')->load($configurable_id);
191
- // temporary force url for simple product that should be redirected to it's parent configurable
192
- $product->setData('url',$configurableProduct->getProductUrl());
193
- }
194
- }
195
- $grouped_id = $this->getGroupedIdByChildId($product->getId());
196
- if ($grouped_id !== 0) {
197
- if($groupedChildPrice == 1) { //$groupedChildPrice == 1 - get child product price from parent config
198
- if(!isset($this->_collectedGroupedPrices[$grouped_id])) {
199
- $groupedProduct = Mage::getModel('catalog/product')->load($grouped_id);
200
- $this->_collectedGroupedPrices[$grouped_id] = $this->getFinalPriceIncludingTax($groupedProduct,true);
201
- }
202
- // temporary force price for simple product that should show price from it's parent configurable
203
- $product->setFinalPrice($this->_collectedGroupedPrices[$grouped_id][$product->getId()]);
204
- $product->setSpecialPrice(null);
205
- $product->setData($map['old_price'],null);
206
- }
207
- if($groupedChildImage == 1) {
208
- // temporary force image for simple product that should show image from it's parent configurable
209
- if(isset($groupedProduct) && $groupedProduct->getId()) {
210
- $product->setData('image',$groupedProduct->getData('image'));
211
- }
212
- }
213
- if($groupedChildRedirect == 1) {
214
- // temporary force url for simple product that should be redirected to it's parent grouped
215
- if(isset($groupedProduct) && $groupedProduct->getId()) {
216
- $product->setData('url', $groupedProduct->getProductUrl());
217
- }
218
- }
219
- }
220
- }
221
- $offer_item = $this->handleProductToGetOffer($product, $additional_attributes);
222
- if($offer_item) $offers[] = $offer_item;
223
- }
224
- $collection->clear();
225
- unset($collection);
226
- unset($media);
227
- return $offers;
228
- }
229
-
230
- protected function _getSingleProduct($product_id)
231
- {
232
- $collection = $this->_getFinalCollection(1, 1, $product_id);
233
- $product = $collection->getFirstItem();
234
- if ($product->getId()) {
235
- return $product;
236
- }
237
- return false;
238
- }
239
-
240
- /**
241
- * Method that prepares one product to be appended to $offers table
242
- *
243
- * $product - product to be processed
244
- * $images - object with media data
245
- * $additional_attributes - definitions of additional product attributes
246
- * $rewrite_url - URL that rewrites standard product URL. If null then no rewrite is executed
247
- */
248
- protected function handleProductToGetOffer($product, $additional_attributes = array())
249
- {
250
- if($product->getData('quarticon_exclude') == 1) return false;
251
-
252
- $map = $this->getMapping();
253
-
254
- $price = $product->getData($map['price']);
255
- $product->setPrice($price); // for proper getFinalPrice calculation
256
-
257
- /**
258
- * Map fields
259
- */
260
- $offer = array(
261
- 'id' => Mage::helper('quartic')->getProduct($product),
262
- 'title' => !empty($map['title']) ? $product->getData($map['title']) : '',
263
- 'price' => $this->getFinalPriceIncludingTax($product),
264
- 'old_price' => '',
265
- 'link' => $product->getProductUrl(),
266
- 'categories' => $this->getCategories($product->getCategoryIds()),
267
- 'status' => $this->_getStatus($product)
268
- );
269
- /**
270
- * Map custom fields
271
- */
272
- $i = 1;
273
- while ($i <= 5) {
274
- $key = 'custom' . $i;
275
- if (!empty($map[$key])) {
276
- $offer[$key] = $product->getData($map[$key]);
277
- }
278
- $i++;
279
- }
280
- $special_price = $product->getSpecialPrice();
281
- if ($special_price) {
282
- $offer['old_price'] = $this->getPriceIncludingTax($product);
283
- }
284
- if ($this->getConfig()->addThumbs()) {
285
- try {
286
- $offer['thumb'] = Mage::helper('catalog/image')->init($product, 'image',$product->getData('image'))->__toString();
287
- } catch (Exception $e) {
288
-
289
- }
290
- }
291
-
292
- if (!empty($author_mapping)) {
293
- $value = $product->getData($author_mapping);
294
- if (!empty($value)) {
295
- $options = $additional_attributes[$author_mapping];
296
- if (!empty($options)) {
297
- $offer['author'] = $options[$value];
298
- } else {
299
- $offer['author'] = $value;
300
- }
301
- }
302
- unset($value);
303
- }
304
- if (version_compare(Mage::getVersion(), '1.5.1.0', '>=')) {
305
- $product->clearInstance();
306
- }
307
- unset($product);
308
- return $offer;
309
- }
310
-
311
- /**
312
- * get attributes map for product feed via handleProductToGetOffer method
313
- *
314
- * @return Array
315
- *
316
- */
317
- public function getMapping()
318
- {
319
- if (is_null($this->mapping)) {
320
- $mapping = array();
321
- $collection = Mage::getModel('quartic/maps')->getCollection();
322
- foreach ($collection as $element) {
323
- $attr = $element->getData('magento_attribute');
324
- if (!empty($attr)) {
325
- $mapping[$element->getData('quartic_attribute')] = $attr;
326
- }
327
- }
328
- $this->mapping = $mapping;
329
- }
330
- return $this->mapping;
331
- }
332
-
333
- public function getFinalPriceIncludingTax($product,$collect = false)
334
- {
335
- if($product->getTypeId() == 'configurable') {
336
- $configurablePriceType = $this->getConfig()->getConfigurablePrice();
337
- if($configurablePriceType > 0) { // get price from configurable product
338
- if(!isset($this->_collectedConfigurablePrices[$product->getId()])) { // configurable product prices could be already collected
339
- $attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
340
- $pricesByAttributeValues = array();
341
- $basePrice = $product->getFinalPrice();
342
- foreach ($attributes as $attribute){
343
- $prices = $attribute->getPrices();
344
- foreach ($prices as $price){
345
- if ($price['is_percent']){ //if the price is specified in percents
346
- $pricesByAttributeValues[$price['value_index']] = (float)$price['pricing_value'] * $basePrice / 100;
347
- }
348
- else { //if the price is absolute value
349
- $pricesByAttributeValues[$price['value_index']] = (float)$price['pricing_value'];
350
- }
351
- }
352
- }
353
-
354
- $totalPrices = array();
355
- $simple = $product->getTypeInstance()->getUsedProducts();
356
- //loop through the products
357
- foreach ($simple as $sProduct){
358
- $optionsPrice = $basePrice;
359
- //loop through the configurable attributes
360
- foreach ($attributes as $attribute){
361
- $value = $sProduct->getData($attribute->getProductAttribute()->getAttributeCode());
362
- if (isset($pricesByAttributeValues[$value])){
363
- $optionsPrice += $pricesByAttributeValues[$value];
364
- }
365
- }
366
- $totalPrices[$sProduct->getId()] = $optionsPrice;
367
- }
368
- } else {
369
- $totalPrices = $this->_collectedConfigurablePrices[$product->getId()];
370
- }
371
-
372
- $minPrice = Mage::helper('tax')->getPrice($product, min($totalPrices), 2);
373
- $maxPrice = Mage::helper('tax')->getPrice($product, max($totalPrices), 2);
374
- }
375
-
376
- if(!$collect) {
377
- switch($configurablePriceType) {
378
- case 0:
379
- return Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), 2);
380
- break;
381
- case 1:
382
- return $minPrice;
383
- break;
384
- case 2:
385
- return $maxPrice;
386
- break;
387
- case 3:
388
- if($maxPrice - $minPrice) {
389
- return Mage::helper('tax')->getPrice($product, $minPrice, 2) . ' - ' . Mage::helper('tax')->getPrice($product, $maxPrice, 2);
390
- } else {
391
- return $maxPrice;
392
- }
393
- break;
394
- }
395
- } else { //just collect all prices and return it as associative array
396
- $result = $totalPrices;
397
- $result['minPrice'] = $minPrice;
398
- $result['maxPrice'] = $maxPrice;
399
- return $result;
400
- }
401
- } elseif($product->getTypeId() == 'grouped') {
402
- $groupedPriceType = $this->getConfig()->getGroupedChildPrice();
403
- $totalPrices = array();
404
- $simple = $product->getTypeInstance(true)->getAssociatedProducts($product);
405
- foreach ($simple as $sProduct){
406
- $totalPrices[$sProduct->getId()] = $sProduct->getFinalPrice();
407
- }
408
-
409
- $minPrice = Mage::helper('tax')->getPrice($product, min($totalPrices), 2);
410
- $maxPrice = Mage::helper('tax')->getPrice($product, max($totalPrices), 2);
411
-
412
- if(!$collect) {
413
- switch($groupedPriceType) {
414
- case 0:
415
- return $minPrice;
416
- break;
417
- case 1:
418
- return $maxPrice;
419
- break;
420
- }
421
- } else { //just collect all prices and return it as associative array
422
- $result = $totalPrices;
423
- $result['minPrice'] = $minPrice;
424
- $result['maxPrice'] = $maxPrice;
425
- return $result;
426
- }
427
- } else {
428
- $taxHelper = Mage::helper('tax');
429
- return $taxHelper->getPrice($product, $product->getFinalPrice(),($taxHelper->getPriceDisplayType() > 1));
430
- }
431
- }
432
-
433
- public function getPriceIncludingTax($product)
434
- {
435
- $taxHelper = Mage::helper('tax');
436
- return $taxHelper->getPrice($product, $product->getPrice(),($taxHelper->getPriceDisplayType() > 1));
437
- }
438
-
439
- protected function _addAdditionalAttributes($collection)
440
- {
441
- return $collection;
442
- }
443
-
444
- /**
445
- * Gets "min_qty" value from config.
446
- *
447
- * @return int
448
- */
449
- protected function _getMinQty()
450
- {
451
- if ($this->_minQty === false) {
452
- $this->_minQty = $this->getConfig()->getMinQty();
453
- }
454
- return $this->_minQty;
455
- }
456
-
457
- /**
458
- * Gets status for product in XML feed.
459
- * If product is invisible, status equals 0.
460
- * If product stock qty is lower than "min_qty" config value, status equals 0.
461
- * Else, status equals 1.
462
- *
463
- * @deprecated deprecated since version 0.5.6 with status attribute mapping
464
- * @param Mage_Catalog_Model_Product $product
465
- * @return bool
466
- */
467
- protected function _getStatus($product)
468
- {
469
- if($product->getTypeId() == 'configurable' || $product->getTypeId() == 'grouped') {
470
- return $product->isVisibleInSiteVisibility() && $product->isVisibleInCatalog();
471
- } else {
472
- return $product->isVisibleInSiteVisibility() && $product->isVisibleInCatalog() && ($this->_getMinQty() ? $product->getQty() >= $this->_getMinQty() : true);
473
- }
474
- }
475
-
476
- /**
477
- * Gets id of a configurable product for specified child product
478
- *
479
- * @param Mage_Catalog_Model_Product $child
480
- * @return int
481
- */
482
- public function getConfigurableIdByChildId($childId)
483
- {
484
- $ids = Mage::getSingleton('catalog/product_type_configurable')->getParentIdsByChild($childId);
485
- if (!empty($ids)) {
486
- return (int) array_shift($ids);
487
- }
488
- return 0;
489
- }
490
-
491
- /**
492
- * Gets id of a grouped product for specified child product
493
- *
494
- * @param int $childId
495
- * @return int
496
- */
497
- public function getGroupedIdByChildId($childId)
498
- {
499
- $ids = Mage::getSingleton('catalog/product_type_grouped')->getParentIdsByChild($childId);
500
- if (!empty($ids)) {
501
- return (int) array_shift($ids);
502
- }
503
- return 0;
504
- }
505
-
506
- protected function getCategories($categoryIds)
507
- {
508
- $joinType = $this->joinType;
509
- $categories = array();
510
- $categoryIdsToAdd = array();
511
- foreach ($categoryIds as $categoryId) {
512
- if (!isset($this->_categories[$categoryId])) {
513
- $categoryIdsToAdd[] = $categoryId;
514
- } else {
515
- $categories[$categoryId] = $this->_categories[$categoryId];
516
- }
517
- }
518
- if (!empty($categoryIdsToAdd)) {
519
- $collection = Mage::getModel('catalog/category')
520
- ->getCollection()
521
- ->addAttributeToSelect('name', $joinType)
522
- ->addAttributeToFilter('is_active', 1)
523
- ->addAttributeToFilter('entity_id', $categoryIdsToAdd)
524
- ->setPage(0, self::CASTEGORIES_LIMIT)
525
- ;
526
- foreach ($collection as $category) {
527
- $this->_categories[$category->getId()] = $category->getName();
528
- $categories[$category->getId()] = $category->getName();
529
- }
530
- }
531
- $categories = array_slice($categories, 0, 6, true);
532
- return $categories;
533
- }
534
-
535
-
536
- public function addImageAttributeToCollection($_productCollection) {
537
- $_mediaGalleryAttributeId = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'image')->getAttributeId();
538
- $core_resource = Mage::getSingleton('core/resource');
539
- $_read = $core_resource->getConnection('core_read');
540
-
541
- $count = count($_productCollection->getItems());
542
- if(!$count) {
543
- return $_productCollection;
544
- }
545
-
546
- $all_ids = array();
547
- foreach($_productCollection->getItems() as $item) {
548
- $all_ids[] = $item->getId();
549
- }
550
-
551
- $query = 'SELECT `entity_id`,`value` FROM `' . $core_resource->getTableName('catalog_product_entity_varchar') . '` WHERE `attribute_id` = ' . $_read->quote($_mediaGalleryAttributeId) . ' AND `entity_id` IN (' . $_read->quote($all_ids) . ');';
552
- $_imagesData = $_read->fetchAll($query);
553
-
554
- $images = array();
555
- foreach($_imagesData as $_imageData) {
556
- $images[$_imageData['entity_id']] = $_imageData['value'];
557
- }
558
-
559
- foreach ($_productCollection->getItems() as $_product) {
560
- $_productId = $_product->getData('entity_id');
561
- if (!empty($images[$_productId])) {
562
- $_product->setData('image', $images[$_productId]);
563
- }
564
- }
565
- unset($_imagesData);
566
-
567
- return $_productCollection;
568
- }
569
-
570
- private function _getStoreId()
571
- {
572
- // Store is already set with quartic/cron model
573
- // $params = Mage::app()->getRequest()->getParams();
574
- // if(isset($params['store'])) {
575
- // $storeId = (is_numeric($params['store'])) ? (int)$params['store'] : Mage::getModel('core/store')->load($params['store'], 'code')->getId();
576
- // } else {
577
- $storeId = Mage::app()->getStore()->getId();
578
- // }
579
-
580
- return $storeId;
581
- }
582
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // TODO: $product->getFinalPrice() zapycha pamięć.
4
+
5
+ class Quarticon_Quartic_Model_Product extends Mage_Core_Model_Abstract
6
+ {
7
+
8
+ const ITERATION_STEP_DEFAULT = 250;
9
+
10
+ protected $default_attribute_set_id = null;
11
+ protected $_categories = array();
12
+ protected $_imagesUrl = null;
13
+ protected $_minQty = false;
14
+ protected $_config = null;
15
+ protected $_collectedConfigurablePrices = array();
16
+ protected $_collectedGroupedPrices = array();
17
+ protected $joinType = 'inner';
18
+ protected $iterationStep = null;
19
+ protected $mapping = null;
20
+
21
+ protected function getConfig()
22
+ {
23
+ if (is_null($this->_config)) {
24
+ $this->_config = Mage::getModel('quartic/config');
25
+ }
26
+ return $this->_config;
27
+ }
28
+
29
+ /**
30
+ * Number of products per feed query
31
+ * @param integer $store_id
32
+ */
33
+ public function getIterationStep($store_id = null)
34
+ {
35
+ if (is_null($this->iterationStep)) {
36
+ $this->iterationStep = (int) Mage::getStoreConfig('quartic/config/feed/product/iteration_step', $store_id);
37
+ }
38
+ if (empty($this->iterationStep)) {
39
+ $this->iterationStep = self::ITERATION_STEP_DEFAULT;
40
+ }
41
+ return $this->iterationStep;
42
+ }
43
+
44
+ /**
45
+ * Get products
46
+ * @param bool $simple simple visibility filter rules?
47
+ * @return mixed
48
+ */
49
+ protected function _getCollection($simple = false)
50
+ {
51
+ $_product = Mage::getModel('catalog/product');
52
+ $storeId = $this->_getStoreId();
53
+
54
+ $collection = $_product
55
+ ->setStoreId($storeId)
56
+ ->getCollection()
57
+ ->addStoreFilter($storeId)
58
+ ;
59
+ $updated = Mage::app()->getRequest()->getParam('updated');
60
+ if ($updated) {
61
+ $collection->addAttributeToFilter('updated_at', array('gteq' => $updated));
62
+ }
63
+ $productIds = Mage::app()->getRequest()->getParam('product');
64
+ if ($productIds) {
65
+ $collection->addAttributeToFilter('entity_id', explode(',',$productIds));
66
+ }
67
+
68
+ $collection = $this->_addQtyField($collection);
69
+ if (!$simple) {
70
+ $collection = $this->_addDisableFilters($collection);
71
+ } else {
72
+ $collection
73
+ ->addAttributeToFilter('type_id', array(
74
+ Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
75
+ Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE,
76
+ Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL,
77
+ Mage_Catalog_Model_Product_Type::TYPE_BUNDLE,
78
+ 'downloadable'
79
+ ))
80
+ ->addAttributeToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
81
+ }
82
+ return $collection;
83
+ }
84
+
85
+ /**
86
+ * Define visibility filters from config settings
87
+ * @param $collection
88
+ * @return mixed
89
+ */
90
+ protected function _addDisableFilters($collection)
91
+ {
92
+ if (!$this->getConfig()->showDisabledProducts()) {
93
+ $collection->addFieldToFilter('status', array('eq' => 1));
94
+ }
95
+
96
+ // $allowVisibility = $this->getConfig()->getVisibility();
97
+ // $collection->addAttributeToFilter('visibility',array('in' => $allowVisibility));
98
+
99
+ return $collection;
100
+ }
101
+
102
+ /**
103
+ * If "min_qty" config value is greater than zero, qty is added to the products collection.
104
+ */
105
+ protected function _addQtyField($collection)
106
+ {
107
+ $storeId = $this->_getStoreId();
108
+ $websiteId = ($storeId == 0) ? 1 : Mage::app()->getStore($storeId)->getWebsiteId();
109
+ if ($this->getConfig()->getMinQty()) {
110
+ $collection->joinField(
111
+ 'qty', 'cataloginventory/stock_item', 'qty', 'product_id=entity_id', null, 'left'
112
+ );
113
+ }
114
+ $collection->joinField('stock_status','cataloginventory/stock_status','stock_status',
115
+ 'product_id=entity_id', array(
116
+ 'stock_status' => Mage_CatalogInventory_Model_Stock_Status::STATUS_IN_STOCK,
117
+ 'website_id' => $websiteId
118
+ ));
119
+ return $collection;
120
+ }
121
+
122
+ /**
123
+ * Get collection items count
124
+ * @param bool $simple simple visibility filter rules?
125
+ * @return mixed
126
+ */
127
+ public function getCollectionCount($simple = false)
128
+ {
129
+ return $this->_getCollection($simple)->getSize();
130
+ }
131
+
132
+ /*
133
+ * Get's product collection with attribute mapping
134
+ */
135
+ protected function _getFinalCollection($page_num = 1, $page_size = 10, $product_id = false)
136
+ {
137
+ $joinType = $this->joinType;
138
+
139
+ $additional_attributes = $this->getMapping();
140
+
141
+ $collection = $this->_getCollection()
142
+ ->setPage($page_num, $page_size)
143
+ ->addAttributeToSelect('price', $joinType)
144
+ ->addAttributeToSelect('special_price', $joinType)
145
+ ->addAttributeToSelect('name', $joinType)
146
+ ->addAttributeToSelect('category_ids', $joinType)
147
+ ->addAttributeToSelect('visibility', $joinType)
148
+ ->addAttributeToSelect('status', $joinType)
149
+ ->addAttributeToSelect('url_path', $joinType)
150
+ ->addAttributeToSelect('sku', $joinType);
151
+ foreach ($additional_attributes as $code => $option) {
152
+ //Join type does not work here
153
+ $collection->addAttributeToSelect($option);
154
+ }
155
+ if ($product_id) {
156
+ $collection->addFieldToFilter('entity_id', $product_id);
157
+ }
158
+ if ($this->getConfig()->addThumbs()) {
159
+ $collection->addAttributeToSelect('image', $joinType);
160
+ }
161
+ $collection = $this->_addAdditionalAttributes($collection);
162
+ $collection = $this->addImageAttributeToCollection($collection);
163
+
164
+ return $collection;
165
+ }
166
+
167
+ public function getAll($page_num = 1, $page_size = 10)
168
+ {
169
+ $additional_attributes = $this->getMapping();
170
+ $collection = $this->_getFinalCollection($page_num, $page_size, false);
171
+ $offers = array();
172
+ $product_items = $collection->getItems();
173
+
174
+ $showConfigurableChilds = $this->getConfig()->getShowConfigurableChilds();
175
+ $configurableChildPrice = $this->getConfig()->getConfigurableChildPrice();
176
+ $configurableChildImage = $this->getConfig()->getConfigurableChildImage();
177
+ $configurableChildRedirect = $this->getConfig()->getConfigurableChildRedirect();
178
+ $map = $this->getMapping();
179
+ $groupedChildPrice = $this->getConfig()->getGroupedChildPrice();
180
+ $groupedChildImage = $this->getConfig()->getGroupedChildImage();
181
+ $groupedChildRedirect = $this->getConfig()->getGroupedChildRedirect();
182
+ foreach ($product_items as $id => $product) {
183
+ if($product->getTypeId() == 'simple') {
184
+ $configurable_id = $this->getConfigurableIdByChildId($product->getId());
185
+ if ($configurable_id !== 0) {
186
+ if($showConfigurableChilds == 0) { //$showConfigurableChilds == 0 - do not show child products of configurable
187
+ continue;
188
+ } elseif($configurableChildPrice == 1) { //$configurableChildPrice == 1 - get child product price from parent config
189
+ if(!isset($this->_collectedConfigurablePrices[$configurable_id])) {
190
+ $configurableProduct = Mage::getModel('catalog/product')->load($configurable_id);
191
+ $this->_collectedConfigurablePrices[$configurable_id] = $this->getFinalPriceIncludingTax($configurableProduct,true);
192
+ }
193
+ // temporary force price for simple product that should show price from it's parent configurable
194
+ $product->setFinalPrice($this->_collectedConfigurablePrices[$configurable_id]);
195
+ $product->setSpecialPrice(null);
196
+ $product->setData($map['old_price'],null);
197
+ }
198
+ if($configurableChildImage == 1) {
199
+ if(!isset($configurableProduct)) $configurableProduct = Mage::getModel('catalog/product')->load($configurable_id);
200
+ // temporary force image for simple product that should show image from it's parent configurable
201
+ $product->setData('image',$configurableProduct->getData('image'));
202
+ }
203
+ if($configurableChildRedirect == 1) {
204
+ if(!isset($configurableProduct)) $configurableProduct = Mage::getModel('catalog/product')->load($configurable_id);
205
+ // temporary force url for simple product that should be redirected to it's parent configurable
206
+ $product->setData('url',$configurableProduct->getProductUrl());
207
+ }
208
+ }
209
+ $grouped_id = $this->getGroupedIdByChildId($product->getId());
210
+ if ($grouped_id !== 0) {
211
+ if($groupedChildPrice == 1) { //$groupedChildPrice == 1 - get child product price from parent config
212
+ if(!isset($this->_collectedGroupedPrices[$grouped_id])) {
213
+ $groupedProduct = Mage::getModel('catalog/product')->load($grouped_id);
214
+ $this->_collectedGroupedPrices[$grouped_id] = $this->getFinalPriceIncludingTax($groupedProduct,true);
215
+ }
216
+ // temporary force price for simple product that should show price from it's parent configurable
217
+ $product->setFinalPrice($this->_collectedGroupedPrices[$grouped_id][$product->getId()]);
218
+ $product->setSpecialPrice(null);
219
+ $product->setData($map['old_price'],null);
220
+ }
221
+ if($groupedChildImage == 1) {
222
+ // temporary force image for simple product that should show image from it's parent configurable
223
+ $product->setData('image',$groupedProduct->getData('image'));
224
+ }
225
+ if($groupedChildRedirect == 1) {
226
+ // temporary force url for simple product that should be redirected to it's parent grouped
227
+ $product->setData('url',$groupedProduct->getProductUrl());
228
+ }
229
+ }
230
+ }
231
+ $offer_item = $this->handleProductToGetOffer($product, $additional_attributes);
232
+ if($offer_item) $offers[] = $offer_item;
233
+ }
234
+ $collection->clear();
235
+ unset($collection);
236
+ unset($media);
237
+ return $offers;
238
+ }
239
+
240
+ /**
241
+ * Get simple (id, url) products list array
242
+ * @param int $page_num
243
+ * @param int $page_size
244
+ * @return array
245
+ */
246
+ public function getSimpleProductList($page_num = 1, $page_size = 10) {
247
+ $collection = $this->_getCollection(true)
248
+ ->setPage($page_num, $page_size)
249
+ ->addAttributeToSelect('url_path', $this->joinType);
250
+ $product_items = $collection->getItems();
251
+
252
+ $feed = array();
253
+ $model = Mage::getModel('catalog/product');
254
+ $helper = Mage::helper('quartic');
255
+ foreach ($product_items as $item) {
256
+ $id = $helper->getProduct($item);
257
+ $product = $model->load($id);
258
+ if($product->getData('quarticon_exclude') == 1) {
259
+ continue;
260
+ }
261
+ $feed[] = array(
262
+ 'id' => $id,
263
+ 'link' => $item->getProductUrl()
264
+ );
265
+ }
266
+ return $feed;
267
+ }
268
+
269
+ protected function _getSingleProduct($product_id)
270
+ {
271
+ $collection = $this->_getFinalCollection(1, 1, $product_id);
272
+ $product = $collection->getFirstItem();
273
+ if ($product->getId()) {
274
+ return $product;
275
+ }
276
+ return false;
277
+ }
278
+
279
+ /**
280
+ * Method that prepares one product to be appended to $offers table
281
+ *
282
+ * $product - product to be processed
283
+ * $images - object with media data
284
+ * $additional_attributes - definitions of additional product attributes
285
+ * $rewrite_url - URL that rewrites standard product URL. If null then no rewrite is executed
286
+ */
287
+ protected function handleProductToGetOffer($product, $additional_attributes = array())
288
+ {
289
+ if($product->getData('quarticon_exclude') == 1) return false;
290
+
291
+ $category_ids = array_slice($product->getCategoryIds(), 0, 6);
292
+ $map = $this->getMapping();
293
+
294
+ $price = $product->getData($map['price']);
295
+ $product->setPrice($price); // for proper getFinalPrice calculation
296
+
297
+ /**
298
+ * Map fields
299
+ */
300
+ $offer = array(
301
+ 'id' => Mage::helper('quartic')->getProduct($product),
302
+ 'title' => !empty($map['title']) ? $product->getData($map['title']) : '',
303
+ 'price' => $this->getFinalPriceIncludingTax($product),
304
+ 'old_price' => !empty($map['old_price']) ? $product->getData($map['old_price']) : '',
305
+ 'link' => $product->getProductUrl(),
306
+ 'categories' => $this->getCategories($category_ids),
307
+ 'status' => $this->_getStatus($product)
308
+ );
309
+ /**
310
+ * Map custom fields
311
+ */
312
+ $i = 1;
313
+ while ($i <= 5) {
314
+ $key = 'custom' . $i;
315
+ if (!empty($map[$key])) {
316
+ $offer[$key] = $product->getData($map[$key]);
317
+ }
318
+ $i++;
319
+ }
320
+ $special_price = $product->getSpecialPrice();
321
+ if ($special_price) {
322
+ $offer['old_price'] = $this->getPriceIncludingTax($product);
323
+ }
324
+ if ($this->getConfig()->addThumbs()) {
325
+ try {
326
+ $offer['thumb'] = Mage::helper('catalog/image')->init($product, 'image',$product->getData('image'))->__toString();
327
+ } catch (Exception $e) {
328
+
329
+ }
330
+ }
331
+
332
+ if (!empty($author_mapping)) {
333
+ $value = $product->getData($author_mapping);
334
+ if (!empty($value)) {
335
+ $options = $additional_attributes[$author_mapping];
336
+ if (!empty($options)) {
337
+ $offer['author'] = $options[$value];
338
+ } else {
339
+ $offer['author'] = $value;
340
+ }
341
+ }
342
+ unset($value);
343
+ }
344
+ if (version_compare(Mage::getVersion(), '1.5.1.0', '>=')) {
345
+ $product->clearInstance();
346
+ }
347
+ unset($product);
348
+ return $offer;
349
+ }
350
+
351
+ /**
352
+ * get attributes map for product feed via handleProductToGetOffer method
353
+ *
354
+ * @return Array
355
+ *
356
+ */
357
+ public function getMapping()
358
+ {
359
+ if (is_null($this->mapping)) {
360
+ $mapping = array();
361
+ $collection = Mage::getModel('quartic/maps')->getCollection();
362
+ foreach ($collection as $element) {
363
+ $attr = $element->getData('magento_attribute');
364
+ if (!empty($attr)) {
365
+ $mapping[$element->getData('quartic_attribute')] = $attr;
366
+ }
367
+ }
368
+ $this->mapping = $mapping;
369
+ }
370
+ return $this->mapping;
371
+ }
372
+
373
+ public function getFinalPriceIncludingTax($product,$collect = false)
374
+ {
375
+ if($product->getTypeId() == 'configurable') {
376
+ $configurablePriceType = $this->getConfig()->getConfigurablePrice();
377
+ if($configurablePriceType > 0) { // get price from configurable product
378
+ if(!isset($this->_collectedConfigurablePrices[$product->getId()])) { // configurable product prices could be already collected
379
+ $attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
380
+ $pricesByAttributeValues = array();
381
+ $basePrice = $product->getFinalPrice();
382
+ foreach ($attributes as $attribute){
383
+ $prices = $attribute->getPrices();
384
+ foreach ($prices as $price){
385
+ if ($price['is_percent']){ //if the price is specified in percents
386
+ $pricesByAttributeValues[$price['value_index']] = (float)$price['pricing_value'] * $basePrice / 100;
387
+ }
388
+ else { //if the price is absolute value
389
+ $pricesByAttributeValues[$price['value_index']] = (float)$price['pricing_value'];
390
+ }
391
+ }
392
+ }
393
+
394
+ $totalPrices = array();
395
+ $simple = $product->getTypeInstance()->getUsedProducts();
396
+ //loop through the products
397
+ foreach ($simple as $sProduct){
398
+ $optionsPrice = $basePrice;
399
+ //loop through the configurable attributes
400
+ foreach ($attributes as $attribute){
401
+ $value = $sProduct->getData($attribute->getProductAttribute()->getAttributeCode());
402
+ if (isset($pricesByAttributeValues[$value])){
403
+ $optionsPrice += $pricesByAttributeValues[$value];
404
+ }
405
+ }
406
+ $totalPrices[$sProduct->getId()] = $optionsPrice;
407
+ }
408
+ } else {
409
+ $totalPrices = $this->_collectedConfigurablePrices[$product->getId()];
410
+ }
411
+
412
+ $minPrice = Mage::helper('tax')->getPrice($product, min($totalPrices), 2);
413
+ $maxPrice = Mage::helper('tax')->getPrice($product, max($totalPrices), 2);
414
+ }
415
+
416
+ if(!$collect) {
417
+ switch($configurablePriceType) {
418
+ case 0:
419
+ return Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), 2);
420
+ break;
421
+ case 1:
422
+ return $minPrice;
423
+ break;
424
+ case 2:
425
+ return $maxPrice;
426
+ break;
427
+ case 3:
428
+ if($maxPrice - $minPrice) {
429
+ return Mage::helper('tax')->getPrice($product, $minPrice, 2) . ' - ' . Mage::helper('tax')->getPrice($product, $maxPrice, 2);
430
+ } else {
431
+ return $maxPrice;
432
+ }
433
+ break;
434
+ }
435
+ } else { //just collect all prices and return it as associative array
436
+ $result = $totalPrices;
437
+ $result['minPrice'] = $minPrice;
438
+ $result['maxPrice'] = $maxPrice;
439
+ return $result;
440
+ }
441
+ } elseif($product->getTypeId() == 'grouped') {
442
+ $groupedPriceType = $this->getConfig()->getGroupedChildPrice();
443
+ $totalPrices = array();
444
+ $simple = $product->getTypeInstance(true)->getAssociatedProducts($product);
445
+ foreach ($simple as $sProduct){
446
+ $totalPrices[$sProduct->getId()] = $sProduct->getFinalPrice();
447
+ }
448
+
449
+ $minPrice = Mage::helper('tax')->getPrice($product, min($totalPrices), 2);
450
+ $maxPrice = Mage::helper('tax')->getPrice($product, max($totalPrices), 2);
451
+
452
+ if(!$collect) {
453
+ switch($groupedPriceType) {
454
+ case 0:
455
+ return $minPrice;
456
+ break;
457
+ case 1:
458
+ return $maxPrice;
459
+ break;
460
+ }
461
+ } else { //just collect all prices and return it as associative array
462
+ $result = $totalPrices;
463
+ $result['minPrice'] = $minPrice;
464
+ $result['maxPrice'] = $maxPrice;
465
+ return $result;
466
+ }
467
+ } else {
468
+ return Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), 2);
469
+ }
470
+ }
471
+
472
+ public function getPriceIncludingTax($product)
473
+ {
474
+ return Mage::helper('tax')->getPrice($product, $product->getPrice(), 2);
475
+ }
476
+
477
+ protected function _addAdditionalAttributes($collection)
478
+ {
479
+ return $collection;
480
+ }
481
+
482
+ /**
483
+ * Gets "min_qty" value from config.
484
+ *
485
+ * @return int
486
+ */
487
+ protected function _getMinQty()
488
+ {
489
+ if ($this->_minQty === false) {
490
+ $this->_minQty = $this->getConfig()->getMinQty();
491
+ }
492
+ return $this->_minQty;
493
+ }
494
+
495
+ /**
496
+ * Gets status for product in XML feed.
497
+ * If product is invisible, status equals 0.
498
+ * If product stock qty is lower than "min_qty" config value, status equals 0.
499
+ * Else, status equals 1.
500
+ *
501
+ * @deprecated deprecated since version 0.5.6 with status attribute mapping
502
+ * @param Mage_Catalog_Model_Product $product
503
+ * @return bool
504
+ */
505
+ protected function _getStatus($product)
506
+ {
507
+ if($product->getTypeId() == 'configurable' || $product->getTypeId() == 'grouped') {
508
+ return $product->isVisibleInSiteVisibility() && $product->isVisibleInCatalog();
509
+ } else {
510
+ return $product->isVisibleInSiteVisibility() && $product->isVisibleInCatalog() && ($this->_getMinQty() ? $product->getQty() >= $this->_getMinQty() : true);
511
+ }
512
+ }
513
+
514
+ /**
515
+ * Gets id of a configurable product for specified child product
516
+ *
517
+ * @param Mage_Catalog_Model_Product $child
518
+ * @return int
519
+ */
520
+ public function getConfigurableIdByChildId($childId)
521
+ {
522
+ $ids = Mage::getSingleton('catalog/product_type_configurable')->getParentIdsByChild($childId);
523
+ if (!empty($ids)) {
524
+ return (int) array_shift($ids);
525
+ }
526
+ return 0;
527
+ }
528
+
529
+ /**
530
+ * Gets id of a grouped product for specified child product
531
+ *
532
+ * @param int $childId
533
+ * @return int
534
+ */
535
+ public function getGroupedIdByChildId($childId)
536
+ {
537
+ $ids = Mage::getSingleton('catalog/product_type_grouped')->getParentIdsByChild($childId);
538
+ if (!empty($ids)) {
539
+ return (int) array_shift($ids);
540
+ }
541
+ return 0;
542
+ }
543
+
544
+ protected function getCategories($categoryIds)
545
+ {
546
+ $joinType = $this->joinType;
547
+ $categories = array();
548
+ $categoryIdsToAdd = array();
549
+ foreach ($categoryIds as $categoryId) {
550
+ if (!isset($this->_categories[$categoryId])) {
551
+ $categoryIdsToAdd[] = $categoryId;
552
+ } else {
553
+ $categories[$categoryId] = $this->_categories[$categoryId];
554
+ }
555
+ }
556
+ if (!empty($categoryIdsToAdd)) {
557
+ $collection = Mage::getModel('catalog/category')
558
+ ->getCollection()
559
+ ->addAttributeToSelect('name', $joinType)
560
+ ->addAttributeToFilter('entity_id', $categoryIdsToAdd)
561
+ ->setPage(0, count($categoryIdsToAdd));
562
+ foreach ($collection as $category) {
563
+ $this->_categories[$category->getId()] = $category->getName();
564
+ $categories[$category->getId()] = $category->getName();
565
+ }
566
+ }
567
+ return $categories;
568
+ }
569
+
570
+
571
+ public function addImageAttributeToCollection($_productCollection) {
572
+ $_mediaGalleryAttributeId = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'image')->getAttributeId();
573
+ $core_resource = Mage::getSingleton('core/resource');
574
+ $_read = $core_resource->getConnection('core_read');
575
+
576
+ $count = count($_productCollection->getItems());
577
+ if(!$count) {
578
+ return $_productCollection;
579
+ }
580
+
581
+ $all_ids = array();
582
+ foreach($_productCollection->getItems() as $item) {
583
+ $all_ids[] = $item->getId();
584
+ }
585
+
586
+ $query = 'SELECT `entity_id`,`value` FROM `' . $core_resource->getTableName('catalog_product_entity_varchar') . '` WHERE `attribute_id` = ' . $_read->quote($_mediaGalleryAttributeId) . ' AND `entity_id` IN (' . $_read->quote($all_ids) . ');';
587
+ $_imagesData = $_read->fetchAll($query);
588
+
589
+ $images = array();
590
+ foreach($_imagesData as $_imageData) {
591
+ $images[$_imageData['entity_id']] = $_imageData['value'];
592
+ }
593
+
594
+ foreach ($_productCollection->getItems() as $_product) {
595
+ $_productId = $_product->getData('entity_id');
596
+ if (!empty($images[$_productId])) {
597
+ $_product->setData('image', $images[$_productId]);
598
+ }
599
+ }
600
+ unset($_imagesData);
601
+
602
+ return $_productCollection;
603
+ }
604
+
605
+ /**
606
+ * Get store id (from request parameter or detect)
607
+ * @return int
608
+ */
609
+ private function _getStoreId()
610
+ {
611
+ $params = Mage::app()->getRequest()->getParams();
612
+ if(isset($params['store'])) {
613
+ $storeId = (is_numeric($params['store'])) ? (int)$params['store'] : Mage::getModel('core/store')->load($params['store'], 'code')->getId();
614
+ } else {
615
+ $storeId = Mage::app()->getStore()->getId();
616
+ }
617
+
618
+ return $storeId;
619
+ }
620
+ }
app/code/community/Quarticon/Quartic/Model/System/Config/Source/Configurablechildimage.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
-
3
-
4
-
5
- class Quarticon_Quartic_Model_System_Config_Source_Configurablechildimage
6
- {
7
- protected $_options;
8
-
9
- public function toOptionArray()
10
- {
11
- if (!$this->_options) {
12
- $this->_options[] = array('value' => 0, 'label' => Mage::helper('quartic')->__('Get from simple product'));
13
- $this->_options[] = array('value' => 1, 'label' => Mage::helper('quartic')->__('Get from parent product'));
14
- }
15
- return $this->_options;
16
- }
17
- }
1
+ <?php
2
+
3
+
4
+
5
+ class Quarticon_Quartic_Model_System_Config_Source_Configurablechildimage
6
+ {
7
+ protected $_options;
8
+
9
+ public function toOptionArray()
10
+ {
11
+ if (!$this->_options) {
12
+ $this->_options[] = array('value' => 0, 'label' => Mage::helper('quartic')->__('Get from simple product'));
13
+ $this->_options[] = array('value' => 1, 'label' => Mage::helper('quartic')->__('Get from parent product'));
14
+ }
15
+ return $this->_options;
16
+ }
17
+ }
app/code/community/Quarticon/Quartic/Model/System/Config/Source/Configurablechildprice.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
-
3
-
4
-
5
- class Quarticon_Quartic_Model_System_Config_Source_Configurablechildprice
6
- {
7
- protected $_options;
8
-
9
- public function toOptionArray()
10
- {
11
- if (!$this->_options) {
12
- $this->_options[] = array('value' => 0, 'label' => Mage::helper('quartic')->__('Get from simple product'));
13
- $this->_options[] = array('value' => 1, 'label' => Mage::helper('quartic')->__('Get from parent product'));
14
- }
15
- return $this->_options;
16
- }
17
- }
1
+ <?php
2
+
3
+
4
+
5
+ class Quarticon_Quartic_Model_System_Config_Source_Configurablechildprice
6
+ {
7
+ protected $_options;
8
+
9
+ public function toOptionArray()
10
+ {
11
+ if (!$this->_options) {
12
+ $this->_options[] = array('value' => 0, 'label' => Mage::helper('quartic')->__('Get from simple product'));
13
+ $this->_options[] = array('value' => 1, 'label' => Mage::helper('quartic')->__('Get from parent product'));
14
+ }
15
+ return $this->_options;
16
+ }
17
+ }
app/code/community/Quarticon/Quartic/Model/System/Config/Source/Configurablechilds.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
-
3
-
4
-
5
- class Quarticon_Quartic_Model_System_Config_Source_Configurablechilds
6
- {
7
- protected $_options;
8
-
9
- public function toOptionArray()
10
- {
11
- if (!$this->_options) {
12
- $this->_options[] = array('value' => 0, 'label' => Mage::helper('quartic')->__('Do not show'));
13
- $this->_options[] = array('value' => 1, 'label' => Mage::helper('quartic')->__('Show if possible'));
14
- }
15
- return $this->_options;
16
- }
17
- }
1
+ <?php
2
+
3
+
4
+
5
+ class Quarticon_Quartic_Model_System_Config_Source_Configurablechilds
6
+ {
7
+ protected $_options;
8
+
9
+ public function toOptionArray()
10
+ {
11
+ if (!$this->_options) {
12
+ $this->_options[] = array('value' => 0, 'label' => Mage::helper('quartic')->__('Do not show'));
13
+ $this->_options[] = array('value' => 1, 'label' => Mage::helper('quartic')->__('Show if possible'));
14
+ }
15
+ return $this->_options;
16
+ }
17
+ }
app/code/community/Quarticon/Quartic/Model/System/Config/Source/Configurableprice.php CHANGED
@@ -1,19 +1,19 @@
1
- <?php
2
-
3
-
4
-
5
- class Quarticon_Quartic_Model_System_Config_Source_Configurableprice
6
- {
7
- protected $_options;
8
-
9
- public function toOptionArray()
10
- {
11
- if (!$this->_options) {
12
- $this->_options[] = array('value' => 0, 'label' => Mage::helper('quartic')->__('Standard configurable product price'));
13
- $this->_options[] = array('value' => 1, 'label' => Mage::helper('quartic')->__('Minimum price'));
14
- $this->_options[] = array('value' => 2, 'label' => Mage::helper('quartic')->__('Maximum price'));
15
- // $this->_options[] = array('value' => 3, 'label' => Mage::helper('quartic')->__('Price range'));
16
- }
17
- return $this->_options;
18
- }
19
- }
1
+ <?php
2
+
3
+
4
+
5
+ class Quarticon_Quartic_Model_System_Config_Source_Configurableprice
6
+ {
7
+ protected $_options;
8
+
9
+ public function toOptionArray()
10
+ {
11
+ if (!$this->_options) {
12
+ $this->_options[] = array('value' => 0, 'label' => Mage::helper('quartic')->__('Standard configurable product price'));
13
+ $this->_options[] = array('value' => 1, 'label' => Mage::helper('quartic')->__('Minimum price'));
14
+ $this->_options[] = array('value' => 2, 'label' => Mage::helper('quartic')->__('Maximum price'));
15
+ // $this->_options[] = array('value' => 3, 'label' => Mage::helper('quartic')->__('Price range'));
16
+ }
17
+ return $this->_options;
18
+ }
19
+ }
app/code/community/Quarticon/Quartic/Model/System/Config/Source/Groupedchildimage.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
-
3
-
4
-
5
- class Quarticon_Quartic_Model_System_Config_Source_Groupedchildimage
6
- {
7
- protected $_options;
8
-
9
- public function toOptionArray()
10
- {
11
- if (!$this->_options) {
12
- $this->_options[] = array('value' => 0, 'label' => Mage::helper('quartic')->__('Get from simple product'));
13
- $this->_options[] = array('value' => 1, 'label' => Mage::helper('quartic')->__('Get from parent product'));
14
- }
15
- return $this->_options;
16
- }
17
- }
1
+ <?php
2
+
3
+
4
+
5
+ class Quarticon_Quartic_Model_System_Config_Source_Groupedchildimage
6
+ {
7
+ protected $_options;
8
+
9
+ public function toOptionArray()
10
+ {
11
+ if (!$this->_options) {
12
+ $this->_options[] = array('value' => 0, 'label' => Mage::helper('quartic')->__('Get from simple product'));
13
+ $this->_options[] = array('value' => 1, 'label' => Mage::helper('quartic')->__('Get from parent product'));
14
+ }
15
+ return $this->_options;
16
+ }
17
+ }
app/code/community/Quarticon/Quartic/Model/System/Config/Source/Groupedprice.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
-
3
-
4
-
5
- class Quarticon_Quartic_Model_System_Config_Source_Groupedprice
6
- {
7
- protected $_options;
8
-
9
- public function toOptionArray()
10
- {
11
- if (!$this->_options) {
12
- $this->_options[] = array('value' => 0, 'label' => Mage::helper('quartic')->__('Minimum from simple products'));
13
- $this->_options[] = array('value' => 1, 'label' => Mage::helper('quartic')->__('Maximum from simple products'));
14
- }
15
- return $this->_options;
16
- }
17
- }
1
+ <?php
2
+
3
+
4
+
5
+ class Quarticon_Quartic_Model_System_Config_Source_Groupedprice
6
+ {
7
+ protected $_options;
8
+
9
+ public function toOptionArray()
10
+ {
11
+ if (!$this->_options) {
12
+ $this->_options[] = array('value' => 0, 'label' => Mage::helper('quartic')->__('Minimum from simple products'));
13
+ $this->_options[] = array('value' => 1, 'label' => Mage::helper('quartic')->__('Maximum from simple products'));
14
+ }
15
+ return $this->_options;
16
+ }
17
+ }
app/code/community/Quarticon/Quartic/Model/System/Config/Source/Visibility.php CHANGED
@@ -1,19 +1,19 @@
1
- <?php
2
-
3
-
4
-
5
- class Quarticon_Quartic_Model_System_Config_Source_Visibility
6
- {
7
- protected $_options;
8
-
9
- public function toOptionArray()
10
- {
11
- if (!$this->_options) {
12
- $options = Mage::getModel('catalog/product_visibility')->getOptionArray();
13
- foreach($options as $value => $option) {
14
- $this->_options[] = array('value' => $value, 'label' => $option);
15
- }
16
- }
17
- return $this->_options;
18
- }
19
- }
1
+ <?php
2
+
3
+
4
+
5
+ class Quarticon_Quartic_Model_System_Config_Source_Visibility
6
+ {
7
+ protected $_options;
8
+
9
+ public function toOptionArray()
10
+ {
11
+ if (!$this->_options) {
12
+ $options = Mage::getModel('catalog/product_visibility')->getOptionArray();
13
+ foreach($options as $value => $option) {
14
+ $this->_options[] = array('value' => $value, 'label' => $option);
15
+ }
16
+ }
17
+ return $this->_options;
18
+ }
19
+ }
app/code/community/Quarticon/Quartic/controllers/ActiveController.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Quarticon_Quartic_ActiveController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ /**
6
+ * Return plugin and store version
7
+ */
8
+ public function checkAction()
9
+ {
10
+ // sprawdz czy jest powiazanie z customerem
11
+ $helper = Mage::helper('quartic');
12
+ $storeId = $helper->getStoreId();
13
+
14
+ // przygotuj dane klienta - m. in. wysyla katalog i historie przez API
15
+ $helper->prepareCustomerData();
16
+
17
+ $arr = array(
18
+ 'name' => 'Quartic plugin',
19
+ 'pluginVersion' => reset(Mage::getConfig()->getModuleConfig("Quarticon_Quartic")->version),
20
+ 'storeVersion' => Mage::getVersion(),
21
+ 'storeId' => $storeId
22
+ );
23
+ header('Content-Type: application/json');
24
+ die(json_encode($arr));
25
+ }
26
+ }
app/code/community/Quarticon/Quartic/controllers/Adminhtml/ApiController.php DELETED
@@ -1,128 +0,0 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Adminhtml_ApiController extends Mage_Adminhtml_Controller_Action
4
- {
5
-
6
- protected function _initAction()
7
- {
8
- return $this;
9
- }
10
-
11
- public function placementsAction()
12
- {
13
- $stores = Mage::app()->getStores();
14
-
15
- /* @var $session Mage_Adminhtml_Model_Session */
16
- $session = Mage::getSingleton('adminhtml/session');
17
-
18
- try {
19
- /* @var $frames Quarticon_Quartic_Model_Placement */
20
- $frames = Mage::getModel('quartic/placement');
21
-
22
- $deleteResult = $frames->deleteAll();
23
- if($deleteResult) {
24
- $loaded = $frames->apiLoad(0); // for default config value
25
- foreach($stores as $store) {
26
- $loaded = $frames->apiLoad($store->getId());
27
- }
28
-
29
- $session->addSuccess(Mage::helper('quartic')->__('The placements have been synchronised.'));
30
- } else {
31
- $session->addError($message);
32
- }
33
- } catch (Exception $e) {
34
- foreach (explode("\n", $e->getMessage()) as $message) {
35
- $session->addError($deleteResult['message']);
36
- }
37
- }
38
- return $this->_redirectReferer();
39
- }
40
-
41
- /**
42
- * Send orders feed action
43
- */
44
- public function prepareordersAction()
45
- {
46
- $helper = Mage::helper('quartic');
47
-
48
- /* @var $session Mage_Adminhtml_Model_Session */
49
- $session = Mage::getSingleton('adminhtml/session');
50
-
51
- /* @var $api Quarticon_Quartic_Model_Client_Api */
52
- $api = Mage::getModel('quartic/client_api');
53
-
54
- $storeCode = $this->getRequest()->getParam('store');
55
- $websiteCode = $this->getRequest()->getParam('website');
56
- $storeId = $this->_getStoreId();
57
-
58
- try {
59
- $_order = Mage::getModel('quartic/order');
60
- $writer = new Quarticon_Quartic_Model_Adapter_Writer();
61
- $uri = $_order->getFilePath();
62
- touch($uri);
63
- $writer->openUri(realpath($uri));
64
- //$writer->openUri('php://output');
65
- $writer->startDocument('1.0', 'UTF-8');
66
- $writer->setIndent(true);
67
- $mem_writer = new Quarticon_Quartic_Model_Adapter_Writer();
68
- $mem_writer->openMemory();
69
- $mem_writer->setIndent(true);
70
- $writer->startElement('orders');
71
- $count = $_order->getCollectionCount();
72
- $steps = ceil($count / Quarticon_Quartic_Model_Order::ITERATION_STEP);
73
- for ($step = 1; $step <= $steps; $step++) {
74
- $collection = $_order->getAll($step, Quarticon_Quartic_Model_Order::ITERATION_STEP);
75
- foreach ($collection as $o) {
76
- $mem_writer->startElement('order');
77
- $mem_writer->writeElement('transaction', $o['id']);
78
- $mem_writer->writeElement('timestamp', $o['timestamp']);
79
- $mem_writer->writeElement('user', $o['user']);
80
- $mem_writer->writeElement('product', $o['product']);
81
- $mem_writer->writeElement('quantity', $o['quantity']);
82
- $mem_writer->writeElement('price', $o['price']);
83
- $mem_writer->endElement();
84
- unset($o);
85
- }
86
- $batch_xml_string = $mem_writer->outputMemory(true);
87
- $writer->writeRaw($batch_xml_string);
88
- unset($collection);
89
- }
90
- unset($mem_writer);
91
- $writer->endElement();
92
- $writer->endDocument();
93
-
94
- $hash = Mage::getStoreConfig("quartic/config/hash", $storeId);
95
- $data = array(
96
- 'url' => Mage::getUrl('quartic/feed/orders', array('hash' => $hash, 'store' => $storeId)),
97
- );
98
- $helper->log('POST transactions');
99
- $helper->log(var_export(array('data' => $data), true));
100
- $new_trans = $api->post('transactions', array('data' => $data));
101
- $helper->log(var_export($new_trans, true));
102
-
103
- $session->addSuccess(Mage::helper('quartic')->__('Transaction feed is ready for sync.'));
104
- } catch (Exception $e) {
105
- $session->addError($e->getMessage());
106
- }
107
- return $this->_redirect('adminhtml/system_config/edit/section/quartic',array('store'=>$storeCode,'website'=>$websiteCode));
108
- }
109
-
110
- private function _getStoreId()
111
- {
112
- $params = Mage::app()->getRequest()->getParams();
113
- if(isset($params['store'])) {
114
- $storeId = (is_numeric($params['store'])) ? (int)$params['store'] : Mage::getModel('core/store')->load($params['store'], 'code')->getId();
115
- } else {
116
- $storeId = Mage::app()->getStore()->getId();
117
- }
118
-
119
- if($storeId == 0) return Mage::app()->getDefaultStoreView()->getStoreId();
120
-
121
- return $storeId;
122
- }
123
-
124
- protected function _isAllowed()
125
- {
126
- return Mage::getSingleton('admin/session')->isAllowed('system/config/quartic');
127
- }
128
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/controllers/Adminhtml/IndexController.php CHANGED
@@ -1,23 +1,18 @@
1
- <?php
2
- class Quarticon_Quartic_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
3
- {
4
-
5
- protected function _initAction()
6
- {
7
- return $this;
8
- }
9
-
10
- public function urlsAction()
11
- {
12
- $this->_title($this->__('System'))
13
- ->_title($this->__('Quartic'))
14
- ->_title($this->__('Feed URLs'));
15
- $this->loadLayout();
16
- $this->renderLayout();
17
- }
18
-
19
- protected function _isAllowed()
20
- {
21
- return Mage::getSingleton('admin/session')->isAllowed('catalog/quartic');
22
- }
23
- }
1
+ <?php
2
+ class Quarticon_Quartic_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+
5
+ protected function _initAction()
6
+ {
7
+ return $this;
8
+ }
9
+
10
+ public function urlsAction()
11
+ {
12
+ $this->_title($this->__('System'))
13
+ ->_title($this->__('Quartic'))
14
+ ->_title($this->__('Feed URLs'));
15
+ $this->loadLayout();
16
+ $this->renderLayout();
17
+ }
18
+ }
 
 
 
 
 
app/code/community/Quarticon/Quartic/controllers/Adminhtml/MapsController.php CHANGED
@@ -1,33 +1,28 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_Adminhtml_MapsController extends Mage_Adminhtml_Controller_Action
4
- {
5
-
6
- protected function _initAction()
7
- {
8
- $this->loadLayout();
9
- return $this;
10
- }
11
-
12
- public function indexAction()
13
- {
14
- $this->_initAction()
15
- ->renderLayout();
16
- }
17
-
18
- protected function massSaveAction()
19
- {
20
- $data = $this->getRequest()->getParam('mapped');
21
- foreach ($data as $id => $value) {
22
- $model = Mage::getModel('quartic/maps')->load($id);
23
- $model->setData('magento_attribute', $value);
24
- $model->save();
25
- }
26
- $this->_redirect("*/*/");
27
- }
28
-
29
- protected function _isAllowed()
30
- {
31
- return Mage::getSingleton('admin/session')->isAllowed('quartic/maps');
32
- }
33
- }
1
+ <?php
2
+
3
+ class Quarticon_Quartic_Adminhtml_MapsController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ protected function _initAction()
7
+ {
8
+ $this->loadLayout();
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction()
13
+ {
14
+ $this->_initAction()
15
+ ->renderLayout();
16
+ }
17
+
18
+ protected function massSaveAction()
19
+ {
20
+ $data = $this->getRequest()->getParam('mapped');
21
+ foreach ($data as $id => $value) {
22
+ $model = Mage::getModel('quartic/maps')->load($id);
23
+ $model->setData('magento_attribute', $value);
24
+ $model->save();
25
+ }
26
+ $this->_redirect("*/*/");
27
+ }
28
+ }
 
 
 
 
 
app/code/community/Quarticon/Quartic/controllers/FeedController.php CHANGED
@@ -1,159 +1,193 @@
1
- <?php
2
-
3
- class Quarticon_Quartic_FeedController extends Mage_Core_Controller_Front_Action
4
- {
5
-
6
- const FEED_PROD_LOG = 'qon_prodfeed.log';
7
-
8
- protected $logFeed = true;
9
-
10
- protected function _log($message)
11
- {
12
- if ($this->logFeed) {
13
- Mage::log($message, null, self::FEED_PROD_LOG);
14
- }
15
- }
16
-
17
- protected function getConfig()
18
- {
19
- return Mage::getModel('quartic/config');
20
- }
21
-
22
- protected function _startXML()
23
- {
24
- $hash = $this->getRequest()->getParam('hash');
25
- if ($hash == $this->getConfig()->getHash() && $this->getConfig()->isActive()) {
26
- return true;
27
- } else {
28
- return false;
29
- }
30
- }
31
-
32
- /**
33
- * View product feed action (if hash and config are active)
34
- */
35
- public function productsAction()
36
- {
37
- //$this->getResponse()->setBody($responseAjax->toJson());
38
- if ($this->_startXML()) {
39
- require_once('Zend/Log.php');
40
-
41
- $storeId = $this->_getStoreId();
42
- $filename = 'xmlOutput_' . $storeId . '.xml';
43
- $filepath = Mage::getBaseDir('var') . "/quartic/" . $filename;
44
- $olderThan = 24 * 3600; //24h
45
-
46
- if(file_exists($filepath) && (time() - filemtime($filepath) < $olderThan) && !$this->getRequest()->getParam('refresh')) { // not older than 24h
47
- header("Content-Type:text/xml");
48
- header("Data_source: file",true);
49
- $contents = file_get_contents($filepath);
50
- echo $contents;
51
- $this->log();
52
- die();
53
- } else {
54
- Mage::getModel('quartic/cron')->refreshFeed($storeId);
55
- if(file_exists($filepath)) { // refreshed, try again
56
- header("Content-Type:text/xml");
57
- header("Data_source: regenerated",true);
58
- $contents = file_get_contents($filepath);
59
- echo $contents;
60
- die();
61
- } elseif(file_exists($filepath) && (time() - filemtime($filepath) >= $olderThan)) { // file too old
62
- header("Error: 512 File Too old - " . date('c',filemtime($filepath)),true,512);
63
- $this->log();
64
- die();
65
- } elseif(!file_exists($filepath)) { //file not exists
66
- header("Error: 513 File not exists",true,513);
67
- $this->log();
68
- die();
69
- } else {
70
- header("Error: 514 Something is wrong",true,514); // nobody will never see this... that's sad
71
- $this->log();
72
- die();
73
- }
74
- }
75
- } else {
76
- $this->_redirect('/');
77
- }
78
- }
79
-
80
- /**
81
- * View orders feed action (if hash and config are active)
82
- */
83
- public function ordersAction()
84
- {
85
-
86
- require_once('Zend/Log.php');
87
-
88
- if ($this->_startXML()) {
89
- $storeId = $this->_getStoreId();
90
- header("Content-Type:text/xml");
91
- $writer = new Quarticon_Quartic_Model_Adapter_Writer();
92
- $writer->openUri('php://output');
93
- $writer->startDocument('1.0', 'UTF-8');
94
- $writer->setIndent(true);
95
- $mem_writer = new Quarticon_Quartic_Model_Adapter_Writer();
96
- $mem_writer->openMemory();
97
- $mem_writer->setIndent(true);
98
- $writer->startElement('orders');
99
- $writer->writeAttribute('xmlns', "http://cp.quarticon.com/docs/transactions/1.1/schema");
100
- $writer->writeAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance");
101
- $writer->writeAttribute('xsi:schemaLocation', "http://quartic.pl/catalog/1.1/transactions
102
- http://cp.quarticon.com/docs/transactions/1.1/schema/quartic_transactions_1.1
103
- .xsd");
104
- $_order = Mage::getModel('quartic/order');
105
- $count = $_order->getCollectionCount($storeId);
106
- $steps = ceil($count / Quarticon_Quartic_Model_Order::ITERATION_STEP);
107
- for ($step = 1; $step <= $steps; $step++) {
108
- $collection = $_order->getAll($step, Quarticon_Quartic_Model_Order::ITERATION_STEP, $storeId);
109
- foreach ($collection as $o) {
110
- $mem_writer->startElement('order');
111
- $mem_writer->writeElement('transaction', $o['id']);
112
- $mem_writer->writeElement('timestamp', $o['timestamp']);
113
- $mem_writer->writeElement('user', $o['user']);
114
- $mem_writer->writeElement('product', $o['product']);
115
- $mem_writer->writeElement('quantity', $o['quantity']);
116
- $mem_writer->writeElement('price', $o['price']);
117
- $mem_writer->endElement();
118
- unset($o);
119
- }
120
- $batch_xml_string = $mem_writer->outputMemory(true);
121
- $writer->writeRaw($batch_xml_string);
122
- unset($collection);
123
- }
124
- unset($mem_writer);
125
- $writer->endElement();
126
- $writer->endDocument();
127
- die();
128
- } else {
129
- $this->_redirect('/');
130
- }
131
- }
132
-
133
- /**
134
- * Log feed action to quartic_history model (since 0.3.4)
135
- */
136
- public function log()
137
- {
138
- $model = Mage::getModel('quartic/history');
139
- $storeCode = $this->getRequest()->getParam('___store');
140
- $store = Mage::getModel("core/store")->load($storeCode);
141
- $data = array('store_id' => $store->getId());
142
- $model->setData($data);
143
- $model->save();
144
- }
145
-
146
- private function _getStoreId()
147
- {
148
- $params = Mage::app()->getRequest()->getParams();
149
- if(isset($params['store'])) {
150
- $storeId = (is_numeric($params['store'])) ? (int)$params['store'] : Mage::getModel('core/store')->load($params['store'], 'code')->getId();
151
- } else {
152
- $storeId = Mage::app()->getStore()->getId();
153
- }
154
-
155
- if($storeId == 0) return Mage::app()->getDefaultStoreView()->getStoreId();
156
-
157
- return $storeId;
158
- }
159
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Quarticon_Quartic_FeedController extends Mage_Core_Controller_Front_Action
4
+ {
5
+
6
+ /**
7
+ * log file
8
+ */
9
+ const FEED_PROD_LOG = 'qon_prodfeed.log';
10
+
11
+ /**
12
+ * Helper
13
+ * @var Quarticon_Quartic_Helper_Data
14
+ */
15
+ private $helper;
16
+
17
+ /**
18
+ * Log text
19
+ * @param $txt
20
+ */
21
+ private function _log($txt)
22
+ {
23
+ $this->helper->log($txt, static::FEED_PROD_LOG);
24
+ }
25
+
26
+ /**
27
+ * @return mixed
28
+ */
29
+ protected function getConfig()
30
+ {
31
+ return Mage::getModel('quartic/config');
32
+ }
33
+
34
+ protected function _startXML()
35
+ {
36
+ $hash = $this->getRequest()->getParam('hash');
37
+ if ($hash == $this->getConfig()->getHash() && $this->getConfig()->isActive()) {
38
+ return true;
39
+ } else {
40
+ return false;
41
+ }
42
+ }
43
+
44
+ /**
45
+ * View product feed action (if hash and config are active)
46
+ */
47
+ public function productsAction()
48
+ {
49
+ $storeId = $this->_getStoreId();
50
+ $filename = 'xmlOutput_' . $storeId . '.xml';
51
+ $filepath = Mage::getBaseDir('var') . "/quartic/" . $filename;
52
+ $olderThan = 24 * 3600; //24h
53
+
54
+ if(file_exists($filepath) && (time() - filemtime($filepath) < $olderThan)) { // not older than 24h
55
+ header("Content-Type:text/xml");
56
+ $contents = file_get_contents($filepath);
57
+ echo $contents;
58
+ $this->logHistory();
59
+ die();
60
+ } elseif(file_exists($filepath) && (time() - filemtime($filepath) >= $olderThan)) { // file too old
61
+ header("Error: 512 File Too old - " . date('c',filemtime($filepath)),true,512);
62
+ $this->logHistory();
63
+ die();
64
+ } elseif(!file_exists($filepath)) { //file not exists
65
+ header("Error: 513 File not exists",true,513);
66
+ $this->logHistory();
67
+ die();
68
+ } else {
69
+ header("Error: 514 Something is wrong",true,514); // nobody will never see this... that's sad
70
+ $this->logHistory();
71
+ die();
72
+ }
73
+ }
74
+
75
+ /**
76
+ * View product feed action (if hash and config are active)
77
+ */
78
+ public function csvAction()
79
+ {
80
+ $storeId = $this->_getStoreId();
81
+ $filename = 'csvFeed_' . $storeId . '.csv';
82
+ $filepath = Mage::getBaseDir('var') . "/quartic/" . $filename;
83
+ $olderThan = 24 * 3600; //24h
84
+ if(file_exists($filepath) && (time() - filemtime($filepath) < $olderThan)) {
85
+ // not older than 24h
86
+ $this->outputFile($filepath);
87
+ $this->_log('file older than 24h');
88
+ $this->logHistory();
89
+ die();
90
+ } elseif(file_exists($filepath) && (time() - filemtime($filepath) >= $olderThan)) {
91
+ // file too old
92
+ $this->_log('file too old - generating');
93
+ $feed = Mage::getModel('quartic/feed');
94
+ $feed->refreshProductsFeed($storeId);
95
+ $this->outputFile($filepath);
96
+ $this->logHistory();
97
+ die();
98
+ } elseif(!file_exists($filepath)) {
99
+ //file not exists
100
+ $this->_log('file not exists, generating..');
101
+
102
+ $feed = Mage::getModel('quartic/feed');
103
+ $feed->refreshProductsFeed($storeId);
104
+
105
+ $this->outputFile($filepath);
106
+ $this->logHistory();
107
+ die();
108
+ } else {
109
+ header("Error: 514 Something is wrong", true, 514); // nobody will never see this... that's sad
110
+ $this->_log('unexpected error');
111
+ $this->logHistory();
112
+ die();
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Print file
118
+ * @param $filepath
119
+ */
120
+ private function outputFile($filepath) {
121
+ header("Content-Type:text/csv");
122
+ $contents = file_get_contents($filepath);
123
+ echo $contents;
124
+ }
125
+
126
+ /**
127
+ * View orders feed action (if hash and config are active)
128
+ */
129
+ public function ordersAction()
130
+ {
131
+ $storeId = $this->_getStoreId();
132
+ header("Content-Type:text/xml");
133
+ $writer = new Quarticon_Quartic_Model_Adapter_Writer();
134
+ $writer->openUri('php://output');
135
+ $writer->startDocument('1.0', 'UTF-8');
136
+ $writer->setIndent(true);
137
+ $mem_writer = new Quarticon_Quartic_Model_Adapter_Writer();
138
+ $mem_writer->openMemory();
139
+ $mem_writer->setIndent(true);
140
+ $writer->startElement('orders');
141
+ $writer->writeAttribute('xmlns', "http://cp.quarticon.com/docs/transactions/1.1/schema");
142
+ $writer->writeAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance");
143
+ $writer->writeAttribute('xsi:schemaLocation', "http://quartic.pl/catalog/1.1/transactions
144
+ http://cp.quarticon.com/docs/transactions/1.1/schema/quartic_transactions_1.1
145
+ .xsd");
146
+ $_order = Mage::getModel('quartic/order');
147
+ $count = $_order->getCollectionCount($storeId);
148
+ $steps = ceil($count / Quarticon_Quartic_Model_Order::ITERATION_STEP);
149
+ for ($step = 1; $step <= $steps; $step++) {
150
+ $collection = $_order->getAll($step, Quarticon_Quartic_Model_Order::ITERATION_STEP, $storeId);
151
+ foreach ($collection as $o) {
152
+ $mem_writer->startElement('order');
153
+ $mem_writer->writeElement('transaction', $o['id']);
154
+ $mem_writer->writeElement('timestamp', $o['timestamp']);
155
+ $mem_writer->writeElement('user', $o['user']);
156
+ $mem_writer->writeElement('product', $o['product']);
157
+ $mem_writer->writeElement('quantity', $o['quantity']);
158
+ $mem_writer->writeElement('price', $o['price']);
159
+ $mem_writer->endElement();
160
+ unset($o);
161
+ }
162
+ $batch_xml_string = $mem_writer->outputMemory(true);
163
+ $writer->writeRaw($batch_xml_string);
164
+ unset($collection);
165
+ }
166
+ unset($mem_writer);
167
+ $writer->endElement();
168
+ $writer->endDocument();
169
+ die();
170
+ }
171
+
172
+ /**
173
+ * Log feed action to quartic_history model (since 0.3.4)
174
+ */
175
+ public function logHistory()
176
+ {
177
+ $model = Mage::getModel('quartic/history');
178
+ $storeCode = $this->getRequest()->getParam('___store');
179
+ $store = Mage::getModel("core/store")->load($storeCode);
180
+ $data = array('store_id' => $store->getId());
181
+ $model->setData($data);
182
+ $model->save();
183
+ }
184
+
185
+ /**
186
+ * Get store id from request
187
+ * @return int
188
+ */
189
+ private function _getStoreId() {
190
+ $this->helper = Mage::helper('quartic');
191
+ return $this->helper->getStoreId();
192
+ }
193
+ }
app/code/community/Quarticon/Quartic/controllers/FrameController.php CHANGED
@@ -1,16 +1,16 @@
1
- <?php
2
- class Quarticon_Quartic_FrameController extends Mage_Core_Controller_Front_Action
3
- {
4
-
5
- protected function getConfig()
6
- {
7
- return Mage::getModel('quartic/config');
8
- }
9
-
10
- public function IndexAction()
11
- {
12
- $slot = $this->getRequest()->getParam('slot');
13
- $block = $this->getLayout()->createBlock('quartic/products')->setTemplate('quartic/products/'.$slot.'.phtml');
14
- $this->getResponse()->setBody($block->toHtml());
15
- }
16
- }
1
+ <?php
2
+ class Quarticon_Quartic_FrameController extends Mage_Core_Controller_Front_Action
3
+ {
4
+
5
+ protected function getConfig()
6
+ {
7
+ return Mage::getModel('quartic/config');
8
+ }
9
+
10
+ public function IndexAction()
11
+ {
12
+ $slot = $this->getRequest()->getParam('slot');
13
+ $block = $this->getLayout()->createBlock('quartic/products')->setTemplate('quartic/products/'.$slot.'.phtml');
14
+ $this->getResponse()->setBody($block->toHtml());
15
+ }
16
+ }
app/code/community/Quarticon/Quartic/data/quartic_setup/data-install-1.2.3.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $secret = Mage::getStoreConfig('quartic/config/secret');
5
+ $storeName = Mage::getStoreConfig('quartic/config/storeName');
6
+ Mage::getModel('core/config')->saveConfig('quartic/config/iframe_link', 'https://shopapi.quarticon.com/pluginMagento/admin', 'default', 0);
7
+ Mage::getModel('core/config')->saveConfig('quartic/config/webhook_link', 'https://shopapi.quarticon.com/pluginMagento/webhook', 'default', 0);
8
+ Mage::getModel('core/config')->saveConfig('quartic/config/clientData_link', 'https://shopapi.quarticon.com/pluginMagento/getClientData', 'default', 0);
9
+ if (!$secret && !$storeName) {
10
+ $storeName = Mage::getModel('quartic/config')->savePluginStoreName();
11
+ $secret = Mage::getModel('quartic/config')->saveSecret();
12
+ }
13
+
14
+ Mage::app()->getStore()->resetConfig();
15
+
16
+ // send config to quartic webhook
17
+ Mage::helper('quartic')->sendEventStoreInit($storeName, $secret);
18
+
19
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/data/quartic_setup/data-install-1.3.1.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $secret = Mage::getStoreConfig('quartic/config/secret');
5
+ $storeName = Mage::getStoreConfig('quartic/config/storeName');
6
+ Mage::getModel('core/config')->saveConfig('quartic/config/iframe_link', 'https://shopapi.quarticon.com/pluginMagento/admin', 'default', 0);
7
+ Mage::getModel('core/config')->saveConfig('quartic/config/webhook_link', 'https://shopapi.quarticon.com/pluginMagento/webhook', 'default', 0);
8
+ Mage::getModel('core/config')->saveConfig('quartic/config/clientData_link', 'https://shopapi.quarticon.com/pluginMagento/getClientData', 'default', 0);
9
+ if (!$secret && !$storeName) {
10
+ $storeName = Mage::getModel('quartic/config')->savePluginStoreName();
11
+ $secret = Mage::getModel('quartic/config')->saveSecret();
12
+ }
13
+
14
+ Mage::app()->getStore()->resetConfig();
15
+
16
+ // send config to quartic webhook
17
+ Mage::helper('quartic')->sendEventStoreInit($storeName, $secret);
18
+
19
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/data/quartic_setup/data-upgrade-1.2.2-1.2.3.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ Mage::getModel('core/config')->saveConfig('quartic/config/iframe_link', 'https://shopapi.quarticon.com/pluginMagento/admin', 'default', 0);
6
+ Mage::getModel('core/config')->saveConfig('quartic/config/webhook_link', 'https://shopapi.quarticon.com/pluginMagento/webhook', 'default', 0);
7
+ Mage::getModel('core/config')->saveConfig('quartic/config/clientData_link', 'https://shopapi.quarticon.com/pluginMagento/getClientData', 'default', 0);
8
+ $name = Mage::getModel('quartic/config')->savePluginStoreName();
9
+ $secret = Mage::getModel('quartic/config')->saveSecret();
10
+
11
+ Mage::app()->getStore()->resetConfig();
12
+
13
+ // send config to quartic webhook
14
+ Mage::helper('quartic')->sendEventStoreInit($name, $secret);
15
+
16
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/data/quartic_setup/data-upgrade-1.2.9-1.3.0.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ Mage::helper('quartic')->sendUpgradeEvent();
6
+
7
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/etc/adminhtml.xml CHANGED
@@ -1,30 +1,36 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <menu>
4
- <catalog>
5
- <children>
6
- <quartic translate="title" module="quartic">
7
- <title>QUARTICON | Quartic</title>
8
- <action>adminhtml/index/urls</action>
9
- <sort_order>1500</sort_order>
10
- </quartic>
11
- </children>
12
- </catalog>
13
- <quartic translate="title" module="quartic">
14
- <title>Quartic</title>
15
- <sort_order>90</sort_order>
16
- <children>
17
- <config translate="title" module="quartic">
18
- <title>Configuration</title>
19
- <sort_order>10</sort_order>
20
- <action>adminhtml/system_config/edit/section/quartic</action>
21
- </config>
22
- <maps translate="title" module="quartic">
23
- <title>Attribute mapping</title>
24
- <sort_order>20</sort_order>
25
- <action>adminhtml/maps</action>
26
- </maps>
27
- </children>
28
- </quartic>
29
- </menu>
30
- </config>
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <!-- <catalog>
5
+ <children>
6
+ <quartic translate="title" module="quartic">
7
+ <title>QUARTICON | Quartic</title>
8
+ <action>quartic/adminhtml_index/urls</action>
9
+ <sort_order>1500</sort_order>
10
+ </quartic>
11
+ </children>
12
+ </catalog> -->
13
+ <quartic translate="title" module="quartic">
14
+ <title>Quartic</title>
15
+ <sort_order>90</sort_order>
16
+ <action>adminhtml/system_config/edit/section/plugin</action>
17
+ <!-- <children>
18
+ <plugin translate="title" module="quartic">
19
+ <title>Plugin</title>
20
+ <sort_order>3</sort_order>
21
+ <action>adminhtml/system_config/edit/section/plugin</action>
22
+ </plugin>
23
+ <config translate="title" module="quartic">
24
+ <title>Configuration</title>
25
+ <sort_order>10</sort_order>
26
+ <action>adminhtml/system_config/edit/section/quartic</action>
27
+ </config>
28
+ <maps translate="title" module="quartic">
29
+ <title>Attribute mapping</title>
30
+ <sort_order>20</sort_order>
31
+ <action>quartic/adminhtml_maps</action>
32
+ </maps>
33
+ </children> -->
34
+ </quartic>
35
+ </menu>
36
+ </config>
app/code/community/Quarticon/Quartic/etc/config.xml CHANGED
@@ -1,224 +1,217 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Quarticon_Quartic>
5
- <version>1.0.8</version>
6
- </Quarticon_Quartic>
7
- </modules>
8
- <global>
9
- <blocks>
10
- <quartic>
11
- <class>Quarticon_Quartic_Block</class>
12
- </quartic>
13
- </blocks>
14
- <models>
15
- <quartic>
16
- <class>Quarticon_Quartic_Model</class>
17
- <resourceModel>quartic_mysql4</resourceModel>
18
- </quartic>
19
- <quartic_mysql4>
20
- <class>Quarticon_Quartic_Model_Mysql4</class>
21
- <entities>
22
- <placement>
23
- <table>quartic_placements</table>
24
- </placement>
25
- <history>
26
- <table>quartic_history</table>
27
- </history>
28
- <maps>
29
- <table>quartic_maps</table>
30
- </maps>
31
- </entities>
32
- </quartic_mysql4>
33
- </models>
34
- <resources>
35
- <quartic_setup>
36
- <setup>
37
- <module>Quarticon_Quartic</module>
38
- </setup>
39
- <connection>
40
- <use>core_setup</use>
41
- </connection>
42
- </quartic_setup>
43
- <quartic_write>
44
- <connection>
45
- <use>core_write</use>
46
- </connection>
47
- </quartic_write>
48
- <quartic_read>
49
- <connection>
50
- <use>core_read</use>
51
- </connection>
52
- </quartic_read>
53
- </resources>
54
- <helpers>
55
- <quartic>
56
- <class>Quarticon_Quartic_Helper</class>
57
- </quartic>
58
- </helpers>
59
- </global>
60
- <frontend>
61
- <routers>
62
- <quartic>
63
- <use>standard</use>
64
- <args>
65
- <module>Quarticon_Quartic</module>
66
- <frontName>quartic</frontName>
67
- </args>
68
- </quartic>
69
- </routers>
70
- <layout>
71
- <updates>
72
- <quartic>
73
- <file>quartic.xml</file>
74
- </quartic>
75
- </updates>
76
- </layout>
77
- <translate>
78
- <modules>
79
- <Quarticon_Quartic>
80
- <files>
81
- <default>Quarticon_Quartic.csv</default>
82
- </files>
83
- </Quarticon_Quartic>
84
- </modules>
85
- </translate>
86
- <events>
87
- <core_block_abstract_to_html_after>
88
- <observers>
89
- <quartic>
90
- <type>singleton</type>
91
- <class>quartic/observer_frontend</class>
92
- <method>blockAbstractToHtmlAfter</method>
93
- </quartic>
94
- </observers>
95
- </core_block_abstract_to_html_after>
96
- <controller_front_send_response_before>
97
- <observers>
98
- <quartic_controller_front_send_response_before>
99
- <type>singleton</type>
100
- <class>quartic/observer_frontend</class>
101
- <method>controllerFrontSendResponseBefore</method>
102
- </quartic_controller_front_send_response_before>
103
- </observers>
104
- </controller_front_send_response_before>
105
- </events>
106
- </frontend>
107
- <default>
108
- <quartic>
109
- <config>
110
- <active>0</active>
111
- <use_sku>1</use_sku>
112
- <add_thumbs>0</add_thumbs>
113
- <only_in_stock>0</only_in_stock>
114
- <show_disabled_products>1</show_disabled_products>
115
- <category_use_product_frame>0</category_use_product_frame>
116
- <min_qty>0</min_qty>
117
- <visibility>4</visibility>
118
- <configurable_price>0</configurable_price>
119
- <feed>
120
- <product>
121
- <iteration_step>250</iteration_step>
122
- </product>
123
- </feed>
124
- </config>
125
- <composite>
126
- <configurable_childs>1</configurable_childs>
127
- <configurable_child_image>0</configurable_child_image>
128
- <configurable_child_price>1</configurable_child_price>
129
- <grouped_child_image>0</grouped_child_image>
130
- <grouped_child_price>0</grouped_child_price>
131
- </composite>
132
- </quartic>
133
- </default>
134
- <adminhtml>
135
- <events>
136
- <admin_system_config_changed_section_quartic>
137
- <observers>
138
- <quartic>
139
- <type>singleton</type>
140
- <class>quartic/observer_adminhtml</class>
141
- <method>handle_adminSystemConfigChangedSection</method>
142
- </quartic>
143
- </observers>
144
- </admin_system_config_changed_section_quartic>
145
- </events>
146
- <translate>
147
- <modules>
148
- <Quarticon_Quartic>
149
- <files>
150
- <default>Quarticon_Quartic.csv</default>
151
- </files>
152
- </Quarticon_Quartic>
153
- </modules>
154
- </translate>
155
- <acl>
156
- <resources>
157
- <!--<all>
158
- <title>Allow Everything</title>
159
- </all>-->
160
- <admin>
161
- <children>
162
- <catalog>
163
- <children>
164
- <quartic translate="title" module="quartic">
165
- <title>QUARTICON | Quartic</title>
166
- </quartic>
167
- </children>
168
- </catalog>
169
- <system>
170
- <children>
171
- <config>
172
- <children>
173
- <quartic translate="title" module="quartic">
174
- <title>QUARTICON | Quartic</title>
175
- </quartic>
176
- </children>
177
- </config>
178
- </children>
179
- </system>
180
- <quartic translate="title" module="quartic">
181
- <title>Quartic</title>
182
- <sort_order>90</sort_order>
183
- <children>
184
- <maps translate="title" module="quartic">
185
- <title>Attribute mapping</title>
186
- </maps>
187
- </children>
188
- </quartic>
189
- </children>
190
- </admin>
191
- </resources>
192
- </acl>
193
- <layout>
194
- <updates>
195
- <quartic>
196
- <file>quartic.xml</file>
197
- </quartic>
198
- </updates>
199
- </layout>
200
- </adminhtml>
201
- <crontab>
202
- <jobs>
203
- <quartic>
204
- <schedule>
205
- <cron_expr>13 */8 * * *</cron_expr>
206
- </schedule>
207
- <run>
208
- <model>quartic/cron::refreshProductsFeed</model>
209
- </run>
210
- </quartic>
211
- </jobs>
212
- </crontab>
213
- <admin>
214
- <routers>
215
- <adminhtml>
216
- <args>
217
- <modules>
218
- <Quarticon_Quartic before="Mage_Adminhtml">Quarticon_Quartic_Adminhtml</Quarticon_Quartic>
219
- </modules>
220
- </args>
221
- </adminhtml>
222
- </routers>
223
- </admin>
224
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Quarticon_Quartic>
5
+ <version>1.3.1.0</version>
6
+ </Quarticon_Quartic>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <quartic>
11
+ <class>Quarticon_Quartic_Block</class>
12
+ </quartic>
13
+ </blocks>
14
+ <models>
15
+ <quartic>
16
+ <class>Quarticon_Quartic_Model</class>
17
+ <resourceModel>quartic_mysql4</resourceModel>
18
+ </quartic>
19
+ <quartic_mysql4>
20
+ <class>Quarticon_Quartic_Model_Mysql4</class>
21
+ <entities>
22
+ <history>
23
+ <table>quartic_history</table>
24
+ </history>
25
+ <maps>
26
+ <table>quartic_maps</table>
27
+ </maps>
28
+ </entities>
29
+ </quartic_mysql4>
30
+ </models>
31
+ <resources>
32
+ <quartic_setup>
33
+ <setup>
34
+ <module>Quarticon_Quartic</module>
35
+ </setup>
36
+ <connection>
37
+ <use>core_setup</use>
38
+ </connection>
39
+ </quartic_setup>
40
+ <quartic_write>
41
+ <connection>
42
+ <use>core_write</use>
43
+ </connection>
44
+ </quartic_write>
45
+ <quartic_read>
46
+ <connection>
47
+ <use>core_read</use>
48
+ </connection>
49
+ </quartic_read>
50
+ </resources>
51
+ <helpers>
52
+ <quartic>
53
+ <class>Quarticon_Quartic_Helper</class>
54
+ </quartic>
55
+ </helpers>
56
+ </global>
57
+ <frontend>
58
+ <routers>
59
+ <quartic>
60
+ <use>standard</use>
61
+ <args>
62
+ <module>Quarticon_Quartic</module>
63
+ <frontName>quartic</frontName>
64
+ </args>
65
+ </quartic>
66
+ </routers>
67
+ <layout>
68
+ <updates>
69
+ <quartic>
70
+ <file>quartic.xml</file>
71
+ </quartic>
72
+ </updates>
73
+ </layout>
74
+ <translate>
75
+ <modules>
76
+ <Quarticon_Quartic>
77
+ <files>
78
+ <default>Quarticon_Quartic.csv</default>
79
+ </files>
80
+ </Quarticon_Quartic>
81
+ </modules>
82
+ </translate>
83
+ <events>
84
+ <core_block_abstract_to_html_after>
85
+ <observers>
86
+ <quartic>
87
+ <type>singleton</type>
88
+ <class>quartic/observer_frontend</class>
89
+ <method>blockAbstractToHtmlAfter</method>
90
+ </quartic>
91
+ </observers>
92
+ </core_block_abstract_to_html_after>
93
+ <controller_front_send_response_before>
94
+ <observers>
95
+ <quartic_controller_front_send_response_before>
96
+ <type>singleton</type>
97
+ <class>quartic/observer_frontend</class>
98
+ <method>controllerFrontSendResponseBefore</method>
99
+ </quartic_controller_front_send_response_before>
100
+ </observers>
101
+ </controller_front_send_response_before>
102
+ </events>
103
+ </frontend>
104
+ <default>
105
+ <quartic>
106
+ <config>
107
+ <active>0</active>
108
+ <use_sku>0</use_sku>
109
+ <add_thumbs>0</add_thumbs>
110
+ <only_in_stock>0</only_in_stock>
111
+ <show_disabled_products>1</show_disabled_products>
112
+ <category_use_product_frame>0</category_use_product_frame>
113
+ <min_qty>0</min_qty>
114
+ <visibility>4</visibility>
115
+ <configurable_price>0</configurable_price>
116
+ <feed>
117
+ <product>
118
+ <iteration_step>250</iteration_step>
119
+ </product>
120
+ </feed>
121
+ </config>
122
+ <composite>
123
+ <configurable_childs>1</configurable_childs>
124
+ <configurable_child_image>0</configurable_child_image>
125
+ <configurable_child_price>1</configurable_child_price>
126
+ <grouped_child_image>0</grouped_child_image>
127
+ <grouped_child_price>0</grouped_child_price>
128
+ </composite>
129
+ </quartic>
130
+ </default>
131
+ <adminhtml>
132
+ <events>
133
+ <admin_system_config_changed_section_quartic>
134
+ <observers>
135
+ <quartic>
136
+ <type>singleton</type>
137
+ <class>quartic/observer_adminhtml</class>
138
+ <method>handle_adminSystemConfigChangedSection</method>
139
+ </quartic>
140
+ </observers>
141
+ </admin_system_config_changed_section_quartic>
142
+ <controller_action_layout_load_before>
143
+ <observers>
144
+ <quartic_predispatch>
145
+ <type>singleton</type>
146
+ <class>quartic/observer_adminhtml</class>
147
+ <method>adminPageBefore</method>
148
+ </quartic_predispatch>
149
+ </observers>
150
+ </controller_action_layout_load_before>
151
+ </events>
152
+ <translate>
153
+ <modules>
154
+ <Quarticon_Quartic>
155
+ <files>
156
+ <default>Quarticon_Quartic.csv</default>
157
+ </files>
158
+ </Quarticon_Quartic>
159
+ </modules>
160
+ </translate>
161
+ <acl>
162
+ <resources>
163
+ <!--<all>
164
+ <title>Allow Everything</title>
165
+ </all>-->
166
+ <admin>
167
+ <children>
168
+ <system>
169
+ <children>
170
+ <config>
171
+ <children>
172
+ <!-- <quartic>
173
+ <title>QUARTICON | Quartic</title>
174
+ </quartic> -->
175
+ <plugin>
176
+ <title>Plugin</title>
177
+ </plugin>
178
+ </children>
179
+ </config>
180
+ </children>
181
+ </system>
182
+ </children>
183
+ </admin>
184
+ </resources>
185
+ </acl>
186
+ <layout>
187
+ <updates>
188
+ <quartic>
189
+ <file>quartic.xml</file>
190
+ </quartic>
191
+ </updates>
192
+ </layout>
193
+ </adminhtml>
194
+ <crontab>
195
+ <jobs>
196
+ <quartic>
197
+ <schedule>
198
+ <cron_expr>2 * * * *</cron_expr>
199
+ </schedule>
200
+ <run>
201
+ <model>quartic/cron::refreshProductsFeed</model>
202
+ </run>
203
+ </quartic>
204
+ </jobs>
205
+ </crontab>
206
+ <admin>
207
+ <routers>
208
+ <quartic>
209
+ <use>admin</use>
210
+ <args>
211
+ <module>Quarticon_Quartic</module>
212
+ <frontName>quartic</frontName>
213
+ </args>
214
+ </quartic>
215
+ </routers>
216
+ </admin>
217
+ </config>
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/etc/system.xml CHANGED
@@ -1,604 +1,162 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <sections>
4
- <quartic translate="label" module="quartic">
5
- <label><![CDATA[<div class="quarticon-headline"></div>QUARTICON | Quartic]]></label>
6
- <tab>general</tab>
7
- <sort_order>1600</sort_order>
8
- <show_in_default>1</show_in_default>
9
- <show_in_website>1</show_in_website>
10
- <show_in_store>1</show_in_store>
11
- <groups>
12
- <config translate="label">
13
- <label>Configuration</label>
14
- <frontend_type>fieldset</frontend_type>
15
- <frontend_model>quartic/adminhtml_system_config_form_fieldset</frontend_model>
16
- <sort_order>10</sort_order>
17
- <show_in_default>1</show_in_default>
18
- <show_in_website>1</show_in_website>
19
- <show_in_store>1</show_in_store>
20
- <fields>
21
- <active translate="label">
22
- <label>Enabled</label>
23
- <frontend_type>select</frontend_type>
24
- <source_model>adminhtml/system_config_source_yesno</source_model>
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
- <tooltip>Select if plugin should be enabled or disabled.</tooltip>
30
- </active>
31
- <customer translate="label">
32
- <label>API username</label>
33
- <frontend_type>text</frontend_type>
34
- <comment>This value is used for API authenthication</comment>
35
- <sort_order>20</sort_order>
36
- <show_in_default>1</show_in_default>
37
- <show_in_website>1</show_in_website>
38
- <show_in_store>1</show_in_store>
39
- <tooltip>This value is used for API authentication and can be found in Quartic control panel (settings tab). Field must be filled in order to use this plugin.</tooltip>
40
- </customer>
41
- <api_key translate="label,comment">
42
- <label>API key</label>
43
- <frontend_type>text</frontend_type>
44
- <comment>This value is used for API authenthication</comment>
45
- <sort_order>30</sort_order>
46
- <show_in_default>1</show_in_default>
47
- <show_in_website>1</show_in_website>
48
- <show_in_store>1</show_in_store>
49
- <tooltip>This value is used for API authentication and can be found in Quartic control panel (settings tab). Field must be filled in order to use this plugin.</tooltip>
50
- </api_key>
51
- <register translate="label,comment">
52
- <label>Register</label>
53
- <frontend_type>button</frontend_type>
54
- <frontend_model>quartic/adminhtml_system_config_form_field_register</frontend_model>
55
- <comment>Register to obtain values for customer login and key configuration fields</comment>
56
- <sort_order>35</sort_order>
57
- <show_in_default>1</show_in_default>
58
- <show_in_website>1</show_in_website>
59
- <show_in_store>1</show_in_store>
60
- </register>
61
- <show_disabled_products translate="label">
62
- <label>Show disabled products in XML feed?</label>
63
- <frontend_type>select</frontend_type>
64
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
65
- <source_model>adminhtml/system_config_source_yesno</source_model>
66
- <sort_order>70</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
- <tooltip>Decide if you wish to include disabled product in product feed which is downloaded on a daily basis. It will not affect your recommendations.</tooltip>
71
- </show_disabled_products>
72
- <min_qty translate="label">
73
- <label>Minimal product quantity for status equals 1</label>
74
- <frontend_type>text</frontend_type>
75
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
76
- <sort_order>80</sort_order>
77
- <show_in_default>1</show_in_default>
78
- <show_in_website>1</show_in_website>
79
- <show_in_store>1</show_in_store>
80
- <validate>validate-number validate-zero-or-greater</validate>
81
- <tooltip>Set the number of items in stock to mark them as available for sale (this will affect what products are recommended).</tooltip>
82
- </min_qty>
83
- <!-- <visibility translate="label">
84
- <label>Product visibility in feed</label>
85
- <frontend_type>multiselect</frontend_type>
86
- <source_model>quartic/system_config_source_visibility</source_model>
87
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
88
- <sort_order>81</sort_order>
89
- <show_in_default>1</show_in_default>
90
- <show_in_website>1</show_in_website>
91
- <show_in_store>1</show_in_store>
92
- </visibility> -->
93
- <catalog_id translate="label">
94
- <label>Quartic Catalog Name</label>
95
- <frontend_type>select</frontend_type>
96
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
97
- <source_model>quartic/catalog</source_model>
98
- <sort_order>90</sort_order>
99
- <show_in_default>1</show_in_default>
100
- <show_in_website>1</show_in_website>
101
- <show_in_store>1</show_in_store>
102
- <validate>validate-number</validate>
103
- <tooltip>At the beginning select ‘—Create new—‘ this will generate your first product catalog which will be uploaded to our cloud later.</tooltip>
104
- </catalog_id>
105
- <getplacements translate="label,comment">
106
- <label>Get Placements</label>
107
- <frontend_type>button</frontend_type>
108
- <frontend_model>quartic/adminhtml_system_config_form_field_button</frontend_model>
109
- <button_url>adminhtml/api/placements</button_url>
110
- <comment>Load placement snippets from your QuarticON account</comment>
111
- <sort_order>100</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
- <tooltip>Load placement snippets from your QuarticON account.</tooltip>
116
- </getplacements>
117
- <sendorders translate="label,comment">
118
- <label>Send Transaction History</label>
119
- <frontend_type>button</frontend_type>
120
- <frontend_model>quartic/adminhtml_system_config_form_field_button</frontend_model>
121
- <button_url>adminhtml/api/prepareorders</button_url>
122
- <comment>Send transaction history to your QuarticON account</comment>
123
- <sort_order>110</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
- <tooltip>Send transaction history to your QuarticON account.</tooltip>
128
- </sendorders>
129
- </fields>
130
- </config>
131
- <composite translate="label">
132
- <label>Composite products</label>
133
- <frontend_type>fieldset</frontend_type>
134
- <frontend_model>quartic/adminhtml_system_config_form_fieldset</frontend_model>
135
- <sort_order>20</sort_order>
136
- <show_in_default>1</show_in_default>
137
- <show_in_website>1</show_in_website>
138
- <show_in_store>1</show_in_store>
139
- <fields>
140
- <configurable_price translate="label">
141
- <label>Price type of configurable product</label>
142
- <frontend_type>select</frontend_type>
143
- <source_model>quartic/system_config_source_configurableprice</source_model>
144
- <sort_order>1</sort_order>
145
- <show_in_default>1</show_in_default>
146
- <show_in_website>1</show_in_website>
147
- <show_in_store>1</show_in_store>
148
- </configurable_price>
149
- <configurable_childs translate="label">
150
- <label>Configurable children products</label>
151
- <frontend_type>select</frontend_type>
152
- <source_model>quartic/system_config_source_configurablechilds</source_model>
153
- <sort_order>10</sort_order>
154
- <show_in_default>1</show_in_default>
155
- <show_in_website>1</show_in_website>
156
- <show_in_store>1</show_in_store>
157
- </configurable_childs>
158
- <configurable_child_image translate="label">
159
- <label>Configurable children product image</label>
160
- <frontend_type>select</frontend_type>
161
- <source_model>quartic/system_config_source_configurablechildimage</source_model>
162
- <sort_order>20</sort_order>
163
- <show_in_default>1</show_in_default>
164
- <show_in_website>1</show_in_website>
165
- <show_in_store>1</show_in_store>
166
- </configurable_child_image>
167
- <configurable_child_price translate="label">
168
- <label>Configurable children product price</label>
169
- <frontend_type>select</frontend_type>
170
- <source_model>quartic/system_config_source_configurablechildprice</source_model>
171
- <sort_order>30</sort_order>
172
- <show_in_default>1</show_in_default>
173
- <show_in_website>1</show_in_website>
174
- <show_in_store>1</show_in_store>
175
- </configurable_child_price>
176
- <configurable_child_redirect translate="label">
177
- <label>Redirect simple product to configurable</label>
178
- <frontend_type>select</frontend_type>
179
- <source_model>adminhtml/system_config_source_yesno</source_model>
180
- <sort_order>40</sort_order>
181
- <show_in_default>1</show_in_default>
182
- <show_in_website>1</show_in_website>
183
- <show_in_store>1</show_in_store>
184
- </configurable_child_redirect>
185
- <grouped_child_price translate="label">
186
- <label>Grouped product price</label>
187
- <frontend_type>select</frontend_type>
188
- <source_model>quartic/system_config_source_groupedprice</source_model>
189
- <sort_order>50</sort_order>
190
- <show_in_default>1</show_in_default>
191
- <show_in_website>1</show_in_website>
192
- <show_in_store>1</show_in_store>
193
- </grouped_child_price>
194
- <grouped_child_image translate="label">
195
- <label>Grouped children product image</label>
196
- <frontend_type>select</frontend_type>
197
- <source_model>quartic/system_config_source_groupedchildimage</source_model>
198
- <sort_order>60</sort_order>
199
- <show_in_default>1</show_in_default>
200
- <show_in_website>1</show_in_website>
201
- <show_in_store>1</show_in_store>
202
- </grouped_child_image>
203
- <grouped_child_redirect translate="label">
204
- <label>Redirect simple product to grouped</label>
205
- <frontend_type>select</frontend_type>
206
- <source_model>adminhtml/system_config_source_yesno</source_model>
207
- <sort_order>70</sort_order>
208
- <show_in_default>1</show_in_default>
209
- <show_in_website>1</show_in_website>
210
- <show_in_store>1</show_in_store>
211
- </grouped_child_redirect>
212
- </fields>
213
- </composite>
214
- <!-- PLACEMENTS FOR HOME -->
215
- <frames_homepage translate="label">
216
- <label>Recommendation frames - Homepage</label>
217
- <frontend_type>fieldset</frontend_type>
218
- <frontend_model>quartic/adminhtml_system_config_form_fieldset</frontend_model>
219
- <allow_empty>true</allow_empty>
220
- <sort_order>30</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
- <fields>
225
- <top translate="label">
226
- <label>Top</label>
227
- <frontend_type>select</frontend_type>
228
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
229
- <source_model>quartic/placement_home</source_model>
230
- <sort_order>10</sort_order>
231
- <show_in_default>1</show_in_default>
232
- <show_in_website>1</show_in_website>
233
- <show_in_store>1</show_in_store>
234
- <tooltip>Select which widget should be displayed on your homepage top placement.</tooltip>
235
- </top>
236
- <top_enabled translate="label">
237
- <label><![CDATA[&#9654; Enabled]]></label>
238
- <comment><![CDATA[<br />]]></comment>
239
- <frontend_type>select</frontend_type>
240
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
241
- <source_model>adminhtml/system_config_source_yesno</source_model>
242
- <sort_order>15</sort_order>
243
- <show_in_default>1</show_in_default>
244
- <show_in_website>1</show_in_website>
245
- <show_in_store>1</show_in_store>
246
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
247
- </top_enabled>
248
- <bottom translate="label">
249
- <label>Bottom</label>
250
- <frontend_type>select</frontend_type>
251
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
252
- <source_model>quartic/placement_home</source_model>
253
- <sort_order>20</sort_order>
254
- <show_in_default>1</show_in_default>
255
- <show_in_website>1</show_in_website>
256
- <show_in_store>1</show_in_store>
257
- <tooltip>Select which widget should be displayed on your homepage bottom placement.</tooltip>
258
- </bottom>
259
- <bottom_enabled translate="label">
260
- <label><![CDATA[&#9654; Enabled]]></label>
261
- <comment><![CDATA[<br />]]></comment>
262
- <frontend_type>select</frontend_type>
263
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
264
- <source_model>adminhtml/system_config_source_yesno</source_model>
265
- <sort_order>25</sort_order>
266
- <show_in_default>1</show_in_default>
267
- <show_in_website>1</show_in_website>
268
- <show_in_store>1</show_in_store>
269
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
270
- </bottom_enabled>
271
- </fields>
272
- </frames_homepage>
273
- <!-- PLACEMENTS FOR CATEGORY -->
274
- <frames_category translate="label">
275
- <label>Recommendation frames - Category</label>
276
- <frontend_type>fieldset</frontend_type>
277
- <frontend_model>quartic/adminhtml_system_config_form_fieldset</frontend_model>
278
- <allow_empty>true</allow_empty>
279
- <sort_order>40</sort_order>
280
- <show_in_default>1</show_in_default>
281
- <show_in_website>1</show_in_website>
282
- <show_in_store>1</show_in_store>
283
- <fields>
284
- <category_use_product_frame translate="label,comment">
285
- <label>Use product frame on category page</label>
286
- <comment>Category page frames will show recommendations related to random product instead of recommendations related to whole category</comment>
287
- <!--<comment>Recommendations will be get for random product from a category</comment>-->
288
- <frontend_type>select</frontend_type>
289
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
290
- <source_model>adminhtml/system_config_source_yesno</source_model>
291
- <sort_order>5</sort_order>
292
- <show_in_default>1</show_in_default>
293
- <show_in_website>1</show_in_website>
294
- <show_in_store>1</show_in_store>
295
- <tooltip>Category page frames will show recommendations related to random product instead of recommendations related to whole category.</tooltip>
296
- </category_use_product_frame>
297
- <top translate="label">
298
- <label>Top</label>
299
- <frontend_type>select</frontend_type>
300
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
301
- <source_model>quartic/placement_category</source_model>
302
- <sort_order>10</sort_order>
303
- <show_in_default>1</show_in_default>
304
- <show_in_website>1</show_in_website>
305
- <show_in_store>1</show_in_store>
306
- <tooltip>Select which widget should be displayed on your category top placement.</tooltip>
307
- </top>
308
- <top_enabled translate="label">
309
- <label><![CDATA[&#9654; Enabled]]></label>
310
- <comment><![CDATA[<br />]]></comment>
311
- <frontend_type>select</frontend_type>
312
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
313
- <source_model>adminhtml/system_config_source_yesno</source_model>
314
- <sort_order>15</sort_order>
315
- <show_in_default>1</show_in_default>
316
- <show_in_website>1</show_in_website>
317
- <show_in_store>1</show_in_store>
318
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
319
- </top_enabled>
320
- <left translate="label">
321
- <label>Left</label>
322
- <frontend_type>select</frontend_type>
323
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
324
- <source_model>quartic/placement_category</source_model>
325
- <sort_order>20</sort_order>
326
- <show_in_default>1</show_in_default>
327
- <show_in_website>1</show_in_website>
328
- <show_in_store>1</show_in_store>
329
- <tooltip>Select which widget should be displayed on your category left placement.</tooltip>
330
- </left>
331
- <left_enabled translate="label">
332
- <label><![CDATA[&#9654; Enabled]]></label>
333
- <comment><![CDATA[<br />]]></comment>
334
- <frontend_type>select</frontend_type>
335
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
336
- <source_model>adminhtml/system_config_source_yesno</source_model>
337
- <sort_order>25</sort_order>
338
- <show_in_default>1</show_in_default>
339
- <show_in_website>1</show_in_website>
340
- <show_in_store>1</show_in_store>
341
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
342
- </left_enabled>
343
- <bottom translate="label">
344
- <label>Bottom</label>
345
- <frontend_type>select</frontend_type>
346
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
347
- <source_model>quartic/placement_category</source_model>
348
- <sort_order>30</sort_order>
349
- <show_in_default>1</show_in_default>
350
- <show_in_website>1</show_in_website>
351
- <show_in_store>1</show_in_store>
352
- <tooltip>Select which widget should be displayed on your category bottom placement.</tooltip>
353
- </bottom>
354
- <bottom_enabled translate="label">
355
- <label><![CDATA[&#9654; Enabled]]></label>
356
- <comment><![CDATA[<br />]]></comment>
357
- <frontend_type>select</frontend_type>
358
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
359
- <source_model>adminhtml/system_config_source_yesno</source_model>
360
- <sort_order>35</sort_order>
361
- <show_in_default>1</show_in_default>
362
- <show_in_website>1</show_in_website>
363
- <show_in_store>1</show_in_store>
364
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
365
- </bottom_enabled>
366
- <right translate="label">
367
- <label>Right</label>
368
- <frontend_type>select</frontend_type>
369
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
370
- <source_model>quartic/placement_category</source_model>
371
- <sort_order>40</sort_order>
372
- <show_in_default>1</show_in_default>
373
- <show_in_website>1</show_in_website>
374
- <show_in_store>1</show_in_store>
375
- <tooltip>Select which widget should be displayed on your category right placement.</tooltip>
376
- </right>
377
- <right_enabled translate="label">
378
- <label><![CDATA[&#9654; Enabled]]></label>
379
- <comment><![CDATA[<br />]]></comment>
380
- <frontend_type>select</frontend_type>
381
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
382
- <source_model>adminhtml/system_config_source_yesno</source_model>
383
- <sort_order>45</sort_order>
384
- <show_in_default>1</show_in_default>
385
- <show_in_website>1</show_in_website>
386
- <show_in_store>1</show_in_store>
387
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
388
- </right_enabled>
389
- </fields>
390
- </frames_category>
391
- <!-- PLACEMENTS FOR PRODUCT -->
392
- <frames_product translate="label">
393
- <label>Recommendation frames - Product</label>
394
- <frontend_type>fieldset</frontend_type>
395
- <frontend_model>quartic/adminhtml_system_config_form_fieldset</frontend_model>
396
- <allow_empty>true</allow_empty>
397
- <sort_order>50</sort_order>
398
- <show_in_default>1</show_in_default>
399
- <show_in_website>1</show_in_website>
400
- <show_in_store>1</show_in_store>
401
- <fields>
402
- <top translate="label">
403
- <label>Top</label>
404
- <frontend_type>select</frontend_type>
405
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
406
- <source_model>quartic/placement_product</source_model>
407
- <sort_order>10</sort_order>
408
- <show_in_default>1</show_in_default>
409
- <show_in_website>1</show_in_website>
410
- <show_in_store>1</show_in_store>
411
- <tooltip>Select which widget should be displayed on your product top placement.</tooltip>
412
- </top>
413
- <top_enabled translate="label">
414
- <label><![CDATA[&#9654; Enabled]]></label>
415
- <comment><![CDATA[<br />]]></comment>
416
- <frontend_type>select</frontend_type>
417
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
418
- <source_model>adminhtml/system_config_source_yesno</source_model>
419
- <sort_order>15</sort_order>
420
- <show_in_default>1</show_in_default>
421
- <show_in_website>1</show_in_website>
422
- <show_in_store>1</show_in_store>
423
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
424
- </top_enabled>
425
- <middle translate="label">
426
- <label>Middle</label>
427
- <frontend_type>select</frontend_type>
428
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
429
- <source_model>quartic/placement_product</source_model>
430
- <sort_order>20</sort_order>
431
- <show_in_default>1</show_in_default>
432
- <show_in_website>1</show_in_website>
433
- <show_in_store>1</show_in_store>
434
- <tooltip>Select which widget should be displayed on your product middle placement.</tooltip>
435
- </middle>
436
- <middle_enabled translate="label">
437
- <label><![CDATA[&#9654; Enabled]]></label>
438
- <comment><![CDATA[<br />]]></comment>
439
- <frontend_type>select</frontend_type>
440
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
441
- <source_model>adminhtml/system_config_source_yesno</source_model>
442
- <sort_order>25</sort_order>
443
- <show_in_default>1</show_in_default>
444
- <show_in_website>1</show_in_website>
445
- <show_in_store>1</show_in_store>
446
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
447
- </middle_enabled>
448
- <bottom translate="label">
449
- <label>Bottom</label>
450
- <frontend_type>select</frontend_type>
451
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
452
- <source_model>quartic/placement_product</source_model>
453
- <sort_order>30</sort_order>
454
- <show_in_default>1</show_in_default>
455
- <show_in_website>1</show_in_website>
456
- <show_in_store>1</show_in_store>
457
- <tooltip>Select which widget should be displayed on your product bottom placement.</tooltip>
458
- </bottom>
459
- <bottom_enabled translate="label">
460
- <label><![CDATA[&#9654; Enabled]]></label>
461
- <comment><![CDATA[<br />]]></comment>
462
- <frontend_type>select</frontend_type>
463
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
464
- <source_model>adminhtml/system_config_source_yesno</source_model>
465
- <sort_order>35</sort_order>
466
- <show_in_default>1</show_in_default>
467
- <show_in_website>1</show_in_website>
468
- <show_in_store>1</show_in_store>
469
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
470
- </bottom_enabled>
471
- <right translate="label">
472
- <label>Right</label>
473
- <frontend_type>select</frontend_type>
474
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
475
- <source_model>quartic/placement_product</source_model>
476
- <sort_order>40</sort_order>
477
- <show_in_default>1</show_in_default>
478
- <show_in_website>1</show_in_website>
479
- <show_in_store>1</show_in_store>
480
- <tooltip>Select which widget should be displayed on your product right placement.</tooltip>
481
- </right>
482
- <right_enabled translate="label">
483
- <label><![CDATA[&#9654; Enabled]]></label>
484
- <comment><![CDATA[<br />]]></comment>
485
- <frontend_type>select</frontend_type>
486
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
487
- <source_model>adminhtml/system_config_source_yesno</source_model>
488
- <sort_order>45</sort_order>
489
- <show_in_default>1</show_in_default>
490
- <show_in_website>1</show_in_website>
491
- <show_in_store>1</show_in_store>
492
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
493
- </right_enabled>
494
- </fields>
495
- </frames_product>
496
- <!-- PLACEMENTS FOR CART -->
497
- <frames_cart translate="label">
498
- <label>Recommendation frames - Cart</label>
499
- <frontend_type>fieldset</frontend_type>
500
- <frontend_model>quartic/adminhtml_system_config_form_fieldset</frontend_model>
501
- <allow_empty>true</allow_empty>
502
- <sort_order>60</sort_order>
503
- <show_in_default>1</show_in_default>
504
- <show_in_website>1</show_in_website>
505
- <show_in_store>1</show_in_store>
506
- <fields>
507
- <top translate="label">
508
- <label>Top</label>
509
- <frontend_type>select</frontend_type>
510
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
511
- <source_model>quartic/placement_cart</source_model>
512
- <sort_order>10</sort_order>
513
- <show_in_default>1</show_in_default>
514
- <show_in_website>1</show_in_website>
515
- <show_in_store>1</show_in_store>
516
- <tooltip>Select which widget should be displayed on your cart top placement.</tooltip>
517
- </top>
518
- <top_enabled translate="label">
519
- <label><![CDATA[&#9654; Enabled]]></label>
520
- <comment><![CDATA[<br />]]></comment>
521
- <frontend_type>select</frontend_type>
522
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
523
- <source_model>adminhtml/system_config_source_yesno</source_model>
524
- <sort_order>15</sort_order>
525
- <show_in_default>1</show_in_default>
526
- <show_in_website>1</show_in_website>
527
- <show_in_store>1</show_in_store>
528
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
529
- </top_enabled>
530
- <middle translate="label">
531
- <label>Middle</label>
532
- <frontend_type>select</frontend_type>
533
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
534
- <source_model>quartic/placement_cart</source_model>
535
- <sort_order>20</sort_order>
536
- <show_in_default>1</show_in_default>
537
- <show_in_website>1</show_in_website>
538
- <show_in_store>1</show_in_store>
539
- <tooltip>Select which widget should be displayed on your cart middle placement.</tooltip>
540
- </middle>
541
- <middle_enabled translate="label">
542
- <label><![CDATA[&#9654; Enabled]]></label>
543
- <comment><![CDATA[<br />]]></comment>
544
- <frontend_type>select</frontend_type>
545
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
546
- <source_model>adminhtml/system_config_source_yesno</source_model>
547
- <sort_order>25</sort_order>
548
- <show_in_default>1</show_in_default>
549
- <show_in_website>1</show_in_website>
550
- <show_in_store>1</show_in_store>
551
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
552
- </middle_enabled>
553
- <bottom translate="label">
554
- <label>Bottom</label>
555
- <frontend_type>select</frontend_type>
556
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
557
- <source_model>quartic/placement_cart</source_model>
558
- <sort_order>30</sort_order>
559
- <show_in_default>1</show_in_default>
560
- <show_in_website>1</show_in_website>
561
- <show_in_store>1</show_in_store>
562
- <tooltip>Select which widget should be displayed on your cart bottom placement.</tooltip>
563
- </bottom>
564
- <bottom_enabled translate="label">
565
- <label><![CDATA[&#9654; Enabled]]></label>
566
- <comment><![CDATA[<br />]]></comment>
567
- <frontend_type>select</frontend_type>
568
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
569
- <source_model>adminhtml/system_config_source_yesno</source_model>
570
- <sort_order>35</sort_order>
571
- <show_in_default>1</show_in_default>
572
- <show_in_website>1</show_in_website>
573
- <show_in_store>1</show_in_store>
574
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
575
- </bottom_enabled>
576
- <right translate="label">
577
- <label>Right</label>
578
- <frontend_type>select</frontend_type>
579
- <frontend_model>quartic/adminhtml_system_config_form_field_placement</frontend_model>
580
- <source_model>quartic/placement_cart</source_model>
581
- <sort_order>40</sort_order>
582
- <show_in_default>1</show_in_default>
583
- <show_in_website>1</show_in_website>
584
- <show_in_store>1</show_in_store>
585
- <tooltip>Select which widget should be displayed on your cart right placement.</tooltip>
586
- </right>
587
- <right_enabled translate="label">
588
- <label><![CDATA[&#9654; Enabled]]></label>
589
- <comment><![CDATA[<br />]]></comment>
590
- <frontend_type>select</frontend_type>
591
- <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
592
- <source_model>adminhtml/system_config_source_yesno</source_model>
593
- <sort_order>45</sort_order>
594
- <show_in_default>1</show_in_default>
595
- <show_in_website>1</show_in_website>
596
- <show_in_store>1</show_in_store>
597
- <tooltip>Select if widget should be enabled or disabled.</tooltip>
598
- </right_enabled>
599
- </fields>
600
- </frames_cart>
601
- </groups>
602
- </quartic>
603
- </sections>
604
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <plugin translate="label" module="quartic">
5
+ <label>Plugin</label>
6
+ <tab>general</tab>
7
+ <sort_order>1500</sort_order>
8
+ <show_in_default>1</show_in_default>
9
+ <show_in_website>1</show_in_website>
10
+ <show_in_store>1</show_in_store>
11
+ <groups>
12
+ <config translate="label">
13
+ <label>Plugin</label>
14
+ <frontend_type>link</frontend_type>
15
+ <frontend_model>quartic/adminhtml_system_config_form_iframe</frontend_model>
16
+ <sort_order>10</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ </config>
21
+ </groups>
22
+ </plugin>
23
+ <!-- <quartic translate="label" module="quartic">
24
+ <label><![CDATA[<div class="quarticon-headline"></div>QUARTICON | Quartic]]></label>
25
+ <tab>general</tab>
26
+ <sort_order>1600</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ <groups>
31
+ <config translate="label">
32
+ <label>Configuration</label>
33
+ <frontend_type>fieldset</frontend_type>
34
+ <frontend_model>quartic/adminhtml_system_config_form_fieldset</frontend_model>
35
+ <sort_order>10</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <fields>
40
+ <show_disabled_products translate="label">
41
+ <label>Show disabled products in XML feed?</label>
42
+ <frontend_type>select</frontend_type>
43
+ <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
44
+ <source_model>adminhtml/system_config_source_yesno</source_model>
45
+ <sort_order>70</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ <tooltip>Decide if you wish to include disabled product in product feed which is downloaded on a daily basis. It will not affect your recommendations.</tooltip>
50
+ </show_disabled_products>
51
+ <min_qty translate="label">
52
+ <label>Minimal product quantity for status equals 1</label>
53
+ <frontend_type>text</frontend_type>
54
+ <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
55
+ <sort_order>80</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>1</show_in_store>
59
+ <validate>validate-number validate-zero-or-greater</validate>
60
+ <tooltip>Set the number of items in stock to mark them as available for sale (this will affect what products are recommended).</tooltip>
61
+ </min_qty>
62
+ <catalog_id translate="label">
63
+ <label>Quartic Catalog Name</label>
64
+ <frontend_type>select</frontend_type>
65
+ <frontend_model>quartic/adminhtml_system_config_form_field_text</frontend_model>
66
+ <source_model>quartic/catalog</source_model>
67
+ <sort_order>90</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ <validate>validate-number</validate>
72
+ <tooltip>At the beginning select ‘—Create new—‘ this will generate your first product catalog which will be uploaded to our cloud later.</tooltip>
73
+ </catalog_id>
74
+ </fields>
75
+ </config>
76
+ <composite translate="label">
77
+ <label>Composite products</label>
78
+ <frontend_type>fieldset</frontend_type>
79
+ <frontend_model>quartic/adminhtml_system_config_form_fieldset</frontend_model>
80
+ <sort_order>20</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ <fields>
85
+ <configurable_price translate="label">
86
+ <label>Price type of configurable product</label>
87
+ <frontend_type>select</frontend_type>
88
+ <source_model>quartic/system_config_source_configurableprice</source_model>
89
+ <sort_order>1</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ </configurable_price>
94
+ <configurable_childs translate="label">
95
+ <label>Configurable children products</label>
96
+ <frontend_type>select</frontend_type>
97
+ <source_model>quartic/system_config_source_configurablechilds</source_model>
98
+ <sort_order>10</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>1</show_in_store>
102
+ </configurable_childs>
103
+ <configurable_child_image translate="label">
104
+ <label>Configurable children product image</label>
105
+ <frontend_type>select</frontend_type>
106
+ <source_model>quartic/system_config_source_configurablechildimage</source_model>
107
+ <sort_order>20</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ </configurable_child_image>
112
+ <configurable_child_price translate="label">
113
+ <label>Configurable children product price</label>
114
+ <frontend_type>select</frontend_type>
115
+ <source_model>quartic/system_config_source_configurablechildprice</source_model>
116
+ <sort_order>30</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ </configurable_child_price>
121
+ <configurable_child_redirect translate="label">
122
+ <label>Redirect simple product to configurable</label>
123
+ <frontend_type>select</frontend_type>
124
+ <source_model>adminhtml/system_config_source_yesno</source_model>
125
+ <sort_order>40</sort_order>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>1</show_in_website>
128
+ <show_in_store>1</show_in_store>
129
+ </configurable_child_redirect>
130
+ <grouped_child_price translate="label">
131
+ <label>Grouped product price</label>
132
+ <frontend_type>select</frontend_type>
133
+ <source_model>quartic/system_config_source_groupedprice</source_model>
134
+ <sort_order>50</sort_order>
135
+ <show_in_default>1</show_in_default>
136
+ <show_in_website>1</show_in_website>
137
+ <show_in_store>1</show_in_store>
138
+ </grouped_child_price>
139
+ <grouped_child_image translate="label">
140
+ <label>Grouped children product image</label>
141
+ <frontend_type>select</frontend_type>
142
+ <source_model>quartic/system_config_source_groupedchildimage</source_model>
143
+ <sort_order>60</sort_order>
144
+ <show_in_default>1</show_in_default>
145
+ <show_in_website>1</show_in_website>
146
+ <show_in_store>1</show_in_store>
147
+ </grouped_child_image>
148
+ <grouped_child_redirect translate="label">
149
+ <label>Redirect simple product to grouped</label>
150
+ <frontend_type>select</frontend_type>
151
+ <source_model>adminhtml/system_config_source_yesno</source_model>
152
+ <sort_order>70</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>1</show_in_store>
156
+ </grouped_child_redirect>
157
+ </fields>
158
+ </composite>
159
+ </groups>
160
+ </quartic> -->
161
+ </sections>
162
+ </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ Mage::getModel('quartic/config')->saveHash();
6
+
7
+ @mail(
8
+ 'contact@quarticon.com',
9
+ '[Install] Quartic 0.1.0',
10
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
11
+ "From: " . (
12
+ Mage::getStoreConfig('general/store_information/email_address') ?
13
+ Mage::getStoreConfig('general/store_information/email_address') :
14
+ 'contact@quarticon.com'
15
+ )
16
+ );
17
+
18
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-install-0.1.4.php CHANGED
@@ -1,32 +1,32 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
-
5
- Mage::getModel('quartic/config')->saveHash();
6
-
7
- $installer->run("
8
- CREATE TABLE IF NOT EXISTS {$this->getTable('quartic_placements')} (
9
- `id` int(11) NOT NULL AUTO_INCREMENT,
10
- `qon_id` int(11) NOT NULL,
11
- `qon_parent_id` int(11) NOT NULL,
12
- `name` varchar(255) NOT NULL,
13
- `div_id` varchar(255) NOT NULL,
14
- `snippet` text NOT NULL,
15
- PRIMARY KEY (`id`),
16
- KEY `qon_id` (`qon_id`),
17
- KEY `qon_parent_id` (`qon_parent_id`)
18
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
19
- ");
20
-
21
- @mail(
22
- 'contact@quarticon.com',
23
- '[Install] Quartic ' . Mage::getConfig()->getModuleConfig("Quarticon_Quartic")->version,
24
- "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
25
- "From: " . (
26
- Mage::getStoreConfig('general/store_information/email_address') ?
27
- Mage::getStoreConfig('general/store_information/email_address') :
28
- 'contact@quarticon.com'
29
- )
30
- );
31
-
32
- $installer->endSetup();
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ Mage::getModel('quartic/config')->saveHash();
6
+
7
+ $installer->run("
8
+ CREATE TABLE IF NOT EXISTS {$this->getTable('quartic_placements')} (
9
+ `id` int(11) NOT NULL AUTO_INCREMENT,
10
+ `qon_id` int(11) NOT NULL,
11
+ `qon_parent_id` int(11) NOT NULL,
12
+ `name` varchar(255) NOT NULL,
13
+ `div_id` varchar(255) NOT NULL,
14
+ `snippet` text NOT NULL,
15
+ PRIMARY KEY (`id`),
16
+ KEY `qon_id` (`qon_id`),
17
+ KEY `qon_parent_id` (`qon_parent_id`)
18
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
19
+ ");
20
+
21
+ @mail(
22
+ 'contact@quarticon.com',
23
+ '[Install] Quartic 0.1.4',
24
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
25
+ "From: " . (
26
+ Mage::getStoreConfig('general/store_information/email_address') ?
27
+ Mage::getStoreConfig('general/store_information/email_address') :
28
+ 'contact@quarticon.com'
29
+ )
30
+ );
31
+
32
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.1.0-0.1.4.php CHANGED
@@ -1,30 +1,30 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
-
5
- $installer->run("
6
- CREATE TABLE IF NOT EXISTS {$this->getTable('quartic_placements')} (
7
- `id` int(11) NOT NULL AUTO_INCREMENT,
8
- `qon_id` int(11) NOT NULL,
9
- `qon_parent_id` int(11) NOT NULL,
10
- `name` varchar(255) NOT NULL,
11
- `div_id` varchar(255) NOT NULL,
12
- `snippet` text NOT NULL,
13
- PRIMARY KEY (`id`),
14
- KEY `qon_id` (`qon_id`),
15
- KEY `qon_parent_id` (`qon_parent_id`)
16
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
17
- ");
18
-
19
- // @mail(
20
- // 'contact@quarticon.com',
21
- // '[Upgrade] Quartic 0.1.4',
22
- // "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
23
- // "From: " . (
24
- // Mage::getStoreConfig('general/store_information/email_address') ?
25
- // Mage::getStoreConfig('general/store_information/email_address') :
26
- // 'contact@quarticon.com'
27
- // )
28
- // );
29
-
30
- $installer->endSetup();
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $installer->run("
6
+ CREATE TABLE IF NOT EXISTS {$this->getTable('quartic_placements')} (
7
+ `id` int(11) NOT NULL AUTO_INCREMENT,
8
+ `qon_id` int(11) NOT NULL,
9
+ `qon_parent_id` int(11) NOT NULL,
10
+ `name` varchar(255) NOT NULL,
11
+ `div_id` varchar(255) NOT NULL,
12
+ `snippet` text NOT NULL,
13
+ PRIMARY KEY (`id`),
14
+ KEY `qon_id` (`qon_id`),
15
+ KEY `qon_parent_id` (`qon_parent_id`)
16
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
17
+ ");
18
+
19
+ @mail(
20
+ 'contact@quarticon.com',
21
+ '[Upgrade] Quartic 0.1.4',
22
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
23
+ "From: " . (
24
+ Mage::getStoreConfig('general/store_information/email_address') ?
25
+ Mage::getStoreConfig('general/store_information/email_address') :
26
+ 'contact@quarticon.com'
27
+ )
28
+ );
29
+
30
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.1.7-0.2.0.php CHANGED
@@ -1,79 +1,79 @@
1
- <?php
2
- $this->startSetup();
3
-
4
- /*
5
- * Feeds history
6
- */
7
-
8
- $sql = <<<SQLTEXT
9
-
10
- DROP TABLE IF EXISTS {$this->getTable('quartic_history')};
11
-
12
- create table {$this->getTable('quartic_history')}(
13
- id int not null auto_increment,
14
- store_id int,
15
- user int,
16
- date timestamp,
17
- PRIMARY KEY (`id`)
18
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
19
-
20
- SQLTEXT;
21
-
22
- $this->run($sql);
23
-
24
- /*
25
- * Install additional product feed mapping attributes
26
- */
27
-
28
- $sql = <<<SQLTEXT
29
-
30
- DROP TABLE IF EXISTS {$this->getTable('quartic_maps')};
31
-
32
- CREATE TABLE {$this->getTable('quartic_maps')}(
33
- id int not null auto_increment,
34
- quartic_attribute varchar(255),
35
- magento_attribute varchar(255),
36
- PRIMARY KEY (`id`)
37
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
38
-
39
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
40
- (NULL, 'title', 'name');
41
-
42
- SQLTEXT;
43
-
44
- $this->run($sql);
45
-
46
- $sql = <<<SQLTEXT
47
-
48
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
49
- (NULL, 'id', 'sku');
50
-
51
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
52
- (NULL, 'price', 'price');
53
-
54
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
55
- (NULL, 'old_price', 'old_price');
56
-
57
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
58
- (NULL, 'status', 'status');
59
-
60
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
61
- (NULL, 'custom1', '');
62
-
63
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
64
- (NULL, 'custom2', '');
65
-
66
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
67
- (NULL, 'custom3', '');
68
-
69
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
70
- (NULL, 'custom4', '');
71
-
72
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
73
- (NULL, 'custom5', '');
74
-
75
- SQLTEXT;
76
-
77
- $this->run($sql);
78
-
79
- $this->endSetup();
1
+ <?php
2
+ $this->startSetup();
3
+
4
+ /*
5
+ * Feeds history
6
+ */
7
+
8
+ $sql = <<<SQLTEXT
9
+
10
+ DROP TABLE IF EXISTS {$this->getTable('quartic_history')};
11
+
12
+ create table {$this->getTable('quartic_history')}(
13
+ id int not null auto_increment,
14
+ store_id int,
15
+ user int,
16
+ date timestamp,
17
+ PRIMARY KEY (`id`)
18
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
19
+
20
+ SQLTEXT;
21
+
22
+ $this->run($sql);
23
+
24
+ /*
25
+ * Install additional product feed mapping attributes
26
+ */
27
+
28
+ $sql = <<<SQLTEXT
29
+
30
+ DROP TABLE IF EXISTS {$this->getTable('quartic_maps')};
31
+
32
+ CREATE TABLE {$this->getTable('quartic_maps')}(
33
+ id int not null auto_increment,
34
+ quartic_attribute varchar(255),
35
+ magento_attribute varchar(255),
36
+ PRIMARY KEY (`id`)
37
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
38
+
39
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
40
+ (NULL, 'title', 'name');
41
+
42
+ SQLTEXT;
43
+
44
+ $this->run($sql);
45
+
46
+ $sql = <<<SQLTEXT
47
+
48
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
49
+ (NULL, 'id', 'sku');
50
+
51
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
52
+ (NULL, 'price', 'price');
53
+
54
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
55
+ (NULL, 'old_price', 'old_price');
56
+
57
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
58
+ (NULL, 'status', 'status');
59
+
60
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
61
+ (NULL, 'custom1', '');
62
+
63
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
64
+ (NULL, 'custom2', '');
65
+
66
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
67
+ (NULL, 'custom3', '');
68
+
69
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
70
+ (NULL, 'custom4', '');
71
+
72
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
73
+ (NULL, 'custom5', '');
74
+
75
+ SQLTEXT;
76
+
77
+ $this->run($sql);
78
+
79
+ $this->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.2.1-0.2.2.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
-
5
- $installer->run("
6
- ALTER TABLE {$this->getTable('quartic_placements')}
7
- ADD `parent_name` VARCHAR(255) NOT NULL AFTER `qon_parent_id`;
8
- ");
9
-
10
- // @mail(
11
- // 'contact@quarticon.com',
12
- // '[Upgrade] Quartic 0.2.2',
13
- // "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
14
- // "From: " . (
15
- // Mage::getStoreConfig('general/store_information/email_address') ?
16
- // Mage::getStoreConfig('general/store_information/email_address') :
17
- // 'contact@quarticon.com'
18
- // )
19
- // );
20
-
21
- $installer->endSetup();
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $installer->run("
6
+ ALTER TABLE {$this->getTable('quartic_placements')}
7
+ ADD `parent_name` VARCHAR(255) NOT NULL AFTER `qon_parent_id`;
8
+ ");
9
+
10
+ @mail(
11
+ 'contact@quarticon.com',
12
+ '[Upgrade] Quartic 0.2.2',
13
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
14
+ "From: " . (
15
+ Mage::getStoreConfig('general/store_information/email_address') ?
16
+ Mage::getStoreConfig('general/store_information/email_address') :
17
+ 'contact@quarticon.com'
18
+ )
19
+ );
20
+
21
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.2.2-0.2.3.php CHANGED
@@ -1,45 +1,45 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
-
5
- $sql = <<<SQLTEXT
6
- TRUNCATE TABLE {$this->getTable('quartic_maps')};
7
- SQLTEXT;
8
-
9
- $this->run($sql);
10
-
11
- $sql = <<<SQLTEXT
12
-
13
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
14
- (NULL, 'price', 'price');
15
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
16
- (NULL, 'old_price', 'old_price');
17
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
18
- (NULL, 'title', 'name');
19
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
20
- (NULL, 'custom1', '');
21
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
22
- (NULL, 'custom2', '');
23
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
24
- (NULL, 'custom3', '');
25
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
26
- (NULL, 'custom4', '');
27
- INSERT INTO {$this->getTable('quartic_maps')} VALUES
28
- (NULL, 'custom5', '');
29
-
30
- SQLTEXT;
31
-
32
- $this->run($sql);
33
-
34
- // @mail(
35
- // 'contact@quarticon.com',
36
- // '[Upgrade] Quartic 0.2.3',
37
- // "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
38
- // "From: " . (
39
- // Mage::getStoreConfig('general/store_information/email_address') ?
40
- // Mage::getStoreConfig('general/store_information/email_address') :
41
- // 'contact@quarticon.com'
42
- // )
43
- // );
44
-
45
- $installer->endSetup();
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $sql = <<<SQLTEXT
6
+ TRUNCATE TABLE {$this->getTable('quartic_maps')};
7
+ SQLTEXT;
8
+
9
+ $this->run($sql);
10
+
11
+ $sql = <<<SQLTEXT
12
+
13
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
14
+ (NULL, 'price', 'price');
15
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
16
+ (NULL, 'old_price', 'old_price');
17
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
18
+ (NULL, 'title', 'name');
19
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
20
+ (NULL, 'custom1', '');
21
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
22
+ (NULL, 'custom2', '');
23
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
24
+ (NULL, 'custom3', '');
25
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
26
+ (NULL, 'custom4', '');
27
+ INSERT INTO {$this->getTable('quartic_maps')} VALUES
28
+ (NULL, 'custom5', '');
29
+
30
+ SQLTEXT;
31
+
32
+ $this->run($sql);
33
+
34
+ @mail(
35
+ 'contact@quarticon.com',
36
+ '[Upgrade] Quartic 0.2.3',
37
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
38
+ "From: " . (
39
+ Mage::getStoreConfig('general/store_information/email_address') ?
40
+ Mage::getStoreConfig('general/store_information/email_address') :
41
+ 'contact@quarticon.com'
42
+ )
43
+ );
44
+
45
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.2.3-0.2.4.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
-
5
- $use_sku = 0;
6
- Mage::getModel('core/config')->saveConfig('quartic/config/use_sku', $use_sku, 'default', 0);
7
- $add_thumbs = 1;
8
- Mage::getModel('core/config')->saveConfig('quartic/config/add_thumbs', $add_thumbs, 'default', 0);
9
-
10
- // @mail(
11
- // 'contact@quarticon.com',
12
- // '[Upgrade] Quartic 0.2.4',
13
- // "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
14
- // "From: " . (
15
- // Mage::getStoreConfig('general/store_information/email_address') ?
16
- // Mage::getStoreConfig('general/store_information/email_address') :
17
- // 'contact@quarticon.com'
18
- // )
19
- // );
20
-
21
- $installer->endSetup();
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $use_sku = 0;
6
+ Mage::getModel('core/config')->saveConfig('quartic/config/use_sku', $use_sku, 'default', 0);
7
+ $add_thumbs = 1;
8
+ Mage::getModel('core/config')->saveConfig('quartic/config/add_thumbs', $add_thumbs, 'default', 0);
9
+
10
+ @mail(
11
+ 'contact@quarticon.com',
12
+ '[Upgrade] Quartic 0.2.4',
13
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
14
+ "From: " . (
15
+ Mage::getStoreConfig('general/store_information/email_address') ?
16
+ Mage::getStoreConfig('general/store_information/email_address') :
17
+ 'contact@quarticon.com'
18
+ )
19
+ );
20
+
21
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.2.5-0.2.6.php CHANGED
@@ -1,38 +1,38 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
-
5
- $sql = <<<SQLTEXT
6
-
7
- UPDATE {$this->getTable('quartic_maps')} SET
8
- quartic_attribute = 'custom_1'
9
- WHERE quartic_attribute = 'custom1';
10
- UPDATE {$this->getTable('quartic_maps')} SET
11
- quartic_attribute = 'custom_2'
12
- WHERE quartic_attribute = 'custom2';
13
- UPDATE {$this->getTable('quartic_maps')} SET
14
- quartic_attribute = 'custom_3'
15
- WHERE quartic_attribute = 'custom3';
16
- UPDATE {$this->getTable('quartic_maps')} SET
17
- quartic_attribute = 'custom_4'
18
- WHERE quartic_attribute = 'custom4';
19
- UPDATE {$this->getTable('quartic_maps')} SET
20
- quartic_attribute = 'custom_5'
21
- WHERE quartic_attribute = 'custom5';
22
-
23
- SQLTEXT;
24
-
25
- $this->run($sql);
26
-
27
- // @mail(
28
- // 'contact@quarticon.com',
29
- // '[Upgrade] Quartic 0.2.6',
30
- // "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
31
- // "From: " . (
32
- // Mage::getStoreConfig('general/store_information/email_address') ?
33
- // Mage::getStoreConfig('general/store_information/email_address') :
34
- // 'contact@quarticon.com'
35
- // )
36
- // );
37
-
38
- $installer->endSetup();
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $sql = <<<SQLTEXT
6
+
7
+ UPDATE {$this->getTable('quartic_maps')} SET
8
+ quartic_attribute = 'custom_1'
9
+ WHERE quartic_attribute = 'custom1';
10
+ UPDATE {$this->getTable('quartic_maps')} SET
11
+ quartic_attribute = 'custom_2'
12
+ WHERE quartic_attribute = 'custom2';
13
+ UPDATE {$this->getTable('quartic_maps')} SET
14
+ quartic_attribute = 'custom_3'
15
+ WHERE quartic_attribute = 'custom3';
16
+ UPDATE {$this->getTable('quartic_maps')} SET
17
+ quartic_attribute = 'custom_4'
18
+ WHERE quartic_attribute = 'custom4';
19
+ UPDATE {$this->getTable('quartic_maps')} SET
20
+ quartic_attribute = 'custom_5'
21
+ WHERE quartic_attribute = 'custom5';
22
+
23
+ SQLTEXT;
24
+
25
+ $this->run($sql);
26
+
27
+ @mail(
28
+ 'contact@quarticon.com',
29
+ '[Upgrade] Quartic 0.2.6',
30
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
31
+ "From: " . (
32
+ Mage::getStoreConfig('general/store_information/email_address') ?
33
+ Mage::getStoreConfig('general/store_information/email_address') :
34
+ 'contact@quarticon.com'
35
+ )
36
+ );
37
+
38
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.3.1-0.3.2.php CHANGED
@@ -1,26 +1,26 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
-
5
- $sql = <<<SQLTEXT
6
- DELETE FROM {$this->getTable('core_config_data')}
7
- WHERE path LIKE 'quartic/frames%';
8
- SQLTEXT;
9
-
10
- $this->run($sql);
11
-
12
- $cache = Mage::app()->getCacheInstance();
13
- $cache->cleanType('config');
14
-
15
- // @mail(
16
- // 'contact@quarticon.com',
17
- // '[Upgrade] Quartic 0.3.2',
18
- // "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
19
- // "From: " . (
20
- // Mage::getStoreConfig('general/store_information/email_address') ?
21
- // Mage::getStoreConfig('general/store_information/email_address') :
22
- // 'contact@quarticon.com'
23
- // )
24
- // );
25
-
26
- $installer->endSetup();
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $sql = <<<SQLTEXT
6
+ DELETE FROM {$this->getTable('core_config_data')}
7
+ WHERE path LIKE 'quartic/frames%';
8
+ SQLTEXT;
9
+
10
+ $this->run($sql);
11
+
12
+ $cache = Mage::app()->getCacheInstance();
13
+ $cache->cleanType('config');
14
+
15
+ @mail(
16
+ 'contact@quarticon.com',
17
+ '[Upgrade] Quartic 0.3.2',
18
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
19
+ "From: " . (
20
+ Mage::getStoreConfig('general/store_information/email_address') ?
21
+ Mage::getStoreConfig('general/store_information/email_address') :
22
+ 'contact@quarticon.com'
23
+ )
24
+ );
25
+
26
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.3.2-0.3.3.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ @mail(
6
+ 'contact@quarticon.com',
7
+ '[Upgrade] Quartic 0.3.3',
8
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
9
+ "From: " . (
10
+ Mage::getStoreConfig('general/store_information/email_address') ?
11
+ Mage::getStoreConfig('general/store_information/email_address') :
12
+ 'contact@quarticon.com'
13
+ )
14
+ );
15
+
16
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.3.3-0.3.4.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ @mail(
6
+ 'contact@quarticon.com',
7
+ '[Upgrade] Quartic 0.3.4',
8
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
9
+ "From: " . (
10
+ Mage::getStoreConfig('general/store_information/email_address') ?
11
+ Mage::getStoreConfig('general/store_information/email_address') :
12
+ 'contact@quarticon.com'
13
+ )
14
+ );
15
+
16
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.3.4-0.3.5.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ @mail(
6
+ 'contact@quarticon.com',
7
+ '[Upgrade] Quartic 0.3.5',
8
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
9
+ "From: " . (
10
+ Mage::getStoreConfig('general/store_information/email_address') ?
11
+ Mage::getStoreConfig('general/store_information/email_address') :
12
+ 'contact@quarticon.com'
13
+ )
14
+ );
15
+
16
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-0.3.5-0.3.6.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ @mail(
6
+ 'contact@quarticon.com',
7
+ '[Upgrade] Quartic 0.3.6',
8
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
9
+ "From: " . (
10
+ Mage::getStoreConfig('general/store_information/email_address') ?
11
+ Mage::getStoreConfig('general/store_information/email_address') :
12
+ 'contact@quarticon.com'
13
+ )
14
+ );
15
+
16
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-1.0.2-1.0.3.php CHANGED
@@ -1,48 +1,48 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
- $connection = $installer->getConnection();
5
-
6
- if ($connection->tableColumnExists($this->getTable('quartic_placements'), 'api_name') === false) {
7
- $installer->run("
8
- ALTER TABLE {$this->getTable('quartic_placements')}
9
- ADD `api_name` varchar(255) NOT NULL AFTER `id`;
10
- ");
11
- }
12
-
13
- // category attribute
14
- $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
15
- $setup->addAttribute('catalog_product', 'quarticon_exclude', array(
16
- 'group' => 'General',
17
- 'input' => 'select',
18
- 'type' => 'int',
19
- 'label' => 'Exclude from Quarticon feed',
20
- 'source' => 'eav/entity_attribute_source_boolean',
21
- 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
22
- 'visible' => 1,
23
- 'required' => 0,
24
- 'visible_on_front' => 0,
25
- 'is_html_allowed_on_front' => 0,
26
- 'is_configurable' => 0,
27
- 'searchable' => 0,
28
- 'filterable' => 0,
29
- 'comparable' => 0,
30
- 'unique' => false,
31
- 'user_defined' => true,
32
- 'default' => '1',
33
- 'is_user_defined' => true,
34
- 'used_in_product_listing' => false
35
- ));
36
-
37
- // @mail(
38
- // 'contact@quarticon.com',
39
- // '[Upgrade] Quartic 1.0.3',
40
- // "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
41
- // "From: " . (
42
- // Mage::getStoreConfig('general/store_information/email_address') ?
43
- // Mage::getStoreConfig('general/store_information/email_address') :
44
- // 'contact@quarticon.com'
45
- // )
46
- // );
47
-
48
- $installer->endSetup();
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $connection = $installer->getConnection();
5
+
6
+ if ($connection->tableColumnExists($this->getTable('quartic_placements'), 'api_name') === false) {
7
+ $installer->run("
8
+ ALTER TABLE {$this->getTable('quartic_placements')}
9
+ ADD `api_name` varchar(255) NOT NULL AFTER `id`;
10
+ ");
11
+ }
12
+
13
+ // category attribute
14
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
15
+ $setup->addAttribute('catalog_product', 'quarticon_exclude', array(
16
+ 'group' => 'General',
17
+ 'input' => 'select',
18
+ 'type' => 'int',
19
+ 'label' => 'Exclude from Quarticon feed',
20
+ 'source' => 'eav/entity_attribute_source_boolean',
21
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
22
+ 'visible' => 1,
23
+ 'required' => 0,
24
+ 'visible_on_front' => 0,
25
+ 'is_html_allowed_on_front' => 0,
26
+ 'is_configurable' => 0,
27
+ 'searchable' => 0,
28
+ 'filterable' => 0,
29
+ 'comparable' => 0,
30
+ 'unique' => false,
31
+ 'user_defined' => true,
32
+ 'default' => '1',
33
+ 'is_user_defined' => true,
34
+ 'used_in_product_listing' => false
35
+ ));
36
+
37
+ @mail(
38
+ 'contact@quarticon.com',
39
+ '[Upgrade] Quartic 1.0.3',
40
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
41
+ "From: " . (
42
+ Mage::getStoreConfig('general/store_information/email_address') ?
43
+ Mage::getStoreConfig('general/store_information/email_address') :
44
+ 'contact@quarticon.com'
45
+ )
46
+ );
47
+
48
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-1.0.3-1.0.8.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
- $connection = $installer->getConnection();
5
-
6
- // category attribute
7
- $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
8
- $setup->addAttribute('catalog_product', 'quarticon_exclude', array(
9
- 'group' => 'General',
10
- 'input' => 'select',
11
- 'type' => 'int',
12
- 'label' => 'Exclude from Quarticon feed',
13
- 'source' => 'eav/entity_attribute_source_boolean',
14
- 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
15
- 'visible' => 1,
16
- 'required' => 0,
17
- 'visible_on_front' => 0,
18
- 'is_html_allowed_on_front' => 0,
19
- 'is_configurable' => 0,
20
- 'searchable' => 0,
21
- 'filterable' => 0,
22
- 'comparable' => 0,
23
- 'unique' => false,
24
- 'user_defined' => true,
25
- 'default' => '0',
26
- 'is_user_defined' => true,
27
- 'used_in_product_listing' => false
28
- ));
29
-
30
- ///*
31
- // * Remove price from mapping
32
- // */
33
- //$sql = <<<SQLTEXT
34
- //DELETE FROM {$this->getTable('quartic_maps')} WHERE quartic_attribute = 'price' OR quartic_attribute = 'old_price';
35
- //SQLTEXT;
36
- //$this->run($sql);
37
-
38
- /*
39
- * Fix some old versioning
40
- */
41
- $sql = <<<SQLTEXT
42
- update `core_resource` set version = '1.0.8', data_version = '1.0.8' where code = 'quartic_setup';
43
- SQLTEXT;
44
- $this->run($sql);
45
-
46
-
47
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-1.1.1-1.2.0.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ @mail(
5
+ 'contact@quarticon.com',
6
+ '[Upgrade] Quartic 1.2.0',
7
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
8
+ "From: " . (
9
+ Mage::getStoreConfig('general/store_information/email_address') ?
10
+ Mage::getStoreConfig('general/store_information/email_address') :
11
+ 'contact@quarticon.com'
12
+ )
13
+ );
14
+
15
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-1.2.0-1.2.3.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ @mail(
5
+ 'contact@quarticon.com',
6
+ '[Upgrade] Quartic 1.2.3',
7
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
8
+ "From: " . (
9
+ Mage::getStoreConfig('general/store_information/email_address') ?
10
+ Mage::getStoreConfig('general/store_information/email_address') :
11
+ 'contact@quarticon.com'
12
+ )
13
+ );
14
+
15
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-1.2.3-1.3.0.0.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ @mail(
5
+ 'contact@quarticon.com',
6
+ '[Upgrade] Quartic ' . Mage::getConfig()->getModuleConfig("Quarticon_Quartic")->version,
7
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
8
+ "From: " . (
9
+ Mage::getStoreConfig('general/store_information/email_address') ?
10
+ Mage::getStoreConfig('general/store_information/email_address') :
11
+ 'contact@quarticon.com'
12
+ )
13
+ );
14
+
15
+ $installer->endSetup();
app/code/community/Quarticon/Quartic/sql/quartic_setup/mysql4-upgrade-1.3.0.0-1.3.1.0.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $connection = $installer->getConnection();
5
+ $installer->run("DROP TABLE IF EXISTS {$this->getTable('quartic_placements')}");
6
+
7
+ @mail(
8
+ 'contact@quarticon.com',
9
+ '[Upgrade] Quartic ' . Mage::getConfig()->getModuleConfig("Quarticon_Quartic")->version,
10
+ "IP: " . $_SERVER['SERVER_ADDR'] . "\r\nHost: " . gethostbyaddr($_SERVER['SERVER_ADDR']),
11
+ "From: " . (
12
+ Mage::getStoreConfig('general/store_information/email_address') ?
13
+ Mage::getStoreConfig('general/store_information/email_address') :
14
+ 'contact@quarticon.com'
15
+ )
16
+ );
17
+
18
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/quartic.xml CHANGED
@@ -1,30 +1,25 @@
1
- <?xml version="1.0"?>
2
- <layout>
3
- <default>
4
- <reference name="head">
5
- <action method="addCss">
6
- <name>quartic.css</name>
7
- </action>
8
- </reference>
9
- </default>
10
- <adminhtml_index_urls>
11
- <reference name="content">
12
- <block type="quartic/adminhtml_urls" name="quartic_urls" />
13
- </reference>
14
- </adminhtml_index_urls>
15
- <adminhtml_maps_index>
16
- <reference name="content">
17
- <block type="quartic/adminhtml_maps" name="quartic_maps" />
18
- </reference>
19
- </adminhtml_maps_index>
20
- <adminhtml_history_index>
21
- <reference name="content">
22
- <block type="quartic/adminhtml_history" name="quartic_history" />
23
- </reference>
24
- </adminhtml_history_index>
25
- <adminhtml_api_placements>
26
- <reference name="content">
27
- <block type="quartic/adminhtml_api_dump" name="quartic_result" />
28
- </reference>
29
- </adminhtml_api_placements>
30
  </layout>
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss">
6
+ <name>quartic.css</name>
7
+ </action>
8
+ </reference>
9
+ </default>
10
+ <quartic_adminhtml_index_urls>
11
+ <reference name="content">
12
+ <block type="quartic/adminhtml_urls" name="quartic_urls" />
13
+ </reference>
14
+ </quartic_adminhtml_index_urls>
15
+ <!-- <quartic_adminhtml_maps_index>
16
+ <reference name="content">
17
+ <block type="quartic/adminhtml_maps" name="quartic_maps" />
18
+ </reference>
19
+ </quartic_adminhtml_maps_index> -->
20
+ <quartic_adminhtml_history_index>
21
+ <reference name="content">
22
+ <block type="quartic/adminhtml_history" name="quartic_history" />
23
+ </reference>
24
+ </quartic_adminhtml_history_index>
 
 
 
 
 
25
  </layout>
app/design/adminhtml/default/default/template/quartic/api/dump.phtml CHANGED
@@ -1,10 +1,10 @@
1
- <div class="content-header">
2
- <table cellspacing="0">
3
- <tr>
4
- <td style="width:50%;"><h3><?php echo Mage::helper('quartic')->__('Test') ?></h3></td>
5
- </tr>
6
- </table>
7
- </div>
8
- <div>
9
- <pre><?php print_r($this->getResult()); ?></pre>
10
- </div>
1
+ <div class="content-header">
2
+ <table cellspacing="0">
3
+ <tr>
4
+ <td style="width:50%;"><h3><?php echo Mage::helper('quartic')->__('Test') ?></h3></td>
5
+ </tr>
6
+ </table>
7
+ </div>
8
+ <div>
9
+ <pre><?php print_r($this->getResult()); ?></pre>
10
+ </div>
app/design/adminhtml/default/default/template/quartic/history.phtml CHANGED
@@ -1,10 +1,10 @@
1
- <div class="content-header">
2
- <table cellspacing="0">
3
- <tr>
4
- <td style="width:50%;"><h3><?php echo Mage::helper('quartic')->__('Quartic feed history') ?></h3></td>
5
- </tr>
6
- </table>
7
- </div>
8
- <div>
9
- <?php echo $this->getGridHtml() ?>
10
  </div>
1
+ <div class="content-header">
2
+ <table cellspacing="0">
3
+ <tr>
4
+ <td style="width:50%;"><h3><?php echo Mage::helper('quartic')->__('Quartic feed history') ?></h3></td>
5
+ </tr>
6
+ </table>
7
+ </div>
8
+ <div>
9
+ <?php echo $this->getGridHtml() ?>
10
  </div>
app/design/adminhtml/default/default/template/quartic/maps.phtml CHANGED
@@ -1,18 +1,18 @@
1
- <div class="content-header">
2
- <table cellspacing="0">
3
- <tr>
4
- <td style="width:50%;"><h3><?php echo Mage::helper('quartic')->__('Quartic attributes map') ?></h3></td>
5
- </tr>
6
- </table>
7
- </div>
8
- <div>
9
- <form action="<?php echo $this->getUrl('*/adminhtml_maps/massSave'); ?>" method="POST">
10
- <input type="hidden" name="form_key" value="<?= $this->getFormKey(); ?>" />
11
- <?php echo $this->getChildHtml() ?>
12
-
13
- <button title="<?php echo $this->__('Save mapping'); ?>" class="scalable ">
14
- <span><span><span><?php echo $this->__('Save mapping'); ?></span></span></span>
15
- </button>
16
-
17
- </form>
18
  </div>
1
+ <div class="content-header">
2
+ <table cellspacing="0">
3
+ <tr>
4
+ <td style="width:50%;"><h3><?php echo Mage::helper('quartic')->__('Quartic attributes map') ?></h3></td>
5
+ </tr>
6
+ </table>
7
+ </div>
8
+ <div>
9
+ <form action="<?php echo $this->getUrl('*/adminhtml_maps/massSave'); ?>" method="POST">
10
+ <input type="hidden" name="form_key" value="<?= $this->getFormKey(); ?>" />
11
+ <?php echo $this->getChildHtml() ?>
12
+
13
+ <button title="<?php echo $this->__('Save mapping'); ?>" class="scalable ">
14
+ <span><span><span><?php echo $this->__('Save mapping'); ?></span></span></span>
15
+ </button>
16
+
17
+ </form>
18
  </div>
app/design/adminhtml/default/default/template/quartic/system/config/button_register.phtml CHANGED
@@ -1,10 +1,10 @@
1
- <?php echo $this->getButtonHtml() ?>
2
-
3
- <script type="text/javascript">
4
- //<![CDATA[
5
- function qon_check() {
6
- var qon_reg = window.open('<?php echo $this->getRegisterUrl() ?>');
7
- window.qon_reg = qon_reg;
8
- }
9
- //]]>
10
  </script>
1
+ <?php echo $this->getButtonHtml() ?>
2
+
3
+ <script type="text/javascript">
4
+ //<![CDATA[
5
+ function qon_check() {
6
+ var qon_reg = window.open('<?php echo $this->getRegisterUrl() ?>');
7
+ window.qon_reg = qon_reg;
8
+ }
9
+ //]]>
10
  </script>
app/design/adminhtml/default/default/template/quartic/urls.phtml CHANGED
@@ -1,10 +1,10 @@
1
- <div class="content-header">
2
- <table cellspacing="0">
3
- <tr>
4
- <td style="width:50%;"><h3><?php echo Mage::helper('quartic')->__('Quartic feed URLs') ?></h3></td>
5
- </tr>
6
- </table>
7
- </div>
8
- <div>
9
- <?php echo $this->getGridHtml() ?>
10
- </div>
1
+ <div class="content-header">
2
+ <table cellspacing="0">
3
+ <tr>
4
+ <td style="width:50%;"><h3><?php echo Mage::helper('quartic')->__('Quartic feed URLs') ?></h3></td>
5
+ </tr>
6
+ </table>
7
+ </div>
8
+ <div>
9
+ <?php echo $this->getGridHtml() ?>
10
+ </div>
app/design/frontend/base/default/layout/quartic.xml CHANGED
@@ -1,18 +1,28 @@
1
- <?xml version="1.0"?>
2
- <layout>
3
- <default>
4
- <reference name="before_body_end">
5
- <block type="quartic/script" name="quartic_script" template="quartic/script.phtml" />
6
- </reference>
7
- </default>
8
- <catalog_product_view>
9
- <reference name="before_body_end">
10
- <block type="quartic/getter_product" name="quartic_getter_product" before="quartic_script" template="quartic/getter/product.phtml" />
11
- </reference>
12
- </catalog_product_view>
13
- <checkout_onepage_success>
14
- <reference name="before_body_end">
15
- <block type="quartic/getter_order" name="quartic_getter_order" before="quartic_script" template="quartic/getter/order.phtml" />
16
- </reference>
17
- </checkout_onepage_success>
 
 
 
 
 
 
 
 
 
 
18
  </layout>
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="after_body_start">
5
+ <block type="quartic/script" name="quartic_script" template="quartic/script.phtml" />
6
+ </reference>
7
+ <reference name="head">
8
+ <action method="addCss">
9
+ <name>quartic.css</name>
10
+ </action>
11
+ </reference>
12
+ </default>
13
+ <catalog_product_view>
14
+ <reference name="before_body_end">
15
+ <block type="quartic/getter_product" name="quartic_getter_product" before="quartic_script" template="quartic/getter/product.phtml" />
16
+ </reference>
17
+ </catalog_product_view>
18
+ <checkout_onepage_success>
19
+ <reference name="before_body_end">
20
+ <block type="quartic/getter_order" name="quartic_getter_order" before="quartic_script" template="quartic/getter/order.phtml" />
21
+ </reference>
22
+ </checkout_onepage_success>
23
+ <checkout_cart_index>
24
+ <reference name="after_body_start">
25
+ <block type="quartic/cart" name="quartic_cart" before="quartic_script" template="quartic/cart.phtml" />
26
+ </reference>
27
+ </checkout_cart_index>
28
  </layout>
app/design/frontend/base/default/template/quartic/cart.phtml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php if ($this->isActive()): ?>
2
+ <script type="text/javascript">
3
+ function _qCartProducts() {
4
+ return '<?php echo $this->getProducts() ?>';
5
+ }
6
+ </script>
7
+ <?php endif; ?>
app/design/frontend/base/default/template/quartic/frame/cart.phtml CHANGED
@@ -1,3 +1,3 @@
1
- <?php if ($this->isActive()): ?>
2
- <?php echo $this->getSnippetBody(); ?>
3
  <?php endif; ?>
1
+ <?php if ($this->isActive()): ?>
2
+ <?php echo $this->getSnippetBody(); ?>
3
  <?php endif; ?>
app/design/frontend/base/default/template/quartic/frame/category.phtml CHANGED
@@ -1,3 +1,3 @@
1
- <?php if ($this->isActive()): ?>
2
- <?php echo $this->getSnippetBody(); ?>
3
  <?php endif; ?>
1
+ <?php if ($this->isActive()): ?>
2
+ <?php echo $this->getSnippetBody(); ?>
3
  <?php endif; ?>
app/design/frontend/base/default/template/quartic/frame/home.phtml CHANGED
@@ -1,3 +1,3 @@
1
- <?php if ($this->isActive()): ?>
2
- <?php echo $this->getSnippetBody(); ?>
3
  <?php endif; ?>
1
+ <?php if ($this->isActive()): ?>
2
+ <?php echo $this->getSnippetBody(); ?>
3
  <?php endif; ?>
app/design/frontend/base/default/template/quartic/frame/product.phtml CHANGED
@@ -1,6 +1,6 @@
1
- <?php if ($this->isActive()): ?>
2
- <?php $productId = $this->getProductId(); ?>
3
- <?php if ($productId): ?>
4
- <?php echo $this->getSnippetBody(); ?>
5
- <?php endif; ?>
6
  <?php endif; ?>
1
+ <?php if ($this->isActive()): ?>
2
+ <?php $productId = $this->getProductId(); ?>
3
+ <?php if ($productId): ?>
4
+ <?php echo $this->getSnippetBody(); ?>
5
+ <?php endif; ?>
6
  <?php endif; ?>
app/design/frontend/base/default/template/quartic/getter/order.phtml CHANGED
@@ -1,17 +1,18 @@
1
- <?php if ($this->isActive()): ?>
2
- <?php $order = $this->getOrder(); ?>
3
- <?php $order_items = $this->getProducts(); ?>
4
- <script type="text/javascript">
5
- var upsParams = upsParams || [];
6
- upsParams.push(['customer','<?php echo $this->getCustomer(); ?>']);
7
- upsParams.push(['transaction', '<?php echo $order->getIncrementId(); ?>']);
8
- upsParams.push(['user', '<?php echo $this->getUser(); ?>']);
9
- <?php foreach ($order_items as $item): ?>
10
- upsParams.push(['action','purchase']);    
11
- upsParams.push(['product','<?php echo $item['product']; ?>']);
12
- upsParams.push(['price','<?php echo $item['price']; ?>']);
13
- upsParams.push(['quantity','<?php echo $item['quantity']; ?>']);
14
- upsParams.push(['execute']);
15
- <?php endforeach; ?>
16
- </script>
 
17
  <?php endif; ?>
1
+ <?php if ($this->isActive()): ?>
2
+ <?php $order = $this->getOrder(); ?>
3
+ <?php $order_items = $this->getProducts(); ?>
4
+ <script type="text/javascript">
5
+ function _qTransactionScript() {
6
+ window.upsParams = window.upsParams || [];
7
+ upsParams.push(['transaction', '<?php echo $order->getIncrementId(); ?>']);
8
+ upsParams.push(['user', '<?php echo $this->getUser(); ?>']);
9
+ <?php foreach ($order_items as $item): ?>
10
+ upsParams.push(['action', 'purchase']);
11
+ upsParams.push(['product', '<?php echo $item['product']; ?>']);
12
+ upsParams.push(['price', '<?php echo $item['price']; ?>']);
13
+ upsParams.push(['quantity', '<?php echo $item['quantity']; ?>']);
14
+ upsParams.push(['execute']);
15
+ <?php endforeach; ?>
16
+ }
17
+ </script>
18
  <?php endif; ?>
app/design/frontend/base/default/template/quartic/getter/product.phtml CHANGED
@@ -1,10 +1,42 @@
1
- <?php if ($this->isActive()): ?>
2
- <script type="text/javascript">
3
-     var upsParams = upsParams || []
4
-     upsParams.push(['action','view'])
5
-     upsParams.push(['customer','<?php echo $this->getCustomer(); ?>'])
6
-     upsParams.push(['user', '<?php echo $this->getUser(); ?>'])
7
-     upsParams.push(['product', '<?php echo Mage::helper('quartic')->getProduct($this->getProduct()); ?>'])
8
- upsParams.push(['execute'])
9
- </script>
10
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->isActive()):
2
+
3
+ $prod = $this->getProduct();
4
+ $productId = Mage::helper('quartic')->getProduct($prod);
5
+ $prices = $this->getProductPrices($prod);
6
+ $categories = $prod->getCategoryIds();
7
+ $categoriesData = [];
8
+ $model = Mage::getModel('catalog/category');
9
+ foreach($categories as $category) {
10
+ $catObj = $model->load($category);
11
+ $categoriesData[] = array(
12
+ 'name' => $catObj->getName(),
13
+ 'id' => $category
14
+ );
15
+ }
16
+ ?>
17
+ <script type="text/javascript">
18
+ function _qViewScript() {
19
+ upsParams = window.upsParams || [];
20
+ upsParams.push(['action', 'view']);
21
+ upsParams.push(['user', '<?php echo $this->getUser(); ?>']);
22
+ upsParams.push(['product', '<?php echo $productId; ?>']);
23
+ upsParams.push(['execute']);
24
+ }
25
+ </script>
26
+ <?php if ($this->showQuarticTags($prod)): ?>
27
+ <div class="qON_product" style="display:none"
28
+ data-qon-id="<?php echo htmlspecialchars($productId); ?>"
29
+ data-qon-title="<?php echo htmlspecialchars($prod->getName()); ?>"
30
+ data-qon-status="<?php echo htmlspecialchars($prod->getStatus()); ?>"
31
+ data-qon-price="<?php echo htmlspecialchars($prices['price']); ?>"
32
+ data-qon-old-price="<?php echo htmlspecialchars($prices['price'] < $prices['price_old'] ? $prices['price_old'] : ''); ?>"
33
+ data-qon-link="<?php echo htmlspecialchars($prod->getProductUrl()); ?>"
34
+ data-qon-image="<?php echo htmlspecialchars($prod->getImageUrl()); ?>"
35
+ <?php foreach($categoriesData as $key => $cat): ?>
36
+ data-qon-category-<?php echo $key+1; ?>-id="<?php echo htmlspecialchars($cat['id']); ?>"
37
+ data-qon-category-<?php echo $key+1; ?>-title="<?php echo htmlspecialchars($cat['name']); ?>"
38
+ <?php endforeach; ?>
39
+ ></div>
40
+ <?php endif; ?>
41
+
42
+ <?php endif; ?>
app/design/frontend/base/default/template/quartic/products.phtml CHANGED
@@ -1,90 +1,90 @@
1
- <?php
2
- $_productCollection=$this->getLoadedProductCollection();
3
- $_helper = $this->helper('catalog/output');
4
- ?>
5
- <?php if ($_productCollection->count()): ?>
6
- <h2><?php echo Mage::helper('quartic')->__('Recommendations'); ?></h2>
7
- <div class="category-products">
8
- <?php // List mode ?>
9
- <?php if($this->getMode()!='grid'): ?>
10
- <?php $_iterator = 0; ?>
11
- <ol class="products-list" id="products-list">
12
- <?php foreach ($_productCollection as $_product): ?>
13
- <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
14
- <?php // Product Image ?>
15
- <a href="<?php echo $this->getQuarticUrl($_product) ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
16
- <?php // Product description ?>
17
- <div class="product-shop">
18
- <div class="f-fix">
19
- <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
20
- <h2 class="product-name"><a href="<?php echo $this->getQuarticUrl($_product) ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
21
- <?php if($_product->getRatingSummary()): ?>
22
- <?php echo $this->getReviewsSummaryHtml($_product) ?>
23
- <?php endif; ?>
24
- <?php echo $this->getPriceHtml($_product, true) ?>
25
- <?php if($_product->isSaleable()): ?>
26
- <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getQuarticAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
27
- <?php else: ?>
28
- <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
29
- <?php endif; ?>
30
- <div class="desc std">
31
- <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
32
- <a href="<?php echo $this->getQuarticUrl($_product) ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
33
- </div>
34
- <ul class="add-to-links">
35
- <?php if ($this->helper('wishlist')->isAllow()) : ?>
36
- <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
37
- <?php endif; ?>
38
- <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
39
- <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
40
- <?php endif; ?>
41
- </ul>
42
- </div>
43
- </div>
44
- </li>
45
- <?php endforeach; ?>
46
- </ol>
47
- <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
48
-
49
- <?php else: ?>
50
-
51
- <?php // Grid Mode ?>
52
-
53
- <?php $_collectionSize = $_productCollection->count() ?>
54
- <?php $_columnCount = $this->getColumnCount(); ?>
55
- <?php $i=0; foreach ($_productCollection as $_product): ?>
56
- <?php if ($i++%$_columnCount==0): ?>
57
- <ul class="products-grid">
58
- <?php endif ?>
59
- <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
60
- <a href="<?php echo $this->getQuarticUrl($_product) ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
61
- <h2 class="product-name"><a href="<?php echo $this->getQuarticUrl($_product) ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
62
- <?php if($_product->getRatingSummary()): ?>
63
- <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
64
- <?php endif; ?>
65
- <?php echo $this->getPriceHtml($_product, true) ?>
66
- <div class="actions">
67
- <?php if($_product->isSaleable()): ?>
68
- <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getQuarticAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
69
- <?php else: ?>
70
- <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
71
- <?php endif; ?>
72
- <ul class="add-to-links">
73
- <?php if ($this->helper('wishlist')->isAllow()) : ?>
74
- <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
75
- <?php endif; ?>
76
- <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
77
- <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
78
- <?php endif; ?>
79
- </ul>
80
- </div>
81
- </li>
82
- <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
83
- </ul>
84
- <?php endif ?>
85
- <?php endforeach ?>
86
- <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
87
- <?php endif; ?>
88
-
89
- </div>
90
  <?php endif; ?>
1
+ <?php
2
+ $_productCollection=$this->getLoadedProductCollection();
3
+ $_helper = $this->helper('catalog/output');
4
+ ?>
5
+ <?php if ($_productCollection->count()): ?>
6
+ <h2><?php echo Mage::helper('quartic')->__('Recommendations'); ?></h2>
7
+ <div class="category-products">
8
+ <?php // List mode ?>
9
+ <?php if($this->getMode()!='grid'): ?>
10
+ <?php $_iterator = 0; ?>
11
+ <ol class="products-list" id="products-list">
12
+ <?php foreach ($_productCollection as $_product): ?>
13
+ <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
14
+ <?php // Product Image ?>
15
+ <a href="<?php echo $this->getQuarticUrl($_product) ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
16
+ <?php // Product description ?>
17
+ <div class="product-shop">
18
+ <div class="f-fix">
19
+ <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
20
+ <h2 class="product-name"><a href="<?php echo $this->getQuarticUrl($_product) ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
21
+ <?php if($_product->getRatingSummary()): ?>
22
+ <?php echo $this->getReviewsSummaryHtml($_product) ?>
23
+ <?php endif; ?>
24
+ <?php echo $this->getPriceHtml($_product, true) ?>
25
+ <?php if($_product->isSaleable()): ?>
26
+ <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getQuarticAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
27
+ <?php else: ?>
28
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
29
+ <?php endif; ?>
30
+ <div class="desc std">
31
+ <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
32
+ <a href="<?php echo $this->getQuarticUrl($_product) ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
33
+ </div>
34
+ <ul class="add-to-links">
35
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
36
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
37
+ <?php endif; ?>
38
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
39
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
40
+ <?php endif; ?>
41
+ </ul>
42
+ </div>
43
+ </div>
44
+ </li>
45
+ <?php endforeach; ?>
46
+ </ol>
47
+ <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
48
+
49
+ <?php else: ?>
50
+
51
+ <?php // Grid Mode ?>
52
+
53
+ <?php $_collectionSize = $_productCollection->count() ?>
54
+ <?php $_columnCount = $this->getColumnCount(); ?>
55
+ <?php $i=0; foreach ($_productCollection as $_product): ?>
56
+ <?php if ($i++%$_columnCount==0): ?>
57
+ <ul class="products-grid">
58
+ <?php endif ?>
59
+ <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
60
+ <a href="<?php echo $this->getQuarticUrl($_product) ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
61
+ <h2 class="product-name"><a href="<?php echo $this->getQuarticUrl($_product) ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
62
+ <?php if($_product->getRatingSummary()): ?>
63
+ <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
64
+ <?php endif; ?>
65
+ <?php echo $this->getPriceHtml($_product, true) ?>
66
+ <div class="actions">
67
+ <?php if($_product->isSaleable()): ?>
68
+ <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getQuarticAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
69
+ <?php else: ?>
70
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
71
+ <?php endif; ?>
72
+ <ul class="add-to-links">
73
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
74
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
75
+ <?php endif; ?>
76
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
77
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
78
+ <?php endif; ?>
79
+ </ul>
80
+ </div>
81
+ </li>
82
+ <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
83
+ </ul>
84
+ <?php endif ?>
85
+ <?php endforeach ?>
86
+ <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
87
+ <?php endif; ?>
88
+
89
+ </div>
90
  <?php endif; ?>
app/design/frontend/base/default/template/quartic/products/slt_cart.phtml CHANGED
File without changes
app/design/frontend/base/default/template/quartic/products/slt_category.phtml CHANGED
File without changes
app/design/frontend/base/default/template/quartic/products/slt_home.phtml CHANGED
File without changes
app/design/frontend/base/default/template/quartic/products/slt_product.phtml CHANGED
File without changes
app/design/frontend/base/default/template/quartic/script.phtml CHANGED
@@ -1,28 +1,71 @@
1
- <?php if ($this->isActive()): ?>
2
- <script type="text/javascript">
3
- var upsParams = upsParams || [];
4
- upsParams.push(['customer', '<?php echo $this->getCustomer(); ?>']);
5
- var upsScript = document.createElement('script');
6
- upsScript.setAttribute('type','text/javascript');
7
- upsScript.setAttribute('src', '//rec.quartic.pl/qon.js');
8
- upsScript.setAttribute('async','async');
9
- var upsAnchor = document.getElementsByTagName('script')[0];
10
- upsAnchor.parentNode.insertBefore(upsScript, upsAnchor);
11
- function quartic_rec (recommendations, slot) {
12
- var parameters = { slot: slot };
13
- var i;
14
- var count = recommendations.length;
15
- for (var i = 0; i < count; i++) {
16
- parameters['sku[' + i + ']'] = recommendations[i][0];
17
- parameters['url[' + i + ']'] = recommendations[i][1];
18
- }
19
- new Ajax.Request('<?php echo Mage::getUrl('quartic/frame/index'); ?>', {
20
- method: 'post',
21
- parameters: parameters,
22
- onSuccess: function(transport) {
23
- $(slot).update(transport.responseText);
24
- }
25
- });
26
- }
27
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  <?php endif; ?>
1
+ <?php if ($this->isActive()): /* ?>
2
+
3
+ <script type="text/javascript">
4
+ var upsParams = upsParams || [];
5
+ upsParams.push(['customer', '<?php echo $this->getCustomer(); ?>']);
6
+ var upsScript = document.createElement('script');
7
+ upsScript.setAttribute('type','text/javascript');
8
+ upsScript.setAttribute('src', '//rec.quartic.pl/qon.js');
9
+ upsScript.setAttribute('async','async');
10
+ var upsAnchor = document.getElementsByTagName('script')[0];
11
+ upsAnchor.parentNode.insertBefore(upsScript, upsAnchor);
12
+ function quartic_rec (recommendations, slot) {
13
+ var parameters = { slot: slot };
14
+ var i;
15
+ var count = recommendations.length;
16
+ for (var i = 0; i < count; i++) {
17
+ parameters['sku[' + i + ']'] = recommendations[i][0];
18
+ parameters['url[' + i + ']'] = recommendations[i][1];
19
+ }
20
+ new Ajax.Request('<?php echo Mage::getUrl('quartic/frame/index'); ?>', {
21
+ method: 'post',
22
+ parameters: parameters,
23
+ onSuccess: function(transport) {
24
+ $(slot).update(transport.responseText);
25
+ }
26
+ });
27
+ }
28
+ </script>
29
+ */ ?>
30
+ <script type="text/javascript">
31
+ function _qAddEvent(element, eventName, fn) {
32
+ if (element.addEventListener) {
33
+ element.addEventListener(eventName, fn, false);
34
+ } else if (element.attachEvent) {
35
+ if (eventName == 'DOMContentLoaded') {
36
+ eventName = 'readystatechange';
37
+ fn = function() {
38
+ if ( document.readyState === "complete" ) {
39
+ fn();
40
+ }
41
+ };
42
+ }
43
+ element.attachEvent('on' + eventName, fn);
44
+ }
45
+ }
46
+ _qAddEvent(window, 'DOMContentLoaded', function() {
47
+ var _qprods = '';
48
+ if (typeof _qCartProducts != 'undefined') {
49
+ _qprods = _qCartProducts();
50
+ }
51
+ xhr = new XMLHttpRequest();
52
+ xhr.open('POST', 'https://shopapi.quarticon.com/pluginMagento/content');
53
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
54
+ xhr.onload = function() {
55
+ window.upsParams = window.upsParams || [];
56
+ upsParams.push(['user', '<?php echo $this->getUser(); ?>']);
57
+ if (xhr.readyState != 4 || xhr.status != 200) return;
58
+ if (typeof _qViewScript != 'undefined') {
59
+ _qViewScript();
60
+ }
61
+ if (typeof _qTransactionScript != 'undefined') {
62
+ _qTransactionScript();
63
+ }
64
+ eval(xhr.responseText);
65
+ };
66
+ var _qparams = 'storeName='+encodeURIComponent('<?php echo $this->getStoreName(); ?>')+'&template=footer';
67
+ _qparams += '&products='+encodeURIComponent(_qprods);
68
+ xhr.send(_qparams);
69
+ });
70
+ </script>
71
  <?php endif; ?>
app/etc/modules/Quarticon_Quartic.xml CHANGED
@@ -1,9 +1,9 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <modules>
4
- <Quarticon_Quartic>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </Quarticon_Quartic>
8
- </modules>
9
  </config>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Quarticon_Quartic>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Quarticon_Quartic>
8
+ </modules>
9
  </config>
app/locale/pl_PL/Quarticon_Quartic.csv CHANGED
@@ -6,6 +6,7 @@
6
  "Add thumbnails to XML","Dodaj miniaturki zdjęć do XML-a"
7
  "Attribute mapping","Mapowanie atrybutów"
8
  "Author field in Products XML","Pole 'autor' w XML-u z produktami"
 
9
  "Configuration","Konfiguracja"
10
  "Could not log in. Check your credentials and try again.","Nie udało się zalogować. Sprawdź poprawność danych i spróbuj ponownie."
11
  "Disable if your SKUs are longer than 20 characters","Wyłącz, jeżeli Twoje SKU mają więcej niż 20 znaków"
6
  "Add thumbnails to XML","Dodaj miniaturki zdjęć do XML-a"
7
  "Attribute mapping","Mapowanie atrybutów"
8
  "Author field in Products XML","Pole 'autor' w XML-u z produktami"
9
+ "Plugin","Wtyczka QON"
10
  "Configuration","Konfiguracja"
11
  "Could not log in. Check your credentials and try again.","Nie udało się zalogować. Sprawdź poprawność danych i spróbuj ponownie."
12
  "Disable if your SKUs are longer than 20 characters","Wyłącz, jeżeli Twoje SKU mają więcej niż 20 znaków"
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
- <name>Quarticon_Quartic</name>
4
- <version>1.0.8</version>
5
  <stability>stable</stability>
6
- <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Recommend - personalized product recommendations, by QuarticON.com</summary>
10
- <description>Recommend - personalized product recommendations, by QuarticON.com</description>
11
- <notes>The extension integrates your store with Quartic platform.</notes>
12
- <authors><author><name>QuarticON</name><user>quarticon</user><email>contact@quarticon.com</email></author></authors>
13
- <date>2016-04-05</date>
14
- <time>11:13:53</time>
15
- <contents><target name="magecommunity"><dir name="Quarticon"><dir name="Quartic"><dir name="Block"><dir name="Adminhtml"><dir name="Api"><file name="Dump.php" hash="6d90575698aeb92c20b7ba8db38fd8d4"/></dir><dir name="History"><file name="Grid.php" hash="a32fe8ab7e02f309ca99b42f18af803b"/></dir><file name="History.php" hash="6d552d7d7a7f404b4ed5a816977b2dc8"/><dir name="Maps"><file name="Grid.php" hash="58f158db6a9bb4ccf702a848b918d333"/><dir name="Renderer"><file name="Input.php" hash="a209bbe5b71291c1b3f5f5994fbf5e2f"/><file name="Select.php" hash="0318c06d7f4b62c11800b4ffe4aa62bc"/></dir></dir><file name="Maps.php" hash="9744bd8300dac3e98d089ecf70faa6a2"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Button.php" hash="b9df45e6eb248d41386cb5768396c2ee"/><file name="Placement.php" hash="08810176b93fdd32948b22d15dae3418"/><file name="Register.php" hash="3098ec89d046749ec94aae5fe7b74b49"/><file name="Text.php" hash="1715cb301736f5491399ceb57a7fb510"/></dir><file name="Fieldset.php" hash="29fc8b5212bd5d2c825b55beb9e08dd0"/></dir></dir></dir><dir name="Urls"><file name="Grid.php" hash="e104ebebd5ce12f49b1003068f6c40a7"/></dir><file name="Urls.php" hash="6e4bb1a3dbb25174cd9f7226a7eb3e2a"/></dir><file name="Box.php" hash="67ddbd72ae1c06dfa307bd8d6c00ae4f"/><dir name="Frame"><file name="Cart.php" hash="438a729fe07cc629693f06abe431dff3"/><file name="Category.php" hash="068d3d1062c005482bdbed623d6cf136"/><file name="Home.php" hash="475eae5b390abc205ec9a65a0d8c13ad"/><file name="Product.php" hash="e0854d2407b9048758e47e1dd7d70d94"/></dir><dir name="Getter"><file name="Cart.php" hash="d2b99e59220a32f92596033813698069"/><file name="Order.php" hash="0c13b0eb560fb95e1e73d5fd9689f8b4"/><file name="Product.php" hash="b267c9dbecea690be8aa3d028ce38d75"/></dir><file name="Products.php" hash="282af5d3242c8f13d90dfc19067fc2f7"/><file name="Script.php" hash="4e1173d214e331e68db7f8b3313d4ad6"/></dir><dir name="Helper"><file name="Data.php" hash="5ddf57e608f89502a1c396f40cdbae66"/></dir><dir name="Model"><dir name="Adapter"><file name="Writer.php" hash="66e2f2649ac3ec3f8e8878a3e595ce3c"/></dir><file name="Attribute.php" hash="0e2918e9bb12bae57b63b67b7b048f49"/><file name="Catalog.php" hash="2e0eff970755b82ab1b76e2fe9a5b893"/><dir name="Client"><file name="AbstractCurl.php" hash="dd0e0ddc0885c8224a13a563ab8759bd"/><file name="Api.php" hash="5c36fa2eed71784e3ef3a82c4767b66d"/><dir name="Resource"><file name="Curl.php" hash="07924c032361218ebf4390a61442c30f"/></dir></dir><file name="Config.php" hash="9f30730756e93085b78133df24c9ef63"/><file name="Cron.php" hash="11876b32701bad001efcbc8cf56ed608"/><file name="Frame.php" hash="073932bb3116a30a269fbe94cb019225"/><file name="History.php" hash="451b494fdd77277b235d2a0d52fcc99c"/><dir name="Insert"><file name="Cart.php" hash="c668360217730c627875560add9ad033"/><file name="Category.php" hash="313ec107fd93bbf07ad40cf754c97197"/><file name="Home.php" hash="ad89be2ba8cdd83827d9d261c056620e"/><file name="Product.php" hash="8d4609828965cc210b83094c157af22d"/></dir><file name="Insert.php" hash="3eac4d73c5d92c077a22106cd8a31651"/><file name="Maps.php" hash="772431aac9f57decc072c91f580ec3f3"/><dir name="Mysql4"><dir name="History"><file name="Collection.php" hash="16c997ad5b0206b64392d64d9986fb40"/></dir><file name="History.php" hash="10ff5200887a7c12cb9b0312acc3a4c5"/><dir name="Maps"><file name="Collection.php" hash="e5a6067327d75240ccf42fc5397332bf"/></dir><file name="Maps.php" hash="bd3dc9f67a482c2f475c1d651abd274a"/><dir name="Placement"><file name="Collection.php" hash="95ac7e3641bb395b3c518b56b85a4985"/></dir><file name="Placement.php" hash="cfaf72514c2cebc604bb14bd79966989"/></dir><dir name="Observer"><file name="Adminhtml.php" hash="98e026fd64715ea2ca5ace77591f58ae"/><file name="Frontend.php" hash="c6028e91a381e0fe43e6685ec9b26e35"/></dir><file name="Order.php" hash="fdf30df406f857a7d8391e9205bc29f6"/><dir name="Placement"><file name="Cart.php" hash="d154c166acb0859d0ef69a81430969f5"/><file name="Category.php" hash="1175fc97b34388bd988393fc2e9a1734"/><file name="Home.php" hash="57a3fa699e54840d341fcfc15fa5a692"/><file name="Product.php" hash="eefb43d29d3945663926d43bcefb587c"/></dir><file name="Placement.php" hash="350264808b4d8a796213ffc69f7e55af"/><file name="Product.php" hash="69d81e0a99d6b5576a36d15a92404231"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Configurablechildimage.php" hash="c285087d38df0cdb0d185ed9236edd95"/><file name="Configurablechildprice.php" hash="434b0050a09f54939838980cb8bc5e84"/><file name="Configurablechilds.php" hash="faa8090eade035631f216a1204f8abd4"/><file name="Configurableprice.php" hash="7aff7becec4a7ff8e470aa41ffd4dc71"/><file name="Groupedchildimage.php" hash="73360b50fc0e8081bf2f082ce499e2e7"/><file name="Groupedprice.php" hash="313a4b7c952f3276961c95413ad9edbc"/><file name="Visibility.php" hash="40a6fe7628dae2d75f9ec527d20bbf3c"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ApiController.php" hash="379e216283ba7b24cb91fcad3bc50fe2"/><file name="IndexController.php" hash="bfa43997a5edde51cc5f0c08fb5a4baf"/><file name="MapsController.php" hash="7c56718d0dcda4e43e0c67c1d8765065"/></dir><file name="FeedController.php" hash="19716b631bedfe0d16d132e004dee9ef"/><file name="FrameController.php" hash="124801d72b1190909cc3ae82a820e56c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="aba68387e0e64d554b1b2c088f620528"/><file name="config.xml" hash="106cdec8d5fd17c430e715cfb2693343"/><file name="system.xml" hash="08639392edb42abb309a158a2d6240fe"/></dir><dir name="sql"><dir name="quartic_setup"><file name="mysql4-install-0.1.4.php" hash="fea2b7ac9d15990ff0be165b77c6452e"/><file name="mysql4-upgrade-0.1.0-0.1.4.php" hash="e69d1bbc22950cb6c6a4f4b18c2074e7"/><file name="mysql4-upgrade-0.1.7-0.2.0.php" hash="489a892eee6a5bc06e857f20eca2b0c7"/><file name="mysql4-upgrade-0.2.1-0.2.2.php" hash="7aad767fe500b67610163e54cfad0e62"/><file name="mysql4-upgrade-0.2.2-0.2.3.php" hash="5bb55976425ba1076bb57fc823f4dc80"/><file name="mysql4-upgrade-0.2.3-0.2.4.php" hash="fca0ff6f4ab3c78d69bf44cae2b73657"/><file name="mysql4-upgrade-0.2.5-0.2.6.php" hash="1f6bf21fdb97427bf2c564acaded4c14"/><file name="mysql4-upgrade-0.3.1-0.3.2.php" hash="7d4a6e7a6a86e272b5bf443b8995d48f"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="70059300681d0220e4dff6527b4f35ac"/><file name="mysql4-upgrade-1.0.3-1.0.8.php" hash="1bdba92d832580a7821585c4ad84a644"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="quartic.xml" hash="12f7e42b8fa9a7ab31e6f78f34bf7bd4"/></dir><dir name="template"><dir name="quartic"><dir name="api"><file name="dump.phtml" hash="0fa64e9c2de0698a998679e0d2b2f1eb"/></dir><file name="history.phtml" hash="fe445bb739fcad8ae688944c0188fd41"/><file name="maps.phtml" hash="8f0814d506b1ddc5248f7487e2942d17"/><dir name="system"><dir name="config"><file name="button_register.phtml" hash="f19fdea76b46c5699f1387cf462d467b"/></dir></dir><file name="urls.phtml" hash="3d6c3fb06daad5e31dec6d97692750cc"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="quartic.xml" hash="96a0f31aa65b5ea9e6f92aecb246de72"/><file name="quartic.xml" hash="96a0f31aa65b5ea9e6f92aecb246de72"/></dir><dir name="template"><dir name="quartic"><dir name="frame"><file name="cart.phtml" hash="f7867e13e0bebd593adaab509e7bff71"/><file name="category.phtml" hash="f7867e13e0bebd593adaab509e7bff71"/><file name="home.phtml" hash="f7867e13e0bebd593adaab509e7bff71"/><file name="product.phtml" hash="43b7ffa983e9ad9324b623fce82bef6c"/></dir><dir name="getter"><file name="order.phtml" hash="e9a993d30ef73ff8b74bc0301347862a"/><file name="product.phtml" hash="68fc01a6ae190e73da448cd0b45a2066"/></dir><dir name="products"><file name="slt_cart.phtml" hash="b534e86c913c3e5c7a59956980055e9a"/><file name="slt_category.phtml" hash="b534e86c913c3e5c7a59956980055e9a"/><file name="slt_home.phtml" hash="b534e86c913c3e5c7a59956980055e9a"/><file name="slt_product.phtml" hash="b534e86c913c3e5c7a59956980055e9a"/></dir><file name="products.phtml" hash="82c4f8d4f3b223133acf500313d1ea65"/><file name="script.phtml" hash="07f7b8f0a867c694e4aec1fd26af2199"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Quarticon_Quartic.xml" hash="028268cb01d9e01103b62b265b9dcd7a"/></dir></target><target name="magelocale"><dir name="pl_PL"><file name="Quarticon_Quartic.csv" hash="44471c7ccb74cefb37a9197c9df8acee"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="quarticon-icon.png" hash="75db9de222be47ea963f5432ef8b3ef3"/></dir><file name="quartic.css" hash="9fef6b352df11c73f1ea3e33041e5fa9"/></dir></dir></dir></target><target name="mage"><dir name="var"><file name="quartic" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
+ <name>QuarticON</name>
4
+ <version>1.3.1</version>
5
  <stability>stable</stability>
6
+ <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>QuarticON plugin</summary>
10
+ <description>QuarticON plugin</description>
11
+ <notes>1.3.1 release QON</notes>
12
+ <authors><author><name>QuarticON</name><user>QON</user><email>it@quartic.pl</email></author></authors>
13
+ <date>2016-04-15</date>
14
+ <time>13:19:43</time>
15
+ <contents><target name="magecommunity"><dir name="Quarticon"><dir name="Quartic"><dir name="Block"><dir name="Adminhtml"><dir name="Api"><file name="Dump.php" hash="9098d72cb5d1f73ae7ea7ac3f28278b1"/></dir><dir name="History"><file name="Grid.php" hash="517735833b4764f4bf50c8563bb0e5b0"/></dir><file name="History.php" hash="d4fd147b82381a612a132a56f4da6712"/><dir name="Maps"><file name="Grid.php" hash="cf07305bbe68e51c0cb3855109c6bad9"/><dir name="Renderer"><file name="Input.php" hash="205b47df91aece6e991b88788197736f"/><file name="Select.php" hash="ae82c2eb17938e0d0e6453cf0a5d8649"/></dir></dir><file name="Maps.php" hash="0042bc188c30d95a4d653ef26af97b2b"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Button.php" hash="753becec9aefb0878f08b4ddd0ed01db"/><file name="Placement.php" hash="f150b7bdb6021dc2f22143934335fda8"/><file name="Register.php" hash="8a0b98c9a3f40e94b61a843054ff1827"/><file name="Text.php" hash="d6ce699c53619a9d2ddb862ddf101ad5"/></dir><file name="Fieldset.php" hash="7a6bd8c03d06e6314c3c1a08c16c8570"/><file name="Iframe.php" hash="ac7118ac0f12ca9f9004cedab49e5c89"/></dir></dir></dir><dir name="Urls"><file name="Grid.php" hash="74071de33b53a92ad194922a064fcf5a"/></dir><file name="Urls.php" hash="e6fe81972417f267f796df472f3000c7"/></dir><file name="Box.php" hash="68b0fd09ff4edc8cd6d9adccf21f4691"/><file name="Cart.php" hash="00034241764ec801f3cb88ffb9b09ab5"/><dir name="Frame"><file name="Cart.php" hash="e14a9566d58e6e503d916aebf97ad607"/><file name="Category.php" hash="ab4cd330cc2be1bafce1b919bb4d5aef"/><file name="Home.php" hash="ca5041089b6566a646efe090a3611f54"/><file name="Product.php" hash="9cd922264bdca77955090a134ad97317"/></dir><dir name="Getter"><file name="Cart.php" hash="249c95aa1728d44cce2e2aeb49308abd"/><file name="Order.php" hash="0da1e0dfc77588ea994b8b1f1eef4ace"/><file name="Product.php" hash="659fa287ad7c4c200ac94a8773f46440"/></dir><file name="Products.php" hash="9e68c2cdb575f09f55ff0228735c5950"/><file name="Script.php" hash="8fa197458ffad147ab5e171b850f3720"/></dir><dir name="Helper"><file name="Data.php" hash="6e213f18e6c2d5f8490fe5b184b2092d"/></dir><dir name="Model"><dir name="Adapter"><file name="Writer.php" hash="2814e7b52057b1caeca435e9d0c04f5e"/></dir><file name="Attribute.php" hash="41813151b700674bcf3095907356e492"/><file name="Catalog.php" hash="b7feef5fec1d20cfa0abd470f0169019"/><dir name="Client"><file name="AbstractCurl.php" hash="fe8473a6310788f22dccb0a59874bfd5"/><file name="Api.php" hash="91613bfd192e2855c0a2c90da6c5a459"/><dir name="Resource"><file name="Curl.php" hash="fccbf7ac484c8bdd840cb7d19bbe192a"/></dir></dir><file name="Config.php" hash="5527cb899d91b339fe913216f4c1952c"/><file name="Cron.php" hash="4e642d0ab308d5cd6ca04db9bded3b37"/><file name="Feed.php" hash="8540d9a708303830e8c61d0ae3c8abda"/><file name="Frame.php" hash="8c6e95e440e2fe608050e20d08530b48"/><file name="History.php" hash="fde15e250eb09bf8a54be185dd01a5ad"/><dir name="Insert"><file name="Cart.php" hash="f371a8fa5a82ebb76f5b3f197071053e"/><file name="Category.php" hash="aaf6d056469a3805a059e0ae9f1f7d63"/><file name="Home.php" hash="85dd40a1b92c6a0e1c1f06621e782520"/><file name="Product.php" hash="81fea85f21564962964a6b6ae0d73ac3"/></dir><file name="Insert.php" hash="f2cc83b7200b0da3b1daf61415a6402d"/><file name="Maps.php" hash="cb1d59cb4b678dfbe6735669d27ca8d7"/><dir name="Mysql4"><dir name="History"><file name="Collection.php" hash="b5b6c967e79618c10cf93c7be619314a"/></dir><file name="History.php" hash="604a9a89b70811aa7af503e0d501e00a"/><dir name="Maps"><file name="Collection.php" hash="194473ac93621dd3543cba4596c47edb"/></dir><file name="Maps.php" hash="b7aa1aaf9f9e90ecdba4ed856055a66a"/><dir name="Placement"><file name="Collection.php" hash="a0786249516566c6658fd2de46cd6c17"/></dir><file name="Placement.php" hash="9cad46e80831e013d5bf790380230d89"/></dir><dir name="Observer"><file name="Adminhtml.php" hash="6430cea4855c2e7c634c17911a3e5f9c"/><file name="Frontend.php" hash="d6333d8378cdc78fc83bc3da0e703d89"/></dir><file name="Order.php" hash="d77300d22dbc64576cedeeb1a14e62fd"/><dir name="Placement"><file name="Cart.php" hash="d0fb9c1bf8c043f71ad1450c4d9cb96e"/><file name="Category.php" hash="144aaf25384c688c035e2ba6e6959c37"/><file name="Home.php" hash="efc3f57d81d9c5b1b616ad8b2cd25d25"/><file name="Product.php" hash="b406968ee5858045110cc536c14299eb"/></dir><file name="Placement.php" hash="df5ba0417a3264548cda85cea2716861"/><file name="Product.php" hash="59e5eb58f3faff09c41071aeb3737125"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Configurablechildimage.php" hash="78330fe6ea2a422e4216bc81434d1a6f"/><file name="Configurablechildprice.php" hash="f3a506f7cd71224868af95549130a378"/><file name="Configurablechilds.php" hash="0bbd9615178d785f40da904a63ccf472"/><file name="Configurableprice.php" hash="4e08c480e99792eab861fe9b5ac03d77"/><file name="Groupedchildimage.php" hash="727780d8adf293d5110b67d2335fa114"/><file name="Groupedprice.php" hash="5f7ec3d06c1eb402be8118e14b18ed3b"/><file name="Visibility.php" hash="e5bb66cfc29c53d8a4d2a408dbbadf22"/></dir></dir></dir></dir><dir name="controllers"><file name="ActiveController.php" hash="e5edce243291198b53dc40ae64cb6bca"/><dir name="Adminhtml"><file name="ApiController.php" hash="fbc04b1cef33bc0f79dbf2eb607fcda7"/><file name="IndexController.php" hash="420ee117a121686b057de487b9d20dc3"/><file name="MapsController.php" hash="02e61797e0fc85a25513e6711ba12d6a"/></dir><file name="BaseController.php" hash="d3f0c7ba35c36693cfad55b7458220ef"/><file name="FeedController.php" hash="c9e3f88216ef189400280a610771aa3e"/><file name="FrameController.php" hash="07f1a8d0f1e5a1a8e627484bf9d2b76f"/></dir><dir name="data"><dir name="quartic_setup"><file name="data-install-1.2.3.php" hash="e28e26cf5bb0de1e35f732ece1ca24dc"/><file name="data-install-1.3.1.php" hash="e28e26cf5bb0de1e35f732ece1ca24dc"/><file name="data-upgrade-1.2.2-1.2.3.php" hash="b440e6fbc24f21c5f95ca0b68b8f7bbb"/><file name="data-upgrade-1.2.9-1.3.0.php" hash="2968ca978876dcf4aabc6462adeef295"/><file name="data-upgrade-1.3.0-1.3.1.php" hash="2968ca978876dcf4aabc6462adeef295"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="83ac72792e22853dff836e0ff5612e32"/><file name="config.xml" hash="9903ab7a8ad6f9ae4b4f5cbde5241d91"/><file name="system.xml" hash="96a42d8e9dc03bad5e6b36497bd72543"/></dir><dir name="sql"><dir name="quartic_setup"><file name="mysql4-install-0.1.0.php" hash="ed5bdcbe719e466cd3f4efa26b72c6b1"/><file name="mysql4-install-0.1.4.php" hash="9e65888ab6e237a412f03b8f40e8e952"/><file name="mysql4-upgrade-0.1.0-0.1.4.php" hash="607142527b29edec6bf3627267ac0d55"/><file name="mysql4-upgrade-0.1.7-0.2.0.php" hash="cb0a96030a8ec29c7cf4183dd61ccf2f"/><file name="mysql4-upgrade-0.2.1-0.2.2.php" hash="c2802cf049815d75117486b3f9703767"/><file name="mysql4-upgrade-0.2.2-0.2.3.php" hash="26c21317b21f34f7fc819cfd02f413cf"/><file name="mysql4-upgrade-0.2.3-0.2.4.php" hash="cb44aa73f7131b4ea2acb4e6d1873e35"/><file name="mysql4-upgrade-0.2.5-0.2.6.php" hash="d256dc5935a04c71d4b1c924c58a2ca6"/><file name="mysql4-upgrade-0.3.1-0.3.2.php" hash="9d5f6e7e1101f535b146cafb93b84ecc"/><file name="mysql4-upgrade-0.3.2-0.3.3.php" hash="c9bf9d6273f733e9732a7123746d6e9a"/><file name="mysql4-upgrade-0.3.3-0.3.4.php" hash="4412d48af50cb8c6ad9fad9a36807528"/><file name="mysql4-upgrade-0.3.4-0.3.5.php" hash="8f653dd35b5461a24d4c9808eae24c4a"/><file name="mysql4-upgrade-0.3.5-0.3.6.php" hash="f6da8601bdfc9c28521d20e80fd2b556"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="427c55b45f0e779bfeb9e6659e3f5a89"/><file name="mysql4-upgrade-1.1.1-1.2.0.php" hash="72099a7874167ab26c49c607c5383f70"/><file name="mysql4-upgrade-1.2.0-1.2.3.php" hash="7e0d931c3d5c5a9e6fbce817f9223f56"/><file name="mysql4-upgrade-1.2.3-1.3.0.0.php" hash="20c89cde0be8e82895a99bead4661415"/><file name="mysql4-upgrade-1.3.0.0-1.3.1.0.php" hash="0489c5c93336430da7aadb560bfb0f0e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="quartic.xml" hash="b653f620afa50d3fb954a5e0f88e2746"/></dir><dir name="template"><dir name="quartic"><dir name="api"><file name="dump.phtml" hash="0bba42e9b5ffb4284aee119921989b17"/></dir><file name="history.phtml" hash="dd9c6ec4eedc5de84ac90fd547ceabef"/><file name="maps.phtml" hash="438965b309d3e16488950e1576451203"/><dir name="system"><dir name="config"><file name="button_register.phtml" hash="f85b46c8e01c47d4bb369fa04074d3ef"/></dir></dir><file name="urls.phtml" hash="9e851635f6c1737e5db9081baa222174"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="quartic.xml" hash="bf49e10951335ef2e2494dd2f9dc7e5d"/></dir><dir name="template"><dir name="quartic"><file name="cart.phtml" hash="bec59d333255f34e0785002667f94306"/><dir name="frame"><file name="cart.phtml" hash="330441bbf70ee7a5c548f6a78507c5c0"/><file name="category.phtml" hash="330441bbf70ee7a5c548f6a78507c5c0"/><file name="home.phtml" hash="330441bbf70ee7a5c548f6a78507c5c0"/><file name="product.phtml" hash="ba414f18717384fda768c116bdff9f50"/></dir><dir name="getter"><file name="order.phtml" hash="a623a03bc9b51721bf547d80773f9c22"/><file name="product.phtml" hash="b71034985ed2757e85072597e300359f"/></dir><dir name="products"><file name="slt_cart.phtml" hash="b534e86c913c3e5c7a59956980055e9a"/><file name="slt_category.phtml" hash="b534e86c913c3e5c7a59956980055e9a"/><file name="slt_home.phtml" hash="b534e86c913c3e5c7a59956980055e9a"/><file name="slt_product.phtml" hash="b534e86c913c3e5c7a59956980055e9a"/></dir><file name="products.phtml" hash="2402fe0ce2153e9520a74457b5e96495"/><file name="script.phtml" hash="0cfc26a61827cc3bfd55523aace47c7a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Quarticon_Quartic.xml" hash="7b123838bd21dca630ee2c92d3ef3194"/></dir></target><target name="magelocale"><dir name="pl_PL"><file name="Quarticon_Quartic.csv" hash="39be3b4f0e8e3e4ef2ecc37740d52844"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="quarticon-icon.png" hash="75db9de222be47ea963f5432ef8b3ef3"/></dir><file name="quartic.css" hash="fece17f7531ae2384639d3382a7f293a"/></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><file name="quartic.css" hash="09dbf269fc29f07a9fc2f8191a62934e"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
skin/adminhtml/default/default/images/quarticon-icon.png CHANGED
File without changes
skin/adminhtml/default/default/quartic.css CHANGED
@@ -1,7 +1,7 @@
1
- .quarticon-headline {
2
- background: url('images/quarticon-icon.png') no-repeat;
3
- display: inline;
4
- width: 25px; height: 20px;
5
- float: left;
6
- background-size: 20px 20px;
7
- }
1
+ .quarticon-headline {
2
+ background: url('images/quarticon-icon.png') no-repeat;
3
+ display: inline;
4
+ width: 25px; height: 20px;
5
+ float: left;
6
+ background-size: 20px 20px;
7
+ }
skin/frontend/base/default/quartic.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .qON_placeholder .qONjs[style] {
2
+ clear:both;
3
+ }