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 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_SalesItemRenderer $this */
12
+ ?>
13
+ <?php
14
+ $_item = $this->getItem();
15
+ $_zakekePreviews = $this->getZakekePreviews();
16
+ ?>
17
+ <tr class="border" id="order-item-row-<?php echo $_item->getId() ?>">
18
+ <td><h3 class="product-name"><?php echo $this->escapeHtml($_item->getName()) ?></h3>
19
+ <div class="zakeke-preview">
20
+ <div style="display: flex">
21
+ <?php foreach ($_zakekePreviews as $preview): ?>
22
+ <div data-zakeke-label="<?php echo $this->quoteEscape($preview->label) ?>" style="position: relative; max-height: 186px; overflow: hidden; cursor: pointer; margin: 0px;"
23
+ onclick="zakekeShowPreview(this); return false;">
24
+ <img src="<?php echo $this->quoteEscape($preview->url) ?>" style="width: 180px">
25
+ </div>
26
+ <?php endforeach; ?>
27
+ </div>
28
+ </div>
29
+ <?php if ($_options = $this->getItemOptions()): ?>
30
+ <dl class="item-options">
31
+ <?php foreach ($_options as $_option) : ?>
32
+ <?php if (isset($_option['is_zakeke'])) continue; ?>
33
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
34
+ <?php if (!$this->getPrintStatus()): ?>
35
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
36
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>>
37
+ <?php echo $_formatedOptionValue['value'] ?>
38
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
39
+ <div class="truncated_full_value">
40
+ <dl class="item-options">
41
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
42
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
43
+ </dl>
44
+ </div>
45
+ <?php endif; ?>
46
+ </dd>
47
+ <?php else: ?>
48
+ <dd><?php echo $this->escapeHtml((isset($_option['print_value']) ? $_option['print_value'] : $_option['value'])) ?></dd>
49
+ <?php endif; ?>
50
+ <?php endforeach; ?>
51
+ </dl>
52
+ <?php endif; ?>
53
+
54
+ <?php echo $this->escapeHtml($_item->getDescription()) ?>
55
+ <?php if ($this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?>
56
+ <br/><a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>"
57
+ class="giftmessage-preview-link expand"
58
+ onclick="return giftMessageToogle('<?php echo $_item->getId() ?>')"><?php echo $this->__('Gift Message') ?></a>
59
+ <?php endif; ?>
60
+ </td>
61
+ <td><?php echo $this->escapeHtml(Mage::helper('core/string')->splitInjection($this->getSku())) ?></td>
62
+
63
+ <td class="a-right nowrap">
64
+ <?php if ($this->helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
65
+ <span class="price-excl-tax">
66
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
67
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
68
+ <span class="cart-price">
69
+ <?php endif; ?>
70
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
71
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
72
+ </span>
73
+ <?php endif; ?>
74
+ <?php endif; ?>
75
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
76
+ <span class="cart-tax-total"
77
+ onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
78
+ <?php else: ?>
79
+ <span class="cart-price">
80
+ <?php endif; ?>
81
+
82
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
83
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice() + $this->getItem()->getWeeeTaxAppliedAmount() + $this->getItem()->getWeeeTaxDisposition()); ?>
84
+ <?php else: ?>
85
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()) ?>
86
+ <?php endif; ?>
87
+ </span>
88
+
89
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
90
+
91
+ <span class="cart-tax-info" id="eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>"
92
+ style="display:none;">
93
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
94
+ <small>
95
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
96
+ <span class="nobr"><?php echo $tax['title']; ?>
97
+ : <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
98
+ <?php endforeach; ?>
99
+ </small>
100
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
101
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
102
+ <span class="nobr"><small><?php echo $tax['title']; ?>
103
+ : <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></small></span>
104
+ <?php endforeach; ?>
105
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
106
+ <small>
107
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
108
+ <span class="nobr"><?php echo $tax['title']; ?>
109
+ : <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
110
+ <?php endforeach; ?>
111
+ </small>
112
+ <?php endif; ?>
113
+ </span>
114
+
115
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
116
+ <span class="cart-tax-total"
117
+ onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
118
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
119
+ :<br/> <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice() + $this->getItem()->getWeeeTaxAppliedAmount() + $this->getItem()->getWeeeTaxDisposition()); ?></span>
120
+ </span>
121
+ <?php endif; ?>
122
+ <?php endif; ?>
123
+ </span>
124
+ <br/>
125
+ <?php endif; ?>
126
+ <?php if ($this->helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
127
+ <span class="price-incl-tax">
128
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
129
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
130
+ <span class="cart-price">
131
+ <?php endif; ?>
132
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
133
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
134
+ </span>
135
+ <?php endif; ?>
136
+ <?php endif; ?>
137
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($this->getItem()); ?>
138
+
139
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
140
+ <span class="cart-tax-total"
141
+ onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
142
+ <?php else: ?>
143
+ <span class="cart-price">
144
+ <?php endif; ?>
145
+
146
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
147
+ <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
148
+ <?php else: ?>
149
+ <?php echo $this->getOrder()->formatPrice($_incl - $this->getItem()->getWeeeTaxDisposition()) ?>
150
+ <?php endif; ?>
151
+
152
+ </span>
153
+
154
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
155
+
156
+ <span class="cart-tax-info" id="unit-item-tax-details<?php echo $this->getItem()->getId(); ?>"
157
+ style="display:none;">
158
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
159
+ <small>
160
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
161
+ <span class="nobr"><?php echo $tax['title']; ?>
162
+ : <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
163
+ <?php endforeach; ?>
164
+ </small>
165
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
166
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
167
+ <span class="nobr"><small><?php echo $tax['title']; ?>
168
+ : <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></small></span>
169
+ <?php endforeach; ?>
170
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
171
+ <small>
172
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
173
+ <span class="nobr"><?php echo $tax['title']; ?>
174
+ : <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
175
+ <?php endforeach; ?>
176
+ </small>
177
+ <?php endif; ?>
178
+ </span>
179
+
180
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
181
+ <span class="cart-tax-total"
182
+ onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
183
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>
184
+ :<br/> <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
185
+ </span>
186
+ <?php endif; ?>
187
+ <?php endif; ?>
188
+ </span>
189
+ <?php endif; ?>
190
+ </td>
191
+
192
+ <td class="a-right nowrap">
193
+ <span class="nobr">
194
+ <?php if ($this->getItem()->getQtyOrdered() > 0): ?>
195
+ <?php echo $this->__('Ordered'); ?>:
196
+ <strong><?php echo $this->getItem()->getQtyOrdered() * 1 ?></strong><br/>
197
+ <?php endif; ?>
198
+ <?php if ($this->getItem()->getQtyShipped() > 0): ?>
199
+ <?php echo $this->__('Shipped'); ?>:
200
+ <strong><?php echo $this->getItem()->getQtyShipped() * 1 ?></strong><br/>
201
+ <?php endif; ?>
202
+ <?php if ($this->getItem()->getQtyCanceled() > 0): ?>
203
+ <?php echo $this->__('Canceled'); ?>:
204
+ <strong><?php echo $this->getItem()->getQtyCanceled() * 1 ?></strong><br/>
205
+ <?php endif; ?>
206
+ <?php if ($this->getItem()->getQtyRefunded() > 0): ?>
207
+ <?php echo $this->__('Refunded'); ?>:
208
+ <strong><?php echo $this->getItem()->getQtyRefunded() * 1 ?></strong><br/>
209
+ <?php endif; ?>
210
+ </span>
211
+ </td>
212
+ <td class="a-right nowrap">
213
+ <?php if ($this->helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
214
+ <span class="price-excl-tax">
215
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
216
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
217
+ <span class="cart-price">
218
+ <?php endif; ?>
219
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
220
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
221
+ </span>
222
+ <?php endif; ?>
223
+ <?php endif; ?>
224
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
225
+ <span class="cart-tax-total"
226
+ onclick="taxToggle('esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
227
+ <?php else: ?>
228
+ <span class="cart-price">
229
+ <?php endif; ?>
230
+
231
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
232
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal() + $this->getItem()->getWeeeTaxAppliedRowAmount() + $this->getItem()->getWeeeTaxRowDisposition()); ?>
233
+ <?php else: ?>
234
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
235
+ <?php endif; ?>
236
+
237
+ </span>
238
+
239
+
240
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
241
+
242
+ <span class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>"
243
+ style="display:none;">
244
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
245
+ <small>
246
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
247
+ <span class="nobr"><?php echo $tax['title']; ?>
248
+ : <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></span>
249
+ <?php endforeach; ?>
250
+ </small>
251
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
252
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
253
+ <span class="nobr"><small><?php echo $tax['title']; ?>
254
+ : <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></small></span>
255
+ <?php endforeach; ?>
256
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
257
+ <small>
258
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
259
+ <span class="nobr"><?php echo $tax['title']; ?>
260
+ : <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></span>
261
+ <?php endforeach; ?>
262
+ </small>
263
+ <?php endif; ?>
264
+ </span>
265
+
266
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
267
+ <span class="cart-tax-total"
268
+ onclick="taxToggle('esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
269
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
270
+ :<br/> <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal() + $this->getItem()->getWeeeTaxAppliedRowAmount() + $this->getItem()->getWeeeTaxRowDisposition()); ?></span>
271
+ </span>
272
+ <?php endif; ?>
273
+ <?php endif; ?>
274
+ </span>
275
+ <br/>
276
+ <?php endif; ?>
277
+ <?php if ($this->helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
278
+ <span class="price-incl-tax">
279
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
280
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
281
+ <span class="cart-price">
282
+ <?php endif; ?>
283
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
284
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
285
+ </span>
286
+ <?php endif; ?>
287
+ <?php endif; ?>
288
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($this->getItem()); ?>
289
+
290
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
291
+ <span class="cart-tax-total"
292
+ onclick="taxToggle('subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
293
+ <?php else: ?>
294
+ <span class="cart-price">
295
+ <?php endif; ?>
296
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
297
+ <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
298
+ <?php else: ?>
299
+ <?php echo $this->getOrder()->formatPrice($_incl - $this->getItem()->getWeeeTaxRowDisposition()) ?>
300
+ <?php endif; ?>
301
+
302
+ </span>
303
+
304
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
305
+
306
+ <span class="cart-tax-info" id="subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>"
307
+ style="display:none;">
308
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
309
+ <small>
310
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
311
+ <span class="nobr"><?php echo $tax['title']; ?>
312
+ : <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></span>
313
+ <?php endforeach; ?>
314
+ </small>
315
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
316
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
317
+ <span class="nobr"><small><?php echo $tax['title']; ?>
318
+ : <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></small></span>
319
+ <?php endforeach; ?>
320
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
321
+ <small>
322
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
323
+ <span class="nobr"><?php echo $tax['title']; ?>
324
+ : <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></span>
325
+ <?php endforeach; ?>
326
+ </small>
327
+ <?php endif; ?>
328
+ </span>
329
+
330
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
331
+ <span class="cart-tax-total"
332
+ onclick="taxToggle('subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
333
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>
334
+ :<br/> <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
335
+ </span>
336
+ <?php endif; ?>
337
+ <?php endif; ?>
338
+ </span>
339
+ <?php endif; ?>
340
+ </td>
341
+ <!--
342
+ <?php if ($this->helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
343
+ <th class="nowrap a-right"><?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()) ?></th>
344
+ <?php endif; ?>
345
+ <?php if ($this->helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
346
+ <th class="nowrap a-right"><?php echo $this->getOrder()->formatPrice($this->helper('checkout')->getSubtotalInclTax($this->getItem())); ?></th>
347
+ <?php endif; ?>
348
+ -->
349
+ </tr>
app/etc/modules/Futurenext_Zakeke.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Futurenext_Zakeke>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Catalog />
9
+ <Mage_Sales />
10
+ </depends>
11
+ </Futurenext_Zakeke>
12
+ </modules>
13
+ </config>
js/zakeke/customize.js ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*******************************************************
2
+ * Copyright (C) 2016 FutureNext SRL
3
+ *
4
+ * This file is part of Zakeke.
5
+ *
6
+ * Zakeke can not be copied and/or distributed without the express
7
+ * permission of FutureNext SRL
8
+ *******************************************************/
9
+
10
+ function zakekeCustomizationAdd(config) {
11
+ 'use strict';
12
+
13
+ var productDataCache = {},
14
+ pendingProductDataRequests = [],
15
+ container = window.document.getElementById('zakeke-container'),
16
+ iframe = container.firstElementChild,
17
+ updatedParams = function (color, zakekeOptions) {
18
+ if (color == null) {
19
+ throw new Error('color param is null');
20
+ }
21
+
22
+ var params = $jZakeke.extend({}, config.params),
23
+ colorObj = JSON.parse(color);
24
+
25
+ colorObj.forEach(function (val) {
26
+ if (val.IsGlobal) {
27
+ if (params['super_attribute'] != null) {
28
+ params['super_attribute'][val.Id] = val.Value.Id;
29
+ }
30
+ } else {
31
+ if (params['options'] != null) {
32
+ params['options'][val.Id] = val.Value.Id;
33
+ }
34
+ }
35
+ });
36
+
37
+ if (zakekeOptions != null) {
38
+ Object.keys(zakekeOptions).forEach(function(key) {
39
+ params[key] = zakekeOptions[key];
40
+ });
41
+ }
42
+
43
+ return params;
44
+ },
45
+ emitProductDataEvent = function (productData) {
46
+ iframe.contentWindow.postMessage({
47
+ data: productData,
48
+ zakekeMessageType: 1
49
+ }, '*');
50
+ },
51
+ productData = function(color, zakekeOptions) {
52
+ var queryString = $jZakeke.param(updatedParams(color, zakekeOptions)),
53
+ cached = productDataCache[queryString];
54
+
55
+ if (cached !== undefined) {
56
+ emitProductDataEvent(cached);
57
+ return;
58
+ }
59
+
60
+ if (pendingProductDataRequests.indexOf(queryString) !== -1) {
61
+ return;
62
+ }
63
+
64
+ pendingProductDataRequests.push(queryString);
65
+ $jZakeke.ajax(config.baseUrl + '/zakeke/customize/price?' + queryString)
66
+ .done(function (result) {
67
+ var productData = $jZakeke.extend({}, result);
68
+ productData.color = color;
69
+ productData.isOutOfStock = false;
70
+ productDataCache[queryString] = productData;
71
+ emitProductDataEvent(productData);
72
+ })
73
+ .fail(function () {
74
+ var productData = {
75
+ color: color,
76
+ isOutOfStock: true
77
+ };
78
+ productDataCache[queryString] = productData;
79
+ emitProductDataEvent(productData);
80
+ })
81
+ .always(function () {
82
+ var index = pendingProductDataRequests.indexOf(queryString);
83
+ if (index !== -1) {
84
+ pendingProductDataRequests.splice(index, 1);
85
+ }
86
+ });
87
+ },
88
+ addToCart = function (color, design, model) {
89
+ var zakekeOptions = {};
90
+ zakekeOptions['zakeke-design'] = design;
91
+ zakekeOptions['zakeke-model'] = model;
92
+ zakekeOptions['form_key'] = config.formKey;
93
+ zakekeOptions['zakeke-token'] = config.formKey;
94
+ var params = updatedParams(color, zakekeOptions),
95
+ form = window.document.getElementById('zakeke-addtocart');
96
+
97
+ form.method = 'POST';
98
+ form.action = config.checkoutUrl;
99
+ Object.keys(params).forEach(function (key) {
100
+ if (params[key] instanceof String || typeof(params[key]) !== 'object') {
101
+ var input = window.document.createElement('INPUT');
102
+ input.type = 'hidden';
103
+ input.name = key;
104
+ input.value = params[key];
105
+ form.appendChild(input);
106
+ } else {
107
+ Object.keys(params[key]).forEach(function (subKey) {
108
+ var input = window.document.createElement('INPUT');
109
+ input.type = 'hidden';
110
+ input.name = key + '[' + subKey + ']';
111
+ input.value = params[key][subKey];
112
+ form.appendChild(input);
113
+ });
114
+ }
115
+ });
116
+ $(form).submit();
117
+ };
118
+
119
+ window.addEventListener('message', function (event) {
120
+ if (event.origin !== config.zakekeUrl) {
121
+ return;
122
+ }
123
+
124
+ if (event.data.zakekeMessageType === 0) {
125
+ addToCart(event.data.colorId, event.data.designId, event.data.modelId);
126
+ } else if (event.data.zakekeMessageType === 1) {
127
+ var zakekeOptions = {};
128
+ if (event.data.design.price !== undefined) {
129
+ zakekeOptions['zakeke-price'] = event.data.design.price;
130
+ }
131
+ if (event.data.design.percentPrice !== undefined) {
132
+ zakekeOptions['zakeke-percent-price'] = event.data.design.percentPrice;
133
+ }
134
+ productData(event.data.design.color, zakekeOptions);
135
+ }
136
+ }, false);
137
+
138
+ if (!window.matchMedia('(min-width: 768px)').matches) {
139
+ window.addEventListener('resize', function () {
140
+ iframe.style.minHeight = window.innerHeight + 'px';
141
+ window.document.body.style.overflow = 'hidden';
142
+ });
143
+ }
144
+ }
145
+
js/zakeke/jquery.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ /*! jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license */
2
+ !function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=Q.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e);return!1}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}return!1}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):C.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/[^\x20\t\r\n\f]+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),
3
+ a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Y=/[A-Z]/g;function Z(a){return"true"===a||"false"!==a&&("null"===a?null:a===+a+""?+a:X.test(a)?JSON.parse(a):a)}function $(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Y,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c=Z(c)}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=W.get(f),1===f.nodeType&&!V.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),$(f,d,e[d])));V.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=$(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=V.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var _=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,aa=new RegExp("^(?:([+-])=|)("+_+")([a-z%]*)$","i"),ba=["Top","Right","Bottom","Left"],ca=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&&r.contains(a.ownerDocument,a)&&"none"===r.css(a,"display")},da=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function ea(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&&c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&&+i)&&aa.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var fa={};function ga(a){var b,c=a.ownerDocument,d=a.nodeName,e=fa[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&&(e="block"),fa[d]=e,e)}function ha(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=V.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&ca(d)&&(e[f]=ga(d))):"none"!==c&&(e[f]="none",V.set(d,"display",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ha(this,!0)},hide:function(){return ha(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){ca(this)?r(this).show():r(this).hide()})}});var ia=/^(?:checkbox|radio)$/i,ja=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,ka=/^$|\/(?:java|ecma)script/i,la={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};la.optgroup=la.option,la.tbody=la.tfoot=la.colgroup=la.caption=la.thead,la.th=la.td;function ma(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function na(a,b){for(var c=0,d=a.length;c<d;c++)V.set(a[c],"globalEval",!b||V.get(b[c],"globalEval"))}var oa=/<|&#?\w+;/;function pa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(oa.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ja.exec(f)||["",""])[1].toLowerCase(),i=la[h]||la._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=ma(l.appendChild(f),"script"),j&&na(g),c){k=0;while(f=g[k++])ka.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var qa=d.documentElement,ra=/^key/,sa=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ta=/^([^.]*)(?:\.(.+)|)/;function ua(){return!0}function va(){return!1}function wa(){try{return d.activeElement}catch(a){}}function xa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)xa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=va;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(qa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g,h=[],i=b.delegateCount,j=a.target;if(i&&j.nodeType&&!("click"===a.type&&a.button>=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c<i;c++)d=b[c],e=d.selector+" ",void 0===g[e]&&(g[e]=d.needsContext?r(e,this).index(j)>-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i<b.length&&h.push({elem:j,handlers:b.slice(i)}),h},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==wa()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===wa()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&r.nodeName(this,"input"))return this.click(),!1},_default:function(a){return r.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ua:va,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:va,isPropagationStopped:va,isImmediatePropagationStopped:va,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ua,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ua,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ua,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&ra.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&sa.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return xa(this,a,b,c,d)},one:function(a,b,c,d){return xa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=va),this.each(function(){r.event.remove(this,a,c,b)})}});var ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,za=/<script|<style|<link/i,Aa=/checked\s*(?:[^=]|=\s*.checked.)/i,Ba=/^true\/(.*)/,Ca=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Da(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Ea(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Fa(a){var b=Ba.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ga(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ha(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ia.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ia(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&Aa.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ia(f,b,c,d)});if(m&&(e=pa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(ma(e,"script"),Ea),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,ma(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Fa),l=0;l<i;l++)j=h[l],ka.test(j.type||"")&&!V.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ca,""),k))}return a}function Ja(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(ma(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&na(ma(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(ya,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=ma(h),f=ma(a),d=0,e=f.length;d<e;d++)Ha(f[d],g[d]);if(b)if(c)for(f=f||ma(a),g=g||ma(h),d=0,e=f.length;d<e;d++)Ga(f[d],g[d]);else Ga(a,h);return g=ma(h,"script"),g.length>0&&na(g,!i&&ma(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ja(this,a,!0)},remove:function(a){return Ja(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.appendChild(a)}})},prepend:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(ma(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!za.test(a)&&!la[(ja.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(ma(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ia(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(ma(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ka=/^margin/,La=new RegExp("^("+_+")(?!px)[a-z%]+$","i"),Ma=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",qa.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,qa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Na(a,b,c){var d,e,f,g,h=a.style;return c=c||Ma(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&La.test(g)&&Ka.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Oa(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Pa=/^(none|table(?!-c[ea]).+)/,Qa={position:"absolute",visibility:"hidden",display:"block"},Ra={letterSpacing:"0",fontWeight:"400"},Sa=["Webkit","Moz","ms"],Ta=d.createElement("div").style;function Ua(a){if(a in Ta)return a;var b=a[0].toUpperCase()+a.slice(1),c=Sa.length;while(c--)if(a=Sa[c]+b,a in Ta)return a}function Va(a,b,c){var d=aa.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Wa(a,b,c,d,e){var f,g=0;for(f=c===(d?"border":"content")?4:"width"===b?1:0;f<4;f+=2)"margin"===c&&(g+=r.css(a,c+ba[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+ba[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+ba[f]+"Width",!0,e))):(g+=r.css(a,"padding"+ba[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+ba[f]+"Width",!0,e)));return g}function Xa(a,b,c){var d,e=!0,f=Ma(a),g="border-box"===r.css(a,"boxSizing",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),d<=0||null==d){if(d=Na(a,b,f),(d<0||null==d)&&(d=a.style[b]),La.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Wa(a,b,c||(g?"border":"content"),e,f)+"px"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Na(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ua(h)||h),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=aa.exec(c))&&e[1]&&(c=ea(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ua(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Na(a,b,d)),"normal"===e&&b in Ra&&(e=Ra[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Pa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?Xa(a,b,d):da(a,Qa,function(){return Xa(a,b,d)})},set:function(a,c,d){var e,f=d&&Ma(a),g=d&&Wa(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=aa.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Va(a,c,g)}}}),r.cssHooks.marginLeft=Oa(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Na(a,"marginLeft"))||a.getBoundingClientRect().left-da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px"}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+ba[d]+b]=f[d]||f[d-2]||f[0];return e}},Ka.test(a)||(r.cssHooks[a+b].set=Va)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=Ma(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function Ya(a,b,c,d,e){return new Ya.prototype.init(a,b,c,d,e)}r.Tween=Ya,Ya.prototype={constructor:Ya,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Ya.propHooks[this.prop];return a&&a.get?a.get(this):Ya.propHooks._default.get(this)},run:function(a){var b,c=Ya.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ya.propHooks._default.set(this),this}},Ya.prototype.init.prototype=Ya.prototype,Ya.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Ya.propHooks.scrollTop=Ya.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Ya.prototype.init,r.fx.step={};var Za,$a,_a=/^(?:toggle|show|hide)$/,ab=/queueHooks$/;function bb(){$a&&(a.requestAnimationFrame(bb),r.fx.tick())}function cb(){return a.setTimeout(function(){Za=void 0}),Za=r.now()}function db(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ba[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function eb(a,b,c){for(var d,e=(hb.tweeners[b]||[]).concat(hb.tweeners["*"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function fb(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&&ca(a),q=V.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],_a.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=V.get(a,"display")),k=r.css(a,"display"),"none"===k&&(j?k=j:(ha([a],!0),j=a.style.display||j,k=r.css(a,"display"),ha([a]))),("inline"===k||"inline-block"===k&&null!=j)&&"none"===r.css(a,"float")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&&(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&&(p=q.hidden):q=V.access(a,"fxshow",{display:j}),f&&(q.hidden=!p),p&&ha([a],!0),m.done(function(){p||ha([a]),V.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=eb(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function gb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],r.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function hb(a,b,c){var d,e,f=0,g=hb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Za||cb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:Za||cb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(gb(k,j.opts.specialEasing);f<g;f++)if(d=hb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,eb,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}r.Animation=r.extend(hb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return ea(c.elem,a,aa.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(K);for(var c,d=0,e=a.length;d<e;d++)c=a[d],hb.tweeners[c]=hb.tweeners[c]||[],hb.tweeners[c].unshift(b)},prefilters:[fb],prefilter:function(a,b){b?hb.prefilters.unshift(a):hb.prefilters.push(a)}}),r.speed=function(a,b,c){var e=a&&"object"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off||d.hidden?e.duration=0:"number"!=typeof e.duration&&(e.duration in r.fx.speeds?e.duration=r.fx.speeds[e.duration]:e.duration=r.fx.speeds._default),null!=e.queue&&e.queue!==!0||(e.queue="fx"),e.old=e.complete,e.complete=function(){r.isFunction(e.old)&&e.old.call(this),e.queue&&r.dequeue(this,e.queue)},e},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(ca).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=hb(this,r.extend({},a),f);(e||V.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=r.timers,g=V.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&ab.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=V.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(db(b,!0),a,d,e)}}),r.each({slideDown:db("show"),slideUp:db("hide"),slideToggle:db("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(Za=r.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),Za=void 0},r.fx.timer=function(a){r.timers.push(a),a()?r.fx.start():r.timers.pop()},r.fx.interval=13,r.fx.start=function(){$a||($a=a.requestAnimationFrame?a.requestAnimationFrame(bb):a.setInterval(r.fx.tick,r.fx.interval))},r.fx.stop=function(){a.cancelAnimationFrame?a.cancelAnimationFrame($a):a.clearInterval($a),$a=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var ib,jb=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return S(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?ib:void 0)),
4
+ void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),ib={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=jb[b]||r.find.attr;jb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=jb[g],jb[g]=e,e=null!=c(a,b,d)?g:null,jb[g]=f),e}});var kb=/^(?:input|select|textarea|button)$/i,lb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):kb.test(a.nodeName)||lb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function mb(a){var b=a.match(K)||[];return b.join(" ")}function nb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,nb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,nb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,nb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=nb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(nb(c))+" ").indexOf(b)>-1)return!0;return!1}});var ob=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(ob,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:mb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d<i;d++)if(c=e[d],(c.selected||d===f)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,"optgroup"))){if(b=r(c).val(),g)return b;h.push(b)}return h},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ia.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,"$1"),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Qb=[],Rb=/(=)\?(?=&|$)|\?\?/;r.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Qb.pop()||r.expando+"_"+rb++;return this[a]=!0,a}}),r.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Rb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Rb.test(b.data)&&"data");if(h||"jsonp"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Rb,"$1"+e):b.jsonp!==!1&&(b.url+=(sb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||r.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Qb.push(e)),g&&r.isFunction(f)&&f(g[0]),g=f=void 0}),"script"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="<form></form><form></form>",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=B.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=pa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=mb(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&r.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?r("<div>").append(r.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length};function Sb(a){return r.isWindow(a)?a:9===a.nodeType&&a.defaultView}r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),d.width||d.height?(e=f.ownerDocument,c=Sb(e),b=e.documentElement,{top:d.top+c.pageYOffset-b.clientTop,left:d.left+c.pageXOffset-b.clientLeft}):d):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),r.nodeName(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||qa})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return S(this,function(a,d,e){var f=Sb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Oa(o.pixelPosition,function(a,c){if(c)return c=Na(a,b),La.test(c)?r(a).position()[b]+"px":c})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return S(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),r.parseJSON=JSON.parse,"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var Tb=a.jQuery,Ub=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=Ub),b&&a.jQuery===r&&(a.jQuery=Tb),r},b||(a.jQuery=a.$=r),r});
5
+
6
+ $jZakeke = jQuery.noConflict();
js/zakeke/preview.js ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*******************************************************
2
+ * Copyright (C) 2016 FutureNext SRL
3
+ *
4
+ * This file is part of Zakeke.
5
+ *
6
+ * Zakeke can not be copied and/or distributed without the express
7
+ * permission of FutureNext SRL
8
+ *******************************************************/
9
+
10
+ function zakekeShowPreview(preview) {
11
+ var previewUrl = preview.lastElementChild.src,
12
+ previewLabel = preview.dataset.zakekeLabel,
13
+ backdrop = window.document.createElement('DIV'),
14
+ popup = window.document.createElement('DIV'),
15
+ content = window.document.createElement('DIV'),
16
+ label = window.document.createElement('DIV'),
17
+ labelText = window.document.createTextNode(previewLabel),
18
+ image = window.document.createElement('IMG');
19
+
20
+ content.style = 'position: relative';
21
+
22
+ if (previewLabel && previewLabel.length > 0) {
23
+ label.appendChild(labelText);
24
+ label.style.cssText = 'position: absolute; bottom: 0px; left: 0px; width: 100%; padding: 10px; box-sizing: border-box; color: rgb(51, 51, 51); background: rgba(255, 255, 255, 0.87) none repeat scroll 0% 0%; border-top: 1px solid rgb(255, 255, 255); border-bottom: 1px solid rgba(0, 0, 0, 0.25); border-radius: 0px 0px 5px 5px; box-shadow: 0px -2px 4px rgba(0, 0, 0, 0.35); font-weight: bold;';
25
+
26
+ content.appendChild(label);
27
+ }
28
+
29
+ image.src = previewUrl;
30
+
31
+ popup.style.cssText = 'align-self: center; background: white';
32
+ content.appendChild(image);
33
+
34
+ popup.appendChild(content);
35
+
36
+ backdrop.appendChild(popup);
37
+
38
+ backdrop.addEventListener('click', function () {
39
+ preview.parentElement.parentElement.removeChild(backdrop);
40
+ });
41
+
42
+ backdrop.style.cssText = 'position: fixed; height: 100%; width: 100%; background: black; left: 0; top: 0; z-index: 9999; display: flex; flex-direction: column; justify-content: center;';
43
+
44
+ preview.parentElement.parentElement.appendChild(backdrop);
45
+ }
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Futurenext_Zakeke</name>
4
+ <version>1.0.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://www.zakeke.com/Contracts/GeneralConditions">Zakeke license</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Innovative cloud platform that allows any Magento store to integrate into the system a 2D and 3D complete customizer of products</summary>
10
+ <description>Zakeke is an innovative cloud platform that allows any Magento store to integrate into the system a 2D and 3D complete customizer of products, giving the possibility to customize "live" products for sale to the end customer.</description>
11
+ <notes>Initial release</notes>
12
+ <authors><author><name>Futurenext</name><user>futurenext</user><email>info@zakeke.com</email></author></authors>
13
+ <date>2017-03-16</date>
14
+ <time>19:12:11</time>
15
+ <contents><target name="magecommunity"><dir name="Futurenext"><dir name="Zakeke"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Composite"><dir name="Fieldset"><file name="Downloadable.php" hash="2d8fb733bc0ba91d9f6663f36489fbd3"/></dir></dir><dir name="Edit"><dir name="Tab"><dir name="Downloadable"><file name="Links.php" hash="346b6dfd7dd8607b67c280350ac9975e"/><file name="Samples.php" hash="93c481ebd2ef25927bd836829d943fae"/></dir><file name="Downloadable.php" hash="f8b9ba9f21da82fdc42aca57b2342440"/></dir></dir></dir></dir><dir name="Sales"><dir name="Items"><dir name="Column"><dir name="Zakeke"><file name="Name.php" hash="6cc64337a5364971f76d56415696cd70"/></dir></dir></dir></dir></dir><file name="CartItemRenderer.php" hash="9ccdff59acc42ada9288e0788dd7860d"/><file name="CheckoutItemRenderer.php" hash="efc02e5ff750861fe849c83e7df24da1"/><dir name="Customize"><file name="Add.php" hash="6d206e080ed91ed1ffbdd7528d89be2f"/><file name="Configure.php" hash="e815ed877af5727bd20289429122107b"/></dir><file name="Customize.php" hash="a338a95a03f9bc85c216f46264e121ce"/><file name="CustomizeButton.php" hash="0289e8754309ed5ba622a4e0ce643d25"/><file name="ModuleChecker.php" hash="8df2615bc87c4e656584ee80a51a9b31"/><dir name="Sales"><dir name="Order"><dir name="Email"><dir name="Items"><dir name="Order"><file name="Default.php" hash="f053f33c788884284d983f9340b8a104"/></dir></dir></dir></dir></dir><file name="SalesItemRenderer.php" hash="e5033cf0e41f399d27d8a4f6e9cad82f"/><file name="View.php" hash="f4f780e2c0e48bc0280bc6980d420da2"/></dir><dir name="Helper"><file name="Data.php" hash="4f4d0e717a12106f094a8ca18612f6e3"/><file name="ZakekeApi.php" hash="0e3cdb32c1feffe7c6f02fb4db1a6e1a"/></dir><dir name="Model"><dir name="Api2"><dir name="Colors"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="0b1ad3d9656fd5b729d1f7a626359e19"/></dir></dir></dir><file name="Colors.php" hash="f9f004c13ef5357bb3d5e798208e7902"/><dir name="ProductAttribute"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="40a6a5def798a5d0e8bcee1ac8c8a4d8"/></dir></dir></dir><file name="ProductAttribute.php" hash="97ea0f12646d9f1f1ab6916ed41f04dc"/><dir name="ProductOptions"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="6c6dd2079f58a654b60c465cc1fbc357"/></dir></dir></dir><file name="ProductOptions.php" hash="5e1234a158723dc5a8e2c3ccf6e152cf"/><dir name="Settings"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="e982e900acb2a4ac267cdda95c87cd35"/></dir></dir></dir><file name="Settings.php" hash="2f7fa711c00e75d3c4afabb007145c49"/><dir name="ZakekeEnabled"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="a066645ac7d771eb13fd0c5bb1faaf2c"/></dir></dir></dir><file name="ZakekeEnabled.php" hash="0f5c210fa296b30283aa41f500c3e3b9"/></dir><file name="ModuleList.php" hash="929479d45eb4252daaff6e4a40733b09"/><file name="Observer.php" hash="37a1bb6c4e610051c7990bd6f77e42b9"/><dir name="Resource"><file name="Setup.php" hash="42a7681d56fcd5ad06f75a223ef420f1"/><dir name="ZakekeEnabled"><file name="Collection.php" hash="fdadf3c788c4b5e175e4a20501116027"/></dir><file name="ZakekeEnabled.php" hash="f32fb4b25f1f78287a38c3bd170bdbaa"/></dir><file name="ZakekeEnabled.php" hash="9b31e4606dcf8622092f638ca9f3920c"/></dir><dir name="controllers"><file name="CustomizeController.php" hash="9231d14c59e7ba4bb3ea5bbd7236c66f"/><dir name="Zakeke"><file name="ModuleCheckerController.php" hash="b92d1f5b155479a85f358f1356ccdd29"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="09c94a981c8f0be41c567f186c485c38"/><file name="api2.xml" hash="9af2352582ae62a261d07f58e64d5e77"/><file name="config.xml" hash="e078df0b8d962903d46fd95245afdcc4"/><file name="system.xml" hash="ffcb307ec816a6b30e9e86b8e5a10411"/></dir><dir name="sql"><dir name="zakeke_setup"><file name="install-1.0.0.0.php" hash="64a3954b20b3142886446ac432a04b21"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Futurenext_Zakeke.xml" hash="f309795ee4b758943868cb1f7459fb9c"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="js"><dir name="zakeke"><file name="preview.js" hash="a22a32209982d2dda7561cff723b49bb"/></dir></dir><dir name="css"><dir name="zakeke"><file name="productview.css" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="zakeke"><file name="modulechecker.css" hash="e7fd6efc953f7e2aae234607a0a379a8"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="zakeke.xml" hash="d296777d398f6af473adfb8a15477b47"/></dir><dir name="template"><dir name="zakeke"><file name="modulechecker.phtml" hash="7855639fdc8b9511798a30adb60d33d3"/><dir name="sales"><dir name="items"><dir name="column"><dir name="zakeke"><file name="name.phtml" hash="e441a8f732c2d378df0deb88b7f7f5e7"/></dir></dir></dir><dir name="order"><dir name="creditmemo"><dir name="create"><dir name="items"><dir name="renderer"><file name="zakeke.phtml" hash="6294158a08ad56639c3a57a4d88c2f81"/></dir></dir></dir><dir name="view"><dir name="items"><dir name="renderer"><file name="zakeke.phtml" hash="4421194ecc884d934f099a256062cfcb"/></dir></dir></dir></dir><dir name="invoice"><dir name="create"><dir name="items"><dir name="renderer"><file name="zakeke.phtml" hash="74c7b3f6230f25b48dc3eb762eed7b2f"/></dir></dir></dir><dir name="view"><dir name="items"><dir name="renderer"><file name="zakeke.phtml" hash="01cd2347f60718c6238a7e19274d83bb"/></dir></dir></dir></dir><dir name="view"><dir name="items"><dir name="renderer"><file name="zakeke.phtml" hash="867a37a7072be0cba7dc9f7c03cec0d4"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="zakeke.xml" hash="d5e2ce6707c4e307857469097caeebda"/></dir><dir name="template"><dir name="zakeke"><dir name="cart"><dir name="item"><file name="default.phtml" hash="76a04053b4e70fcaece89f3b71e594d7"/></dir><file name="minicart.phtml" hash="514c94db61f9cee5503d22ac54df9522"/></dir><dir name="checkout"><dir name="onepage"><dir name="review"><file name="item.phtml" hash="718b4a5f5e765377e0cbbb9a74ebea35"/></dir></dir></dir><dir name="customization"><file name="add.phtml" hash="c647328e435fbe6dbe61e325e7a90f89"/></dir><file name="customize.phtml" hash="5b16967774ef9109760873480f2f23c2"/><file name="customizeButton.phtml" hash="29b7e8e3a29af442ff18f32cdde1d1f6"/><dir name="sales"><dir name="order"><dir name="items"><dir name="renderer"><file name="zakeke.phtml" hash="e7d7aac95595d24719104463d2620f74"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="layout"><file name="zakeke.xml" hash=""/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="zakeke"><file name="customize.js" hash="efab393e72ffeedae64002dc1b8c002c"/><file name="jquery.js" hash="105112a8a757f683234e01dec3799022"/><file name="preview.js" hash="a22a32209982d2dda7561cff723b49bb"/></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name/><channel>connect.magentocommerce.com/core</channel><min/><max/></package><extension><name>curl</name><min/><max/></extension></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/zakeke/modulechecker.css ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #zakeke-summary {
2
+ font-size: 15px;
3
+ height: 50px;
4
+ display: flex;
5
+ justify-content: center;
6
+ flex-direction: column;
7
+ background-position-y: center;
8
+ }
9
+
10
+ #zakeke-summary.zakeke-valid {
11
+ background-color: #fffbbb;
12
+ background-image: url("../../default/images/success-msg.png");
13
+ }
14
+
15
+ #zakeke-summary.zakeke-not-valid {
16
+ background-color: #fcc;
17
+ background-image: url("../../default/images/error-msg.png");
18
+ }
19
+
20
+ .zakeke-checker {
21
+ padding-left: 55px;
22
+ margin-bottom: 40px;
23
+ background-position-x: 15px;
24
+ background-repeat: no-repeat;
25
+ }
26
+
27
+ .zakeke-checker h3 {
28
+ margin-bottom: 0;
29
+ }
30
+
31
+ .zakeke-checker.zakeke-valid {
32
+ background-image: url("../../default/images/success-msg.png");
33
+ }
34
+
35
+ .zakeke-checker.zakeke-not-valid {
36
+ background-image: url("../../default/images/error-msg.png");
37
+ }
38
+
39
+ .zakeke-checker.zakeke-not-valid ul li {
40
+ background: url("../../default/images/error_msg_icon.gif") no-repeat;
41
+ padding-left: 22px;
42
+ }
skin/frontend/base/default/css/zakeke/productview.css ADDED
File without changes
skin/frontend/base/default/js/zakeke/preview.js ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*******************************************************
2
+ * Copyright (C) 2016 FutureNext SRL
3
+ *
4
+ * This file is part of Zakeke.
5
+ *
6
+ * Zakeke can not be copied and/or distributed without the express
7
+ * permission of FutureNext SRL
8
+ *******************************************************/
9
+
10
+ function zakekeShowPreview(preview) {
11
+ var previewUrl = preview.lastElementChild.src,
12
+ previewLabel = preview.dataset.zakekeLabel,
13
+ backdrop = window.document.createElement('DIV'),
14
+ popup = window.document.createElement('DIV'),
15
+ content = window.document.createElement('DIV'),
16
+ label = window.document.createElement('DIV'),
17
+ labelText = window.document.createTextNode(previewLabel),
18
+ image = window.document.createElement('IMG');
19
+
20
+ content.style = 'position: relative';
21
+
22
+ if (previewLabel && previewLabel.length > 0) {
23
+ label.appendChild(labelText);
24
+ label.style.cssText = 'position: absolute; bottom: 0px; left: 0px; width: 100%; padding: 10px; box-sizing: border-box; color: rgb(51, 51, 51); background: rgba(255, 255, 255, 0.87) none repeat scroll 0% 0%; border-top: 1px solid rgb(255, 255, 255); border-bottom: 1px solid rgba(0, 0, 0, 0.25); border-radius: 0px 0px 5px 5px; box-shadow: 0px -2px 4px rgba(0, 0, 0, 0.35); font-weight: bold;';
25
+
26
+ content.appendChild(label);
27
+ }
28
+
29
+ image.src = previewUrl;
30
+
31
+ popup.style.cssText = 'align-self: center; background: white';
32
+ content.appendChild(image);
33
+
34
+ popup.appendChild(content);
35
+
36
+ backdrop.appendChild(popup);
37
+
38
+ backdrop.addEventListener('click', function () {
39
+ preview.parentElement.parentElement.removeChild(backdrop);
40
+ });
41
+
42
+ backdrop.style.cssText = 'position: fixed; height: 100%; width: 100%; background: black; left: 0; top: 0; z-index: 9999; display: flex; flex-direction: column; justify-content: center;';
43
+
44
+ preview.parentElement.parentElement.appendChild(backdrop);
45
+ }