Futurenext_Zakeke - Version 1.0.0.0

Version Notes

Initial release

Download this release

Release Info

Developer Futurenext
Extension Futurenext_Zakeke
Version 1.0.0.0
Comparing to
See all releases


Version 1.0.0.0

Files changed (64) hide show
  1. app/code/community/Futurenext/Zakeke/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Downloadable.php +36 -0
  2. app/code/community/Futurenext/Zakeke/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php +168 -0
  3. app/code/community/Futurenext/Zakeke/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php +302 -0
  4. app/code/community/Futurenext/Zakeke/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php +210 -0
  5. app/code/community/Futurenext/Zakeke/Block/Adminhtml/Sales/Items/Column/Zakeke/Name.php +135 -0
  6. app/code/community/Futurenext/Zakeke/Block/CartItemRenderer.php +116 -0
  7. app/code/community/Futurenext/Zakeke/Block/CheckoutItemRenderer.php +107 -0
  8. app/code/community/Futurenext/Zakeke/Block/Customize.php +211 -0
  9. app/code/community/Futurenext/Zakeke/Block/Customize/Add.php +24 -0
  10. app/code/community/Futurenext/Zakeke/Block/Customize/Configure.php +24 -0
  11. app/code/community/Futurenext/Zakeke/Block/CustomizeButton.php +83 -0
  12. app/code/community/Futurenext/Zakeke/Block/ModuleChecker.php +43 -0
  13. app/code/community/Futurenext/Zakeke/Block/Sales/Order/Email/Items/Order/Default.php +37 -0
  14. app/code/community/Futurenext/Zakeke/Block/SalesItemRenderer.php +80 -0
  15. app/code/community/Futurenext/Zakeke/Block/View.php +77 -0
  16. app/code/community/Futurenext/Zakeke/Helper/Data.php +82 -0
  17. app/code/community/Futurenext/Zakeke/Helper/ZakekeApi.php +452 -0
  18. app/code/community/Futurenext/Zakeke/Model/Api2/Colors.php +21 -0
  19. app/code/community/Futurenext/Zakeke/Model/Api2/Colors/Rest/Admin/V1.php +45 -0
  20. app/code/community/Futurenext/Zakeke/Model/Api2/ProductAttribute.php +21 -0
  21. app/code/community/Futurenext/Zakeke/Model/Api2/ProductAttribute/Rest/Admin/V1.php +29 -0
  22. app/code/community/Futurenext/Zakeke/Model/Api2/ProductOptions.php +21 -0
  23. app/code/community/Futurenext/Zakeke/Model/Api2/ProductOptions/Rest/Admin/V1.php +79 -0
  24. app/code/community/Futurenext/Zakeke/Model/Api2/Settings.php +21 -0
  25. app/code/community/Futurenext/Zakeke/Model/Api2/Settings/Rest/Admin/V1.php +32 -0
  26. app/code/community/Futurenext/Zakeke/Model/Api2/ZakekeEnabled.php +21 -0
  27. app/code/community/Futurenext/Zakeke/Model/Api2/ZakekeEnabled/Rest/Admin/V1.php +130 -0
  28. app/code/community/Futurenext/Zakeke/Model/ModuleList.php +113 -0
  29. app/code/community/Futurenext/Zakeke/Model/Observer.php +621 -0
  30. app/code/community/Futurenext/Zakeke/Model/Resource/Setup.php +20 -0
  31. app/code/community/Futurenext/Zakeke/Model/Resource/ZakekeEnabled.php +38 -0
  32. app/code/community/Futurenext/Zakeke/Model/Resource/ZakekeEnabled/Collection.php +24 -0
  33. app/code/community/Futurenext/Zakeke/Model/ZakekeEnabled.php +42 -0
  34. app/code/community/Futurenext/Zakeke/controllers/CustomizeController.php +348 -0
  35. app/code/community/Futurenext/Zakeke/controllers/Zakeke/ModuleCheckerController.php +44 -0
  36. app/code/community/Futurenext/Zakeke/etc/adminhtml.xml +47 -0
  37. app/code/community/Futurenext/Zakeke/etc/api2.xml +251 -0
  38. app/code/community/Futurenext/Zakeke/etc/config.xml +189 -0
  39. app/code/community/Futurenext/Zakeke/etc/system.xml +70 -0
  40. app/code/community/Futurenext/Zakeke/sql/zakeke_setup/install-1.0.0.0.php +90 -0
  41. app/design/adminhtml/default/default/layout/zakeke.xml +142 -0
  42. app/design/adminhtml/default/default/template/zakeke/modulechecker.phtml +64 -0
  43. app/design/adminhtml/default/default/template/zakeke/sales/items/column/zakeke/name.phtml +45 -0
  44. app/design/adminhtml/default/default/template/zakeke/sales/order/creditmemo/create/items/renderer/zakeke.phtml +262 -0
  45. app/design/adminhtml/default/default/template/zakeke/sales/order/creditmemo/view/items/renderer/zakeke.phtml +246 -0
  46. app/design/adminhtml/default/default/template/zakeke/sales/order/invoice/create/items/renderer/zakeke.phtml +255 -0
  47. app/design/adminhtml/default/default/template/zakeke/sales/order/invoice/view/items/renderer/zakeke.phtml +254 -0
  48. app/design/adminhtml/default/default/template/zakeke/sales/order/view/items/renderer/zakeke.phtml +223 -0
  49. app/design/frontend/base/default/layout/zakeke.xml +126 -0
  50. app/design/frontend/base/default/template/zakeke/cart/item/default.phtml +274 -0
  51. app/design/frontend/base/default/template/zakeke/cart/minicart.phtml +184 -0
  52. app/design/frontend/base/default/template/zakeke/checkout/onepage/review/item.phtml +237 -0
  53. app/design/frontend/base/default/template/zakeke/customization/add.phtml +23 -0
  54. app/design/frontend/base/default/template/zakeke/customize.phtml +25 -0
  55. app/design/frontend/base/default/template/zakeke/customizeButton.phtml +52 -0
  56. app/design/frontend/base/default/template/zakeke/sales/order/items/renderer/zakeke.phtml +349 -0
  57. app/etc/modules/Futurenext_Zakeke.xml +13 -0
  58. js/zakeke/customize.js +145 -0
  59. js/zakeke/jquery.js +6 -0
  60. js/zakeke/preview.js +45 -0
  61. package.xml +18 -0
  62. skin/adminhtml/default/default/zakeke/modulechecker.css +42 -0
  63. skin/frontend/base/default/css/zakeke/productview.css +0 -0
  64. skin/frontend/base/default/js/zakeke/preview.js +45 -0
app/code/community/Futurenext/Zakeke/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Downloadable.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Downloadable
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml block for fieldset of downloadable product
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_Downloadable_Block_Adminhtml_Catalog_Product_Composite_Fieldset_Downloadable extends Mage_Downloadable_Block_Catalog_Product_Links
35
+ {
36
+ }
app/code/community/Futurenext/Zakeke/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Downloadable
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml catalog product downloadable items tab and form
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Downloadable
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_Downloadable_Block_Adminhtml_Catalog_Product_Edit_Tab_Downloadable
35
+ extends Mage_Adminhtml_Block_Widget implements Mage_Adminhtml_Block_Widget_Tab_Interface
36
+ {
37
+
38
+ /**
39
+ * Reference to product objects that is being edited
40
+ *
41
+ * @var Mage_Catalog_Model_Product
42
+ */
43
+ protected $_product = null;
44
+
45
+ protected $_config = null;
46
+
47
+ /**
48
+ * Class constructor
49
+ *
50
+ */
51
+ public function __construct()
52
+ {
53
+ parent::__construct();
54
+ // $this->setSkipGenerateContent(true);
55
+ $this->setTemplate('downloadable/product/edit/downloadable.phtml');
56
+ }
57
+
58
+ /**
59
+ * Get tab URL
60
+ *
61
+ * @return string
62
+ */
63
+ // public function getTabUrl()
64
+ // {
65
+ // return $this->getUrl('downloadable/product_edit/form', array('_current' => true));
66
+ // }
67
+
68
+ /**
69
+ * Get tab class
70
+ *
71
+ * @return string
72
+ */
73
+ // public function getTabClass()
74
+ // {
75
+ // return 'ajax';
76
+ // }
77
+
78
+ /**
79
+ * Check is readonly block
80
+ *
81
+ * @return boolean
82
+ */
83
+ public function isReadonly()
84
+ {
85
+ return $this->getProduct()->getDownloadableReadonly();
86
+ }
87
+
88
+ /**
89
+ * Retrieve product
90
+ *
91
+ * @return Mage_Catalog_Model_Product
92
+ */
93
+ public function getProduct()
94
+ {
95
+ return Mage::registry('current_product');
96
+ }
97
+
98
+ /**
99
+ * Get tab label
100
+ *
101
+ * @return string
102
+ */
103
+ public function getTabLabel()
104
+ {
105
+ return Mage::helper('downloadable')->__('Downloadable Information');
106
+ }
107
+
108
+ /**
109
+ * Get tab title
110
+ *
111
+ * @return string
112
+ */
113
+ public function getTabTitle()
114
+ {
115
+ return Mage::helper('downloadable')->__('Downloadable Information');
116
+ }
117
+
118
+ /**
119
+ * Check if tab can be displayed
120
+ *
121
+ * @return boolean
122
+ */
123
+ public function canShowTab()
124
+ {
125
+ return true;
126
+ }
127
+
128
+ /**
129
+ * Check if tab is hidden
130
+ *
131
+ * @return boolean
132
+ */
133
+ public function isHidden()
134
+ {
135
+ return false;
136
+ }
137
+
138
+ /**
139
+ * Render block HTML
140
+ *
141
+ * @return string
142
+ */
143
+ protected function _toHtml()
144
+ {
145
+ $accordion = $this->getLayout()->createBlock('adminhtml/widget_accordion')
146
+ ->setId('downloadableInfo');
147
+
148
+ $accordion->addItem('samples', array(
149
+ 'title' => Mage::helper('adminhtml')->__('Samples'),
150
+ 'content' => $this->getLayout()
151
+ ->createBlock('downloadable/adminhtml_catalog_product_edit_tab_downloadable_samples')->toHtml(),
152
+ 'open' => false,
153
+ ));
154
+
155
+ $accordion->addItem('links', array(
156
+ 'title' => Mage::helper('adminhtml')->__('Links'),
157
+ 'content' => $this->getLayout()->createBlock(
158
+ 'downloadable/adminhtml_catalog_product_edit_tab_downloadable_links',
159
+ 'catalog.product.edit.tab.downloadable.links')->toHtml(),
160
+ 'open' => true,
161
+ ));
162
+
163
+ $this->setChild('accordion', $accordion);
164
+
165
+ return parent::_toHtml();
166
+ }
167
+
168
+ }
app/code/community/Futurenext/Zakeke/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Downloadable
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml catalog product downloadable items tab links section
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Downloadable
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_Downloadable_Block_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Links
35
+ extends Mage_Adminhtml_Block_Template
36
+ {
37
+ /**
38
+ * Purchased Separately Attribute cache
39
+ *
40
+ * @var Mage_Catalog_Model_Resource_Eav_Attribute
41
+ */
42
+ protected $_purchasedSeparatelyAttribute = null;
43
+
44
+ /**
45
+ * Class constructor
46
+ *
47
+ */
48
+ public function __construct()
49
+ {
50
+ parent::__construct();
51
+ $this->setTemplate('downloadable/product/edit/downloadable/links.phtml');
52
+ $this->setCanEditPrice(true);
53
+ $this->setCanReadPrice(true);
54
+ }
55
+
56
+ /**
57
+ * Get product that is being edited
58
+ *
59
+ * @return Mage_Catalog_Model_Product
60
+ */
61
+ public function getProduct()
62
+ {
63
+ return Mage::registry('product');
64
+ }
65
+
66
+ /**
67
+ * Retrieve Purchased Separately Attribute object
68
+ *
69
+ * @return Mage_Catalog_Model_Resource_Eav_Attribute
70
+ */
71
+ public function getPurchasedSeparatelyAttribute()
72
+ {
73
+ if (is_null($this->_purchasedSeparatelyAttribute)) {
74
+ $_attributeCode = 'links_purchased_separately';
75
+
76
+ $this->_purchasedSeparatelyAttribute = Mage::getModel('eav/entity_attribute')
77
+ ->loadByCode(Mage_Catalog_Model_Product::ENTITY, $_attributeCode);
78
+ }
79
+
80
+ return $this->_purchasedSeparatelyAttribute;
81
+ }
82
+
83
+ /**
84
+ * Retrieve Purchased Separately HTML select
85
+ *
86
+ * @return string
87
+ */
88
+ public function getPurchasedSeparatelySelect()
89
+ {
90
+ $select = $this->getLayout()->createBlock('adminhtml/html_select')
91
+ ->setName('product[links_purchased_separately]')
92
+ ->setId('downloadable_link_purchase_type')
93
+ ->setOptions(Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray())
94
+ ->setValue($this->getProduct()->getLinksPurchasedSeparately());
95
+
96
+ return $select->getHtml();
97
+ }
98
+
99
+ /**
100
+ * Retrieve Add button HTML
101
+ *
102
+ * @return string
103
+ */
104
+ public function getAddButtonHtml()
105
+ {
106
+ $addButton = $this->getLayout()->createBlock('adminhtml/widget_button')
107
+ ->setData(array(
108
+ 'label' => Mage::helper('downloadable')->__('Add New Row'),
109
+ 'id' => 'add_link_item',
110
+ 'class' => 'add'
111
+ ));
112
+ return $addButton->toHtml();
113
+ }
114
+
115
+ /**
116
+ * Retrieve default links title
117
+ *
118
+ * @return string
119
+ */
120
+ public function getLinksTitle()
121
+ {
122
+ return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE);
123
+ }
124
+
125
+ /**
126
+ * Check exists defined links title
127
+ *
128
+ * @return bool
129
+ */
130
+ public function getUsedDefault()
131
+ {
132
+ return $this->getProduct()->getAttributeDefaultValue('links_title') === false;
133
+ }
134
+
135
+ /**
136
+ * Return true if price in website scope
137
+ *
138
+ * @deprecated since 1.14.2.0
139
+ * @return bool
140
+ */
141
+ public function getIsPriceWebsiteScope()
142
+ {
143
+ return Mage::helper('downloadable')->getIsPriceWebsiteScope();
144
+ }
145
+
146
+ /**
147
+ * Return array of links
148
+ *
149
+ * @return array
150
+ */
151
+ public function getLinkData()
152
+ {
153
+ $linkArr = array();
154
+ $links = $this->getProduct()->getTypeInstance(true)->getLinks($this->getProduct());
155
+ $priceWebsiteScope = Mage::helper('downloadable')->getIsPriceWebsiteScope();
156
+ foreach ($links as $item) {
157
+ $tmpLinkItem = array(
158
+ 'link_id' => $item->getId(),
159
+ 'title' => $this->escapeHtml($item->getTitle()),
160
+ 'price' => $this->getCanReadPrice() ? $this->getPriceValue($item->getPrice()) : '',
161
+ 'number_of_downloads' => $item->getNumberOfDownloads(),
162
+ 'is_shareable' => $item->getIsShareable(),
163
+ 'link_url' => $item->getLinkUrl(),
164
+ 'link_type' => $item->getLinkType(),
165
+ 'sample_file' => $item->getSampleFile(),
166
+ 'sample_url' => $item->getSampleUrl(),
167
+ 'sample_type' => $item->getSampleType(),
168
+ 'sort_order' => $item->getSortOrder(),
169
+ );
170
+ $file = Mage::helper('downloadable/file')->getFilePath(
171
+ Mage_Downloadable_Model_Link::getBasePath(), $item->getLinkFile()
172
+ );
173
+
174
+ if ($item->getLinkFile() && !is_file($file)) {
175
+ Mage::helper('core/file_storage_database')->saveFileToFilesystem($file);
176
+ }
177
+
178
+ if ($item->getLinkFile() && is_file($file)) {
179
+ $name = '<a href="'
180
+ . $this->getUrl('*/downloadable_product_edit/link', array(
181
+ 'id' => $item->getId(),
182
+ '_secure' => true
183
+ )) . '">' . Mage::helper('downloadable/file')->getFileFromPathFile($item->getLinkFile()) . '</a>';
184
+ $tmpLinkItem['file_save'] = array(
185
+ array(
186
+ 'file' => $item->getLinkFile(),
187
+ 'name' => $name,
188
+ 'size' => filesize($file),
189
+ 'status' => 'old'
190
+ ));
191
+ }
192
+ $sampleFile = Mage::helper('downloadable/file')->getFilePath(
193
+ Mage_Downloadable_Model_Link::getBaseSamplePath(), $item->getSampleFile()
194
+ );
195
+ if ($item->getSampleFile() && is_file($sampleFile)) {
196
+ $tmpLinkItem['sample_file_save'] = array(
197
+ array(
198
+ 'file' => $item->getSampleFile(),
199
+ 'name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getSampleFile()),
200
+ 'size' => filesize($sampleFile),
201
+ 'status' => 'old'
202
+ ));
203
+ }
204
+ if ($item->getNumberOfDownloads() == '0') {
205
+ $tmpLinkItem['is_unlimited'] = ' checked="checked"';
206
+ }
207
+ if ($this->getProduct()->getStoreId() && $item->getStoreTitle()) {
208
+ $tmpLinkItem['store_title'] = $item->getStoreTitle();
209
+ }
210
+ if ($this->getProduct()->getStoreId() && $priceWebsiteScope) {
211
+ $tmpLinkItem['website_price'] = $item->getWebsitePrice();
212
+ }
213
+ $linkArr[] = new Varien_Object($tmpLinkItem);
214
+ }
215
+ return $linkArr;
216
+ }
217
+
218
+ /**
219
+ * Return formated price with two digits after decimal point
220
+ *
221
+ * @param decimal $value
222
+ * @return decimal
223
+ */
224
+ public function getPriceValue($value)
225
+ {
226
+ return number_format($value, 2, null, '');
227
+ }
228
+
229
+ /**
230
+ * Retrieve max downloads value from config
231
+ *
232
+ * @return int
233
+ */
234
+ public function getConfigMaxDownloads()
235
+ {
236
+ return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_DEFAULT_DOWNLOADS_NUMBER);
237
+ }
238
+
239
+ /**
240
+ * Prepare block Layout
241
+ *
242
+ */
243
+ protected function _prepareLayout()
244
+ {
245
+ $this->setChild(
246
+ 'upload_button',
247
+ $this->getLayout()->createBlock('adminhtml/widget_button')->addData(array(
248
+ 'id' => '',
249
+ 'label' => Mage::helper('adminhtml')->__('Upload Files'),
250
+ 'type' => 'button',
251
+ 'onclick' => 'Downloadable.massUploadByType(\'links\');Downloadable.massUploadByType(\'linkssample\')'
252
+ ))
253
+ );
254
+ }
255
+
256
+ /**
257
+ * Retrieve Upload button HTML
258
+ *
259
+ * @return string
260
+ */
261
+ public function getUploadButtonHtml()
262
+ {
263
+ return $this->getChild('upload_button')->toHtml();
264
+ }
265
+
266
+ /**
267
+ * Retrive config json
268
+ *
269
+ * @return string
270
+ */
271
+ public function getConfigJson($type='links')
272
+ {
273
+ $this->getConfig()->setUrl(Mage::getModel('adminhtml/url')->addSessionParam()
274
+ ->getUrl('*/downloadable_file/upload', array('type' => $type, '_secure' => true)));
275
+ $this->getConfig()->setParams(array('form_key' => $this->getFormKey()));
276
+ $this->getConfig()->setFileField($type);
277
+ $this->getConfig()->setFilters(array(
278
+ 'all' => array(
279
+ 'label' => Mage::helper('adminhtml')->__('All Files'),
280
+ 'files' => array('*.*')
281
+ )
282
+ ));
283
+ $this->getConfig()->setReplaceBrowseWithRemove(true);
284
+ $this->getConfig()->setWidth('32');
285
+ $this->getConfig()->setHideUploadButton(true);
286
+ return Mage::helper('core')->jsonEncode($this->getConfig()->getData());
287
+ }
288
+
289
+ /**
290
+ * Retrive config object
291
+ *
292
+ * @return Varien_Config
293
+ */
294
+ public function getConfig()
295
+ {
296
+ if(is_null($this->_config)) {
297
+ $this->_config = new Varien_Object();
298
+ }
299
+
300
+ return $this->_config;
301
+ }
302
+ }
app/code/community/Futurenext/Zakeke/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Downloadable
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml catalog product downloadable items tab links section
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Downloadable
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Mage_Downloadable_Block_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Samples
35
+ extends Mage_Adminhtml_Block_Widget
36
+ {
37
+ /**
38
+ * Class constructor
39
+ *
40
+ */
41
+ public function __construct()
42
+ {
43
+ parent::__construct();
44
+ $this->setTemplate('downloadable/product/edit/downloadable/samples.phtml');
45
+ }
46
+
47
+ /**
48
+ * Get model of the product that is being edited
49
+ *
50
+ * @return Mage_Catalog_Model_Product
51
+ */
52
+ public function getProduct()
53
+ {
54
+ return Mage::registry('current_product');
55
+ }
56
+
57
+ /**
58
+ * Check block is readonly
59
+ *
60
+ * @return boolean
61
+ */
62
+ public function isReadonly()
63
+ {
64
+ return $this->getProduct()->getDownloadableReadonly();
65
+ }
66
+
67
+
68
+ /**
69
+ * Retrieve Add Button HTML
70
+ *
71
+ * @return string
72
+ */
73
+ public function getAddButtonHtml()
74
+ {
75
+ $addButton = $this->getLayout()->createBlock('adminhtml/widget_button')
76
+ ->setData(array(
77
+ 'label' => Mage::helper('downloadable')->__('Add New Row'),
78
+ 'id' => 'add_sample_item',
79
+ 'class' => 'add',
80
+ ));
81
+ return $addButton->toHtml();
82
+ }
83
+
84
+ /**
85
+ * Retrieve samples array
86
+ *
87
+ * @return array
88
+ */
89
+ public function getSampleData()
90
+ {
91
+ $samplesArr = array();
92
+ $samples = $this->getProduct()->getTypeInstance(true)->getSamples($this->getProduct());
93
+ foreach ($samples as $item) {
94
+ $tmpSampleItem = array(
95
+ 'sample_id' => $item->getId(),
96
+ 'title' => $this->escapeHtml($item->getTitle()),
97
+ 'sample_url' => $item->getSampleUrl(),
98
+ 'sample_type' => $item->getSampleType(),
99
+ 'sort_order' => $item->getSortOrder(),
100
+ );
101
+ $file = Mage::helper('downloadable/file')->getFilePath(
102
+ Mage_Downloadable_Model_Sample::getBasePath(), $item->getSampleFile()
103
+ );
104
+ if ($item->getSampleFile() && !is_file($file)) {
105
+ Mage::helper('core/file_storage_database')->saveFileToFilesystem($file);
106
+ }
107
+ if ($item->getSampleFile() && is_file($file)) {
108
+ $tmpSampleItem['file_save'] = array(
109
+ array(
110
+ 'file' => $item->getSampleFile(),
111
+ 'name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getSampleFile()),
112
+ 'size' => filesize($file),
113
+ 'status' => 'old'
114
+ ));
115
+ }
116
+ if ($this->getProduct() && $item->getStoreTitle()) {
117
+ $tmpSampleItem['store_title'] = $item->getStoreTitle();
118
+ }
119
+ $samplesArr[] = new Varien_Object($tmpSampleItem);
120
+ }
121
+
122
+ return $samplesArr;
123
+ }
124
+
125
+ /**
126
+ * Check exists defined samples title
127
+ *
128
+ * @return bool
129
+ */
130
+ public function getUsedDefault()
131
+ {
132
+ return $this->getProduct()->getAttributeDefaultValue('samples_title') === false;
133
+ }
134
+
135
+ /**
136
+ * Retrieve Default samples title
137
+ *
138
+ * @return string
139
+ */
140
+ public function getSamplesTitle()
141
+ {
142
+ return Mage::getStoreConfig(Mage_Downloadable_Model_Sample::XML_PATH_SAMPLES_TITLE);
143
+ }
144
+
145
+ /**
146
+ * Prepare layout
147
+ *
148
+ */
149
+ protected function _prepareLayout()
150
+ {
151
+ $this->setChild(
152
+ 'upload_button',
153
+ $this->getLayout()->createBlock('adminhtml/widget_button')
154
+ ->addData(array(
155
+ 'id' => '',
156
+ 'label' => Mage::helper('adminhtml')->__('Upload Files'),
157
+ 'type' => 'button',
158
+ 'onclick' => 'Downloadable.massUploadByType(\'samples\')'
159
+ ))
160
+ );
161
+ }
162
+
163
+ /**
164
+ * Retrieve Upload button HTML
165
+ *
166
+ * @return string
167
+ */
168
+ public function getUploadButtonHtml()
169
+ {
170
+ return $this->getChild('upload_button')->toHtml();
171
+ }
172
+
173
+ /**
174
+ * Retrive config json
175
+ *
176
+ * @return string
177
+ */
178
+ public function getConfigJson()
179
+ {
180
+ $this->getConfig()->setUrl(Mage::getModel('adminhtml/url')
181
+ ->addSessionParam()
182
+ ->getUrl('*/downloadable_file/upload', array('type' => 'samples', '_secure' => true)));
183
+ $this->getConfig()->setParams(array('form_key' => $this->getFormKey()));
184
+ $this->getConfig()->setFileField('samples');
185
+ $this->getConfig()->setFilters(array(
186
+ 'all' => array(
187
+ 'label' => Mage::helper('adminhtml')->__('All Files'),
188
+ 'files' => array('*.*')
189
+ )
190
+ ));
191
+ $this->getConfig()->setReplaceBrowseWithRemove(true);
192
+ $this->getConfig()->setWidth('32');
193
+ $this->getConfig()->setHideUploadButton(true);
194
+ return Mage::helper('core')->jsonEncode($this->getConfig()->getData());
195
+ }
196
+
197
+ /**
198
+ * Retrive config object
199
+ *
200
+ * @return Varien_Config
201
+ */
202
+ public function getConfig()
203
+ {
204
+ if(is_null($this->_config)) {
205
+ $this->_config = new Varien_Object();
206
+ }
207
+
208
+ return $this->_config;
209
+ }
210
+ }
app/code/community/Futurenext/Zakeke/Block/Adminhtml/Sales/Items/Column/Zakeke/Name.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke admin sales item column render block
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Block_Adminhtml_Sales_Items_Column_Zakeke_Name extends Mage_Adminhtml_Block_Sales_Items_Column_Name
19
+ {
20
+ public function getZakekeOption()
21
+ {
22
+ /**
23
+ * Get the Zakeke product option
24
+ *
25
+ * @return int|false
26
+ * @throws Exception
27
+ */
28
+ try {
29
+ $additionalOptions = $this->getItem()->getProductOptionByCode('additional_options');
30
+ if (!$additionalOptions) {
31
+ return false;
32
+ }
33
+
34
+ foreach ($additionalOptions as $option) {
35
+ if (!isset($option['is_zakeke'])) {
36
+ continue;
37
+ }
38
+
39
+ return $option;
40
+ }
41
+
42
+ return false;
43
+ } catch (Exception $e) {
44
+ Mage::logException($e);
45
+ throw $e;
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Get the Zakeke design preview files
51
+ *
52
+ * @return int|false
53
+ * @throws Exception
54
+ */
55
+ public function getZakekeDesignId()
56
+ {
57
+ try {
58
+ $options = $this->getItem()->getProductOptions();
59
+ if (!$options) {
60
+ return false;
61
+ }
62
+
63
+ if (!isset($options['info_buyRequest'])) {
64
+ return false;
65
+ }
66
+
67
+ $buyRequest = $options['info_buyRequest'];
68
+
69
+ if (!isset($buyRequest[Futurenext_Zakeke_Helper_Data::ZAKEKE_DESIGN_PARAM])) {
70
+ return false;
71
+ }
72
+
73
+ return $buyRequest[Futurenext_Zakeke_Helper_Data::ZAKEKE_DESIGN_PARAM];
74
+ } catch (Exception $e) {
75
+ Mage::logException($e);
76
+ throw $e;
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Get the Zakeke design preview files
82
+ *
83
+ * @return array|false
84
+ * @throws Exception
85
+ */
86
+ public function getZakekePreviews()
87
+ {
88
+ try {
89
+ $zakekeDesignId = $this->getZakekeDesignId();
90
+ if (!$zakekeDesignId) {
91
+ return false;
92
+ }
93
+
94
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
95
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
96
+ $previews = $zakekeApi->getPreview($zakekeDesignId);
97
+ if (!$previews) {
98
+ $zakekeOption = $this->getZakekeOption();
99
+ if (isset($zakekeOption['previews'])) {
100
+ $previews = $zakekeOption['previews'];
101
+ }
102
+ }
103
+
104
+ return $previews;
105
+ } catch (Exception $e) {
106
+ Mage::logException($e);
107
+ throw $e;
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Get the Zakeke design output zip url
113
+ *
114
+ * @return array|false
115
+ * @throws Exception
116
+ */
117
+ public function getZakekeOutputZip()
118
+ {
119
+ try {
120
+ $zakekeDesignId = $this->getZakekeDesignId();
121
+ if (!$zakekeDesignId) {
122
+ return false;
123
+ }
124
+
125
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
126
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
127
+ $zipUrl = $zakekeApi->getZakekeOutputZip($zakekeDesignId);
128
+ return $zipUrl;
129
+ } catch (Exception $e) {
130
+ Mage::logException($e);
131
+ throw $e;
132
+ }
133
+ }
134
+ }
135
+ ?>
app/code/community/Futurenext/Zakeke/Block/CartItemRenderer.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke cart item render block
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Block_CartItemRenderer extends Mage_Checkout_Block_Cart_Item_Renderer
19
+ {
20
+ /**
21
+ * Get access to the Zakeke API
22
+ *
23
+ * @return Futurenext_Zakeke_Helper_ZakekeApi
24
+ */
25
+ protected function getZakekeApi()
26
+ {
27
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
28
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
29
+ return $zakekeApi;
30
+ }
31
+
32
+ /**
33
+ * Get the Zakeke design previews
34
+ *
35
+ * @return array|false
36
+ * @throws Exception
37
+ */
38
+ public function getZakekePreviews()
39
+ {
40
+ try {
41
+ $product = $this->getProduct();
42
+
43
+ $additionalOption = $product->getCustomOption('additional_options');
44
+ if (!$additionalOption) {
45
+ return false;
46
+ }
47
+
48
+ $additionalOptions = (array)unserialize($additionalOption->getValue());
49
+
50
+ foreach ($additionalOptions as $option) {
51
+ if (!isset($option['is_zakeke'])) {
52
+ continue;
53
+ }
54
+
55
+ $previews = array();
56
+ if (isset($option['previews'])) {
57
+ $previews = $option['previews'];
58
+ }
59
+ return $previews;
60
+ }
61
+ } catch (Exception $e) {
62
+ Mage::logException($e);
63
+ throw $e;
64
+ }
65
+ return false;
66
+ }
67
+
68
+ /**
69
+ * Get product customize options
70
+ *
71
+ * @return array|false
72
+ */
73
+ public function getProductOptions()
74
+ {
75
+ /* @var Mage_Catalog_Helper_Product_Configuration $helper */
76
+ $helper = Mage::helper('catalog/product_configuration');
77
+
78
+ $product = $this->getProduct();
79
+ $typeId = $product->getTypeId();
80
+ $options = null;
81
+ if ($typeId == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
82
+ $options = $helper->getConfigurableOptions($this->getItem());
83
+ } else {
84
+ $options = $helper->getCustomOptions($this->getItem());
85
+ }
86
+
87
+ return $options;
88
+ }
89
+
90
+ /**
91
+ * Get list of all otions for product
92
+ *
93
+ * @return array
94
+ */
95
+ public function getOptionList()
96
+ {
97
+ return $this->getProductOptions();
98
+ }
99
+
100
+ /**
101
+ * Get item configure url
102
+ *
103
+ * @return string
104
+ */
105
+ public function getConfigureUrl()
106
+ {
107
+ $item = $this->getItem();
108
+ $buyRequest = $item->getOptionByCode('info_buyRequest');
109
+ $buyRequestParams = (array)unserialize($buyRequest->getValue());
110
+ $buyRequestParams['id'] = $item->getId();
111
+ unset($buyRequestParams['zakeke-token']);
112
+ unset($buyRequestParams['zakeke-pricing']);
113
+
114
+ return $this->getUrl('zakeke/Customize/Configure') . '?' . http_build_query($buyRequestParams);
115
+ }
116
+ }
app/code/community/Futurenext/Zakeke/Block/CheckoutItemRenderer.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke checkout item render block
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Block_CheckoutItemRenderer extends Mage_Checkout_Block_Cart_Item_Renderer
19
+ {
20
+ /**
21
+ * Get product customize options
22
+ *
23
+ * @return array|false
24
+ */
25
+ public function getProductOptions()
26
+ {
27
+ /* @var Mage_Catalog_Helper_Product_Configuration $helper */
28
+ $helper = Mage::helper('catalog/product_configuration');
29
+
30
+ $product = $this->getProduct();
31
+ $typeId = $product->getTypeId();
32
+ $options = null;
33
+ if ($typeId == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
34
+ $options = $helper->getConfigurableOptions($this->getItem());
35
+ } else {
36
+ $options = $helper->getCustomOptions($this->getItem());
37
+ }
38
+
39
+ return $options;
40
+ }
41
+
42
+ /**
43
+ * Get the Zakeke design preview files
44
+ *
45
+ * @return int|false
46
+ * @throws Exception
47
+ */
48
+ public function getZakekeDesignId()
49
+ {
50
+ try {
51
+ $additionalOptions = $this->getItem()->getOptionByCode('additional_options');
52
+ if (!$additionalOptions) {
53
+ return false;
54
+ }
55
+
56
+ $options = (array)unserialize($additionalOptions->getValue());
57
+
58
+ foreach ($options as $option) {
59
+ if (!isset($option['is_zakeke'])) {
60
+ continue;
61
+ }
62
+
63
+ return $option['design'];
64
+ }
65
+
66
+ return false;
67
+ } catch (Exception $e) {
68
+ Mage::logException($e);
69
+ throw $e;
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Get the Zakeke design preview files
75
+ *
76
+ * @return array|false
77
+ * @throws Exception
78
+ */
79
+ public function getZakekePreviews()
80
+ {
81
+ try {
82
+ $additionalOptions = $this->getItem()->getOptionByCode('additional_options');
83
+ if (!$additionalOptions) {
84
+ return false;
85
+ }
86
+
87
+ $options = (array)unserialize($additionalOptions->getValue());
88
+
89
+ foreach ($options as $option) {
90
+ if (!isset($option['is_zakeke'])) {
91
+ continue;
92
+ }
93
+
94
+ $previews = array();
95
+ if (isset($option['previews'])) {
96
+ $previews = $option['previews'];
97
+ }
98
+ return $previews;
99
+ }
100
+
101
+ return false;
102
+ } catch (Exception $e) {
103
+ Mage::logException($e);
104
+ throw $e;
105
+ }
106
+ }
107
+ }
app/code/community/Futurenext/Zakeke/Block/Customize.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2017 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke base customization block
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Block_Customize extends Futurenext_Zakeke_Block_View
19
+ {
20
+ const WIDTH_BREAKPOINT = 768;
21
+
22
+ /**
23
+ * Check the customer device property.
24
+ *
25
+ * @return bool
26
+ */
27
+ private function isLarge()
28
+ {
29
+ $resolution = Mage::app()->getRequest()->getParam('resolution');
30
+ if ($resolution === null) {
31
+ return true;
32
+ }
33
+
34
+ $parts = explode('x', $resolution);
35
+ $width = (int)$parts[0];
36
+ return $width >= self::WIDTH_BREAKPOINT;
37
+ }
38
+
39
+ /**
40
+ * Get the Zakeke iframe.
41
+ *
42
+ * @return string
43
+ */
44
+ public function iframeHtml()
45
+ {
46
+ if ($this->isLarge()) {
47
+ $html = '<iframe id="zakeke-frame" src="' . $this->getLargeUrl() . '" style="min-height: 719px; width: 100%" frameBorder="0"></iframe>';
48
+ } else {
49
+ $html = '<iframe id="zakeke-frame" src="' . $this->getMobileUrl() .'" style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 999999999; height: 100%" frameBorder="0"></iframe>'
50
+ . '<style>body { overflow: hidden }</style>';
51
+ }
52
+
53
+ return $html . '<script> document.getElementById("zakeke-frame").scrollIntoView({block: "start", behavior: "smooth"}); </script>';
54
+ }
55
+
56
+ /**
57
+ * Zakeke authentication token.
58
+ *
59
+ * @return string
60
+ */
61
+ public function getZakekeToken()
62
+ {
63
+ return Mage::registry(
64
+ Futurenext_Zakeke_Helper_Data::ZAKEKE_REGISTRY_TOKEN
65
+ );
66
+ }
67
+
68
+ /**
69
+ * Color attribute identifier
70
+ *
71
+ * @return int|false
72
+ */
73
+ public function getColorAttributeId()
74
+ {
75
+ /** @var Mage_Eav_Model_Config $eav */
76
+ $eav = Mage::getModel('eav/config');
77
+ $attribute = $eav->getAttribute('catalog_product', 'color');
78
+ if (!isset($attribute)) {
79
+ return false;
80
+ }
81
+ return $attribute->getAttributeId();
82
+ }
83
+
84
+ /**
85
+ * How we display prices regarding tax
86
+ *
87
+ * @return string
88
+ */
89
+ protected function getTaxPricesPolicy()
90
+ {
91
+ $store = Mage::app()->getStore();
92
+
93
+ /** @var Mage_Tax_Helper_Data $taxHelper */
94
+ $taxHelper = Mage::helper('tax');
95
+ if ($taxHelper->displayPriceExcludingTax($store)) {
96
+ return 'excluding';
97
+ } else {
98
+ return 'including';
99
+ }
100
+ }
101
+
102
+ /**
103
+ * Return the URL for the Zakeke customizer iFrame
104
+ * complete of product SKU and security token
105
+ *
106
+ * @param bool $isMobile - Use the mobile or the large version
107
+ * @return string
108
+ */
109
+ public function getCustomizerUrl($isMobile)
110
+ {
111
+ $product = $this->getProduct();
112
+ $sku = null;
113
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
114
+ $sku = $product->getData('sku');
115
+ } else {
116
+ $sku = $product->getSku();
117
+ }
118
+
119
+ $data = array(
120
+ 'name' => $product->getName(),
121
+ 'token' => $this->getZakekeToken(),
122
+ 'currency' => Mage::app()->getStore()->getCurrentCurrencyCode(),
123
+ 'taxPricesPolicy' => $this->getTaxPricesPolicy(),
124
+ 'culture' => str_replace('_', '-', Mage::app()->getLocale()->getLocaleCode()),
125
+ 'modelCode' => $sku,
126
+ 'ecommerce' => 'magento1',
127
+ 'attribute' => array()
128
+ );
129
+
130
+ $params = Mage::app()->getRequest()->getParams();
131
+
132
+ if (isset($params['super_attribute'])) {
133
+ foreach ($params['super_attribute'] as $key => $value) {
134
+ $data['attribute'][$key] = $value;
135
+ }
136
+ }
137
+
138
+ if (isset($params['options'])) {
139
+ foreach ($params['options'] as $key => $value) {
140
+ $data['attribute'][$key] = $value;
141
+ }
142
+ }
143
+
144
+ if (isset($params['qty'])) {
145
+ $data['qty'] = $params['qty'];
146
+ }
147
+
148
+ $zakekeOption = Mage::app()->getRequest()->getParam(
149
+ Futurenext_Zakeke_Helper_Data::ZAKEKE_DESIGN_PARAM
150
+ );
151
+ if ($zakekeOption) {
152
+ $data['design'] = $zakekeOption;
153
+ }
154
+
155
+ $path = '/Customizer/index.html';
156
+ if ($isMobile) {
157
+ $path = '/Customizer/index.mobile.html';
158
+ }
159
+
160
+ $url = Futurenext_Zakeke_Helper_Data::ZAKEKE_BASE_URL . $path . '?' . http_build_query($data);
161
+ return $url;
162
+ }
163
+
164
+ public function getMobileUrl()
165
+ {
166
+ return $this->getCustomizerUrl(true);
167
+ }
168
+
169
+ public function getLargeUrl()
170
+ {
171
+ return $this->getCustomizerUrl(false);
172
+ }
173
+
174
+ /**
175
+ * Url where to go when the customization is added to cart
176
+ *
177
+ * @return string
178
+ */
179
+ public function getReturnUrl()
180
+ {
181
+ return Mage::app()->getRequest()->getParam('return_url', $this->getUrl('checkout/cart'));
182
+ }
183
+
184
+ /**
185
+ * Get json configuration needed to javascript
186
+ *
187
+ * @return string
188
+ */
189
+ public function getJsonConfig()
190
+ {
191
+ /** @var Mage_Core_Model_Session $session */
192
+ $session = Mage::getSingleton('core/session');
193
+
194
+ $data = array(
195
+ 'zakekeUrl' => Futurenext_Zakeke_Helper_Data::ZAKEKE_BASE_URL,
196
+ 'mobileUrl' => $this->getMobileUrl(),
197
+ 'largeUrl' => $this->getLargeUrl(),
198
+ 'params' => Mage::app()->getRequest()->getParams(),
199
+ 'colorAttributeId' => $this->getColorAttributeId(),
200
+ 'checkoutUrl' => $this->getAddtocartFormTarget(),
201
+ 'cartUrl' => $this->getUrl('checkout/cart'),
202
+ 'returnUrl' => $this->getReturnUrl(),
203
+ 'formKey' => $session->getFormKey(),
204
+ 'zakekeToken' => $this->getZakekeToken(),
205
+ 'baseUrl' => Mage::getBaseUrl()
206
+ );
207
+ /** @var Mage_Core_Helper_Data $coreHelper */
208
+ $coreHelper = Mage::helper('core');
209
+ return $coreHelper->jsonEncode($data);
210
+ }
211
+ }
app/code/community/Futurenext/Zakeke/Block/Customize/Add.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke new customization block
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Block_Customize_Add extends Futurenext_Zakeke_Block_Customize
19
+ {
20
+ public function getAddtocartFormTarget()
21
+ {
22
+ return $this->getUrl('checkout/cart/add');
23
+ }
24
+ }
app/code/community/Futurenext/Zakeke/Block/Customize/Configure.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke configure customization block
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Block_Customize_Configure extends Futurenext_Zakeke_Block_Customize
19
+ {
20
+ public function getAddtocartFormTarget()
21
+ {
22
+ return $this->getUrl('checkout/cart/updateItemOptions');
23
+ }
24
+ }
app/code/community/Futurenext/Zakeke/Block/CustomizeButton.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke customization button block
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Block_CustomizeButton extends Futurenext_Zakeke_Block_View
19
+ {
20
+ /**
21
+ * Url to the new product customization page
22
+ *
23
+ * @return string
24
+ */
25
+ public function getCustomizeAddUrl()
26
+ {
27
+ return $this->getUrl('zakeke/Customize/Add');
28
+ }
29
+
30
+ /**
31
+ * Url to to product customization editing page
32
+ *
33
+ * @return string
34
+ */
35
+ public function getCustomizeConfigureUrl()
36
+ {
37
+ $params = array(
38
+ 'id' => $this->getRequest()->getParam('id')
39
+ );
40
+
41
+ $zakekeOption = $this->getZakekeOption();
42
+ if ($zakekeOption) {
43
+ $params[Futurenext_Zakeke_Helper_Data::ZAKEKE_DESIGN_PARAM] = $zakekeOption['design'];
44
+ }
45
+
46
+ return $this->getUrl('zakeke/Customize/Configure') . '?' . http_build_query($params);
47
+ }
48
+
49
+ /**
50
+ * Check if the customer is editing a product quote item
51
+ *
52
+ * @return bool
53
+ */
54
+ public function isEditMode()
55
+ {
56
+ return $this->getRequest()->getActionName() == 'configure';
57
+ }
58
+
59
+ /**
60
+ * Url to the correct controller page
61
+ * @return string
62
+ */
63
+ public function getCustomizeUrl()
64
+ {
65
+ return $this->isEditMode() ? $this->getCustomizeConfigureUrl()
66
+ : $this->getCustomizeAddUrl();
67
+ }
68
+
69
+ /**
70
+ * Get json configuration needed to javascript
71
+ *
72
+ * @return string
73
+ */
74
+ public function getJsonConfig()
75
+ {
76
+ $data = array(
77
+ 'customizeUrl' => $this->getCustomizeUrl()
78
+ );
79
+ /** @var Mage_Core_Helper_Data $coreHelper */
80
+ $coreHelper = Mage::helper('core');
81
+ return $coreHelper->jsonEncode($data);
82
+ }
83
+ }
app/code/community/Futurenext/Zakeke/Block/ModuleChecker.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke module checker block
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Block_ModuleChecker extends Mage_Core_Block_Template
19
+ {
20
+ /**
21
+ * Get the list of incompatible modules
22
+ *
23
+ * @return Varien_Object[]
24
+ */
25
+ public function getModuleList()
26
+ {
27
+ return Mage::registry(
28
+ Futurenext_Zakeke_Helper_Data::ZAKEKE_MODULE_LIST_REGISTRY
29
+ );
30
+ }
31
+
32
+ /**
33
+ * Check if Zakeke is reachable from the shop server
34
+ *
35
+ * @return bool
36
+ */
37
+ public function getIsZakekeReachable()
38
+ {
39
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
40
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
41
+ return $zakekeApi->isReachable();
42
+ }
43
+ }
app/code/community/Futurenext/Zakeke/Block/Sales/Order/Email/Items/Order/Default.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke rewrite for sales email
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Block_Sales_Order_Email_Items_Order_Default extends Mage_Sales_Block_Order_Email_Items_Order_Default
19
+ {
20
+ public function getItemOptions()
21
+ {
22
+ $result = parent::getItemOptions();
23
+ foreach ($result as $key => $value) {
24
+ if (!isset($value['is_zakeke'])) {
25
+ continue;
26
+ }
27
+
28
+ /** @var Futurenext_Zakeke_Helper_Data $zakekeData */
29
+ $zakekeData = Mage::helper('futurenext_zakeke');
30
+
31
+ $result[$key]['value'] = $zakekeData->emailHtmlView($value['previews']);
32
+ break;
33
+ }
34
+
35
+ return $result;
36
+ }
37
+ }
app/code/community/Futurenext/Zakeke/Block/SalesItemRenderer.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke sales item renderer block
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Block_SalesItemRenderer extends Mage_Sales_Block_Order_Item_Renderer_Default
19
+ {
20
+ /**
21
+ * Get the Zakeke design preview files
22
+ *
23
+ * @return int|false
24
+ * @throws Exception
25
+ */
26
+ public function getZakekeDesignId()
27
+ {
28
+ try {
29
+ /** @var array $options */
30
+ $options = $this->getItem()->getProductOptions();
31
+ if (!($options && isset($options['info_buyRequest']))) {
32
+ return false;
33
+ }
34
+
35
+ $buyRequest = $options['info_buyRequest'];
36
+ if (!isset($buyRequest[Futurenext_Zakeke_Helper_Data::ZAKEKE_DESIGN_PARAM])) {
37
+ return false;
38
+ }
39
+
40
+ return $buyRequest[Futurenext_Zakeke_Helper_Data::ZAKEKE_DESIGN_PARAM];
41
+ } catch (Exception $e) {
42
+ Mage::logException($e);
43
+ throw $e;
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Get the Zakeke design preview files
49
+ *
50
+ * @return array|false
51
+ * @throws Exception
52
+ */
53
+ public function getZakekePreviews()
54
+ {
55
+ try {
56
+ /** @var array $options */
57
+ $options = $this->getItem()->getProductOptions();
58
+ if (!($options && isset($options['additional_options']))) {
59
+ return false;
60
+ }
61
+
62
+ $additionalOptions = $options['additional_options'];
63
+
64
+ foreach ($additionalOptions as $additionalOption) {
65
+ if (!isset($additionalOption['is_zakeke'])) {
66
+ continue;
67
+ }
68
+
69
+ if (isset($additionalOption['previews'])) {
70
+ return $additionalOption['previews'];
71
+ }
72
+ }
73
+
74
+ return [];
75
+ } catch (Exception $e) {
76
+ Mage::logException($e);
77
+ throw $e;
78
+ }
79
+ }
80
+ }
app/code/community/Futurenext/Zakeke/Block/View.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke base block
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Block_View extends Mage_Core_Block_Template
19
+ {
20
+ /**
21
+ * Get the current product
22
+ *
23
+ * @return Mage_Catalog_Model_Product
24
+ */
25
+ public function getProduct()
26
+ {
27
+ $product = Mage::registry('product');
28
+ return $product;
29
+ }
30
+
31
+ /**
32
+ * Return whether the current product is customizable with Zakeke
33
+ *
34
+ * @return bool
35
+ */
36
+ public function isProductCustomizable()
37
+ {
38
+ $product = $this->getProduct();
39
+ $sku = null;
40
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
41
+ $sku = $product->getData('sku');
42
+ } else {
43
+ $sku = $product->getSku();
44
+ }
45
+
46
+ /** @var Futurenext_Zakeke_Model_ZakekeEnabled $zakekeEnabled */
47
+ $zakekeEnabled = Mage::getModel('futurenext_zakeke/zakekeEnabled');
48
+ $zakekeEnabledId = $zakekeEnabled->getIdFromSku($sku);
49
+ Mage::log('Zakeke product with the sku ' . $sku . ' has $zakekeEnabledId ' . $zakekeEnabledId);
50
+ return (bool) $zakekeEnabledId;
51
+ }
52
+
53
+ /**
54
+ * Get the Zakeke product option
55
+ *
56
+ * @return array|null
57
+ */
58
+ protected function getZakekeOption()
59
+ {
60
+ $option = Mage::registry(
61
+ Futurenext_Zakeke_Helper_Data::ZAKEKE_OPTION_REGISTRY
62
+ );
63
+ return $option;
64
+ }
65
+
66
+ /**
67
+ * Retrieve Session Form Key
68
+ *
69
+ * @return string
70
+ */
71
+ public function getFormKey()
72
+ {
73
+ /** @var Mage_Core_Model_Session $session */
74
+ $session = Mage::getSingleton('core/session');
75
+ return $session->getFormKey();
76
+ }
77
+ }
app/code/community/Futurenext/Zakeke/Helper/Data.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke helper
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Helper_Data extends Mage_Core_Helper_Abstract
19
+ {
20
+ const ZAKEKE_BASE_URL = 'https://www.zakeke.com';
21
+ const ZAKEKE_API_URL = 'https://api.zakeke.com';
22
+ const ZAKEKE_REGISTRY_TOKEN = 'zakeke-auth-token';
23
+ const ADD_TO_CART_PARAM = 'zakeke-customization';
24
+ const ZAKEKE_DESIGN_PARAM = 'zakeke-design';
25
+ const ZAKEKE_PRICING_PARAM = 'zakeke-pricing';
26
+ const ZAKEKE_MODEL_PARAM = 'zakeke-model';
27
+ const ZAKEKE_OPTION_REGISTRY = 'zakeke-option';
28
+ const GUEST_COOKIE = 'zakeke-guest';
29
+ const ZAKEKE_MODULE_LIST_REGISTRY = 'zakeke-module-list';
30
+ const ZAKEKE_CART_INFO_REGISTRY = 'zakeke-cart-info';
31
+ const ZAKEKE_PRODUCT_TYPE = 'zakeke';
32
+
33
+ /**
34
+ * Return whether the product is customizable with Zakeke
35
+ *
36
+ * @param Mage_Catalog_Model_Product $product
37
+ * @return bool
38
+ */
39
+ public function isProductCustomizable($product)
40
+ {
41
+ $sku = null;
42
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
43
+ $sku = $product->getData('sku');
44
+ } else {
45
+ $sku = $product->getSku();
46
+ }
47
+
48
+ /** @var Futurenext_Zakeke_Model_ZakekeEnabled $zakekeEnabled */
49
+ $zakekeEnabled = Mage::getModel('futurenext_zakeke/zakekeEnabled');
50
+ $zakekeEnabledId = $zakekeEnabled->getIdFromSku($sku);
51
+ return (bool) $zakekeEnabledId;
52
+ }
53
+
54
+ /**
55
+ * Get the HTML view for the option
56
+ *
57
+ * @param array $previews
58
+ * @return string
59
+ */
60
+ public function htmlView($previews)
61
+ {
62
+ $output = '<div class="zakeke-preview"><div style="display: flex">';
63
+ foreach ($previews as $preview) {
64
+ $output .= '<div onclick="zakekeShowPreview(this)" data-zakeke-label="' . $this->quoteEscape($preview->label) . '" style="position: relative; cursor: pointer; margin: 0px;"><img src="' . $this->quoteEscape($preview->url) . '" style="width: 80px"></div>';
65
+ }
66
+
67
+ $output .= '</div></div>';
68
+ return $output;
69
+ }
70
+
71
+ /**
72
+ * Get the HTML view for the option
73
+ *
74
+ * @param array $previews
75
+ * @return string
76
+ */
77
+ public function emailHtmlView($previews)
78
+ {
79
+ $output = '<img src="' . $this->quoteEscape($previews[0]->url) . '" width="150" height="150" />';
80
+ return $output;
81
+ }
82
+ }
app/code/community/Futurenext/Zakeke/Helper/ZakekeApi.php ADDED
@@ -0,0 +1,452 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke API
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Helper_ZakekeApi extends Mage_Core_Helper_Abstract
19
+ {
20
+ private $options = array(
21
+ CURLOPT_RETURNTRANSFER => true, // return web page
22
+ CURLOPT_HEADER => false, // don't return headers
23
+ CURLOPT_FOLLOWLOCATION => true, // follow redirects
24
+ CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
25
+ CURLOPT_ENCODING => '', // handle compressed
26
+ CURLOPT_AUTOREFERER => true, // set referrer on redirect
27
+ CURLOPT_CONNECTTIMEOUT => 120, // time-out on connect
28
+ CURLOPT_TIMEOUT => 120, // time-out on response
29
+ );
30
+
31
+ /**
32
+ * Get the needed data for adding a product to the cart
33
+ *
34
+ * @param int $designId
35
+ * @return object|false
36
+ */
37
+ public function getCartInfo($designId)
38
+ {
39
+ $data = $this->getMinimalData();
40
+
41
+ $url = Futurenext_Zakeke_Helper_Data::ZAKEKE_API_URL
42
+ . '/api/designdocs/' . $designId . '/cartinfo'
43
+ . '?' . http_build_query($data);
44
+
45
+ $ch = curl_init();
46
+ curl_setopt_array($ch, $this->options);
47
+ curl_setopt($ch, CURLOPT_URL, $url);
48
+ $res = curl_exec($ch);
49
+
50
+ if ($res === false) {
51
+ Mage::log(
52
+ 'Zakeke: failed to get ' . $url . ' ' . curl_error($ch) . ' ' . $res,
53
+ Zend_Log::ERR
54
+ );
55
+ return false;
56
+ }
57
+
58
+ $json = json_decode($res);
59
+ if ($json === null) {
60
+ Mage::log(
61
+ 'Zakeke: failed to parse ' . $url . ' ' . $res,
62
+ Zend_Log::ERR
63
+ );
64
+ return false;
65
+ }
66
+
67
+ $res = new stdClass();
68
+ $res->pricing = $json->pricing;
69
+
70
+ $principalAvailable = false;
71
+ $previews = [];
72
+ foreach ($json->previewFiles as $preview) {
73
+ if ($preview->format == 'SVG' || $preview->isOutput) {
74
+ continue;
75
+ }
76
+
77
+ $previewObj = new stdClass();
78
+ $previewObj->url = $preview->url;
79
+ $previewObj->label = $preview->sideName;
80
+
81
+ if ($preview->sideIsDefault) {
82
+ $principalAvailable = true;
83
+ if ($previews) {
84
+ $previews[] = $previews[0];
85
+ $previews[0] = $previewObj;
86
+ } else {
87
+ $previews[] = $previewObj;
88
+ }
89
+ }
90
+
91
+ $previews[] = $previewObj;
92
+ }
93
+
94
+ if (!$principalAvailable) {
95
+ $previewObj = new stdClass();
96
+ $previewObj->url = $json->tempPreviewUrl;
97
+ $previewObj->label = '';
98
+
99
+ if ($previews) {
100
+ $previews[] = $previews[0];
101
+ $previews[0] = $previewObj;
102
+ } else {
103
+ $previews[] = $previewObj;
104
+ }
105
+ }
106
+
107
+ $res->previews = $previews;
108
+
109
+ return $res;
110
+ }
111
+
112
+ /**
113
+ * Get the Zakeke authentication token
114
+ *
115
+ * @param array $data - Data to pass as query string.
116
+ * @return string|false
117
+ */
118
+ public function getToken($data)
119
+ {
120
+ $registryKey = Futurenext_Zakeke_Helper_Data::ZAKEKE_REGISTRY_TOKEN . http_build_query($data);
121
+ $token = Mage::registry($registryKey);
122
+ if (!is_null($token)) {
123
+ return $token;
124
+ }
125
+
126
+ $data = array_merge($data, $this->getMinimalData());
127
+
128
+ $query = http_build_query($data);
129
+ $url = Futurenext_Zakeke_Helper_Data::ZAKEKE_API_URL . '/api/Login?' . $query;
130
+
131
+ $ch = curl_init($url);
132
+ curl_setopt_array($ch, $this->options);
133
+ $res = curl_exec($ch);
134
+
135
+ if ($res === false) {
136
+ Mage::log(
137
+ 'Zakeke: failed to get ' . $url . ' ' . curl_error($ch) . ' ' . $res,
138
+ Zend_Log::ERR
139
+ );
140
+ return false;
141
+ }
142
+
143
+ $json = json_decode($res);
144
+ if ($json === null) {
145
+ Mage::log(
146
+ 'Zakeke: failed to parse ' . $url . ' ' . $res,
147
+ Zend_Log::ERR
148
+ );
149
+ return false;
150
+ }
151
+
152
+ if (!isset($json->token)) {
153
+ Mage::log(
154
+ 'Zakeke: failed to get token ' . $url . ' ' . $res,
155
+ Zend_Log::ERR
156
+ );
157
+ return false;
158
+ }
159
+
160
+ $token = $json->token;
161
+ Mage::register($registryKey, $token);
162
+ return $token;
163
+ }
164
+
165
+ /**
166
+ * Get the minimal data required to get an authentication token
167
+ *
168
+ * @return array
169
+ */
170
+ protected function getMinimalData()
171
+ {
172
+ $zakekeUsername = Mage::getStoreConfig('futurenext_zakeke/settings/zakekeUsername');
173
+ $zakekePassword = Mage::getStoreConfig('futurenext_zakeke/settings/zakekePassword');
174
+
175
+ $data = array(
176
+ 'user' => $zakekeUsername,
177
+ 'pwd' => $zakekePassword
178
+ );
179
+ return $data;
180
+ }
181
+
182
+ /**
183
+ * Get the raw response from a Zakeke api
184
+ *
185
+ * @param string $url
186
+ * @return \stdClass|\stdClass[]|false
187
+ */
188
+ protected function getRawRequest($url)
189
+ {
190
+ $token = $this->getToken(
191
+ $this->getMinimalData()
192
+ );
193
+ if ($token === false) {
194
+ return false;
195
+ }
196
+
197
+ $url = Futurenext_Zakeke_Helper_Data::ZAKEKE_API_URL . $url;
198
+
199
+ $ch = curl_init($url);
200
+ curl_setopt_array($ch, $this->options);
201
+ curl_setopt($ch, CURLOPT_HTTPHEADER, [
202
+ 'X-Auth-Token: ' . $token,
203
+ ]);
204
+ $res = curl_exec($ch);
205
+ if ($res === false) {
206
+ Mage::log(
207
+ 'Zakeke: failed to get ' . $url . ' ' . curl_error($ch) . ' ' . $res,
208
+ Zend_Log::ERR
209
+ );
210
+ return false;
211
+ }
212
+
213
+ $json = json_decode($res);
214
+ if ($json === null) {
215
+ Mage::log(
216
+ 'Zakeke: failed to parse ' . $url . ' ' . $res,
217
+ Zend_Log::ERR
218
+ );
219
+ return false;
220
+ }
221
+
222
+ return $res;
223
+ }
224
+
225
+ /**
226
+ * Get the Zakeke design price
227
+ *
228
+ * @param string $designId - Zakeke design identifier
229
+ * @return array|false
230
+ */
231
+ public function getDesignPricing($designId)
232
+ {
233
+ return $this->getRawRequest('/api/designs/' . $designId . '/pricing');
234
+ }
235
+
236
+ /**
237
+ * Get the Zakeke design preview files
238
+ *
239
+ * @param string $designId - Zakeke design identifier
240
+ * @return array|false
241
+ */
242
+ public function getPreview($designId)
243
+ {
244
+ $data = array(
245
+ 'docid' => $designId
246
+ );
247
+ $json = $this->getRawRequest('/api/designs/0/previewfiles?' . http_build_query($data));
248
+ if ($json === false) {
249
+ return false;
250
+ }
251
+
252
+ $previews = array();
253
+ foreach ($json as $preview) {
254
+ if ($preview->format == 'SVG') {
255
+ continue;
256
+ }
257
+
258
+ $previewObj = new stdClass();
259
+ $previewObj->url = $preview->url;
260
+ $previewObj->label = $preview->sideName;
261
+ $previews[] = $previewObj;
262
+ }
263
+ return $previews;
264
+ }
265
+
266
+ /**
267
+ * Get the Zakeke design output zip
268
+ *
269
+ * @param string $designId - Zakeke design identifier
270
+ * @return string|false
271
+ */
272
+ public function getZakekeOutputZip($designId)
273
+ {
274
+ $data = array(
275
+ 'docid' => $designId
276
+ );
277
+ $json = $this->getRawRequest('/api/designs/0/outputfiles/zip?' . http_build_query($data));
278
+ if ($json === false) {
279
+ return false;
280
+ }
281
+
282
+ return $json->url;
283
+ }
284
+
285
+ /**
286
+ * Associate the guest with a customer
287
+ *
288
+ * @param string $guestCode - Guest identifier
289
+ * @param string $customerId - Customer identifier
290
+ * @return void
291
+ */
292
+ public function associateGuest($guestCode, $customerId)
293
+ {
294
+ $data = $this->getMinimalData();
295
+ $data['vc'] = $guestCode;
296
+ $data['cc'] = $customerId;
297
+
298
+ $this->getToken($data);
299
+ }
300
+
301
+ /**
302
+ * Order containing Zakeke customized products placed
303
+ *
304
+ * @param array $data - data of the order
305
+ * @return bool
306
+ */
307
+ public function placeOrder($data)
308
+ {
309
+ Mage::log('Zakeke placed order such info ' . json_encode($data));
310
+
311
+ $ch = curl_init();
312
+ curl_setopt_array($ch, $this->options);
313
+
314
+ $tokenData = $this->getMinimalData();
315
+ if (isset($data['customerID'])) {
316
+ $tokenData['cc'] = $data['customerID'];
317
+ } elseif (isset($data['visitorID'])) {
318
+ $tokenData['vc'] = $data['visitorID'];
319
+ }
320
+
321
+ $query = http_build_query($tokenData);
322
+ $url = Futurenext_Zakeke_Helper_Data::ZAKEKE_API_URL . '/api/Login?' . $query;
323
+ curl_setopt($ch, CURLOPT_URL, $url);
324
+ $res = curl_exec($ch);
325
+
326
+ if ($res === false) {
327
+ Mage::log(
328
+ 'Zakeke: failed to get ' . $url . ' ' . curl_error($ch) . ' ' . $res,
329
+ Zend_Log::ERR
330
+ );
331
+ return false;
332
+ }
333
+
334
+ $json = json_decode($res);
335
+ if ($json === null) {
336
+ Mage::log(
337
+ 'Zakeke: failed to parse ' . $url . ' ' . $res,
338
+ Zend_Log::ERR
339
+ );
340
+ return false;
341
+ }
342
+
343
+ $token = $json->token;
344
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
345
+ 'X-Auth-Token: ' . $token,
346
+ 'Connection: Keep-Alive',
347
+ 'Keep-Alive: 300'
348
+ ));
349
+
350
+ $placeOrderData = array(
351
+ 'orderCode' => $data['orderCode'],
352
+ 'sessionID' => $data['sessionID'],
353
+ 'total' => $data['total'],
354
+ 'orderStatusID' => $data['orderStatusID'],
355
+ 'details' => $data['details'],
356
+ 'marketplaceID' => '2'
357
+ );
358
+ $encodedData = http_build_query($placeOrderData);
359
+
360
+ $url = Futurenext_Zakeke_Helper_Data::ZAKEKE_API_URL . '/api/orderdocs';
361
+ curl_setopt($ch, CURLOPT_URL, $url);
362
+ curl_setopt($ch, CURLOPT_POST, 1);
363
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $encodedData);
364
+ $res = curl_exec($ch);
365
+
366
+ if ($res === false) {
367
+ Mage::log(
368
+ 'Zakeke: failed to get ' . $url . ' ' . curl_error($ch) . ' ' . $res,
369
+ Zend_Log::ERR
370
+ );
371
+ return false;
372
+ }
373
+
374
+ return true;
375
+ }
376
+
377
+ /**
378
+ * Cancel an order containing Zakeke customized products placed.
379
+ *
380
+ * @param string $orderId
381
+ * @return void
382
+ */
383
+ public function cancelOrder($orderId)
384
+ {
385
+ }
386
+
387
+ /**
388
+ * Return an array of incompatible modules with hints how to solve the problem
389
+ *
390
+ * @param array $moduleList
391
+ * @return array|false
392
+ */
393
+ public function moduleChecker($moduleList)
394
+ {
395
+ $incompatibleModules = array();
396
+
397
+ $json = $this->getRawRequest('/api/IncompatiblePlugins');
398
+ if ($json === false) {
399
+ return false;
400
+ }
401
+
402
+ foreach ($moduleList as $module) {
403
+ foreach ($json as $incompatibleModule) {
404
+ if ($module['name'] !== $incompatibleModule->name) {
405
+ continue;
406
+ }
407
+
408
+ if ($module['setup_version'] >= $incompatibleModule->fromVersion
409
+ || $module['setup_version'] <= $incompatibleModule->toVersion
410
+ ) {
411
+ $moduleInfo = new Varien_Object();
412
+ $moduleInfo->setName($module['name']);
413
+ $moduleInfo->setSetupVersion($module['setup_version']);
414
+ $moduleInfo->setHowToFixHtml($incompatibleModule->fix);
415
+
416
+ $incompatibleModules[] = $moduleInfo;
417
+ }
418
+ }
419
+ }
420
+
421
+ return $incompatibleModules;
422
+ }
423
+
424
+ /**
425
+ * Check if Zakeke is reachable from the shop server
426
+ *
427
+ * @return bool
428
+ */
429
+ public function isReachable()
430
+ {
431
+ $ch = curl_init(Futurenext_Zakeke_Helper_Data::ZAKEKE_BASE_URL);
432
+ curl_setopt($ch, CURLOPT_NOBODY, true);
433
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
434
+ curl_setopt($ch, CURLOPT_TIMEOUT, 5);
435
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
436
+ curl_setopt($ch, CURLOPT_VERBOSE, false);
437
+ curl_exec($ch);
438
+ $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
439
+ curl_close($ch);
440
+ return $httpCode >= 200 && $httpCode < 300;
441
+ }
442
+
443
+ /**
444
+ * Log event to Zakeke server
445
+ *
446
+ * @param string $message
447
+ * @return void
448
+ */
449
+ public function log($message)
450
+ {
451
+ }
452
+ }
app/code/community/Futurenext/Zakeke/Model/Api2/Colors.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke Magento REST API for retrieving color product attribute values
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Api2_Colors extends Mage_Api2_Model_Resource
19
+ {
20
+
21
+ }
app/code/community/Futurenext/Zakeke/Model/Api2/Colors/Rest/Admin/V1.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke Magento REST API for retrieving color product attribute values
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Api2_Colors_Rest_Admin_V1 extends Futurenext_Zakeke_Model_Api2_Colors
19
+ {
20
+ /**
21
+ * Retrieve the product colors
22
+ *
23
+ * @return array
24
+ */
25
+ public function _retrieveCollection()
26
+ {
27
+ /** @var Mage_Eav_Model_Resource_Entity_Attribute_Collection $attributeCollection */
28
+ $attributeCollection = Mage::getResourceModel('eav/entity_attribute_collection');
29
+ $attributeInfo = $attributeCollection->setCodeFilter('color')->getFirstItem();
30
+ $attributeId = $attributeInfo->getAttributeId();
31
+ if (is_null($attributeId)) {
32
+ return array();
33
+ }
34
+
35
+ /** @var Mage_Catalog_Model_Resource_Eav_Attribute $attribute */
36
+ $attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
37
+ $attributeOptions = $attribute->getSource()->getAllOptions(false);
38
+ for($i = 0; $i < count($attributeOptions); $i++)
39
+ {
40
+ $attributeOptions[$i]['attribute_id'] = $attributeId;
41
+ }
42
+
43
+ return $attributeOptions;
44
+ }
45
+ }
app/code/community/Futurenext/Zakeke/Model/Api2/ProductAttribute.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke Magento REST API for retrieving an attribute
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Api2_ProductAttribute extends Mage_Api2_Model_Resource
19
+ {
20
+
21
+ }
app/code/community/Futurenext/Zakeke/Model/Api2/ProductAttribute/Rest/Admin/V1.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke Magento REST API for retrieving product options
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Api2_ProductAttribute_Rest_Admin_V1 extends Futurenext_Zakeke_Model_Api2_Colors
19
+ {
20
+ /**
21
+ * Retrieve an attribute
22
+ *
23
+ * @return array
24
+ */
25
+ public function _retrieve()
26
+ {
27
+
28
+ }
29
+ }
app/code/community/Futurenext/Zakeke/Model/Api2/ProductOptions.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke Magento REST API for retrieving product options
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Api2_ProductOptions extends Mage_Api2_Model_Resource
19
+ {
20
+
21
+ }
app/code/community/Futurenext/Zakeke/Model/Api2/ProductOptions/Rest/Admin/V1.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke Magento REST API for retrieving product options
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Api2_ProductOptions_Rest_Admin_V1 extends Futurenext_Zakeke_Model_Api2_Colors
19
+ {
20
+ /**
21
+ * Retrieve the product options
22
+ *
23
+ * @return array
24
+ */
25
+ public function _retrieveCollection()
26
+ {
27
+ $res = array();
28
+
29
+ $sku = $this->getRequest()->getParam('sku');
30
+
31
+ /** @var Mage_Catalog_Model_Product $product */
32
+ $product = Mage::getModel('catalog/product');
33
+ $product->load($product->getIdBySku($sku));
34
+
35
+ if (is_null($product->getId())) {
36
+ $this->_critical(
37
+ sprintf('Cannot find a product with such Sku: %s', $sku),
38
+ 404);
39
+ }
40
+
41
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
42
+ $productAttributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
43
+
44
+ foreach ($productAttributes as $configurableAttribute) {
45
+ $attribute = $configurableAttribute->getProductAttribute();
46
+ $values = null;
47
+ if (!is_null($attribute->getSource())) {
48
+ $values = $attribute->getSource()->getAllOptions(false);
49
+ }
50
+
51
+ $res[] = array(
52
+ 'attribute_id' => $attribute->getAttributeId(),
53
+ 'label' => $attribute->getFrontendLabel(),
54
+ 'values' => $values,
55
+ 'custom_option' => false
56
+ );
57
+ }
58
+ }
59
+
60
+ $productCustomOptions = $product->getOptions();
61
+ foreach ($productCustomOptions as $customOption) {
62
+ $values = array();
63
+ foreach ($customOption->getValues() as $value) {
64
+ $values[] = array(
65
+ 'value' => $value->getOptionTypeId(),
66
+ 'label' => $value->getTitle()
67
+ );
68
+ }
69
+ $res[] = array(
70
+ 'attribute_id' => $customOption->getOptionId(),
71
+ 'label' => $customOption->getTitle(),
72
+ 'values' => $values,
73
+ 'custom_option' => true
74
+ );
75
+ }
76
+
77
+ return $res;
78
+ }
79
+ }
app/code/community/Futurenext/Zakeke/Model/Api2/Settings.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke Magento REST API for retrieving a subset of the store settings
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Api2_Settings extends Mage_Api2_Model_Resource
19
+ {
20
+
21
+ }
app/code/community/Futurenext/Zakeke/Model/Api2/Settings/Rest/Admin/V1.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke Magento REST API for retrieving a subset of the store settings
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Api2_Settings_Rest_Admin_V1 extends Futurenext_Zakeke_Model_Api2_Settings
19
+ {
20
+ /**
21
+ * Retrieve a subset of the store settings
22
+ *
23
+ * @return array
24
+ */
25
+ public function _retrieve() {
26
+ $data = array();
27
+ $data['locale'] = Mage::app()->getLocale()->getLocaleCode();
28
+ $data['base_currency_code'] = Mage::app()->getStore()->getBaseCurrencyCode();
29
+ $data['media_url'] = Mage::getBaseUrl('media');
30
+ return $data;
31
+ }
32
+ }
app/code/community/Futurenext/Zakeke/Model/Api2/ZakekeEnabled.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke Magento REST API for setting a product as a customizable
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Api2_ZakekeEnabled extends Mage_Api2_Model_Resource
19
+ {
20
+
21
+ }
app/code/community/Futurenext/Zakeke/Model/Api2/ZakekeEnabled/Rest/Admin/V1.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke Magento REST API for setting a product as a customizable
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Api2_ZakekeEnabled_Rest_Admin_V1 extends Futurenext_Zakeke_Model_Api2_ZakekeEnabled
19
+ {
20
+ const SKU_PARAM_NOT_FOUND = 'Could not get sku from the request data.';
21
+
22
+ /**
23
+ * Clean the frontend cache
24
+ *
25
+ * @return void
26
+ */
27
+ protected function cleanCache()
28
+ {
29
+ Mage::app()->getCacheInstance()->cleanType('full_page');
30
+ Mage::dispatchEvent(
31
+ 'adminhtml_cache_refresh_type',
32
+ array('type' => 'full_page')
33
+ );
34
+ Mage::app()->getCacheInstance()->cleanType(Mage_Core_Block_Abstract::CACHE_GROUP);
35
+ Mage::dispatchEvent(
36
+ 'adminhtml_cache_refresh_type',
37
+ array('type' => Mage_Core_Block_Abstract::CACHE_GROUP)
38
+ );
39
+ }
40
+
41
+ /**
42
+ * List of customizable products
43
+ *
44
+ * @return array
45
+ */
46
+ public function _retrieveCollection()
47
+ {
48
+ /** @var Futurenext_Zakeke_Model_Resource_ZakekeEnabled_Collection $collection */
49
+ $collection = Mage::getModel('futurenext_zakeke/zakekeEnabled')->getCollection();
50
+ $enabled = $collection->load();
51
+ $res = array();
52
+ /** @var Futurenext_Zakeke_Model_ZakekeEnabled $item */
53
+ foreach ($enabled->getItems() as $item) {
54
+ $res[] = $item->toArray();
55
+ }
56
+
57
+ return $res;
58
+ }
59
+
60
+ /**
61
+ * Enable a product for Zakeke
62
+ *
63
+ * @param array $data
64
+ * @return string
65
+ */
66
+ public function _create(array $data)
67
+ {
68
+ if (!isset($data['sku'])) {
69
+ $this->_critical(self::SKU_PARAM_NOT_FOUND);
70
+ }
71
+ $sku = $data['sku'];
72
+
73
+ /** @var Futurenext_Zakeke_Model_ZakekeEnabled $zakekeEnabled */
74
+ $zakekeEnabled = Mage::getModel('futurenext_zakeke/zakekeEnabled');
75
+ $zakekeEnabledId = $zakekeEnabled->getIdFromSku($sku);
76
+ if ($zakekeEnabledId) {
77
+ Mage::log(
78
+ 'ZakekeEnabled Rest _create: an entity already exist for the Sku ' . $sku . ' with id ' . $zakekeEnabledId
79
+ );
80
+ return '';
81
+ }
82
+ $zakekeEnabled->setSku($sku);
83
+
84
+ try {
85
+ $zakekeEnabled->save();
86
+ $this->cleanCache();
87
+ } catch (Mage_Core_Exception $e) {
88
+ Mage::logException($e);
89
+ $this->_critical($e->getMessage(), Mage_Api2_Model_Server::HTTP_INTERNAL_ERROR);
90
+ } catch (Exception $e) {
91
+ Mage::logException($e);
92
+ $this->_critical(self::RESOURCE_UNKNOWN_ERROR);
93
+ }
94
+
95
+ return '';
96
+ }
97
+
98
+ /**
99
+ * Set a SKU as not longer customizable by Zakeke
100
+ *
101
+ * @return void
102
+ */
103
+ public function _delete()
104
+ {
105
+ /** @var string $sku */
106
+ $sku = $this->getRequest()->getParam('sku');
107
+ if (!$sku) {
108
+ $this->_critical(self::SKU_PARAM_NOT_FOUND);
109
+ }
110
+
111
+ $this->cleanCache();
112
+
113
+ /** @var Futurenext_Zakeke_Model_ZakekeEnabled $zakekeEnabled */
114
+ $zakekeEnabled = Mage::getModel('futurenext_zakeke/zakekeEnabled');
115
+ $zakekeEnabledId = $zakekeEnabled->getIdFromSku($sku);
116
+ if (!$zakekeEnabledId) {
117
+ Mage::log('ZakekeEnabled Rest _delete: could not get the entity from the Sku ' . $sku);
118
+ return;
119
+ }
120
+
121
+ try {
122
+ $zakekeEnabled->load($zakekeEnabledId);
123
+ $zakekeEnabled->delete();
124
+ } catch (Mage_Core_Exception $e) {
125
+ $this->_critical($e->getMessage(), Mage_Api2_Model_Server::HTTP_INTERNAL_ERROR);
126
+ } catch (Exception $e) {
127
+ $this->_critical(self::RESOURCE_INTERNAL_ERROR);
128
+ }
129
+ }
130
+ }
app/code/community/Futurenext/Zakeke/Model/ModuleList.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke model for retrieving the installed modules on the store
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_ModuleList extends Varien_Object
19
+ {
20
+ protected $_lists = array();
21
+
22
+ public function gather()
23
+ {
24
+ $config = Mage::getConfig();
25
+ foreach($config->getNode('modules')->children() as $item)
26
+ {
27
+ $o = new Varien_Object();
28
+ $o->setName($item->getName());
29
+ $o->setActive((string)$item->active);
30
+ $o->setCodePool((string)$item->codePool);
31
+
32
+ //use same logic from Mage_Core_Model_Config::getModuleDir
33
+ //but recreated here to allow for poorly configued modules
34
+ $codePool = $config->getModuleConfig($item->getName())->codePool;
35
+ $dir = $config->getOptions()->getCodeDir().DS.$codePool.DS.uc_words($item->getName(),DS);
36
+ $o->setPath($dir);
37
+
38
+ $exists = file_exists($o->getPath());
39
+ $exists = $exists ? 'yes' : 'no';
40
+ $o->setPathExists($exists);
41
+
42
+ $exists = file_exists($o->getPath() . '/etc/config.xml');
43
+ $exists = $exists ? 'yes' : 'no';
44
+ $o->setConfigExists($exists);
45
+ $o->setModuleVersion('?');
46
+ if($exists == 'yes')
47
+ {
48
+ $xml = simplexml_load_file($o->getPath() . '/etc/config.xml');
49
+ $modules = $xml->modules;
50
+ if(!$modules){ continue; }
51
+
52
+ $name = $modules->{$item->getName()};
53
+ if(!$name){ continue; }
54
+
55
+ $version = $name->version;
56
+ if(!$version) {
57
+ $version = '?';
58
+ }
59
+
60
+ $version = (string) $version;
61
+ $o->setModuleVersion($version);
62
+ }
63
+
64
+
65
+ if(!array_key_exists($o->getCodePool(), $this->_lists))
66
+ {
67
+ $this->_lists[$o->getCodePool()] = array();
68
+ }
69
+ $this->_lists[$o->getCodePool()][] = $o;
70
+ }
71
+
72
+ return $this;
73
+ }
74
+
75
+ public function getCoreList()
76
+ {
77
+ return $this->_getList('core');
78
+ }
79
+
80
+ public function getLocalList()
81
+ {
82
+ return $this->_getList('local');
83
+ }
84
+
85
+ public function getCommunityList()
86
+ {
87
+ return $this->_getList('community');
88
+ }
89
+
90
+ public function getList($type = null)
91
+ {
92
+ if ($type) {
93
+ return $this->_lists[$type];
94
+ } else {
95
+ return $this->_lists;
96
+ }
97
+ }
98
+
99
+ public function getUnknownCodePools()
100
+ {
101
+ $known = array('core','local','community');
102
+ $pools = array_keys($this->_lists);
103
+ $final = array();
104
+ foreach($pools as $item)
105
+ {
106
+ if(!in_array($item,$known))
107
+ {
108
+ $final[] = $item;
109
+ }
110
+ }
111
+ return $final;
112
+ }
113
+ }
app/code/community/Futurenext/Zakeke/Model/Observer.php ADDED
@@ -0,0 +1,621 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke Observer
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Observer
19
+ {
20
+ /**
21
+ * Fills and set the zakeke additional options
22
+ *
23
+ * @param Varien_Event_Observer $observer
24
+ * @return $this
25
+ * @throws Exception
26
+ */
27
+ public function productLoadAfterCartAdd($observer)
28
+ {
29
+ try {
30
+ $action = Mage::app()->getFrontController()->getAction();
31
+ if (!$action) {
32
+ return $this;
33
+ }
34
+ $actionName = $action->getFullActionName();
35
+ if ($actionName != 'checkout_cart_add' && $actionName != 'checkout_cart_updateItemOptions') {
36
+ return $this;
37
+ }
38
+
39
+ $request = $action->getRequest();
40
+ $design = $request->getParam(
41
+ Futurenext_Zakeke_Helper_Data::ZAKEKE_DESIGN_PARAM
42
+ );
43
+ $model = $request->getParam(
44
+ Futurenext_Zakeke_Helper_Data::ZAKEKE_MODEL_PARAM
45
+ );
46
+ if (!$design || !$model) {
47
+ return $this;
48
+ }
49
+
50
+ $qty = $request->getParam('qty');
51
+ if ($qty) {
52
+ $filter = new Zend_Filter_LocalizedToNormalized(
53
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
54
+ );
55
+ $qty = $filter->filter($qty);
56
+ }
57
+
58
+ /** @var Mage_Catalog_Model_Product $product */
59
+ $product = $observer->getProduct();
60
+
61
+ $toAddProductId = $request->getParam('product');
62
+ if ($toAddProductId && $toAddProductId != $product->getId()) {
63
+ return $this;
64
+ }
65
+
66
+ /** @var Futurenext_Zakeke_Helper_Data $zakekeHelper */
67
+ $zakekeHelper = Mage::helper('futurenext_zakeke');
68
+
69
+ if (!$zakekeHelper->isProductCustomizable($product)) {
70
+ Mage::log(
71
+ 'Zakeke tried order ' . $product->getSku() . ' with model ' . $model . ' but is not customizable'
72
+ );
73
+ return $this;
74
+ }
75
+
76
+ $additionalOptions = array();
77
+ $additionalOption = $product->getCustomOption('additional_options');
78
+ if ($additionalOption) {
79
+ $additionalOptions = (array)unserialize($additionalOption->getValue());
80
+ }
81
+
82
+ foreach ($additionalOptions as $additionalOption) {
83
+ if (isset($additionalOption['is_zakeke'])) {
84
+ return $this;
85
+ }
86
+ }
87
+
88
+ $registryKey = Futurenext_Zakeke_Helper_Data::ZAKEKE_CART_INFO_REGISTRY . $toAddProductId;
89
+ $zakekeCartData = Mage::registry($registryKey);
90
+ if (is_null($zakekeCartData)) {
91
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
92
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
93
+ $zakekeCartData = $zakekeApi->getCartInfo($design);
94
+ Mage::register($registryKey, $zakekeCartData);
95
+ }
96
+
97
+ /** @var Mage_Core_Helper_Data $coreHelper */
98
+ $coreHelper = Mage::helper('core');
99
+
100
+ $originalFinalPrice = $product->getFinalPrice($qty);
101
+
102
+ $zakekePrice = 0.0;
103
+ if ($zakekeCartData->pricing->modelPriceDeltaPerc) {
104
+ $zakekePrice += $originalFinalPrice * ($zakekeCartData->pricing->modelPriceDeltaPerc / 100);
105
+ } else {
106
+ $zakekePrice += (float)$zakekeCartData->pricing->modelPriceDeltaValue;
107
+ }
108
+ $zakekePrice += (float)$zakekeCartData->pricing->designPrice;
109
+
110
+ $zakekeOption = array(
111
+ 'label' => $coreHelper->__('Customization'),
112
+ 'value' => $zakekeHelper->htmlView($zakekeCartData->previews),
113
+ 'print_value' => '#' . $design,
114
+ 'custom_view' => true,
115
+ 'design' => $design,
116
+ 'model' => $model,
117
+ 'previews' => $zakekeCartData->previews,
118
+ 'pricing' => $zakekeCartData->pricing,
119
+ 'price' => $zakekePrice,
120
+ 'original_final_price' => $originalFinalPrice,
121
+ 'is_zakeke' => true
122
+ );
123
+
124
+ $additionalOptions[] = $zakekeOption;
125
+
126
+ if ($zakekePrice) {
127
+ $zakekeFinalPrice = $coreHelper->currency($zakekePrice, true, false);
128
+ $zakekePricingOption = [
129
+ 'label' => $coreHelper->__('Customization Price'),
130
+ 'value' => $zakekeFinalPrice
131
+ ];
132
+ $additionalOptions[] = $zakekePricingOption;
133
+ }
134
+
135
+ $product->addCustomOption('additional_options', serialize($additionalOptions));
136
+ } catch (Exception $e) {
137
+ Mage::logException($e);
138
+ throw $e;
139
+ }
140
+ return $this;
141
+ }
142
+
143
+ /**
144
+ * Reorder a customized product.
145
+ *
146
+ * @param Varien_Event_Observer $observer
147
+ * @return $this
148
+ * @throws Exception
149
+ */
150
+ public function reorder($observer)
151
+ {
152
+ try {
153
+ $action = Mage::app()->getFrontController()->getAction();
154
+ if ($action === null) {
155
+ return $this;
156
+ }
157
+ $actionName = $action->getFullActionName();
158
+ if ($actionName != 'sales_order_reorder') {
159
+ return $this;
160
+ }
161
+
162
+ /** @var Mage_Sales_Model_Quote_Item $item */
163
+ $item = $observer->getQuoteItem();
164
+ $buyInfo = $item->getBuyRequest();
165
+
166
+ if (!isset($buyInfo[Futurenext_Zakeke_Helper_Data::ZAKEKE_DESIGN_PARAM])) {
167
+ return $this;
168
+ }
169
+
170
+ if (!isset($buyInfo[Futurenext_Zakeke_Helper_Data::ZAKEKE_MODEL_PARAM])) {
171
+ return $this;
172
+ }
173
+
174
+ /** @var Futurenext_Zakeke_Helper_Data $zakekeHelper */
175
+ $zakekeHelper = Mage::helper('futurenext_zakeke');
176
+
177
+ $product = $item->getProduct();
178
+ if (!$zakekeHelper->isProductCustomizable($item->getProduct())) {
179
+ return $this;
180
+ }
181
+
182
+ $qty = $action->getRequest()->getParam('qty');
183
+ if ($qty !== null) {
184
+ $filter = new Zend_Filter_LocalizedToNormalized(
185
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
186
+ );
187
+ $qty = $filter->filter($qty);
188
+ }
189
+
190
+ $design = $buyInfo[Futurenext_Zakeke_Helper_Data::ZAKEKE_DESIGN_PARAM];
191
+ $model = $buyInfo[Futurenext_Zakeke_Helper_Data::ZAKEKE_MODEL_PARAM];
192
+
193
+ $additionalOptions = array();
194
+ $additionalOption = $item->getOptionByCode('additional_options');
195
+ if ($additionalOption !== null) {
196
+ $additionalOptions = (array)unserialize($additionalOption->getValue());
197
+ }
198
+
199
+ /** @var Mage_Core_Helper_Data $coreHelper */
200
+ $coreHelper = Mage::helper('core');
201
+
202
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
203
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
204
+ $zakekeCartData = $zakekeApi->getCartInfo($design);
205
+
206
+ $originalFinalPrice = $product->getFinalPrice($qty);
207
+
208
+ $zakekePrice = 0.0;
209
+ if ($zakekeCartData->pricing->modelPriceDeltaPerc) {
210
+ $zakekePrice += $originalFinalPrice * ($zakekeCartData->pricing->modelPriceDeltaPerc / 100);
211
+ } else {
212
+ $zakekePrice += (float)$zakekeCartData->pricing->modelPriceDeltaValue;
213
+ }
214
+ $zakekePrice += (float)$zakekeCartData->pricing->designPrice;
215
+
216
+ $zakekeOption = array(
217
+ 'label' => $coreHelper->__('Customization'),
218
+ 'value' => $zakekeHelper->htmlView($zakekeCartData->previews),
219
+ 'print_value' => '#' . $design,
220
+ 'custom_view' => true,
221
+ 'design' => $design,
222
+ 'model' => $model,
223
+ 'previews' => $zakekeCartData->previews,
224
+ 'pricing' => $zakekeCartData->pricing,
225
+ 'price' => $zakekePrice,
226
+ 'original_final_price' => $originalFinalPrice,
227
+ 'is_zakeke' => true
228
+ );
229
+ $additionalOptions[] = $zakekeOption;
230
+
231
+ $simpleProductOption = $item->getOptionByCode('simple_product');
232
+ if ($simpleProductOption !== null) {
233
+ $product = $simpleProductOption->getProduct();
234
+ }
235
+
236
+ if ($zakekePrice) {
237
+ $zakekeFinalPrice = $coreHelper->currency($zakekePrice);
238
+
239
+ $zakekePricingOption = [
240
+ 'label' => $coreHelper->__('Customization Price'),
241
+ 'value' => $zakekeFinalPrice
242
+ ];
243
+ $additionalOptions[] = $zakekePricingOption;
244
+ }
245
+
246
+ $item->addOption(array(
247
+ 'code' => 'product_type',
248
+ 'value' => 'zakeke',
249
+ 'product' => $item->getProduct(),
250
+ 'product_id' => $item->getProduct()->getId()
251
+ ));
252
+
253
+ $item->addOption(array(
254
+ 'code' => 'additional_options',
255
+ 'value' => serialize($additionalOptions),
256
+ 'product' => $item->getProduct(),
257
+ 'product_id' => $item->getProduct()->getId()
258
+ ));
259
+ } catch (Exception $e) {
260
+ Mage::logException($e);
261
+ throw $e;
262
+ }
263
+ return $this;
264
+ }
265
+
266
+ /**
267
+ * Adds additiona_options when converting a quote item to an order item
268
+ *
269
+ * @param Varien_Event_Observer $observer
270
+ * @return $this
271
+ * @throws Exception
272
+ */
273
+ public function salesConvertQuoteItemToOrderItem(Varien_Event_Observer $observer)
274
+ {
275
+ try {
276
+ /** @var Mage_Sales_Model_Quote_Item $quoteItem */
277
+ $quoteItem = $observer->getItem();
278
+ $additionalOptionsOption = $quoteItem->getOptionByCode('additional_options');
279
+ if ($additionalOptionsOption) {
280
+ $additionalOptions = (array)unserialize($additionalOptionsOption->getValue());
281
+
282
+ /** @var Mage_Sales_Model_Order_Item $orderItem */
283
+ $orderItem = $observer->getOrderItem();
284
+ $options = $orderItem->getProductOptions();
285
+ $options['additional_options'] = $additionalOptions;
286
+ $orderItem->setProductOptions($options);
287
+ }
288
+ } catch (Exception $e) {
289
+ Mage::logException($e);
290
+ throw $e;
291
+ }
292
+ return $this;
293
+ }
294
+
295
+ /**
296
+ * Set the zakeke product type
297
+ *
298
+ * @param Varien_Event_Observer $observer
299
+ * @return $this
300
+ * @throws Exception
301
+ */
302
+ public function cartAdd($observer)
303
+ {
304
+ try {
305
+ /** @var Mage_Catalog_Model_Product $product */
306
+ $product = $observer->getProduct();
307
+
308
+ $found = false;
309
+ $zakekePrice = 0.0;
310
+
311
+ $action = Mage::app()->getFrontController()->getAction();
312
+ $request = $action->getRequest();
313
+ $qty = $request->getParam('qty');
314
+ if (isset($qty)) {
315
+ $filter = new Zend_Filter_LocalizedToNormalized(
316
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
317
+ );
318
+ $qty = $filter->filter($qty);
319
+ }
320
+
321
+ /** @var Mage_Catalog_Model_Product_Option $additionalOption */
322
+ $additionalOption = $product->getCustomOption('additional_options');
323
+ if ($additionalOption) {
324
+ $additionalOptions = (array)unserialize($additionalOption->getValue());
325
+ foreach ($additionalOptions as $option) {
326
+ if (isset($option['is_zakeke'])) {
327
+ $found = true;
328
+
329
+ if (isset($option['pricing'])) {
330
+ $pricing = $option['pricing'];
331
+ if ($pricing->modelPriceDeltaPerc) {
332
+ $zakekePrice += $product->getFinalPrice($qty) * ($pricing->modelPriceDeltaPerc / 100);
333
+ } else {
334
+ $zakekePrice += (float)$pricing->modelPriceDeltaValue;
335
+ }
336
+
337
+ $zakekePrice += (float)$pricing->designPrice;
338
+ }
339
+ break;
340
+ }
341
+ }
342
+ }
343
+
344
+ if (!$found) {
345
+ return $this;
346
+ }
347
+
348
+ /** @var Mage_Sales_Model_Quote_Item $quoteItem */
349
+ $quoteItem = $observer->getQuoteItem();
350
+ /** @var Mage_Sales_Model_Quote_Item_Option $option */
351
+ $option = Mage::getModel('sales/quote_item_option');
352
+ $option->setProductId($product->getId())
353
+ ->setCode('product_type')
354
+ ->setProduct($product)
355
+ ->setValue(Futurenext_Zakeke_Helper_Data::ZAKEKE_PRODUCT_TYPE);
356
+ $quoteItem->addOption($option);
357
+
358
+ /** @var Mage_Directory_Helper_Data $directoryHelper */
359
+ $directoryHelper = Mage::helper('directory');
360
+ $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
361
+ $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
362
+
363
+ $baseFinalPrice = $product->getFinalPrice($quoteItem->getQty()) + $zakekePrice;
364
+ $finalPrice = $directoryHelper->currencyConvert($baseFinalPrice, $baseCurrencyCode, $currentCurrencyCode);
365
+
366
+ $quoteItem->setCustomPrice($finalPrice);
367
+ $quoteItem->setOriginalCustomPrice($finalPrice);
368
+ $product->setIsSuperMode(true);
369
+ } catch (Exception $e) {
370
+ Mage::logException($e);
371
+ throw $e;
372
+ }
373
+ return $this;
374
+ }
375
+
376
+ /**
377
+ * Notify Zakeke that an order containing some Zakeke customized product is begin placed
378
+ *
379
+ * @param Varien_Event_Observer $observer
380
+ * @return $this
381
+ * @throws Exception
382
+ */
383
+ public function orderSave($observer)
384
+ {
385
+ try {
386
+ /** @var Mage_Sales_Model_Order $order */
387
+ $order = $observer->getOrder();
388
+
389
+ if (!$order->isObjectNew()) {
390
+ return $this;
391
+ }
392
+
393
+ $action = Mage::app()->getFrontController()->getAction();
394
+ $request = $action->getRequest();
395
+ $qty = $request->getParam('qty');
396
+ if (isset($qty)) {
397
+ $filter = new Zend_Filter_LocalizedToNormalized(
398
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
399
+ );
400
+ $qty = $filter->filter($qty);
401
+ }
402
+
403
+ /** @var Mage_Customer_Model_Session $session */
404
+ $session = Mage::getSingleton('customer/session');
405
+
406
+ $data = array(
407
+ 'orderCode' => $order->getIncrementId(),
408
+ 'sessionID' => $session->getSessionId(),
409
+ 'total' => $order->getBaseSubtotal(),
410
+ 'orderStatusID' => 1,
411
+ 'details' => array()
412
+ );
413
+
414
+ $guestCode = Mage::app()->getCookie()->get(
415
+ Futurenext_Zakeke_Helper_Data::GUEST_COOKIE
416
+ );
417
+ if (!$order->getCustomerIsGuest()) {
418
+ $data['customerID'] = $order->getCustomerId();
419
+ } elseif ($guestCode) {
420
+ $data['visitorID'] = $guestCode;
421
+ }
422
+
423
+ /** @var Mage_Tax_Helper_Data $taxHelper */
424
+ $taxHelper = Mage::helper('tax');
425
+
426
+ $items = $order->getAllVisibleItems();
427
+ /** @var Mage_Sales_Model_Order_Item $item */
428
+ foreach ($items as $item) {
429
+ if ($item->getParentItem()) {
430
+ continue;
431
+ }
432
+
433
+ $productOptions = $item->getProductOptions();
434
+
435
+ if (!isset($productOptions['additional_options'])) {
436
+ continue;
437
+ }
438
+
439
+ $additionalOptions = $productOptions['additional_options'];
440
+ foreach ($additionalOptions as $option) {
441
+ if (!isset($option['is_zakeke'])) {
442
+ continue;
443
+ }
444
+
445
+ $zakekePrice = 0.0;
446
+ if (isset($option['price'])) {
447
+ $zakekePrice = $option['price'];
448
+ }
449
+ $zakekeTaxPrice = $taxHelper->getPrice(
450
+ $item->getProduct(),
451
+ $zakekePrice,
452
+ false,
453
+ null,
454
+ null,
455
+ null,
456
+ null,
457
+ null,
458
+ false
459
+ );
460
+
461
+ $originalFinalPrice = 0.0;
462
+ if (isset($option['original_final_price'])) {
463
+ $originalFinalPrice = $option['original_final_price'];
464
+ }
465
+ $originalFinalTaxPrice = $taxHelper->getPrice(
466
+ $item->getProduct(),
467
+ $originalFinalPrice,
468
+ false,
469
+ null,
470
+ null,
471
+ null,
472
+ null,
473
+ null,
474
+ false
475
+ );
476
+
477
+ $itemData = array(
478
+ 'designDocID' => $option['design'],
479
+ 'orderDetailCode' => $item->getQuoteItemId(),
480
+ 'quantity' => $item->getQtyOrdered(),
481
+ 'designUnitPrice' => $zakekeTaxPrice,
482
+ 'modelUnitPrice' => $originalFinalTaxPrice
483
+ );
484
+
485
+ $data['details'][] = $itemData;
486
+ break;
487
+ }
488
+ }
489
+
490
+ if (count($data['details']) > 0) {
491
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
492
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
493
+ $zakekeApi->placeOrder($data);
494
+ }
495
+ } catch (Exception $e) {
496
+ Mage::logException($e);
497
+ throw $e;
498
+ }
499
+ return $this;
500
+ }
501
+
502
+ /**
503
+ * Notify Zakeke that an order containing some Zakeke customized product is begin cancelled
504
+ *
505
+ * @param Varien_Event_Observer $observer
506
+ * @return $this
507
+ * @throws Exception
508
+ */
509
+ public function orderCancel($observer)
510
+ {
511
+ try {
512
+ /** @var Mage_Sales_Model_Order $order */
513
+ $order = $observer->getOrder();
514
+
515
+ if ($order->getStatus() != 'canceled') {
516
+ return $this;
517
+ }
518
+
519
+ /** @var Mage_Sales_Model_Order_Item $item */
520
+ foreach ($order->getAllVisibleItems() as $item) {
521
+ if ($item->getProductType() == Futurenext_Zakeke_Helper_Data::ZAKEKE_PRODUCT_TYPE) {
522
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
523
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
524
+ $zakekeApi->cancelOrder($order->getId());
525
+ return $this;
526
+ }
527
+ }
528
+ } catch (Exception $e) {
529
+ Mage::logException($e);
530
+ throw $e;
531
+ }
532
+ return $this;
533
+ }
534
+
535
+ /**
536
+ * Notify Zakeke if a guest is also a Zakeke user that now she is registered
537
+ *
538
+ * @param Varien_Event_Observer $observer
539
+ * @return $this
540
+ * @throws Exception
541
+ */
542
+ public function customerRegister($observer)
543
+ {
544
+ try {
545
+ $guestCode = Mage::app()->getCookie()->get(
546
+ Futurenext_Zakeke_Helper_Data::GUEST_COOKIE
547
+ );
548
+ if (!$guestCode) {
549
+ return $this;
550
+ }
551
+
552
+ /** @var Mage_Customer_Model_Customer $customer */
553
+ $customer = $observer->getCustomer();
554
+
555
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
556
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
557
+ $zakekeApi->associateGuest($guestCode, $customer->getId());
558
+ } catch (Exception $e) {
559
+ Mage::logException($e);
560
+ throw $e;
561
+ }
562
+ return $this;
563
+ }
564
+
565
+ /**
566
+ * Notify if a Zakeke guest login with an account on the store
567
+ *
568
+ * @param Varien_Event_Observer $observer
569
+ * @return $this
570
+ * @throws Exception
571
+ */
572
+ public function customerLogin($observer)
573
+ {
574
+ try {
575
+ $guestCode = Mage::app()->getCookie()->get(
576
+ Futurenext_Zakeke_Helper_Data::GUEST_COOKIE
577
+ );
578
+ if (!$guestCode) {
579
+ return $this;
580
+ }
581
+
582
+ /** @var Mage_Customer_Model_Customer $customer */
583
+ $customer = $observer->getCustomer();
584
+
585
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
586
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
587
+ $zakekeApi->associateGuest($guestCode, $customer->getId());
588
+ } catch (Exception $e) {
589
+ Mage::logException($e);
590
+ throw $e;
591
+ }
592
+ return $this;
593
+ }
594
+
595
+ /**
596
+ * Remove the Zakeke guest cookie on logout
597
+ *
598
+ * @param Varien_Event_Observer $observer
599
+ * @return $this
600
+ * @throws Exception
601
+ */
602
+ public function customerLogout($observer)
603
+ {
604
+ try {
605
+ $guestCode = Mage::app()->getCookie()->get(
606
+ Futurenext_Zakeke_Helper_Data::GUEST_COOKIE
607
+ );
608
+ if (!$guestCode) {
609
+ return $this;
610
+ }
611
+
612
+ Mage::app()->getCookie()->delete(
613
+ Futurenext_Zakeke_Helper_Data::GUEST_COOKIE
614
+ );
615
+ } catch (Exception $e) {
616
+ Mage::logException($e);
617
+ throw $e;
618
+ }
619
+ return $this;
620
+ }
621
+ }
app/code/community/Futurenext/Zakeke/Model/Resource/Setup.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke setup
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
19
+ {
20
+ }
app/code/community/Futurenext/Zakeke/Model/Resource/ZakekeEnabled.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke ZakekeEnabled resource
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Resource_ZakekeEnabled extends Mage_Core_Model_Resource_Db_Abstract
19
+ {
20
+ protected function _construct()
21
+ {
22
+ $this->_init('futurenext_zakeke/zakekeEnabled', 'entity_id');
23
+ }
24
+
25
+ /**
26
+ * Get ZakekeEnabled identifier from SKU.
27
+ *
28
+ * @param string $sku
29
+ * @return string
30
+ */
31
+ public function getIdFromSku($sku)
32
+ {
33
+ $connection = $this->_getConnection('read');
34
+ $select = $connection->select()->from($this->getMainTable(), 'entity_id')->where('sku = :sku');
35
+ $bind = array(':sku' => (string) $sku);
36
+ return $connection->fetchOne($select, $bind);
37
+ }
38
+ }
app/code/community/Futurenext/Zakeke/Model/Resource/ZakekeEnabled/Collection.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke ZakekeEnabled collection
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Model_Resource_ZakekeEnabled_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
19
+ {
20
+ public function _construct()
21
+ {
22
+ $this->_init('futurenext_zakeke/zakekeEnabled');
23
+ }
24
+ }
app/code/community/Futurenext/Zakeke/Model/ZakekeEnabled.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke model for keeping track of customizable products
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ *
18
+ * @method $this setSku(string $sku)
19
+ */
20
+ class Futurenext_Zakeke_Model_ZakekeEnabled extends Mage_Core_Model_Abstract
21
+ {
22
+ protected $_eventPrefix = 'futurenext_zakeke_zakekeEnabled';
23
+ protected $_eventObject = 'zakekeEnabled';
24
+
25
+ protected function _construct()
26
+ {
27
+ $this->_init('futurenext_zakeke/zakekeEnabled');
28
+ }
29
+
30
+ /**
31
+ * Get ZakekeEnabled identifier from SKU.
32
+ *
33
+ * @param string $sku
34
+ * @return string
35
+ */
36
+ public function getIdFromSku($sku)
37
+ {
38
+ /** @var Futurenext_Zakeke_Model_Resource_ZakekeEnabled $resource */
39
+ $resource = $this->getResource();
40
+ return $resource->getIdFromSku($sku);
41
+ }
42
+ }
app/code/community/Futurenext/Zakeke/controllers/CustomizeController.php ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke controller for customizations
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ *
18
+ * @method $this setSku(string $sku)
19
+ */
20
+ class Futurenext_Zakeke_CustomizeController extends Mage_Core_Controller_Front_Action
21
+ {
22
+ /**
23
+ * Ten years
24
+ */
25
+ const COOKIE_PERIOD = 315360000;
26
+
27
+ const NOT_FOUND_MESSAGE = 'Failed to get a product from given parameters.';
28
+
29
+ /**
30
+ * Initialize product instance from add to cart form data
31
+ *
32
+ * @return Mage_Catalog_Model_Product|false
33
+ */
34
+ protected function _initProduct()
35
+ {
36
+ $productId = (int)$this->getRequest()->getParam('product');
37
+ if (!$productId) {
38
+ return false;
39
+ }
40
+
41
+ $storeId = Mage::app()->getStore()->getId();
42
+
43
+ /** @var Mage_Catalog_Helper_Product $productHelper */
44
+ $productHelper = Mage::helper('catalog/product');
45
+ $product = $productHelper->getProduct($productId, $storeId);
46
+ $buyRequest = new Varien_Object();
47
+ $buyRequest->setData($this->getRequest()->getParams());
48
+
49
+ /*
50
+ * Setup necessary for custom options
51
+ */
52
+ try {
53
+ $products = $product->getTypeInstance(true)->prepareForCart($buyRequest, $product);
54
+ if (is_string($products)) {
55
+ return false;
56
+ }
57
+ } catch (Exception $e) {
58
+ return false;
59
+ }
60
+
61
+ return $product;
62
+ }
63
+
64
+ /**
65
+ * Set back redirect url to response
66
+ *
67
+ * @return $this
68
+ * @throws Mage_Exception
69
+ */
70
+ protected function _goBack()
71
+ {
72
+ $returnUrl = $this->getRequest()->getParam('return_url');
73
+ if ($returnUrl) {
74
+ if (!$this->_isUrlInternal($returnUrl)) {
75
+ throw new Mage_Exception('External urls redirect to "' . $returnUrl . '" denied!');
76
+ }
77
+
78
+ /** @var Mage_Checkout_Model_Session $session */
79
+ $session = Mage::getSingleton('checkout/session');
80
+ $session->getMessages(true);
81
+ $this->getResponse()->setRedirect($returnUrl);
82
+ } elseif ($backUrl = $this->_getRefererUrl()) {
83
+ $this->getResponse()->setRedirect($backUrl);
84
+ } else {
85
+ $this->_redirect('/');
86
+ }
87
+ return $this;
88
+ }
89
+
90
+ /**
91
+ * Ajax action that return pricing of a customization in json
92
+ *
93
+ * @throws Exception
94
+ */
95
+ public function priceAction()
96
+ {
97
+ $this->getResponse()->setHeader('Content-type', 'application/json');
98
+
99
+ try {
100
+ $product = $this->_initProduct();
101
+
102
+ /**
103
+ * Check product availability
104
+ */
105
+ if (!$product) {
106
+ Mage::log('Zakeke CustomizeController: ' . self::NOT_FOUND_MESSAGE);
107
+ $this->getResponse()->setHeader('HTTP/1.1', '404', true);
108
+ $data = array('error' => self::NOT_FOUND_MESSAGE);
109
+ $this->getResponse()->setBody(json_encode($data));
110
+ return;
111
+ }
112
+
113
+ $qty = $this->getRequest()->getParam('qty');
114
+ if (isset($qty)) {
115
+ $filter = new Zend_Filter_LocalizedToNormalized(
116
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
117
+ );
118
+ $qty = $filter->filter($qty);
119
+ }
120
+
121
+ $baseFinalPrice = $product->getFinalPrice($qty);
122
+ $baseZakekePrice = (float) $this->getRequest()->getParam('zakeke-price', 0.0);
123
+ $zakekePercentPrice = (float) $this->getRequest()->getParam('zakeke-percent-price', 0.0);
124
+ $baseZakekeFinalPrice = $baseZakekePrice;
125
+
126
+ if ($zakekePercentPrice) {
127
+ $baseZakekeFinalPrice += $baseFinalPrice*($zakekePercentPrice/100);
128
+ }
129
+
130
+ /** @var Mage_Tax_Helper_Data $taxHelper */
131
+ $taxHelper = Mage::helper('tax');
132
+ if ($taxHelper->displayPriceIncludingTax()) {
133
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
134
+ $zakekeFinalPrice = $taxHelper->getPrice(
135
+ $product,
136
+ $baseZakekeFinalPrice,
137
+ true,
138
+ null,
139
+ null,
140
+ null,
141
+ null,
142
+ null,
143
+ false
144
+ );
145
+ $finalPrice = $taxHelper->getPrice(
146
+ $product,
147
+ $baseFinalPrice,
148
+ true,
149
+ null,
150
+ null,
151
+ null,
152
+ null,
153
+ null,
154
+ false
155
+ );
156
+ } else {
157
+ $zakekeFinalPrice = $taxHelper->getPrice($product, $baseZakekeFinalPrice, true);
158
+ $finalPrice = $taxHelper->getPrice($product, $baseFinalPrice, true);
159
+ }
160
+ } else {
161
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
162
+ $zakekeFinalPrice = $taxHelper->getPrice(
163
+ $product,
164
+ $baseZakekeFinalPrice,
165
+ false,
166
+ null,
167
+ null,
168
+ null,
169
+ null,
170
+ null,
171
+ false
172
+ );
173
+ $finalPrice = $taxHelper->getPrice(
174
+ $product,
175
+ $baseFinalPrice,
176
+ false,
177
+ null,
178
+ null,
179
+ null,
180
+ null,
181
+ null,
182
+ false
183
+ );
184
+ } else {
185
+ $zakekeFinalPrice = $taxHelper->getPrice($product, $baseZakekeFinalPrice);
186
+ $finalPrice = $taxHelper->getPrice($product, $baseFinalPrice);
187
+ }
188
+ }
189
+
190
+ $unitFinalPrice = $finalPrice + $zakekeFinalPrice;
191
+
192
+ /** @var Mage_Core_Helper_Data $coreHelper */
193
+ $coreHelper = Mage::helper('core');
194
+
195
+ $data = array(
196
+ 'finalPrice' => $coreHelper->currency($unitFinalPrice, false, false),
197
+ );
198
+ $this->getResponse()->setBody(json_encode($data));
199
+ } catch (Exception $e) {
200
+ Mage::logException($e);
201
+ throw $e;
202
+ }
203
+ }
204
+
205
+ /**
206
+ * Show the Zakeke interface when doing a new personalization
207
+ */
208
+ public function addAction()
209
+ {
210
+ /** @var Mage_Customer_Model_Session $session */
211
+ $session = Mage::getSingleton('customer/session');
212
+
213
+ try {
214
+ $data = array();
215
+
216
+ if (!$session->isLoggedIn()) {
217
+ $guestCode = Mage::app()->getCookie()->get(
218
+ Futurenext_Zakeke_Helper_Data::GUEST_COOKIE
219
+ );
220
+ if (!$guestCode) {
221
+ /** @var Mage_Core_Helper_Data $coreHelper */
222
+ $coreHelper = Mage::helper('core');
223
+ $guestCode = $coreHelper->getRandomString(32);
224
+ Mage::app()->getCookie()->set(
225
+ Futurenext_Zakeke_Helper_Data::GUEST_COOKIE,
226
+ $guestCode,
227
+ self::COOKIE_PERIOD
228
+ );
229
+ }
230
+ $data['vc'] = $guestCode;
231
+ } else {
232
+ $data['cc'] = $session->getCustomerId();
233
+ }
234
+
235
+ $qty = $this->getRequest()->getParam('qty');
236
+ if (isset($qty)) {
237
+ $filter = new Zend_Filter_LocalizedToNormalized(
238
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
239
+ );
240
+ $this->getRequest()->setParam('qty', $filter->filter($qty));
241
+ }
242
+
243
+ $product = $this->_initProduct();
244
+
245
+ /**
246
+ * Check product availability
247
+ */
248
+ if (!$product) {
249
+ throw new Exception($this->__('Can\'t retrieve request product'));
250
+ }
251
+
252
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
253
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
254
+ $token = $zakekeApi->getToken($data);
255
+ if (!$token) {
256
+ throw new Exception($this->__('Failed to get the Zakeke authentication token.'));
257
+ }
258
+
259
+ // Register current data
260
+ Mage::register('current_product', $product);
261
+ Mage::register('product', $product);
262
+ Mage::register(
263
+ Futurenext_Zakeke_Helper_Data::ZAKEKE_REGISTRY_TOKEN,
264
+ $token
265
+ );
266
+
267
+ $this->loadLayout();
268
+ $title = $product->getName() . ' ' . $this->__('customization');
269
+ $this->getLayout()->getBlock('head')->setTitle($title);
270
+ $this->renderLayout();
271
+ } catch (Exception $e) {
272
+ Mage::logException($e);
273
+ $session->addException($e, $e->getMessage());
274
+ $this->_goBack();
275
+ }
276
+ }
277
+
278
+ /**
279
+ * Show the Zakeke interface when configuing a quote item
280
+ */
281
+ public function configureAction()
282
+ {
283
+ /** @var Mage_Customer_Model_Session $session */
284
+ $session = Mage::getSingleton('customer/session');
285
+
286
+ try {
287
+ /** @var Mage_Core_Helper_Http $coreHttpHelper */
288
+ $coreHttpHelper = Mage::helper('core/http');
289
+ $remoteAddr = $coreHttpHelper->getRemoteAddr();
290
+
291
+ $data = array(
292
+ 'ip' => $remoteAddr
293
+ );
294
+
295
+ $guestCode = Mage::app()->getCookie()->get(
296
+ Futurenext_Zakeke_Helper_Data::GUEST_COOKIE
297
+ );
298
+ if ($guestCode) {
299
+ $data['vc'] = $guestCode;
300
+ }
301
+
302
+ if ($session->isLoggedIn()) {
303
+ $data['cc'] = $session->getCustomerId();
304
+ }
305
+
306
+ $qty = $this->getRequest()->getParam('qty');
307
+ if (isset($qty)) {
308
+ $filter = new Zend_Filter_LocalizedToNormalized(
309
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
310
+ );
311
+ $this->getRequest()->setParam('qty', $filter->filter($qty));
312
+ }
313
+
314
+ $product = $this->_initProduct();
315
+
316
+ /**
317
+ * Check product availability
318
+ */
319
+ if (!$product) {
320
+ throw new Exception($this->__('Can\'t retrieve request product'));
321
+ }
322
+
323
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
324
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
325
+ $token = $zakekeApi->getToken($data);
326
+ if (!$token) {
327
+ throw new Exception($this->__('Failed to get the Zakeke authentication token.'));
328
+ }
329
+
330
+ // Register current data
331
+ Mage::register('current_product', $product);
332
+ Mage::register('product', $product);
333
+ Mage::register(
334
+ Futurenext_Zakeke_Helper_Data::ZAKEKE_REGISTRY_TOKEN,
335
+ $token
336
+ );
337
+
338
+ $this->loadLayout();
339
+ $title = $product->getName() . ' ' . $this->__('customization');
340
+ $this->getLayout()->getBlock('head')->setTitle($title);
341
+ $this->renderLayout();
342
+ } catch (Exception $e) {
343
+ Mage::logException($e);
344
+ $session->addException($e, $e->getMessage());
345
+ $this->_goBack();
346
+ }
347
+ }
348
+ }
app/code/community/Futurenext/Zakeke/controllers/Zakeke/ModuleCheckerController.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /**
13
+ * Zakeke controller for module checker
14
+ *
15
+ * @category Futurenext
16
+ * @package Futurenext_Zakeke
17
+ */
18
+ class Futurenext_Zakeke_Zakeke_ModuleCheckerController extends Mage_Adminhtml_Controller_Action
19
+ {
20
+ /**
21
+ * Show if the Zakeke module is ready for the store
22
+ */
23
+ public function indexAction()
24
+ {
25
+ /** @var Futurenext_Zakeke_Model_ModuleList $moduleListHelper */
26
+ $moduleListHelper = Mage::getSingleton('futurenext_zakeke/moduleList');
27
+ $moduleListHelper->gather();
28
+ $moduleList = $moduleListHelper->getList();
29
+ /** @var Futurenext_Zakeke_Helper_ZakekeApi $zakekeApi */
30
+ $zakekeApi = Mage::helper('futurenext_zakeke/zakekeApi');
31
+ $completeModuleList = $zakekeApi->moduleChecker($moduleList);
32
+
33
+ Mage::register(
34
+ Futurenext_Zakeke_Helper_Data::ZAKEKE_MODULE_LIST_REGISTRY,
35
+ $completeModuleList
36
+ );
37
+
38
+ $this->loadLayout()
39
+ ->_title('Zakeke Readiness Check')
40
+ ->_setActiveMenu('futurenext_zakeke/moduleChecker')
41
+ ->_addBreadcrumb($this->__('Zakeke'), $this->__('Readiness Check'));
42
+ $this->renderLayout();
43
+ }
44
+ }
app/code/community/Futurenext/Zakeke/etc/adminhtml.xml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /*******************************************************
4
+ * Copyright (C) 2016 FutureNext SRL
5
+ *
6
+ * This file is part of Zakeke.
7
+ *
8
+ * Zakeke can not be copied and/or distributed without the express
9
+ * permission of FutureNext SRL
10
+ *******************************************************/
11
+ -->
12
+ <config>
13
+ <acl>
14
+ <resources>
15
+ <admin>
16
+ <children>
17
+ <system>
18
+ <children>
19
+ <config>
20
+ <children>
21
+ <futurenext_zakeke module="futurenext_zakeke">
22
+ <title>Zakeke Interactive Product Design</title>
23
+ </futurenext_zakeke>
24
+ </children>
25
+ </config>
26
+ </children>
27
+ </system>
28
+ </children>
29
+ </admin>
30
+ </resources>
31
+ </acl>
32
+
33
+ <menu>
34
+ <futurenext_zakeke translate="title" module="futurenext_zakeke">
35
+ <title>Zakeke</title>
36
+ <depends><module>Futurenext_Zakeke</module></depends>
37
+ <sort_order>100</sort_order>
38
+ <children>
39
+ <moduleChecker translate="title" module="futurenext_zakeke">
40
+ <title>Readiness Check</title>
41
+ <action>adminhtml/zakeke_moduleChecker/index</action>
42
+ <sort_order>10</sort_order>
43
+ </moduleChecker>
44
+ </children>
45
+ </futurenext_zakeke>
46
+ </menu>
47
+ </config>
app/code/community/Futurenext/Zakeke/etc/api2.xml ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /*******************************************************
4
+ * Copyright (C) 2016 FutureNext SRL
5
+ *
6
+ * This file is part of Zakeke.
7
+ *
8
+ * Zakeke can not be copied and/or distributed without the express
9
+ * permission of FutureNext SRL
10
+ *******************************************************/
11
+ -->
12
+ <config>
13
+ <api2>
14
+ <resource_groups>
15
+ <futurenext_zakeke translate="title" module="futurenext_zakeke">
16
+ <title>Zakeke api</title>
17
+ <sort_order>10</sort_order>
18
+ </futurenext_zakeke>
19
+ </resource_groups>
20
+
21
+ <resources>
22
+ <zakekeEnabled translate="title" module="futurenext_zakeke">
23
+ <group>futurenext_zakeke</group>
24
+ <model>futurenext_zakeke/api2_zakekeEnabled</model>
25
+ <title>Enable Zakeke for a product</title>
26
+ <sort_order>10</sort_order>
27
+ <privileges>
28
+ <admin>
29
+ <create>1</create>
30
+ <retrieve>1</retrieve>
31
+ <update>1</update>
32
+ <delete>1</delete>
33
+ </admin>
34
+ <customer>
35
+ <create>0</create>
36
+ <retrieve>0</retrieve>
37
+ <update>0</update>
38
+ <delete>0</delete>
39
+ </customer>
40
+ <guest>
41
+ <create>0</create>
42
+ <retrieve>0</retrieve>
43
+ <update>0</update>
44
+ <delete>0</delete>
45
+ </guest>
46
+ </privileges>
47
+ <attributes translate="" module="futurenext_zakeke">
48
+ <entity_id>Entity ID</entity_id>
49
+ <sku>Sku</sku>
50
+ </attributes>
51
+ <include_attributes>
52
+ <admin>
53
+ <read>
54
+ <entity_id>1</entity_id>
55
+ <sku>1</sku>
56
+ </read>
57
+ </admin>
58
+ </include_attributes>
59
+ <force_attributes>
60
+ <admin>
61
+ <entity_id>1</entity_id>
62
+ <sku>1</sku>
63
+ </admin>
64
+ </force_attributes>
65
+ <routes>
66
+ <route_collection>
67
+ <route>/zakeke/enabled</route>
68
+ <action_type>collection</action_type>
69
+ </route_collection>
70
+ <route_entity>
71
+ <route>/zakeke/enabled/:sku</route>
72
+ <action_type>entity</action_type>
73
+ </route_entity>
74
+ </routes>
75
+ <versions>1</versions>
76
+ </zakekeEnabled>
77
+
78
+ <zakekeColors translate="title" module="futurenext_zakeke">
79
+ <group>futurenext_zakeke</group>
80
+ <model>futurenext_zakeke/api2_colors</model>
81
+ <title>Color attribute values</title>
82
+ <sort_order>10</sort_order>
83
+ <privileges>
84
+ <admin>
85
+ <retrieve>1</retrieve>
86
+ </admin>
87
+ <customer>
88
+ <create>0</create>
89
+ <retrieve>0</retrieve>
90
+ <update>0</update>
91
+ <delete>0</delete>
92
+ </customer>
93
+ <guest>
94
+ <create>0</create>
95
+ <retrieve>0</retrieve>
96
+ <update>0</update>
97
+ <delete>0</delete>
98
+ </guest>
99
+ </privileges>
100
+ <attributes>
101
+ <value>Color value ID</value>
102
+ <label>Color value label</label>
103
+ <attribute_id>Color attribute ID</attribute_id>
104
+ </attributes>
105
+ <include_attributes>
106
+ <admin>
107
+ <read>
108
+ <value>1</value>
109
+ <label>1</label>
110
+ <attribute_id>1</attribute_id>
111
+ </read>
112
+ </admin>
113
+ </include_attributes>
114
+ <force_attributes>
115
+ <admin>
116
+ <value>1</value>
117
+ <label>1</label>
118
+ <attribute_id>1</attribute_id>
119
+ </admin>
120
+ </force_attributes>
121
+ <routes>
122
+ <route_collection>
123
+ <route>/zakeke/colors</route>
124
+ <action_type>collection</action_type>
125
+ </route_collection>
126
+ </routes>
127
+ <versions>1</versions>
128
+ </zakekeColors>
129
+
130
+ <zakekeProductOptions translate="title" module="futurenext_zakeke">
131
+ <group>futurenext_zakeke</group>
132
+ <model>futurenext_zakeke/api2_productOptions</model>
133
+ <title>Product configurable options</title>
134
+ <sort_order>10</sort_order>
135
+ <privileges>
136
+ <admin>
137
+ <create>1</create>
138
+ <retrieve>1</retrieve>
139
+ <update>1</update>
140
+ <delete>1</delete>
141
+ </admin>
142
+ <customer>
143
+ <create>1</create>
144
+ <retrieve>1</retrieve>
145
+ <update>1</update>
146
+ <delete>1</delete>
147
+ </customer>
148
+ <guest>
149
+ <retrieve>1</retrieve>
150
+ </guest>
151
+ </privileges>
152
+ <attributes translate="" module="futurenext_zakeke">
153
+ <attribute_id>Attribute ID</attribute_id>
154
+ <label>Attribute label</label>
155
+ <values>Attribute values</values>
156
+ </attributes>
157
+ <include_attributes>
158
+ <admin>
159
+ <read>
160
+ <attribute_id>1</attribute_id>
161
+ <label>1</label>
162
+ <values>1</values>
163
+ </read>
164
+ </admin>
165
+ </include_attributes>
166
+ <force_attributes>
167
+ <admin>
168
+ <attribute_id>1</attribute_id>
169
+ <label>1</label>
170
+ <values>1</values>
171
+ </admin>
172
+ </force_attributes>
173
+ <routes>
174
+ <route_collection>
175
+ <route>/zakeke/product/configurableOptions/:sku</route>
176
+ <action_type>collection</action_type>
177
+ </route_collection>
178
+ </routes>
179
+ <versions>1</versions>
180
+ </zakekeProductOptions>
181
+
182
+ <zakekeSettings translate="title" module="futurenext_zakeke">
183
+ <group>futurenext_zakeke</group>
184
+ <model>futurenext_zakeke/api2_settings</model>
185
+ <title>Store settings</title>
186
+ <sort_order>10</sort_order>
187
+ <privileges>
188
+ <admin>
189
+ <retrieve>1</retrieve>
190
+ </admin>
191
+ <customer>
192
+ <create>0</create>
193
+ <retrieve>1</retrieve>
194
+ <update>0</update>
195
+ <delete>0</delete>
196
+ </customer>
197
+ <guest>
198
+ <create>0</create>
199
+ <retrieve>0</retrieve>
200
+ <update>0</update>
201
+ <delete>0</delete>
202
+ </guest>
203
+ </privileges>
204
+ <attributes>
205
+ <locale>Store locale code</locale>
206
+ <base_currency_code>Store base currency code</base_currency_code>
207
+ <media_url>Store media path</media_url>
208
+ </attributes>
209
+ <include_attributes>
210
+ <admin>
211
+ <read>
212
+ <locale>1</locale>
213
+ <base_currency_code>1</base_currency_code>
214
+ <media_url>1</media_url>
215
+ </read>
216
+ </admin>
217
+ </include_attributes>
218
+ <force_attributes>
219
+ <admin>
220
+ <locale>1</locale>
221
+ <base_currency_code>1</base_currency_code>
222
+ <media_url>1</media_url>
223
+ </admin>
224
+ </force_attributes>
225
+ <routes>
226
+ <route_collection>
227
+ <route>/zakeke/settings</route>
228
+ <action_type>entity</action_type>
229
+ </route_collection>
230
+ </routes>
231
+ <versions>1</versions>
232
+ </zakekeSettings>
233
+
234
+ <product translate="title" module="api2">
235
+ <attributes module="api2">
236
+ <sku>Product SKU</sku>
237
+ </attributes>
238
+
239
+ <exclude_attributes>
240
+ <admin>
241
+ <read>
242
+ <image_url>0</image_url>
243
+ <image>0</image>
244
+ <small_image>0</small_image>
245
+ </read>
246
+ </admin>
247
+ </exclude_attributes>
248
+ </product>
249
+ </resources>
250
+ </api2>
251
+ </config>
app/code/community/Futurenext/Zakeke/etc/config.xml ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /*******************************************************
4
+ * Copyright (C) 2016 FutureNext SRL
5
+ *
6
+ * This file is part of Zakeke.
7
+ *
8
+ * Zakeke can not be copied and/or distributed without the express
9
+ * permission of FutureNext SRL
10
+ *******************************************************/
11
+ -->
12
+ <config>
13
+ <modules>
14
+ <Futurenext_Zakeke>
15
+ <version>1.0.0.0</version>
16
+ </Futurenext_Zakeke>
17
+ </modules>
18
+
19
+ <global>
20
+ <blocks>
21
+ <futurenext_zakeke>
22
+ <class>Futurenext_Zakeke_Block</class>
23
+ </futurenext_zakeke>
24
+ <sales>
25
+ <rewrite>
26
+ <order_email_items_order_default>Futurenext_Zakeke_Block_Sales_Order_Email_Items_Order_Default</order_email_items_order_default>
27
+ </rewrite>
28
+ </sales>
29
+ </blocks>
30
+
31
+ <models>
32
+ <futurenext_zakeke>
33
+ <class>Futurenext_Zakeke_Model</class>
34
+ <resourceModel>futurenext_zakeke_resource</resourceModel>
35
+ </futurenext_zakeke>
36
+ <futurenext_zakeke_resource>
37
+ <class>Futurenext_Zakeke_Model_Resource</class>
38
+ <entities>
39
+ <zakekeEnabled>
40
+ <table>futurenext_zakeke_enabled</table>
41
+ </zakekeEnabled>
42
+ </entities>
43
+ </futurenext_zakeke_resource>
44
+
45
+ <restapi>
46
+ <class>Futurenext_Zakeke_Model_Api2_ZakekeEnabled</class>
47
+ </restapi>
48
+ </models>
49
+
50
+ <resources>
51
+ <zakeke_setup>
52
+ <setup>
53
+ <module>Futurenext_Zakeke</module>
54
+ <class>Futurenext_Zakeke_Model_Resource_Setup</class>
55
+ </setup>
56
+ </zakeke_setup>
57
+ </resources>
58
+
59
+ <helpers>
60
+ <futurenext_zakeke>
61
+ <class>Futurenext_Zakeke_Helper</class>
62
+ </futurenext_zakeke>
63
+ </helpers>
64
+
65
+ <events>
66
+ <catalog_product_load_after>
67
+ <observers>
68
+ <futurenext_zakeke_product_load_after_cart_add>
69
+ <class>Futurenext_Zakeke_Model_Observer</class>
70
+ <method>productLoadAfterCartAdd</method>
71
+ </futurenext_zakeke_product_load_after_cart_add>
72
+ </observers>
73
+ </catalog_product_load_after>
74
+
75
+ <sales_quote_item_set_product>
76
+ <observers>
77
+ <futurenext_zakeke_cart_add>
78
+ <class>Futurenext_Zakeke_Model_Observer</class>
79
+ <method>cartAdd</method>
80
+ </futurenext_zakeke_cart_add>
81
+ </observers>
82
+ </sales_quote_item_set_product>
83
+
84
+ <sales_convert_quote_item_to_order_item>
85
+ <observers>
86
+ <futurenext_zakeke>
87
+ <class>Futurenext_Zakeke_Model_Observer</class>
88
+ <method>salesConvertQuoteItemToOrderItem</method>
89
+ </futurenext_zakeke>
90
+ </observers>
91
+ </sales_convert_quote_item_to_order_item>
92
+
93
+ <sales_model_service_quote_submit_success>
94
+ <observers>
95
+ <futurenext_zakeke>
96
+ <class>Futurenext_Zakeke_Model_Observer</class>
97
+ <method>orderSave</method>
98
+ </futurenext_zakeke>
99
+ </observers>
100
+ </sales_model_service_quote_submit_success>
101
+
102
+ <customer_register_success>
103
+ <observers>
104
+ <futurenext_zakeke>
105
+ <class>Futurenext_Zakeke_Model_Observer</class>
106
+ <method>customerRegister</method>
107
+ </futurenext_zakeke>
108
+ </observers>
109
+ </customer_register_success>
110
+
111
+ <customer_login>
112
+ <observers>
113
+ <futurenext_zakeke>
114
+ <class>Futurenext_Zakeke_Model_Observer</class>
115
+ <method>customerLogin</method>
116
+ </futurenext_zakeke>
117
+ </observers>
118
+ </customer_login>
119
+
120
+ <customer_logout>
121
+ <observers>
122
+ <futurenext_zakeke>
123
+ <class>Futurenext_Zakeke_Model_Observer</class>
124
+ <method>customerLogout</method>
125
+ </futurenext_zakeke>
126
+ </observers>
127
+ </customer_logout>
128
+
129
+ <checkout_cart_product_add_after>
130
+ <observers>
131
+ <futurenext_zakeke>
132
+ <class>Futurenext_Zakeke_Model_Observer</class>
133
+ <method>reorder</method>
134
+ </futurenext_zakeke>
135
+ </observers>
136
+ </checkout_cart_product_add_after>
137
+ </events>
138
+ </global>
139
+
140
+ <adminhtml>
141
+ <layout>
142
+ <updates>
143
+ <futurenext_zakeke>
144
+ <file>zakeke.xml</file>
145
+ </futurenext_zakeke>
146
+ </updates>
147
+ </layout>
148
+ </adminhtml>
149
+
150
+ <frontend>
151
+ <routers>
152
+ <futurenext_zakeke>
153
+ <use>standard</use>
154
+ <args>
155
+ <module>Futurenext_Zakeke</module>
156
+ <frontName>zakeke</frontName>
157
+ </args>
158
+ </futurenext_zakeke>
159
+ </routers>
160
+
161
+ <layout>
162
+ <updates>
163
+ <futurenext_zakeke>
164
+ <file>zakeke.xml</file>
165
+ </futurenext_zakeke>
166
+ </updates>
167
+ </layout>
168
+ </frontend>
169
+
170
+ <admin>
171
+ <routers>
172
+ <adminhtml>
173
+ <args>
174
+ <modules>
175
+ <futurenext_zakeke before="Mage_Adminhtml">Futurenext_Zakeke</futurenext_zakeke>
176
+ </modules>
177
+ </args>
178
+ </adminhtml>
179
+ </routers>
180
+ </admin>
181
+
182
+ <default>
183
+ <futurenext_zakeke>
184
+ <settings>
185
+ <zakekeActive>1</zakekeActive>
186
+ </settings>
187
+ </futurenext_zakeke>
188
+ </default>
189
+ </config>
app/code/community/Futurenext/Zakeke/etc/system.xml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /*******************************************************
4
+ * Copyright (C) 2016 FutureNext SRL
5
+ *
6
+ * This file is part of Zakeke.
7
+ *
8
+ * Zakeke can not be copied and/or distributed without the express
9
+ * permission of FutureNext SRL
10
+ *******************************************************/
11
+ -->
12
+ <config>
13
+ <tabs>
14
+ <zakeke translate="label" module="futurenext_zakeke">
15
+ <label>Zakeke Interactive Product Design</label>
16
+ <sort_order>200</sort_order>
17
+ </zakeke>
18
+ </tabs>
19
+ <sections>
20
+ <futurenext_zakeke translate="label" module="futurenext_zakeke">
21
+ <label>Zakeke Interactive Product Design</label>
22
+ <tab>zakeke</tab>
23
+ <class>separator-top</class>
24
+ <sort_order>340</sort_order>
25
+ <frontend_type>text</frontend_type>
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
+ <groups>
30
+ <settings translate="label">
31
+ <label>General Settings</label>
32
+ <frontend_type>text</frontend_type>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ <fields>
37
+ <zakekeActive translate="label">
38
+ <label>Enabled</label>
39
+ <sort_order>1</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ <frontend_type>select</frontend_type>
44
+ <source_model>adminhtml/system_config_source_yesno</source_model>
45
+ </zakekeActive>
46
+
47
+ <zakekeUsername translate="label">
48
+ <label>Zakeke username</label>
49
+ <sort_order>2</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ <frontend_type>text</frontend_type>
54
+ <comment><![CDATA[Need a Zakeke account? <a href="https://www.zakeke.com/" target="_blank">Click here to get one]]></comment>
55
+ </zakekeUsername>
56
+
57
+ <zakekePassword translate="label">
58
+ <label>Zakeke password</label>
59
+ <sort_order>3</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ <frontend_type>password</frontend_type>
64
+ </zakekePassword>
65
+ </fields>
66
+ </settings>
67
+ </groups>
68
+ </futurenext_zakeke>
69
+ </sections>
70
+ </config>
app/code/community/Futurenext/Zakeke/sql/zakeke_setup/install-1.0.0.0.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+
12
+ /* @var Futurenext_Zakeke_Model_Resource_Setup $installer */
13
+ $installer = $this;
14
+
15
+ $installer->startSetup();
16
+
17
+ /**
18
+ * Create table 'futurenext_zakeke_enabled'
19
+ */
20
+ $table = $installer->getConnection()
21
+ ->newTable($installer->getTable('futurenext_zakeke_enabled'))
22
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
23
+ 'identity' => true,
24
+ 'unsigned' => true,
25
+ 'nullable' => false,
26
+ 'primary' => true,
27
+ ), 'Entity ID')
28
+ ->addColumn('sku', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array(
29
+ 'nullable' => false
30
+ ), 'SKU')
31
+ ->addIndex($installer->getIdxName('futurenext_zakeke_enabled', array('sku')),
32
+ array('sku'))
33
+ ->setComment('Zakeke Customizable Product Table');
34
+ $installer->getConnection()->createTable($table);
35
+
36
+ /**
37
+ * Save rules with resources
38
+ */
39
+
40
+ /** @var Mage_Api2_Model_Acl_Global_Role $role */
41
+ $role = Mage::getModel('api2/acl_global_role');
42
+ $role->setRoleName('Zakeke');
43
+ $role->save();
44
+ $roleId = $role->getId();
45
+ $resources = array(
46
+ 'zakekeSettings' => array('retrieve'),
47
+ 'zakekeProductOptions' => array('create', 'retrieve', 'update', 'delete'),
48
+ 'zakekeColors' => array('retrieve'),
49
+ 'zakekeEnabled' => array('create', 'retrieve', 'update', 'delete'),
50
+ 'product' => array('retrieve'),
51
+ 'product_category' => array('retrieve'),
52
+ 'product_image' => array('retrieve'),
53
+ 'stock_item' => array('retrieve'),
54
+ 'order' => array('retrieve'),
55
+ 'order_item' => array('retrieve')
56
+ );
57
+
58
+ /** @var Mage_Api2_Model_Acl_Global_Rule $rule */
59
+ $rule = Mage::getModel('api2/acl_global_rule');
60
+ foreach ($resources as $resourceId => $privileges) {
61
+ foreach ($privileges as $privilege) {
62
+ $rule->setId(null)
63
+ ->isObjectNew(true);
64
+
65
+ $rule->setRoleId($roleId)
66
+ ->setResourceId($resourceId)
67
+ ->setPrivilege($privilege)
68
+ ->save();
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Save OAuth Consumer
74
+ */
75
+
76
+ /** @var Mage_Oauth_Model_Consumer $oauthConsumer */
77
+ $oauthConsumer = Mage::getModel('oauth/consumer');
78
+ /** @var Mage_Oauth_Helper_Data $oauthHelper */
79
+ $oauthHelper = Mage::helper('oauth');
80
+
81
+ $oauthConsumer->setName('Zakeke');
82
+ $oauthConsumer->setKey($oauthHelper->generateConsumerKey());
83
+ $oauthConsumer->setSecret($oauthHelper->generateConsumerKey());
84
+ $oauthConsumer->setCallbackUrl(
85
+ Futurenext_Zakeke_Helper_Data::ZAKEKE_BASE_URL . '/integration/magento1/success'
86
+ );
87
+ $oauthConsumer->save();
88
+
89
+ $installer->endSetup();
90
+ ?>
app/design/adminhtml/default/default/layout/zakeke.xml ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <adminhtml_sales_order_view>
4
+ <reference name="head">
5
+ <action method="addJs"><file>zakeke/preview.js</file></action>
6
+ </reference>
7
+ <reference name="order_items">
8
+ <action method="addItemRender">
9
+ <type>zakeke</type>
10
+ <block>adminhtml/sales_order_view_items_renderer_default</block>
11
+ <template>zakeke/sales/order/view/items/renderer/zakeke.phtml</template>
12
+ </action>
13
+ <action method="addColumnRender">
14
+ <column>zakeke</column>
15
+ <block>futurenext_zakeke/adminhtml_sales_items_column_zakeke_name</block>
16
+ <template>zakeke/sales/items/column/zakeke/name.phtml</template>
17
+ </action>
18
+ </reference>
19
+ </adminhtml_sales_order_view>
20
+
21
+ <adminhtml_sales_order_invoice_view>
22
+ <reference name="head">
23
+ <action method="addJs"><file>zakeke/preview.js</file></action>
24
+ </reference>
25
+ <reference name="invoice_items">
26
+ <action method="addItemRender">
27
+ <type>zakeke</type>
28
+ <block>adminhtml/sales_order_view_items_renderer_default</block>
29
+ <template>zakeke/sales/order/invoice/view/items/renderer/zakeke.phtml</template>
30
+ </action>
31
+ <action method="addColumnRender">
32
+ <column>zakeke</column>
33
+ <block>futurenext_zakeke/adminhtml_sales_items_column_zakeke_name</block>
34
+ <template>zakeke/sales/items/column/zakeke/name.phtml</template>
35
+ </action>
36
+ </reference>
37
+ </adminhtml_sales_order_invoice_view>
38
+
39
+ <adminhtml_sales_order_invoice_new>
40
+ <reference name="head">
41
+ <action method="addJs"><file>zakeke/preview.js</file></action>
42
+ </reference>
43
+ <reference name="order_items">
44
+ <action method="addItemRender">
45
+ <type>zakeke</type>
46
+ <block>adminhtml/sales_order_view_items_renderer_default</block>
47
+ <template>zakeke/sales/order/invoice/create/items/renderer/zakeke.phtml</template>
48
+ </action>
49
+ <action method="addColumnRender">
50
+ <column>zakeke</column>
51
+ <block>futurenext_zakeke/adminhtml_sales_items_column_zakeke_name</block>
52
+ <template>zakeke/sales/items/column/zakeke/name.phtml</template>
53
+ </action>
54
+ </reference>
55
+ </adminhtml_sales_order_invoice_new>
56
+
57
+ <adminhtml_sales_order_invoice_updateqty>
58
+ <reference name="head">
59
+ <action method="addJs"><file>zakeke/preview.js</file></action>
60
+ </reference>
61
+ <reference name="order_items">
62
+ <action method="addItemRender">
63
+ <type>zakeke</type>
64
+ <block>adminhtml/sales_items_renderer_default</block>
65
+ <template>zakeke/sales/order/invoice/create/items/renderer/zakeke.phtml</template>
66
+ </action>
67
+ <action method="addColumnRender">
68
+ <column>zakeke</column>
69
+ <block>futurenext_zakeke/adminhtml_sales_items_column_zakeke_name</block>
70
+ <template>zakeke/sales/items/column/zakeke/name.phtml</template>
71
+ </action>
72
+ </reference>
73
+ </adminhtml_sales_order_invoice_updateqty>
74
+
75
+ <adminhtml_sales_order_creditmemo_new>
76
+ <reference name="head">
77
+ <action method="addJs"><file>zakeke/preview.js</file></action>
78
+ </reference>
79
+ <reference name="order_items">
80
+ <action method="addItemRender">
81
+ <type>zakeke</type>
82
+ <block>adminhtml/sales_items_renderer_default</block>
83
+ <template>zakeke/sales/order/creditmemo/create/items/renderer/zakeke.phtml</template>
84
+ </action>
85
+ <action method="addColumnRender">
86
+ <column>zakeke</column>
87
+ <block>futurenext_zakeke/adminhtml_sales_items_column_zakeke_name</block>
88
+ <template>zakeke/sales/items/column/zakeke/name.phtml</template>
89
+ </action>
90
+ </reference>
91
+ </adminhtml_sales_order_creditmemo_new>
92
+
93
+ <adminhtml_sales_order_creditmemo_updateqty>
94
+ <reference name="head">
95
+ <action method="addJs"><file>zakeke/preview.js</file></action>
96
+ </reference>
97
+ <reference name="order_items">
98
+ <action method="addItemRender">
99
+ <type>zakeke</type>
100
+ <block>adminhtml/sales_items_renderer_default</block>
101
+ <template>zakeke/sales/order/creditmemo/create/items/renderer/zakeke.phtml</template>
102
+ </action>
103
+ <action method="addColumnRender">
104
+ <column>zakeke</column>
105
+ <block>futurenext_zakeke/adminhtml_sales_items_column_zakeke_name</block>
106
+ <template>zakeke/sales/items/column/zakeke/name.phtml</template>
107
+ </action>
108
+ </reference>
109
+ </adminhtml_sales_order_creditmemo_updateqty>
110
+
111
+ <adminhtml_sales_order_creditmemo_view>
112
+ <reference name="head">
113
+ <action method="addJs"><file>zakeke/preview.js</file></action>
114
+ </reference>
115
+ <reference name="creditmemo_items">
116
+ <action method="addItemRender">
117
+ <type>zakeke</type>
118
+ <block>adminhtml/sales_items_renderer_default</block>
119
+ <template>zakeke/sales/order/creditmemo/view/items/renderer/zakeke.phtml</template>
120
+ </action>
121
+ <action method="addColumnRender">
122
+ <column>zakeke</column>
123
+ <block>futurenext_zakeke/adminhtml_sales_items_column_zakeke_name</block>
124
+ <template>zakeke/sales/items/column/zakeke/name.phtml</template>
125
+ </action>
126
+ </reference>
127
+ </adminhtml_sales_order_creditmemo_view>
128
+
129
+ <adminhtml_zakeke_modulechecker_index>
130
+ <reference name="head">
131
+ <action method="addItem">
132
+ <type>skin_css</type>
133
+ <name>zakeke/modulechecker.css</name>
134
+ </action>
135
+ </reference>
136
+ <reference name="content">
137
+ <block type="futurenext_zakeke/moduleChecker"
138
+ template="zakeke/modulechecker.phtml"
139
+ name="zakeke_module_checker" />
140
+ </reference>
141
+ </adminhtml_zakeke_modulechecker_index>
142
+ </layout>
app/design/adminhtml/default/default/template/zakeke/modulechecker.phtml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /** @var Futurenext_Zakeke_Block_ModuleChecker $this */
4
+
5
+ $moduleList = $this->getModuleList();
6
+ $isZakekeReachable = $this->getIsZakekeReachable();
7
+ $isModuleCheckerValid = count($moduleList) == 0;
8
+ # $isModuleCheckerValid = true;
9
+
10
+ $isReady = $isZakekeReachable && $isModuleCheckerValid;
11
+
12
+ /** @var Mage_Adminhtml_Helper_Data $helper */
13
+ $helper = Mage::helper('adminhtml');
14
+ ?>
15
+ <div class="middle" id="anchor-content" xmlns="http://www.w3.org/1999/html">
16
+ <div id="page:main-container">
17
+ <div class="content-header">
18
+ <h3><?php echo $helper->__('Readiness Check') ?></h3>
19
+ </div>
20
+ <div id="zakeke-summary"
21
+ class="zakeke-checker <?php echo $isReady ? 'zakeke-valid' : 'zakeke-not-valid' ?>">
22
+ <span>
23
+ <?php if ($isReady): ?>
24
+ <strong><?php echo $helper->__('Compatible!') ?></strong> <?php echo $helper->__('You Magento store is ready for Zakeke.') ?>
25
+ <?php else: ?>
26
+ <strong><?php echo $helper->__('Error!') ?></strong> <?php echo $helper->__('You need to resolve these issues to use Zakeke.') ?>
27
+ <?php endif; ?>
28
+ </span>
29
+ </div>
30
+
31
+ <div id="zakeke-reachable-checker"
32
+ class="zakeke-checker <?php echo $isZakekeReachable ? 'zakeke-valid' : 'zakeke-not-valid' ?>">
33
+ <h3><?php echo $helper->__('Connection Check') ?></h3>
34
+ <div>
35
+ <?php if ($isZakekeReachable): ?>
36
+ <p><?php echo $helper->__('Zakeke is reachable.') ?></p>
37
+ <?php else: ?>
38
+ <div class="zakeke-problem-description">
39
+ <p><?php echo $helper->__('Zakeke is not reachable. Contact us and we will investigate the problem.') ?></p>
40
+ </div>
41
+ <?php endif; ?>
42
+ </div>
43
+ </div>
44
+
45
+ <div id="zakeke-module-checker"
46
+ class="zakeke-checker <?php echo $isModuleCheckerValid ? 'zakeke-valid' : 'zakeke-not-valid' ?>">
47
+ <h3><?php echo $helper->__('Modules Check') ?></h3>
48
+ <div>
49
+ <?php if ($isModuleCheckerValid): ?>
50
+ <p><?php echo $helper->__('Your modules are compatible.') ?></p>
51
+ <?php else: ?>
52
+ <div class="zakeke-problem-description">
53
+ <p><?php echo $helper->__('%s modules result not compatible', count($moduleList)) ?></p>
54
+ </div>
55
+ <ul>
56
+ <?php foreach($moduleList as $index => $module): ?>
57
+ <li><?php echo sprintf('%s (%s) - %s', $module->getName(), $module->getModuleVersion(), $module->getHowToFix()) ?></span></li>
58
+ <?php endforeach; ?>
59
+ </ul>
60
+ <?php endif; ?>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </div>
app/design/adminhtml/default/default/template/zakeke/sales/items/column/zakeke/name.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_zakekePreviews = $this->getZakekePreviews();
3
+ $_zakekeDownload = $this->getZakekeOutputZip();
4
+ ?>
5
+ <?php if ($_item = $this->getItem()): ?>
6
+ <h5 class="title"><span id="order_item_<?php echo $_item->getId() ?>_title"><?php echo $this->escapeHtml($_item->getName()) ?></span></h5>
7
+ <div><strong><?php echo $this->helper('sales')->__('SKU') ?>:</strong> <?php echo implode('<br />', Mage::helper('catalog')->splitSku($this->escapeHtml($this->getSku()))); ?></div>
8
+
9
+ <?php if ($_zakekePreviews) : ?>
10
+ <?php echo $this->helper('futurenext_zakeke')->htmlView($_zakekePreviews) ?>
11
+ <?php endif; ?>
12
+ <?php if ($_zakekeDownload) : ?>
13
+ <a href="<?php echo $this->quoteEscape($_zakekeDownload) ?>" download>
14
+ <?php echo $this->escapeHtml($this->helper('futurenext_zakeke')->__('Download customization files')) ?>
15
+ </a>
16
+ <?php else : ?>
17
+ <?php echo $this->escapeHtml($this->helper('futurenext_zakeke')->__('Customization files in processing')) ?>
18
+ <?php endif; ?>
19
+
20
+ <?php if ($this->getOrderOptions()): ?>
21
+ <dl class="item-options">
22
+ <?php foreach ($this->getOrderOptions() as $_option): ?>
23
+ <?php if (isset($_option['is_zakeke'])) continue; ?>
24
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
25
+ <dd>
26
+ <?php if (isset($_option['custom_view']) && $_option['custom_view']): ?>
27
+ <?php echo $this->getCustomizedOptionValue($_option); ?>
28
+ <?php else: ?>
29
+ <?php $_option = $this->getFormattedOption($_option['value']); ?>
30
+ <?php echo $_option['value']; ?><?php if (isset($_option['remainder']) && $_option['remainder']): ?><span id="<?php echo $_dots = 'dots' . uniqid()?>"> ...</span><span id="<?php echo $_id = 'id' . uniqid()?>"><?php echo $_option['remainder'] ?></span>
31
+ <script type="text/javascript">
32
+ $('<?php echo $_id ?>').hide();
33
+ $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_id ?>').show();});
34
+ $('<?php echo $_id ?>').up().observe('mouseover', function(){$('<?php echo $_dots?>').hide();});
35
+ $('<?php echo $_id ?>').up().observe('mouseout', function(){$('<?php echo $_id ?>').hide();});
36
+ $('<?php echo $_id ?>').up().observe('mouseout', function(){$('<?php echo $_dots ?>').show();});
37
+ </script>
38
+ <?php endif; ?>
39
+ <?php endif; ?>
40
+ </dd>
41
+ <?php endforeach; ?>
42
+ </dl>
43
+ <?php endif; ?>
44
+ <?php echo $this->escapeHtml($_item->getDescription()) ?>
45
+ <?php endif; ?>
app/design/adminhtml/default/default/template/zakeke/sales/order/creditmemo/create/items/renderer/zakeke.phtml ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $_item = $this->getItem() ?>
28
+ <?php $this->setPriceDataObject($_item); ?>
29
+ <tr class="border">
30
+ <td><?php echo $this->getColumnHtml($_item, 'zakeke') ?></td>
31
+ <td class="a-right">
32
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
33
+ <span class="price-excl-tax">
34
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
35
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
36
+ <?php endif; ?>
37
+
38
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
39
+ <?php
40
+ echo $this->displayPrices(
41
+ $_item->getBasePrice() + $_item->getBaseWeeeTaxAppliedAmount() + $_item->getBaseWeeeTaxDisposition(),
42
+ $_item->getPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()
43
+ );
44
+ ?>
45
+ <?php else: ?>
46
+ <?php echo $this->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?>
47
+ <?php endif; ?>
48
+
49
+
50
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
51
+ <br/>
52
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
53
+ <small>
54
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
55
+ <span class="nobr"><?php echo $tax['title']; ?>
56
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
57
+ <?php endforeach; ?>
58
+ </small>
59
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
60
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
61
+ <span class="nobr"><small><?php echo $tax['title']; ?>
62
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></small></span>
63
+ <?php endforeach; ?>
64
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
65
+ <small>
66
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
67
+ <span class="nobr"><?php echo $tax['title']; ?>
68
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
69
+ <?php endforeach; ?>
70
+ </small>
71
+ <?php endif; ?>
72
+
73
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
74
+ <br/>
75
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br/>
76
+ <?php
77
+ echo $this->displayPrices(
78
+ $_item->getBasePrice() + $_item->getBaseWeeeTaxAppliedAmount() + $_item->getBaseWeeeTaxDisposition(),
79
+ $_item->getPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()
80
+ );
81
+ ?>
82
+ </span>
83
+ <?php endif; ?>
84
+ <?php endif; ?>
85
+ </span>
86
+ <br/>
87
+ <?php endif; ?>
88
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
89
+ <span class="price-incl-tax">
90
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
91
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
92
+ <?php endif; ?>
93
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
94
+ <?php $_baseIncl = $this->helper('checkout')->getBasePriceInclTax($_item); ?>
95
+
96
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
97
+ <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
98
+ <?php else: ?>
99
+ <?php echo $this->displayPrices($_baseIncl - $_item->getBaseWeeeTaxDisposition(), $_incl - $_item->getWeeeTaxDisposition()) ?>
100
+ <?php endif; ?>
101
+
102
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
103
+ <br/>
104
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
105
+ <small>
106
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
107
+ <span class="nobr"><?php echo $tax['title']; ?>
108
+ : <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
109
+ <?php endforeach; ?>
110
+ </small>
111
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
112
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
113
+ <span class="nobr"><small><?php echo $tax['title']; ?>
114
+ : <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></small></span>
115
+ <?php endforeach; ?>
116
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
117
+ <small>
118
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
119
+ <span class="nobr"><?php echo $tax['title']; ?>
120
+ : <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
121
+ <?php endforeach; ?>
122
+ </small>
123
+ <?php endif; ?>
124
+
125
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
126
+ <br/>
127
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
128
+ :<br/> <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
129
+ <?php endif; ?>
130
+ <?php endif; ?>
131
+ </span>
132
+ <?php endif; ?>
133
+ </td>
134
+ <td class="a-center"><?php echo $this->getColumnHtml($_item, 'qty') ?></td>
135
+ <?php if ($this->canParentReturnToStock($_item)) : ?>
136
+ <td class="a-center">
137
+ <?php if ($this->canReturnItemToStock($_item)) : ?>
138
+ <input type="checkbox" name="creditmemo[items][<?php echo $_item->getOrderItemId() ?>][back_to_stock]"
139
+ value="1"<?php if ($_item->getBackToStock()): ?> checked<?php endif; ?>/>
140
+ <?php endif; ?>
141
+ </td>
142
+ <?php endif; ?>
143
+ <td class="a-center">
144
+ <?php if ($this->canEditQty()) : ?>
145
+ <input type="text" class="input-text qty-input"
146
+ name="creditmemo[items][<?php echo $_item->getOrderItemId() ?>][qty]"
147
+ value="<?php echo $_item->getQty() * 1 ?>"/>
148
+ <?php else : ?>
149
+ <?php echo $_item->getQty() * 1 ?>
150
+ <?php endif; ?>
151
+ </td>
152
+ <td class="a-right">
153
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
154
+ <span class="price-excl-tax">
155
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
156
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
157
+ <?php endif; ?>
158
+
159
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
160
+ <?php
161
+ echo $this->displayPrices(
162
+ $_item->getBaseRowTotal() + $_item->getBaseWeeeTaxAppliedRowAmount() + $_item->getBaseWeeeTaxRowDisposition(),
163
+ $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()
164
+ );
165
+ ?>
166
+ <?php else: ?>
167
+ <?php echo $this->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
168
+ <?php endif; ?>
169
+
170
+
171
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
172
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
173
+ <small>
174
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
175
+ <span class="nobr"><?php echo $tax['title']; ?>
176
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
177
+ <?php endforeach; ?>
178
+ </small>
179
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
180
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
181
+ <span class="nobr"><small><?php echo $tax['title']; ?>
182
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></small></span>
183
+ <?php endforeach; ?>
184
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
185
+ <small>
186
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
187
+ <span class="nobr"><?php echo $tax['title']; ?>
188
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
189
+ <?php endforeach; ?>
190
+ </small>
191
+ <?php endif; ?>
192
+
193
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
194
+ <br/>
195
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br/>
196
+ <?php
197
+ echo $this->displayPrices(
198
+ $_item->getBaseRowTotal() + $_item->getBaseWeeeTaxAppliedRowAmount() + $_item->getBaseWeeeTaxRowDisposition(),
199
+ $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()
200
+ );
201
+ ?>
202
+ </span>
203
+ <?php endif; ?>
204
+ <?php endif; ?>
205
+ </span>
206
+ <br/>
207
+ <?php endif; ?>
208
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
209
+ <span class="price-incl-tax">
210
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
211
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
212
+ <?php endif; ?>
213
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
214
+ <?php $_baseIncl = $this->helper('checkout')->getBaseSubtotalInclTax($_item); ?>
215
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
216
+ <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseRowWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
217
+ <?php else: ?>
218
+ <?php echo $this->displayPrices($_baseIncl - $_item->getBaseWeeeTaxRowDisposition(), $_incl - $_item->getWeeeTaxRowDisposition()) ?>
219
+ <?php endif; ?>
220
+
221
+
222
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
223
+
224
+ <br/>
225
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
226
+ <small>
227
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
228
+ <span class="nobr"><?php echo $tax['title']; ?>
229
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
230
+ <?php endforeach; ?>
231
+ </small>
232
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
233
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
234
+ <span class="nobr"><small><?php echo $tax['title']; ?>
235
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></small></span>
236
+ <?php endforeach; ?>
237
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
238
+ <small>
239
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
240
+ <span class="nobr"><?php echo $tax['title']; ?>
241
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
242
+ <?php endforeach; ?>
243
+ </small>
244
+ <?php endif; ?>
245
+
246
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
247
+ <br/><span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
248
+ :<br/> <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseRowWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
249
+ <?php endif; ?>
250
+ <?php endif; ?>
251
+ </span>
252
+ <?php endif; ?>
253
+ </td>
254
+ <td class="a-right"><?php echo $this->displayPriceAttribute('tax_amount') ?></td>
255
+ <td class="a-right"><?php echo $this->displayPriceAttribute('discount_amount') ?></td>
256
+ <td class="a-right last">
257
+ <?php echo $this->displayPrices(
258
+ $_item->getBaseRowTotal() + $_item->getBaseTaxAmount() - $_item->getBaseDiscountAmount() + $_item->getBaseWeeeTaxAppliedRowAmount(),
259
+ $_item->getRowTotal() + $_item->getTaxAmount() - $_item->getDiscountAmount() + $_item->getWeeeTaxAppliedRowAmount()
260
+ ) ?>
261
+ </td>
262
+ </tr>
app/design/adminhtml/default/default/template/zakeke/sales/order/creditmemo/view/items/renderer/zakeke.phtml ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $_item = $this->getItem() ?>
28
+ <?php $this->setPriceDataObject($_item) ?>
29
+ <tr class="border">
30
+ <td><?php echo $this->getColumnHtml($_item, 'zakeke') ?></td>
31
+ <td class="a-right">
32
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
33
+ <span class="price-excl-tax">
34
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
35
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
36
+ <?php endif; ?>
37
+
38
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
39
+ <?php
40
+ echo $this->displayPrices(
41
+ $_item->getBasePrice() + $_item->getBaseWeeeTaxAppliedAmount() + $_item->getBaseWeeeTaxDisposition(),
42
+ $_item->getPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()
43
+ );
44
+ ?>
45
+ <?php else: ?>
46
+ <?php echo $this->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?>
47
+ <?php endif; ?>
48
+
49
+
50
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
51
+ <br/>
52
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
53
+ <small>
54
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
55
+ <span class="nobr"><?php echo $tax['title']; ?>
56
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
57
+ <?php endforeach; ?>
58
+ </small>
59
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
60
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
61
+ <span class="nobr"><small><?php echo $tax['title']; ?>
62
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></small></span>
63
+ <?php endforeach; ?>
64
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
65
+ <small>
66
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
67
+ <span class="nobr"><?php echo $tax['title']; ?>
68
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
69
+ <?php endforeach; ?>
70
+ </small>
71
+ <?php endif; ?>
72
+
73
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
74
+ <br/>
75
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br/>
76
+ <?php
77
+ echo $this->displayPrices(
78
+ $_item->getBasePrice() + $_item->getBaseWeeeTaxAppliedAmount() + $_item->getBaseWeeeTaxDisposition(),
79
+ $_item->getPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()
80
+ );
81
+ ?>
82
+ </span>
83
+ <?php endif; ?>
84
+ <?php endif; ?>
85
+ </span>
86
+ <br/>
87
+ <?php endif; ?>
88
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
89
+ <span class="price-incl-tax">
90
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
91
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
92
+ <?php endif; ?>
93
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
94
+ <?php $_baseIncl = $this->helper('checkout')->getBasePriceInclTax($_item); ?>
95
+
96
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
97
+ <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
98
+ <?php else: ?>
99
+ <?php echo $this->displayPrices($_baseIncl - $_item->getBaseWeeeTaxDisposition(), $_incl - $_item->getWeeeTaxDisposition()) ?>
100
+ <?php endif; ?>
101
+
102
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
103
+ <br/>
104
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
105
+ <small>
106
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
107
+ <span class="nobr"><?php echo $tax['title']; ?>
108
+ : <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
109
+ <?php endforeach; ?>
110
+ </small>
111
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
112
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
113
+ <span class="nobr"><small><?php echo $tax['title']; ?>
114
+ : <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></small></span>
115
+ <?php endforeach; ?>
116
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
117
+ <small>
118
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
119
+ <span class="nobr"><?php echo $tax['title']; ?>
120
+ : <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
121
+ <?php endforeach; ?>
122
+ </small>
123
+ <?php endif; ?>
124
+
125
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
126
+ <br/>
127
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
128
+ :<br/> <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
129
+ <?php endif; ?>
130
+ <?php endif; ?>
131
+ </span>
132
+ <?php endif; ?>
133
+
134
+ </td>
135
+ <td class="a-center"><?php echo $_item->getQty() * 1 ?></td>
136
+ <td class="a-right">
137
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
138
+ <span class="price-excl-tax">
139
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
140
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
141
+ <?php endif; ?>
142
+
143
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
144
+ <?php
145
+ echo $this->displayPrices(
146
+ $_item->getBaseRowTotal() + $_item->getBaseWeeeTaxAppliedRowAmount() + $_item->getBaseWeeeTaxRowDisposition(),
147
+ $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()
148
+ );
149
+ ?>
150
+ <?php else: ?>
151
+ <?php echo $this->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
152
+ <?php endif; ?>
153
+
154
+
155
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
156
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
157
+ <small>
158
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
159
+ <span class="nobr"><?php echo $tax['title']; ?>
160
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
161
+ <?php endforeach; ?>
162
+ </small>
163
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
164
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
165
+ <span class="nobr"><small><?php echo $tax['title']; ?>
166
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></small></span>
167
+ <?php endforeach; ?>
168
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
169
+ <small>
170
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
171
+ <span class="nobr"><?php echo $tax['title']; ?>
172
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
173
+ <?php endforeach; ?>
174
+ </small>
175
+ <?php endif; ?>
176
+
177
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
178
+ <br/>
179
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br/>
180
+ <?php
181
+ echo $this->displayPrices(
182
+ $_item->getBaseRowTotal() + $_item->getBaseWeeeTaxAppliedRowAmount() + $_item->getBaseWeeeTaxRowDisposition(),
183
+ $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()
184
+ );
185
+ ?>
186
+ </span>
187
+ <?php endif; ?>
188
+ <?php endif; ?>
189
+ </span>
190
+ <br/>
191
+ <?php endif; ?>
192
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
193
+ <span class="price-incl-tax">
194
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
195
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
196
+ <?php endif; ?>
197
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
198
+ <?php $_baseIncl = $this->helper('checkout')->getBaseSubtotalInclTax($_item); ?>
199
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
200
+ <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseRowWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
201
+ <?php else: ?>
202
+ <?php echo $this->displayPrices($_baseIncl - $_item->getBaseWeeeTaxRowDisposition(), $_incl - $_item->getWeeeTaxRowDisposition()) ?>
203
+ <?php endif; ?>
204
+
205
+
206
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
207
+
208
+ <br/>
209
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
210
+ <small>
211
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
212
+ <span class="nobr"><?php echo $tax['title']; ?>
213
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
214
+ <?php endforeach; ?>
215
+ </small>
216
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
217
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
218
+ <span class="nobr"><small><?php echo $tax['title']; ?>
219
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></small></span>
220
+ <?php endforeach; ?>
221
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
222
+ <small>
223
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
224
+ <span class="nobr"><?php echo $tax['title']; ?>
225
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
226
+ <?php endforeach; ?>
227
+ </small>
228
+ <?php endif; ?>
229
+
230
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
231
+ <br/><span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
232
+ :<br/> <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseRowWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
233
+ <?php endif; ?>
234
+ <?php endif; ?>
235
+ </span>
236
+ <?php endif; ?>
237
+ </td>
238
+ <td class="a-right"><?php echo $this->displayPriceAttribute('tax_amount') ?></td>
239
+ <td class="a-right"><?php echo $this->displayPriceAttribute('discount_amount') ?></td>
240
+ <td class="a-right last">
241
+ <?php echo $this->displayPrices(
242
+ $_item->getBaseRowTotal() - $_item->getBaseDiscountAmount() + $_item->getBaseTaxAmount() + $_item->getBaseWeeeTaxAppliedRowAmount(),
243
+ $_item->getRowTotal() - $_item->getDiscountAmount() + $_item->getTaxAmount() + $_item->getWeeeTaxAppliedRowAmount()
244
+ ) ?>
245
+ </td>
246
+ </tr>
app/design/adminhtml/default/default/template/zakeke/sales/order/invoice/create/items/renderer/zakeke.phtml ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $_item = $this->getItem() ?>
28
+ <?php $this->setPriceDataObject($_item) ?>
29
+ <tr class="border">
30
+ <td><?php echo $this->getColumnHtml($_item, 'zakeke') ?></td>
31
+ <td class="a-right">
32
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
33
+ <span class="price-excl-tax">
34
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
35
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
36
+ <?php endif; ?>
37
+
38
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
39
+ <?php
40
+ echo $this->displayPrices(
41
+ $_item->getBasePrice() + $_item->getBaseWeeeTaxAppliedAmount() + $_item->getBaseWeeeTaxDisposition(),
42
+ $_item->getPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()
43
+ );
44
+ ?>
45
+ <?php else: ?>
46
+ <?php echo $this->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?>
47
+ <?php endif; ?>
48
+
49
+
50
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
51
+ <br/>
52
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
53
+ <small>
54
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
55
+ <span class="nobr"><?php echo $tax['title']; ?>
56
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
57
+ <?php endforeach; ?>
58
+ </small>
59
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
60
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
61
+ <span class="nobr"><small><?php echo $tax['title']; ?>
62
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></small></span>
63
+ <?php endforeach; ?>
64
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
65
+ <small>
66
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
67
+ <span class="nobr"><?php echo $tax['title']; ?>
68
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
69
+ <?php endforeach; ?>
70
+ </small>
71
+ <?php endif; ?>
72
+
73
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
74
+ <br/>
75
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br/>
76
+ <?php
77
+ echo $this->displayPrices(
78
+ $_item->getBasePrice() + $_item->getBaseWeeeTaxAppliedAmount() + $_item->getBaseWeeeTaxDisposition(),
79
+ $_item->getPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()
80
+ );
81
+ ?>
82
+ </span>
83
+ <?php endif; ?>
84
+ <?php endif; ?>
85
+ </span>
86
+ <br/>
87
+ <?php endif; ?>
88
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
89
+ <span class="price-incl-tax">
90
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
91
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
92
+ <?php endif; ?>
93
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
94
+ <?php $_baseIncl = $this->helper('checkout')->getBasePriceInclTax($_item); ?>
95
+
96
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
97
+ <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
98
+ <?php else: ?>
99
+ <?php echo $this->displayPrices($_baseIncl - $_item->getBaseWeeeTaxDisposition(), $_incl - $_item->getWeeeTaxDisposition()) ?>
100
+ <?php endif; ?>
101
+
102
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
103
+ <br/>
104
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
105
+ <small>
106
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
107
+ <span class="nobr"><?php echo $tax['title']; ?>
108
+ : <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
109
+ <?php endforeach; ?>
110
+ </small>
111
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
112
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
113
+ <span class="nobr"><small><?php echo $tax['title']; ?>
114
+ : <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></small></span>
115
+ <?php endforeach; ?>
116
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
117
+ <small>
118
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
119
+ <span class="nobr"><?php echo $tax['title']; ?>
120
+ : <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
121
+ <?php endforeach; ?>
122
+ </small>
123
+ <?php endif; ?>
124
+
125
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
126
+ <br/>
127
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
128
+ :<br/> <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
129
+ <?php endif; ?>
130
+ <?php endif; ?>
131
+ </span>
132
+ <?php endif; ?>
133
+
134
+ </td>
135
+ <td class="a-center"><?php echo $this->getColumnHtml($_item, 'qty') ?></td>
136
+ <td class="a-center">
137
+ <?php if ($this->canEditQty()) : ?>
138
+ <input type="text" class="input-text qty-input" name="invoice[items][<?php echo $_item->getOrderItemId() ?>]"
139
+ value="<?php echo $_item->getQty() * 1 ?>"/>
140
+ <?php else : ?>
141
+ <?php echo $_item->getQty() * 1 ?>
142
+ <?php endif; ?>
143
+ </td>
144
+ <td class="a-right">
145
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
146
+ <span class="price-excl-tax">
147
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
148
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
149
+ <?php endif; ?>
150
+
151
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
152
+ <?php
153
+ echo $this->displayPrices(
154
+ $_item->getBaseRowTotal() + $_item->getBaseWeeeTaxAppliedRowAmount() + $_item->getBaseWeeeTaxRowDisposition(),
155
+ $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()
156
+ );
157
+ ?>
158
+ <?php else: ?>
159
+ <?php echo $this->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
160
+ <?php endif; ?>
161
+
162
+
163
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
164
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
165
+ <small>
166
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
167
+ <span class="nobr"><?php echo $tax['title']; ?>
168
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
169
+ <?php endforeach; ?>
170
+ </small>
171
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
172
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
173
+ <span class="nobr"><small><?php echo $tax['title']; ?>
174
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></small></span>
175
+ <?php endforeach; ?>
176
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
177
+ <small>
178
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
179
+ <span class="nobr"><?php echo $tax['title']; ?>
180
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
181
+ <?php endforeach; ?>
182
+ </small>
183
+ <?php endif; ?>
184
+
185
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
186
+ <br/>
187
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br/>
188
+ <?php
189
+ echo $this->displayPrices(
190
+ $_item->getBaseRowTotal() + $_item->getBaseWeeeTaxAppliedRowAmount() + $_item->getBaseWeeeTaxRowDisposition(),
191
+ $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()
192
+ );
193
+ ?>
194
+ </span>
195
+ <?php endif; ?>
196
+ <?php endif; ?>
197
+ </span>
198
+ <br/>
199
+ <?php endif; ?>
200
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
201
+ <span class="price-incl-tax">
202
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
203
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
204
+ <?php endif; ?>
205
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
206
+ <?php $_baseIncl = $this->helper('checkout')->getBaseSubtotalInclTax($_item); ?>
207
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
208
+ <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseRowWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
209
+ <?php else: ?>
210
+ <?php echo $this->displayPrices($_baseIncl - $_item->getBaseWeeeTaxRowDisposition(), $_incl - $_item->getWeeeTaxRowDisposition()) ?>
211
+ <?php endif; ?>
212
+
213
+
214
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
215
+
216
+ <br/>
217
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
218
+ <small>
219
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
220
+ <span class="nobr"><?php echo $tax['title']; ?>
221
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
222
+ <?php endforeach; ?>
223
+ </small>
224
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
225
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
226
+ <span class="nobr"><small><?php echo $tax['title']; ?>
227
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></small></span>
228
+ <?php endforeach; ?>
229
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
230
+ <small>
231
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
232
+ <span class="nobr"><?php echo $tax['title']; ?>
233
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
234
+ <?php endforeach; ?>
235
+ </small>
236
+ <?php endif; ?>
237
+
238
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
239
+ <br/><span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
240
+ :<br/> <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseRowWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
241
+ <?php endif; ?>
242
+ <?php endif; ?>
243
+ </span>
244
+ <?php endif; ?>
245
+
246
+ </td>
247
+ <td class="a-right"><?php echo $this->displayPriceAttribute('tax_amount') ?></td>
248
+ <td class="a-right"><?php echo $this->displayPriceAttribute('discount_amount') ?></td>
249
+ <td class="a-right last">
250
+ <?php echo $this->displayPrices(
251
+ $_item->getBaseRowTotal() + $_item->getBaseTaxAmount() - $_item->getBaseDiscountAmount() + $_item->getBaseWeeeTaxAppliedRowAmount(),
252
+ $_item->getRowTotal() + $_item->getTaxAmount() - $_item->getDiscountAmount() + $_item->getWeeeTaxAppliedRowAmount()
253
+ ) ?>
254
+ </td>
255
+ </tr>
app/design/adminhtml/default/default/template/zakeke/sales/order/invoice/view/items/renderer/zakeke.phtml ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $_item = $this->getItem() ?>
28
+ <?php $this->setPriceDataObject($_item) ?>
29
+ <tr class="border">
30
+ <td><?php echo $this->getColumnHtml($_item, 'zakeke') ?></td>
31
+ <td class="a-right">
32
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
33
+ <span class="price-excl-tax">
34
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
35
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
36
+ <?php endif; ?>
37
+
38
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
39
+ <?php
40
+ echo $this->displayPrices(
41
+ $_item->getBasePrice() + $_item->getBaseWeeeTaxAppliedAmount() + $_item->getBaseWeeeTaxDisposition(),
42
+ $_item->getPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()
43
+ );
44
+ ?>
45
+ <?php else: ?>
46
+ <?php echo $this->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?>
47
+ <?php endif; ?>
48
+
49
+
50
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
51
+ <br/>
52
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
53
+ <small>
54
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
55
+ <span class="nobr"><?php echo $tax['title']; ?>
56
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
57
+ <?php endforeach; ?>
58
+ </small>
59
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
60
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
61
+ <span class="nobr"><small><?php echo $tax['title']; ?>
62
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></small></span>
63
+ <?php endforeach; ?>
64
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
65
+ <small>
66
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
67
+ <span class="nobr"><?php echo $tax['title']; ?>
68
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
69
+ <?php endforeach; ?>
70
+ </small>
71
+ <?php endif; ?>
72
+
73
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
74
+ <br/>
75
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br/>
76
+ <?php
77
+ echo $this->displayPrices(
78
+ $_item->getBasePrice() + $_item->getBaseWeeeTaxAppliedAmount() + $_item->getBaseWeeeTaxDisposition(),
79
+ $_item->getPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()
80
+ );
81
+ ?>
82
+ </span>
83
+ <?php endif; ?>
84
+ <?php endif; ?>
85
+ </span>
86
+ <br/>
87
+ <?php endif; ?>
88
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
89
+ <span class="price-incl-tax">
90
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
91
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
92
+ <?php endif; ?>
93
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
94
+ <?php $_baseIncl = $this->helper('checkout')->getBasePriceInclTax($_item); ?>
95
+
96
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
97
+ <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
98
+ <?php else: ?>
99
+ <?php echo $this->displayPrices($_baseIncl - $_item->getBaseWeeeTaxDisposition(), $_incl - $_item->getWeeeTaxDisposition()) ?>
100
+ <?php endif; ?>
101
+
102
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
103
+ <br/>
104
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
105
+ <small>
106
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
107
+ <span class="nobr"><?php echo $tax['title']; ?>
108
+ : <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
109
+ <?php endforeach; ?>
110
+ </small>
111
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
112
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
113
+ <span class="nobr"><small><?php echo $tax['title']; ?>
114
+ : <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></small></span>
115
+ <?php endforeach; ?>
116
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
117
+ <small>
118
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
119
+ <span class="nobr"><?php echo $tax['title']; ?>
120
+ : <?php echo $this->displayPrices($tax['base_amount_incl_tax'], $tax['amount_incl_tax']); ?></span>
121
+ <?php endforeach; ?>
122
+ </small>
123
+ <?php endif; ?>
124
+
125
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
126
+ <br/>
127
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
128
+ :<br/> <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
129
+ <?php endif; ?>
130
+ <?php endif; ?>
131
+ </span>
132
+ <?php endif; ?>
133
+
134
+ </td>
135
+ <td class="a-center"><?php echo $this->getColumnHtml($_item, 'qty') ?></td>
136
+ <td class="a-center">
137
+ <?php if ($this->canEditQty()) : ?>
138
+ <input type="text" class="input-text qty-input" name="invoice[items][<?php echo $_item->getOrderItemId() ?>]"
139
+ value="<?php echo $_item->getQty() * 1 ?>"/>
140
+ <?php else : ?>
141
+ <?php echo $_item->getQty() * 1 ?>
142
+ <?php endif; ?>
143
+ </td>
144
+ <td class="a-right">
145
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
146
+ <span class="price-excl-tax">
147
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
148
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
149
+ <?php endif; ?>
150
+
151
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
152
+ <?php
153
+ echo $this->displayPrices(
154
+ $_item->getBaseRowTotal() + $_item->getBaseWeeeTaxAppliedRowAmount() + $_item->getBaseWeeeTaxRowDisposition(),
155
+ $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()
156
+ );
157
+ ?>
158
+ <?php else: ?>
159
+ <?php echo $this->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
160
+ <?php endif; ?>
161
+
162
+
163
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
164
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
165
+ <small>
166
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
167
+ <span class="nobr"><?php echo $tax['title']; ?>
168
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
169
+ <?php endforeach; ?>
170
+ </small>
171
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
172
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
173
+ <span class="nobr"><small><?php echo $tax['title']; ?>
174
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></small></span>
175
+ <?php endforeach; ?>
176
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
177
+ <small>
178
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
179
+ <span class="nobr"><?php echo $tax['title']; ?>
180
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
181
+ <?php endforeach; ?>
182
+ </small>
183
+ <?php endif; ?>
184
+
185
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
186
+ <br/>
187
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br/>
188
+ <?php
189
+ echo $this->displayPrices(
190
+ $_item->getBaseRowTotal() + $_item->getBaseWeeeTaxAppliedRowAmount() + $_item->getBaseWeeeTaxRowDisposition(),
191
+ $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()
192
+ );
193
+ ?>
194
+ </span>
195
+ <?php endif; ?>
196
+ <?php endif; ?>
197
+ </span>
198
+ <br/>
199
+ <?php endif; ?>
200
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
201
+ <span class="price-incl-tax">
202
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
203
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
204
+ <?php endif; ?>
205
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
206
+ <?php $_baseIncl = $this->helper('checkout')->getBaseSubtotalInclTax($_item); ?>
207
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
208
+ <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseRowWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
209
+ <?php else: ?>
210
+ <?php echo $this->displayPrices($_baseIncl - $_item->getBaseWeeeTaxRowDisposition(), $_incl - $_item->getWeeeTaxRowDisposition()) ?>
211
+ <?php endif; ?>
212
+
213
+
214
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
215
+
216
+ <br/>
217
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
218
+ <small>
219
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
220
+ <span class="nobr"><?php echo $tax['title']; ?>
221
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
222
+ <?php endforeach; ?>
223
+ </small>
224
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
225
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
226
+ <span class="nobr"><small><?php echo $tax['title']; ?>
227
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></small></span>
228
+ <?php endforeach; ?>
229
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
230
+ <small>
231
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
232
+ <span class="nobr"><?php echo $tax['title']; ?>
233
+ : <?php echo $this->displayPrices($tax['base_row_amount_incl_tax'], $tax['row_amount_incl_tax']); ?></span>
234
+ <?php endforeach; ?>
235
+ </small>
236
+ <?php endif; ?>
237
+
238
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
239
+ <br/><span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
240
+ :<br/> <?php echo $this->displayPrices($_baseIncl + Mage::helper('weee')->getBaseRowWeeeTaxInclTax($_item), $_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
241
+ <?php endif; ?>
242
+ <?php endif; ?>
243
+ </span>
244
+ <?php endif; ?>
245
+ </td>
246
+ <td class="a-right"><?php echo $this->displayPriceAttribute('tax_amount') ?></td>
247
+ <td class="a-right"><?php echo $this->displayPriceAttribute('discount_amount') ?></td>
248
+ <td class="a-right last">
249
+ <?php echo $this->displayPrices(
250
+ $_item->getBaseRowTotal() + $_item->getBaseTaxAmount() - $_item->getBaseDiscountAmount() + $_item->getBaseWeeeTaxAppliedRowAmount(),
251
+ $_item->getRowTotal() + $_item->getTaxAmount() - $_item->getDiscountAmount() + $_item->getWeeeTaxAppliedRowAmount()
252
+ ) ?>
253
+ </td>
254
+ </tr>
app/design/adminhtml/default/default/template/zakeke/sales/order/view/items/renderer/zakeke.phtml ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_item = $this->getItem() ?>
2
+ <?php $this->setPriceDataObject($_item) ?>
3
+ <tr<?php if ($this->canDisplayGiftmessage()): ?> class="border"<?php endif; ?>>
4
+ <td class="giftmessage-single-item">
5
+ <?php if ($this->canDisplayContainer()): ?>
6
+ <div id="<?php echo $this->getHtmlId() ?>" class="item-container">
7
+ <?php endif; ?>
8
+ <div class="item-text">
9
+ <?php echo $this->getColumnHtml($_item, 'zakeke') ?>
10
+ </div>
11
+ <?php if ($this->canDisplayContainer()): ?>
12
+ </div>
13
+ <?php endif ?>
14
+ </td>
15
+ <td class="a-center"><?php echo $_item->getStatus() ?></td>
16
+ <td class="a-right"><?php echo $this->displayPriceAttribute('original_price') ?></td>
17
+ <td class="a-right">
18
+
19
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
20
+ <span class="price-excl-tax">
21
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
22
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
23
+ <?php endif; ?>
24
+
25
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
26
+ <?php
27
+ echo $this->displayPrices(
28
+ $_item->getBasePrice() + $_item->getBaseWeeeTaxAppliedAmount() + $_item->getBaseWeeeTaxDisposition(),
29
+ $_item->getPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()
30
+ );
31
+ ?>
32
+ <?php else: ?>
33
+ <?php echo $this->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?>
34
+ <?php endif; ?>
35
+
36
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
37
+ <br/>
38
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
39
+ <small>
40
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
41
+ <span class="nobr"><?php echo $tax['title']; ?>
42
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
43
+ <?php endforeach; ?>
44
+ </small>
45
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
46
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
47
+ <span class="nobr"><small><?php echo $tax['title']; ?>
48
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></small></span>
49
+ <?php endforeach; ?>
50
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
51
+ <small>
52
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
53
+ <span class="nobr"><?php echo $tax['title']; ?>
54
+ : <?php echo $this->displayPrices($tax['base_amount'], $tax['amount']); ?></span>
55
+ <?php endforeach; ?>
56
+ </small>
57
+ <?php endif; ?>
58
+
59
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
60
+ <br/>
61
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br/>
62
+ <?php
63
+ echo $this->displayPrices(
64
+ $_item->getBasePrice() + $_item->getBaseWeeeTaxAppliedAmount() + $_item->getBaseWeeeTaxDisposition(),
65
+ $_item->getPrice() + $_item->getWeeeTaxAppliedAmount() + $_item->getWeeeTaxDisposition()
66
+ );
67
+ ?>
68
+ </span>
69
+ <?php endif; ?>
70
+ <?php endif; ?>
71
+ </span>
72
+ <br/>
73
+ <?php endif; ?>
74
+
75
+ <?php if ($this->helper('tax')->displaySalesPriceInclTax() || $this->helper('tax')->displaySalesBothPrices()): ?>
76
+ <span class="price-incl-tax">
77
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
78
+ <span class="label"><?php echo $this->helper('tax')->__('Incl. Tax'); ?>:</span>
79
+ <?php endif; ?>
80
+ <?php $weeeTaxInclTax = Mage::helper('weee')->getWeeeTaxInclTax($_item); ?>
81
+ <?php if ($weeeTaxInclTax && Mage::helper('weee')->typeOfDisplay($_item, 0, 'sales')): // including ?>
82
+ <?php echo $this->helper('checkout')->formatPrice($this->helper('checkout')->getPriceInclTax($_item) + $weeeTaxInclTax); ?>
83
+ <?php elseif ($weeeTaxInclTax && Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): // incl. + weee ?>
84
+ <?php echo $this->helper('checkout')->formatPrice($this->helper('checkout')->getPriceInclTax($_item) + $weeeTaxInclTax); ?>
85
+ <br/>
86
+ <small>
87
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
88
+ <span class="nobr"><?php echo $tax['title']; ?>
89
+ : <?php echo Mage::helper('core')->currency($tax['amount_incl_tax'], true, true); ?></span>
90
+ <br/>
91
+ <?php endforeach; ?>
92
+ </small>
93
+ <?php elseif ($_item->getWeeeTaxAppliedAmount() && Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): // excl. + weee + final ?>
94
+ <?php echo $this->helper('checkout')->formatPrice($this->helper('checkout')->getPriceInclTax($_item)); ?>
95
+ <br/>
96
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
97
+ <span class="nobr"><small><?php echo $tax['title']; ?>
98
+ : <?php echo Mage::helper('core')->currency($tax['amount_incl_tax'], true, true); ?></small></span>
99
+ <br/>
100
+ <?php endforeach; ?>
101
+ <span class="nobr">
102
+ <?php echo Mage::helper('weee')->__('Total'); ?>:
103
+ <?php echo $this->helper('checkout')->formatPrice($this->helper('checkout')->getPriceInclTax($_item) + $weeeTaxInclTax); ?>
104
+ </span>
105
+ <?php else: // excl. ?>
106
+ <?php echo $this->helper('checkout')->formatPrice($this->helper('checkout')->getPriceInclTax($_item)); ?>
107
+ <?php endif; ?>
108
+ </span>
109
+ <?php endif; ?>
110
+ </td>
111
+ <td><?php echo $this->getColumnHtml($_item, 'qty') ?></td>
112
+
113
+ <td class="a-right">
114
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
115
+ <span class="price-excl-tax">
116
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
117
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
118
+ <?php endif; ?>
119
+
120
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales', $_item->getStoreId())): ?>
121
+ <?php
122
+ echo $this->displayPrices(
123
+ $_item->getBaseRowTotal() + $_item->getBaseWeeeTaxAppliedRowAmount() + $_item->getBaseWeeeTaxRowDisposition(),
124
+ $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()
125
+ );
126
+ ?>
127
+ <?php else: ?>
128
+ <?php echo $this->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
129
+ <?php endif; ?>
130
+
131
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
132
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales', $_item->getStoreId())): ?>
133
+ <small>
134
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
135
+ <span class="nobr"><?php echo $tax['title']; ?>
136
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
137
+ <?php endforeach; ?>
138
+ </small>
139
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
140
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
141
+ <span class="nobr"><small><?php echo $tax['title']; ?>
142
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></small></span>
143
+ <?php endforeach; ?>
144
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales', $_item->getStoreId())): ?>
145
+ <small>
146
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
147
+ <span class="nobr"><?php echo $tax['title']; ?>
148
+ : <?php echo $this->displayPrices($tax['base_row_amount'], $tax['row_amount']); ?></span>
149
+ <?php endforeach; ?>
150
+ </small>
151
+ <?php endif; ?>
152
+
153
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales', $_item->getStoreId())): ?>
154
+ <br/>
155
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br/>
156
+ <?php
157
+ echo $this->displayPrices(
158
+ $_item->getBaseRowTotal() + $_item->getBaseWeeeTaxAppliedRowAmount() + $_item->getBaseWeeeTaxRowDisposition(),
159
+ $_item->getRowTotal() + $_item->getWeeeTaxAppliedRowAmount() + $_item->getWeeeTaxRowDisposition()
160
+ );
161
+ ?>
162
+ </span>
163
+ <?php endif; ?>
164
+ <?php endif; ?>
165
+ </span>
166
+ <br/>
167
+ <?php endif; ?>
168
+
169
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
170
+ <span class="price-incl-tax">
171
+
172
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
173
+ <span class="label"><?php echo $this->helper('tax')->__('Incl. Tax'); ?>:</span>
174
+ <?php endif; ?>
175
+
176
+ <?php if ($_item->getWeeeTaxAppliedRowAmount() && Mage::helper('weee')->typeOfDisplay($_item, 0, 'sales')): // including ?>
177
+ <?php echo $this->helper('checkout')->formatPrice($this->helper('checkout')->getSubtotalInclTax($_item) + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
178
+ <?php elseif ($_item->getWeeeTaxAppliedRowAmount() && Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): // incl. + weee ?>
179
+ <?php echo $this->helper('checkout')->formatPrice($this->helper('checkout')->getSubtotalInclTax($_item) + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
180
+ <br/>
181
+ <small>
182
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
183
+ <span class="nobr"><?php echo $tax['title']; ?>
184
+ : <?php echo Mage::helper('core')->currency($tax['row_amount_incl_tax'], true, true); ?></span>
185
+ <br/>
186
+ <?php endforeach; ?>
187
+ </small>
188
+ <?php elseif ($_item->getWeeeTaxAppliedRowAmount() && Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): // excl. + weee + final ?>
189
+ <?php echo $this->helper('checkout')->formatPrice($this->helper('checkout')->getSubtotalInclTax($_item)); ?>
190
+ <br/>
191
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
192
+ <span class="nobr"><small><?php echo $tax['title']; ?>
193
+ : <?php echo Mage::helper('core')->currency($tax['row_amount_incl_tax'], true, true); ?></small></span>
194
+ <br/>
195
+ <?php endforeach; ?>
196
+ <span class="nobr">
197
+ <?php echo Mage::helper('weee')->__('Total'); ?>:
198
+ <?php echo $this->helper('checkout')->formatPrice($this->helper('checkout')->getSubtotalInclTax($_item) + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
199
+ </span>
200
+ <?php else: // excl. ?>
201
+ <?php echo $this->displaySubtotalInclTax($_item); ?>
202
+ <?php endif; ?>
203
+
204
+ <!--
205
+
206
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
207
+ <span class="label"><?php echo $this->helper('tax')->__('Incl. Tax'); ?>:</span>
208
+ <?php endif; ?>
209
+ <?php echo $this->displaySubtotalInclTax($_item); ?>
210
+ -->
211
+ </span>
212
+ <?php endif; ?>
213
+ </td>
214
+ <td class="a-right"><?php echo $this->displayPriceAttribute('tax_amount') ?></td>
215
+ <td class="a-right"><?php echo $this->displayTaxPercent($_item) ?></td>
216
+ <td class="a-right"><?php echo $this->displayPriceAttribute('discount_amount') ?></td>
217
+ <td class="a-right last">
218
+ <?php echo $this->displayPrices(
219
+ $_item->getBaseRowTotal() - $_item->getBaseDiscountAmount() + $_item->getBaseTaxAmount() + $_item->getBaseHiddenTaxAmount() + $_item->getBaseWeeeTaxAppliedRowAmount(),
220
+ $_item->getRowTotal() - $_item->getDiscountAmount() + $_item->getTaxAmount() + $_item->getHiddenTaxAmount() + $_item->getWeeeTaxAppliedRowAmount()
221
+ ); ?>
222
+ </td>
223
+ </tr>
app/design/frontend/base/default/layout/zakeke.xml ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /*******************************************************
4
+ * Copyright (C) 2016 FutureNext SRL
5
+ *
6
+ * This file is part of Zakeke.
7
+ *
8
+ * Zakeke can not be copied and/or distributed without the express
9
+ * permission of FutureNext SRL
10
+ *******************************************************/
11
+ -->
12
+ <layout version="0.1.0">
13
+ <default>
14
+ <reference name="minicart_head">
15
+ <action method="addItemRender">
16
+ <type>zakeke</type>
17
+ <block>futurenext_zakeke/cartItemRenderer</block>
18
+ <template>zakeke/cart/minicart.phtml</template>
19
+ </action>
20
+ </reference>
21
+ <reference name="cart_sidebar">
22
+ <action method="addItemRender">
23
+ <type>zakeke</type>
24
+ <block>futurenext_zakeke/cartItemRenderer</block>
25
+ <template>zakeke/cart/minicart.phtml</template>
26
+ </action>
27
+ </reference>
28
+ <reference name="minicart_content">
29
+ <action method="addItemRender">
30
+ <type>zakeke</type>
31
+ <block>futurenext_zakeke/cartItemRenderer</block>
32
+ <template>zakeke/cart/minicart.phtml</template>
33
+ </action>
34
+ </reference>
35
+ <reference name="head">
36
+ <action method="addItem">
37
+ <type>skin_js</type>
38
+ <name>js/zakeke/preview.js</name>
39
+ </action>
40
+ </reference>
41
+ </default>
42
+
43
+ <customer_account>
44
+ <reference name="cart_sidebar">
45
+ <action method="addItemRender">
46
+ <type>zakeke</type>
47
+ <block>futurenext_zakeke/cartItemRenderer</block>
48
+ <template>zakeke/cart/minicart.phtml</template>
49
+ </action>
50
+ </reference>
51
+ </customer_account>
52
+
53
+ <checkout_cart_index>
54
+ <reference name="checkout.cart">
55
+ <action method="addItemRender">
56
+ <type>zakeke</type>
57
+ <block>futurenext_zakeke/cartItemRenderer</block>
58
+ <template>zakeke/cart/item/default.phtml</template>
59
+ </action>
60
+ </reference>
61
+ </checkout_cart_index>
62
+
63
+ <catalog_product_view>
64
+ <reference name="head">
65
+ <action method="addItem">
66
+ <type>skin_css</type>
67
+ <name>css/zakeke/productview.css</name>
68
+ </action>
69
+ </reference>
70
+ <reference name="product.info.addtocart">
71
+ <block type="futurenext_zakeke/customizeButton"
72
+ name="zakeke.customize.button"
73
+ template="zakeke/customizeButton.phtml"/>
74
+ </reference>
75
+ </catalog_product_view>
76
+
77
+ <checkout_onepage_review>
78
+ <reference name="root">
79
+ <action method="addItemRender">
80
+ <type>zakeke</type>
81
+ <block>futurenext_zakeke/checkoutItemRenderer</block>
82
+ <template>zakeke/checkout/onepage/review/item.phtml</template></action>
83
+ </reference>
84
+ </checkout_onepage_review>
85
+
86
+ <sales_order_view>
87
+ <reference name="order_items">
88
+ <action method="addItemRender">
89
+ <type>zakeke</type>
90
+ <block>futurenext_zakeke/salesItemRenderer</block>
91
+ <template>zakeke/sales/order/items/renderer/zakeke.phtml</template>
92
+ </action>
93
+ </reference>
94
+ </sales_order_view>
95
+
96
+ <futurenext_zakeke_customize_add>
97
+ <reference name="root">
98
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
99
+ </reference>
100
+ <reference name="head">
101
+ <action method="addJs"><script>zakeke/jquery.js</script></action>
102
+ <action method="addJs"><script>zakeke/customize.js</script></action>
103
+ </reference>
104
+ <reference name="content">
105
+ <block type="futurenext_zakeke/customize_add"
106
+ name="zakeke.customize.add"
107
+ template="zakeke/customize.phtml"/>
108
+ </reference>
109
+ </futurenext_zakeke_customize_add>
110
+
111
+ <futurenext_zakeke_customize_configure>
112
+ <reference name="root">
113
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
114
+ </reference>
115
+ <reference name="head">
116
+ <action method="addJs"><script>zakeke/jquery.js</script></action>
117
+ <action method="addJs"><script>zakeke/customize.js</script></action>
118
+ </reference>
119
+ <reference name="content">
120
+ <block type="futurenext_zakeke/customize_configure"
121
+ name="zakeke.customize.configure"
122
+ template="zakeke/customize.phtml"/>
123
+ </reference>
124
+ </futurenext_zakeke_customize_configure>
125
+
126
+ </layout>
app/design/frontend/base/default/template/zakeke/cart/item/default.phtml ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+ /** @var Futurenext_Zakeke_Block_CartItemRenderer $this */
12
+ ?>
13
+ <?php
14
+ $_item = $this->getItem();
15
+ $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
16
+ $canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
17
+ $zakekePreviews = $this->getZakekePreviews();
18
+ if ($zakekePreviews) {
19
+ $principalImagePreviewUrl = $zakekePreviews[0]->url;
20
+ } else {
21
+ $principalImagePreviewUrl = '';
22
+ }
23
+ ?>
24
+ <tr>
25
+ <td><?php if ($this->hasProductUrl()):?><a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><?php endif;?><img src="<?php echo $this->quoteEscape($principalImagePreviewUrl); ?>" width="75" height="75" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /><?php if ($this->hasProductUrl()):?></a><?php endif;?></td>
26
+ <td>
27
+ <h2 class="product-name">
28
+ <?php if ($this->hasProductUrl()):?>
29
+ <a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->escapeHtml($this->getProductName()) ?></a>
30
+ <?php else: ?>
31
+ <?php echo $this->escapeHtml($this->getProductName()) ?>
32
+ <?php endif; ?>
33
+ </h2>
34
+ <?php if ($_options = $this->getOptionList()):?>
35
+ <dl class="item-options">
36
+ <?php foreach ($_options as $_option) : ?>
37
+ <?php if (isset($_option['is_zakeke'])) continue; ?>
38
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
39
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
40
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
41
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
42
+ <div class="truncated_full_value">
43
+ <dl class="item-options">
44
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
45
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
46
+ </dl>
47
+ </div>
48
+ <?php endif; ?>
49
+ </dd>
50
+ <?php endforeach; ?>
51
+ </dl>
52
+ <?php endif;?>
53
+ <?php if ($messages = $this->getMessages()): ?>
54
+ <?php foreach ($messages as $message): ?>
55
+ <p class="item-msg <?php echo $message['type'] ?>">* <?php echo $this->escapeHtml($message['text']) ?></p>
56
+ <?php endforeach; ?>
57
+ <?php endif; ?>
58
+ <?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
59
+ <?php if ($addInfoBlock): ?>
60
+ <?php echo $addInfoBlock->setItem($_item)->toHtml() ?>
61
+ <?php endif;?>
62
+ </td>
63
+ <td class="a-center">
64
+ <?php if ($isVisibleProduct): ?>
65
+ <a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Edit item parameters')) ?>"><?php echo $this->__('Edit') ?></a>
66
+ <?php endif ?>
67
+ </td>
68
+ <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
69
+ <td class="a-center">
70
+ <?php if ($isVisibleProduct): ?>
71
+ <a href="<?php echo $this->helper('wishlist')->getMoveFromCartUrl($_item->getId()); ?>" class="link-wishlist use-ajax"><?php echo $this->__('Move'); ?></a>
72
+ <?php endif ?>
73
+ </td>
74
+ <?php endif ?>
75
+
76
+ <?php if ($canApplyMsrp): ?>
77
+ <td class="a-right"<?php if ($this->helper('tax')->displayCartBothPrices()): ?> colspan="2"<?php endif; ?>>
78
+ <span class="cart-price">
79
+ <span class="cart-msrp-unit"><?php echo $this->__('See price before order confirmation.'); ?></span>
80
+ <?php $helpLinkId = 'cart-msrp-help-' . $_item->getId(); ?>
81
+ <a id="<?php echo $helpLinkId ?>" href="#" class="map-help-link"><?php echo $this->__("What's this?"); ?></a>
82
+ <script type="text/javascript">
83
+ Catalog.Map.addHelpLink($('<?php echo $helpLinkId ?>'), "<?php echo $this->__("What's this?") ?>");
84
+ </script>
85
+ </span>
86
+ </td>
87
+ <?php else: ?>
88
+
89
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
90
+ <td class="a-right">
91
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
92
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
93
+ <?php else: ?>
94
+ <span class="cart-price">
95
+ <?php endif; ?>
96
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
97
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
98
+ <?php else: ?>
99
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
100
+ <?php endif; ?>
101
+
102
+ </span>
103
+
104
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
105
+
106
+ <div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
107
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
108
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
109
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
110
+ <?php endforeach; ?>
111
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
112
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
113
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
114
+ <?php endforeach; ?>
115
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
116
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
117
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
118
+ <?php endforeach; ?>
119
+ <?php endif; ?>
120
+ </div>
121
+
122
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
123
+ <div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
124
+ <span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
125
+ </div>
126
+ <?php endif; ?>
127
+ <?php endif; ?>
128
+ </td>
129
+ <?php endif; ?><!-- inclusive price starts here -->
130
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
131
+ <td>
132
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
133
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
134
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
135
+ <?php else: ?>
136
+ <span class="cart-price">
137
+ <?php endif; ?>
138
+
139
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
140
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
141
+ <?php else: ?>
142
+ <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
143
+ <?php endif; ?>
144
+
145
+ </span>
146
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
147
+
148
+ <div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
149
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
150
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
151
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
152
+ <?php endforeach; ?>
153
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
154
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
155
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
156
+ <?php endforeach; ?>
157
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
158
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
159
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
160
+ <?php endforeach; ?>
161
+ <?php endif; ?>
162
+ </div>
163
+
164
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
165
+ <div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
166
+ <span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
167
+ </div>
168
+ <?php endif; ?>
169
+ <?php endif; ?>
170
+ </td>
171
+ <?php endif; ?>
172
+ <?php endif; ?>
173
+ <td class="a-center">
174
+ <input name="cart[<?php echo $_item->getId() ?>][qty]"
175
+ data-cart-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>"
176
+ value="<?php echo $this->getQty() ?>" size="4" title="<?php echo $this->__('Qty') ?>" class="input-text qty" maxlength="12" />
177
+ </td>
178
+
179
+ <!--Sub total starts here -->
180
+ <?php if (($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
181
+ <td class="a-right">
182
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
183
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
184
+ <?php else: ?>
185
+ <span class="cart-price">
186
+ <?php endif; ?>
187
+
188
+ <?php if ($canApplyMsrp): ?>
189
+ <span class="cart-msrp-subtotal">--</span>
190
+ <?php else: ?>
191
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
192
+ <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
193
+ <?php else: ?>
194
+ <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>
195
+ <?php endif; ?>
196
+ <?php endif; ?>
197
+
198
+ </span>
199
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
200
+
201
+ <div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
202
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
203
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
204
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
205
+ <?php endforeach; ?>
206
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
207
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
208
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
209
+ <?php endforeach; ?>
210
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
211
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
212
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
213
+ <?php endforeach; ?>
214
+ <?php endif; ?>
215
+ </div>
216
+
217
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
218
+ <div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
219
+ <span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
220
+ </div>
221
+ <?php endif; ?>
222
+ <?php endif; ?>
223
+ </td>
224
+ <?php endif; ?>
225
+ <?php if (($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
226
+ <td>
227
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
228
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
229
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
230
+ <?php else: ?>
231
+ <span class="cart-price">
232
+ <?php endif; ?>
233
+
234
+ <?php if ($canApplyMsrp): ?>
235
+ <span class="cart-msrp-subtotal">--</span>
236
+ <?php else: ?>
237
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
238
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
239
+ <?php else: ?>
240
+ <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
241
+ <?php endif; ?>
242
+ <?php endif; ?>
243
+
244
+ </span>
245
+
246
+
247
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
248
+
249
+ <div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
250
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
251
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
252
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
253
+ <?php endforeach; ?>
254
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
255
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
256
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
257
+ <?php endforeach; ?>
258
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
259
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
260
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
261
+ <?php endforeach; ?>
262
+ <?php endif; ?>
263
+ </div>
264
+
265
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
266
+ <div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
267
+ <span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
268
+ </div>
269
+ <?php endif; ?>
270
+ <?php endif; ?>
271
+ </td>
272
+ <?php endif; ?>
273
+ <td class="a-center"><a href="<?php echo $this->getDeleteUrl()?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Remove item')) ?>" class="btn-remove btn-remove2"><?php echo $this->__('Remove item')?></a></td>
274
+ </tr>
app/design/frontend/base/default/template/zakeke/cart/minicart.phtml ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+ /** @var Futurenext_Zakeke_Block_CartItemRenderer $this */
12
+ ?>
13
+
14
+ <?php
15
+ $_item = $this->getItem();
16
+ $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
17
+ $canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
18
+ $zakekePreviews = $this->getZakekePreviews();
19
+ if ($zakekePreviews) {
20
+ $principalImagePreviewUrl = $zakekePreviews[0]->url;
21
+ } else {
22
+ $principalImagePreviewUrl = '';
23
+ }
24
+ ?>
25
+ <li class="item" xmlns="http://www.w3.org/1999/html">
26
+ <?php if ($this->hasProductUrl()): ?>
27
+ <a href="<?php echo $this->getProductUrl()?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><img src="<?php echo $this->quoteEscape($principalImagePreview->url); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></a>
28
+ <?php else: ?>
29
+ <span class="product-image"><img src="<?php echo $this->quoteEscape($principalImagePreviewUrl); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></span>
30
+ <?php endif; ?>
31
+ <div class="product-details">
32
+ <p class="product-name"><?php if ($this->hasProductUrl()): ?><a href="<?php echo $this->getProductUrl() ?>"><?php endif; ?><?php echo $this->escapeHtml($this->getProductName()) ?><?php if ($this->hasProductUrl()): ?></a><?php endif; ?></p>
33
+
34
+ <table class="info-wrapper">
35
+ <tbody>
36
+ <tr>
37
+ <th><?php echo $this->__('Price'); ?></th>
38
+ <td>
39
+ <?php if ($canApplyMsrp): ?>
40
+
41
+ <span class="map-cart-sidebar-item"><?php echo $this->__('See price before order confirmation.'); ?></span>
42
+
43
+ <?php else: ?>
44
+
45
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
46
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
47
+ <?php echo $this->__('Excl. Tax'); ?>:
48
+ <?php endif; ?>
49
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
50
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
51
+ <?php else: ?>
52
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
53
+ <?php endif; ?>
54
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
55
+ <br />
56
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
57
+ <small>
58
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
59
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
60
+ <?php endforeach; ?>
61
+ </small>
62
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
63
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
64
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
65
+ <?php endforeach; ?>
66
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
67
+ <small>
68
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
69
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
70
+ <?php endforeach; ?>
71
+ </small>
72
+ <?php endif; ?>
73
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
74
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
75
+ <?php endif; ?>
76
+ <?php endif; ?>
77
+ <?php endif; ?>
78
+
79
+
80
+
81
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
82
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
83
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
84
+ <br /><?php echo $this->__('Incl. Tax'); ?>:
85
+ <?php endif; ?>
86
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
87
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
88
+ <?php else: ?>
89
+ <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
90
+ <?php endif; ?>
91
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
92
+ <br />
93
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
94
+ <small>
95
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
96
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
97
+ <?php endforeach; ?>
98
+ </small>
99
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
100
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
101
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span>
102
+ <?php endforeach; ?>
103
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
104
+ <small>
105
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
106
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
107
+ <?php endforeach; ?>
108
+ </small>
109
+ <?php endif; ?>
110
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
111
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
112
+ <?php endif; ?>
113
+ <?php endif; ?>
114
+ <?php endif; ?>
115
+
116
+ <?php endif; //Can apply MSRP ?>
117
+ </td>
118
+ </tr>
119
+ <tr class="qty-wrapper">
120
+ <th><?php echo $this->__('Qty'); ?></th>
121
+ <td>
122
+ <input
123
+ id="qinput-<?php echo $_item->getId(); ?>"
124
+ data-link="<?php echo $this->getAjaxUpdateUrl() ?>"
125
+ data-item-id="<?php echo $_item->getId(); ?>"
126
+ data-cart-item-id="<?php echo $_item->getSku(); ?>"
127
+ class="qty cart-item-quantity input-text" name=""
128
+ value="<?php echo $this->getQty()?>"
129
+ <?php if ($this->isOnCheckoutPage()) echo 'disabled'; ?>
130
+ />
131
+
132
+ <button id="qbutton-<?php echo $_item->getId(); ?>"
133
+ data-item-id="<?php echo $_item->getId(); ?>"
134
+ disabled="disabled"
135
+ data-update
136
+ data-cart-item-update
137
+ class="button quantity-button">
138
+ <?php echo $this->__('ok'); ?>
139
+ </button>
140
+ </td>
141
+ </tr>
142
+ </tbody>
143
+ </table>
144
+
145
+ <?php if ($isVisibleProduct): ?>
146
+ <a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Edit item')) ?>" class="btn-edit">
147
+ <?php echo $this->__('Edit item')?>
148
+ </a>
149
+ |
150
+ <?php if (!$this->isOnCheckoutPage()): ?>
151
+ <a href="<?php echo $this->getAjaxDeleteUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Remove This Item')) ?>"
152
+ data-confirm="<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>"
153
+ class="remove">
154
+ <?php echo $this->__('Remove Item') ?>
155
+ </a>
156
+ <?php else: ?>
157
+ <span><?php echo $this->__('Remove Item') ?></span>
158
+ <?php endif; ?>
159
+ <?php endif ?>
160
+
161
+
162
+
163
+ <?php if ($_options = $this->getOptionList()):?>
164
+ <div class="truncated">
165
+ <div class="truncated_full_value">
166
+ <dl class="item-options">
167
+ <?php foreach ($_options as $_option) : ?>
168
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
169
+ <dd>
170
+ <?php if (is_array($_option['value'])): ?>
171
+ <?php echo nl2br(implode("\n", $_option['value'])) ?>
172
+ <?php else: ?>
173
+ <?php echo $_option['value'] ?>
174
+ <?php endif; ?>
175
+ </dd>
176
+ <?php endforeach; ?>
177
+ </dl>
178
+ </div>
179
+ <a href="#" onclick="return false;" class="details"><?php echo $this->__('Details') ?></a>
180
+ </div>
181
+ <?php endif; ?>
182
+
183
+ </div>
184
+ </li>
app/design/frontend/base/default/template/zakeke/checkout/onepage/review/item.phtml ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+ $_item = $this->getItem();
12
+ $_zakekePreviews = $this->getZakekePreviews();
13
+ ?>
14
+ <tr>
15
+ <td><h3 class="product-name"><?php echo $this->escapeHtml($this->getProductName()) ?></h3>
16
+ <div class="zakeke-preview">
17
+ <div style="display: flex">
18
+ <?php foreach ($_zakekePreviews as $preview): ?>
19
+ <div data-zakeke-label="<?php echo $this->quoteEscape($preview->label) ?>" style="position: relative; width: 180px; height: 180px; overflow: hidden; cursor: pointer; margin: 0px;"
20
+ onclick="zakekeShowPreview(this); return false;">
21
+ <img src="<?php echo $this->quoteEscape($preview->url) ?>" style="width: 180px">
22
+ </div>
23
+ <?php endforeach; ?>
24
+ </div>
25
+ </div>
26
+ <?php if ($_options = $this->getOptionList()):?>
27
+ <dl class="item-options">
28
+ <?php foreach ($_options as $_option) : ?>
29
+ <?php if (isset($_option['is_zakeke'])) continue; ?>
30
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
31
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
32
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
33
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
34
+ <div class="truncated_full_value">
35
+ <dl class="item-options">
36
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
37
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
38
+ </dl>
39
+ </div>
40
+ <?php endif; ?>
41
+ </dd>
42
+ <?php endforeach; ?>
43
+ </dl>
44
+ <?php endif;?>
45
+ <?php if ($addtInfoBlock = $this->getProductAdditionalInformationBlock()):?>
46
+ <?php echo $addtInfoBlock->setItem($_item)->toHtml() ?>
47
+ <?php endif;?>
48
+ </td>
49
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
50
+ <td class="a-right">
51
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
52
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
53
+ <?php else: ?>
54
+ <span class="cart-price">
55
+ <?php endif; ?>
56
+
57
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
58
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
59
+ <?php else: ?>
60
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
61
+ <?php endif; ?>
62
+
63
+ </span>
64
+
65
+
66
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
67
+
68
+ <div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
69
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
70
+ <small>
71
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
72
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
73
+ <?php endforeach; ?>
74
+ </small>
75
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
76
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
77
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></small></span><br />
78
+ <?php endforeach; ?>
79
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
80
+ <small>
81
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
82
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
83
+ <?php endforeach; ?>
84
+ </small>
85
+ <?php endif; ?>
86
+ </div>
87
+
88
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
89
+ <div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
90
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
91
+ </div>
92
+ <?php endif; ?>
93
+ <?php endif; ?>
94
+ </td>
95
+ <?php endif; ?>
96
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
97
+ <td>
98
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
99
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
100
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
101
+ <?php else: ?>
102
+ <span class="cart-price">
103
+ <?php endif; ?>
104
+
105
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
106
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
107
+ <?php else: ?>
108
+ <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
109
+ <?php endif; ?>
110
+
111
+ </span>
112
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
113
+
114
+ <div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
115
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
116
+ <small>
117
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
118
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
119
+ <?php endforeach; ?>
120
+ </small>
121
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
122
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
123
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
124
+ <?php endforeach; ?>
125
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
126
+ <small>
127
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
128
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
129
+ <?php endforeach; ?>
130
+ </small>
131
+ <?php endif; ?>
132
+ </div>
133
+
134
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
135
+ <div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
136
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
137
+ </div>
138
+ <?php endif; ?>
139
+ <?php endif; ?>
140
+ </td>
141
+ <?php endif; ?>
142
+ <td class="a-center"><?php echo $_item->getQty() ?></td>
143
+ <!-- sub total starts here -->
144
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
145
+ <td class="a-right">
146
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
147
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
148
+ <?php else: ?>
149
+ <span class="cart-price">
150
+ <?php endif; ?>
151
+
152
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
153
+ <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
154
+ <?php else: ?>
155
+ <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>
156
+ <?php endif; ?>
157
+
158
+ </span>
159
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
160
+
161
+ <div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
162
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
163
+ <small>
164
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
165
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span><br />
166
+ <?php endforeach; ?>
167
+ </small>
168
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
169
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
170
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></small></span><br />
171
+ <?php endforeach; ?>
172
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
173
+ <small>
174
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
175
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span><br />
176
+ <?php endforeach; ?>
177
+ </small>
178
+ <?php endif; ?>
179
+ </div>
180
+
181
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
182
+ <div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
183
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
184
+ </div>
185
+ <?php endif; ?>
186
+ <?php endif; ?>
187
+ </td>
188
+ <?php endif; ?>
189
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
190
+ <td>
191
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
192
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
193
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
194
+ <?php else: ?>
195
+ <span class="cart-price">
196
+ <?php endif; ?>
197
+
198
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
199
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
200
+ <?php else: ?>
201
+ <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
202
+ <?php endif; ?>
203
+
204
+ </span>
205
+
206
+
207
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
208
+
209
+ <div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
210
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
211
+ <small>
212
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
213
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
214
+ <?php endforeach; ?>
215
+ </small>
216
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
217
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
218
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
219
+ <?php endforeach; ?>
220
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
221
+ <small>
222
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
223
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
224
+ <?php endforeach; ?>
225
+ </small>
226
+ <?php endif; ?>
227
+ </div>
228
+
229
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
230
+ <div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
231
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
232
+ </div>
233
+ <?php endif; ?>
234
+ <?php endif; ?>
235
+ </td>
236
+ <?php endif; ?>
237
+ </tr>
app/design/frontend/base/default/template/zakeke/customization/add.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+ /** @var Futurenext_Zakeke_Block_Customize_Add $this */
12
+ ?>
13
+
14
+ <?php if ($this->isProductCustomizable()): ?>
15
+ <div id="zakeke-container"></div>
16
+
17
+ <form id="zakeke-addtocart" style="display: none">
18
+ </form>
19
+
20
+ <script type="application/javascript">
21
+ zakekeCustomizationAdd(<?php /* @escapeNotVerified */ echo $this->getJsonConfig() ?>);
22
+ </script>
23
+ <?php endif; ?>
app/design/frontend/base/default/template/zakeke/customize.phtml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+ /** @var Futurenext_Zakeke_Block_Customize $this */
12
+ ?>
13
+
14
+ <?php if ($this->isProductCustomizable()): ?>
15
+ <div id="zakeke-container">
16
+ <?php echo $this->iframeHtml() ?>
17
+ </div>
18
+
19
+ <form id="zakeke-addtocart" style="display: none">
20
+ </form>
21
+
22
+ <script type="application/javascript">
23
+ zakekeCustomizationAdd(<?php echo $this->getJsonConfig() ?>);
24
+ </script>
25
+ <?php endif; ?>
app/design/frontend/base/default/template/zakeke/customizeButton.phtml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************
3
+ * Copyright (C) 2016 FutureNext SRL
4
+ *
5
+ * This file is part of Zakeke.
6
+ *
7
+ * Zakeke can not be copied and/or distributed without the express
8
+ * permission of FutureNext SRL
9
+ *******************************************************/
10
+
11
+ /** @var Futurenext_Zakeke_Block_CustomizeButton $this */
12
+ ?>
13
+
14
+ <?php if ($this->isProductCustomizable()): ?>
15
+ <button id="zakeke-customize-button" class="button">
16
+ <span><?php /* @escapeNotVerified */ echo $this->__('Customize') ?></span>
17
+ </button>
18
+
19
+ <script type="application/javascript">
20
+ (function (config) {
21
+ 'use strict';
22
+
23
+ var zakekeButton = window.document.getElementById('zakeke-customize-button'),
24
+ addtoCartForm = window.document.getElementById('product_addtocart_form'),
25
+ observer = new MutationObserver(function() {
26
+ zakekeButton.removeAttribute('onclick');
27
+ });
28
+
29
+ observer.observe(zakekeButton, {
30
+ attributes: true,
31
+ attributeFilter: ['onclick'],
32
+ attributeOldValue: false,
33
+ childList: false,
34
+ characterData: false
35
+ });
36
+
37
+ zakekeButton.addEventListener('click', function (event) {
38
+ var cartForm = new VarienForm('product_addtocart_form');
39
+ if (zakekeButton.disabled || (cartForm && !cartForm.validator.validate())) {
40
+ event.preventDefault();
41
+ return false;
42
+ }
43
+
44
+ zakekeButton.disabled = true;
45
+ addtoCartForm.action = config.customizeUrl;
46
+ addtoCartForm.submit();
47
+
48
+ event.preventDefault();
49
+ }, true);
50
+ })(<?php echo $this->getJsonConfig() ?>);
51
+ </script>
52
+ <?php endif; ?>
app/design/frontend/base/default/template/zakeke/sales/order/items/renderer/zakeke.phtml ADDED
@@ -0,0 +1,349 @@