Qixol_Promo - Version 1.0.0

Version Notes

Version 1.0.0 release

Download this release

Release Info

Developer Qixol
Extension Qixol_Promo
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (206) hide show
  1. app/code/community/Qixol/Promo/Block/Adminhtml/Banner.php +11 -0
  2. app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit.php +81 -0
  3. app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit/Bannerimage/Grid.php +149 -0
  4. app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit/Bannerimage/Tab/Form.php +131 -0
  5. app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit/Form.php +19 -0
  6. app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit/Tab/Bannerimage.php +31 -0
  7. app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit/Tab/Form.php +52 -0
  8. app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit/Tabs.php +38 -0
  9. app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Grid.php +109 -0
  10. app/code/community/Qixol/Promo/Block/Adminhtml/Bannerboxes.php +11 -0
  11. app/code/community/Qixol/Promo/Block/Adminhtml/Bannerboxes/Edit.php +37 -0
  12. app/code/community/Qixol/Promo/Block/Adminhtml/Bannerboxes/Edit/Form.php +19 -0
  13. app/code/community/Qixol/Promo/Block/Adminhtml/Bannerboxes/Edit/Tab/Form.php +88 -0
  14. app/code/community/Qixol/Promo/Block/Adminhtml/Bannerboxes/Edit/Tabs.php +20 -0
  15. app/code/community/Qixol/Promo/Block/Adminhtml/Bannerboxes/Grid.php +85 -0
  16. app/code/community/Qixol/Promo/Block/Adminhtml/Bannerimage.php +11 -0
  17. app/code/community/Qixol/Promo/Block/Adminhtml/Bannerimage/Edit.php +24 -0
  18. app/code/community/Qixol/Promo/Block/Adminhtml/Bannerimage/Edit/Form.php +19 -0
  19. app/code/community/Qixol/Promo/Block/Adminhtml/Bannerimage/Edit/Tab/Form.php +41 -0
  20. app/code/community/Qixol/Promo/Block/Adminhtml/Bannerimage/Edit/Tabs.php +19 -0
  21. app/code/community/Qixol/Promo/Block/Adminhtml/Customergrouspmap.php +11 -0
  22. app/code/community/Qixol/Promo/Block/Adminhtml/Customergrouspmap/Edit.php +37 -0
  23. app/code/community/Qixol/Promo/Block/Adminhtml/Customergrouspmap/Edit/Form.php +17 -0
  24. app/code/community/Qixol/Promo/Block/Adminhtml/Customergrouspmap/Edit/Tab/Form.php +66 -0
  25. app/code/community/Qixol/Promo/Block/Adminhtml/Customergrouspmap/Edit/Tabs.php +20 -0
  26. app/code/community/Qixol/Promo/Block/Adminhtml/Customergrouspmap/Grid.php +97 -0
  27. app/code/community/Qixol/Promo/Block/Adminhtml/Qixolbackend.php +5 -0
  28. app/code/community/Qixol/Promo/Block/Adminhtml/Sales/Order/Total.php +64 -0
  29. app/code/community/Qixol/Promo/Block/Adminhtml/Shippingmap.php +11 -0
  30. app/code/community/Qixol/Promo/Block/Adminhtml/Shippingmap/Edit.php +37 -0
  31. app/code/community/Qixol/Promo/Block/Adminhtml/Shippingmap/Edit/Form.php +17 -0
  32. app/code/community/Qixol/Promo/Block/Adminhtml/Shippingmap/Edit/Tab/Form.php +151 -0
  33. app/code/community/Qixol/Promo/Block/Adminhtml/Shippingmap/Edit/Tabs.php +20 -0
  34. app/code/community/Qixol/Promo/Block/Adminhtml/Shippingmap/Grid.php +129 -0
  35. app/code/community/Qixol/Promo/Block/Adminhtml/Sticker.php +11 -0
  36. app/code/community/Qixol/Promo/Block/Adminhtml/Sticker/Edit.php +69 -0
  37. app/code/community/Qixol/Promo/Block/Adminhtml/Sticker/Edit/Form.php +19 -0
  38. app/code/community/Qixol/Promo/Block/Adminhtml/Sticker/Edit/Tab/Form.php +131 -0
  39. app/code/community/Qixol/Promo/Block/Adminhtml/Sticker/Edit/Tabs.php +20 -0
  40. app/code/community/Qixol/Promo/Block/Adminhtml/Sticker/Grid.php +132 -0
  41. app/code/community/Qixol/Promo/Block/Adminhtml/Storesmap.php +11 -0
  42. app/code/community/Qixol/Promo/Block/Adminhtml/Storesmap/Edit.php +37 -0
  43. app/code/community/Qixol/Promo/Block/Adminhtml/Storesmap/Edit/Form.php +17 -0
  44. app/code/community/Qixol/Promo/Block/Adminhtml/Storesmap/Edit/Tab/Form.php +133 -0
  45. app/code/community/Qixol/Promo/Block/Adminhtml/Storesmap/Edit/Tabs.php +20 -0
  46. app/code/community/Qixol/Promo/Block/Adminhtml/Storesmap/Grid.php +110 -0
  47. app/code/community/Qixol/Promo/Block/Adminhtml/System/Config/Attributes.php +40 -0
  48. app/code/community/Qixol/Promo/Block/Adminhtml/Widget/Grid.php +22 -0
  49. app/code/community/Qixol/Promo/Block/Adminhtml/Widget/Grid/Column.php +36 -0
  50. app/code/community/Qixol/Promo/Block/Adminhtml/Widget/Grid/Column/Filter/Banner.php +7 -0
  51. app/code/community/Qixol/Promo/Block/Adminhtml/Widget/Grid/Column/Renderer/Banner.php +31 -0
  52. app/code/community/Qixol/Promo/Block/Adminhtml/Widget/Grid/Column/Renderer/Sticker.php +39 -0
  53. app/code/community/Qixol/Promo/Block/Banner.php +54 -0
  54. app/code/community/Qixol/Promo/Block/Bannerboxes.php +17 -0
  55. app/code/community/Qixol/Promo/Block/Customergrouspmap.php +17 -0
  56. app/code/community/Qixol/Promo/Block/Issuedcoupon.php +10 -0
  57. app/code/community/Qixol/Promo/Block/Sales/Creditmemo.php +21 -0
  58. app/code/community/Qixol/Promo/Block/Sales/Invoice.php +20 -0
  59. app/code/community/Qixol/Promo/Block/Sales/Order.php +20 -0
  60. app/code/community/Qixol/Promo/Block/Sales/Order/Total.php +64 -0
  61. app/code/community/Qixol/Promo/Block/Shippingmap.php +17 -0
  62. app/code/community/Qixol/Promo/Block/Startexportbutton.php +204 -0
  63. app/code/community/Qixol/Promo/Block/Startimportbutton.php +204 -0
  64. app/code/community/Qixol/Promo/Block/Sticker.php +54 -0
  65. app/code/community/Qixol/Promo/Block/Storesmap.php +17 -0
  66. app/code/community/Qixol/Promo/Helper/Data.php +63 -0
  67. app/code/community/Qixol/Promo/Model/Advert.php +191 -0
  68. app/code/community/Qixol/Promo/Model/Banner.php +81 -0
  69. app/code/community/Qixol/Promo/Model/Bannerboxes.php +36 -0
  70. app/code/community/Qixol/Promo/Model/Bannerimage.php +91 -0
  71. app/code/community/Qixol/Promo/Model/Bannerresize.php +232 -0
  72. app/code/community/Qixol/Promo/Model/Bonuspoints.php +117 -0
  73. app/code/community/Qixol/Promo/Model/Creditmemopoints.php +18 -0
  74. app/code/community/Qixol/Promo/Model/Cron.php +16 -0
  75. app/code/community/Qixol/Promo/Model/Customergrouspmap.php +21 -0
  76. app/code/community/Qixol/Promo/Model/Deletedproduct.php +12 -0
  77. app/code/community/Qixol/Promo/Model/Exportstat.php +12 -0
  78. app/code/community/Qixol/Promo/Model/Exprpocessstat.php +12 -0
  79. app/code/community/Qixol/Promo/Model/Invoicepoints.php +20 -0
  80. app/code/community/Qixol/Promo/Model/Issuedcoupon.php +16 -0
  81. app/code/community/Qixol/Promo/Model/Mysql4/Banner.php +147 -0
  82. app/code/community/Qixol/Promo/Model/Mysql4/Banner/Collection.php +9 -0
  83. app/code/community/Qixol/Promo/Model/Mysql4/Bannerboxes.php +9 -0
  84. app/code/community/Qixol/Promo/Model/Mysql4/Bannerboxes/Collection.php +9 -0
  85. app/code/community/Qixol/Promo/Model/Mysql4/Bannerimage.php +7 -0
  86. app/code/community/Qixol/Promo/Model/Mysql4/Bannerimage/Collection.php +8 -0
  87. app/code/community/Qixol/Promo/Model/Mysql4/Bonuspoints.php +8 -0
  88. app/code/community/Qixol/Promo/Model/Mysql4/Bonuspoints/Collection.php +9 -0
  89. app/code/community/Qixol/Promo/Model/Mysql4/Customergrouspmap.php +9 -0
  90. app/code/community/Qixol/Promo/Model/Mysql4/Customergrouspmap/Collection.php +9 -0
  91. app/code/community/Qixol/Promo/Model/Mysql4/Deletedproduct.php +8 -0
  92. app/code/community/Qixol/Promo/Model/Mysql4/Deletedproduct/Collection.php +12 -0
  93. app/code/community/Qixol/Promo/Model/Mysql4/Exportstat.php +8 -0
  94. app/code/community/Qixol/Promo/Model/Mysql4/Exportstat/Collection.php +12 -0
  95. app/code/community/Qixol/Promo/Model/Mysql4/Exprpocessstat.php +8 -0
  96. app/code/community/Qixol/Promo/Model/Mysql4/Exprpocessstat/Collection.php +12 -0
  97. app/code/community/Qixol/Promo/Model/Mysql4/Issuedcoupon.php +10 -0
  98. app/code/community/Qixol/Promo/Model/Mysql4/Issuedcoupon/Collection.php +12 -0
  99. app/code/community/Qixol/Promo/Model/Mysql4/Promotions.php +46 -0
  100. app/code/community/Qixol/Promo/Model/Mysql4/Promotions/Collection.php +12 -0
  101. app/code/community/Qixol/Promo/Model/Mysql4/Shippingmap.php +9 -0
  102. app/code/community/Qixol/Promo/Model/Mysql4/Shippingmap/Collection.php +9 -0
  103. app/code/community/Qixol/Promo/Model/Mysql4/Sticker.php +238 -0
  104. app/code/community/Qixol/Promo/Model/Mysql4/Sticker/Collection.php +9 -0
  105. app/code/community/Qixol/Promo/Model/Mysql4/Storesmap.php +9 -0
  106. app/code/community/Qixol/Promo/Model/Mysql4/Storesmap/Collection.php +9 -0
  107. app/code/community/Qixol/Promo/Model/Observer.php +819 -0
  108. app/code/community/Qixol/Promo/Model/Ordertotalpoints.php +56 -0
  109. app/code/community/Qixol/Promo/Model/PromoService.php +201 -0
  110. app/code/community/Qixol/Promo/Model/Promotions.php +12 -0
  111. app/code/community/Qixol/Promo/Model/RESTPromoService.php +357 -0
  112. app/code/community/Qixol/Promo/Model/SOAPPromoService.php +273 -0
  113. app/code/community/Qixol/Promo/Model/Shippingmap.php +21 -0
  114. app/code/community/Qixol/Promo/Model/Sinch.php +1594 -0
  115. app/code/community/Qixol/Promo/Model/Status.php +13 -0
  116. app/code/community/Qixol/Promo/Model/Sticker.php +67 -0
  117. app/code/community/Qixol/Promo/Model/Storesmap.php +21 -0
  118. app/code/community/Qixol/Promo/Model/System/Config/Source/Attributes.php +21 -0
  119. app/code/community/Qixol/Promo/Model/System/Config/Source/Cart/Settings.php +38 -0
  120. app/code/community/Qixol/Promo/Model/System/Config/Source/Customers/List.php +19 -0
  121. app/code/community/Qixol/Promo/Model/System/Config/Source/IServiceProtocols/Values.php +28 -0
  122. app/code/community/Qixol/Promo/Model/System/Config/Source/Iservices/Values.php +33 -0
  123. app/code/community/Qixol/Promo/Model/System/Config/Source/Shippings/List.php +38 -0
  124. app/code/community/Qixol/Promo/Model/System/Config/Source/Stores.php +23 -0
  125. app/code/community/Qixol/Promo/Model/Wysiwyg/Config.php +38 -0
  126. app/code/community/Qixol/Promo/Model/config.php +9 -0
  127. app/code/community/Qixol/Promo/Model/iPromoService.php +29 -0
  128. app/code/community/Qixol/Promo/controllers/Adminhtml/BannerController.php +258 -0
  129. app/code/community/Qixol/Promo/controllers/Adminhtml/BannerboxesController.php +105 -0
  130. app/code/community/Qixol/Promo/controllers/Adminhtml/BannerimageController.php +258 -0
  131. app/code/community/Qixol/Promo/controllers/Adminhtml/CustomergrouspmapController.php +105 -0
  132. app/code/community/Qixol/Promo/controllers/Adminhtml/QixolbackendController.php +11 -0
  133. app/code/community/Qixol/Promo/controllers/Adminhtml/ShippingmapController.php +105 -0
  134. app/code/community/Qixol/Promo/controllers/Adminhtml/StickerController.php +208 -0
  135. app/code/community/Qixol/Promo/controllers/Adminhtml/StoresmapController.php +105 -0
  136. app/code/community/Qixol/Promo/controllers/AjaxController.php +152 -0
  137. app/code/community/Qixol/Promo/controllers/CartController.php +57 -0
  138. app/code/community/Qixol/Promo/controllers/IndexController.php +22 -0
  139. app/code/community/Qixol/Promo/controllers/IssuedcouponController.php +17 -0
  140. app/code/community/Qixol/Promo/etc/adminhtml.xml +25 -0
  141. app/code/community/Qixol/Promo/etc/config.xml +393 -0
  142. app/code/community/Qixol/Promo/etc/system.xml +482 -0
  143. app/code/community/Qixol/Promo/sql/qixol_setup/mysql4-install-1.0.0.php +247 -0
  144. app/design/adminhtml/default/default/layout/qixol.xml +102 -0
  145. app/design/adminhtml/default/default/template/qixol/bannerboxes.phtml +1 -0
  146. app/design/adminhtml/default/default/template/qixol/bannerimage.phtml +14 -0
  147. app/design/adminhtml/default/default/template/qixol/banners.phtml +50 -0
  148. app/design/adminhtml/default/default/template/qixol/customergrouspmap.phtml +1 -0
  149. app/design/adminhtml/default/default/template/qixol/order/advert.phtml +38 -0
  150. app/design/adminhtml/default/default/template/qixol/qixolbackend.phtml +196 -0
  151. app/design/adminhtml/default/default/template/qixol/shippingmap.phtml +1 -0
  152. app/design/adminhtml/default/default/template/qixol/stickers.phtml +50 -0
  153. app/design/adminhtml/default/default/template/qixol/storesmap.phtml +1 -0
  154. app/design/adminhtml/default/default/template/qixol/system/config/attributes.phtml +10 -0
  155. app/design/frontend/base/default/layout/qixol.xml +162 -0
  156. app/design/frontend/base/default/template/qixol/cart/advert.phtml +81 -0
  157. app/design/frontend/base/default/template/qixol/cart/bonuspointbox.phtml +75 -0
  158. app/design/frontend/base/default/template/qixol/cart/cart.phtml +246 -0
  159. app/design/frontend/base/default/template/qixol/cart/item/default.phtml +390 -0
  160. app/design/frontend/base/default/template/qixol/cart/totals.phtml +130 -0
  161. app/design/frontend/base/default/template/qixol/issuedcoupon/list.phtml +95 -0
  162. app/design/frontend/base/default/template/qixol/issuedpoints/box.phtml +6 -0
  163. app/design/frontend/base/default/template/qixol/issuedpoints/dashboard_points.phtml +10 -0
  164. app/design/frontend/base/default/template/qixol/minicart/advert.phtml +61 -0
  165. app/design/frontend/base/default/template/qixol/minicart/default.phtml +238 -0
  166. app/design/frontend/base/default/template/qixol/minicart/mincart.phtml +227 -0
  167. app/design/frontend/base/default/template/qixol/myaccount/order/email/default.phtml +163 -0
  168. app/design/frontend/base/default/template/qixol/myaccount/order/email/items.phtml +138 -0
  169. app/design/frontend/base/default/template/qixol/myaccount/order/invoice/default.phtml +328 -0
  170. app/design/frontend/base/default/template/qixol/myaccount/order/invoice/invoice.phtml +128 -0
  171. app/design/frontend/base/default/template/qixol/myaccount/order/items/default.phtml +347 -0
  172. app/design/frontend/base/default/template/qixol/myaccount/order/items/items.phtml +109 -0
  173. app/design/frontend/base/default/template/qixol/myaccount/order/print/default.phtml +347 -0
  174. app/design/frontend/base/default/template/qixol/myaccount/order/print/messages.phtml +1 -0
  175. app/design/frontend/base/default/template/qixol/myaccount/order/print/print.phtml +132 -0
  176. app/design/frontend/base/default/template/qixol/onepage/advert.phtml +60 -0
  177. app/design/frontend/base/default/template/qixol/onepage/item.phtml +288 -0
  178. app/design/frontend/base/default/template/qixol/onepage/review.phtml +148 -0
  179. app/design/frontend/base/default/template/qixol/product/qixol_adv.phtml +85 -0
  180. app/design/frontend/base/default/template/qixol/product/qixol_info_details.phtml +42 -0
  181. app/design/frontend/base/default/template/qixol/product/qixol_product_info.phtml +99 -0
  182. app/design/frontend/base/default/template/qixol/sidebar/advert.phtml +40 -0
  183. app/design/frontend/base/default/template/qixol/sidebar/default.phtml +145 -0
  184. app/design/frontend/base/default/template/qixol/sidebar/sidebar.phtml +80 -0
  185. app/design/frontend/rwd/default/template/qixol/minicart/advert.phtml +61 -0
  186. app/design/frontend/rwd/default/template/qixol/minicart/default.phtml +258 -0
  187. app/design/frontend/rwd/default/template/qixol/minicart/mincart.phtml +231 -0
  188. app/etc/modules/Qixol_Promo.xml +10 -0
  189. app/locale/en_US/Qixol_Promo.csv +142 -0
  190. media/custom/stickers/bogof.png +0 -0
  191. media/custom/stickers/bogor.png +0 -0
  192. media/custom/stickers/bundle.png +0 -0
  193. media/custom/stickers/deal.png +0 -0
  194. media/custom/stickers/freeproduct.png +0 -0
  195. media/custom/stickers/issuecoupon.png +0 -0
  196. media/custom/stickers/issuepoints.png +0 -0
  197. media/custom/stickers/offers.png +0 -0
  198. media/custom/stickers/productsreduction.png +0 -0
  199. package.xml +18 -0
  200. skin/adminhtml/default/default/images/_error.png +0 -0
  201. skin/adminhtml/default/default/images/_run.gif +0 -0
  202. skin/adminhtml/default/default/images/_yes.gif +0 -0
  203. skin/frontend/base/default/css/qixol.css +116 -0
  204. skin/frontend/base/default/js/lib/jquery.cycle2.min.js +16 -0
  205. skin/frontend/base/default/js/lib/jquery.cycle2.swipe.min.js +2 -0
  206. var/logs_qixol/logs_here.txt +1 -0
app/code/community/Qixol/Promo/Block/Adminhtml/Banner.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Banner extends Mage_Adminhtml_Block_Widget_Grid_Container {
3
+
4
+ public function __construct() {
5
+ $this->_controller = 'adminhtml_banner';
6
+ $this->_blockGroup = 'qixol';
7
+ $this->_headerText = Mage::helper('qixol')->__('Banner Manager');
8
+ $this->_addButtonLabel = Mage::helper('qixol')->__('Add Banner');
9
+ parent::__construct();
10
+ }
11
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Banner_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+
7
+ $this->_objectId = 'id';
8
+ $this->_blockGroup = 'qixol';
9
+ $this->_controller = 'adminhtml_banner';
10
+
11
+ $this->_updateButton('save', 'label', Mage::helper('qixol')->__('Save Item'));
12
+ $this->_updateButton('delete', 'label', Mage::helper('qixol')->__('Delete Item'));
13
+
14
+ $this->_addButton('saveandcontinue', array(
15
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
16
+ 'onclick' => 'saveAndContinueEdit()',
17
+ 'class' => 'save',
18
+ ), -100);
19
+
20
+ $this->_addButton('addImage', array(
21
+ 'label' => Mage::helper('qixol')->__('Add Image'),
22
+ 'onclick' => 'addImage()',
23
+ 'class' => 'save',
24
+ ), -100);
25
+
26
+ $addImageUrl = $this->getUrl('*/adminhtml_bannerimage/addBannerImage', array('bannerid' => $this->getRequest()->getParam('id')));
27
+
28
+ $this->_formScripts[] = "
29
+ /*function toggleEditor() {
30
+ if (tinyMCE.getInstanceById('banner_content') == null) {
31
+ tinyMCE.execCommand('mceAddControl', false, 'banner_content');
32
+ } else {
33
+ tinyMCE.execCommand('mceRemoveControl', false, 'banner_content');
34
+ }
35
+ }*/
36
+
37
+ function saveAndContinueEdit(){
38
+ editForm.submit($('edit_form').action+'back/edit/');
39
+ }
40
+
41
+ function addImage() {
42
+ window.location.href='" . $addImageUrl . "';
43
+ }
44
+
45
+ function showTypeContents(){
46
+ var typeId=$('banner_type').value;
47
+ var show = ((typeId==0)?'block':'none');
48
+ var hide = ((typeId==0)?'none':'block');
49
+ $('filename').setStyle({display:show});
50
+ $('filename_delete').setStyle({display:show});
51
+ //$('banner_content').setStyle({display:hide});
52
+ setTimeout('bannerContentType()',1000);
53
+ alert($('filename').getStyle('display'))
54
+ }
55
+
56
+ function bannerContentType(){
57
+ var typeId=$('banner_type').value;
58
+ var hide = ((typeId==0)?'none':'block');
59
+ $('buttonsbanner_content').setStyle({display:hide});
60
+ $('banner_content_parent').setStyle({display:hide});
61
+ }
62
+
63
+
64
+ /* Event.observe('banner_type', 'change', function(){
65
+ showTypeContents();
66
+ });
67
+ Event.observe(window, 'load', function(){
68
+ showTypeContents();
69
+ }); */
70
+ ";
71
+ }
72
+
73
+ public function getHeaderText() {
74
+ if (Mage::registry('banner_data') && Mage::registry('banner_data')->getId()) {
75
+ return Mage::helper('qixol')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('banner_data')->getTitle()));
76
+ } else {
77
+ return Mage::helper('qixol')->__('Add Item');
78
+ }
79
+ }
80
+
81
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit/Bannerimage/Grid.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Banner_Edit_Bannerimage_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setDefaultSort('sort_order');
9
+ $this->setDefaultDir('asc');
10
+ $this->setId('bannerImageGrid');
11
+ $this->setDefaultFilter(array('banner_id'=>1));
12
+ $this->setUseAjax(true);
13
+ }
14
+
15
+ protected function _addColumnFilterToCollection($column)
16
+ {
17
+ if ($column->getId() == 'banner_id') {
18
+ $inBannerIds = $this->_getBannerimages();
19
+ if (empty($inBannerIds)) {
20
+ $inBannerIds = 0;
21
+ }
22
+ if ($column->getFilter()->getValue()) {
23
+ $this->getCollection()->addFieldToFilter('banner_id', array('in'=>$inBannerIds));
24
+ }
25
+ else {
26
+ if($inBannerIds) {
27
+ $this->getCollection()->addFieldToFilter('banner_id', array('nin'=>$inBannerIds));
28
+ }
29
+ }
30
+ }
31
+ else {
32
+ parent::_addColumnFilterToCollection($column);
33
+ }
34
+ return $this;
35
+ }
36
+
37
+ protected function _prepareCollection()
38
+ {
39
+ $bannerId = $this->getRequest()->getParam('id');
40
+ Mage::register('BANNERID', $bannerId);
41
+ $collection = Mage::getModel('qixol/banner')->getBannerImageCollection();
42
+ $this->setCollection($collection);
43
+ return parent::_prepareCollection();
44
+ }
45
+
46
+ protected function _prepareColumns()
47
+ {
48
+ $this->addColumn('banner_id', array(
49
+ 'header' => Mage::helper('qixol')->__('Banner id'),
50
+ 'name' => 'banner_id',
51
+ 'index' => 'banner_id',
52
+ 'values' => $this->_getBannerimages(),
53
+ 'column_css_class' => 'no-display',
54
+ 'header_css_class' => 'no-display'
55
+ ));
56
+
57
+ $this->addColumn('banner_image_id', array(
58
+ 'header' => Mage::helper('qixol')->__('Id'),
59
+ 'name' => 'banner_image_id',
60
+ 'index' => 'banner_image_id',
61
+ 'column_css_class' => 'no-display',
62
+ 'header_css_class' => 'no-display'
63
+ ));
64
+
65
+ $this->addColumn('filename', array(
66
+ 'header' =>Mage::helper('qixol')->__('Filename'),
67
+ 'name' => 'filename',
68
+ 'index' => 'filename'
69
+ ));
70
+
71
+ $this->addColumn('sort_order', array(
72
+ 'header' =>Mage::helper('qixol')->__('Sort order'),
73
+ 'name' => 'sort_order',
74
+ 'index' => 'sort_order'
75
+ ));
76
+
77
+ $this->addColumn('promotion_reference', array(
78
+ 'header' =>Mage::helper('qixol')->__('Promotion reference'),
79
+ 'name' => 'promotion_reference',
80
+ 'index' => 'promotion_reference'
81
+ ));
82
+
83
+ $this->addColumn('comment', array(
84
+ 'header' =>Mage::helper('qixol')->__('Comment'),
85
+ 'name' => 'comment',
86
+ 'index' => 'comment'
87
+ ));
88
+
89
+ $this->addColumn('url', array(
90
+ 'header' =>Mage::helper('qixol')->__('URL'),
91
+ 'name' => 'url',
92
+ 'index' => 'url'
93
+ ));
94
+
95
+ /*
96
+ $this->addColumn('grid_actions',
97
+ array(
98
+ 'header'=>Mage::helper('adminhtml')->__('Actions'),
99
+ 'width'=>5,
100
+ 'sortable'=>false,
101
+ 'filter' =>false,
102
+ 'type' => 'action',
103
+ 'actions' => array(
104
+ array(
105
+ 'caption' => Mage::helper('adminhtml')->__('Remove'),
106
+ 'onClick' => 'role.deleteFromRole($role_id);'
107
+ )
108
+ )
109
+ )
110
+ );
111
+ */
112
+
113
+ return parent::_prepareColumns();
114
+ }
115
+ //
116
+ // public function getGridUrl()
117
+ // {
118
+ // $bannerId = $this->getRequest()->getParam('id');
119
+ // // TODO: {action} is...?
120
+ // return $this->getUrl('*/*/{action}', array('id' => $bannerId));
121
+ // }
122
+
123
+ public function getRowUrl($row) {
124
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
125
+ }
126
+
127
+ protected function _getBannerimages($json=false)
128
+ {
129
+ $bannerId = ( $this->getRequest()->getParam('id') > 0 ) ? $this->getRequest()->getParam('id') : Mage::registry('BANNERID');
130
+ $bannerImages = Mage::getModel('qixol/banner')->setId($bannerId)->getBannerImageIds();
131
+
132
+ if (count($bannerImages) > 0) {
133
+ if ( $json ) {
134
+ $jsonBannerImages = Array();
135
+ foreach($bannerImages as $bannerImage) $jsonBannerImages[$bannerImage] = 0;
136
+ return Mage::helper('core')->jsonEncode((object)$jsonBannerImages);
137
+ } else {
138
+ return array_values($bannerImages);
139
+ }
140
+ } else {
141
+ if ( $json ) {
142
+ return '{}';
143
+ } else {
144
+ return array();
145
+ }
146
+ }
147
+ }
148
+ }
149
+
app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit/Bannerimage/Tab/Form.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Banner_Edit_Bannerimage_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ $form = new Varien_Data_Form();
6
+ $this->setForm($form);
7
+ $fieldset = $form->addFieldset('sticker_form', array('legend' => Mage::helper('qixol')->__('Item information')));
8
+ $version = substr(Mage::getVersion(), 0, 3);
9
+ //$config = (($version == '1.4' || $version == '1.5') ? "'config' => Mage::getSingleton('sticker/wysiwyg_config')->getConfig()" : "'class'=>''");
10
+
11
+ $fieldset->addField('filename', 'image', array(
12
+ 'label' => Mage::helper('qixol')->__('Upload and use Image'),
13
+ 'required' => true,
14
+ 'name' => 'filename',
15
+ ));
16
+
17
+ $fieldset->addField('is_default_for_type', 'select', array(
18
+ 'label' => Mage::helper('qixol')->__('Default for Promotion Type?'),
19
+ 'class' => 'required-entry',
20
+ 'name' => 'is_default_for_type',
21
+ 'values' => array(
22
+ array(
23
+ 'value' => 1,
24
+ 'label' => Mage::helper('qixol')->__('Yes'),
25
+ ),
26
+ array(
27
+ 'value' => 0,
28
+ 'label' => Mage::helper('qixol')->__('No'),
29
+ ),
30
+ ),
31
+ ));
32
+
33
+ $fieldset->addField('promo_type_name', 'select', array(
34
+ 'label' => Mage::helper('qixol')->__('Promotion Type'),
35
+ 'class' => 'required-entry',
36
+ 'required' => false,
37
+ 'name' => 'promo_type_name',
38
+ 'values' => array(
39
+ array(
40
+ 'value' => '',
41
+ 'label' => Mage::helper('qixol')->__('Not defined'),
42
+ ),
43
+ array(
44
+ 'value' => 'BOGOF',
45
+ 'label' => Mage::helper('qixol')->__('Buy one get one free'),
46
+ ),
47
+ array(
48
+ 'value' => 'BOGOR',
49
+ 'label' => Mage::helper('qixol')->__('Buy one get one reduced'),
50
+ ),
51
+ array(
52
+ 'value' => 'BUNDLE',
53
+ 'label' => Mage::helper('qixol')->__('Bundle'),
54
+ ),
55
+ array(
56
+ 'value' => 'DEAL',
57
+ 'label' => Mage::helper('qixol')->__('Deal'),
58
+ ),
59
+ array(
60
+ 'value' => 'FREEPRODUCT',
61
+ 'label' => Mage::helper('qixol')->__('Free product'),
62
+ ),
63
+ array(
64
+ 'value' => 'ISSUECOUPON',
65
+ 'label' => Mage::helper('qixol')->__('Issue coupon'),
66
+ ),
67
+ array(
68
+ 'value' => 'ISSUEPOINTS',
69
+ 'label' => Mage::helper('qixol')->__('Issue points'),
70
+ ),
71
+ array(
72
+ 'value' => 'BASKETREDUCTION',
73
+ 'label' => Mage::helper('qixol')->__('Backet reduction'),
74
+ ),
75
+ array(
76
+ 'value' => 'DELIVERYREDUCTION',
77
+ 'label' => Mage::helper('qixol')->__('Delivery reduction'),
78
+ ),
79
+ /*array(
80
+ 'value' => 8,
81
+ 'label' => Mage::helper('qixol')->__('Multiple promos'),
82
+ ),*/
83
+ array(
84
+ 'value' => 'PRODUCTSREDUCTION',
85
+ 'label' => Mage::helper('qixol')->__('Product reduction'),
86
+ ),
87
+ ),
88
+ ));
89
+
90
+ $field_last = $fieldset->addField('promo_reference', 'text', array(
91
+ 'label' => Mage::helper('qixol')->__('Promotion reference'),
92
+ 'name' => 'promo_reference',
93
+ ));
94
+
95
+ $field_last->setAfterElementHtml('<script>
96
+ //< ![C
97
+ function on_change_is_default_for_type(){
98
+ if ($(\'is_default_for_type\')[$(\'is_default_for_type\').selectedIndex].value==\'1\'){
99
+ $(\'promo_reference\').setValue("");
100
+ $(\'promo_reference\').disable();
101
+ $(\'promo_type_name\').enable();
102
+ }else {
103
+ $(\'promo_reference\').enable();
104
+ $(\'promo_type_name\').selectedIndex=0;
105
+ $(\'promo_type_name\').disable();
106
+ }
107
+
108
+ }
109
+
110
+ document.observe("dom:loaded", function() {
111
+
112
+ $("is_default_for_type").observe("change",function(e){
113
+ on_change_is_default_for_type();
114
+ });
115
+ on_change_is_default_for_type();
116
+ });
117
+
118
+
119
+ //]]>
120
+ </script>');
121
+
122
+ if (Mage::getSingleton('adminhtml/session')->getStickerData()) {
123
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getStickerData());
124
+ Mage::getSingleton('adminhtml/session')->setStickerData(null);
125
+ } elseif (Mage::registry('sticker_data')) {
126
+ $form->setValues(Mage::registry('sticker_data')->getData());
127
+ }
128
+ return parent::_prepareForm();
129
+ }
130
+
131
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Banner_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ 'id' => 'edit_form',
8
+
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit/Tab/Bannerimage.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Banner_Edit_Tab_Bannerimage extends Mage_Adminhtml_Block_Widget_Tabs {
3
+
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+
8
+ $bannerId = $this->getRequest()->getParam('id', false);
9
+
10
+ $bannerImages = Mage::getModel("qixol/bannerimage")->getCollection()->load();
11
+ $this->setTemplate('qixol/bannerimage.phtml')
12
+ ->assign('bannerImages', $bannerImages->getItems())
13
+ ->assign('bannerId', $bannerId);
14
+ }
15
+
16
+ protected function _prepareLayout()
17
+ {
18
+ $this->setChild('bannerImageGrid', $this->getLayout()->createBlock('qixol/adminhtml_banner_edit_bannerimage_grid', 'bannerImageGrid'));
19
+ return parent::_prepareLayout();
20
+ }
21
+
22
+ protected function _getGridHtml()
23
+ {
24
+ return $this->getChildHtml('bannerImageGrid');
25
+ }
26
+
27
+ protected function _getJsObjectName()
28
+ {
29
+ return $this->getChild('bannerImageGrid')->getJsObjectName();
30
+ }
31
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit/Tab/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Banner_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ $form = new Varien_Data_Form();
6
+ $this->setForm($form);
7
+ $fieldset = $form->addFieldset('banner_form', array('legend' => Mage::helper('qixol')->__('Item information')));
8
+ $version = substr(Mage::getVersion(), 0, 3);
9
+ //$config = (($version == '1.4' || $version == '1.5') ? "'config' => Mage::getSingleton('banner/wysiwyg_config')->getConfig()" : "'class'=>''");
10
+
11
+ $fieldset->addField('title', 'text', array(
12
+ 'label' => Mage::helper('qixol')->__('Title'),
13
+ 'class' => 'required-entry',
14
+ 'required' => true,
15
+ 'name' => 'title',
16
+ ));
17
+
18
+ $fieldset->addField('display_zone', 'multiselect', array(
19
+ 'label' => Mage::helper('qixol')->__('Display Zone'),
20
+ 'class' => 'required-entry',
21
+ 'required' => true,
22
+ 'name' => 'display_zone',
23
+ 'values' => Mage::getModel('qixol/bannerboxes')->getOptionArray(),
24
+ 'after_element_html' => Mage::helper('qixol')->__('use: <br>CATEGORY_TOP for showing on category list<br>PRODUCT_BOTTOM on bottom product page<br>PRODUCT_TOP on top on product page<br>PRODUCT_INLINE on top on product page<br>separate by ; '),
25
+ ));
26
+
27
+ $fieldset->addField('status', 'select', array(
28
+ 'label' => Mage::helper('qixol')->__('Status'),
29
+ 'class' => 'required-entry',
30
+ 'name' => 'status',
31
+ 'values' => array(
32
+ array(
33
+ 'value' => 0,
34
+ 'label' => Mage::helper('qixol')->__('Disabled'),
35
+ ),
36
+ array(
37
+ 'value' => 1,
38
+ 'label' => Mage::helper('qixol')->__('Enabled'),
39
+ ),
40
+ ),
41
+ ));
42
+
43
+ if (Mage::getSingleton('adminhtml/session')->getBannerData()) {
44
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getBannerData());
45
+ Mage::getSingleton('adminhtml/session')->setBannerData(null);
46
+ } elseif (Mage::registry('banner_data')) {
47
+ $form->setValues(Mage::registry('banner_data')->getData());
48
+ }
49
+ return parent::_prepareForm();
50
+ }
51
+
52
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Edit/Tabs.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Banner_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('qixol_tabs');
7
+ $this->setDestElementId('edit_form');
8
+ $this->setTitle(Mage::helper('qixol')->__('Item Information'));
9
+ }
10
+
11
+ protected function _beforeToHtml() {
12
+ $this->addTab('form_section', array(
13
+ 'label' => Mage::helper('qixol')->__('Banner Information'),
14
+ 'alt' => Mage::helper('qixol')->__('Banner information'),
15
+ 'content' => $this->getLayout()->createBlock('qixol/adminhtml_banner_edit_tab_form')->toHtml(),
16
+ ));
17
+
18
+ $this->addTab('images_grid', array(
19
+ 'label' => Mage::helper('qixol')->__('Banner Images'),
20
+ 'alt' => Mage::helper('qixol')->__('Banner images'),
21
+ 'content' => $this->getLayout()->createBlock('qixol/adminhtml_banner_edit_tab_bannerimage', 'banner.bannerimages.grid')->toHtml(),
22
+ ));
23
+
24
+ // $this->addTab('images_grid', array(
25
+ // 'label' => Mage::helper('qixol')->__('Banner Images'),
26
+ // 'alt' => Mage::helper('qixol')->__('Banner images'),
27
+ // 'content' => $this->getLayout()->createBlock('qixol/adminhtml_banner_edit_bannerimage_grid', 'banner.bannerimages.grid')->toHtml(),
28
+ // ));
29
+ //
30
+ // $this->addTab('images_form', array(
31
+ // 'label' => Mage::helper('qixol')->__('Add banner image'),
32
+ // 'alt' => Mage::helper('qixol')->__('Add banner image'),
33
+ // 'content' => $this->getLayout()->createBlock('qixol/adminhtml_banner_edit_bannerimage_tab_form')->toHtml()
34
+ // ));
35
+
36
+ return parent::_beforeToHtml();
37
+ }
38
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Banner/Grid.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Banner_Grid extends Qixol_Promo_Block_Adminhtml_Widget_Grid {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('bannerGrid');
7
+ $this->setDefaultSort('banner_id');
8
+ $this->setDefaultDir('ASC');
9
+ $this->setSaveParametersInSession(true);
10
+ }
11
+
12
+ protected function _prepareCollection() {
13
+ $collection = Mage::getModel('qixol/banner')->getCollection();
14
+ $this->setCollection($collection);
15
+ return parent::_prepareCollection();
16
+ }
17
+
18
+ protected function _prepareColumns() {
19
+ $this->addColumn('banner_id', array(
20
+ 'header' => Mage::helper('qixol')->__('ID'),
21
+ 'align' => 'center',
22
+ 'width' => '30px',
23
+ 'index' => 'banner_id',
24
+ ));
25
+
26
+ $this->addColumn('title', array(
27
+ 'header' => Mage::helper('qixol')->__('Title'),
28
+ 'width' => '150px',
29
+ 'index' => 'title',
30
+ ));
31
+
32
+ $this->addColumn('display_zone', array(
33
+ 'header' => Mage::helper('qixol')->__('Display Zone'),
34
+ 'width' => '250px',
35
+ 'index' => 'display_zone',
36
+ ));
37
+
38
+ /* TODO: should use the Qixol_Promo_Model_Status class for this? */
39
+ $this->addColumn('status', array(
40
+ 'header' => Mage::helper('qixol')->__('Status'),
41
+ 'align' => 'left',
42
+ 'width' => '80px',
43
+ 'index' => 'status',
44
+ 'type' => 'options',
45
+ 'options' => array(
46
+ 0 => 'Disabled',
47
+ 1 => 'Enabled',
48
+ ),
49
+ ));
50
+
51
+ $this->addColumn('action',
52
+ array(
53
+ 'header' => Mage::helper('qixol')->__('Action'),
54
+ 'width' => '80',
55
+ 'type' => 'action',
56
+ 'getter' => 'getId',
57
+ 'actions' => array(
58
+ array(
59
+ 'caption' => Mage::helper('qixol')->__('Edit'),
60
+ 'url' => array('base' => '*/*/edit'),
61
+ 'field' => 'id'
62
+ )
63
+ ),
64
+ 'filter' => false,
65
+ 'sortable' => false,
66
+ 'index' => 'stores',
67
+ 'is_system' => true,
68
+ ));
69
+
70
+ //$this->addExportType('*/*/exportCsv', Mage::helper('qixol')->__('CSV'));
71
+ //$this->addExportType('*/*/exportXml', Mage::helper('qixol')->__('XML'));
72
+
73
+ return parent::_prepareColumns();
74
+ }
75
+
76
+ protected function _prepareMassaction() {
77
+ $this->setMassactionIdField('banner_id');
78
+ $this->getMassactionBlock()->setFormFieldName('banner');
79
+
80
+ $this->getMassactionBlock()->addItem('delete', array(
81
+ 'label' => Mage::helper('qixol')->__('Delete'),
82
+ 'url' => $this->getUrl('*/*/massDelete'),
83
+ 'confirm' => Mage::helper('qixol')->__('Are you sure?')
84
+ ));
85
+
86
+ $statuses = Mage::getSingleton('qixol/status')->getOptionArray();
87
+
88
+ array_unshift($statuses, array('label' => '', 'value' => ''));
89
+ $this->getMassactionBlock()->addItem('status', array(
90
+ 'label' => Mage::helper('qixol')->__('Change status'),
91
+ 'url' => $this->getUrl('*/*/massStatus', array('_current' => true)),
92
+ 'additional' => array(
93
+ 'visibility' => array(
94
+ 'name' => 'status',
95
+ 'type' => 'select',
96
+ 'class' => 'required-entry',
97
+ 'label' => Mage::helper('qixol')->__('Status'),
98
+ 'values' => $statuses
99
+ )
100
+ )
101
+ ));
102
+ return $this;
103
+ }
104
+
105
+ public function getRowUrl($row) {
106
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
107
+ }
108
+
109
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Bannerboxes.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Bannerboxes extends Mage_Adminhtml_Block_Widget_Grid_Container {
3
+
4
+ public function __construct() {
5
+ $this->_controller = 'adminhtml_bannerboxes';
6
+ $this->_blockGroup = 'qixol';
7
+ $this->_headerText = Mage::helper('qixol')->__('Banner Box Manager');
8
+ $this->_addButtonLabel = Mage::helper('qixol')->__('Add Banner box');
9
+ parent::__construct();
10
+ }
11
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Bannerboxes/Edit.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Bannerboxes_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+
7
+ $this->_objectId = 'id';
8
+ $this->_blockGroup = 'qixol';
9
+ $this->_controller = 'adminhtml_bannerboxes';
10
+
11
+ $this->_updateButton('save', 'label', Mage::helper('qixol')->__('Save Item'));
12
+ $this->_updateButton('delete', 'label', Mage::helper('qixol')->__('Delete Item'));
13
+
14
+ $this->_addButton('saveandcontinue', array(
15
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
16
+ 'onclick' => 'saveAndContinueEdit()',
17
+ 'class' => 'save',
18
+ ), -100);
19
+
20
+ $this->_formScripts[] = "
21
+
22
+ function saveAndContinueEdit(){
23
+ editForm.submit($('edit_form').action+'back/edit/');
24
+ }
25
+
26
+ ";
27
+ }
28
+
29
+ public function getHeaderText() {
30
+ if (Mage::registry('bannerbox_data') && Mage::registry('bannerbox_data')->getId()) {
31
+ return Mage::helper('qixol')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('bannerbox_data')->getTitle()));
32
+ } else {
33
+ return Mage::helper('qixol')->__('Add Item');
34
+ }
35
+ }
36
+
37
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Bannerboxes/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Bannerboxes_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ 'id' => 'edit_form',
8
+
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ // 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Bannerboxes/Edit/Tab/Form.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Bannerboxes_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ $form = new Varien_Data_Form();
6
+ $this->setForm($form);
7
+ $fieldset = $form->addFieldset('bannerbox_form', array('legend' => Mage::helper('qixol')->__('Item information')));
8
+ $version = substr(Mage::getVersion(), 0, 3);
9
+ //$config = (($version == '1.4' || $version == '1.5') ? "'config' => Mage::getSingleton('banner/wysiwyg_config')->getConfig()" : "'class'=>''");
10
+
11
+
12
+
13
+
14
+
15
+
16
+ $fieldset->addField('banner_box_type', 'select', array(
17
+ 'label' => Mage::helper('qixol')->__('Box Position'),
18
+ 'class' => 'required-entry',
19
+ 'required' => true,
20
+ 'name' => 'banner_box_type',
21
+ 'values' => array(
22
+ array(
23
+ 'value' => 'CATEGORY_TOP',
24
+ 'label' => Mage::helper('qixol')->__('CATEGORY_TOP - the top box of category listsing'),
25
+ ),
26
+ array(
27
+ 'value' => 'PRODUCT_BOTTOM',
28
+ 'label' => Mage::helper('qixol')->__('bottom of the product view page'),
29
+ ),
30
+ array(
31
+ 'value' => 'PRODUCT_TOP',
32
+ 'label' => Mage::helper('qixol')->__('PRODUCT_TOP - top of product view page'),
33
+ ),
34
+ array(
35
+ 'value' => 'PRODUCT_INLINE',
36
+ 'label' => Mage::helper('qixol')->__('PRODUCT_INLINE - inline in add to catrt box on product page'),
37
+ ),
38
+ array(
39
+ 'value' => 'BASKET_INLINE',
40
+ 'label' => Mage::helper('qixol')->__('BASKET_INLINE - box on basket'),
41
+ ),
42
+ array(
43
+ 'value' => 'CATEGORY_STICKERS',
44
+ 'label' => Mage::helper('qixol')->__('CATEGORY_STICKERS - stickers on category listing'),
45
+ ),
46
+ array(
47
+ 'value' => 'PRODUCT_INFO_STICKERS',
48
+ 'label' => Mage::helper('qixol')->__('PRODUCT_INFO_STICKERS - stickers on product info'),
49
+ ),
50
+
51
+ ),
52
+ ));
53
+
54
+ $fieldset->addField('banner_box_translation_type', 'text', array(
55
+ 'label' => Mage::helper('qixol')->__('Translation Type'),
56
+ 'class' => 'required-entry',
57
+ 'required' => true,
58
+ 'name' => 'banner_box_translation_type',
59
+ 'after_element_html' => Mage::helper('qixol')->__('fadeout, scrollHorz , tileSlide or others from Cycle2 for myltyple data'),
60
+ ));
61
+
62
+
63
+ $fieldset->addField('banner_box_is_active', 'select', array(
64
+ 'label' => Mage::helper('qixol')->__('Status'),
65
+ 'class' => 'required-entry',
66
+ 'name' => 'banner_box_is_active',
67
+ 'values' => array(
68
+ array(
69
+ 'value' => 0,
70
+ 'label' => Mage::helper('qixol')->__('Disabled'),
71
+ ),
72
+ array(
73
+ 'value' => 1,
74
+ 'label' => Mage::helper('qixol')->__('Enabled'),
75
+ ),
76
+ ),
77
+ ));
78
+
79
+ if (Mage::getSingleton('adminhtml/session')->getBannerboxData()) {
80
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getBannerboxData());
81
+ Mage::getSingleton('adminhtml/session')->setBannerboxData(null);
82
+ } elseif (Mage::registry('bannerbox_data')) {
83
+ $form->setValues(Mage::registry('bannerbox_data')->getData());
84
+ }
85
+ return parent::_prepareForm();
86
+ }
87
+
88
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Bannerboxes/Edit/Tabs.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Bannerboxes_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('qixol_tabs');
7
+ $this->setDestElementId('edit_form');
8
+ $this->setTitle(Mage::helper('qixol')->__('Banner box Information'));
9
+ }
10
+
11
+ protected function _beforeToHtml() {
12
+ $this->addTab('form_section', array(
13
+ 'label' => Mage::helper('qixol')->__('Banner box Information'),
14
+ 'alt' => Mage::helper('qixol')->__('Banner box Information'),
15
+ 'content' => $this->getLayout()->createBlock('qixol/adminhtml_bannerboxes_edit_tab_form')->toHtml(),
16
+ ));
17
+ return parent::_beforeToHtml();
18
+ }
19
+
20
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Bannerboxes/Grid.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Bannerboxes_Grid extends Mage_Adminhtml_Block_Widget_Grid {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('bannerGrid');
7
+ $this->setDefaultSort('banner_box_type');
8
+ $this->setDefaultDir('ASC');
9
+ $this->setSaveParametersInSession(true);
10
+ }
11
+
12
+ protected function _prepareCollection() {
13
+ $collection = Mage::getModel('qixol/bannerboxes')->getCollection();
14
+ $this->setCollection($collection);
15
+ return parent::_prepareCollection();
16
+ }
17
+
18
+ protected function _prepareColumns() {
19
+
20
+ $this->addColumn('banner_box_type', array(
21
+ 'header' => Mage::helper('qixol')->__('Banner Box Type'),
22
+ 'width' => '100px',
23
+ 'index' => 'banner_box_type',
24
+ 'type' => 'options',
25
+ 'options' => array(
26
+ 'CATEGORY_TOP' => 'CATEGORY_TOP',
27
+ 'PRODUCT_BOTTOM' => 'PRODUCT_BOTTOM',
28
+ 'PRODUCT_TOP' => 'PRODUCT_TOP',
29
+ 'PRODUCT_INLINE' => 'PRODUCT_INLINE',
30
+ 'BASKET_INLINE' => 'BASKET_INLINE',
31
+ 'CATEGORY_STICKERS' => 'CATEGORY_STICKERS',
32
+ 'PRODUCT_INFO_STICKERS' => 'PRODUCT_INFO_STICKERS',
33
+ ),
34
+ ));
35
+
36
+ $this->addColumn('banner_box_is_active', array(
37
+ 'header' => Mage::helper('qixol')->__('Enabled?'),
38
+ 'align' => 'left',
39
+ 'width' => '80px',
40
+ 'index' => 'banner_box_is_active',
41
+ 'type' => 'options',
42
+ 'options' => array(
43
+ 0 => 'Disabled',
44
+ 1 => 'Enabled',
45
+ ),
46
+ ));
47
+
48
+ $this->addColumn('banner_box_translation_type', array(
49
+ 'header' => Mage::helper('qixol')->__('Translate Type'),
50
+ 'width' => '80px',
51
+ 'index' => 'banner_box_translation_type',
52
+ 'align' => 'center',
53
+ ));
54
+
55
+
56
+
57
+ $this->addColumn('action',
58
+ array(
59
+ 'header' => Mage::helper('qixol')->__('Action'),
60
+ 'width' => '80',
61
+ 'type' => 'action',
62
+ 'getter' => 'getId',
63
+ 'actions' => array(
64
+ array(
65
+ 'caption' => Mage::helper('qixol')->__('Edit'),
66
+ 'url' => array('base' => '*/*/edit'),
67
+ 'field' => 'id'
68
+ )
69
+ ),
70
+ 'filter' => false,
71
+ 'sortable' => false,
72
+ 'index' => 'stores',
73
+ 'is_system' => true,
74
+ ));
75
+
76
+ //$this->addExportType('*/*/exportCsv', Mage::helper('qixol')->__('CSV'));
77
+ //$this->addExportType('*/*/exportXml', Mage::helper('qixol')->__('XML'));
78
+ return parent::_prepareColumns();
79
+ }
80
+
81
+ public function getRowUrl($row) {
82
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
83
+ }
84
+
85
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Bannerimage.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Bannerimage extends Mage_Adminhtml_Block_Widget_Grid_Container {
3
+
4
+ public function __construct() {
5
+ $this->_controller = 'adminhtml_bannerimage';
6
+ $this->_blockGroup = 'qixol';
7
+ $this->_headerText = Mage::helper('qixol')->__('Banner Image Manager');
8
+ $this->_addButtonLabel = Mage::helper('qixol')->__('Add Banner image');
9
+ parent::__construct();
10
+ }
11
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Bannerimage/Edit.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Bannerimage_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+
7
+ $this->_objectId = 'id';
8
+ $this->_blockGroup = 'qixol';
9
+ $this->_controller = 'adminhtml_bannerimage';
10
+
11
+ $this->_updateButton('save', 'label', Mage::helper('qixol')->__('Save Item'));
12
+ $this->_updateButton('delete', 'label', Mage::helper('qixol')->__('Delete Item'));
13
+
14
+ }
15
+
16
+ public function getHeaderText() {
17
+ if (Mage::registry('bannerimage_data') && Mage::registry('bannerimage_data')->getId()) {
18
+ return Mage::helper('qixol')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('bannerimage_data')->getTitle()));
19
+ } else {
20
+ return Mage::helper('qixol')->__('Add Item');
21
+ }
22
+ }
23
+
24
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Bannerimage/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Bannerimage_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ 'id' => 'edit_form',
8
+
9
+ 'action' => $this->getUrl('*/*/save'),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Bannerimage/Edit/Tab/Form.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Bannerimage_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ $form = new Varien_Data_Form();
6
+ $this->setForm($form);
7
+ $fieldset = $form->addFieldset('bannerimage_form', array('legend' => Mage::helper('qixol')->__('Item information')));
8
+ $version = substr(Mage::getVersion(), 0, 3);
9
+ //$config = (($version == '1.4' || $version == '1.5') ? "'config' => Mage::getSingleton('sticker/wysiwyg_config')->getConfig()" : "'class'=>''");
10
+
11
+ $field_last = $fieldset->addField('banner_id', 'hidden', array(
12
+ 'label' => Mage::helper('qixol')->__('Banner id'),
13
+ 'name' => 'banner_id',
14
+ 'value' => $this->getRequest()->getParam('bannerid', false)
15
+ ));
16
+
17
+ $fieldset->addField('filename', 'image', array(
18
+ 'label' => Mage::helper('qixol')->__('Upload and use Image'),
19
+ 'required' => true,
20
+ 'name' => 'filename',
21
+ ));
22
+
23
+ $field_last = $fieldset->addField('promotion_reference', 'text', array(
24
+ 'label' => Mage::helper('qixol')->__('Promotion reference'),
25
+ 'name' => 'promotion_reference',
26
+ ));
27
+
28
+ $field_last = $fieldset->addField('comment', 'text', array(
29
+ 'label' => Mage::helper('qixol')->__('Comment'),
30
+ 'name' => 'comment',
31
+ ));
32
+
33
+ $field_last = $fieldset->addField('url', 'text', array(
34
+ 'label' => Mage::helper('qixol')->__('Url'),
35
+ 'name' => 'url',
36
+ ));
37
+
38
+ return parent::_prepareForm();
39
+ }
40
+
41
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Bannerimage/Edit/Tabs.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Bannerimage_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('qixol_tabs');
7
+ $this->setDestElementId('edit_form');
8
+ $this->setTitle(Mage::helper('qixol')->__('Item Information'));
9
+ }
10
+
11
+ protected function _beforeToHtml() {
12
+ $this->addTab('images_grid', array(
13
+ 'label' => Mage::helper('qixol')->__('Banner Images'),
14
+ 'alt' => Mage::helper('qixol')->__('Banner images'),
15
+ 'content' => $this->getLayout()->createBlock('qixol/adminhtml_bannerimage_edit_tab_form')->toHtml(),
16
+ ));
17
+ return parent::_beforeToHtml();
18
+ }
19
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Customergrouspmap.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Customergrouspmap extends Mage_Adminhtml_Block_Widget_Grid_Container {
3
+
4
+ public function __construct() {
5
+ $this->_controller = 'adminhtml_customergrouspmap';
6
+ $this->_blockGroup = 'qixol';
7
+ $this->_headerText = Mage::helper('qixol')->__('Customer Group Integration Codes');
8
+ $this->_addButtonLabel = Mage::helper('qixol')->__('Add Customer Group Integration Code');
9
+ parent::__construct();
10
+ }
11
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Customergrouspmap/Edit.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Customergrouspmap_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+
7
+ $this->_objectId = 'id';
8
+ $this->_blockGroup = 'qixol';
9
+ $this->_controller = 'adminhtml_customergrouspmap';
10
+
11
+ $this->_updateButton('save', 'label', Mage::helper('qixol')->__('Save Item'));
12
+ $this->_updateButton('delete', 'label', Mage::helper('qixol')->__('Delete Item'));
13
+
14
+ $this->_addButton('saveandcontinue', array(
15
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
16
+ 'onclick' => 'saveAndContinueEdit()',
17
+ 'class' => 'save',
18
+ ), -100);
19
+
20
+ $this->_formScripts[] = "
21
+
22
+ function saveAndContinueEdit(){
23
+ editForm.submit($('edit_form').action+'back/edit/');
24
+ }
25
+
26
+ ";
27
+ }
28
+
29
+ public function getHeaderText() {
30
+ if (Mage::registry('customergrouspmap_data') && Mage::registry('customergrouspmap_data')->getId()) {
31
+ return Mage::helper('qixol')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('customergrouspmap_data')->getTitle()));
32
+ } else {
33
+ return Mage::helper('qixol')->__('Add Item');
34
+ }
35
+ }
36
+
37
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Customergrouspmap/Edit/Form.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Customergrouspmap_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ 'id' => 'edit_form',
8
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
9
+ 'method' => 'post',
10
+ )
11
+ );
12
+
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Customergrouspmap/Edit/Tab/Form.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Customergrouspmap_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ $hlp=Mage::helper('qixol');
6
+ $form = new Varien_Data_Form();
7
+ $this->setForm($form);
8
+ $fieldset = $form->addFieldset('customergrouspmap_form', array('legend' => $hlp->__('Item information')));
9
+ //$version = substr(Mage::getVersion(), 0, 3);
10
+ //$config = (($version == '1.4' || $version == '1.5') ? "'config' => Mage::getSingleton('quxol/wysiwyg_config')->getConfig()" : "'class'=>''");
11
+
12
+ $list_map_names=Mage::getModel('qixol/customergrouspmap')->getCollection();
13
+
14
+ $customer_group_name_array_list=Array();
15
+ $list_map_names_exists=array();
16
+
17
+ foreach ($list_map_names as $list_map){
18
+ $list_map_names_exists[$list_map->getCustomerGroupName()]=$list_map->getCustomerGroupName();
19
+ }
20
+
21
+
22
+ $customerGroupModel = new Mage_Customer_Model_Group();
23
+ $allCustomerGroups = $customerGroupModel->getCollection()->toOptionHash();
24
+ foreach($allCustomerGroups as $key => $group){
25
+ $customer_group_name_array_list[$group] = $hlp->__($group);
26
+ if (isset($list_map_names_exists[$group])) unset($list_map_names_exists[$group]);
27
+
28
+ }
29
+
30
+
31
+
32
+ if (count($list_map_names_exists)){
33
+ foreach ($list_map_names_exists as $exists_old_code)
34
+ $customer_group_name_array_list[$exists_old_code] = $hlp->__($exists_old_code);
35
+
36
+ }
37
+
38
+
39
+
40
+ $fieldset->addField('customer_group_name', 'select', array(
41
+ 'label' => Mage::helper('qixol')->__('Customer Group:'),
42
+ 'class' => 'required-entry',
43
+ 'required' => true,
44
+ 'name' => 'customer_group_name',
45
+ 'values' => $customer_group_name_array_list
46
+ ));
47
+
48
+ $fieldset->addField('integration_code', 'text', array(
49
+ 'label' => Mage::helper('qixol')->__('Integration Code'),
50
+ 'class' => 'required-entry',
51
+ 'required' => true,
52
+ 'name' => 'integration_code',
53
+ 'after_element_html' => Mage::helper('qixol')->__('Name to be send to qixol.'),
54
+ ));
55
+
56
+
57
+ if (Mage::getSingleton('adminhtml/session')->getCustomergrouspmapData()) {
58
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getCustomergrouspmapData());
59
+ Mage::getSingleton('adminhtml/session')->getCustomergrouspmapData(null);
60
+ } elseif (Mage::registry('customergrouspmap_data')) {
61
+ $form->setValues(Mage::registry('customergrouspmap_data')->getData());
62
+ }
63
+ return parent::_prepareForm();
64
+ }
65
+
66
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Customergrouspmap/Edit/Tabs.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Customergrouspmap_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('qixol_tabs');
7
+ $this->setDestElementId('edit_form');
8
+ $this->setTitle(Mage::helper('qixol')->__('Customer Group Integration Codes Information'));
9
+ }
10
+
11
+ protected function _beforeToHtml() {
12
+ $this->addTab('form_section', array(
13
+ 'label' => Mage::helper('qixol')->__('Customer Group Integration Codes'),
14
+ 'alt' => Mage::helper('qixol')->__('Customer Group Integration Codes'),
15
+ 'content' => $this->getLayout()->createBlock('qixol/adminhtml_customergrouspmap_edit_tab_form')->toHtml(),
16
+ ));
17
+ return parent::_beforeToHtml();
18
+ }
19
+
20
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Customergrouspmap/Grid.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Customergrouspmap_Grid extends Mage_Adminhtml_Block_Widget_Grid {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('customergrouspmapGrid');
7
+ $this->setDefaultSort('integration_code');
8
+ $this->setDefaultDir('ASC');
9
+ $this->setSaveParametersInSession(true);
10
+ }
11
+
12
+ protected function _prepareCollection() {
13
+ $collection = Mage::getModel('qixol/customergrouspmap')->getCollection();
14
+ $this->setCollection($collection);
15
+ return parent::_prepareCollection();
16
+ }
17
+
18
+ protected function _prepareColumns() {
19
+ $hlp = Mage::helper('qixol');
20
+ $list_map_names=Mage::getModel('qixol/customergrouspmap')->getCollection();
21
+
22
+ $customer_group_name_array_list=Array();
23
+ $list_map_names_exists=array();
24
+
25
+ foreach ($list_map_names as $list_map){
26
+ $list_map_names_exists[$list_map->getCustomerGroupName()]=$list_map->getCustomerGroupName();
27
+ }
28
+
29
+
30
+ $customerGroupModel = new Mage_Customer_Model_Group();
31
+ $allCustomerGroups = $customerGroupModel->getCollection()->toOptionHash();
32
+ foreach($allCustomerGroups as $key => $group){
33
+ $customer_group_name_array_list[$group] = $hlp->__($group);
34
+ if (isset($list_map_names_exists[$group])) unset($list_map_names_exists[$group]);
35
+
36
+ }
37
+
38
+
39
+
40
+ if (count($list_map_names_exists)){
41
+ foreach ($list_map_names_exists as $exists_old_code)
42
+ $customer_group_name_array_list[$exists_old_code] = $hlp->__($exists_old_code);
43
+
44
+ }
45
+
46
+
47
+
48
+ $this->addColumn('customer_group_name', array(
49
+ 'header' => $hlp->__('Customer Group'),
50
+ 'type' => 'customer',
51
+ 'align' => 'left',
52
+ 'width' => '250px',
53
+ 'index' => 'customer_group_name',
54
+ 'type' => 'options',
55
+ 'options' => $customer_group_name_array_list
56
+ ));
57
+
58
+
59
+
60
+ $this->addColumn('integration_code', array(
61
+ 'header' => $hlp->__('Integration Code'),
62
+ 'width' => '350px',
63
+ 'index' => 'integration_code'
64
+ ));
65
+
66
+ $this->addColumn('action',
67
+ array(
68
+ 'header' => $hlp->__('Action'),
69
+ 'width' => '80',
70
+ 'type' => 'action',
71
+ 'getter' => 'getId',
72
+ 'actions' => array(
73
+ array(
74
+ 'caption' => $hlp->__('Edit'),
75
+ 'url' => array('base' => '*/*/edit'),
76
+ 'field' => 'id'
77
+ ),
78
+ array(
79
+ 'caption' => $hlp->__('Delete'),
80
+ 'url' => array('base' => '*/*/delete'),
81
+ 'field' => 'id'
82
+ )
83
+ ),
84
+ 'filter' => false,
85
+ 'sortable' => false,
86
+ 'index' => 'stores',
87
+ 'is_system' => true,
88
+ ));
89
+
90
+ return parent::_prepareColumns();
91
+ }
92
+
93
+ public function getRowUrl($row) {
94
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
95
+ }
96
+
97
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Qixolbackend.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Qixol_Promo_Block_Adminhtml_Qixolbackend extends Mage_Adminhtml_Block_Template {
4
+
5
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Sales/Order/Total.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Sales_Order_Total extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * Get label cell tag properties
6
+ *
7
+ * @return string
8
+ */
9
+ public function getLabelProperties()
10
+ {
11
+ return $this->getParentBlock()->getLabelProperties();
12
+ }
13
+
14
+ /**
15
+ * Get order store object
16
+ *
17
+ * @return Mage_Sales_Model_Order
18
+ */
19
+ public function getOrder()
20
+ {
21
+ return $this->getParentBlock()->getOrder();
22
+ }
23
+
24
+ /**
25
+ * Get totals source object
26
+ *
27
+ * @return Mage_Sales_Model_Order
28
+ */
29
+ public function getSource()
30
+ {
31
+ return $this->getParentBlock()->getSource();
32
+ }
33
+
34
+ /**
35
+ * Get value cell tag properties
36
+ *
37
+ * @return string
38
+ */
39
+ public function getValueProperties()
40
+ {
41
+ return $this->getParentBlock()->getValueProperties();
42
+ }
43
+
44
+ /**
45
+ * Initialize reward points totals
46
+ *
47
+ */
48
+ public function initTotals()
49
+ {
50
+ if ((float) $this->getOrder()->getBasePointsAmount()) {
51
+ $source = $this->getSource();
52
+ $value = $source->getPointsAmount();
53
+
54
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
55
+ 'code' => 'points',
56
+ 'strong' => false,
57
+ 'label' => 'Reward points discount',
58
+ 'value' => $source instanceof Mage_Sales_Model_Order_Creditmemo ? - $value : -$value
59
+ )));
60
+ }
61
+
62
+ return $this;
63
+ }
64
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Shippingmap.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Shippingmap extends Mage_Adminhtml_Block_Widget_Grid_Container {
3
+
4
+ public function __construct() {
5
+ $this->_controller = 'adminhtml_shippingmap';
6
+ $this->_blockGroup = 'qixol';
7
+ $this->_headerText = Mage::helper('qixol')->__('Shipping Method Integration Codes');
8
+ $this->_addButtonLabel = Mage::helper('qixol')->__('Add Shipping Method Integration Code');
9
+ parent::__construct();
10
+ }
11
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Shippingmap/Edit.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Shippingmap_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+
7
+ $this->_objectId = 'id';
8
+ $this->_blockGroup = 'qixol';
9
+ $this->_controller = 'adminhtml_shippingmap';
10
+
11
+ $this->_updateButton('save', 'label', Mage::helper('qixol')->__('Save Item'));
12
+ $this->_updateButton('delete', 'label', Mage::helper('qixol')->__('Delete Item'));
13
+
14
+ $this->_addButton('saveandcontinue', array(
15
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
16
+ 'onclick' => 'saveAndContinueEdit()',
17
+ 'class' => 'save',
18
+ ), -100);
19
+
20
+ $this->_formScripts[] = "
21
+
22
+ function saveAndContinueEdit(){
23
+ editForm.submit($('edit_form').action+'back/edit/');
24
+ }
25
+
26
+ ";
27
+ }
28
+
29
+ public function getHeaderText() {
30
+ if (Mage::registry('shippingmap_data') && Mage::registry('shippingmap_data')->getId()) {
31
+ return Mage::helper('qixol')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('shippingmap_data')->getTitle()));
32
+ } else {
33
+ return Mage::helper('qixol')->__('Add Item');
34
+ }
35
+ }
36
+
37
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Shippingmap/Edit/Form.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Shippingmap_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ 'id' => 'edit_form',
8
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
9
+ 'method' => 'post',
10
+ )
11
+ );
12
+
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Shippingmap/Edit/Tab/Form.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Shippingmap_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ $hlp=Mage::helper('qixol');
6
+ $form = new Varien_Data_Form();
7
+ $this->setForm($form);
8
+ $fieldset = $form->addFieldset('shippingmap_form', array('legend' => $hlp->__('Item information')));
9
+ //$version = substr(Mage::getVersion(), 0, 3);
10
+ //$config = (($version == '1.4' || $version == '1.5') ? "'config' => Mage::getSingleton('quxol/wysiwyg_config')->getConfig()" : "'class'=>''");
11
+
12
+
13
+
14
+ $shipping_name_array_list=Array();
15
+
16
+
17
+ $list_map_names=Mage::getModel('qixol/shippingmap')->getCollection();
18
+ $list_map_names_exists=array();
19
+
20
+ foreach ($list_map_names as $list_map){
21
+ $list_map_names_exists[$list_map->getShippingName()]=$list_map->getShippingName();
22
+ }
23
+
24
+ //$carriers = Mage::getSingleton('shipping/config')->getActiveCarriers();
25
+ $carriers = Mage::getSingleton('shipping/config')->getAllCarriers();
26
+
27
+ $shippingMethodDropDownValues = array();
28
+
29
+ foreach($carriers as $_ccode => $_carrier)
30
+ {
31
+ $carrierMethods = array();
32
+
33
+ if(!$_title = Mage::getStoreConfig("carriers/$_ccode/title"))
34
+ {
35
+ $_title = $_ccode;
36
+ }
37
+
38
+ try{ //some methods not allowed getAllowedMethods
39
+ if($_methods = $_carrier->getAllowedMethods())
40
+ {
41
+ foreach($_methods as $_mcode => $_method)
42
+ {
43
+ $_code = $_ccode . '_' . $_mcode;
44
+ $shippingMethod = $hlp->__(trim($_method) == '' ? $_code : $_method);
45
+ $carrierMethods[] = array(
46
+ 'value' => $_code . '::' . $_title . '::' . $shippingMethod,
47
+ 'label' => $shippingMethod
48
+ );
49
+ if (isset($list_map_names_exists[$_code]))
50
+ {
51
+ unset($_code);
52
+ }
53
+ }
54
+
55
+ $shippingMethodDropDownValues[] = array('label' => $_title, 'value' => $carrierMethods);
56
+ }
57
+ }
58
+ catch(Exception $e) {
59
+ continue;
60
+ }
61
+
62
+ }
63
+
64
+ //$shipping_name_array_list = array(
65
+ // array(
66
+ // 'label' => 'Flatrate',
67
+ // 'value' => array(array('label' => 'Fixed', 'value' => 'flatrate_flatrate'))
68
+ // ),
69
+ // array(
70
+ // 'label' => 'Free Shipping',
71
+ // 'value' => array(array('label' => 'Free', 'value' => 'freeshipping_freeshipping'))
72
+ // ),
73
+ // array(
74
+ // 'label' => 'Federal Express',
75
+ // 'value' => array(
76
+ // array('label' => '2 Day', 'value' => 'fedex_FEDEX_2_DAY'),
77
+ // array('label' => 'Ground', 'value' => 'fedex_FEDEX_GROUND'),
78
+ // array('label' => 'First Overnight', 'value' => 'fedex_FIRST_OVERNIGHT')
79
+ // ))
80
+ //);
81
+
82
+ $fieldset->addField('shipping_method', 'select', array(
83
+ 'label' => Mage::helper('qixol')->__('Shipping Method'),
84
+ 'class' => 'required-entry',
85
+ 'required' => true,
86
+ 'name' => 'shipping_method',
87
+ 'values' => $shippingMethodDropDownValues
88
+ ));
89
+
90
+ $fieldset->addField('integration_code', 'text', array(
91
+ 'label' => Mage::helper('qixol')->__('Integration Code'),
92
+ 'class' => 'required-entry',
93
+ 'required' => true,
94
+ 'name' => 'integration_code',
95
+ 'after_element_html' => Mage::helper('qixol')->__('Code to be synchronised to Promo'),
96
+ ));
97
+
98
+ $fieldset->addField('shipping_name', 'hidden', array(
99
+ 'name' => 'shipping_name'
100
+ ));
101
+
102
+ $fieldset->addField('carrier_title', 'hidden', array(
103
+ 'name' => 'carrier_title'
104
+ ));
105
+
106
+ $lastField = $fieldset->addField('carrier_method', 'hidden', array(
107
+ 'name' => 'carrier_method'
108
+ ));
109
+
110
+
111
+ $lastField->setAfterElementHtml($this->prepareScript());
112
+
113
+ if (Mage::getSingleton('adminhtml/session')->getShippingmapData()) {
114
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getShippingmapData());
115
+ Mage::getSingleton('adminhtml/session')->setShippingmapData(null);
116
+ } elseif (Mage::registry('shippingmap_data')) {
117
+ $form->setValues(Mage::registry('shippingmap_data')->getData());
118
+ }
119
+ return parent::_prepareForm();
120
+ }
121
+
122
+ private function prepareScript()
123
+ {
124
+ return '<script>
125
+ //< ![C
126
+ function shipping_method_onChange(){
127
+ setDataFields();
128
+ }
129
+
130
+ function setDataFields() {
131
+ var shippingMethodDetails = $("shipping_method").value.split(\'::\');
132
+ $("shipping_name").value = shippingMethodDetails[0];
133
+ $("carrier_title").value = shippingMethodDetails[1];
134
+ $("carrier_method").value = shippingMethodDetails[2];
135
+ }
136
+
137
+ document.observe("dom:loaded", function() {
138
+
139
+ $("shipping_method").observe("change",function(e){
140
+ shipping_method_onChange();
141
+ });
142
+
143
+ setDataFields();
144
+
145
+ });
146
+
147
+
148
+ //]]>
149
+ </script>';
150
+ }
151
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Shippingmap/Edit/Tabs.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Shippingmap_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('qixol_tabs');
7
+ $this->setDestElementId('edit_form');
8
+ $this->setTitle(Mage::helper('qixol')->__('Shipping Method'));
9
+ }
10
+
11
+ protected function _beforeToHtml() {
12
+ $this->addTab('form_section', array(
13
+ 'label' => Mage::helper('qixol')->__('Shipping Method'),
14
+ 'alt' => Mage::helper('qixol')->__('Shipping Method'),
15
+ 'content' => $this->getLayout()->createBlock('qixol/adminhtml_shippingmap_edit_tab_form')->toHtml(),
16
+ ));
17
+ return parent::_beforeToHtml();
18
+ }
19
+
20
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Shippingmap/Grid.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Shippingmap_Grid extends Mage_Adminhtml_Block_Widget_Grid {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('shippingmapGrid');
7
+ $this->setDefaultSort('integration_code');
8
+ $this->setDefaultDir('ASC');
9
+ $this->setSaveParametersInSession(true);
10
+ }
11
+
12
+ protected function _prepareCollection() {
13
+ $collection = Mage::getModel('qixol/shippingmap')->getCollection();
14
+ $this->setCollection($collection);
15
+ return parent::_prepareCollection();
16
+ }
17
+
18
+ protected function _prepareColumns() {
19
+ $hlp = Mage::helper('qixol');
20
+ $list_map_names=Mage::getModel('qixol/shippingmap')->getCollection();
21
+
22
+ $shipping_name_array_list=Array();
23
+ $list_map_names_exists=array();
24
+
25
+ foreach ($list_map_names as $list_map){
26
+ $list_map_names_exists[$list_map->getShippingName()]=$list_map->getShippingName();
27
+ }
28
+
29
+ //$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
30
+ $methods = Mage::getSingleton('shipping/config')->getAllCarriers();
31
+
32
+ //$options = array();
33
+
34
+ foreach($methods as $_ccode => $_carrier)
35
+ {
36
+ $_methodOptions = array();
37
+ try{ //some methods not allowed getAllowedMethods
38
+ if($_methods = $_carrier->getAllowedMethods())
39
+ {
40
+ if(!$_title = Mage::getStoreConfig("carriers/$_ccode/title"))
41
+ $_title = $_ccode;
42
+
43
+ foreach($_methods as $_mcode => $_method)
44
+ {
45
+ $_code = $_ccode . '_' . $_mcode;
46
+ $shipping_name_array_list[$_code] = $hlp->__(trim($_method)==''?$_code:$_method)." - /".$_code."/";
47
+ if (isset($list_map_names_exists[$_code])) unset($shipping_name_array_list[$_code]);
48
+ }
49
+
50
+
51
+ // $options[] = array('value' => $_methodOptions, 'label' => $hlp->__($_title));*/
52
+ }
53
+ }
54
+ catch(Exception $e) {
55
+ continue;
56
+ }
57
+ }
58
+
59
+ if (count($list_map_names_exists)){
60
+ foreach ($list_map_names_exists as $exists_old_code)
61
+ $shipping_name_array_list[$exists_old_code] = $hlp->__($exists_old_code);
62
+
63
+ }
64
+
65
+
66
+
67
+ $this->addColumn('shipping_name', array(
68
+ 'header' => $hlp->__('Shipping Method'),
69
+ 'type' => 'shipping',
70
+ 'align' => 'left',
71
+ 'width' => '250px',
72
+ 'index' => 'shipping_name',
73
+ 'type' => 'options',
74
+ 'options' => $shipping_name_array_list,
75
+ 'column_css_class' => 'no-display',
76
+ 'header_css_class' => 'no-display'
77
+
78
+ ));
79
+
80
+ $this->addColumn('carrier_title', array(
81
+ 'header' => $hlp->__('Carrier'),
82
+ 'align' => 'left',
83
+ 'index' => 'carrier_title'
84
+ ));
85
+
86
+ $this->addColumn('carrier_method', array(
87
+ 'header' => $hlp->__('Method'),
88
+ 'align' => 'left',
89
+ 'index' => 'carrier_method'
90
+ ));
91
+
92
+ $this->addColumn('integration_code', array(
93
+ 'header' => $hlp->__('Integration Code'),
94
+ 'width' => '350px',
95
+ 'index' => 'integration_code'
96
+ ));
97
+
98
+ $this->addColumn('action',
99
+ array(
100
+ 'header' => $hlp->__('Action'),
101
+ 'width' => '80',
102
+ 'type' => 'action',
103
+ 'getter' => 'getId',
104
+ 'actions' => array(
105
+ array(
106
+ 'caption' => $hlp->__('Edit'),
107
+ 'url' => array('base' => '*/*/edit'),
108
+ 'field' => 'id'
109
+ ),
110
+ array(
111
+ 'caption' => $hlp->__('Delete'),
112
+ 'url' => array('base' => '*/*/delete'),
113
+ 'field' => 'id'
114
+ )
115
+ ),
116
+ 'filter' => false,
117
+ 'sortable' => false,
118
+ 'index' => 'stores',
119
+ 'is_system' => true,
120
+ ));
121
+
122
+ return parent::_prepareColumns();
123
+ }
124
+
125
+ public function getRowUrl($row) {
126
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
127
+ }
128
+
129
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Sticker.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Sticker extends Mage_Adminhtml_Block_Widget_Grid_Container {
3
+
4
+ public function __construct() {
5
+ $this->_controller = 'adminhtml_sticker';
6
+ $this->_blockGroup = 'qixol';
7
+ $this->_headerText = Mage::helper('qixol')->__('Stickers Manager');
8
+ $this->_addButtonLabel = Mage::helper('qixol')->__('Add Sticker');
9
+ parent::__construct();
10
+ }
11
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Sticker/Edit.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Sticker_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+
7
+ $this->_objectId = 'id';
8
+ $this->_blockGroup = 'qixol';
9
+ $this->_controller = 'adminhtml_sticker';
10
+
11
+ $this->_updateButton('save', 'label', Mage::helper('qixol')->__('Save Item'));
12
+ $this->_updateButton('delete', 'label', Mage::helper('qixol')->__('Delete Item'));
13
+
14
+ $this->_addButton('saveandcontinue', array(
15
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
16
+ 'onclick' => 'saveAndContinueEdit()',
17
+ 'class' => 'save',
18
+ ), -100);
19
+
20
+ $this->_formScripts[] = "
21
+ /*function toggleEditor() {
22
+ if (tinyMCE.getInstanceById('sticker_content') == null) {
23
+ tinyMCE.execCommand('mceAddControl', false, 'sticker_content');
24
+ } else {
25
+ tinyMCE.execCommand('mceRemoveControl', false, 'sticker_content');
26
+ }
27
+ }*/
28
+
29
+ function saveAndContinueEdit(){
30
+ editForm.submit($('edit_form').action+'back/edit/');
31
+ }
32
+
33
+ function showTypeContents(){
34
+ var typeId=$('sticker_type').value;
35
+ var show = ((typeId==0)?'block':'none');
36
+ var hide = ((typeId==0)?'none':'block');
37
+ $('filename').setStyle({display:show});
38
+ $('filename_delete').setStyle({display:show});
39
+ //$('sticker_content').setStyle({display:hide});
40
+ setTimeout('stickerContentType()',1000);
41
+ alert($('filename').getStyle('display'))
42
+ }
43
+
44
+ function stickerContentType(){
45
+ var typeId=$('sticker_type').value;
46
+ var hide = ((typeId==0)?'none':'block');
47
+ $('buttonssticker_content').setStyle({display:hide});
48
+ $('sticker_content_parent').setStyle({display:hide});
49
+ }
50
+
51
+
52
+ /* Event.observe('sticker_type', 'change', function(){
53
+ showTypeContents();
54
+ });
55
+ Event.observe(window, 'load', function(){
56
+ showTypeContents();
57
+ }); */
58
+ ";
59
+ }
60
+
61
+ public function getHeaderText() {
62
+ if (Mage::registry('sticker_data') && Mage::registry('sticker_data')->getId()) {
63
+ return Mage::helper('qixol')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('sticker_data')->getTitle()));
64
+ } else {
65
+ return Mage::helper('qixol')->__('Add Item');
66
+ }
67
+ }
68
+
69
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Sticker/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Sticker_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ 'id' => 'edit_form',
8
+
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Sticker/Edit/Tab/Form.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Sticker_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ $form = new Varien_Data_Form();
6
+ $this->setForm($form);
7
+ $fieldset = $form->addFieldset('sticker_form', array('legend' => Mage::helper('qixol')->__('Item information')));
8
+ $version = substr(Mage::getVersion(), 0, 3);
9
+ //$config = (($version == '1.4' || $version == '1.5') ? "'config' => Mage::getSingleton('sticker/wysiwyg_config')->getConfig()" : "'class'=>''");
10
+
11
+ $fieldset->addField('filename', 'image', array(
12
+ 'label' => Mage::helper('qixol')->__('Upload and use Image'),
13
+ 'required' => true,
14
+ 'name' => 'filename',
15
+ ));
16
+
17
+ $fieldset->addField('is_default_for_type', 'select', array(
18
+ 'label' => Mage::helper('qixol')->__('Default for Promotion Type?'),
19
+ 'class' => 'required-entry',
20
+ 'name' => 'is_default_for_type',
21
+ 'values' => array(
22
+ array(
23
+ 'value' => 1,
24
+ 'label' => Mage::helper('qixol')->__('Yes'),
25
+ ),
26
+ array(
27
+ 'value' => 0,
28
+ 'label' => Mage::helper('qixol')->__('No'),
29
+ ),
30
+ ),
31
+ ));
32
+
33
+ $fieldset->addField('promo_type_name', 'select', array(
34
+ 'label' => Mage::helper('qixol')->__('Promotion Type'),
35
+ 'class' => 'required-entry',
36
+ 'required' => false,
37
+ 'name' => 'promo_type_name',
38
+ 'values' => array(
39
+ array(
40
+ 'value' => '',
41
+ 'label' => Mage::helper('qixol')->__('Not defined'),
42
+ ),
43
+ array(
44
+ 'value' => 'BOGOF',
45
+ 'label' => Mage::helper('qixol')->__('Buy one get one free'),
46
+ ),
47
+ array(
48
+ 'value' => 'BOGOR',
49
+ 'label' => Mage::helper('qixol')->__('Buy one get one reduced'),
50
+ ),
51
+ array(
52
+ 'value' => 'BUNDLE',
53
+ 'label' => Mage::helper('qixol')->__('Bundle'),
54
+ ),
55
+ array(
56
+ 'value' => 'DEAL',
57
+ 'label' => Mage::helper('qixol')->__('Deal'),
58
+ ),
59
+ array(
60
+ 'value' => 'FREEPRODUCT',
61
+ 'label' => Mage::helper('qixol')->__('Free product'),
62
+ ),
63
+ array(
64
+ 'value' => 'ISSUECOUPON',
65
+ 'label' => Mage::helper('qixol')->__('Issue coupon'),
66
+ ),
67
+ array(
68
+ 'value' => 'ISSUEPOINTS',
69
+ 'label' => Mage::helper('qixol')->__('Issue points'),
70
+ ),
71
+ array(
72
+ 'value' => 'BASKETREDUCTION',
73
+ 'label' => Mage::helper('qixol')->__('Backet reduction'),
74
+ ),
75
+ array(
76
+ 'value' => 'DELIVERYREDUCTION',
77
+ 'label' => Mage::helper('qixol')->__('Delivery reduction'),
78
+ ),
79
+ /*array(
80
+ 'value' => 8,
81
+ 'label' => Mage::helper('qixol')->__('Multiple promos'),
82
+ ),*/
83
+ array(
84
+ 'value' => 'PRODUCTSREDUCTION',
85
+ 'label' => Mage::helper('qixol')->__('Product reduction'),
86
+ ),
87
+ ),
88
+ ));
89
+
90
+ $field_last = $fieldset->addField('promo_reference', 'text', array(
91
+ 'label' => Mage::helper('qixol')->__('Promotion reference'),
92
+ 'name' => 'promo_reference',
93
+ ));
94
+
95
+ $field_last->setAfterElementHtml('<script>
96
+ //< ![C
97
+ function on_change_is_default_for_type(){
98
+ if ($(\'is_default_for_type\')[$(\'is_default_for_type\').selectedIndex].value==\'1\'){
99
+ $(\'promo_reference\').setValue("");
100
+ $(\'promo_reference\').disable();
101
+ $(\'promo_type_name\').enable();
102
+ }else {
103
+ $(\'promo_reference\').enable();
104
+ $(\'promo_type_name\').selectedIndex=0;
105
+ $(\'promo_type_name\').disable();
106
+ }
107
+
108
+ }
109
+
110
+ document.observe("dom:loaded", function() {
111
+
112
+ $("is_default_for_type").observe("change",function(e){
113
+ on_change_is_default_for_type();
114
+ });
115
+ on_change_is_default_for_type();
116
+ });
117
+
118
+
119
+ //]]>
120
+ </script>');
121
+
122
+ if (Mage::getSingleton('adminhtml/session')->getStickerData()) {
123
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getStickerData());
124
+ Mage::getSingleton('adminhtml/session')->setStickerData(null);
125
+ } elseif (Mage::registry('sticker_data')) {
126
+ $form->setValues(Mage::registry('sticker_data')->getData());
127
+ }
128
+ return parent::_prepareForm();
129
+ }
130
+
131
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Sticker/Edit/Tabs.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Sticker_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('qixol_tabs');
7
+ $this->setDestElementId('edit_form');
8
+ $this->setTitle(Mage::helper('qixol')->__('Item Information'));
9
+ }
10
+
11
+ protected function _beforeToHtml() {
12
+ $this->addTab('form_section', array(
13
+ 'label' => Mage::helper('qixol')->__('Sticker Information'),
14
+ 'alt' => Mage::helper('qixol')->__('Sticker information'),
15
+ 'content' => $this->getLayout()->createBlock('qixol/adminhtml_sticker_edit_tab_form')->toHtml(),
16
+ ));
17
+ return parent::_beforeToHtml();
18
+ }
19
+
20
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Sticker/Grid.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Sticker_Grid extends Qixol_Promo_Block_Adminhtml_Widget_Grid {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('stickerGrid');
7
+ $this->setDefaultSort('sticker_id');
8
+ $this->setDefaultDir('ASC');
9
+ $this->setSaveParametersInSession(true);
10
+ }
11
+
12
+ protected function _prepareCollection() {
13
+ $collection = Mage::getModel('qixol/sticker')->getCollection();
14
+ $this->setCollection($collection);
15
+ return parent::_prepareCollection();
16
+ }
17
+
18
+ protected function _prepareColumns() {
19
+ $this->addColumn('sticker_id', array(
20
+ 'header' => Mage::helper('qixol')->__('ID'),
21
+ 'align' => 'center',
22
+ 'width' => '30px',
23
+ 'index' => 'sticker_id',
24
+ ));
25
+
26
+ $this->addColumn('filename', array(
27
+ 'header' => Mage::helper('qixol')->__('Image'),
28
+ 'align' => 'center',
29
+ 'index' => 'filename',
30
+ 'type' => 'sticker',
31
+ 'escape' => true,
32
+ 'sortable' => false,
33
+ 'width' => '150px',
34
+ ));
35
+
36
+ $this->addColumn('promo_reference', array(
37
+ 'header' => Mage::helper('qixol')->__('Promotion reference'),
38
+ 'width' => '250px',
39
+ 'index' => 'promo_reference',
40
+ ));
41
+
42
+ $this->addColumn('promo_type_name', array(
43
+ 'header' => Mage::helper('qixol')->__('Promotion type name'),
44
+ 'width' => '100px',
45
+ 'index' => 'promo_type_name',
46
+ 'type' => 'options',
47
+ 'options' => array(
48
+ '' => Mage::helper('qixol')->__(''),
49
+ 'BOGOF' => Mage::helper('qixol')->__('Buy one get one free'),
50
+ 'BOGOR' => Mage::helper('qixol')->__('Buy one get one reduced'),
51
+ 'BUNDLE' => Mage::helper('qixol')->__('Bundle'),
52
+ 'DEAL' => Mage::helper('qixol')->__('Deal'),
53
+ 'FREEPRODUCT' => Mage::helper('qixol')->__('Free product'),
54
+ 'ISSUECOUPON' => Mage::helper('qixol')->__('Issue coupon'),
55
+
56
+ 'ISSUEPOINTS' => Mage::helper('qixol')->__('Issue points'),
57
+ 'BASKETREDUCTION' => Mage::helper('qixol')->__('Basket reduction'),
58
+ 'DELIVERYREDUCTION' => Mage::helper('qixol')->__('Delivery coupon'),
59
+
60
+ /*7 => 'Issue points',
61
+ 8 => 'Multiple promos',*/
62
+ 'PRODUCTSREDUCTION' => Mage::helper('qixol')->__('Product reduction'),
63
+ ),
64
+ ));
65
+
66
+ $this->addColumn('is_default_for_type', array(
67
+ 'header' => Mage::helper('qixol')->__('Default for promotion type'),
68
+ 'width' => '100px',
69
+ 'index' => 'is_default_for_type',
70
+ 'type' => 'options',
71
+ 'options' => array(
72
+ 0 => Mage::helper('qixol')->__('No'),
73
+ 1 => Mage::helper('qixol')->__('Yes'),
74
+ ),
75
+ ));
76
+
77
+ $this->addColumn('action',
78
+ array(
79
+ 'header' => Mage::helper('qixol')->__('Action'),
80
+ 'width' => '80',
81
+ 'type' => 'action',
82
+ 'getter' => 'getId',
83
+ 'actions' => array(
84
+ array(
85
+ 'caption' => Mage::helper('qixol')->__('Edit'),
86
+ 'url' => array('base' => '*/*/edit'),
87
+ 'field' => 'id'
88
+ )
89
+ ),
90
+ 'filter' => false,
91
+ 'sortable' => false,
92
+ 'index' => 'stores',
93
+ 'is_system' => true,
94
+ ));
95
+
96
+ return parent::_prepareColumns();
97
+ }
98
+
99
+ protected function _prepareMassaction() {
100
+ $this->setMassactionIdField('sticker_id');
101
+ $this->getMassactionBlock()->setFormFieldName('sticker');
102
+
103
+ $this->getMassactionBlock()->addItem('delete', array(
104
+ 'label' => Mage::helper('qixol')->__('Delete'),
105
+ 'url' => $this->getUrl('*/*/massDelete'),
106
+ 'confirm' => Mage::helper('qixol')->__('Are you sure?')
107
+ ));
108
+
109
+ $statuses = Mage::getSingleton('qixol/status')->getOptionArray();
110
+
111
+ array_unshift($statuses, array('label' => '', 'value' => ''));
112
+ $this->getMassactionBlock()->addItem('status', array(
113
+ 'label' => Mage::helper('qixol')->__('Change status'),
114
+ 'url' => $this->getUrl('*/*/massStatus', array('_current' => true)),
115
+ 'additional' => array(
116
+ 'visibility' => array(
117
+ 'name' => 'status',
118
+ 'type' => 'select',
119
+ 'class' => 'required-entry',
120
+ 'label' => Mage::helper('qixol')->__('Status'),
121
+ 'values' => $statuses
122
+ )
123
+ )
124
+ ));
125
+ return $this;
126
+ }
127
+
128
+ public function getRowUrl($row) {
129
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
130
+ }
131
+
132
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Storesmap.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Storesmap extends Mage_Adminhtml_Block_Widget_Grid_Container {
3
+
4
+ public function __construct() {
5
+ $this->_controller = 'adminhtml_storesmap';
6
+ $this->_blockGroup = 'qixol';
7
+ $this->_headerText = Mage::helper('qixol')->__('Store Integration Codes');
8
+ $this->_addButtonLabel = Mage::helper('qixol')->__('Add Store Integration Code');
9
+ parent::__construct();
10
+ }
11
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Storesmap/Edit.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Storesmap_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+
7
+ $this->_objectId = 'id';
8
+ $this->_blockGroup = 'qixol';
9
+ $this->_controller = 'adminhtml_storesmap';
10
+
11
+ $this->_updateButton('save', 'label', Mage::helper('qixol')->__('Save Item'));
12
+ $this->_updateButton('delete', 'label', Mage::helper('qixol')->__('Delete Item'));
13
+
14
+ $this->_addButton('saveandcontinue', array(
15
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
16
+ 'onclick' => 'saveAndContinueEdit()',
17
+ 'class' => 'save',
18
+ ), -100);
19
+
20
+ $this->_formScripts[] = "
21
+
22
+ function saveAndContinueEdit(){
23
+ editForm.submit($('edit_form').action+'back/edit/');
24
+ }
25
+
26
+ ";
27
+ }
28
+
29
+ public function getHeaderText() {
30
+ if (Mage::registry('storesmap_data') && Mage::registry('storesmap_data')->getId()) {
31
+ return Mage::helper('qixol')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('storesmap_data')->getTitle()));
32
+ } else {
33
+ return Mage::helper('qixol')->__('Add Item');
34
+ }
35
+ }
36
+
37
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Storesmap/Edit/Form.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Storesmap_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ 'id' => 'edit_form',
8
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
9
+ 'method' => 'post',
10
+ )
11
+ );
12
+
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Storesmap/Edit/Tab/Form.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Storesmap_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
3
+
4
+ protected function _prepareForm() {
5
+ $hlp=Mage::helper('qixol');
6
+ $form = new Varien_Data_Form();
7
+ $this->setForm($form);
8
+ $fieldset = $form->addFieldset('storesmap_form', array('legend' => $hlp->__('Item information')));
9
+ //$version = substr(Mage::getVersion(), 0, 3);
10
+ //$config = (($version == '1.4' || $version == '1.5') ? "'config' => Mage::getSingleton('quxol/wysiwyg_config')->getConfig()" : "'class'=>''");
11
+
12
+
13
+
14
+ $store_name_array_list=Array();
15
+ $list_map_names_exists=array();
16
+
17
+ foreach ($list_map_names as $list_map)
18
+ {
19
+ $list_map_names_exists[$list_map->getWebsite()][$list_map->getStoreGroup()][$list_map->getStoreName()] = $list_map->getStoreName();
20
+ }
21
+
22
+ $dropDownList = array();
23
+
24
+ foreach (Mage::app()->getWebsites() as $website)
25
+ {
26
+ $storeGroups = array();
27
+
28
+ foreach ($website->getGroups() as $group)
29
+ {
30
+ $stores = $group->getStores();
31
+ $storesArray = array();
32
+ foreach ($stores as $store)
33
+ {
34
+ $storesArray[] = array(
35
+ 'value' => $website->getName() . '::' . $group->getName() . '::' . $store->getName(),
36
+ 'label' => $store->getName()
37
+ );
38
+ /*
39
+ $store_name_array_list[$website->getName()][$group->getName()][$store->getName()] = $store->getName();
40
+ if (isset($list_map_names_exists[$website->getName()][$group->getName()][$store->getName()]))
41
+ {
42
+ unset($store_name_array_list[$website->getName()][$group->getName()][$store->getName()]);
43
+ }
44
+ */
45
+ }
46
+ $storeGroups[] = array(
47
+ 'label' => $group->getName(),
48
+ 'value' => $storesArray
49
+ );
50
+ }
51
+ $dropDownList[] = array(
52
+ 'label' => $website->getName(),
53
+ 'value' => $storeGroups
54
+ );
55
+ }
56
+
57
+ // if (count($list_map_names_exists))
58
+ // {
59
+ // foreach ($list_map_names_exists as $exists_old_code)
60
+ // {
61
+ // $store_name_array_list[$exists_old_code] = $hlp->__($exists_old_code);
62
+ // }
63
+ // }
64
+
65
+ $fieldset->addField('store_dropdown', 'select', array(
66
+ 'label' => Mage::helper('qixol')->__('Store Name'),
67
+ 'class' => 'required-entry',
68
+ 'required' => true,
69
+ 'name' => 'store_dropdown',
70
+ 'values' => $dropDownList
71
+ ));
72
+
73
+ $fieldset->addField('integration_code', 'text', array(
74
+ 'label' => Mage::helper('qixol')->__('Integration Code'),
75
+ 'class' => 'required-entry',
76
+ 'required' => true,
77
+ 'name' => 'integration_code',
78
+ 'after_element_html' => Mage::helper('qixol')->__('Code to be sent to Promo.'),
79
+ ));
80
+
81
+ $fieldset->addField('website', 'hidden', array(
82
+ 'name' => 'website'
83
+ ));
84
+
85
+ $fieldset->addField('store_group', 'hidden', array(
86
+ 'name' => 'store_group'
87
+ ));
88
+
89
+ $lastField = $fieldset->addField('store_name', 'hidden', array(
90
+ 'name' => 'store_name'
91
+ ));
92
+
93
+ $lastField->setAfterElementHtml($this->prepareScript());
94
+
95
+ if (Mage::getSingleton('adminhtml/session')->getStoresmapData()) {
96
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getStoresmapData());
97
+ Mage::getSingleton('adminhtml/session')->getStoresmapData(null);
98
+ } elseif (Mage::registry('storesmap_data')) {
99
+ $form->setValues(Mage::registry('storesmap_data')->getData());
100
+ }
101
+ return parent::_prepareForm();
102
+ }
103
+
104
+ private function prepareScript()
105
+ {
106
+ return '<script>
107
+ //< ![C
108
+ function store_dropdown_onChange(){
109
+ setDataFields();
110
+ }
111
+
112
+ function setDataFields() {
113
+ var storeDetails = $("store_dropdown").value.split(\'::\');
114
+ $("website").value = storeDetails[0];
115
+ $("store_group").value = storeDetails[1];
116
+ $("store_name").value = storeDetails[2];
117
+ }
118
+
119
+ document.observe("dom:loaded", function() {
120
+
121
+ $("store_dropdown").observe("change",function(e){
122
+ store_dropdown_onChange();
123
+ });
124
+
125
+ setDataFields();
126
+
127
+ });
128
+
129
+
130
+ //]]>
131
+ </script>';
132
+ }
133
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Storesmap/Edit/Tabs.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Storesmap_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('qixol_tabs');
7
+ $this->setDestElementId('edit_form');
8
+ $this->setTitle(Mage::helper('qixol')->__('Stores'));
9
+ }
10
+
11
+ protected function _beforeToHtml() {
12
+ $this->addTab('form_section', array(
13
+ 'label' => Mage::helper('qixol')->__('Integration Codes'),
14
+ 'alt' => Mage::helper('qixol')->__('Integration Codes'),
15
+ 'content' => $this->getLayout()->createBlock('qixol/adminhtml_storesmap_edit_tab_form')->toHtml(),
16
+ ));
17
+ return parent::_beforeToHtml();
18
+ }
19
+
20
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Storesmap/Grid.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_Storesmap_Grid extends Mage_Adminhtml_Block_Widget_Grid {
3
+
4
+ public function __construct() {
5
+ parent::__construct();
6
+ $this->setId('storesmapGrid');
7
+ $this->setDefaultSort('store_name');
8
+ $this->setDefaultDir('ASC');
9
+ $this->setSaveParametersInSession(true);
10
+ }
11
+
12
+ protected function _prepareCollection() {
13
+ $collection = Mage::getModel('qixol/storesmap')->getCollection();
14
+ $this->setCollection($collection);
15
+ return parent::_prepareCollection();
16
+ }
17
+
18
+ protected function _prepareColumns() {
19
+ $hlp = Mage::helper('qixol');
20
+ $list_map_names=Mage::getModel('qixol/storesmap')->getCollection();
21
+
22
+ $store_name_array_list=Array();
23
+ $list_map_names_exists=array();
24
+
25
+ foreach ($list_map_names as $list_map){
26
+ $list_map_names_exists[$list_map->getStoreName()]=$list_map->getStoreName();
27
+ }
28
+
29
+
30
+ foreach (Mage::app()->getWebsites() as $website) {
31
+ foreach ($website->getGroups() as $group) {
32
+ $stores = $group->getStores();
33
+ foreach ($stores as $store) {
34
+ $store_name_array_list[$store->getName()] = $store->getName();
35
+ if (isset($list_map_names_exists[$store->getName()])) unset($store_name_array_list[$store->getName()]);
36
+ }
37
+ }
38
+ }
39
+
40
+ if (count($list_map_names_exists)){
41
+ foreach ($list_map_names_exists as $exists_old_code)
42
+ $store_name_array_list[$exists_old_code] = $hlp->__($exists_old_code);
43
+
44
+ }
45
+
46
+
47
+ $this->addColumn('website', array(
48
+ 'header' => $hlp->__('Website'),
49
+ 'align' => 'left',
50
+ 'width' => '250px',
51
+ 'index' => 'website'
52
+ ));
53
+
54
+ $this->addColumn('store_group', array(
55
+ 'header' => $hlp->__('Store Group'),
56
+ 'align' => 'left',
57
+ 'width' => '250px',
58
+ 'index' => 'store_group'
59
+ ));
60
+
61
+ $this->addColumn('store_name', array(
62
+ 'header' => $hlp->__('Store Name'),
63
+ 'type' => 'stores',
64
+ 'align' => 'left',
65
+ 'width' => '250px',
66
+ 'index' => 'store_name',
67
+ 'type' => 'options',
68
+ 'options' => $store_name_array_list
69
+ ));
70
+
71
+
72
+
73
+ $this->addColumn('integration_code', array(
74
+ 'header' => $hlp->__('Integration Code'),
75
+ 'width' => '350px',
76
+ 'index' => 'integration_code'
77
+ ));
78
+
79
+ $this->addColumn('action',
80
+ array(
81
+ 'header' => $hlp->__('Action'),
82
+ 'width' => '80',
83
+ 'type' => 'action',
84
+ 'getter' => 'getId',
85
+ 'actions' => array(
86
+ array(
87
+ 'caption' => $hlp->__('Edit'),
88
+ 'url' => array('base' => '*/*/edit'),
89
+ 'field' => 'id'
90
+ ),
91
+ array(
92
+ 'caption' => $hlp->__('Delete'),
93
+ 'url' => array('base' => '*/*/delete'),
94
+ 'field' => 'id'
95
+ )
96
+ ),
97
+ 'filter' => false,
98
+ 'sortable' => false,
99
+ 'index' => 'stores',
100
+ 'is_system' => true,
101
+ ));
102
+
103
+ return parent::_prepareColumns();
104
+ }
105
+
106
+ public function getRowUrl($row) {
107
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
108
+ }
109
+
110
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/System/Config/Attributes.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Adminhtml_System_Config_Attributes extends Mage_Adminhtml_Block_System_Config_Form_Field{
3
+ const CONFIG_PATH = 'qixol/productattrib/attributes'; //put here the full path from the config to your element
4
+ protected $_values = null;
5
+ protected function _construct()
6
+ {
7
+ $this->setTemplate('qixol/system/config/attributes.phtml');
8
+ return parent::_construct();
9
+ }
10
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
11
+ {
12
+ $this->setNamePrefix($element->getName())
13
+ ->setHtmlId($element->getHtmlId());
14
+ return $this->_toHtml();
15
+ }
16
+ public function getValues(){
17
+ $values = array();
18
+ //get the available values (use the source model from your question)
19
+ foreach (Mage::getSingleton('qixol/system_config_source_attributes')->toOptionArray() as $value){
20
+ $values[$value['value']] = $value['label'];
21
+ }
22
+ return $values;
23
+ }
24
+ public function getIsChecked($name){
25
+ return in_array($name, $this->getCheckedValues());
26
+ }
27
+ public function getCheckedValues(){
28
+ if (is_null($this->_values)){
29
+ $data = $this->getConfigData();
30
+ if (isset($data[self::CONFIG_PATH])){
31
+ $data = $data[self::CONFIG_PATH];
32
+ }
33
+ else{
34
+ $data = '';
35
+ }
36
+ $this->_values = explode(',', $data);
37
+ }
38
+ return $this->_values;
39
+ }
40
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Widget/Grid.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage/Adminhtml/Block/Widget/Grid.php';
3
+ class Qixol_Promo_Block_Adminhtml_Widget_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function addColumn($columnId, $column) {
6
+ if (is_array($column)) {
7
+ $this->_columns[$columnId] = $this->getLayout()->createBlock('qixol/adminhtml_widget_grid_column')
8
+ ->setData($column)
9
+ ->setGrid($this);
10
+ }
11
+ /* elseif ($column instanceof Varien_Object) {
12
+ $this->_columns[$columnId] = $column;
13
+ } */ else {
14
+ throw new Exception(Mage::helper('adminhtml')->__('Wrong column format'));
15
+ }
16
+
17
+ $this->_columns[$columnId]->setId($columnId);
18
+ $this->_lastColumnId = $columnId;
19
+ return $this;
20
+ }
21
+
22
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Widget/Grid/Column.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage/Adminhtml/Block/Widget/Grid/Column.php';
3
+
4
+ class Qixol_Promo_Block_Adminhtml_Widget_Grid_Column extends Mage_Adminhtml_Block_Widget_Grid_Column {
5
+
6
+ protected function _getRendererByType() {
7
+ switch (strtolower($this->getType())) {
8
+ case 'banner':
9
+ $rendererClass = 'qixol/adminhtml_widget_grid_column_renderer_banner';
10
+ break;
11
+ case 'sticker':
12
+ $rendererClass = 'qixol/adminhtml_widget_grid_column_renderer_sticker';
13
+ break;
14
+ default:
15
+ $rendererClass = parent::_getRendererByType();
16
+ break;
17
+ }
18
+ return $rendererClass;
19
+ }
20
+
21
+ protected function _getFilterByType() {
22
+ switch (strtolower($this->getType())) {
23
+ case 'banner':
24
+ $filterClass = 'qixol/adminhtml_widget_grid_column_filter_banner';
25
+ break;
26
+ case 'sticker':
27
+ $filterClass = 'qixol/adminhtml_widget_grid_column_filter_banner';
28
+ break;
29
+ default:
30
+ $filterClass = parent::_getFilterByType();
31
+ break;
32
+ }
33
+ return $filterClass;
34
+ }
35
+
36
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Widget/Grid/Column/Filter/Banner.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once 'Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Text.php';
4
+
5
+ class Qixol_Promo_Block_Adminhtml_Widget_Grid_Column_Filter_Banner extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Text {
6
+
7
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Widget/Grid/Column/Renderer/Banner.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once 'Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php';
4
+ class Qixol_Promo_Block_Adminhtml_Widget_Grid_Column_Renderer_Banner extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
5
+
6
+ public function __construct() {
7
+
8
+ }
9
+
10
+ public function render(Varien_Object $row) {
11
+ return $this->_getValue($row);
12
+ }
13
+
14
+ protected function _getValue(Varien_Object $row) {
15
+ $dored = false;
16
+ $out = '';
17
+ if ($getter = $this->getColumn()->getGetter()) {
18
+ $val = $row->$getter();
19
+ }
20
+ $val = $row->getData($this->getColumn()->getIndex());
21
+ if (trim($val)!=''){
22
+ $url = Mage::helper('qixol')->getImageUrl($val);
23
+ $size = Mage::helper('qixol')->getImageThumbSize($val);
24
+ $file_extis = Mage::helper('qixol')->getFileExists($val);
25
+ $popLink = "popWin('$url','image','width=800,height=600,resizable=yes,scrollbars=yes')";
26
+ if (is_array($size) && $file_extis)
27
+ $out = '<a href="javascript:;" onclick="'.$popLink.'"><img src="'.$url.'" width="'.$size['width'].'" height="'.$size['height'].'" style="border: 2px solid #CCCCCC;"/></a>';
28
+ }
29
+ return $out;
30
+ }
31
+ }
app/code/community/Qixol/Promo/Block/Adminhtml/Widget/Grid/Column/Renderer/Sticker.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once 'Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php';
4
+ class Qixol_Promo_Block_Adminhtml_Widget_Grid_Column_Renderer_Sticker extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
5
+
6
+ public function __construct() {
7
+
8
+ }
9
+
10
+ public function render(Varien_Object $row) {
11
+ return $this->_getValue($row);
12
+ }
13
+
14
+ protected function _getValue(Varien_Object $row) {
15
+ $dored = false;
16
+ $out = '';
17
+ if ($getter = $this->getColumn()->getGetter()) {
18
+ $val = $row->$getter();
19
+ }
20
+
21
+ $val = $row->getData($this->getColumn()->getIndex());
22
+ if (trim($val)!=''){
23
+ $url = Mage::helper('qixol')->getImageUrl($val);
24
+ $size = Mage::helper('qixol')->getImageThumbSize($val);
25
+ $file_extis = Mage::helper('qixol')->getFileExists($val);
26
+ $popLink = "popWin('$url','image','width=800,height=600,resizable=yes,scrollbars=yes')";
27
+ if (is_array($size) && $file_extis)
28
+ $out = '<a href="javascript:;" onclick="'.$popLink.'"><img src="'.$url.'" width="'.$size['width'].'" height="'.$size['height'].'" style="border: 2px solid #CCCCCC;"/></a>';
29
+ }else {
30
+ $val = $row->getData('use_default_sticker');
31
+ if ($val!=''){
32
+ $url=Mage::getModel('qixol/sticker')->getDefaultSticker($val);
33
+ $popLink = "popWin('$url','image','width=800,height=600,resizable=yes,scrollbars=yes')";
34
+ $out = '<a href="javascript:;" onclick="'.$popLink.'"><img src="'.$url.'" width="100" style="border: 2px solid #CCCCCC;"/></a>';
35
+ }
36
+ }
37
+ return $out;
38
+ }
39
+ }
app/code/community/Qixol/Promo/Block/Banner.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Banner extends Mage_Core_Block_Template {
3
+
4
+ public function _prepareLayout() {
5
+ return parent::_prepareLayout();
6
+ }
7
+
8
+ public function getBanner() {
9
+ if (!$this->hasData('banner')) {
10
+ $this->setData('banner', Mage::registry('banner'));
11
+ }
12
+ return $this->getData('banner');
13
+ }
14
+
15
+ public function getResizeImage($bannerPath, $groupName, $w = 0, $h = 0) {
16
+ $name = '';
17
+ $_helper = Mage::helper('qixol');
18
+ $bannerDirPath = $_helper->updateDirSepereator($bannerPath);
19
+ $baseDir = Mage::getBaseDir();
20
+ $mediaDir = Mage::getBaseDir('media');
21
+ $mediaUrl = Mage::getBaseUrl('media');
22
+ $resizeDir = $mediaDir . DS . 'custom' . DS . 'banners' . DS . 'resize' . DS;
23
+ $resizeUrl = $mediaUrl.'custom/banners/resize/';
24
+ $imageName = basename($bannerDirPath);
25
+
26
+ if (@file_exists($mediaDir . DS . $bannerDirPath)) {
27
+ $name = $mediaDir . DS . $bannerPath;
28
+ $this->checkDir($resizeDir . $groupName);
29
+ $smallImgPath = $resizeDir . $groupName . DS . $imageName;
30
+ $smallImg = $resizeUrl . $groupName .'/'. $imageName;
31
+ }
32
+
33
+ if ($name != '') {
34
+ $resizeObject = Mage::getModel('qixol/bannerresize');
35
+ $resizeObject->setImage($name);
36
+ if ($resizeObject->resizeLimitwh($w, $h, $smallImgPath) === false) {
37
+ return $resizeObject->error();
38
+ } else {
39
+ return $smallImg;
40
+ }
41
+ } else {
42
+ return '';
43
+ }
44
+ }
45
+
46
+ protected function checkDir($directory) {
47
+ if (!is_dir($directory)) {
48
+ umask(0);
49
+ mkdir($directory, 0777,true);
50
+ return true;
51
+ }
52
+ }
53
+
54
+ }
app/code/community/Qixol/Promo/Block/Bannerboxes.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Bannerboxes extends Mage_Core_Block_Template {
3
+
4
+ public function _prepareLayout() {
5
+ return parent::_prepareLayout();
6
+ }
7
+
8
+ public function getBannerboxes() {
9
+ if (!$this->hasData('bannerboxes')) {
10
+ $this->setData('bannerboxes', Mage::registry('bannerboxes'));
11
+ }
12
+ return $this->getData('bannerboxes');
13
+ }
14
+
15
+
16
+
17
+ }
app/code/community/Qixol/Promo/Block/Customergrouspmap.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Customergrouspmap extends Mage_Core_Block_Template {
3
+
4
+ public function _prepareLayout() {
5
+ return parent::_prepareLayout();
6
+ }
7
+
8
+ public function getShippingmap() {
9
+ if (!$this->hasData('customergrouspmap')) {
10
+ $this->setData('customergrouspmap', Mage::registry('customergrouspmap'));
11
+ }
12
+ return $this->getData('customergrouspmap');
13
+ }
14
+
15
+
16
+
17
+ }
app/code/community/Qixol/Promo/Block/Issuedcoupon.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Qixol_Promo_Block_Issuedcoupon extends Mage_Customer_Block_Account_Dashboard // Mage_Core_Block_Template
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ }
10
+ }
app/code/community/Qixol/Promo/Block/Sales/Creditmemo.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //????????????????
3
+ class Qixol_Promo_Block_Adminhtml_Sales_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
4
+ {
5
+ protected function _initTotals() {
6
+ parent::_initTotals();
7
+ $amt = $this->getSource()->getPointsAmount();
8
+ $baseAmt = $this->getSource()->getBasePointsAmount();
9
+ if ($amt != 0) {
10
+
11
+ $this->addTotal(new Varien_Object(array(
12
+ 'code' => 'points',
13
+ 'value' => $amt,
14
+ 'base_value' => $baseAmt,
15
+ 'label' => 'Rewards points discount',
16
+ )), 'points');
17
+ }
18
+ return $this;
19
+ }
20
+
21
+ }
app/code/community/Qixol/Promo/Block/Sales/Invoice.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //????????????????
3
+ class Qixol_Promo_Block_Adminhtml_Sales_Invoice extends Mage_Sales_Block_Order_Invoice_Totals
4
+ {
5
+ protected function _initTotals() {
6
+ parent::_initTotals();
7
+ $amt = $this->getSource()->getPointsAmount();
8
+ $baseAmt = $this->getSource()->getBasePointsAmount();
9
+ if ($amt != 0) {
10
+ $this->addTotal(new Varien_Object(array(
11
+ 'code' => 'points',
12
+ 'value' => $amt,
13
+ 'base_value' => $baseAmt,
14
+ 'label' => 'Reward Points Discount',
15
+ )), 'points');
16
+ }
17
+ return $this;
18
+ }
19
+
20
+ }
app/code/community/Qixol/Promo/Block/Sales/Order.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //????????????????
3
+ class Qixol_Promo_Block_Adminhtml_Sales_Order extends Mage_Sales_Block_Order_Totals
4
+ {
5
+ protected function _initTotals() {
6
+
7
+ parent::_initTotals();
8
+ $amt = $this->getSource()->getPointsAmount();
9
+ $baseAmt = $this->getSource()->getBasePointsAmount();
10
+ if ($amt != 0) {
11
+ $this->addTotal(new Varien_Object(array(
12
+ 'code' => 'points',
13
+ 'value' => $amt,
14
+ 'base_value' => $baseAmt,
15
+ 'label' => 'Reward points discount',
16
+ )), 'points');
17
+ }
18
+ return $this;
19
+ }
20
+ }
app/code/community/Qixol/Promo/Block/Sales/Order/Total.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Sales_Order_Total extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * Get label cell tag properties
6
+ *
7
+ * @return string
8
+ */
9
+ public function getLabelProperties()
10
+ {
11
+ return $this->getParentBlock()->getLabelProperties();
12
+ }
13
+
14
+ /**
15
+ * Get order store object
16
+ *
17
+ * @return Mage_Sales_Model_Order
18
+ */
19
+ public function getOrder()
20
+ {
21
+ return $this->getParentBlock()->getOrder();
22
+ }
23
+
24
+ /**
25
+ * Get totals source object
26
+ *
27
+ * @return Mage_Sales_Model_Order
28
+ */
29
+ public function getSource()
30
+ {
31
+ return $this->getParentBlock()->getSource();
32
+ }
33
+
34
+ /**
35
+ * Get value cell tag properties
36
+ *
37
+ * @return string
38
+ */
39
+ public function getValueProperties()
40
+ {
41
+ return $this->getParentBlock()->getValueProperties();
42
+ }
43
+
44
+ /**
45
+ * Initialize reward points totals
46
+ *
47
+ */
48
+ public function initTotals()
49
+ {
50
+ if ((float) $this->getOrder()->getBasePointsAmount()) {
51
+ $source = $this->getSource();
52
+ $value = $source->getPointsAmount();
53
+
54
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
55
+ 'code' => 'points',
56
+ 'strong' => false,
57
+ 'label' => 'Reward points discount',
58
+ 'value' => $source instanceof Mage_Sales_Model_Order_Creditmemo ? - $value : -$value
59
+ )));
60
+ }
61
+
62
+ return $this;
63
+ }
64
+ }
app/code/community/Qixol/Promo/Block/Shippingmap.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Shippingmap extends Mage_Core_Block_Template {
3
+
4
+ public function _prepareLayout() {
5
+ return parent::_prepareLayout();
6
+ }
7
+
8
+ public function getShippingmap() {
9
+ if (!$this->hasData('shippingmap')) {
10
+ $this->setData('shippingmap', Mage::registry('shippingmap'));
11
+ }
12
+ return $this->getData('shippingmap');
13
+ }
14
+
15
+
16
+
17
+ }
app/code/community/Qixol/Promo/Block/Startexportbutton.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Startexportbutton extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $this->setElement($element);
8
+ $_hlp = Mage::helper('qixol');
9
+ $html = $this->AddJs();
10
+
11
+ $start_export_button = $this->getLayout()->createBlock('adminhtml/widget_button')
12
+ ->setType('button')
13
+ ->setClass('scalable')
14
+ ->setLabel('Export now')
15
+ ->setOnClick("start_promo_export()")
16
+ ->toHtml();
17
+ $safe_mode_set = ini_get('safe_mode');
18
+ if($safe_mode_set){
19
+ $html .="<p class='sinch-error'><b>You can't start export (safe_mode is 'On'. set safe_mode = Off in php.ini )<b></p>";
20
+ } else {
21
+ $html .= $start_export_button;
22
+ }
23
+
24
+ $html .= '<div id="qixolexport_status_template" name="qixolexport_status_template" style="display:none; margin-top: 5px;">';//none
25
+ $html .= $this->getProcessingHtml();
26
+ $html .= '</div>';
27
+
28
+ $html .= '<div id="export_current_status_message" name="export_current_status_message" style="display:true"><br />';
29
+ $export=Mage::getModel('qixol/sinch');
30
+ // TODO: near duplicate of code in AjaxController.php
31
+ $last_export_statuses = $export->getDataOfLatestExport();
32
+ foreach ($last_export_statuses as $last_export_status)
33
+ {
34
+ $message = $last_export_status['last_message'];
35
+ switch ($message)
36
+ {
37
+ case 'error':
38
+ $html .= '<hr /><p class="sinch-error">';
39
+ $html .= $last_export_status['export_what'];
40
+ $html .= ' export failed</p><p>';
41
+ $html .= $last_export_status['exports_start'];
42
+ $html .= '</p><p>';
43
+ $html .= $last_export_status['status_export_message'];
44
+ $html .= '</p>';
45
+ break;
46
+ case 'success':
47
+ $html .= '<hr/><p class="sinch-success">';
48
+ $html .= $last_export_status['export_what'];
49
+ $html .= ' exported succesfully</p>';
50
+ $html .= '<p>';
51
+ $html .= $last_export_status['exports_start'];
52
+ $html .= '</p>';
53
+ break;
54
+ case 'process':
55
+ $html .= '<hr/><p>';
56
+ $html .= $last_export_status['export_what'];
57
+ $html .= ' is running now</p>';
58
+ $html .= '<p>';
59
+ $html .= $last_export_status['exports_start'];
60
+ $html .= '</p>';
61
+ break;
62
+ default:
63
+ break;
64
+ }
65
+ }
66
+ $html .= '</div>';
67
+
68
+ return $html;
69
+ }
70
+
71
+ protected function getProcessingHtml()
72
+ {
73
+ $_hlp = Mage::helper('qixol');
74
+ $run_pic = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)."adminhtml/default/default/images/_run.gif";
75
+
76
+ $html = "Exporting...&nbsp<img src='";
77
+ $html .= $run_pic;
78
+ $html .= "' alt='";
79
+ $html .= $_hlp->__('product export run');
80
+ $html .= "' />";
81
+
82
+ return $html;
83
+ }
84
+
85
+ protected function AddJs()
86
+ {
87
+ $post_url=$this->getUrl('qixol_admin/ajax/ExportProduct');
88
+ $post_url_upd=$this->getUrl('qixol_admin/ajax/UpdateExportStatus');
89
+ $statusHtml = $this->getProcessingHtml();
90
+ $html = "
91
+ <script>
92
+ function start_promo_export(){
93
+ $('qixolexport_status_template').innerHTML = \"$statusHtml\";
94
+ $('qixolexport_status_template').show();
95
+ $('export_current_status_message').hide();
96
+ this_export = new promo_export('$post_url','$post_url_upd');
97
+ this_export.startProductExport();
98
+ }
99
+
100
+ var promo_export = Class.create();
101
+ promo_export.prototype = {
102
+
103
+ initialize: function(postUrl, postUrlUpd) {
104
+ this.postUrl = postUrl;
105
+ this.postUrlUpd = postUrlUpd;
106
+ this.failureUrl = document.URL;
107
+ // unique user session ID
108
+ this.SID = null;
109
+ // object with event message data
110
+ this.objectMsg = null;
111
+ this.prevMsg = '';
112
+ // interval object
113
+ this.updateTimer = null;
114
+ // default shipping code. Display on errors
115
+
116
+ elem = 'checkoutSteps';
117
+ clickableEntity = '.head';
118
+
119
+ // overwrite Accordion class method
120
+ var headers = $$('#' + elem + ' .section ' + clickableEntity);
121
+ headers.each(function(header) {
122
+ Event.observe(header,'click',this.sectionClicked.bindAsEventListener(this));
123
+ }.bind(this));
124
+ },
125
+ startProductExport: function () {
126
+ _this = this;
127
+ new Ajax.Request(this.postUrl,
128
+ {
129
+ method:'post',
130
+ parameters: '',
131
+ requestTimeout: 10,
132
+ /*
133
+ onLoading:function(){
134
+ alert('onLoading');
135
+ },
136
+ onLoaded:function(){
137
+ alert('onLoaded');
138
+ },
139
+ */
140
+ onSuccess: function(transport) {
141
+ var response = transport.responseText || null;
142
+ _this.SID = response;
143
+ if (_this.SID) {
144
+ _this.updateEvent();
145
+ $('session_id').value = _this.SID;
146
+ } else {
147
+ alert('Can not get your session ID. Please reload the page!');
148
+ }
149
+ },
150
+ onTimeout: function() { alert('Can not get your session ID. Timeout!'); },
151
+ onFailure: function() { alert('Something went wrong...') }
152
+ });
153
+
154
+ },
155
+
156
+ updateEvent: function () {
157
+ _this = this;
158
+ new Ajax.Request(this.postUrlUpd,
159
+ {
160
+ method: 'post',
161
+ parameters: {session_id: this.SID},
162
+ onSuccess: function(transport) {
163
+ _this.objectMsg = transport.responseText.evalJSON();
164
+
165
+ if (_this.objectMsg.finished == 1) {
166
+ _this.updateExportStatusHtml();
167
+ _this.clearUpdateInterval();
168
+ } else {
169
+ _this.updateTimer = setInterval(function(){_this.updateEvent();},4000);
170
+ }
171
+
172
+ },
173
+ onFailure: this.ajaxFailure.bind(),
174
+ });
175
+ },
176
+
177
+ updateExportStatusHtml: function(){
178
+ var finishedMessage = 'Export finished.&nbsp;';
179
+ if (_this.objectMsg.error == 1) {
180
+ finishedMessage += '<img src=\"".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)."adminhtml/default/default/images/_error.png"."\"/>';
181
+ } else {
182
+ finishedMessage += '<img src=\"".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)."adminhtml/default/default/images/_yes.gif"."\"/>';
183
+ }
184
+ $('qixolexport_status_template').innerHTML = finishedMessage;
185
+ $('export_current_status_message').innerHTML = _this.objectMsg.message;
186
+ $('export_current_status_message').show();
187
+ },
188
+
189
+ ajaxFailure: function(){
190
+ this.clearUpdateInterval();
191
+ location.href = this.failureUrl;
192
+ },
193
+
194
+ clearUpdateInterval: function () {
195
+ clearInterval(this.updateTimer);
196
+ },
197
+
198
+
199
+ }
200
+ </script>
201
+ ";
202
+ return $html;
203
+ }
204
+ }
app/code/community/Qixol/Promo/Block/Startimportbutton.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Startimportbutton extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $this->setElement($element);
8
+ $_hlp = Mage::helper('qixol');
9
+ $html = $this->AddJs();
10
+
11
+ $start_import_button = $this->getLayout()->createBlock('adminhtml/widget_button')
12
+ ->setType('button')
13
+ ->setClass('scalable')
14
+ ->setLabel('Import now')
15
+ ->setOnClick("start_promotion_import()")
16
+ ->toHtml();
17
+ $safe_mode_set = ini_get('safe_mode');
18
+ if($safe_mode_set){
19
+ $html .="<p class='sinch-error'><b>You can't start import (safe_mode is 'On'. set safe_mode = Off in php.ini )<b></p>";
20
+ } else {
21
+ $html .= $start_import_button;
22
+ }
23
+
24
+ $html .= '<div id="qixolimport_status_template" name="qixolimport_status_template" style="display:none; margin-top: 5px;">';//none
25
+ $html .= $this->getProcessingHtml();
26
+ $html .= '</div>';
27
+
28
+ $html .= '<div id="import_current_status_message" name="import_current_status_message" style="display:true"><br />';
29
+ $import=Mage::getModel('qixol/sinch');
30
+ // TODO: near duplicate of code in AjaxController.php
31
+ $last_import_statuses = $import->getDataOfLatestImport();
32
+ foreach ($last_import_statuses as $last_import_status)
33
+ {
34
+ $message = $last_import_status['last_message'];
35
+ switch ($message)
36
+ {
37
+ case 'error':
38
+ $html .= '<hr /><p class="sinch-error">';
39
+ $html .= $last_import_status['import_what'];
40
+ $html .= ' import failed</p><p>';
41
+ $html .= $last_import_status['imports_start'];
42
+ $html .= '</p><p>';
43
+ $html .= $last_import_status['status_import_message'];
44
+ $html .= '</p></div>';
45
+ break;
46
+ case 'success':
47
+ $html .= '<hr/><p class="sinch-success">';
48
+ $html .= $last_import_status['import_what'];
49
+ $html .= ' imported succesfully</p>';
50
+ $html .= '<p>';
51
+ $html .= $last_import_status['imports_start'];
52
+ $html .= '</p>';
53
+ break;
54
+ case 'process':
55
+ $html .= '<hr/><p>';
56
+ $html .= $last_import_status['import_what'];
57
+ $html .= ' is running now</p>';
58
+ $html .= '<p>';
59
+ $html .= $last_import_status['imports_start'];
60
+ $html .= '</p>';
61
+ break;
62
+ default:
63
+ break;
64
+ }
65
+ }
66
+ $html .= '</div>';
67
+
68
+ return $html;
69
+ }
70
+
71
+ protected function getProcessingHtml()
72
+ {
73
+ $_hlp = Mage::helper('qixol');
74
+ $run_pic = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)."adminhtml/default/default/images/_run.gif";
75
+
76
+ $html = "Importing...&nbsp<img src='";
77
+ $html .= $run_pic;
78
+ $html .= "' alt='";
79
+ $html .= $_hlp->__('product import run');
80
+ $html .= "' />";
81
+
82
+ return $html;
83
+ }
84
+
85
+ protected function AddJs()
86
+ {
87
+ $post_url=$this->getUrl('qixol_admin/ajax/ImportPromotion');
88
+ $post_url_upd=$this->getUrl('qixol_admin/ajax/UpdateImportStatus');
89
+ $statusHtml = $this->getProcessingHtml();
90
+ $html = "
91
+ <script>
92
+ function start_promotion_import(){
93
+ $('qixolimport_status_template').innerHTML = \"$statusHtml\";
94
+ $('qixolimport_status_template').show();
95
+ $('import_current_status_message').hide();
96
+ this_import = new promo_import('$post_url','$post_url_upd');
97
+ this_import.startPromotionImport();
98
+ }
99
+
100
+ var promo_import = Class.create();
101
+ promo_import.prototype = {
102
+
103
+ initialize: function(postUrl, postUrlUpd) {
104
+ this.postUrl = postUrl;
105
+ this.postUrlUpd = postUrlUpd;
106
+ this.failureUrl = document.URL;
107
+ // unique user session ID
108
+ this.SID = null;
109
+ // object with event message data
110
+ this.objectMsg = null;
111
+ this.prevMsg = '';
112
+ // interval object
113
+ this.updateTimer = null;
114
+ // default shipping code. Display on errors
115
+
116
+ elem = 'checkoutSteps';
117
+ clickableEntity = '.head';
118
+
119
+ // overwrite Accordion class method
120
+ var headers = $$('#' + elem + ' .section ' + clickableEntity);
121
+ headers.each(function(header) {
122
+ Event.observe(header,'click',this.sectionClicked.bindAsEventListener(this));
123
+ }.bind(this));
124
+ },
125
+ startPromotionImport: function () {
126
+ _this = this;
127
+ new Ajax.Request(this.postUrl,
128
+ {
129
+ method:'post',
130
+ parameters: '',
131
+ requestTimeout: 10,
132
+ /*
133
+ onLoading:function(){
134
+ alert('onLoading');
135
+ },
136
+ onLoaded:function(){
137
+ alert('onLoaded');
138
+ },
139
+ */
140
+ onSuccess: function(transport) {
141
+ var response = transport.responseText || null;
142
+ _this.SID = response;
143
+ if (_this.SID) {
144
+ _this.updateEvent();
145
+ $('session_id').value = _this.SID;
146
+ } else {
147
+ alert('Can not get your session ID. Please reload the page!');
148
+ }
149
+ },
150
+ onTimeout: function() { alert('Can not get your session ID. Timeout!'); },
151
+ onFailure: function() { alert('Something went wrong...') }
152
+ });
153
+
154
+ },
155
+
156
+ updateEvent: function () {
157
+ _this = this;
158
+ new Ajax.Request(this.postUrlUpd,
159
+ {
160
+ method: 'post',
161
+ parameters: {session_id: this.SID},
162
+ onSuccess: function(transport) {
163
+ _this.objectMsg = transport.responseText.evalJSON();
164
+
165
+ if (_this.objectMsg.finished == 1){
166
+ _this.updateImportStatusHtml();
167
+ _this.clearUpdateInterval();
168
+ } else {
169
+ _this.updateTimer = setInterval(function(){_this.updateEvent();},4000);
170
+ }
171
+
172
+ },
173
+ onFailure: this.ajaxFailure.bind(),
174
+ });
175
+ },
176
+
177
+ updateImportStatusHtml: function(){
178
+ var finishedMessage = 'Import finished.&nbsp;';
179
+ if (_this.objectMsg.error == 1) {
180
+ finishedMessage += '<img src=\"".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)."adminhtml/default/default/images/_error.png"."\"/>';
181
+ } else {
182
+ finishedMessage += '<img src=\"".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)."adminhtml/default/default/images/_yes.gif"."\"/>';
183
+ }
184
+ $('qixolimport_status_template').innerHTML = finishedMessage;
185
+ $('import_current_status_message').innerHTML = _this.objectMsg.message;
186
+ $('import_current_status_message').show();
187
+ },
188
+
189
+ ajaxFailure: function(){
190
+ this.clearUpdateInterval();
191
+ location.href = this.failureUrl;
192
+ },
193
+
194
+ clearUpdateInterval: function () {
195
+ clearInterval(this.updateTimer);
196
+ },
197
+
198
+
199
+ }
200
+ </script>
201
+ ";
202
+ return $html;
203
+ }
204
+ }
app/code/community/Qixol/Promo/Block/Sticker.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Sticker extends Mage_Core_Block_Template {
3
+
4
+ public function _prepareLayout() {
5
+ return parent::_prepareLayout();
6
+ }
7
+
8
+ public function getSticker() {
9
+ if (!$this->hasData('sticker')) {
10
+ $this->setData('sticker', Mage::registry('sticker'));
11
+ }
12
+ return $this->getData('sticker');
13
+ }
14
+
15
+ public function getResizeImage($bannerPath, $groupName, $w = 0, $h = 0) {
16
+ $name = '';
17
+ $_helper = Mage::helper('qixol');
18
+ $bannerDirPath = $_helper->updateDirSepereator($bannerPath);
19
+ $baseDir = Mage::getBaseDir();
20
+ $mediaDir = Mage::getBaseDir('media');
21
+ $mediaUrl = Mage::getBaseUrl('media');
22
+ $resizeDir = $mediaDir . DS . 'custom' . DS . 'stickers' . DS . 'resize' . DS;
23
+ $resizeUrl = $mediaUrl.'custom/stickers/resize/';
24
+ $imageName = basename($bannerDirPath);
25
+
26
+ if (@file_exists($mediaDir . DS . $bannerDirPath)) {
27
+ $name = $mediaDir . DS . $bannerPath;
28
+ $this->checkDir($resizeDir . $groupName);
29
+ $smallImgPath = $resizeDir . $groupName . DS . $imageName;
30
+ $smallImg = $resizeUrl . $groupName .'/'. $imageName;
31
+ }
32
+
33
+ if ($name != '') {
34
+ $resizeObject = Mage::getModel('qixol/stickerresize');
35
+ $resizeObject->setImage($name);
36
+ if ($resizeObject->resizeLimitwh($w, $h, $smallImgPath) === false) {
37
+ return $resizeObject->error();
38
+ } else {
39
+ return $smallImg;
40
+ }
41
+ } else {
42
+ return '';
43
+ }
44
+ }
45
+
46
+ protected function checkDir($directory) {
47
+ if (!is_dir($directory)) {
48
+ umask(0);
49
+ mkdir($directory, 0777,true);
50
+ return true;
51
+ }
52
+ }
53
+
54
+ }
app/code/community/Qixol/Promo/Block/Storesmap.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Block_Storesmap extends Mage_Core_Block_Template {
3
+
4
+ public function _prepareLayout() {
5
+ return parent::_prepareLayout();
6
+ }
7
+
8
+ public function getShippingmap() {
9
+ if (!$this->hasData('storesmap')) {
10
+ $this->setData('storesmap', Mage::registry('storesmap'));
11
+ }
12
+ return $this->getData('storesmap');
13
+ }
14
+
15
+
16
+
17
+ }
app/code/community/Qixol/Promo/Helper/Data.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+
6
+ protected static $egridImgDir = null;
7
+ protected static $egridImgURL = null;
8
+ protected static $egridImgThumb = null;
9
+ protected static $egridImgThumbWidth = null;
10
+ protected $_allowedExtensions = Array();
11
+
12
+ public function __construct() {
13
+ self::$egridImgDir = Mage::getBaseDir('media') . DS;
14
+ self::$egridImgURL = Mage::getBaseUrl('media');
15
+ self::$egridImgThumb = "thumb/";
16
+ self::$egridImgThumbWidth = 100;
17
+ }
18
+
19
+ public function updateDirSepereator($path){
20
+ return str_replace('\\', DS, $path);
21
+ }
22
+
23
+ public function getImageUrl($image_file) {
24
+ $url = false;
25
+ if (file_exists(self::$egridImgDir . self::$egridImgThumb . $this->updateDirSepereator($image_file)))
26
+ $url = self::$egridImgURL . self::$egridImgThumb . $image_file;
27
+ else
28
+ $url = self::$egridImgURL . $image_file;
29
+ return $url;
30
+ }
31
+
32
+ public function getFileExists($image_file) {
33
+ $file_exists = false;
34
+ $file_exists = file_exists(self::$egridImgDir . $this->updateDirSepereator($image_file));
35
+ return $file_exists;
36
+ }
37
+
38
+ public function getImageThumbSize($image_file) {
39
+ $img_file = $this->updateDirSepereator(self::$egridImgDir . $image_file);
40
+ if ($image_file == '' || !file_exists($img_file))
41
+ return false;
42
+ list($width, $height, $type, $attr) = getimagesize($img_file);
43
+ $a_height = (int) ((self::$egridImgThumbWidth / $width) * $height);
44
+ return Array('width' => self::$egridImgThumbWidth, 'height' => $a_height);
45
+ }
46
+
47
+ function deleteFiles($image_file) {
48
+ $pass = true;
49
+ if (!unlink(self::$egridImgDir . $image_file))
50
+ $pass = false;
51
+ if (!unlink(self::$egridImgDir . self::$egridImgThumb . $image_file))
52
+ $pass = false;
53
+ return $pass;
54
+ }
55
+
56
+ /*public function getUniverseList() {
57
+ echo '<pre>';
58
+ var_dump('1111');
59
+ echo '</pre>';
60
+ die();
61
+ }*/
62
+ }
63
+
app/code/community/Qixol/Promo/Model/Advert.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Advert extends Mage_Core_Model_Abstract {
3
+ function __construct(){
4
+
5
+ }
6
+
7
+ function getCategoryTopAdv($_productCollection){
8
+ //replace with promotion text
9
+
10
+ $text_to_return = '';
11
+
12
+ $advertisment = Mage::getResourceSingleton('qixol/banner');
13
+ $adv_array = $advertisment->getCategoryTopAdv($_productCollection);
14
+ if ($adv_array !== false && count($adv_array)) {
15
+ foreach($adv_array as $advert) {
16
+ if (!empty($advert['filename']) && strlen($advert['filename']) > 5) {
17
+ $text_to_return .= "<div>";
18
+ if (!empty($advert['url'])) {
19
+ $text_to_return .= "<a href='";
20
+ $text_to_return .= $advert['url'];
21
+ $text_to_return .= "'>";
22
+ }
23
+ $text_to_return .= "<img title='";
24
+ $text_to_return .= $advert['promotion_text'];
25
+ $text_to_return .= "' src='";
26
+ $text_to_return .= Mage::getBaseUrl('media');
27
+ $text_to_return .= $advert['filename'];
28
+ $text_to_return .= "'>";
29
+ if (!empty($advert['url'])) {
30
+ $text_to_return .= "</a>";
31
+ }
32
+ $text_to_return .= "</div>";
33
+ } else {
34
+ $text_to_return .= "<div>";
35
+ if (!empty($advert['url'])) {
36
+ $text_to_return .= "<a href='";
37
+ $text_to_return .= $advert['url'];
38
+ $text_to_return .= "'>";
39
+ }
40
+ $text_to_return .= $advert['promotion_text'];
41
+ if (!empty($advert['url'])) {
42
+ $text_to_return .= "</a>";
43
+ }
44
+ $text_to_return .= "</div>";
45
+ }
46
+ }
47
+ }
48
+
49
+ return $text_to_return!=''?/*"<div><ul>".*/$text_to_return/*."</ul></div>"*/:"";
50
+ }
51
+
52
+ function getProductBottmAdv($product){
53
+ //replace with promotion text
54
+ $text_to_return='';
55
+
56
+ $products_has_promotion=Mage::getResourceSingleton('qixol/banner');
57
+ $product_data=$products_has_promotion->getProductTextAdv($product,'Bottom');
58
+ if ($product_data!==false&&count($product_data)){
59
+ foreach($product_data as $advert){
60
+ if ($advert['filename']!=''&&strlen($advert['filename'])>5){
61
+ $text_to_return.="<div>".(trim($advert['url'])!=''?"<a href='".$advert['url']."'>":"")."<img title='".$advert['promotion_text']."' src='".Mage::getBaseUrl('media').$advert['filename']."'>".(trim($advert['url'])!=''?"</a>":"")."</div>";
62
+ }else
63
+ $text_to_return.="<div>".(trim($advert['url'])!=''?"<a href='".$advert['url']."'>":"").$advert['promotion_text'].(trim($advert['url'])!=''?"</a>":"")."</div>";
64
+ }
65
+ }
66
+ return $text_to_return!=''?/*"<div><ul>".*/$text_to_return/*."</ul></div>"*/:"";
67
+
68
+ }
69
+
70
+ function getProductInfoTopAdv($product){
71
+
72
+ $text_to_return='';
73
+
74
+ $products_has_promotion = Mage::getResourceSingleton('qixol/banner');
75
+ $product_data = $products_has_promotion->getProductTextAdv($product,'Top');
76
+ if ($product_data !== false && count($product_data)){
77
+ foreach($product_data as $advert){
78
+ if ($advert['filename']!=''&&strlen($advert['filename'])>5){
79
+ $text_to_return .= "<div>";
80
+ if (trim($advert['url'])!='')
81
+ {
82
+ $text_to_return .= "<a href='";
83
+ $text_to_return .= $advert['url'];
84
+ $text_to_return .= "'>";
85
+ }
86
+ $text_to_return .= "<img title='";
87
+ $text_to_return .= $advert['promotion_text'];
88
+ $text_to_return .= "' src='";
89
+ $text_to_return .= Mage::getBaseUrl('media');
90
+ $text_to_return .= $advert['filename'];
91
+ $text_to_return .= "'>";
92
+ if (trim($advert['url'])!='')
93
+ {
94
+ $text_to_return .= "</a>";
95
+ }
96
+ $text_to_return .= "</div>";
97
+ }
98
+ else
99
+ {
100
+ $text_to_return .= "<div>";
101
+ if (trim($advert['url'])!='')
102
+ {
103
+ $text_to_return .= "<a href='";
104
+ $text_to_return .= $advert['url'];
105
+ $text_to_return .= "'>";
106
+ }
107
+ $text_to_return .= $advert['promotion_text'];
108
+ if (trim($advert['url'])!='')
109
+ {
110
+ $text_to_return .= "</a>";
111
+ }
112
+ $text_to_return .= "</div>";
113
+ }
114
+ }
115
+ }
116
+ return $text_to_return != ''? /*"<div><ul>".*/$text_to_return/*."</ul></div>"*/:"";
117
+
118
+ }
119
+
120
+ function getProductInlineAdv($product){
121
+
122
+ $text_to_return='';
123
+
124
+ $products_has_promotion=Mage::getResourceSingleton('qixol/banner');
125
+ $product_data=$products_has_promotion->getProductTextAdv($product,'Inline');
126
+ if ($product_data!==false&&count($product_data)){
127
+ foreach($product_data as $advert){
128
+ if ($advert['filename']!=''&&strlen($advert['filename'])>5){
129
+ $text_to_return.="<div>".(trim($advert['url'])!=''?"<a href='".$advert['url']."'>":"")."<img title='".$advert['promotion_text']."' src='".Mage::getBaseUrl('media').$advert['filename']."'>".(trim($advert['url'])!=''?"</a>":"")."</div>";
130
+ }else
131
+ $text_to_return.="<div>".(trim($advert['url'])!=''?"<a href='".$advert['url']."'>":"").$advert['promotion_text'].(trim($advert['url'])!=''?"</a>":"")."</div>";
132
+ }
133
+ }
134
+ return $text_to_return!=''?/*"<div><ul>".*/$text_to_return/*."</ul></div>"*/:"";
135
+ }
136
+
137
+ /* STICKER FUNCTIONS - START */
138
+
139
+ function isSticked($product){
140
+ $image=false;
141
+ $products_has_promotion_image=Mage::getResourceSingleton('qixol/sticker');
142
+ $product_stick_images=$products_has_promotion_image->getStickerImage($product);
143
+
144
+ if (is_array($product_stick_images)&&count($product_stick_images)==1) { //if 1 sticker
145
+ $image=$product_stick_images[0]['filename'];
146
+ if (($image!==false)&&strlen($image)>5)
147
+ $image=Mage::getBaseUrl('media').$image;
148
+ return $image;
149
+ }elseif(is_array($product_stick_images)&&count($product_stick_images)>1){
150
+ foreach ($product_stick_images as $image_array){
151
+ if (($image_array['filename']!==false)&&strlen($image_array['filename'])>5){
152
+ $image[]=Mage::getBaseUrl('media').$image_array['filename'];
153
+ }
154
+ }
155
+ return $image;
156
+ }
157
+ return $image;
158
+ }
159
+
160
+ function getAllProductAdv($product){
161
+
162
+ $text_to_return='';
163
+
164
+ $products_has_promotion = Mage::getResourceSingleton('qixol/sticker');
165
+ $product_data = $products_has_promotion->getAllProductTextAdv($product);
166
+ if ($product_data !== false && count($product_data)) {
167
+ //$text_to_return.="";
168
+ //$text_to_return.="";
169
+ foreach($product_data as $advert) {
170
+ $text_to_return .= "<tr><td>";
171
+ $text_to_return .= (empty($advert['promotion_text']) ? $advert['promotion_name'] : $advert['promotion_text']);
172
+ $text_to_return .= "</td><td style='width:100px;'>";
173
+ if ($advert['promotion_type'] == 'BOGOF') {
174
+ $text_to_return .= 'Get one free';
175
+ } else {
176
+ if ($advert['discountpercent'] > 0) {
177
+ $text_to_return .= number_format($advert['discountpercent']) . "%";
178
+ } else {
179
+ $text_to_return .= number_format($advert['discountamount'], 2);
180
+ }
181
+ }
182
+ $text_to_return .= "</td></tr>";
183
+ }
184
+ //$text_to_return.="";
185
+ }
186
+ return $text_to_return!=''?/*"<div><ul>".*/$text_to_return/*."</ul></div>"*/:"";
187
+ }
188
+
189
+ /* STICKER FUNCTIONS - END */
190
+
191
+ }
app/code/community/Qixol/Promo/Model/Banner.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Banner extends Mage_Core_Model_Abstract {
3
+
4
+ public function _construct() {
5
+ parent::_construct();
6
+ $this->_init('qixol/banner');
7
+ }
8
+
9
+ public function load($id){
10
+ parent::load($id);
11
+ $this->getBannerImages();
12
+ return $this;
13
+ }
14
+ public function save(){
15
+ $banner_images=array();
16
+
17
+ if ($this->_data['banner_images']){
18
+ $banner_images=$this->_data['banner_images'];
19
+ unset($this->_data['banner_images']);
20
+ }
21
+ parent::save();
22
+ if ($this->getBannerId()>0){
23
+ $this->setSaveBannerImages($banner_images);
24
+ }
25
+ }
26
+ public function getAllAvailBannerIds(){
27
+ $collection = Mage::getResourceModel('qixol/banner_collection')
28
+ ->getAllIds();
29
+ return $collection;
30
+ }
31
+
32
+ public function getAllBanners() {
33
+ $collection = Mage::getResourceModel('qixol/banner_collection');
34
+ $collection->getSelect()->where('status = ?', 1);
35
+ $data = array();
36
+ foreach ($collection as $record) {
37
+ $data[$record->getId()] = array('value' => $record->getId(), 'label' => $record->getfilename());
38
+ }
39
+ return $data;
40
+ }
41
+
42
+ public function getDataByBannerIds($bannerIds) {
43
+ $data = array();
44
+ if ($bannerIds != '') {
45
+ $collection = Mage::getResourceModel('qixol/banner_collection');
46
+ $collection->getSelect()->where('banner_id IN (' . $bannerIds . ')')->order('sort_order');
47
+ foreach ($collection as $record) {
48
+ $status = $record->getStatus();
49
+ if ($status == 1) {
50
+ $data[] = $record;
51
+ }
52
+ }
53
+ }
54
+ return $data;
55
+ }
56
+
57
+ public function getBannerImages($bannerid=0) {
58
+ if ($bannerid==0) $bannerid=$this->getBannerId();
59
+ $banner_images = Mage::getResourceModel('qixol/banner')->getBannerImages($bannerid);
60
+ $parced_images=Array();
61
+ if (is_array($banner_images))
62
+ foreach ($banner_images as $banner_image){
63
+ $parced_images[]=$banner_image['banner_image_id'];
64
+ }
65
+ $this->setBannerImages($parced_images);
66
+ }
67
+
68
+ public function setSaveBannerImages($banner_images) {
69
+ Mage::getResourceModel('qixol/banner')->setBannerImages($this->getbannerId(),$banner_images);
70
+ }
71
+
72
+ public function getBannerImageCollection()
73
+ {
74
+ return Mage::getResourceModel('qixol/bannerimage_collection');
75
+ }
76
+
77
+ public function getBannerImageIds()
78
+ {
79
+ return $this->getResource()->getBannerImageIds($this);
80
+ }
81
+ }
app/code/community/Qixol/Promo/Model/Bannerboxes.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Bannerboxes extends Mage_Core_Model_Abstract {
3
+
4
+ public function _construct() {
5
+ parent::_construct();
6
+ $this->_init('qixol/bannerboxes', "banner_box_type");
7
+ }
8
+
9
+ public function getOptionArray(){
10
+ $hlp = Mage::helper('qixol');
11
+ $collections=$this->getCollection();
12
+ $list_return=array();
13
+ foreach ($collections as $banner_box){
14
+ if (strpos((string)$banner_box->getBannerBoxType(),'STICKER')===false)
15
+ $list_return[]=array(
16
+ 'value' => (string)$banner_box->getBannerBoxType(),
17
+ 'label' => $hlp->__((string)$banner_box->getBannerBoxType())
18
+ );
19
+ }
20
+ return $list_return;
21
+ }
22
+
23
+ public function getStickerOptionArray(){
24
+ $hlp = Mage::helper('qixol');
25
+ $collections=$this->getCollection();
26
+ $list_return=array();
27
+ foreach ($collections as $banner_box){
28
+ if (strpos((string)$banner_box->getBannerBoxType(),'STICKER')!==false)
29
+ $list_return[]=array(
30
+ 'value' => (string)$banner_box->getBannerBoxType(),
31
+ 'label' => $hlp->__((string)$banner_box->getBannerBoxType())
32
+ );
33
+ }
34
+ return $list_return;
35
+ }
36
+ }
app/code/community/Qixol/Promo/Model/Bannerimage.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //class Mage_Api_Model_User extends Mage_Core_Model_Abstract
3
+ class Qixol_Promo_Model_Bannerimage extends Mage_Core_Model_Abstract
4
+ {
5
+ /**
6
+ * Prefix of model events names
7
+ *
8
+ * @var string
9
+ */
10
+ protected $_eventPrefix = 'qixol_bannerimage';
11
+
12
+ /**
13
+ * Constructor
14
+ */
15
+ protected function _construct()
16
+ {
17
+ $this->_init('qixol/bannerimage', 'banner_image_id');
18
+ }
19
+
20
+ // public function save()
21
+ // {
22
+ // $this->_beforeSave();
23
+ // $data = array(
24
+ // 'filename' => $this->getFilename(),
25
+ // 'sort_order' => $this->getSortorder()
26
+ // );
27
+ //
28
+ // if ($this->getId() > 0) {
29
+ // $data['banner_image_id'] = $this->getId();
30
+ // }
31
+ //
32
+ // if ($this->getPromotionReference())
33
+ // {
34
+ // $data['promotion_reference'] = $this->getPromotionReference();
35
+ // }
36
+ //
37
+ // if ($this->getUrl()) {
38
+ // $data['url'] = $this->_getEncodedApiKey($this->getUrl());
39
+ // }
40
+ //
41
+ // if ($this->getComment()) {
42
+ // $data['comment'] = $this->_getEncodedApiKey($this->getComment());
43
+ // }
44
+ //
45
+ // $this->setData($data);
46
+ // $this->_getResource()->save($this);
47
+ // $this->_afterSave();
48
+ // return $this;
49
+ // }
50
+ //
51
+ // public function delete()
52
+ // {
53
+ // $this->_beforeDelete();
54
+ // $this->_getResource()->delete($this);
55
+ // $this->_afterDelete();
56
+ // return $this;
57
+ // }
58
+ //
59
+ // public function saveRelations()
60
+ // {
61
+ // $this->_getResource()->_saveRelations($this);
62
+ // return $this;
63
+ // }
64
+ //
65
+ // public function deleteFromRole()
66
+ // {
67
+ // $this->_getResource()->deleteFromRole($this);
68
+ // return $this;
69
+ // }
70
+ //
71
+ // public function add()
72
+ // {
73
+ // $this->_getResource()->add($this);
74
+ // return $this;
75
+ // }
76
+
77
+ public function getCollection() {
78
+ return Mage::getResourceModel('qixol/bannerimage_collection');
79
+ }
80
+
81
+ /**
82
+ * Get helper instance
83
+ *
84
+ * @param string $helperName
85
+ * @return Mage_Core_Helper_Abstract
86
+ */
87
+ protected function _getHelper($helperName)
88
+ {
89
+ return Mage::helper($helperName);
90
+ }
91
+ }
app/code/community/Qixol/Promo/Model/Bannerresize.php ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ define("PROMO_AUTO_NAME", 1);
3
+
4
+ class Qixol_Promo_Model_Bannerresize {
5
+
6
+ var $imgFile = "";
7
+ var $imgWidth = 0;
8
+ var $imgHeight = 0;
9
+ var $imgType = "";
10
+ var $imgAttr = "";
11
+ var $type = NULL;
12
+ var $_img = NULL;
13
+ var $_error = "";
14
+
15
+ /**
16
+ * Constructor
17
+ *
18
+ * @param [String $imgFile] Image File Name
19
+ * @return RESIZEIMAGE (Class Object)
20
+ */
21
+ function Promo_Banner_Model_Bannerresize($imgFile="") {
22
+ if (!function_exists("imagecreate")) {
23
+ $this->_error = "Error: GD Library is not available.";
24
+ return false;
25
+ }
26
+
27
+ $this->type = Array(1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF', 8 => 'TIFF', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF', 15 => 'WBMP', 16 => 'XBM');
28
+ if (!empty($imgFile))
29
+ $this->setImage($imgFile);
30
+ }
31
+
32
+ /**
33
+ * Error occured while resizing the image.
34
+ *
35
+ * @return String
36
+ */
37
+ function error() {
38
+ return $this->_error;
39
+ }
40
+
41
+ /**
42
+ * Set image file name
43
+ *
44
+ * @param String $imgFile
45
+ * @return void
46
+ */
47
+ function setImage($imgFile) {
48
+ $this->imgFile = $imgFile;
49
+ return $this->_createImage();
50
+ }
51
+
52
+ /**
53
+ *
54
+ * @return void
55
+ */
56
+ function close() {
57
+ return @imagedestroy($this->_img);
58
+ }
59
+
60
+ /**
61
+ * Resize a image to given width and height and keep it's current width and height ratio
62
+ *
63
+ * @param Number $imgwidth
64
+ * @param Numnber $imgheight
65
+ * @param String $newfile
66
+ */
67
+ function resizeLimitwh($imgwidth, $imgheight, $newfile=NULL) {
68
+ $image_per = 100;
69
+ list($width, $height, $type, $attr) = @getimagesize($this->imgFile);
70
+ if ($width > $imgwidth && $imgwidth > 0)
71
+ $image_per = (double) (($imgwidth * 100) / $width);
72
+
73
+ if (floor(($height * $image_per) / 100) > $imgheight && $imgheight > 0)
74
+ $image_per = (double) (($imgheight * 100) / $height);
75
+
76
+ $this->resizePercentage($image_per, $newfile);
77
+ }
78
+
79
+ /**
80
+ * Resize an image to given percentage.
81
+ *
82
+ * @param Number $percent
83
+ * @param String $newfile
84
+ * @return Boolean
85
+ */
86
+ function resizePercentage($percent=100, $newfile=NULL) {
87
+ $newWidth = ($this->imgWidth * $percent) / 100;
88
+ $newHeight = ($this->imgHeight * $percent) / 100;
89
+ return $this->resize($newWidth, $newHeight, $newfile);
90
+ }
91
+
92
+ /**
93
+ * Resize an image to given X and Y percentage.
94
+ *
95
+ * @param Number $xpercent
96
+ * @param Number $ypercent
97
+ * @param String $newfile
98
+ * @return Boolean
99
+ */
100
+ function resizeXYpercentage($xpercent=100, $ypercent=100, $newfile=NULL) {
101
+ $newWidth = ($this->imgWidth * $xpercent) / 100;
102
+ $newHeight = ($this->imgHeight * $ypercent) / 100;
103
+ return $this->resize($newWidth, $newHeight, $newfile);
104
+ }
105
+
106
+ /**
107
+ * Resize an image to given width and height
108
+ *
109
+ * @param Number $width
110
+ * @param Number $height
111
+ * @param String $newfile
112
+ * @return Boolean
113
+ */
114
+ function resize($width, $height, $newfile=NULL) {
115
+ if (empty($this->imgFile)) {
116
+ $this->_error = "File name is not initialised.";
117
+ return false;
118
+ }
119
+ if ($this->imgWidth <= 0 || $this->imgHeight <= 0) {
120
+ $this->_error = "Could not resize given image";
121
+ return false;
122
+ }
123
+ if ($width <= 0)
124
+ $width = $this->imgWidth;
125
+ if ($height <= 0)
126
+ $height = $this->imgHeight;
127
+ return $this->_resize($width, $height, $newfile);
128
+ }
129
+
130
+ /**
131
+ * Get the image attributes
132
+ * @access Private
133
+ *
134
+ */
135
+ function _getImageInfo() {
136
+ @list($this->imgWidth, $this->imgHeight, $type, $this->imgAttr) = @getimagesize($this->imgFile);
137
+ $this->imgType = $this->type[$type];
138
+ }
139
+
140
+ /**
141
+ * Create the image resource
142
+ * @access Private
143
+ * @return Boolean
144
+ */
145
+ function _createImage() {
146
+ $this->_getImageInfo($this->imgFile);
147
+ if ($this->imgType == 'GIF') {
148
+ $this->_img = @imagecreatefromgif($this->imgFile);
149
+ } elseif ($this->imgType == 'JPG') {
150
+ $this->_img = @imagecreatefromjpeg($this->imgFile);
151
+ } elseif ($this->imgType == 'PNG') {
152
+ $this->_img = @imagecreatefrompng($this->imgFile);
153
+ }
154
+ if (!$this->_img || !@is_resource($this->_img)) {
155
+ $this->_error = "Error loading " . $this->imgFile;
156
+ return false;
157
+ }
158
+ return true;
159
+ }
160
+
161
+ /**
162
+ * Function is used to resize the image
163
+ *
164
+ * @access Private
165
+ * @param Number $width
166
+ * @param Number $height
167
+ * @param String $newfile
168
+ * @return Boolean
169
+ */
170
+ function _resize($width, $height, $newfile=NULL) {
171
+ if (!function_exists("imagecreate")) {
172
+ $this->_error = "Error: GD Library is not available.";
173
+ return false;
174
+ }
175
+
176
+ $newimg = @imagecreatetruecolor($width, $height);
177
+ //imagecolortransparent( $newimg, imagecolorat( $newimg, 0, 0 ) );
178
+
179
+ if ($this->imgType == 'GIF' || $this->imgType == 'PNG') {
180
+ /** Code to keep transparency of image * */
181
+ $colorcount = imagecolorstotal($this->_img);
182
+ if ($colorcount == 0)
183
+ $colorcount = 256;
184
+ imagetruecolortopalette($newimg, true, $colorcount);
185
+ imagepalettecopy($newimg, $this->_img);
186
+ $transparentcolor = imagecolortransparent($this->_img);
187
+ imagefill($newimg, 0, 0, $transparentcolor);
188
+ imagecolortransparent($newimg, $transparentcolor);
189
+ }
190
+
191
+ @imagecopyresampled($newimg, $this->_img, 0, 0, 0, 0, $width, $height, $this->imgWidth, $this->imgHeight);
192
+
193
+
194
+
195
+ if ($newfile === PROMO_AUTO_NAME) {
196
+ if (@preg_match("/\..*+$/", @basename($this->imgFile), $matches))
197
+ $newfile = @substr_replace($this->imgFile, "_har", -@strlen($matches[0]), 0);
198
+ }
199
+ elseif (!empty($newfile)) {
200
+ if (!@preg_match("/\..*+$/", @basename($newfile))) {
201
+ if (@preg_match("/\..*+$/", @basename($this->imgFile), $matches))
202
+ $newfile = $newfile . $matches[0];
203
+ }
204
+ }
205
+ if ($this->imgType == 'GIF') {
206
+ if (!empty($newfile))
207
+ @imagegif($newimg, $newfile);
208
+ else {
209
+ @header("Content-type: image/gif");
210
+ @imagegif($newimg);
211
+ }
212
+ } elseif ($this->imgType == 'JPG') {
213
+ if (!empty($newfile)) {
214
+ @imagejpeg($newimg, $newfile);
215
+ } else {
216
+ @header("Content-type: image/jpeg");
217
+ @imagejpeg($newimg);
218
+ }
219
+ } elseif ($this->imgType == 'PNG') {
220
+ if (!empty($newfile))
221
+ @imagepng($newimg, $newfile);
222
+ else {
223
+ @header("Content-type: image/png");
224
+ @imagepng($newimg);
225
+ }
226
+ }
227
+ @imagedestroy($newimg);
228
+ }
229
+
230
+ }
231
+
232
+ ?>
app/code/community/Qixol/Promo/Model/Bonuspoints.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Bonuspoints extends Mage_Core_Model_Abstract
3
+ {
4
+ protected $customerId = -1;
5
+ protected $storeId = -1;
6
+ protected $currentPoints = NULL;
7
+ protected $earnedPoints = NULL;
8
+ protected $spentPoints = NULL;
9
+
10
+ public function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->_init('qixol/bonuspoints','points_account_id');
14
+ }
15
+
16
+
17
+
18
+ public function save() {
19
+ $connection = Mage::getSingleton('core/resource')->getConnection('bonuspoints_write');
20
+
21
+ $connection->beginTransaction();
22
+ $fields = array();
23
+ $fields['customer_id'] = $this->customerId;
24
+ $fields['store_id'] = (int)$this->storeId;
25
+ $fields['current_points'] = (int)$this->currentPoints;
26
+ $fields['earned_points'] = (int)$this->earnedPoints;
27
+ $fields['spent_points'] = (int)$this->spentPoints;
28
+
29
+
30
+ try {
31
+ $this->_beforeSave();
32
+ if (!is_null($this->pointsAccountId)) {
33
+
34
+
35
+ $where = $connection->quoteInto('customer_id=?',$fields['customer_id']);
36
+ $connection->update('qixol_cutomer_points', $fields, $where);
37
+ }
38
+ else {
39
+ $connection->insert('qixol_cutomer_points', $fields);
40
+ //$this->rewardpointsAccountId =$connection->lastInsertId('rewardpoints_account');
41
+ //$this->rewardpointsAccountId =2;
42
+ }
43
+ $connection->commit();
44
+ $this->_afterSave();
45
+ }
46
+ catch (Exception $e) {
47
+ $connection->rollBack();
48
+ throw $e;
49
+ }
50
+ return $this;
51
+ }
52
+
53
+ public function load($id , $field=null) {
54
+ if ($field === null) {
55
+ $field = 'customer_id';
56
+ }
57
+ $connection = Mage::getSingleton('core/resource')->getConnection('bonuspoints_read');
58
+ $select = $connection->select()->from('qixol_cutomer_points')->where('qixol_cutomer_points.'.$field.'=?', $id);
59
+ $data = $connection->fetchRow($select);
60
+ if (!$data) {
61
+ return $this;
62
+ }
63
+ $this->setPointsAccountId($data['points_account_id']);
64
+ $this->setCustomerId($data['customer_id']);
65
+ $this->setStoreId($data['store_id']);
66
+ $this->setCurrentPoints($data['current_points']);
67
+ $this->setEarnedPoints($data['earned_points']);
68
+ $this->setSpentPoints($data['spent_points']);
69
+ $this->_afterLoad();
70
+ return $this;
71
+ }
72
+
73
+
74
+ public function addPoints($p, $customerId) {
75
+ $collpoint = Mage::getModel('qixol/bonuspoints')->load($customerId);
76
+ if($collpoint){
77
+ $currentPoints = $collpoint->getCurrentPoints();
78
+ $earnedPoints = $collpoint->getEarnedPoints();
79
+ $spentPoints = $collpoint->getSpentPoints();
80
+ }
81
+ else{
82
+ $spentPoints = 0;
83
+ $currentPoints = 0;
84
+ $earnedPoints = 0;
85
+ }
86
+ $storeId = Mage::app()->getStore()->getStoreId();;
87
+ Mage::log('add points $p: '. $p);
88
+ $this->currentPoints = $currentPoints + $p;
89
+ $this->earnedPoints = $earnedPoints + $p;
90
+ $this->spentPoints = $spentPoints;
91
+ $this->customerId = $customerId;
92
+ $this->storeId = $storeId;
93
+ }
94
+
95
+ public function subtractPoints($p, $customerId) {
96
+ $collpoint = Mage::getModel('qixol/bonuspoints')->load($customerId);
97
+ if($collpoint){
98
+ $currentPoints = $collpoint->getCurrentPoints();
99
+ $earnedPoints = $collpoint->getEarnedPoints();
100
+ $spentPoints = $collpoint->getSpentPoints();
101
+ }
102
+ else{
103
+ $spentPoints = 0;
104
+ $currentPoints = 0;
105
+ $earnedPoints = 0;
106
+ }
107
+ $storeId = Mage::app()->getStore()->getStoreId();;
108
+ Mage::log('substract points $p: '. $p);
109
+ $this->currentPoints = $currentPoints - $p;
110
+ $this->spentPoints = $spentPoints + $p;
111
+ $this->customerId = $customerId;
112
+ $this->earnedPoints = $earnedPoints;
113
+ $this->storeId = $storeId;
114
+ }
115
+
116
+
117
+ }
app/code/community/Qixol/Promo/Model/Creditmemopoints.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Creditmemopoints extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract {
3
+
4
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo) {
5
+
6
+ echo "call Qixol_Promo_Model_Creditmemopoints";
7
+ die();
8
+ $creditmemo->setGrandTotal($creditmemo->getGrandTotal() - $creditmemo->getPointsAmount());
9
+ $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() - $creditmemo->getBasePointsAmount());
10
+ /*
11
+ // ???????????????????
12
+ $creditmemo->setPointsAmount($creditmemo->getPointsAmount());
13
+ $creditmemo->setBasePointsAmount($creditmemo->getBasePointsAmount());
14
+ */
15
+ return $this;
16
+ }
17
+
18
+ }
app/code/community/Qixol/Promo/Model/Cron.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Cron{
3
+ public function runExportSynch(){
4
+ $export=Mage::getModel('qixol/sinch');
5
+ //process export here
6
+ //export to qixol
7
+ $export->cron_run_export();
8
+ }
9
+
10
+ public function runImportProductPromotionSynch(){
11
+ $export=Mage::getModel('qixol/sinch');
12
+ //process export here
13
+ //export products
14
+ $export->cron_run_import_promo();
15
+ }
16
+ }
app/code/community/Qixol/Promo/Model/Customergrouspmap.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Customergrouspmap extends Mage_Core_Model_Abstract {
3
+
4
+ public function _construct() {
5
+ parent::_construct();
6
+ $this->_init('qixol/customergrouspmap', "customer_group_name");
7
+ }
8
+
9
+ public function getOptionArray(){
10
+ $hlp = Mage::helper('qixol');
11
+ $collections=$this->getCollection();
12
+ $list_return=array();
13
+ foreach ($collections as $item){
14
+ $list_return[]=array(
15
+ 'value' => (string)$item->getCustomerGroupName(),
16
+ 'label' => $hlp->__((string)$item->getCustomerGroupName())
17
+ );
18
+ }
19
+ return $list_return;
20
+ }
21
+ }
app/code/community/Qixol/Promo/Model/Deletedproduct.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Qixol_Promo_Model_Deletedproduct extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct(){
6
+
7
+ $this->_init("qixol/deletedproduct",'entity_id');
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Qixol/Promo/Model/Exportstat.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Qixol_Promo_Model_Exportstat extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct(){
6
+
7
+ $this->_init("qixol/exportstat",'export_id');
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Qixol/Promo/Model/Exprpocessstat.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Qixol_Promo_Model_Exprpocessstat extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct(){
6
+
7
+ $this->_init("qixol/exprpocessstat",'id');
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Qixol/Promo/Model/Invoicepoints.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Invoicepoints extends Mage_Sales_Model_Order_Invoice_Total_Abstract {
3
+
4
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
5
+ echo "call Qixol_Promo_Model_Invoicepoints";
6
+ die();
7
+ $invoice->setGrandTotal($invoice->getGrandTotal() - $invoice->getPointsAmount());
8
+ $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() - $invoice->getBasePointsAmount());
9
+
10
+ /*
11
+ //?????????????????????????
12
+ $invoice->setPointsAmount($invoice->getPointsAmount());
13
+ $invoice->setBasePointsAmount($invoice->getBasePointsAmount());
14
+ */
15
+ //Mage::log('invoice11: ');
16
+ return $this;
17
+
18
+ }
19
+
20
+ }
app/code/community/Qixol/Promo/Model/Issuedcoupon.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Qixol_Promo_Model_Issuedcoupon extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct(){
6
+
7
+ $this->_init("qixol/issuedcoupon",'entity_id');
8
+
9
+ }
10
+
11
+ public function getCustomerIssuedcoupons($customer_id) {
12
+ $collection = Mage::getResourceModel('qixol/issuedcoupon_collection');
13
+ $collection->getSelect()->where('customer_id = ?', $customer_id);
14
+ return $collection;
15
+ }
16
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Banner.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Banner extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ private $category_top_advertisment_name='CATEGORY_TOP';
5
+ private $product_top_advertisment_name='PRODUCT_TOP';
6
+ private $product_bottom_advertisment_name='PRODUCT_BOTTOM';
7
+ private $product_inline_advertisment_name='PRODUCT_INLINE';
8
+
9
+ public function _construct() {
10
+ $this->_init('qixol/banner', 'banner_id');
11
+ }
12
+
13
+ public function getCategoryTopAdv($_productCollection) {
14
+ $advertisment_text='';
15
+ $product_to_child=array();
16
+ foreach ($_productCollection as $_product){
17
+ $product_to_child[$_product->getId()]=array();
18
+ if ($_product->isConfigurable()){
19
+ $child_ids=array();
20
+ $associatedProducts = $_product->getTypeInstance()->getConfigurableAttributesAsArray($_product);
21
+ foreach ($_product->getTypeInstance()->getUsedProducts() as $childProduct) {
22
+ $child_ids[]=$childProduct->getId();
23
+ }
24
+ $product_to_child[$_product->getId()]=$child_ids;
25
+ }
26
+
27
+ }
28
+
29
+ $where='';
30
+ foreach ($product_to_child as $product_id=>$childs){
31
+ $where.=(strlen($where)>0?" or ":"")."(".((count($childs)?
32
+ " ((qphp.parent_product_id='".(int)$product_id."' and qphp.product_id in (".join(",",$childs).")) or (qphp.product_id='".(int)$product_id."' and qphp.parent_product_id=0) )":
33
+ " qphp.product_id='".(int)$product_id."' and qphp.parent_product_id=0")." ")." ) ";
34
+ }
35
+
36
+ $condition_2 = $this->_getReadAdapter()->quoteInto('bi.banner_id=b.banner_id','');
37
+ $condition_3 = $this->_getReadAdapter()->quoteInto('bi.promotion_reference=pt.yourref',''); // and bi.promotion_reference != \'\','');
38
+ $condition_4 = $this->_getReadAdapter()->quoteInto("qphp.promotion_id=pt.promotion_id ",'');
39
+
40
+ $where=" b.status>0 and (pt.promotion_text!='' or pt.promotion_text is null or bi.filename!='') and b.display_zone like '%".$this->category_top_advertisment_name."%' and (qphp.promotion_id is null or (".$where."))";
41
+
42
+ $select = $this->_getReadAdapter()->select()->from(array('b'=>$this->getTable('qixol/banner')))
43
+ ->join(array('bi'=>$this->getTable('qixol/bannerimage')), $condition_2)
44
+ ->joinLeft(array('pt'=>$this->getTable('promotions')), $condition_3)
45
+ ->joinLeft(array('qphp'=>$this->getTable('promotionhasproduct')), $condition_4)
46
+ ->where($where)->group(array("b.banner_id","bi.banner_image_id"))
47
+ ->order('bi.sort_order')
48
+ ->reset('columns')
49
+ ->columns(array('bi.comment','bi.filename',"bi.url"));
50
+
51
+ $data=$this->_getReadAdapter()->fetchAll($select);
52
+
53
+ if (count($data)) return $data;
54
+ return false;
55
+ }
56
+
57
+ public function getProductTextAdv($product,$adv_type='Inline') {
58
+ //create the list of product->child if parent
59
+ $product_id=$product->getId();
60
+ $child_ids=array();
61
+ if ($product->isConfigurable()){
62
+ $associatedProducts = $product->getTypeInstance()->getConfigurableAttributesAsArray($product);
63
+ foreach ($product->getTypeInstance()->getUsedProducts() as $childProduct) {
64
+ $child_ids[]=$childProduct->getId();
65
+ }
66
+ }
67
+
68
+ switch ($adv_type){
69
+ case "Bottom":
70
+ $display_zone=$this->product_bottom_advertisment_name;
71
+ break;
72
+ case "Top":
73
+ $display_zone=$this->product_top_advertisment_name;
74
+ break;
75
+ case "Inline":
76
+ default :
77
+ $display_zone=$this->product_inline_advertisment_name;
78
+ break;
79
+ }
80
+
81
+ $condition_2 = $this->_getReadAdapter()->quoteInto('bi.banner_id=b.banner_id','');
82
+ $condition_3 = $this->_getReadAdapter()->quoteInto('bi.promotion_reference=pt.yourref', ''); // and bi.promotion_reference != \'\','');
83
+ $condition_4 = $this->_getReadAdapter()->quoteInto("qphp.promotion_id=pt.promotion_id ",'');
84
+
85
+ $where = "b.status > 0 and ";
86
+ $where .= "(pt.promotion_text is null or pt.promotion_text!='' or bi.filename!='') and ";
87
+ $where .= "b.display_zone like '%" . $display_zone . "%' and ";
88
+ $where .= "(qphp.promotion_id is null or (";
89
+ if (count($child_ids))
90
+ {
91
+ $where .= " ((qphp.parent_product_id='" . (int)$product_id . "' and ";
92
+ $where .= "qphp.product_id in (" . join(",",$child_ids) . ")) or ";
93
+ $where .= "(qphp.product_id='" . (int)$product_id."' and ";
94
+ $where .= "qphp.parent_product_id=0) )";
95
+ }
96
+ else
97
+ {
98
+ $where .= " qphp.product_id='" . (int)$product_id . "' and qphp.parent_product_id=0";
99
+ }
100
+ $where .= "))";
101
+
102
+ $select = $this->_getReadAdapter()->select()->from(array('b'=>$this->getTable('qixol/banner')))
103
+ ->join(array('bi'=>$this->getTable('qixol/bannerimage')), $condition_2)
104
+ ->joinLeft(array('pt'=>$this->getTable('promotions')), $condition_3)
105
+ ->joinLeft(array('qphp'=>$this->getTable('promotionhasproduct')), $condition_4)
106
+ ->where($where)
107
+ ->group(array("bi.banner_id","bi.banner_image_id"))
108
+ ->order('bi.sort_order')
109
+ ->reset('columns')
110
+ ->columns(array('bi.comment','bi.filename',"bi.url"));
111
+
112
+ $data=$this->_getReadAdapter()->fetchAll($select);
113
+
114
+ if (count($data)) return $data;
115
+ return false;
116
+ }
117
+
118
+ public function getBannerImages($bannerid){
119
+ $where = $this->_getReadAdapter()->quoteInto(" banner_id = ? ",$bannerid);
120
+ $select = $this->_getReadAdapter()->select()->from(array('b'=>$this->getTable('qixol/bannerimage')))->where($where);
121
+ $data=$this->_getReadAdapter()->fetchAll($select);
122
+ if (count($data)) return $data;
123
+ return array();
124
+ }
125
+
126
+ public function getBannerImageIds(Qixol_Promo_Model_Banner $banner)
127
+ {
128
+ $read = $this->_getReadAdapter();
129
+ $select = $read->select()
130
+ ->from($this->getTable('qixol/bannerimage'), array('banner_id'))
131
+ ->where('banner_id = ?', $banner->getId());
132
+ return $read->fetchCol($select);
133
+ }
134
+
135
+ public function setBannerImages($bannerid,$banner_images){
136
+ if ($bannerid>0&&count($banner_images)>0){
137
+ $where = $this->_getWriteAdapter()->quoteInto(" banner_id = ? ",$bannerid);
138
+ $this->_getWriteAdapter()->delete($this->getTable('qixol/bannerimage'),$where);
139
+ foreach ($banner_images as $banner_image_id){
140
+ $this->_getWriteAdapter()->insert(
141
+ $this->getTable('qixol/bannerimage'),
142
+ array("banner_id" => $bannerid, "banner_image_id" => $banner_image_id)
143
+ );
144
+ }
145
+ }
146
+ }
147
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Banner/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Banner_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
3
+
4
+ public function _construct() {
5
+ parent::_construct();
6
+ $this->_init('qixol/banner');
7
+ }
8
+
9
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Bannerboxes.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Bannerboxes extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected $_isPkAutoIncrement = false;
5
+ public function _construct()
6
+ {
7
+ $this->_init("qixol/bannerboxes", "banner_box_type");
8
+ }
9
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Bannerboxes/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Bannerboxes_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
3
+
4
+ public function _construct() {
5
+ parent::_construct();
6
+ $this->_init('qixol/bannerboxes');
7
+ }
8
+
9
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Bannerimage.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Bannerimage extends Mage_Core_Model_Mysql4_Abstract {
3
+
4
+ public function _construct() {
5
+ $this->_init('qixol/bannerimage', 'banner_image_id');
6
+ }
7
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Bannerimage/Collection.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Bannerimage_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init('qixol/bannerimage');
7
+ }
8
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Bonuspoints.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Bonuspoints extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ $this->_init('qixol/bonuspoints','points_account_id');
7
+ }
8
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Bonuspoints/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Bonuspoints_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->_init('qixol/bonuspoints');
8
+ }
9
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Customergrouspmap.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Customergrouspmap extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected $_isPkAutoIncrement = false;
5
+ public function _construct()
6
+ {
7
+ $this->_init("qixol/customergrouspmap", "customer_group_name");
8
+ }
9
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Customergrouspmap/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Customergrouspmap_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
3
+
4
+ public function _construct() {
5
+ parent::_construct();
6
+ $this->_init('qixol/customergrouspmap');
7
+ }
8
+
9
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Deletedproduct.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Deletedproduct extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("qixol/deletedproduct", "entity_id");
7
+ }
8
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Deletedproduct/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Deletedproduct_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("qixol/deletedproduct");
7
+ }
8
+
9
+
10
+
11
+ }
12
+
app/code/community/Qixol/Promo/Model/Mysql4/Exportstat.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Exportstat extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("qixol/exportstat", "export_id");
7
+ }
8
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Exportstat/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Exportstat_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("qixol/exportstat");
7
+ }
8
+
9
+
10
+
11
+ }
12
+
app/code/community/Qixol/Promo/Model/Mysql4/Exprpocessstat.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Exprpocessstat extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("qixol/exprpocessstat", "id");
7
+ }
8
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Exprpocessstat/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Exprpocessstat_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("qixol/exprpocessstat");
7
+ }
8
+
9
+
10
+
11
+ }
12
+
app/code/community/Qixol/Promo/Model/Mysql4/Issuedcoupon.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Issuedcoupon extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("qixol/issuedcoupon", "entity_id");
7
+ }
8
+
9
+
10
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Issuedcoupon/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Issuedcoupon_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("qixol/issuedcoupon");
7
+ }
8
+
9
+
10
+
11
+ }
12
+
app/code/community/Qixol/Promo/Model/Mysql4/Promotions.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Promotions extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected $_isPkAutoIncrement = false;
5
+
6
+ protected function _construct()
7
+ {
8
+ $this->_init("qixol/promotions", "promotion_id");
9
+ }
10
+
11
+ function removeOldPromotion(){
12
+ //should be one hour, but because of time difference
13
+ $this->_getWriteAdapter()->delete($this->getTable('promotions'), " is_for_product=1 and (update_time!='0000-00-00 00:00:00' and update_time <= '".date("Y-m-d H:i:s",strtotime(" -2 hour"))."' )");
14
+
15
+ return ;
16
+ }
17
+
18
+ function removeOldDayPromotion(){
19
+ //should be one day, but because of time difference
20
+ $this->_getWriteAdapter()->delete($this->getTable('promotions'), " is_for_product=0 and (update_time!='0000-00-00 00:00:00' and update_time <= '".date("Y-m-d H:i:s",strtotime(" -24 hour"))."' )");//remove previous day not updated promotion
21
+ return ;
22
+ }
23
+
24
+ function updatePromotionProduct($datatoupdate){
25
+ //print_r($datatoupdate);
26
+
27
+ if ($datatoupdate['product_id']>0&&$datatoupdate['promotion_id']>0){
28
+ $condition = $this->_getWriteAdapter()->quoteInto('(product_id = ?', $datatoupdate['product_id']);
29
+ $condition = $this->_getWriteAdapter()->quoteInto($condition. " and parent_product_id = ? ", $datatoupdate['parent_product_id']);
30
+ $condition = $this->_getWriteAdapter()->quoteInto($condition. " and promotion_id = ? )", $datatoupdate['promotion_id']);
31
+
32
+ //delete old, insert new
33
+
34
+ $this->_getWriteAdapter()->delete($this->getTable('promotionhasproduct'), $condition);
35
+
36
+ $this->_getWriteAdapter()->insert($this->getTable('promotionhasproduct'), $datatoupdate);
37
+ }
38
+
39
+ }
40
+
41
+ function removeOldPromotedProduct(){
42
+ //should be one day, but because of time difference
43
+ $this->_getWriteAdapter()->delete($this->getTable('promotionhasproduct'), "(update_time!='0000-00-00 00:00:00' and update_time <= ('".date("Y-m-d H:i:s",strtotime(" -2 hour"))."') )");
44
+ return ;
45
+ }
46
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Promotions/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Promotions_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("qixol/promotions");
7
+ }
8
+
9
+
10
+
11
+ }
12
+
app/code/community/Qixol/Promo/Model/Mysql4/Shippingmap.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Shippingmap extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected $_isPkAutoIncrement = false;
5
+ public function _construct()
6
+ {
7
+ $this->_init("qixol/shippingmap", "shipping_name");
8
+ }
9
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Shippingmap/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Shippingmap_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
3
+
4
+ public function _construct() {
5
+ parent::_construct();
6
+ $this->_init('qixol/shippingmap');
7
+ }
8
+
9
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Sticker.php ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Sticker extends Mage_Core_Model_Mysql4_Abstract {
3
+ private $category_stickers_advertisment_name='CATEGORY_STICKERS';
4
+
5
+ public function _construct() {
6
+ // Note that the banner_id refers to the key field in your database table.
7
+ $this->_init('qixol/sticker', 'sticker_id');
8
+ }
9
+
10
+ public function getStickerImage($product) {
11
+
12
+ // How to get the stickers:
13
+ // get promotions that are valid for this product
14
+ // get stickers for specific promotion references for these promotions - take ALL stickers matching this reference
15
+ // next get custom stickers for promotion types other than any matched in the second step
16
+ // finally get system default stickers for any remaining unmatched promotion types
17
+
18
+ /**************************************************************************
19
+ // get promotions that are valid for this product (and child products)
20
+ **************************************************************************/
21
+ $promotions = $this->getPromotionsForProduct($product);
22
+
23
+ if (count($promotions) == 0) {
24
+ return false;
25
+ }
26
+
27
+ /**************************************************************************
28
+ // get stickers for any promotion references (!= '')
29
+ **************************************************************************/
30
+ $promotionSpecificStickers = $this->getPromotionSpecificStickers($promotions);
31
+
32
+ $matchedTypes = array();
33
+ $filenames = array();
34
+
35
+ if (is_array($promotionSpecificStickers)) {
36
+ if (count($promotionSpecificStickers) > 0) {
37
+ foreach ($promotionSpecificStickers as $promotionSpecificSticker) {
38
+ array_push($matchedTypes, $promotionSpecificSticker['promotion_type_name']);
39
+ array_push($filenames, array('filename' => $promotionSpecificSticker['filename']));
40
+ }
41
+ }
42
+ }
43
+
44
+ /**************************************************************************
45
+ // next get custom stickers for promotion types other than any matched in the second step
46
+ **************************************************************************/
47
+ $defaultStickers = $this->getPromotionDefaultStickers($promotions, $matchedTypes);
48
+
49
+ if (is_array($defaultStickers)) {
50
+ if (count($defaultStickers) > 0) {
51
+ foreach ($defaultStickers as $defaultSticker) {
52
+ array_push($matchedTypes, $defaultSticker['promotion_type_name']);
53
+ array_push($filenames, array('filename' => $defaultSticker['filename']));
54
+ }
55
+ }
56
+ }
57
+
58
+ /**************************************************************************
59
+ // next get system stickers for remaining promotion types
60
+ **************************************************************************/
61
+ $systemStickers = $this->getPromotionSystemStickers($promotions, $matchedTypes);
62
+
63
+ if (is_array($systemStickers)) {
64
+ if (count($systemStickers) > 0) {
65
+ foreach ($systemStickers as $systemSticker) {
66
+ array_push($matchedTypes, $systemSticker['promotion_type_name']);
67
+ array_push($filenames, array('filename' => $systemSticker['filename']));
68
+ }
69
+ }
70
+ }
71
+
72
+ return $filenames;
73
+ }
74
+
75
+ public function getAllProductTextAdv($product) {
76
+ /*
77
+ //create the list of product->child if parent
78
+ $product_id=$product->getId();
79
+ $child_ids=array();
80
+ if ($product->isConfigurable()){
81
+ $associatedProducts = $product->getTypeInstance()->getConfigurableAttributesAsArray($product);
82
+ foreach ($product->getTypeInstance()->getUsedProducts() as $childProduct) {
83
+ $child_ids[]=$childProduct->getId();
84
+ }
85
+ }
86
+ //
87
+ $condition_4 = $this->_getReadAdapter()->quoteInto("qphp.promotion_id=pt.promotion_id ",'');
88
+ $where=
89
+ (count($child_ids)?
90
+ " ((qphp.parent_product_id='".(int)$product_id."' and qphp.product_id in (".join(",",$child_ids).")) or (qphp.product_id='".(int)$product_id."' and qphp.parent_product_id=0) )":
91
+ " qphp.product_id='".(int)$product_id."' and qphp.parent_product_id=0");
92
+
93
+ $select = $this->_getReadAdapter()->select()->from(array('qphp'=>$this->getTable('promotionhasproduct')))
94
+ ->joinLeft(array('pt'=>$this->getTable('promotions')), $condition_4)
95
+ ->where($where)->group(array("pt.promotion_id"))->reset('columns')
96
+ ->columns(array('pt.promotion_text','pt.discountpercent','pt.discountamount'));
97
+
98
+ $data=$this->_getReadAdapter()->fetchAll($select);
99
+ */
100
+ $promotions = $this->getPromotionsForProduct($product);
101
+
102
+ if (count($promotions)) return $promotions;
103
+ return false;
104
+ }
105
+
106
+ private function getPromotionsForProduct($product){
107
+ //create the list of product->child if parent
108
+ $product_id=$product->getId();
109
+ $child_ids=array();
110
+ if ($product->isConfigurable()){
111
+ $associatedProducts = $product->getTypeInstance()->getConfigurableAttributesAsArray($product);
112
+ foreach ($product->getTypeInstance()->getUsedProducts() as $childProduct) {
113
+ $child_ids[]=$childProduct->getId();
114
+ }
115
+ }
116
+
117
+ $join = 'product.promotion_id = promo.promotion_id';
118
+ $whereString = '';
119
+ $whereString = '(';
120
+
121
+ $whereString .= "(";
122
+ $whereString .= "(promo.is_everyday=0) and ";
123
+ $whereString .= "((promo.from_date='0000-00-00 00:00:00') or (TIME(promo.from_date) < CURTIME())) and ";
124
+ $whereString .= "((promo.till_date='0000-00-00 00:00:00') or (TIME(promo.till_date) > CURTIME()))";
125
+ $whereString .= ")";
126
+
127
+ $whereString .= " or ";
128
+
129
+ $whereString .= "(";
130
+ $whereString .= "(promo.is_everyday=1) and ";
131
+ $whereString .= "(TIME(promo.from_date) < CURTIME()) and ";
132
+ $whereString .= "(TIME(promo.till_date) > CURTIME())";
133
+ $whereString .= ")";
134
+
135
+ $whereString .= ")";
136
+
137
+ $whereString .= " and ";
138
+
139
+ if (count($child_ids)) {
140
+ $whereString .= "((product.parent_product_id = '".(int)$product_id."' and "
141
+ ."product.product_id in (".join(",",$child_ids).")) or "
142
+ ."(product.product_id = '".(int)$product_id."' and product.parent_product_id = 0) )";
143
+ } else {
144
+ $whereString .= "product.product_id = '".(int)$product_id."' and product.parent_product_id = 0";
145
+ }
146
+
147
+ $select = $this->_getReadAdapter()->select()->distinct()
148
+ ->from(array('product' => $this->getTable('promotionhasproduct')))
149
+ ->join(array('promo' => $this->getTable('promotions')), $join)
150
+ ->where($whereString)
151
+ ->reset('columns')
152
+ ->columns(array('promotion_type' => 'promo.promotion_type',
153
+ 'promotion_name' => 'promo.promotion_name',
154
+ 'promo_reference' => 'promo.yourref',
155
+ 'promotion_text' => 'promo.promotion_text',
156
+ 'discountpercent' => 'promo.discountpercent',
157
+ 'discountamount' => 'promo.discountamount'));
158
+
159
+ return $this->_getReadAdapter()->fetchAll($select);
160
+ }
161
+
162
+ private function getPromotionSpecificStickers($promotions) {
163
+ $references = array();
164
+ foreach($promotions as $key => $value) {
165
+ if ($value[promo_reference] != '') {
166
+ array_push($references, $value[promo_reference]);
167
+ }
168
+ }
169
+
170
+ if (count($references) == 0) {
171
+ return;
172
+ }
173
+
174
+ $join = 'sticker.promo_reference = promo.yourref';
175
+
176
+ $whereStringReferences = join('\',\'', $references);
177
+ $whereStringReferences = 'promo_reference in (\'' . $whereStringReferences . '\')';
178
+
179
+ $select = $this->_getReadAdapter()->select()
180
+ ->from(array('sticker' => $this->getTable('sticker')))
181
+ ->join(array('promo' => $this->getTable('promotions')), $join)
182
+ ->where($whereStringReferences)
183
+ ->reset('columns')
184
+ ->columns(array('filename' => 'filename', 'promotion_type_name' => 'promo.promotion_type'));
185
+
186
+ return $this->_getReadAdapter()->fetchAll($select);
187
+ }
188
+
189
+ private function getPromotionDefaultStickers($promotions, $matchedTypes) {
190
+ $whereString = '(is_default_for_type = 1) and (is_system_default_for_type = 0)';
191
+ if (is_array($matchedTypes)) {
192
+ if (count($matchedTypes) > 0) {
193
+ $whereString .= ' and promo_type_name not in (\'' . join('\',\'', $matchedTypes) . '\')';
194
+ }
195
+ }
196
+
197
+ $unmatchedTypes = array();
198
+ foreach($promotions as $key => $value) {
199
+ if ($value[promotion_type] != '') {
200
+ array_push($unmatchedTypes, $value[promotion_type]);
201
+ }
202
+ }
203
+ $whereString .= ' and promo_type_name in (\'' . join('\',\'', $unmatchedTypes) . '\')';
204
+
205
+ $select = $this->_getReadAdapter()->select()
206
+ ->from($this->getTable('sticker'))
207
+ ->where($whereString)
208
+ ->reset('columns')
209
+ ->columns(array('filename' => 'filename', 'promotion_type_name' => 'promo_type_name'));
210
+
211
+ return $this->_getReadAdapter()->fetchAll($select);
212
+ }
213
+
214
+ private function getPromotionSystemStickers($promotions, $matchedTypes) {
215
+ $whereString = '(is_default_for_type = 1) and (is_system_default_for_type = 1)';
216
+ if (is_array($matchedTypes)) {
217
+ if (count($matchedTypes) > 0) {
218
+ $whereString .= ' and promo_type_name not in (\'' . join('\',\'', $matchedTypes) . '\')';
219
+ }
220
+ }
221
+
222
+ $unmatchedTypes = array();
223
+ foreach($promotions as $key => $value) {
224
+ if ($value[promotion_type] != '') {
225
+ array_push($unmatchedTypes, $value[promotion_type]);
226
+ }
227
+ }
228
+ $whereString .= ' and promo_type_name in (\'' . join('\',\'', $unmatchedTypes) . '\')';
229
+
230
+ $select = $this->_getReadAdapter()->select()
231
+ ->from($this->getTable('sticker'))
232
+ ->where($whereString)
233
+ ->reset('columns')
234
+ ->columns(array('filename' => 'filename', 'promotion_type_name' => 'promo_type_name'));
235
+
236
+ return $this->_getReadAdapter()->fetchAll($select);
237
+ }
238
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Sticker/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Sticker_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
3
+
4
+ public function _construct() {
5
+ parent::_construct();
6
+ $this->_init('qixol/sticker');
7
+ }
8
+
9
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Storesmap.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Storesmap extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected $_isPkAutoIncrement = false;
5
+ public function _construct()
6
+ {
7
+ $this->_init("qixol/storesmap", "store_name");
8
+ }
9
+ }
app/code/community/Qixol/Promo/Model/Mysql4/Storesmap/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Mysql4_Storesmap_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
3
+
4
+ public function _construct() {
5
+ parent::_construct();
6
+ $this->_init('qixol/storesmap');
7
+ }
8
+
9
+ }
app/code/community/Qixol/Promo/Model/Observer.php ADDED
@@ -0,0 +1,819 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Observer
3
+ {
4
+ protected $structure_to_store_in_order=array();
5
+
6
+ public function updateCartAjaxUpdate(Varien_Event_Observer $observer){
7
+ global $_SESSION;
8
+ $controller = $observer->getEvent()->getControllerAction();
9
+ $id_cart = $controller->getRequest()->getParam('id');
10
+ $qty_cart = $controller->getRequest()->getParam('qty');
11
+ $result = array();
12
+ if ($id_cart>0){
13
+ $is_updated=false;
14
+
15
+ if ($qty_cart>0&&
16
+ $_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['quantity']>$_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['originalquantity']){
17
+
18
+ $difference=$_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['quantity']-$_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['originalquantity'];
19
+ if ($qty_cart<=$difference) $qty_cart=0;
20
+ $qty_cart-=$difference;
21
+ $is_updated=true;
22
+ }elseif($qty_cart>0
23
+ &&$_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['generated']>0
24
+ &&$_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['quantity']==$_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['originalquantity']
25
+ &&$qty_cart==$_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['quantity']){
26
+ //only free items - do nothing
27
+ $controller->getResponse()->setHeader('Content-type', 'application/json');
28
+ $result['success'] = 1;
29
+ $result['message'] = Mage::helper('qixol')->__('Item was updated successfully.');
30
+ $controller->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
31
+ $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
32
+ return ;
33
+ }elseif($qty_cart>0
34
+ &&$_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['generated']>0
35
+ &&$_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['quantity']==$_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['originalquantity']
36
+ &&$qty_cart>$_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['quantity']){
37
+ $qty_cart-=$_SESSION['qixol_quoted_items']['items'][$id_cart]['data']['originalquantity'];
38
+ if ($qty_cart<0) $qty_cart=0;
39
+ $is_updated=true;
40
+ }
41
+
42
+
43
+ $session = Mage::getSingleton('checkout/session');
44
+ $cart=Mage::getSingleton('checkout/cart');
45
+ $quote = $session->getQuote();
46
+ $exists_in_cart=array();
47
+ foreach ($quote->getAllVisibleItems() as $item) {
48
+ $exists_in_cart[$item->getItemId()]=$item->getQty();
49
+ }
50
+
51
+ //in cart but difference=0, delete it
52
+ if (isset($exists_in_cart[$id_cart])&&$qty_cart==0){
53
+ // The action controller's constructor expects request and response objects;
54
+ $cart_controllerInstance = Mage::getControllerInstance(
55
+ 'Mage_Checkout_CartController',
56
+ $controller->getRequest(), // you can replace this with the actual request
57
+ new Mage_Core_Controller_Response_Http()
58
+ );
59
+ $cart_controllerInstance->ajaxDeleteAction();
60
+ $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
61
+ return ;
62
+ //exists but qty possible chaged nad it pozitive
63
+ }elseif(isset($exists_in_cart[$id_cart])&&$qty_cart>0){
64
+ // The action controller's constructor expects request and response objects;
65
+ $the_request=$controller->getRequest();
66
+ $the_request->setParam('qty',$qty_cart);
67
+ $cart_controllerInstance = Mage::getControllerInstance(
68
+ 'Mage_Checkout_CartController',
69
+ $the_request, // you can replace this with the actual request
70
+ new Mage_Core_Controller_Response_Http()
71
+ );
72
+ $cart_controllerInstance->ajaxUpdateAction();
73
+ $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
74
+ $result['success'] = 1;
75
+ $result['message'] = Mage::helper('qixol')->__('Item was updated successfully.');
76
+ $controller->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
77
+ return ;
78
+ }elseif((!isset($exists_in_cart[$id_cart]))&&$qty_cart>0){
79
+ //add new item
80
+
81
+
82
+
83
+ if (isset($_SESSION['qixol_quoted_items']['items'][$id_cart]['data'])){
84
+ $qxol_item=$_SESSION['qixol_quoted_items']['items'][$id_cart]['data'];
85
+ $add_params_array=array();
86
+ if ((string)$qxol_item['variantcode']!=''){//configurable
87
+ $simple_product_id=Mage::getModel('catalog/product')->getIdBySku((string)$qxol_item['variantcode']);
88
+ $parent_product_id=Mage::getModel('catalog/product')->getIdBySku((string)$qxol_item['productcode']);
89
+ $parent_product=Mage::getModel('catalog/product')
90
+ ->setStoreId(Mage::app()->getStore()->getId())
91
+ ->load($parent_product_id);
92
+ $simple_product=Mage::getModel('catalog/product')
93
+ ->setStoreId(Mage::app()->getStore()->getId())
94
+ ->load($simple_product_id);
95
+ $add_params_array['product']=$parent_product_id;
96
+ $attributes = $parent_product->getTypeInstance(true)->getConfigurableAttributesAsArray($parent_product);
97
+ foreach ($attributes as $attribute){
98
+ foreach ($attribute['values'] as $value){
99
+ $childValue = $simple_product->getData($attribute['attribute_code']);
100
+ if ($value['value_index'] == $childValue){
101
+ $add_params_array['super_attribute'][$attribute['attribute_id']]=$value['value_index'];
102
+ }
103
+ }
104
+ }
105
+
106
+ }else {
107
+ $parent_product_id=Mage::getModel('catalog/product')->getIdBySku((string)$qxol_item['productcode']);
108
+ $parent_product=Mage::getModel('catalog/product')
109
+ ->setStoreId(Mage::app()->getStore()->getId())
110
+ ->load($parent_product_id);
111
+ $add_params_array['product']=$parent_product_id;
112
+ }
113
+ $filter = new Zend_Filter_LocalizedToNormalized(
114
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
115
+ );
116
+ $add_params_array['qty'] = $filter->filter($qty_cart);
117
+ $add_params_array['related_product']='';
118
+ $controller->getRequest()->setParam('qty',$qty_cart);
119
+
120
+ $cart->addProduct($parent_product, $add_params_array);
121
+
122
+
123
+ }
124
+ $result['success'] = 1;
125
+ $result['message'] = Mage::helper('qixol')->__('Item was updated successfully.');
126
+
127
+ $controller->getResponse()->setHeader('Content-type', 'application/json');
128
+ $controller->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
129
+ $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
130
+ $result['success'] = 1;
131
+ $result['message'] = Mage::helper('qixol')->__('Item was updated successfully.');
132
+ $controller->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
133
+ return ;
134
+
135
+ }
136
+
137
+ }else {
138
+ $controller->getResponse()->setHeader('Content-type', 'application/json');
139
+ $result['success'] = 1;
140
+ $result['message'] = Mage::helper('qixol')->__('Item was updated successfully.');
141
+ $controller->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
142
+ $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
143
+ return ;
144
+ }
145
+ }
146
+
147
+ public function updateCartAjaxDelete(Varien_Event_Observer $observer){
148
+ global $_SESSION;
149
+ $controller = $observer->getEvent()->getControllerAction();
150
+ $id = (int) $controller->getRequest()->getParam('id');
151
+
152
+ if ($id==0||(isset($_SESSION['qixol_quoted_items']['items'][$id]) &&
153
+ $_SESSION['qixol_quoted_items']['items'][$id]['new']>0 &&
154
+ $_SESSION['qixol_quoted_items']['items'][$id]['data']['generated']>0)){
155
+ $result['success'] = 0;
156
+ $result['error'] = Mage::helper('qixol')->__('Can not remove the Free item.');
157
+ $controller->getResponse()->setHeader('Content-type', 'application/json');
158
+ $controller->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
159
+ $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
160
+ return;
161
+ }
162
+ // The action controller's constructor expects request and response objects;
163
+ $cart_controllerInstance = Mage::getControllerInstance(
164
+ 'Mage_Checkout_CartController',
165
+ $controller->getRequest(), // you can replace this with the actual request
166
+ new Mage_Core_Controller_Response_Http()
167
+ );
168
+ $cart_controllerInstance->ajaxDeleteAction();
169
+ //$controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
170
+ }
171
+
172
+ public function updateCartPostAction(Varien_Event_Observer $observer){
173
+ global $_SESSION;
174
+ $controller = $observer->getEvent()->getControllerAction();
175
+ $post_cart = $controller->getRequest()->getParam('cart');
176
+ $post_cart_action = $controller->getRequest()->getParam('update_cart_action');
177
+ if ($post_cart_action=='update_qty'){
178
+ $is_updated=false;
179
+ foreach ($post_cart as $cart_idx=>$cart_value){
180
+ if ($cart_value['qty']>0&&
181
+ $_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['quantity']>$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['originalquantity']){
182
+ $difference=$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['quantity']-$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['originalquantity'];
183
+ if ($cart_value['qty']<=$difference) $cart_value['qty']=0;
184
+ $cart_value['qty']-=$difference;
185
+ //cart add item
186
+ $post_cart[$cart_idx]=$cart_value;
187
+ $is_updated=true;
188
+ }elseif($cart_value['qty']>0
189
+ &&$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['generated']>0
190
+ &&$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['quantity']==$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['originalquantity']
191
+ &&$cart_value['qty']==$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['quantity']){
192
+ //only free items - remove from cart
193
+ unset($post_cart[$cart_idx]);
194
+ $is_updated=true;
195
+ }elseif($cart_value['qty']>0
196
+ &&$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['generated']>0
197
+ &&$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['quantity']==$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['originalquantity']
198
+ &&$cart_value['qty']>$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['quantity']){
199
+ $cart_value['qty']-=$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data']['originalquantity'];
200
+ if ($cart_value['qty']<0) $cart_value['qty']=0;
201
+ //cart add item
202
+ $post_cart[$cart_idx]=$cart_value;
203
+ $is_updated=true;
204
+ }
205
+ }
206
+
207
+ $session = Mage::getSingleton('checkout/session');
208
+ $cart=Mage::getSingleton('checkout/cart');
209
+ $quote = $session->getQuote();
210
+ $exists_in_cart=array();
211
+ foreach ($quote->getAllVisibleItems() as $item) {
212
+ $exists_in_cart[$item->getItemId()]=$item->getQty();
213
+ }
214
+ foreach($post_cart as $cart_idx=>$cart_value){
215
+ if ((!isset($exists_in_cart[$cart_idx]))){
216
+ if (isset($_SESSION['qixol_quoted_items']['items'][$cart_idx]['data'])){
217
+ $qxol_item=$_SESSION['qixol_quoted_items']['items'][$cart_idx]['data'];
218
+ $add_params_array=array();
219
+ if ((string)$qxol_item['variantcode']!=''){//configurable
220
+ $simple_product_id=Mage::getModel('catalog/product')->getIdBySku((string)$qxol_item['variantcode']);
221
+ $parent_product_id=Mage::getModel('catalog/product')->getIdBySku((string)$qxol_item['productcode']);
222
+ $parent_product=Mage::getModel('catalog/product')
223
+ ->setStoreId(Mage::app()->getStore()->getId())
224
+ ->load($parent_product_id);
225
+ $simple_product=Mage::getModel('catalog/product')
226
+ ->setStoreId(Mage::app()->getStore()->getId())
227
+ ->load($simple_product_id);
228
+ $add_params_array['product']=$parent_product_id;
229
+ $attributes = $parent_product->getTypeInstance(true)->getConfigurableAttributesAsArray($parent_product);
230
+ foreach ($attributes as $attribute){
231
+ foreach ($attribute['values'] as $value){
232
+ $childValue = $simple_product->getData($attribute['attribute_code']);
233
+ if ($value['value_index'] == $childValue){
234
+ $add_params_array['super_attribute'][$attribute['attribute_id']]=$value['value_index'];
235
+ }
236
+ }
237
+ }
238
+
239
+ }else {
240
+ $parent_product_id=Mage::getModel('catalog/product')->getIdBySku((string)$qxol_item['productcode']);
241
+ $parent_product=Mage::getModel('catalog/product')
242
+ ->setStoreId(Mage::app()->getStore()->getId())
243
+ ->load($parent_product_id);
244
+ $add_params_array['product']=$parent_product_id;
245
+ }
246
+ $filter = new Zend_Filter_LocalizedToNormalized(
247
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
248
+ );
249
+ $add_params_array['qty'] = $filter->filter($cart_value['qty']);
250
+ $add_params_array['related_product']='';
251
+ $controller->getRequest()->setParam('qty',$cart_value['qty']);
252
+ $cart->addProduct($parent_product, $add_params_array);
253
+
254
+
255
+ }
256
+ //add new item in cart
257
+
258
+ }
259
+ }
260
+
261
+
262
+ if ($is_updated){
263
+ $controller->getRequest()->setParam('cart',$post_cart);
264
+ }
265
+ // The action controller's constructor expects request and response objects;
266
+ $cart_controllerInstance = Mage::getControllerInstance(
267
+ 'Mage_Checkout_CartController',
268
+ $controller->getRequest(), // you can replace this with the actual request
269
+ new Mage_Core_Controller_Response_Http()
270
+ );
271
+ $cart_controllerInstance->updatePostAction();
272
+ //$controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
273
+ }else {
274
+ // The action controller's constructor expects request and response objects;
275
+ $cart_controllerInstance = Mage::getControllerInstance(
276
+ 'Mage_Checkout_CartController',
277
+ $controller->getRequest(), // you can replace this with the actual request
278
+ new Mage_Core_Controller_Response_Http()
279
+ );
280
+ $cart_controllerInstance->updatePostAction();
281
+ //$controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
282
+ }
283
+ }
284
+
285
+ public function deleteCartAction(Varien_Event_Observer $observer){
286
+ global $_SESSION;
287
+ $controller = $observer->getEvent()->getControllerAction();
288
+ $id = (int) $controller->getRequest()->getParam('id');
289
+
290
+ if ($id==0||(isset($_SESSION['qixol_quoted_items']['items'][$id]) &&
291
+ $_SESSION['qixol_quoted_items']['items'][$id]['new']>0 &&
292
+ $_SESSION['qixol_quoted_items']['items'][$id]['data']['generated']>0)){
293
+ $session = Mage::getSingleton('checkout/session');
294
+ $session->addError('Free item couldn\'t be deleted');
295
+ unset($_SESSION['tmp_set']);
296
+ $controller->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
297
+ return;
298
+ }
299
+ // The action controller's constructor expects request and response objects;
300
+ $cart_controllerInstance = Mage::getControllerInstance(
301
+ 'Mage_Checkout_CartController',
302
+ $controller->getRequest(), // you can replace this with the actual request
303
+ new Mage_Core_Controller_Response_Http()
304
+ );
305
+ $cart_controllerInstance->deleteAction();
306
+ $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
307
+ $controller->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
308
+ }
309
+
310
+ public function checkQixolCoupon(Varien_Event_Observer $observer){
311
+ global $_SESSION;
312
+ /* @var Mage_Core_Controller_Front_Action $controller */
313
+ $controller = $observer->getEvent()->getControllerAction();
314
+ if (trim($controller->getRequest()->getParam('coupon_code')) !='') {
315
+ if ((!isset($_SESSION['qixol_quoted_items']['cart_session_id']))||$_SESSION['qixol_quoted_items']['cart_session_id']=='') $_SESSION['qixol_quoted_items']['cart_session_id']=md5(time());
316
+ unset($_SESSION['qixol_quoted_items']['coupons']);
317
+ $_SESSION['qixol_quoted_items']['coupons'][trim($controller->getRequest()->getParam('coupon_code'))]['code']=trim($controller->getRequest()->getParam('coupon_code'));
318
+ //$this->__('Coupon code "%s" was applied.', Mage::helper('core')->escapeHtml($couponCode))
319
+ $session = Mage::getSingleton('checkout/session');
320
+ $quote = $session->getQuote();
321
+ $getSinch=Mage::getModel('qixol/sinch');
322
+ if ($qixol_quoted_items_new=$getSinch->run_ImportCart($quote)){
323
+ $qixol_quoted_items=$qixol_quoted_items_new; //if returned new structure
324
+ $qixol_quoted_items['cart_session_id']=$_SESSION['qixol_quoted_items']['cart_session_id'];
325
+ }
326
+ $qixol_quoted_items['time_checked']=time();
327
+ $_SESSION['qixol_quoted_items']=$qixol_quoted_items;
328
+
329
+ if ($_SESSION['qixol_quoted_items']['coupons'][trim($controller->getRequest()->getParam('coupon_code'))]['code']!=''){
330
+ $coupon_text='';
331
+ foreach ($_SESSION['qixol_quoted_items']['coupons'] as $coupon_stored_data){
332
+ if ((bool)$coupon_stored_data['issued']==false)
333
+ $coupon_text.=$coupon_stored_data['description'].", ";
334
+ }
335
+ $session->addSuccess(Mage::helper('qixol')->__("Qixol coupon '%s' was applied to your order.", $coupon_text ));
336
+ }
337
+ else
338
+ $session->addError(Mage::helper('qixol')->__("Qixol coupon '%s' not applicable.", trim($controller->getRequest()->getParam('coupon_code')) ));
339
+ //compleatly /*intercept*/
340
+ $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
341
+ $controller->getResponse()->setRedirect(Mage::getUrl('checkout/cart')); }
342
+ }
343
+
344
+ public function markDletedProduct(Varien_Event_Observer $observer)
345
+ {
346
+ $product = $observer->getEvent()->getProduct();
347
+ //temporary until we rebuild
348
+ /*$deleted = Mage::getModel('qixol/Deletedproduct');
349
+ $deleted->setId($product->getId());
350
+ $deleted->setDeletedTime(date("Y-m-d H:i:s"));
351
+ $query=$deleted->save();*/
352
+ //temporary , should be redeveloped to work us abowe
353
+ $parentId = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
354
+
355
+ if (is_array($parentId)&&count($parentId)>0){
356
+ foreach ($parentId as $parent_product_id){
357
+ $parent_product=Mage::getModel('catalog/product')->load($parent_product_id);
358
+ break; //we think only one parent for a child
359
+ }
360
+ //store child deleted
361
+ $store_deleted='replace into qixol_product_to_delete(entity_id,product_sku,child_sku,deleted_time) values('.(int)$product->getId().',"'.$parent_product->getSku().'","'.$product->getSku().'",now())';
362
+ } else {
363
+ //store parent deleted
364
+ $store_deleted='replace into qixol_product_to_delete(entity_id,product_sku,child_sku,deleted_time) values('.(int)$product->getId().',"'.$product->getSku().'","",now())';
365
+ }
366
+ $write_db = Mage::getSingleton('core/resource')->getConnection('core_write');
367
+ $write_db->query($store_deleted);
368
+ }
369
+
370
+
371
+ public function processApplyCartPromo(Varien_Event_Observer $observer)
372
+ {
373
+ global $_SESSION;
374
+ if (isset($_SESSION['inside_request'])&&(time()-$_SESSION['inside_request'])<2){//3 second prevent duplicate confirmation request
375
+ //echo "@".(time()-$_SESSION['inside_request'])."@";
376
+ return ;
377
+ }
378
+
379
+ $_SESSION['inside_request']=time();
380
+ $quote = $observer->getQuote();
381
+
382
+ $promotions_data_hash=array();
383
+
384
+ $getSinch=Mage::getModel('qixol/sinch');
385
+ $unlink_coupon_codes=array();
386
+ foreach ($_SESSION['qixol_quoted_items']['coupons'] as $coupon_id=>$coupon_stored_data){
387
+ if ((bool)$coupon_stored_data['issued']==true)
388
+ $unlink_coupon_codes[]=$coupon_id;
389
+
390
+ }
391
+ foreach ($unlink_coupon_codes as $coupon_id){
392
+ //$_Cart=Mage::getModel('checkout/cart');
393
+ unset($_SESSION['qixol_quoted_items']['coupons'][$coupon_id]);
394
+ }
395
+ unset($unlink_coupon_codes);
396
+
397
+ $qixol_quoted_items=$getSinch->run_processOrder($quote);
398
+ $_SESSION['qixol_quoted_items']=$qixol_quoted_items;
399
+
400
+ $delivery_discount_amount=0;
401
+ $recalcualte_totals=false;
402
+ $totaldiscountAmount=0;
403
+ $this->structure_to_store_in_order=array();
404
+ $this->structure_to_store_in_order['items']=array();
405
+ $this->structure_to_store_in_order['promotion_summary']=$_SESSION['qixol_quoted_items']['summary'];
406
+ if (is_array($_SESSION['qixol_quoted_items'])){
407
+ foreach ($quote->getAllItems() as $item) {
408
+ //calculate total discount first
409
+ if (isset($_SESSION['qixol_quoted_items']['items'][$item->getId()]))
410
+ if ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_price']){
411
+ $row_total_before_discount=$item->getRowTotal();
412
+ $dicount_value=$row_total_before_discount-(float)$_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['lineamount'];
413
+
414
+ $this->structure_to_store_in_order['items'][$item->getId()]['discount']=$dicount_value;
415
+ $this->structure_to_store_in_order['items'][$item->getId()]['originalquantity']=$_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['originalquantity'];
416
+ $this->structure_to_store_in_order['items'][$item->getId()]['quantity']=$_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['quantity'];
417
+ $this->structure_to_store_in_order['items'][$item->getId()]['promotions']=$_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'];
418
+ if (is_array($promotions_data_hash))
419
+ foreach ($this->structure_to_store_in_order['items'][$item->getId()]['promotions'] as $promotion_id=>$promotion_arr){
420
+ if (isset($promotions_data_hash[$promotion_id])){
421
+ $this->structure_to_store_in_order['items'][$item->getId()]['promotions'][$promotion_id]['description']=$promotions_data_hash[$promotion_id];
422
+ }else {
423
+ $cart_promotion_data=Mage::getModel('qixol/promotions')->load($promotion_id);
424
+ $promotions_data_hash[$promotion_id]=$cart_promotion_data->getPromotionText();
425
+ $this->structure_to_store_in_order['items'][$item->getId()]['promotions'][$promotion_id]['description']=$promotions_data_hash[$promotion_id];
426
+ }
427
+ }
428
+
429
+ if ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['free_added']>0){
430
+ $this->structure_to_store_in_order['items'][$item->getId()]['free_added']=$_SESSION['qixol_quoted_items']['items'][$item->getId()]['free_added'];
431
+ }
432
+ /*
433
+ $item->setCustomPrice((float)$_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['price']);
434
+ $item->setOriginalCustomPrice((float)$_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['price']);
435
+ $item->setDiscountAmount($dicount_value);
436
+ $item->setBaseDiscountAmount($dicount_value);
437
+ $item->setRowTotalWithDiscount($row_total_before_discount - $dicount_value);
438
+ */
439
+ //$item->setRowTotal($row_total_before_discount-$dicount_value);
440
+ //$item->setBaseRowTotal($row_total_before_discount-$dicount_value);
441
+ /*
442
+ $item->getProduct()->setIsSuperMode(true);
443
+ $item->save();
444
+ **/
445
+ $totaldiscountAmount+=$dicount_value;
446
+ /*$quote->setGrandTotal($quote->getGrandTotal()-$dicount_value);
447
+ $quote->setBaseGrandTotal($quote->getBaseSubtotal()-$dicount_value);
448
+ $quote->setSubtotal($quote->getBaseSubtotal()-$dicount_value);
449
+ $quote->setBaseSubtotal($quote->getBaseSubtotal()-$dicount_value);
450
+ $quote->setSubtotalWithDiscount($quote->getBaseSubtotal()-$dicount_value);
451
+ $quote->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$dicount_value);*/
452
+ $recalcualte_totals=true;
453
+ }
454
+ /*elseif($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['isdelivery']){
455
+ foreach ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'] as $delivery_promotion){
456
+ if ($delivery_promotion['discountamount']>0){
457
+ $delivery_discount_amount+=$delivery_promotion['discountamount'];
458
+ $recalcualte_totals=true;
459
+ }
460
+ }
461
+ }*/
462
+ elseif(is_array($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'])){ //sometimes no linediscount,discount or other need to llok in ['items'][xxx]['promotions'][xxx][discountamount]
463
+ foreach ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'] as $promotion_id=>$check_promotion){
464
+ if ($check_promotion['discountamount']>0&&$check_promotion['basketlevel']>0){
465
+ $dicount_value+=$check_promotion['discountamount'];
466
+ $this->structure_to_store_in_order['items'][$item->getId()]['promotions'][$promotion_id]=$_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'][$promotion_id];
467
+ if (is_array($promotions_data_hash))
468
+ if (isset($promotions_data_hash[$promotion_id])){
469
+ $this->structure_to_store_in_order['items'][$item->getId()]['promotions'][$promotion_id]['description']=$promotions_data_hash[$promotion_id];
470
+ }else {
471
+ $cart_promotion_data=Mage::getModel('qixol/promotions')->load($promotion_id);
472
+ $promotions_data_hash[$promotion_id]=$cart_promotion_data->getPromotionText();
473
+ $this->structure_to_store_in_order['items'][$item->getId()]['promotions'][$promotion_id]['description']=$promotions_data_hash[$promotion_id];
474
+ }
475
+ $totaldiscountAmount+=$dicount_value;
476
+ }
477
+ }
478
+ }/*elseif($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['isdelivery']){
479
+ foreach ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'] as $delivery_promotion){
480
+ if ($delivery_promotion['discountamount']>0){
481
+ $delivery_discount_amount+=$delivery_promotion['discountamount'];
482
+ $recalcualte_totals=true;
483
+ }
484
+ }
485
+ }*/
486
+ }
487
+ //as customer described
488
+ if (isset($_SESSION['qixol_quoted_items']['cart_data']['deliverytotaldiscount'])&&$_SESSION['qixol_quoted_items']['cart_data']['deliverytotaldiscount']>0){
489
+ $delivery_discount_amount=$_SESSION['qixol_quoted_items']['cart_data']['deliverytotaldiscount'];
490
+ $recalcualte_totals=true;
491
+ }
492
+ }
493
+
494
+ if ($recalcualte_totals){
495
+
496
+ $total=$quote->getBaseSubtotal();
497
+ $quote->setSubtotal(0);
498
+ $quote->setBaseSubtotal(0);
499
+
500
+ $quote->setSubtotalWithDiscount(0);
501
+ $quote->setBaseSubtotalWithDiscount(0);
502
+
503
+ $quote->setGrandTotal(0);
504
+ $quote->setBaseGrandTotal(0);
505
+
506
+
507
+ $canAddItems = $quote->isVirtual()? ('billing') : ('shipping');
508
+ foreach ($quote->getAllAddresses() as $address) {
509
+
510
+
511
+ $address->setSubtotal(0);
512
+ $address->setBaseSubtotal(0);
513
+
514
+ $address->setGrandTotal(0);
515
+ $address->setBaseGrandTotal(0);
516
+
517
+ $address->collectTotals();
518
+
519
+ $quote->setSubtotal((float) $quote->getSubtotal() + $address->getSubtotal());
520
+ $quote->setBaseSubtotal((float) $quote->getBaseSubtotal() + $address->getBaseSubtotal());
521
+
522
+ $quote->setSubtotalWithDiscount(
523
+ (float) $quote->getSubtotalWithDiscount() + $address->getSubtotalWithDiscount()
524
+ );
525
+ $quote->setBaseSubtotalWithDiscount(
526
+ (float) $quote->getBaseSubtotalWithDiscount() + $address->getBaseSubtotalWithDiscount()
527
+ );
528
+
529
+ $quote->setGrandTotal((float) $quote->getGrandTotal() + $address->getGrandTotal());
530
+ $quote->setBaseGrandTotal((float) $quote->getBaseGrandTotal() + $address->getBaseGrandTotal());
531
+
532
+ $quote ->save();
533
+
534
+ $quote->setGrandTotal($quote->getBaseSubtotal()-$totaldiscountAmount-$delivery_discount_amount)
535
+ ->setBaseGrandTotal($quote->getBaseSubtotal()-$totaldiscountAmount-$delivery_discount_amount)
536
+ ->setSubtotalWithDiscount($quote->getBaseSubtotal()-$totaldiscountAmount-$delivery_discount_amount)
537
+ ->setBaseSubtotalWithDiscount($quote->getBaseSubtotal()-$totaldiscountAmount-$delivery_discount_amount)
538
+ ->save();
539
+
540
+
541
+ if($address->getAddressType()==$canAddItems) {
542
+
543
+ //echo $address->setDiscountAmount; exit;
544
+ $address->setSubtotalWithDiscount((float) $address->getSubtotalWithDiscount()-$totaldiscountAmount-$delivery_discount_amount);
545
+ $address->setGrandTotal((float) $address->getGrandTotal()-$totaldiscountAmount-$delivery_discount_amount);
546
+ $address->setBaseSubtotalWithDiscount((float) $address->getBaseSubtotalWithDiscount()-$totaldiscountAmount-$delivery_discount_amount);
547
+ $address->setBaseGrandTotal((float) $address->getBaseGrandTotal()-$totaldiscountAmount-$delivery_discount_amount);
548
+
549
+ if($address->getDiscountDescription()){
550
+
551
+ $address->setDiscountAmount(-($address->getDiscountAmount()+$totaldiscountAmount+$delivery_discount_amount));
552
+ $address->setDiscountDescription($address->getDiscountDescription().($totaldiscountAmount>0?', Qixol Discount':"").($delivery_discount_amount>0?", Delivery Discount":""));
553
+ $address->setBaseDiscountAmount(-($address->getBaseDiscountAmount()+$totaldiscountAmount+$delivery_discount_amount));
554
+ }else {
555
+
556
+ $address->setDiscountAmount(-($totaldiscountAmount+$delivery_discount_amount));
557
+ $address->setDiscountDescription(($totaldiscountAmount>0?' Qixol Discount':"").($delivery_discount_amount>0?($totaldiscountAmount>0?",":"")." Delivery Discount":""));
558
+ $address->setBaseDiscountAmount(-($totaldiscountAmount+$delivery_discount_amount));
559
+ }
560
+
561
+ $address->save();
562
+ }
563
+ }
564
+ //add free items
565
+
566
+ if (is_array($_SESSION['qixol_quoted_items'])){
567
+ foreach ($quote->getAllItems() as $item) {
568
+ if (isset($_SESSION['qixol_quoted_items']['items'][$item->getId()]))
569
+ if ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_price']){
570
+ $row_total_before_discount=$item->getRowTotal();
571
+ //$item->setCustomPrice((float)$_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['price']);
572
+ //$item->setOriginalCustomPrice((float)$_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['price']);
573
+ $dicount_value=$row_total_before_discount-(float)$_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['lineamount'];
574
+ $item->setDiscountAmount($dicount_value);
575
+ $item->setBaseDiscountAmount($dicount_value);
576
+ $item->setRowTotalWithDiscount($row_total_before_discount-$dicount_value);
577
+ //$item->setRowTotal($row_total_before_discount-$dicount_value);
578
+ //$item->setBaseRowTotal($row_total_before_discount-$dicount_value);
579
+ $item->getProduct()->setIsSuperMode(true);
580
+ $item->save();
581
+ }
582
+ if ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['free_added']>0){
583
+ $item->setQty($item->getQty()+$_SESSION['qixol_quoted_items']['items'][$item->getId()]['free_added']);
584
+ $item->setDiscountAmount($item->getDiscountAmount()+($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['originalprice']*$_SESSION['qixol_quoted_items']['items'][$item->getId()]['free_added']));
585
+ $item->setBaseDiscountAmount($item->getBaseDiscountAmount()+($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['originalprice']*$_SESSION['qixol_quoted_items']['items'][$item->getId()]['free_added']));
586
+ $dicount_value=$dicount_value+($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['originalprice']*$_SESSION['qixol_quoted_items']['items'][$item->getId()]['free_added']);
587
+ $item->getProduct()->setIsSuperMode(true);
588
+ $item->save();
589
+ }
590
+ }
591
+
592
+ //add free prroducts
593
+ foreach ($_SESSION['qixol_quoted_items']['items'] as $qixol_cart_items){
594
+ if ($qixol_cart_items['new']&&$qixol_cart_items['data']['isdelivery']==0){
595
+ if ($productId=Mage::getModel('catalog/product')->getIdBySku((string)$qixol_cart_items['data']['variantcode']!=''?(string)$qixol_cart_items['data']['variantcode']:(string)$qixol_cart_items['data']['productcode'])){
596
+ $productObj = Mage::getModel('catalog/product')
597
+ ->setStoreId(Mage::app()->getStore()->getId())
598
+ ->load($productId);
599
+ $item=$quote->addProduct($productObj,(int)$qixol_cart_items['data']['quantity']);
600
+ $item->setCustomPrice(0);
601
+ $item->save();
602
+ }
603
+ }
604
+ }
605
+ }
606
+
607
+ }
608
+
609
+ if (isset($_SESSION['qixol_quoted_items']['coupons'])&&count($_SESSION['qixol_quoted_items']['coupons'])){
610
+ $coupons_issued='';
611
+ $customerData_to_work_with = Mage::getSingleton('customer/session')->getCustomer();
612
+ foreach ($_SESSION['qixol_quoted_items']['coupons'] as $_coupons_code=>$tmp_val){
613
+ if ((bool)$tmp_val['issued']==true){
614
+ $coupons_issued.="(".$_coupons_code.") - ".$tmp_val['description'];
615
+ //save issued coupon
616
+ $issued_coupon_model = Mage::getModel('qixol/issuedcoupon');
617
+ $issued_coupon_model->setCustomerId($customerData_to_work_with->getId());
618
+ $issued_coupon_model->setCouponCodeValue($_coupons_code);
619
+ $issued_coupon_model->setCouponValidTill($tmp_val['validtill']);
620
+ $issued_coupon_model->setCouponDescription($tmp_val['description']);
621
+ $issued_coupon_model->setCreatedTime(now());
622
+ $issued_coupon_model->save();
623
+ }
624
+ }
625
+ if (trim($coupons_issued)!=''){
626
+ $order = $observer->getOrder();
627
+ $order->addStatusHistoryComment(Mage::helper('qixol')->__("You have obtined coupon(s):".$coupons_issued), $order->getStatus())
628
+ ->setIsVisibleOnFront(true)
629
+ ->setIsCustomerNotified(true);
630
+ }
631
+ }
632
+
633
+ $order = $observer->getOrder();
634
+ $order->setPromotionDataApplied(serialize($this->structure_to_store_in_order));
635
+ //save issued points to customer
636
+ foreach ($_SESSION['qixol_quoted_items']['summary'] as $summary_data_process){
637
+ if($summary_data_process['data']['issuedpoints']>0){
638
+ if (!isset($customerData_to_work_with))
639
+ $customerData_to_work_with = Mage::getSingleton('customer/session')->getCustomer();
640
+ $this->recordPoints($summary_data_process['data']['issuedpoints'], $customerData_to_work_with->getId());
641
+ }
642
+ }
643
+
644
+
645
+ $discounted_points = Mage::getSingleton('customer/session')->getPointsAmount();
646
+ //subtract points for this order
647
+ if ($discounted_points>0){
648
+ if (!isset($customerData_to_work_with))
649
+ $customerData_to_work_with = Mage::getSingleton('customer/session')->getCustomer();
650
+ $this->usePoints($discounted_points, $customerData_to_work_with->getId());
651
+ }
652
+
653
+
654
+ /*foreach ($order->getAllItems() as $item) {
655
+ if (isset($_SESSION['qixol_quoted_items']['items'][$item->getQuoteId()])){
656
+ if ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['free_added']>0){
657
+ $item->setQtyOrdered($item->getQtyOrdered()+$_SESSION['qixol_quoted_items']['items'][$item->getId()]['free_added']);
658
+ $item->save();
659
+ }
660
+ }
661
+
662
+ }*/
663
+ //$order->save();
664
+ //unset old shopping cart
665
+ //print_r($_SESSION['qixol_quoted_items']);
666
+ unset($_SESSION['qixol_quoted_items']);
667
+ unset($_SESSION['inside_request']);
668
+ $_SESSION['structure_to_store_in_order']=$this->structure_to_store_in_order;
669
+
670
+ }
671
+
672
+
673
+ public function processSavePromotionsToOrder($observer){
674
+ global $_SESSION;
675
+ $order = $observer->getOrder();
676
+ $order->setPromotionDataApplied(serialize($_SESSION['structure_to_store_in_order']));
677
+ $order->save();
678
+ $this->structure_to_store_in_order=array();
679
+ unset($_SESSION['structure_to_store_in_order']);
680
+ }
681
+
682
+ public function processShippingUpdated(Varien_Event_Observer $observer)
683
+ {
684
+ global $_SESSION;
685
+ if (isset($_SESSION['inside_request'])&&(time()-$_SESSION['inside_request'])<1){//7 second prevent duplicate request
686
+ //echo "@".(time()-$_SESSION['inside_request'])."@";
687
+ return ;
688
+ }
689
+
690
+
691
+ $_SESSION['inside_request']=time();
692
+
693
+ $getSinch=Mage::getModel('qixol/sinch');
694
+ $cart=$observer->getEvent()->getQuote();
695
+ if ($qixol_quoted_items_new=$getSinch->run_ImportCart($cart)){
696
+ $qixol_quoted_items=$qixol_quoted_items_new; //if returned new structure
697
+ }
698
+ $qixol_quoted_items['time_checked']=time();
699
+ $qixol_quoted_items['short_data']=$_SESSION['qixol_quoted_items']['short_data'];
700
+ $qixol_quoted_items['cart_session_id']=$_SESSION['qixol_quoted_items']['cart_session_id'];
701
+ $_SESSION['qixol_quoted_items']=$qixol_quoted_items;
702
+
703
+ unset($_SESSION['inside_request']);
704
+ }
705
+
706
+ public function processGetCartPromo(Varien_Event_Observer $observer)
707
+ {
708
+ global $_SESSION;
709
+ if (isset($_SESSION['inside_request'])&&(time()-$_SESSION['inside_request'])<4){//7 second prevent duplicate request
710
+ //echo "@".(time()-$_SESSION['inside_request'])."@";
711
+ return ;
712
+ }
713
+
714
+ $_SESSION['inside_request']=time();
715
+ if ((!isset($_SESSION['qixol_quoted_items']['cart_session_id']))||$_SESSION['qixol_quoted_items']['cart_session_id']=='') $_SESSION['qixol_quoted_items']['cart_session_id']=md5(time());
716
+ $qixol_quoted_items=array();
717
+ $make_request_again=false;
718
+ if (isset($_SESSION['qixol_quoted_items']))
719
+ $qixol_quoted_items=$_SESSION['qixol_quoted_items'];
720
+ else $make_request_again=true;
721
+
722
+ //check difference between cards in productid and it quantity
723
+ $cart = $observer->getEvent()->getCart()->getQuote();
724
+ foreach ($cart->getAllItems() as $item) {
725
+ $product_search_tmp = Mage::getModel('catalog/product')->load($item->getProductId());
726
+ //$product_search_tmp->getSku().$item->getProduct()->getSku() use this structure to have unique combinations for simple and configured products
727
+ $short_data[$product_search_tmp->getSku().$item->getProduct()->getSku()]['qty']=$item->getQty();
728
+ }
729
+
730
+
731
+ if (!$make_request_again)
732
+ if (!is_array($_SESSION['qixol_quoted_items']['short_data'])){
733
+ $make_request_again=true;
734
+ } elseif(count($_SESSION['qixol_quoted_items']['short_data'])!=count($short_data)) {
735
+ $make_request_again=true;
736
+ } else {
737
+ $short_data_old=$_SESSION['qixol_quoted_items']['short_data'];
738
+ }
739
+
740
+ if ((!isset($_SESSION['qixol_quoted_items']['time_checked']))||(($_SESSION['qixol_quoted_items']['time_checked']+1200)<time())){ // rerequest in 10 minutes
741
+ $make_request_again=true;
742
+ }
743
+
744
+
745
+ if (!$make_request_again){
746
+ //now the cart have the same dimension, so if any product diffenrence it vill be visible simply
747
+ foreach($short_data as $current_id=>$current_prod_obj){
748
+ if ((!isset($short_data_old[$current_id]))||$short_data_old[$current_id]['qty']!=$current_prod_obj['qty']){
749
+ $make_request_again=true;
750
+ break;
751
+ }
752
+ }
753
+ }
754
+
755
+ if ((!$make_request_again)){
756
+ $shipping_price_exists=$cart->getShippingAddress()->getShippingAmount();
757
+ if ($shipping_price_exists!=(float)$_SESSION['qixol_quoted_items']['cart_data']['deliveryoriginalprice']){
758
+ $make_request_again=true;
759
+ }
760
+ }
761
+ if (count($cart->getAllItems())==0){
762
+ unset($_SESSION['qixol_quoted_items']['items']);
763
+ unset($_SESSION['qixol_quoted_items']['cart_data']);
764
+ unset($_SESSION['qixol_quoted_items']['short_data']);
765
+ unset($_SESSION['qixol_quoted_items']['promotions']);
766
+ unset($_SESSION['qixol_quoted_items']['messages']);
767
+ unset($_SESSION['qixol_quoted_items']['summary']);
768
+ $unlink_coupon=array();
769
+ foreach ($_SESSION['qixol_quoted_items']['coupons'] as $key_coupon_id => $coupon_data_tmp){
770
+ if ((bool)$coupon_data_tmp['issued']==true)
771
+ $unlink_coupon[$key_coupon_id]=$key_coupon_id;
772
+ }
773
+ if (count($unlink_coupon)>0)
774
+ foreach ($unlink_coupon as $key_coupon_id){
775
+ unset($_SESSION['qixol_quoted_items']['coupons'][$key_coupon_id]);
776
+ }
777
+ unset($qixol_quoted_items);
778
+ unset($short_data);
779
+ //print_r($_SESSION['qixol_quoted_items']);
780
+ //die();
781
+ }
782
+
783
+ //!!!!!!!!!!!!!!!!!!!!!!!
784
+ //$make_request_again=true;
785
+ //!!!!!!!!!!!!!!!!!!!!!!!
786
+ if ($make_request_again){
787
+ //echo "make_new_request<br>";
788
+ $getSinch=Mage::getModel('qixol/sinch');
789
+ if ($qixol_quoted_items_new=$getSinch->run_ImportCart($cart)){
790
+ $qixol_quoted_items=$qixol_quoted_items_new; //if returned new structure
791
+ }
792
+ $qixol_quoted_items['time_checked']=time();
793
+ $qixol_quoted_items['short_data']=$short_data;
794
+ $qixol_quoted_items['cart_session_id']=$_SESSION['qixol_quoted_items']['cart_session_id'];
795
+ $_SESSION['qixol_quoted_items']=$qixol_quoted_items;
796
+ //print_r($_SESSION['qixol_quoted_items']);
797
+ //die();
798
+ }
799
+ /*echo "<pre>";
800
+ print_r($_SESSION['qixol_quoted_items']);
801
+ echo "</pre>";*/
802
+ unset($_SESSION['inside_request']);
803
+ }
804
+
805
+ public function recordPoints($pointsInt, $customerId) {
806
+ $points = Mage::getModel('qixol/bonuspoints')->load($customerId);
807
+ $points->addPoints($pointsInt, $customerId);
808
+ $points->save();
809
+
810
+ }
811
+
812
+
813
+ public function usePoints($discounted, $customerId) {
814
+ $pointsAmt = $discounted;
815
+ $points = Mage::getModel('qixol/bonuspoints')->load($customerId);
816
+ $points->subtractPoints($pointsAmt, $customerId);
817
+ $points->save();
818
+ }
819
+ }
app/code/community/Qixol/Promo/Model/Ordertotalpoints.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Ordertotalpoints extends Mage_Sales_Model_Quote_Address_Total_Abstract {
3
+
4
+ protected $_code = 'points';
5
+
6
+ public function collect(Mage_Sales_Model_Quote_Address $address) {
7
+ parent::collect($address);
8
+
9
+ $this->_setAmount(0);
10
+ $this->_setBaseAmount(0);
11
+
12
+ $items = $this->_getAddressItems($address);
13
+ if (!count($items)) {
14
+ return $this; //this makes only address type shipping to come through
15
+ }
16
+
17
+ $quote = $address->getQuote();
18
+
19
+ if(true/*$address->getData('address_type') == 'billing'*/){
20
+ $points_convertrate=1;
21
+ if ((int)Mage::getStoreConfig('qixol/issuedpoints/convertrate')>0)
22
+ $points_convertrate=(int)Mage::getStoreConfig('qixol/issuedpoints/convertrate');
23
+
24
+ $exist_amount = $quote->getPointsAmount()*$points_convertrate;
25
+ $new_points_amount = Mage::getSingleton('customer/session')->getPointsAmount(); //your discount
26
+ $balance = $new_points_amount - $exist_amount;
27
+
28
+ $address->setPointsAmount($new_points_amount/$points_convertrate);
29
+ $address->setBasePointsAmount($new_points_amount/$points_convertrate);
30
+
31
+
32
+ $grandTotal = $address->getGrandTotal();
33
+ $baseGrandTotal = $address->getBaseGrandTotal();
34
+ $quote->setFeeAmount($new_points_amount/$points_convertrate);
35
+
36
+ $address->setGrandTotal($grandTotal - ($balance/$points_convertrate));
37
+ $address->setBaseGrandTotal($baseGrandTotal - ($balance/$points_convertrate));
38
+ }
39
+ return $this;
40
+ }
41
+
42
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
43
+ {
44
+ $rewards1 = $address->getPointsAmount();
45
+ if ($rewards1!=0) {
46
+ $address->addTotal(array(
47
+ 'code'=>$this->getCode(),
48
+ 'title'=>Mage::helper('qixol')->__('Reward Points Discount'),
49
+ 'value'=>"-".$rewards1
50
+ ));
51
+
52
+ }
53
+ return $this;
54
+ }
55
+
56
+ }
app/code/community/Qixol/Promo/Model/PromoService.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require('iPromoService.php');
4
+ require_once('config.php');
5
+
6
+ abstract class PromoService implements iPromoService
7
+ {
8
+ public abstract function CustomerGroupExport($data);
9
+ public abstract function ShippingMethodsExport($data);
10
+ public abstract function CurrenciesExport($data);
11
+ public abstract function StoresExport($data);
12
+ public abstract function ProductsExport($data);
13
+
14
+ public abstract function PromotionsForProducts($data);
15
+ public abstract function PromotionsForBaskets($data);
16
+
17
+ public abstract function BasketValidate($data);
18
+ public abstract function CouponCodeValidate($couponCode);
19
+ public abstract function RetrieveValidatedBasket($basketRef);
20
+ public abstract function BasketCheck();
21
+
22
+ public function parsePromotionsForBaskets($promotion_new_xml=''){
23
+ $xml_object = simplexml_load_string($promotion_new_xml);
24
+ //print_r($xml_object);
25
+ if ($xml_object instanceof SimpleXMLElement) {
26
+ foreach ($xml_object as $xml_root_key=>$xml_object_sub){
27
+ if ($xml_root_key=='promotions'){
28
+ foreach ($xml_object_sub as $xml_promotions){
29
+ unset($promotion_model);
30
+ $attributes=$xml_promotions->attributes();
31
+ $promotion_model=Mage::getModel('qixol/promotions')->load((int)$attributes['id']);
32
+ if (count($promotion_model->getData())>0){
33
+ $promotion_model->setUpdateTime(date("Y-m-d H:i:s"));
34
+ } else {
35
+ unset($promotion_model);
36
+ $promotion_model=Mage::getModel('qixol/promotions');
37
+ $promotion_model->setCreatedTime(date("Y-m-d H:i:s"));
38
+ $promotion_model->setUpdateTime('0000-00-00 00:00:00');
39
+ }
40
+
41
+ $promotion_model->setPromotionId((int)$attributes['id']);
42
+ $promotion_model->setPromotionType(isset($attributes['type'])?(string)$attributes['type']:"");
43
+
44
+ $promotion_model->setDiscountpercent(isset($attributes['discountpercent'])?(double)$attributes['discountpercent']:0);
45
+ $promotion_model->setDiscountamount(isset($attributes['discountamount'])?(double)$attributes['discountamount']:0);
46
+ $promotion_model->setHascouponrestrictions(isset($attributes['hascouponrestrictions'])?(int)$attributes['hascouponrestrictions']:0);
47
+
48
+ $promotion_model->setPromotionName(isset($xml_promotions->name)?(string)$xml_promotions->name:"");
49
+ $promotion_model->setPromotionText(isset($xml_promotions->displaytext)?(string)$xml_promotions->displaytext:"");
50
+
51
+ try {
52
+ $promotion_model->save();
53
+ } catch(Exception $e) {
54
+ print_r($e);
55
+ }
56
+ }
57
+ }
58
+ }
59
+ //delete not updated simple way
60
+ $promotion_has_products=Mage::getResourceModel('qixol/promotions');
61
+ $promotion_has_products->removeOldDayPromotion();
62
+ }
63
+ }
64
+
65
+ function parsePromotionsForProducts($promotion_new_xml=''){
66
+ $active_promotions=array();
67
+ $new_promotions=array();
68
+ $promotions_list=Mage::getModel('qixol/Promotions')->getCollection();
69
+ foreach ($promotions_list as $current_promotion){
70
+ $active_promotions[$current_promotion->getPromotionId()]=$current_promotion->getPromotionType();
71
+ }
72
+ //first test data
73
+ //$promotion_new_xml='<response><promotions><promotion id="106" type="BUNDLE" yourref="QIXOL-2" bundleprice="50.00"><name>Qixol 2</name><displaytext>Buy three test config products for 50</displaytext></promotion><promotion id="107" type="BOGOF" discountpercent="50.00"><name>Qixol 3a</name><displaytext>test config product 4 - BOGOF</displaytext></promotion><promotion id="108" type="BOGOF" discountpercent="50.00"><name>Qixol 3b</name><displaytext>Test Config product 5 BOGOF</displaytext></promotion><promotion id="109" type="BOGOR" discountpercent="50.00"><name>Qixol 4a</name><displaytext>test config product 6 BOGOR</displaytext></promotion><promotion id="110" type="BOGOR" discountpercent="2.00"><name>Qixol 4b</name><displaytext>test config product 7 BOGOR</displaytext></promotion><promotion id="111" type="BOGOR" discountpercent="24.99"><name>Qixol 4c</name><displaytext>Buy two "Test config product 8" get the second for 24.99</displaytext></promotion><promotion id="112" type="DEAL"><name>Qixol 5a</name><displaytext>Buy a small green, small black and small white product, get the cheapest free</displaytext></promotion><promotion id="113" type="DEAL"><name>Qixol 5b</name><displaytext>Buy a medium red, medium white and medium black product for 19.99</displaytext></promotion><promotion id="116" type="FREEPRODUCT"><name>Qixol 7a</name><displaytext>Buy "test product 1 / Test1_01" get "test product 2 / 123456" free (applies ONCE only)</displaytext></promotion><promotion id="117" type="FREEPRODUCT"><name>Qixol 7b</name><displaytext>Buy "test product 4 / test_4" get "test product 5 / test_5" free for each "test product 4"</displaytext></promotion><promotion id="118" type="ISSUECOUPON"><name>Qixol 8a</name><displaytext>Buy "testing" (test2_01) get a coupon code</displaytext></promotion><promotion id="121" type="PRODUCTSREDUCTION" discountpercent="30.00"><name>Qixol 10</name><displaytext>Use an issued coupon, get 30% off any Size = L product</displaytext></promotion></promotions><products><product productcode="config_11"/><product productcode="config_11" variantcode="test2_01_01"><promotions><promotion id="121" requiredqty="1"/></promotions></product><product productcode="config_11" variantcode="test2_01_03"/><product productcode="config_11" variantcode="test1_1"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_11" variantcode="test2_2"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_11" variantcode="test3_3"/><product productcode="config_11" variantcode="test4_4"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_11" variantcode="test5_5"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_11" variantcode="Test6_6"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_11" variantcode="test7_7"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_11" variantcode="test8_8"><promotions><promotion id="121" requiredqty="1"/></promotions></product><product productcode="config_10"/><product productcode="config_10" variantcode="test2_01_01"><promotions><promotion id="121" requiredqty="1"/></promotions></product><product productcode="config_10" variantcode="test2_01_03"/><product productcode="config_10" variantcode="test1_1"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_10" variantcode="test2_2"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_10" variantcode="test3_3"/><product productcode="config_10" variantcode="test4_4"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_9"/><product productcode="config_9" variantcode="test1_1"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_9" variantcode="test2_2"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_9" variantcode="test5_5"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_9" variantcode="Test6_6"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_9" variantcode="test7_7"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_9" variantcode="test8_8"><promotions><promotion id="121" requiredqty="1"/></promotions></product><product productcode="test8_8"/><product productcode="test7_7"/><product productcode="config_8"><promotions><promotion id="111" requiredqty="2"/></promotions></product><product productcode="config_8" variantcode="test2_01_01"><promotions><promotion id="121" requiredqty="1"/><promotion id="111" requiredqty="2"/></promotions></product><product productcode="config_8" variantcode="test2_01_03"><promotions><promotion id="111" requiredqty="2"/></promotions></product><product productcode="config_8" variantcode="test1_1"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/><promotion id="111" requiredqty="2"/></promotions></product><product productcode="config_8" variantcode="test2_2"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/><promotion id="111" requiredqty="2"/></promotions></product><product productcode="config_8" variantcode="test3_3"><promotions><promotion id="111" requiredqty="2"/></promotions></product><product productcode="config_7"><promotions><promotion id="110" requiredqty="2"/></promotions></product><product productcode="config_7" variantcode="test2_01_01"><promotions><promotion id="121" requiredqty="1"/><promotion id="110" requiredqty="2"/></promotions></product><product productcode="config_7" variantcode="test2_01_03"><promotions><promotion id="110" requiredqty="2"/></promotions></product><product productcode="config_7" variantcode="test1_1"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/><promotion id="110" requiredqty="2"/></promotions></product><product productcode="config_7" variantcode="test2_2"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/><promotion id="110" requiredqty="2"/></promotions></product><product productcode="config_7" variantcode="test3_3"><promotions><promotion id="110" requiredqty="2"/></promotions></product><product productcode="config_7" variantcode="test4_4"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/><promotion id="110" requiredqty="2"/></promotions></product><product productcode="config_7" variantcode="test5_5"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/><promotion id="110" requiredqty="2"/></promotions></product><product productcode="config_7" variantcode="Test6_6"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/><promotion id="110" requiredqty="2"/></promotions></product><product productcode="config_6"><promotions><promotion id="109" requiredqty="2"/></promotions></product><product productcode="config_6" variantcode="test1_1"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/><promotion id="109" requiredqty="2"/></promotions></product><product productcode="config_6" variantcode="test2_2"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/><promotion id="109" requiredqty="2"/></promotions></product><product productcode="config_6" variantcode="test4_4"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/><promotion id="109" requiredqty="2"/></promotions></product><product productcode="config_6" variantcode="test5_5"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/><promotion id="109" requiredqty="2"/></promotions></product><product productcode="config_6" variantcode="Test6_6"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/><promotion id="109" requiredqty="2"/></promotions></product><product productcode="config_5"><promotions><promotion id="108" requiredqty="2"/></promotions></product><product productcode="config_5" variantcode="test2_01_01"><promotions><promotion id="121" requiredqty="1"/><promotion id="108" requiredqty="2"/></promotions></product><product productcode="config_5" variantcode="test2_01_03"><promotions><promotion id="108" requiredqty="2"/></promotions></product><product productcode="config_5" variantcode="test1_1"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/><promotion id="108" requiredqty="2"/></promotions></product><product productcode="config_5" variantcode="test3_3"><promotions><promotion id="108" requiredqty="2"/></promotions></product><product productcode="config_5" variantcode="test4_4"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/><promotion id="108" requiredqty="2"/></promotions></product><product productcode="config_5" variantcode="test5_5"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/><promotion id="108" requiredqty="2"/></promotions></product><product productcode="config_5" variantcode="Test6_6"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/><promotion id="108" requiredqty="2"/></promotions></product><product productcode="Test6_6"/><product productcode="test5_5"/><product productcode="test4_4"/><product productcode="test3_3"/><product productcode="config_4"><promotions><promotion id="107" requiredqty="2"/></promotions></product><product productcode="config_4" variantcode="test2_01_01"><promotions><promotion id="121" requiredqty="1"/><promotion id="107" requiredqty="2"/></promotions></product><product productcode="config_4" variantcode="test2_01_03"><promotions><promotion id="107" requiredqty="2"/></promotions></product><product productcode="config_4" variantcode="test1_1"><promotions><promotion id="112" requiredqty="1" multipleproductrestrictions="1"/><promotion id="107" requiredqty="2"/></promotions></product><product productcode="config_4" variantcode="test2_2"><promotions><promotion id="113" requiredqty="1" multipleproductrestrictions="1"/><promotion id="107" requiredqty="2"/></promotions></product><product productcode="test2_2"/><product productcode="test1_1"/><product productcode="config_3"><promotions><promotion id="106" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_3" variantcode="test2_01_01"><promotions><promotion id="121" requiredqty="1"/><promotion id="106" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_3" variantcode="test2_01_03"><promotions><promotion id="106" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_2"><promotions><promotion id="106" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_2" variantcode="test2_01_01"><promotions><promotion id="121" requiredqty="1"/><promotion id="106" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_2" variantcode="test2_01_03"><promotions><promotion id="106" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_1"><promotions><promotion id="106" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_1" variantcode="test2_01_01"><promotions><promotion id="121" requiredqty="1"/><promotion id="106" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="config_1" variantcode="test2_01_03"><promotions><promotion id="106" requiredqty="1" multipleproductrestrictions="1"/></promotions></product><product productcode="test_5"/><product productcode="test_4"><promotions><promotion id="117" requiredqty="1"/></promotions></product><product productcode="test_3"/><product productcode="123456"/><product productcode="test2_01_03"/><product productcode="test2_01_01"><promotions><promotion id="121" requiredqty="1"/></promotions></product><product productcode="test2_01"><promotions><promotion id="118" requiredqty="1"/></promotions></product><product productcode="test2_01" variantcode="test2_01_01"><promotions><promotion id="118" requiredqty="1"/><promotion id="121" requiredqty="1"/></promotions></product><product productcode="test2_01" variantcode="test2_01_03"><promotions><promotion id="118" requiredqty="1"/></promotions></product><product productcode="Test1_01"><promotions><promotion id="116" requiredqty="1"/></promotions></product></products><summary result="true"/></response>';
74
+ $xml_object = simplexml_load_string($promotion_new_xml);
75
+ //print_r($xml_object);
76
+ if ($xml_object instanceof SimpleXMLElement) {
77
+ foreach ($xml_object->promotions->promotion as $xml_promotions){
78
+ unset($promotion_model);
79
+ $attributes=$xml_promotions->attributes();
80
+ $promotion_model=Mage::getModel('qixol/promotions')->load((int)$attributes['id']);
81
+ if (count($promotion_model->getData())>0){
82
+ $promotion_model->setUpdateTime(date("Y-m-d H:i:s"));
83
+
84
+ } else {
85
+ unset($promotion_model);
86
+ $promotion_model=Mage::getModel('qixol/promotions');
87
+ $promotion_model->setCreatedTime(date("Y-m-d H:i:s"));
88
+ $promotion_model->setUpdateTime('0000-00-00 00:00:00');
89
+ }
90
+
91
+ $promotion_model->setPromotionId((int)$attributes['id']);
92
+ $promotion_model->setIsForProduct(1);
93
+ $promotion_model->setPromotionType(isset($attributes['type'])?(string)$attributes['type']:"");
94
+ $new_promotions[$promotion_model->getPromotionId()]=$promotion_model->getPromotionType();
95
+
96
+ $promotion_model->setDiscountamount(isset($attributes['discountamount'])?(double)$attributes['discountamount']:0);
97
+
98
+ $promotion_model->setDiscountpercent(isset($attributes['discountpercent'])?(double)$attributes['discountpercent']:0);
99
+ $promotion_model->setYourref(isset($attributes['yourref'])?(string)$attributes['yourref']:"");
100
+
101
+ $promotion_model->setBundleprice(isset($attributes['bundleprice'])?(double)$attributes['bundleprice']:0);
102
+ $promotion_model->setPromotionName(isset($xml_promotions->name)?(string)$xml_promotions->name:"");
103
+ $promotion_model->setPromotionText(isset($xml_promotions->displaytext)?(string)$xml_promotions->displaytext:"");
104
+ $promotion_model->setFromDate('0000-00-00 00:00:00');
105
+ $promotion_model->setTillDate('0000-00-00 00:00:00');
106
+
107
+ if (isset($xml_promotions->availabletimes)&&isset($xml_promotions->availabletimes->availabletime)){
108
+ foreach ($xml_promotions->availabletimes->availabletime as $availabletime){
109
+ $time_attributes=$availabletime->attributes();
110
+ if ((string)$time_attributes['start']!=''){
111
+ $promotion_model->setFromDate('2000-01-01 '.(string)$time_attributes['start']);
112
+ $promotion_model->setIsEveryday(1);
113
+ }
114
+ if ((string)$time_attributes['start']!=''){
115
+ $promotion_model->setTillDate('2000-01-01 '.(string)$time_attributes['end']);
116
+ $promotion_model->setIsEveryday(1);
117
+ }
118
+ }
119
+ }
120
+ if ($promotion_model->getFromDate()=='0000-00-00 00:00:00'&&$promotion_model->setTillDate()=='0000-00-00 00:00:00'){
121
+ $promotion_model->setIsEveryday(0);
122
+ }
123
+ try {
124
+ $promotion_model->save();
125
+ } catch(Exception $e) {
126
+ print_r($e);
127
+ }
128
+
129
+
130
+ }
131
+
132
+ //temporary because of bag settings this flag
133
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
134
+ $write_data->query("update qixol_promotions_type set is_everyday=1 where from_date!='0000-00-00 00:00:00' or till_date!='0000-00-00 00:00:00'");
135
+
136
+ foreach ($xml_object->products->product as $xml_products){
137
+ //print_r($xml_products);
138
+ $attributes=$xml_products->attributes();
139
+ if (isset($xml_products->promotions)&&!isset($xml_products->promotions->promotion[0])){
140
+ $ttemp_data=$xml_products->promotions->promotion;
141
+ unset($xml_products->promotions->promotion);
142
+ $xml_products->promotions->promotion[0]=$ttemp_data;
143
+ unset($ttemp_data);
144
+ }
145
+ foreach ($xml_products->promotions->promotion as $idx_name=>$xml_promotion_data){
146
+
147
+
148
+ //if ($idx_name=='promotions'){
149
+ //foreach ($xml_promotion as $xml_promotion_data){
150
+ $xml_promotion_data_attributes=$xml_promotion_data->attributes();
151
+ $promotion_to_product_array=array();
152
+ $promotion_to_product_array['created_time']=date("Y-m-d H:i:s");
153
+ $promotion_to_product_array['update_time']=date("Y-m-d H:i:s");
154
+ //get product id
155
+ $promotion_to_product_array['product_id']=0;
156
+ $product_search_tmp = Mage::getModel('catalog/product');
157
+ if ($product_id_tmp=$product_search_tmp->getIdBySku(((string)$attributes['variantcode']!=''?(string)$attributes['variantcode']:(string)$attributes['productcode']))){
158
+ $promotion_to_product_array['product_id']=(int)$product_id_tmp;
159
+ }
160
+ //get parent_id
161
+ $promotion_to_product_array['parent_product_id']=0;
162
+ if ((string)$attributes['variantcode']!=''){
163
+ $product_search_tmp = Mage::getModel('catalog/product');
164
+ if ($product_id_tmp=$product_search_tmp->getIdBySku((string)$attributes['productcode'])){
165
+ $promotion_to_product_array['parent_product_id']=(int)$product_id_tmp;
166
+ }
167
+ }
168
+
169
+ $promotion_to_product_array['promotion_id']=(int)$xml_promotion_data_attributes['id'];;
170
+ $promotion_to_product_array['parentsku']=((string)$attributes['variantcode']!=''?(string)$attributes['productcode']:'');
171
+ $promotion_to_product_array['sku']=((string)$attributes['variantcode']!=''?(string)$attributes['variantcode']:(string)$attributes['productcode']);
172
+
173
+ $promotion_to_product_array['requiredqty']=(isset($xml_promotion_data_attributes['requiredqty'])?(int)$xml_promotion_data_attributes['requiredqty']:0);
174
+ $promotion_to_product_array['multipleproductrestrictions']=isset($xml_promotion_data_attributes['multipleproductrestrictions'])?(int)$xml_promotion_data_attributes['multipleproductrestrictions']:0;
175
+ $promotion_has_products=Mage::getResourceSingleton('qixol/promotions');
176
+ $promotion_has_products->updatePromotionProduct($promotion_to_product_array);
177
+ }
178
+ // }
179
+ //}
180
+
181
+ }
182
+ //delete not updated simple way
183
+ $promotion_has_products=Mage::getResourceModel('qixol/promotions');
184
+ $promotion_has_products->removeOldPromotion();
185
+ $promotion_has_products->removeOldPromotedProduct();
186
+ /* $condition=$promotion_has_products->_getWriteAdapter()->quoteInto('(update_time <= ?)', "(now() - interval 1 hour)");
187
+ $promotion_has_products->_getWriteAdapter()->delete($this->getTable('promotions'), $condition);
188
+ */
189
+
190
+ /*foreach ($active_promotions as $p_id=>$p_type){
191
+ if (!isset($new_promotions[$p_id])){
192
+ //delete
193
+ }elseif($new_promotions[$p_id]!=$p_type){
194
+ //promotion type changed ???
195
+ }
196
+
197
+ }*/
198
+
199
+ }
200
+ }
201
+ }
app/code/community/Qixol/Promo/Model/Promotions.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Qixol_Promo_Model_Promotions extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct(){
6
+
7
+ $this->_init("qixol/promotions",'promotion_id');
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Qixol/Promo/Model/RESTPromoService.php ADDED
@@ -0,0 +1,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once ('config.php');
4
+ require_once('PromoService.php');
5
+
6
+ class RESTPromoService extends PromoService implements iPromoService
7
+ {
8
+
9
+ private function callQixolPromoRestService($method, $url, $data = false)
10
+ {
11
+ $curl = curl_init();
12
+
13
+ switch ($method)
14
+ {
15
+ case 'POST':
16
+ curl_setopt($curl, CURLOPT_POST, 1);
17
+
18
+ if ($data)
19
+ {
20
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
21
+ }
22
+ break;
23
+
24
+ case 'PUT':
25
+ curl_setopt($curl, CURLOPT_PUT, 1);
26
+ break;
27
+
28
+ default:
29
+ if ($data)
30
+ {
31
+ $url = sprintf("%s?%s", $url, http_build_query($data));
32
+ }
33
+ break;
34
+ }
35
+
36
+ // curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
37
+ // curl_setopt($curl, CURLOPT_USERPWD, "username:password");
38
+
39
+ curl_setopt($curl, CURLOPT_URL, $url);
40
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
41
+
42
+ $result = curl_exec($curl);
43
+
44
+ curl_close($curl);
45
+
46
+ return $result;
47
+ }
48
+
49
+ private function restServiceUrl()
50
+ {
51
+ $evaluationServicesUrl = 'http://evaluation.qixolpromo.com/';
52
+ $liveServicesUrl = 'http://evaluation.qixolpromo.com/';
53
+
54
+ switch (Mage::getStoreConfig('qixol/integraion/services')) {
55
+ case 'evaluation':
56
+ $restServiceUrl = $evaluationServicesUrl;
57
+ break;
58
+ case 'live':
59
+ $restServiceUrl = $liveServicesUrl;
60
+ break;
61
+ case 'custom':
62
+ $restServiceUrl = Mage::getStoreConfig('qixol/integraion/restServiceAddress');
63
+ // TODO: check a string exists and is a valid URL?
64
+ if (substr_compare(substr($restServiceUrl, -1), '/', 0) != 0)
65
+ {
66
+ $restServiceUrl .= '/';
67
+ }
68
+ break;
69
+ default:
70
+ $restServiceUrl = $evaluationServicesUrl;
71
+ break;
72
+ }
73
+ return $restServiceUrl;
74
+ }
75
+
76
+ public function CustomerGroupExport($data)
77
+ {
78
+ $url = $this->restServiceUrl().'api/'.Mage::getStoreConfig('qixol/integraion/companykey').'/import/entityvalues';
79
+ try
80
+ {
81
+ $result = $this->callQixolPromoRestService('POST', $url, $data);
82
+
83
+ if (empty($result))
84
+ {
85
+ $returnValue->messsage = 'Stores - no response';
86
+ $returnValue->success = false;
87
+ }
88
+ else
89
+ {
90
+ $returnValue->message = $result;
91
+ $returnValue->success = true;
92
+ }
93
+
94
+ return $returnValue;
95
+ }
96
+ catch(Exception $e)
97
+ {
98
+ $returnValue->message = print_r($e->faultstring);
99
+ $returnValue->success = false;
100
+
101
+ return $returnValue;
102
+ }
103
+ }
104
+
105
+ public function ShippingMethodsExport($data)
106
+ {
107
+ $url = $this->restServiceUrl().'api/'.Mage::getStoreConfig('qixol/integraion/companykey').'/import/entityvalues';
108
+ try
109
+ {
110
+ $result = $this->callQixolPromoRestService('POST', $url, $data);
111
+
112
+ if (empty($result))
113
+ {
114
+ $returnValue->messsage = 'Stores - no response';
115
+ $returnValue->success = false;
116
+ }
117
+ else
118
+ {
119
+ $returnValue->message = $result;
120
+ $returnValue->success = true;
121
+ }
122
+
123
+ return $returnValue;
124
+ }
125
+ catch(Exception $e)
126
+ {
127
+ $returnValue->message = print_r($e->faultstring);
128
+ $returnValue->success = false;
129
+
130
+ return $returnValue;
131
+ }
132
+ }
133
+
134
+ public function CurrenciesExport($data)
135
+ {
136
+ $url = $this->restServiceUrl().'api/'.Mage::getStoreConfig('qixol/integraion/companykey').'/import/entityvalues';
137
+ try
138
+ {
139
+ $result = $this->callQixolPromoRestService('POST', $url, $data);
140
+
141
+ if (empty($result))
142
+ {
143
+ $returnValue->messsage = 'Stores - no response';
144
+ $returnValue->success = false;
145
+ }
146
+ else
147
+ {
148
+ $returnValue->message = $result;
149
+ $returnValue->success = true;
150
+ }
151
+
152
+ return $returnValue;
153
+ }
154
+ catch(Exception $e)
155
+ {
156
+ $returnValue->message = print_r($e->faultstring);
157
+ $returnValue->success = false;
158
+
159
+ return $returnValue;
160
+ }
161
+ }
162
+
163
+ public function StoresExport($data)
164
+ {
165
+ // TODO: /import/entityvalues
166
+ $url = $this->restServiceUrl().'api/'.Mage::getStoreConfig('qixol/integraion/companykey').'/import/hierarchyvalues';
167
+ try
168
+ {
169
+ $result = $this->callQixolPromoRestService('POST', $url, $data);
170
+
171
+ if (empty($result))
172
+ {
173
+ $returnValue->messsage = 'Stores - no response';
174
+ $returnValue->success = false;
175
+ }
176
+ else
177
+ {
178
+ $returnValue->message = $result;
179
+ $returnValue->success = true;
180
+ }
181
+ return $returnValue;
182
+ }
183
+ catch(Exception $e)
184
+ {
185
+ $returnValue->message = print_r($e->faultstring);
186
+ $returnValue->success = false;
187
+
188
+ return $returnValue;
189
+ }
190
+ }
191
+
192
+ public function ProductsExport($data)
193
+ {
194
+ $url = $this->restServiceUrl().'api/'.Mage::getStoreConfig('qixol/integraion/companykey').'/import/products';
195
+ try
196
+ {
197
+ $result = $this->callQixolPromoRestService('POST', $url, $data);
198
+
199
+ if (empty($result))
200
+ {
201
+ $returnValue->messsage = 'Products - no response';
202
+ $returnValue->success = false;
203
+ }
204
+ else
205
+ {
206
+ $returnValue->message = $result;
207
+ $returnValue->success = true;
208
+ }
209
+
210
+ return $returnValue;
211
+ }
212
+ catch(Exception $e)
213
+ {
214
+ $returnValue->message = print_r($e->faultstring);
215
+ $returnValue->success = false;
216
+
217
+ return $returnValue;
218
+ }
219
+ }
220
+
221
+ public function PromotionsForProducts($data)
222
+ {
223
+ $url = $this->restServiceUrl().'api/'.Mage::getStoreConfig('qixol/integraion/companykey').'/export/promotionsforproducts';
224
+ try
225
+ {
226
+ $result = $this->callQixolPromoRestService('POST', $url, $data);
227
+
228
+ if (empty($result))
229
+ {
230
+ $returnValue->messsage = 'Stores - no response';
231
+ $returnValue->success = false;
232
+ }
233
+ else
234
+ {
235
+ $returnValue->message = $result;
236
+ $returnValue->success = true;
237
+ }
238
+
239
+ return $returnValue;
240
+ }
241
+ catch(Exception $e)
242
+ {
243
+ $returnValue->message = print_r($e->faultstring);
244
+ $returnValue->success = false;
245
+
246
+ return $returnValue;
247
+ }
248
+ }
249
+
250
+ public function PromotionsForBaskets($data)
251
+ {
252
+ $url = $this->restServiceUrl().'api/'.Mage::getStoreConfig('qixol/integraion/companykey').'/export/promotionsforbaskets';
253
+ try
254
+ {
255
+ $result = $this->callQixolPromoRestService('POST', $url, $data);
256
+
257
+ if (empty($result))
258
+ {
259
+ $returnValue->messsage = 'Stores - no response';
260
+ $returnValue->success = false;
261
+ }
262
+ else
263
+ {
264
+ $returnValue->message = $result;
265
+ $returnValue->success = true;
266
+ }
267
+
268
+ return $returnValue;
269
+ }
270
+ catch(Exception $e)
271
+ {
272
+ $returnValue->message = print_r($e->faultstring);
273
+ $returnValue->success = false;
274
+
275
+ return $returnValue;
276
+ }
277
+ }
278
+
279
+ public function CouponCodesImport()
280
+ {
281
+ $returnValue->message = 'NOT IMPLEMENTED';
282
+ $returnValue->success = false;
283
+ return $returnValue;
284
+ }
285
+
286
+ public function BasketValidate($data)
287
+ {
288
+ $url = $this->restServiceUrl().'api/'.Mage::getStoreConfig('qixol/integraion/companykey').'/basket/validate';
289
+ try
290
+ {
291
+ $result = $this->callQixolPromoRestService('POST', $url, $data);
292
+
293
+ if (empty($result))
294
+ {
295
+ $returnValue->messsage = 'Stores - no response';
296
+ $returnValue->success = false;
297
+ }
298
+ else
299
+ {
300
+ $returnValue->message = $result;
301
+ $returnValue->success = true;
302
+ }
303
+
304
+ return $returnValue;
305
+ }
306
+ catch(Exception $e)
307
+ {
308
+ $returnValue->message = print_r($e->faultstring);
309
+ $returnValue->success = false;
310
+
311
+ return $returnValue;
312
+ }
313
+ }
314
+
315
+ public function CouponCodeValidate($couponCode)
316
+ {
317
+ $url = $this->restServiceUrl().'api/'.Mage::getStoreConfig('qixol/integraion/companykey').'/basket/validatecouponcode/'.$couponCode;
318
+ try
319
+ {
320
+ $result = $this->callQixolPromoRestService('POST', $url, $couponCode);
321
+
322
+ if (empty($result))
323
+ {
324
+ $returnValue->messsage = 'Stores - no response';
325
+ $returnValue->success = false;
326
+ }
327
+ else
328
+ {
329
+ $returnValue->message = $result;
330
+ $returnValue->success = true;
331
+ }
332
+
333
+ return $returnValue;
334
+ }
335
+ catch(Exception $e)
336
+ {
337
+ $returnValue->message = print_r($e->faultstring);
338
+ $returnValue->success = false;
339
+
340
+ return $returnValue;
341
+ }
342
+ }
343
+
344
+ public function RetrieveValidatedBasket($basketRef)
345
+ {
346
+ $returnValue->message = 'NOT IMPLEMENTED';
347
+ $returnValue->success = false;
348
+ return $returnValue;
349
+ }
350
+
351
+ public function BasketCheck()
352
+ {
353
+ $returnValue->message = 'NOT IMPLEMENTED';
354
+ $returnValue->success = false;
355
+ return $returnValue;
356
+ }
357
+ }
app/code/community/Qixol/Promo/Model/SOAPPromoService.php ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once ('config.php');
4
+ require_once('PromoService.php');
5
+
6
+ class SOAPPromoService extends PromoService implements iPromoService
7
+ {
8
+
9
+ private function importServiceUrl() {
10
+ $evaluationImportServicesUrl = 'http://evaluation.qixolpromo.com/ImportService.svc';
11
+ $liveImportServicesUrl = 'http://evaluation.qixolpromo.com/ImportService.svc';
12
+
13
+ switch (Mage::getStoreConfig('qixol/integraion/services')) {
14
+ case 'evaluation':
15
+ $importServiceUrl = $evaluationImportServicesUrl;
16
+ break;
17
+ case 'live':
18
+ $importServiceUrl = $liveImportServicesUrl;
19
+ break;
20
+ case 'custom':
21
+ $importServiceUrl = Mage::getStoreConfig('qixol/integraion/importManagerServiceAddress');
22
+ break;
23
+ default:
24
+ $importServiceUrl = $evaluationImportServicesUrl;
25
+ break;
26
+ }
27
+ return $importServiceUrl;
28
+ }
29
+
30
+ private function exportServiceUrl() {
31
+ $evaluationExportServicesUrl = 'http://evaluation.qixolpromo.com/ExportService.svc';
32
+ $liveExportServicesUrl = 'http://evaluation.qixolpromo.com/ExportService.svc';
33
+
34
+ switch (Mage::getStoreConfig('qixol/integraion/services')) {
35
+ case 'evaluation':
36
+ $exportServiceUrl = $evaluationExportServicesUrl;
37
+ break;
38
+ case 'live':
39
+ $exportServiceUrl = $liveExportServicesUrl;
40
+ break;
41
+ case 'custom':
42
+ $exportServiceUrl = Mage::getStoreConfig('qixol/integraion/exportManagerServiceAddress');
43
+ break;
44
+ default:
45
+ $exportServiceUrl = $evaluationExportServicesUrl;
46
+ break;
47
+ }
48
+ return $exportServiceUrl;
49
+ }
50
+
51
+ private function basketServiceUrl() {
52
+
53
+ $evaluationBasketServicesUrl = 'http://evaluation.qixolpromo.com/BasketService.svc';
54
+ $liveBasketServicesUrl = 'http://evaluation.qixolpromo.com/BaskettService.svc';
55
+
56
+ switch (Mage::getStoreConfig('qixol/integraion/services')) {
57
+ case 'evaluation':
58
+ $basketServiceUrl = $evaluationBasketServicesUrl;
59
+ break;
60
+ case 'live':
61
+ $basketServiceUrl = $liveBasketServicesUrl;
62
+ break;
63
+ case 'custom':
64
+ $basketServiceUrl = Mage::getStoreConfig('qixol/integraion/basketManagerServiceAddress');
65
+ break;
66
+ default:
67
+ $basketServiceUrl = $evaluationBasketServicesUrl;
68
+ break;
69
+ }
70
+ return $basketServiceUrl;
71
+ }
72
+
73
+ function CustomerGroupExport($data)
74
+ {
75
+ $soapclient = new soapclient($this->importServiceUrl().'?singleWsdl', array( 'trace' => 1,
76
+ 'location' => $this->importServiceUrl()));
77
+ $types_array = $soapclient->__getTypes();
78
+ $functions_array = $soapclient->__getFunctions();
79
+
80
+ try {
81
+ $result = $soapclient->__soapCall('ImportEntityAttributeValues', array('ImportEntityAttributeValues' => array('xmlToImport' => $data)));
82
+ $returnValue->message = $result->ImportEntityAttributeValuesResult;
83
+ $returnValue->success = true;
84
+ return $returnValue;
85
+ } catch (SoapFault $e) {
86
+ $returnValue->message = $e->faultstring;
87
+ $returnValue->success = false;
88
+ return $returnValue;
89
+ }
90
+ }
91
+
92
+ function ShippingMethodsExport($data)
93
+ {
94
+ $soapclient = new soapclient($this->importServiceUrl().'?singleWsdl', array( 'trace' => 1,
95
+ 'location' => $this->importServiceUrl()));
96
+ $types_array = $soapclient->__getTypes();
97
+ $functions_array = $soapclient->__getFunctions();
98
+ try {
99
+ $result = $soapclient->__soapCall('ImportEntityAttributeValues', array('ImportEntityAttributeValues' => array('xmlToImport' => $data)));
100
+ $returnValue->message = $result->ImportEntityAttributeValuesResult;
101
+ $returnValue->success = true;
102
+ return $returnValue;
103
+ } catch (SoapFault $e) {
104
+ $returnValue->message = $e->faultstring;
105
+ $returnValue->success = false;
106
+ return $returnValue;
107
+ }
108
+ }
109
+
110
+ function CurrenciesExport($data)
111
+ {
112
+ $soapclient = new soapclient($this->importServiceUrl().'?singleWsdl', array( 'trace' => 1,
113
+ 'location' => $this->importServiceUrl()));
114
+ $types_array = $soapclient->__getTypes();
115
+ $functions_array = $soapclient->__getFunctions();
116
+ try {
117
+ $result = $soapclient->__soapCall('ImportEntityAttributeValues', array('ImportEntityAttributeValues' => array('xmlToImport' => $data)));
118
+ $returnValue->message = $result->ImportEntityAttributeValuesResult;
119
+ $returnValue->success = true;
120
+ return $returnValue;
121
+ } catch (SoapFault $e) {
122
+ $returnValue->message = $e->faultstring;
123
+ $returnValue->success = false;
124
+ return $returnValue;
125
+ }
126
+ }
127
+
128
+ function StoresExport($data)
129
+ {
130
+ $soapclient = new soapclient($this->importServiceUrl().'?singleWsdl', array( 'trace' => 1,
131
+ 'location' => $this->importServiceUrl()));
132
+ $types_array = $soapclient->__getTypes();
133
+ $functions_array = $soapclient->__getFunctions();
134
+ try {
135
+ $result = $soapclient->__soapCall('ImportEntityAttributeValues', array('ImportEntityAttributeValues' => array('xmlToImport' => $data)));
136
+ $returnValue->message = $result->ImportEntityAttributeValuesResult;
137
+ $returnValue->success = true;
138
+ return $returnValue;
139
+ } catch (SoapFault $e) {
140
+ $returnValue->message = $e->faultstring;
141
+ $returnValue->success = false;
142
+ return $returnValue;
143
+ }
144
+
145
+ }
146
+
147
+ function ProductsExport($data)
148
+ {
149
+ $soapclient = new soapclient($this->importServiceUrl().'?singleWsdl', array( 'trace' => 1,
150
+ 'location' => $this->importServiceUrl()));
151
+ $types_array = $soapclient->__getTypes();
152
+ $functions_array = $soapclient->__getFunctions();
153
+ try {
154
+ $result = $soapclient->__soapCall('ImportProducts', array('ImportProducts' => array('xmlToImport' => $data)));
155
+ $returnValue->message = $result->ImportProductsResult;
156
+ $returnValue->success = true;
157
+ return $returnValue;
158
+ } catch (SoapFault $e) {
159
+ $returnValue->message = $e->faultstring;
160
+ $returnValue->success = false;
161
+ return $returnValue;
162
+ }
163
+ }
164
+
165
+ public function PromotionsForProducts($data)
166
+ {
167
+ $soapclient = new soapclient($this->exportServiceUrl().'?singleWsdl', array( 'trace' => 1,
168
+ 'location' => $this->exportServiceUrl()));
169
+ try {
170
+ $result = $soapclient->__soapCall('RetrievePromotionsForProducts', array('RetrievePromotionsForProducts' => array('xmlExportRequest' => $data)));
171
+ $returnValue->message = $result->RetrievePromotionsForProductsResult;
172
+ $returnValue->success = true;
173
+ return $returnValue;
174
+ } catch (SoapFault $e) {
175
+ $returnValue->message = $e->faultstring;
176
+ $returnValue->success = false;
177
+ return $returnValue;
178
+ }
179
+ }
180
+
181
+ public function PromotionsForBaskets($data)
182
+ {
183
+ $soapclient = new soapclient($this->exportServiceUrl().'?singleWsdl', array( 'trace' => 1,
184
+ 'location' => $this->exportServiceUrl()));
185
+
186
+ try
187
+ {
188
+ $result = $soapclient->__soapCall('RetrievePromotionsForBaskets', array('RetrievePromotionsForBaskets' => array('xmlExportRequest' => $data)));
189
+ $returnValue->message = $result->RetrievePromotionsForBasketsResult;
190
+ $returnValue->success = true;
191
+ return $returnValue;
192
+ }
193
+ catch (SoapFault $e)
194
+ {
195
+ $returnValue->message = $e->faultstring;
196
+ $returnValue->success = false;
197
+ return $returnValue;
198
+ }
199
+ }
200
+
201
+ public function CouponCodesImport()
202
+ {
203
+ $returnValue->message = 'NOT IMPLEMENTED';
204
+ $returnValue->success = false;
205
+ return $returnValue;
206
+ }
207
+
208
+ public function BasketValidate($data)
209
+ {
210
+ $soapclient = new soapclient($this->basketServiceUrl().'?singleWsdl', array( 'trace' => 1,
211
+ 'location' => $this->basketServiceUrl()));
212
+
213
+ try
214
+ {
215
+ $result = $soapclient->__soapCall('ValidateBasket', array('ValidateBasket' => array('basketXml' => $data)));
216
+ $returnValue->message = $result->ValidateBasketResult;
217
+ $returnValue->success = true;
218
+ return $returnValue;
219
+ } catch (SoapFault $e) {
220
+ $message = $e->faultstring . '\n';
221
+ $message .= "REQUEST:\n" . $soapclient->__getLastRequestHeaders();
222
+ $message .= $soapclient->__getLastRequest() . "\n";
223
+ $message .= "RESPONSE:\n" . $soapclient->__getLastResponseHeaders();
224
+ $message .= $soapclient->__getLastResponse() . "\n";
225
+
226
+ $returnValue->message = $message;
227
+ $returnValue->success = false;
228
+ return $returnValue;
229
+ }
230
+ }
231
+
232
+ public function CouponCodeValidate($couponCode)
233
+ {
234
+ $soapclient_coupon = new soapclient($this->basketServiceUrl().'?singleWsdl', array( 'trace' => 1,
235
+ 'location' => $this->basketServiceUrl()));
236
+
237
+ try
238
+ {
239
+ $soapclient_coupon->__soapCall('ValidateCouponCode', array('ValidateCouponCode' =>
240
+ array('companyKey' =>
241
+ Mage::getStoreConfig('qixol/integraion/companykey'),
242
+ 'couponCode' => $couponCode)));
243
+ $returnValue->message = $result->ValidateCouponCodeResult;
244
+ $returnValue->success = true;
245
+ return $returnValue;
246
+ } catch (SoapFault $e) {
247
+ //$message = $e->faultstring . '\n';
248
+ //$message .= "REQUEST:\n" . $soapclient->__getLastRequestHeaders();
249
+ //$message .= $soapclient->__getLastRequest() . "\n";
250
+ //$message .= "RESPONSE:\n" . $soapclient->__getLastResponseHeaders();
251
+ //$message .= $soapclient->__getLastResponse() . "\n";
252
+
253
+ $returnValue->message = $message;
254
+ $returnValue->success = false;
255
+ return $returnValue;
256
+ }
257
+
258
+ }
259
+
260
+ public function RetrieveValidatedBasket($basketRef)
261
+ {
262
+ $returnValue->message = 'NOT IMPLEMENTED';
263
+ $returnValue->success = false;
264
+ return $returnValue;
265
+ }
266
+
267
+ public function BasketCheck()
268
+ {
269
+ $returnValue->message = 'NOT IMPLEMENTED';
270
+ $returnValue->success = false;
271
+ return $returnValue;
272
+ }
273
+ }
app/code/community/Qixol/Promo/Model/Shippingmap.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Shippingmap extends Mage_Core_Model_Abstract {
3
+
4
+ public function _construct() {
5
+ parent::_construct();
6
+ $this->_init('qixol/shippingmap', "shipping_name");
7
+ }
8
+
9
+ public function getOptionArray(){
10
+ $hlp = Mage::helper('qixol');
11
+ $collections=$this->getCollection();
12
+ $list_return=array();
13
+ foreach ($collections as $item){
14
+ $list_return[]=array(
15
+ 'value' => (string)$item->getShippingName(),
16
+ 'label' => $hlp->__((string)$item->getShippingName())
17
+ );
18
+ }
19
+ return $list_return;
20
+ }
21
+ }
app/code/community/Qixol/Promo/Model/Sinch.php ADDED
@@ -0,0 +1,1594 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //ini_set('memory_limit','256M');
4
+ require_once ('config.php');
5
+ require_once('RESTPromoService.php');
6
+ require_once('SOAPPromoService.php');
7
+
8
+ class Qixol_Promo_Model_Sinch extends Mage_Core_Model_Abstract
9
+ {
10
+ private $process_export_status_table;
11
+ private $process_export_status_id=array();
12
+ private $export_poducts_statistic_table;
13
+ private $export_poducts_statistic_id=array();
14
+ private $export_by = 'MANUAL';
15
+ private $promoService;
16
+
17
+ function __construct()
18
+ {
19
+ $this->process_export_status_table=Mage::getSingleton('core/resource')->getTableName('qixol_process_export_status_table');
20
+ $this->_logFile=LOG_FILE;
21
+ $this->pushLog("constructor");
22
+
23
+ if (Mage::getStoreConfig('qixol/integraion/serviceProtocol') == 'REST') {
24
+ $this->promoService = new RESTPromoService();
25
+ } else {
26
+ $this->promoService = new SOAPPromoService();
27
+ }
28
+ }
29
+
30
+ function pushLog($log){
31
+
32
+ if(trim($log)!=''){
33
+ Mage::log($log, null, $this->_logFile);
34
+ //store in some log table if required
35
+ }
36
+ }
37
+
38
+ function cron_run_export(){//call from cron product export
39
+ $this->pushLog("Start export from cron:".date("Y-m-d H:i:s"));
40
+ $this->export_by='CRON';
41
+ $this->run_export_qixolData();
42
+ $this->pushLog("Finish export from cron".date("Y-m-d H:i:s"));
43
+ }
44
+
45
+ function cron_run_import(){//call from cron product export
46
+ $this->pushLog("Start export from cron:".date("Y-m-d H:i:s"));
47
+ $this->export_by='CRON';
48
+ if (Mage::getStoreConfig('qixol/promo/enabled')>0){
49
+ $this->run_import_promotionsForProducts();
50
+ $this->run_import_promotionsForBaskets();
51
+ }
52
+ $this->pushLog("Finish export from cron".date("Y-m-d H:i:s"));
53
+ }
54
+
55
+ function getDataOfLatestExport(){
56
+ $_status=array();
57
+
58
+ $tmp_data=$this->getExportStatus('customers');
59
+ $customerGroupsStatus = array();
60
+ if ($tmp_data['id'] > 0)
61
+ {
62
+ switch ($tmp_data['message'])
63
+ {
64
+ case 'error':
65
+ $customerGroupsStatus = array('last_message'=>'error',
66
+ 'export_what'=>'Customers',
67
+ 'status_export_message'=>$tmp_data['extended_message'],
68
+ 'exports_start'=>$tmp_data['exports_start'],
69
+ 'is_finished'=>$tmp_data['is_finished']);
70
+ break;
71
+ case 'process':
72
+ $customerGroupsStatus = array('last_message'=>'process',
73
+ 'export_what'=>'Customers',
74
+ 'exports_start'=>$tmp_data['exports_start'],
75
+ 'is_finished'=>$tmp_data['is_finished']);
76
+ break;
77
+ case 'success':
78
+ $customerGroupsStatus = array('last_message'=>'success',
79
+ 'export_what'=>'Customers',
80
+ 'exports_start'=>$tmp_data['exports_start'],
81
+ 'is_finished'=>$tmp_data['is_finished']);
82
+ break;
83
+ }
84
+ }
85
+ else
86
+ {
87
+ $customerGroupsStatus = array('last_message'=>'not started',
88
+ 'export_what'=>'Customers',
89
+ 'exports_start'=>'',
90
+ 'is_finished'=>true);
91
+ }
92
+
93
+ $tmp_data=$this->getExportStatus('delivery');
94
+ $deliveryMethodsStatus = array();
95
+ if ($tmp_data['id'] > 0)
96
+ {
97
+ switch ($tmp_data['message'])
98
+ {
99
+ case 'error':
100
+ $deliveryMethodsStatus = array('last_message'=>'error',
101
+ 'export_what'=>'Delivery',
102
+ 'status_export_message'=>$tmp_data['extended_message'],
103
+ 'exports_start'=>$tmp_data['exports_start'],
104
+ 'is_finished'=>$tmp_data['is_finished']);
105
+ break;
106
+ case 'process':
107
+ $deliveryMethodsStatus = array('last_message'=>'process',
108
+ 'export_what'=>'Delivery',
109
+ 'exports_start'=>$tmp_data['exports_start'],
110
+ 'is_finished'=>$tmp_data['is_finished']);
111
+ break;
112
+ case 'success':
113
+ $deliveryMethodsStatus = array('last_message'=>'success',
114
+ 'export_what'=>'Delivery',
115
+ 'exports_start'=>$tmp_data['exports_start'],
116
+ 'is_finished'=>$tmp_data['is_finished']);
117
+ break;
118
+ }
119
+ }
120
+ else
121
+ {
122
+ $customerGroupsStatus = array('last_message'=>'not started',
123
+ 'export_what'=>'Delivery',
124
+ 'exports_start'=>'',
125
+ 'is_finished'=>true);
126
+ }
127
+
128
+ $tmp_data=$this->getExportStatus('products');
129
+ $productsStatus = array();
130
+ if ($tmp_data['id'] > 0)
131
+ {
132
+ switch ($tmp_data['message'])
133
+ {
134
+ case 'error':
135
+ $productsStatus = array('last_message'=>'error',
136
+ 'export_what'=>'Products',
137
+ 'status_export_message'=>$tmp_data['extended_message'],
138
+ 'exports_start'=>$tmp_data['exports_start'],
139
+ 'is_finished'=>$tmp_data['is_finished']);
140
+ break;
141
+ case 'process':
142
+ $productsStatus = array('last_message'=>'process',
143
+ 'export_what'=>'Products',
144
+ 'exports_start'=>$tmp_data['exports_start'],
145
+ 'is_finished'=>$tmp_data['is_finished']);
146
+ break;
147
+ case 'success':
148
+ $productsStatus = array('last_message'=>'success',
149
+ 'export_what'=>'Products',
150
+ 'exports_start'=>$tmp_data['exports_start'],
151
+ 'is_finished'=>$tmp_data['is_finished']);
152
+ break;
153
+ }
154
+ }
155
+ else
156
+ {
157
+ $customerGroupsStatus = array('last_message'=>'not started',
158
+ 'export_what'=>'Products',
159
+ 'exports_start'=>'',
160
+ 'is_finished'=>true);
161
+ }
162
+
163
+
164
+ $tmp_data=$this->getExportStatus('currency');
165
+ $currencyStatus = array();
166
+ if ($tmp_data['id'] > 0)
167
+ {
168
+ switch ($tmp_data['message'])
169
+ {
170
+ case 'error':
171
+ $currencyStatus = array('last_message'=>'error',
172
+ 'export_what'=>'Currency',
173
+ 'status_export_message'=>$tmp_data['extended_message'],
174
+ 'exports_start'=>$tmp_data['exports_start'],
175
+ 'is_finished'=>$tmp_data['is_finished']);
176
+ break;
177
+ case 'process':
178
+ $currencyStatus = array('last_message'=>'process',
179
+ 'export_what'=>'Currency',
180
+ 'exports_start'=>$tmp_data['exports_start'],
181
+ 'is_finished'=>$tmp_data['is_finished']);
182
+ break;
183
+ case 'success':
184
+ $currencyStatus = array('last_message'=>'success',
185
+ 'export_what'=>'Currency',
186
+ 'exports_start'=>$tmp_data['exports_start'],
187
+ 'is_finished'=>$tmp_data['is_finished']);
188
+ break;
189
+ }
190
+ }
191
+ else
192
+ {
193
+ $customerGroupsStatus = array('last_message'=>'not started',
194
+ 'export_what'=>'Currency',
195
+ 'exports_start'=>'',
196
+ 'is_finished'=>true);
197
+ }
198
+
199
+
200
+ $tmp_data=$this->getExportStatus('store');
201
+ $storeStatus = array();
202
+ if ($tmp_data['id'] > 0)
203
+ {
204
+ switch ($tmp_data['message'])
205
+ {
206
+ case 'error':
207
+ $storeStatus = array('last_message'=>'error',
208
+ 'export_what'=>'Store',
209
+ 'status_export_message'=>$tmp_data['extended_message'],
210
+ 'exports_start'=>$tmp_data['exports_start'],
211
+ 'is_finished'=>$tmp_data['is_finished']);
212
+ break;
213
+ case 'process':
214
+ $storeStatus = array('last_message'=>'process',
215
+ 'export_what'=>'Store',
216
+ 'exports_start'=>$tmp_data['exports_start'],
217
+ 'is_finished'=>$tmp_data['is_finished']);
218
+ break;
219
+ case 'success':
220
+ $storeStatus = array('last_message'=>'success',
221
+ 'export_what'=>'Store',
222
+ 'exports_start'=>$tmp_data['exports_start'],
223
+ 'is_finished'=>$tmp_data['is_finished']);
224
+ break;
225
+ }
226
+ }
227
+ else
228
+ {
229
+ $customerGroupsStatus = array('last_message'=>'not started',
230
+ 'export_what'=>'Store',
231
+ 'exports_start'=>'',
232
+ 'is_finished'=>true);
233
+ }
234
+
235
+
236
+ $_status = array($productsStatus, $customerGroupsStatus, $storeStatus, $currencyStatus, $deliveryMethodsStatus);
237
+
238
+ return $_status;
239
+ }
240
+
241
+ function getDataOfLatestImport()
242
+ {
243
+ $_status=array();
244
+
245
+ $tmp_data = $this->getExportStatus('promotions');
246
+ $promotionsStatus = array();
247
+ if ($tmp_data['id'] > 0)
248
+ {
249
+ switch ($tmp_data['message'])
250
+ {
251
+ case 'error':
252
+ $promotionsStatus = array('last_message'=>'error',
253
+ 'import_what'=>'Promotions',
254
+ 'status_import_message'=>$tmp_data['extended_message'],
255
+ 'imports_start'=>$tmp_data['exports_start'],
256
+ 'is_finished'=>$tmp_data['is_finished']);
257
+ break;
258
+ case 'process':
259
+ $promotionsStatus = array('last_message'=>'process',
260
+ 'import_what'=>'Promotions',
261
+ 'imports_start'=>$tmp_data['exports_start'],
262
+ 'is_finished'=>$tmp_data['is_finished']);
263
+ break;
264
+ case 'success':
265
+ $promotionsStatus = array('last_message'=>'success',
266
+ 'import_what'=>'Promotions',
267
+ 'imports_start'=>$tmp_data['exports_start'],
268
+ 'is_finished'=>$tmp_data['is_finished']);
269
+ break;
270
+ }
271
+ }
272
+ else
273
+ {
274
+ $promotionsStatus = array('last_message'=>'not started',
275
+ 'import_what'=>'Promotions',
276
+ 'imports_start'=>'',
277
+ 'is_finished'=>true);
278
+ }
279
+
280
+ $tmp_data = $this->getExportStatus('basketpromotions');
281
+ $basketPromotionsStatus = array();
282
+ if ($tmp_data['id'] > 0)
283
+ {
284
+ switch ($tmp_data['message'])
285
+ {
286
+ case 'error':
287
+ $basketPromotionsStatus = array('last_message'=>'error',
288
+ 'import_what'=>'Basket Promotions',
289
+ 'status_import_message'=>$tmp_data['extended_message'],
290
+ 'imports_start'=>$tmp_data['exports_start'],
291
+ 'is_finished'=>$tmp_data['is_finished']);
292
+ break;
293
+ case 'process':
294
+ $basketPromotionsStatus = array('last_message'=>'process',
295
+ 'import_what'=>'Basket Promotions',
296
+ 'imports_start'=>$tmp_data['exports_start'],
297
+ 'is_finished'=>$tmp_data['is_finished']);
298
+ break;
299
+ case 'success':
300
+ $basketPromotionsStatus = array('last_message'=>'success',
301
+ 'import_what'=>'Basket Promotions',
302
+ 'imports_start'=>$tmp_data['exports_start'],
303
+ 'is_finished'=>$tmp_data['is_finished']);
304
+ break;
305
+ }
306
+ }
307
+ else
308
+ {
309
+ $basketPromotionsStatus = array('last_message'=>'not started',
310
+ 'import_what'=>'Basket Promotions',
311
+ 'imports_start'=>'',
312
+ 'is_finished'=>true);
313
+ }
314
+
315
+
316
+ $_status = array($promotionsStatus, $basketPromotionsStatus);
317
+
318
+ return $_status;
319
+ }
320
+
321
+ function run_export(){
322
+ $this->run_export_qixolData();
323
+ echo 'done';
324
+ }
325
+
326
+ function run_import(){
327
+ if (Mage::getStoreConfig('qixol/promo/enabled') == 0){
328
+ return;
329
+ }
330
+ $this->run_import_promotionsForProducts();
331
+ $this->run_import_promotionsForBaskets();
332
+ echo 'done';
333
+ }
334
+
335
+ function run_processOrder($cart){
336
+ global $_SESSION;
337
+ return $this->run_ImportCart($cart,true);// set true to confirm cart(process cart)
338
+ }
339
+
340
+ function run_ImportCart($cart,$set_confirmed=false){
341
+ global $_SESSION;
342
+ $_SESSION['inside_request']=time();
343
+
344
+ $item_id=0;
345
+ $data_products='';
346
+ $coupons_applyed='';
347
+ $customer_groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
348
+ if ($customer_groupId > 0)
349
+ {
350
+ $customergroup = Mage::getModel('customer/group')->load($customer_groupId);
351
+ $customergroupName=$customergroup->getCode($customergroup);
352
+ }
353
+ else
354
+ {
355
+ $customergroupName='NOT LOGGED IN';
356
+ }
357
+
358
+ foreach ($cart->getAllVisibleItems() as $item)
359
+ {
360
+ $item_id++;
361
+ //getProduct()->getIsVirtual()
362
+ $data_products.='<item id="'.$item->getId()/*$item_id*/.'" ';
363
+ if ($item->getProductType()=='configurable'){
364
+ //$item->getOptionByCode('simple_product')->getValue();
365
+ $product_search_tmp = Mage::getModel('catalog/product')->load($item->getProductId());
366
+ $data_products.='productcode="'.$product_search_tmp->getSku().'" variantcode="'.$item->getSku().'"';
367
+ //print_r($item->_getData('product'));
368
+ }/*else if ($item->getProductType()=='grouped'){
369
+ //do not apply now
370
+ }else if ($item->getProductType()=='bundle'){
371
+ //do not apply now
372
+ }*/else { //simple
373
+ $data_products.=' productcode="'.$item->getSku().'" variantcode="" ';
374
+ }
375
+ $data_products.=' barcode="" quantity="'.$item->getQty().'" price="'.$item->getPrice().'" ></item>';
376
+ //print_r(Zend_Debug::dump($item->debug()));
377
+
378
+ //print_r(Zend_Debug::dump($item->debug()));
379
+ //echo $data_products."<br>\n";
380
+ }
381
+
382
+ //delivery methid if exists and delivery price....
383
+ $shipping_method_exists=$cart->getShippingAddress()->getShippingMethod();
384
+ $shipping_price_exists=0;
385
+ $product_to_enter_in_cart=array();
386
+ if ($shipping_method_exists!='')
387
+ {
388
+ $shipping_price_exists=$cart->getShippingAddress()->getShippingAmount();
389
+ if ($shipping_price_exists==0)
390
+ {//somethimes returns zero
391
+ // sometimes magento returning shipping method but not returning correct price
392
+ //searching price for method
393
+ $address = $cart->getShippingAddress();
394
+ $rates = $address->collectShippingRates()
395
+ ->getGroupedAllShippingRates();
396
+ foreach ($rates as $carrier)
397
+ {
398
+ foreach ($carrier as $rate)
399
+ {
400
+ if ($rate->getCode()==$shipping_method_exists)
401
+ {
402
+ $shipping_price_exists=$rate->getPrice();
403
+ break;
404
+ }
405
+ }
406
+ }
407
+ }
408
+ }
409
+
410
+
411
+ if (isset($_SESSION['qixol_quoted_items']['coupons'])&&count($_SESSION['qixol_quoted_items']['coupons'])){
412
+ $coupons_applyed.='<coupons>';
413
+ foreach ($_SESSION['qixol_quoted_items']['coupons'] as $entered_coupons=>$tmp_val){
414
+ if ((bool)$tmp_val['issued']==false)
415
+ $coupons_applyed.='<coupon code="'.trim($entered_coupons).'"/>';
416
+ }
417
+ $coupons_applyed.='</coupons>';
418
+ }
419
+
420
+ //get mapping
421
+ // TODO: this conversion from data to array happens in lots of places - move it to the model?
422
+ $list_customer_map_names=Mage::getModel('qixol/Customergrouspmap')->getCollection();
423
+ $list_customer_integration_codes=array();
424
+ foreach ($list_customer_map_names as $list_map)
425
+ {
426
+ $list_customer_integration_codes[$list_map->getCustomerGroupName()]=$list_map->getIntegrationCode();
427
+ }
428
+ // end mapping array
429
+
430
+ if (isset($list_customer_integration_codes[$customergroupName]))
431
+ {
432
+ $customergroupName=$list_customer_integration_codes[$customergroupName];
433
+ }
434
+
435
+ //get mapping
436
+ $list_store_integration_codes=Mage::getModel('qixol/Storesmap')->getCollection();
437
+
438
+ $list_store_integration_codes_exists=array();
439
+
440
+ foreach ($list_store_integration_codes as $list_map)
441
+ {
442
+ $list_store_integration_codes_exists[$list_map->getWebsite()][$list_map->getStoreGroup()][$list_map->getStoreName()]=$list_map->getIntegrationCode();
443
+ }
444
+ // end mapping array
445
+
446
+ //get mapping
447
+ $list_shipping_map_names=Mage::getModel('qixol/Shippingmap')->getCollection();
448
+
449
+ $list_shipping_integration_codes=array();
450
+
451
+ foreach ($list_shipping_map_names as $list_map)
452
+ {
453
+ $list_shipping_integration_codes[$list_map->getCarrier()][$list_map->getStoreGroup()][$list_map->getShippingName()]=$list_map->getIntegrationCode();
454
+ }
455
+ // end mapping array
456
+
457
+ $store_integration_code = $list_store_integration_codes_exists[Mage::app()->getStore()->getWebsite()->getName()][Mage::app()->getStore()->getGroup()->getName()][Mage::app()->getStore()->getName()];
458
+
459
+ if ($data_products!='')
460
+ {
461
+ //echo "call promotions";
462
+ $basketTotal = $cart->getSubtotal();
463
+ if ($shipping_price_exists > 0)
464
+ {
465
+ $basketTotal += (float)$shipping_price_exists;
466
+ }
467
+ $basket = '<basket id="';
468
+ //$basket .= /*Mage::getSingleton("core/session")->getEncryptedSessionId();*/
469
+ $basket .= $_SESSION['qixol_quoted_items']['cart_session_id'];
470
+ $basket .= '" companykey="';
471
+ $basket .= Mage::getStoreConfig('qixol/integraion/companykey');
472
+ $basket .= '" baskettotal="';
473
+ $basket .= $basketTotal;
474
+ $basket .= '" basketdate="';
475
+ $basket .= date("Y-m-d\TH:i:s",strtotime("+ 1 DAY"));
476
+ $basket .= '" channel="';
477
+ $basket .= Mage::app()->getStore()->getWebsite()->getName();
478
+ $basket .= '" storegroup="';
479
+ $basket .= Mage::app()->getStore()->getGroup()->getName();
480
+ $basket .= '" store="';
481
+ if (!empty($store_integration_code))
482
+ {
483
+ $basket .= $store_integration_code;
484
+ }
485
+ else
486
+ {
487
+ $basket .= Mage::app()->getStore()->getName();
488
+ }
489
+ $basket .= '"';
490
+
491
+ // /*Mage::getStoreConfig('qixol/syhchronized/channel')*/.
492
+ if ($shipping_method_exists != '')
493
+ {
494
+ $basket .= ' deliverymethod="';
495
+ $basket .= $shipping_method_exists;
496
+ $basket .= '"';
497
+ }
498
+
499
+ if ($shipping_price_exists > 0)
500
+ {
501
+ $basket .= ' deliveryprice="';
502
+ $basket .= $shipping_price_exists;
503
+ $basket .= '"';
504
+ }
505
+
506
+ $basket .= ' customergroup="';
507
+ $basket .= $customergroupName;
508
+ $basket .= '"';
509
+
510
+ $basket .= ' currencycode="';
511
+ $basket .= Mage::app()->getStore()->getCurrentCurrencyCode();
512
+ $basket .= '"';
513
+
514
+ if ($set_confirmed)
515
+ {
516
+ $basket .= ' confirmed="true"';
517
+ }
518
+
519
+ $basket .= '>';
520
+
521
+ $basket .= $coupons_applyed;
522
+
523
+ $basket .= '<items>';
524
+ $basket .= $data_products;
525
+ $basket .= '</items></basket>';
526
+
527
+ error_log($basket);
528
+ $result = $this->promoService->BasketValidate($basket);
529
+ error_log($result->message);
530
+ if ($result->success)
531
+ {
532
+ $xml_shopping_cart_validated = $result->message;
533
+ $new_cart_structure=array();
534
+ if (strlen($xml_shopping_cart_validated)>10)
535
+ {
536
+ $xml_object = simplexml_load_string($xml_shopping_cart_validated);
537
+
538
+ $attributes_cart=$xml_object->attributes();
539
+ $new_cart_structure['cart_data']=array();
540
+ $new_cart_structure['cart_data']['id']=(isset($attributes_cart['id'])?(string)$attributes_cart['id']:0);
541
+ $new_cart_structure['cart_data']['manualdiscount']=(isset($attributes_cart['manualdiscount'])?(float)$attributes_cart['manualdiscount']:0);
542
+ $new_cart_structure['cart_data']['basketdiscount']=(isset($attributes_cart['basketdiscount'])?(float)$attributes_cart['basketdiscount']:0);
543
+ $new_cart_structure['cart_data']['linestotaldiscount']=(isset($attributes_cart['linestotaldiscount'])?(float)$attributes_cart['linestotaldiscount']:0);
544
+ $new_cart_structure['cart_data']['totaldiscount']=(isset($attributes_cart['totaldiscount'])?(float)$attributes_cart['totaldiscount']:0);
545
+ $new_cart_structure['cart_data']['baskettotal']=(isset($attributes_cart['baskettotal'])?(float)$attributes_cart['baskettotal']:0);
546
+ $new_cart_structure['cart_data']['originalbaskettotal']=(isset($attributes_cart['originalbaskettotal'])?(float)$attributes_cart['originalbaskettotal']:0);
547
+ $new_cart_structure['cart_data']['deliverymanualdiscount']=(isset($attributes_cart['deliverymanualdiscount'])?(float)$attributes_cart['deliverymanualdiscount']:0);
548
+ $new_cart_structure['cart_data']['deliveryprice']=(isset($attributes_cart['deliveryprice'])?(float)$attributes_cart['deliveryprice']:0);
549
+ $new_cart_structure['cart_data']['deliverypromotiondiscount']=(isset($attributes_cart['deliverypromotiondiscount'])?(float)$attributes_cart['deliverypromotiondiscount']:0);
550
+ $new_cart_structure['cart_data']['deliverytotaldiscount']=(isset($attributes_cart['deliverytotaldiscount'])?(float)$attributes_cart['deliverytotaldiscount']:0);
551
+ $new_cart_structure['cart_data']['deliveryoriginalprice']=(isset($attributes_cart['deliveryoriginalprice'])?(float)$attributes_cart['deliveryoriginalprice']:0);
552
+
553
+
554
+ if ($xml_object instanceof SimpleXMLElement)
555
+ {
556
+ foreach ($xml_object as $xml_root_key=>$xml_object_sub)
557
+ {
558
+ if ($xml_root_key=='items')
559
+ {
560
+ $new_cart_structure['items']=array();
561
+ foreach ($xml_object_sub as $item_key=>$xml_items_sub)
562
+ {
563
+ $item_attributes=$xml_items_sub->attributes();
564
+
565
+ $new_cart_structure['items'][(int)$item_attributes['id']]=array();
566
+
567
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['quoteid']=(int)$item_attributes['id'];
568
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['productcode']=(isset($item_attributes['productcode'])?(string)$item_attributes['productcode']:'');
569
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['variantcode']=(isset($item_attributes['variantcode'])?(string)$item_attributes['variantcode']:'');
570
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['price']=(isset($item_attributes['price'])?(float)$item_attributes['price']:0.0);
571
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['manualdiscount']=(isset($item_attributes['manualdiscount'])?(float)$item_attributes['manualdiscount']:0);
572
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['quantity']=(isset($item_attributes['quantity'])?(float)$item_attributes['quantity']:0);
573
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['linepromotiondiscount']=(isset($item_attributes['linepromotiondiscount'])?(float)$item_attributes['linepromotiondiscount']:0);
574
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['totaldiscount']=(isset($item_attributes['totaldiscount'])?(float)$item_attributes['totaldiscount']:0);
575
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['originalprice']=(isset($item_attributes['originalprice'])?(float)$item_attributes['originalprice']:0);
576
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['originalquantity']=(isset($item_attributes['originalquantity'])?(float)$item_attributes['originalquantity']:0);
577
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['originalamount']=(isset($item_attributes['originalamount'])?(float)$item_attributes['originalamount']:0);
578
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['appliedpromotioncount']=(isset($item_attributes['appliedpromotioncount'])?(float)$item_attributes['appliedpromotioncount']:0);
579
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['isdelivery']=(isset($item_attributes['isdelivery'])&&strtolower((string)$item_attributes['isdelivery'])=='true'?true:false);
580
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['totalissuedpoints']=(isset($item_attributes['totalissuedpoints'])?(int)$item_attributes['totalissuedpoints']:0);
581
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['splitfromlineid']=(isset($item_attributes['splitfromlineid'])?(int)$item_attributes['splitfromlineid']:0);
582
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['alwaysexcluded']=(isset($item_attributes['alwaysexcluded'])?(int)$item_attributes['alwaysexcluded']:0);
583
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['generated']=(isset($item_attributes['generated'])&&strtolower($item_attributes['generated'])=='true'?(true):false);
584
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['appliedpromotioncount']=(isset($item_attributes['appliedpromotioncount'])?(float)$item_attributes['appliedpromotioncount']:0);
585
+ $new_cart_structure['items'][(int)$item_attributes['id']]['description']=(isset($xml_items_sub->description)?(string)$xml_items_sub->description:'');
586
+ $new_cart_structure['items'][(int)$item_attributes['id']]['data']['lineamount']=(isset($item_attributes['lineamount'])?(float)$item_attributes['lineamount']:0);
587
+
588
+ //get cart item by cart item iD returned from validation
589
+
590
+ $item_not_found=true;
591
+ foreach ($cart->getAllVisibleItems() as $item)
592
+ {
593
+ if ($item->getId()==(int)$item_attributes['id'])
594
+ {
595
+ $item_not_found=false;
596
+ $cart_item=$item;
597
+ unset($product_search_tmp_sku);
598
+ if ($cart_item->getProductType()=='configurable')
599
+ {
600
+ $product_search_tmp = Mage::getModel('catalog/product')->load($cart_item->getProductId());
601
+ $product_search_tmp_sku=$product_search_tmp->getSku();
602
+ }
603
+ $new_cart_structure['items'][(int)$item_attributes['id']]['updated_qty']=false;
604
+ $new_cart_structure['items'][(int)$item_attributes['id']]['updated_price']=false;
605
+ $product_updated=false;
606
+ //echo "/".$cart_item->getProductType()."||".(string)$item_attributes['productcode']."==".$product_search_tmp_sku."+".(string)$item_attributes['variantcode']."==".$cart_item->getSku()."||";
607
+ if ((!$cart_item->isDeleted() && !$cart_item->getParentItemId()/*check is visible*/)&&($cart_item->getProductType()=='configurable'&&(string)$item_attributes['productcode']==$product_search_tmp_sku&&(string)$item_attributes['variantcode']==$cart_item->getSku())
608
+ || ((string)$item_attributes['variantcode']==''&&(string)$item_attributes['productcode']==$cart_item->getSku()))
609
+ {
610
+ if ($item_attributes['quantity']!=$cart_item->getQty())
611
+ {
612
+ $new_cart_structure['items'][(int)$item_attributes['id']]['updated_qty']=true;
613
+ /* $cart_item->setQty($item_attributes['quantity']);
614
+ $product_updated=true;
615
+ */
616
+ }
617
+ if ((float)$item_attributes['lineamount']!=($cart_item->getPrice()*$cart_item->getQty()))
618
+ {
619
+ /* echo "discount:".((float)$item_attributes['lineamount']/(float)$item_attributes['quantity'])."\n<br>\n";
620
+ $cart_item->setCustomPrice((float)$item_attributes['lineamount']/(float)$item_attributes['quantity']);
621
+ $cart_item->setOriginalCustomPrice((float)$item_attributes['lineamount']/(float)$item_attributes['quantity']);
622
+ $cart_item->getProduct()->setIsSuperMode(true);*/
623
+ $new_cart_structure['items'][(int)$item_attributes['id']]['updated_price']=true;
624
+ //$product_updated=true;
625
+ }
626
+
627
+ /*if ($product_updated){
628
+ $update_cart=true;
629
+ $cart_item->save();
630
+ }
631
+ echo $cart_item->getProductId().",,,,";*/
632
+
633
+ }
634
+ else
635
+ {
636
+ //echo "different<br>";
637
+ if ((int)Mage::getStoreConfig('qixol/advanced/separateitem')>0)
638
+ {
639
+ $new_cart_structure['items'][(int)$item_attributes['id']]['new']=true;
640
+ }
641
+ else
642
+ {
643
+ $new_cart_structure['items'][(int)$item_attributes['id']]['updated_qty']=true;
644
+ }
645
+ //$product_to_enter_in_cart[]=$item_attributes;
646
+ }
647
+ }
648
+ }
649
+ $is_splitted_line=false;
650
+ if ($item_not_found)
651
+ {
652
+ if (!isset($item_attributes['splitfromlineid'])||(int)$item_attributes['splitfromlineid']==0)
653
+ {
654
+ //$product_to_enter_in_cart[]=$item_attributes;
655
+ if ((int)Mage::getStoreConfig('qixol/advanced/separateitem')>0)
656
+ {
657
+ $new_cart_structure['items'][(int)$item_attributes['id']]['new']=true;
658
+ }
659
+ else
660
+ {
661
+ $check_exists_in_cart=false;
662
+ foreach ($new_cart_structure['items'] as $current_item_cart_position => $cart_item_to_check)
663
+ {
664
+ if ($current_item_cart_position == (int)$item_attributes['id'])
665
+ {
666
+ continue;
667
+ }
668
+
669
+ if ($cart_item_to_check['data']['productcode']==(string)$item_attributes['productcode']&&$cart_item_to_check['data']['variantcode']==(string)$item_attributes['variantcode'])
670
+ {
671
+ $new_cart_structure['items'][$current_item_cart_position]['updated_qty']=true;
672
+ $new_cart_structure['items'][$current_item_cart_position]['free_added']=(isset($item_attributes['quantity'])?(float)$item_attributes['quantity']:0);
673
+ //$new_cart_structure['items'][$current_item_cart_position]['updated_price']=true;
674
+ //$new_cart_structure['items'][$current_item_cart_position]['data']['price']+=(isset($item_attributes['price'])?(float)$item_attributes['price']:0.0);
675
+ $new_cart_structure['items'][$current_item_cart_position]['data']['quantity']+=(isset($item_attributes['quantity'])?(float)$item_attributes['quantity']:0);
676
+ //$new_cart_structure['items'][$current_item_cart_position]['data']['originalamount']+=(isset($item_attributes['originalamount'])?(float)$item_attributes['originalamount']:0.0);
677
+ //$new_cart_structure['items'][$current_item_cart_position]['data']['totaldiscount']=(isset($item_attributes['originalamount'])?(float)$item_attributes['originalamount']:0.0);
678
+ $check_exists_in_cart=true;
679
+ }
680
+ }
681
+ if (!$check_exists_in_cart)
682
+ {
683
+ $new_cart_structure['items'][(int)$item_attributes['id']]['new']=true;
684
+ if ($new_cart_structure['items'][(int)$item_attributes['id']]['data']['lineamount']==0)
685
+ {
686
+ $new_cart_structure['items'][$current_item_cart_position]['free_added']=(isset($item_attributes['quantity'])?(float)$item_attributes['quantity']:0);
687
+ }
688
+ }
689
+
690
+ }
691
+ }
692
+ elseif((int)$item_attributes['splitfromlineid']>0)
693
+ {
694
+ //$new_cart_structure['items'][(int)$item_attributes['splitfromlineid']]['data']['quantity']+=(isset($item_attributes['quantity'])?(float)$item_attributes['quantity']:0);
695
+ //remove updated quantity for splitted
696
+ $new_cart_structure['items'][(int)$item_attributes['splitfromlineid']]['updated_qty']=0;
697
+ //for splitted there is possible different discount, should be recalcualted in main produc tdiscount
698
+ $new_cart_structure['items'][(int)$item_attributes['splitfromlineid']]['data']['totaldiscount']+=(float)$item_attributes['totaldiscount'];
699
+ $calcualted_discount=$new_cart_structure['items'][(int)$item_attributes['splitfromlineid']]['data']['totaldiscount']/$new_cart_structure['items'][(int)$item_attributes['splitfromlineid']]['data']['originalquantity'];
700
+ $new_cart_structure['items'][(int)$item_attributes['splitfromlineid']]['data']['price']=$new_cart_structure['items'][(int)$item_attributes['splitfromlineid']]['data']['originalprice']-$calcualted_discount;
701
+ $new_cart_structure['items'][(int)$item_attributes['splitfromlineid']]['data']['lineamount']=($new_cart_structure['items'][(int)$item_attributes['splitfromlineid']]['data']['price']*$new_cart_structure['items'][(int)$item_attributes['splitfromlineid']]['data']['originalquantity']);
702
+ $is_splitted_line=true;
703
+ }
704
+ //echo "new_item";
705
+ }
706
+ foreach ($xml_items_sub as $item_tag_key=>$xml_item_sub)
707
+ {
708
+ if($item_tag_key=='promotions')
709
+ {
710
+ $new_cart_structure['items'][(int)$item_attributes['id']]['promotions']=array();
711
+ foreach ($xml_item_sub as $promotion_id=>$promotion)
712
+ {
713
+ $promotion_attributes=$promotion->attributes();
714
+ $new_cart_structure['items'][(int)$item_attributes['id']]['promotions'][(int)$promotion_attributes['id']]=array();
715
+ //print_r($promotion_attributes);
716
+ $new_cart_structure['items'][(int)$item_attributes['id']]['promotions'][(int)$promotion_attributes['id']]['id']=(int)$promotion_attributes['id'];
717
+
718
+ //$new_cart_structure['items'][(int)$item_attributes['id']]['promotions'][(int)$promotion_attributes['id']]['id']=(isset($promotion_attributes['discountamount'])?(float)$promotion_attributes['discountamount']:0);
719
+ $new_cart_structure['items'][(int)$item_attributes['id']]['promotions'][(int)$promotion_attributes['id']]['instance']=(isset($promotion_attributes['instance'])?(int)$promotion_attributes['instance']:0);
720
+ $new_cart_structure['items'][(int)$item_attributes['id']]['promotions'][(int)$promotion_attributes['id']]['basketlevel']=(isset($promotion_attributes['basketlevel'])&&strtolower($promotion_attributes['basketlevel'])=='true'?(true):false);
721
+ $new_cart_structure['items'][(int)$item_attributes['id']]['promotions'][(int)$promotion_attributes['id']]['discountamount']=(isset($promotion_attributes['discountamount'])?(float)$promotion_attributes['discountamount']:0);
722
+ if ($is_splitted_line)
723
+ { //check is promotion exists in main linea
724
+ if (!isset($new_cart_structure['items'][(int)$item_attributes['splitfromlineid']]['promotions'][(int)$promotion_attributes['id']]))
725
+ {
726
+ $new_cart_structure['items'][(int)$item_attributes['splitfromlineid']]['promotions'][(int)$promotion_attributes['id']]=$new_cart_structure['items'][(int)$item_attributes['id']]['promotions'][(int)$promotion_attributes['id']];
727
+ }
728
+ }
729
+ //the text and promotion data will be parsed from summary
730
+ /*if ((bool)$promotion_attributes['basketlevel']!=true){
731
+ $promotion_data=Mage::getModel('qixol/promotions')->load((int)$promotion_attributes['id']);
732
+ //print_r($promotion_data->getPromotionType());
733
+ //print_r($promotion_data->getPromotionText());
734
+ }*/
735
+ }
736
+
737
+ }
738
+ }
739
+ }
740
+ }
741
+ elseif($xml_root_key=='coupons')
742
+ {
743
+ $new_cart_structure['coupons']=array();
744
+ //print_r($xml_object_sub);
745
+ foreach ($xml_object_sub as $item_key=>$xml_items_sub)
746
+ {
747
+ if ($item_key=='coupon')
748
+ {
749
+ $coupon_attributes=$xml_items_sub->attributes();
750
+ if (!(strtolower((string)$coupon_attributes['issued'])=='true'))
751
+ {
752
+ if(isset($coupon_attributes['code'])&&(string)$coupon_attributes['code']!='')
753
+ {
754
+ $new_cart_structure['coupons'][(string)$coupon_attributes['code']]['issued']=false;
755
+ $new_cart_structure['coupons'][(string)$coupon_attributes['code']]['code']=(string)$coupon_attributes['code'];
756
+ $new_cart_structure['coupons'][(string)$coupon_attributes['code']]['description']=(isset($xml_items_sub->couponname)&&(string)$xml_items_sub->couponname!=''?(string)$xml_items_sub->couponname:(string)$coupon_attributes['code']);
757
+ }
758
+ else
759
+ {
760
+ unset($_SESSION['qixol_quoted_items']['coupons'][(string)$coupon_attributes['code']]);
761
+ }
762
+ }
763
+ else
764
+ {
765
+ //!!!!!!!!!!!!!!! get valid to for coupon
766
+ $validtill='0000-00-00 00:00:00';
767
+
768
+ $result = $this->promoService->CouponCodeValidate((string)$coupon_attributes['code']);
769
+ if ($result->success)
770
+ {
771
+ $update_item=false;
772
+ $xml_coupon_code_validated = $result->message;
773
+ if (strlen($xml_coupon_code_validated)>10)
774
+ {
775
+ $xml_coupon_object = simplexml_load_string($xml_coupon_code_validated);
776
+ foreach ($xml_coupon_object as $xml_coupon_object_root_key=>$xml_coupon_object_object_sub)
777
+ {
778
+ if ($xml_coupon_object_root_key=='coupon')
779
+ {
780
+ foreach ($xml_coupon_object_object_sub as $xml_coupon_object_coupon_key=>$xml_coupon_object_object_coupon)
781
+ {
782
+ if ($xml_coupon_object_coupon_key=='codes')
783
+ {
784
+ foreach ($xml_coupon_object_object_coupon as $xml_coupon_object_object_coupon_obj)
785
+ {
786
+ $xml_coupon_object_object_coupon_attributes=$xml_coupon_object_object_coupon_obj->attributes();
787
+ $validtill=date("Y-m-d H:i:s",strtotime((string)$xml_coupon_object_object_coupon_attributes['validto']));
788
+ }
789
+ }
790
+ }
791
+ }
792
+ }
793
+ }
794
+ }
795
+ //!!!!!!!!!!!!!!! end valid to for coupon
796
+ $new_cart_structure['coupons'][(string)$coupon_attributes['code']]['description']=(string)$xml_items_sub->couponname;//(string)$coupon_attributes['reportingcode']
797
+ $new_cart_structure['coupons'][(string)$coupon_attributes['code']]['validtill']=($validtill=='1970-01-01 00:00:00'?"0000-00-00 00:00:00":$validtill);//(string)$coupon_attributes['code']
798
+ $new_cart_structure['coupons'][(string)$coupon_attributes['code']]['issued']=true;
799
+
800
+ }
801
+ }
802
+ }
803
+ //parce in future
804
+ }
805
+ elseif($xml_root_key=='summary')
806
+ {
807
+ $new_cart_structure['summary']=array();
808
+ foreach ($xml_object_sub as $item_key=>$xml_items_sub)
809
+ {
810
+ if ($item_key=='promotions')
811
+ {
812
+ foreach ($xml_items_sub as $item_1_key=>$xml_item_promotion)
813
+ {
814
+
815
+ $promotion_attributes=$xml_item_promotion->attributes();
816
+ $new_cart_structure['summary'][(int)$promotion_attributes['id']]['data']['type']=(string)$promotion_attributes['type'];
817
+ $new_cart_structure['summary'][(int)$promotion_attributes['id']]['data']['display']=(string)$promotion_attributes['display'];
818
+ $new_cart_structure['summary'][(int)$promotion_attributes['id']]['data']['display_text']=(isset($xml_item_promotion->displaytext)?(string)$xml_item_promotion->displaytext:'');
819
+ $new_cart_structure['summary'][(int)$promotion_attributes['id']]['data']['discountamount']=(isset($promotion_attributes['discountamount'])?(float)$promotion_attributes['discountamount']:0);
820
+ $new_cart_structure['summary'][(int)$promotion_attributes['id']]['data']['basketlevel']=(isset($promotion_attributes['basketlevel'])&&strtolower($promotion_attributes['basketlevel'])=='true'?(true):false);
821
+ $new_cart_structure['summary'][(int)$promotion_attributes['id']]['data']['deliverylevel']=(isset($promotion_attributes['deliverylevel'])&&strtolower($promotion_attributes['deliverylevel'])=='true'?(true):false);
822
+ $new_cart_structure['summary'][(int)$promotion_attributes['id']]['data']['issuedpoints']=(isset($promotion_attributes['issuedpoints'])?((int)$promotion_attributes['issuedpoints']):0);
823
+ $new_cart_structure['summary'][(int)$promotion_attributes['id']]['data']['issuedcoupon']=(isset($promotion_attributes['issuedcoupon'])&&strtolower($promotion_attributes['issuedcoupon'])=='true'?(true):false);
824
+ $new_cart_structure['summary'][(int)$promotion_attributes['id']]['data']['unpublished']=(isset($promotion_attributes['unpublished'])&&strtolower($promotion_attributes['unpublished'])=='true'?(true):false);
825
+ $new_cart_structure['summary'][(int)$promotion_attributes['id']]['data']['issuedproduct']=(isset($promotion_attributes['issuedproduct'])&&strtolower($promotion_attributes['issuedproduct'])=='true'?(true):false);
826
+ $new_cart_structure['summary'][(int)$promotion_attributes['id']]['data']['description']=(isset($xml_item_promotion->description)?(string)$xml_item_promotion->description:'');
827
+ $new_cart_structure['summary'][(int)$promotion_attributes['id']]['data']['name']=(isset($xml_item_promotion->name)?(string)$xml_item_promotion->name:'');
828
+ }
829
+ }
830
+ elseif($item_key=='messages')
831
+ {
832
+ //messages will be here;
833
+ $new_cart_structure['messages']=array();
834
+ }
835
+ }
836
+
837
+ }
838
+ }
839
+ }
840
+ }
841
+
842
+ /* NO UPDATE CART HERE AS FOR NOW, WILL UPDETE BEFORE ORDER CREATION
843
+ if ($product_to_enter_in_cart){
844
+ print_r($product_to_enter_in_cart);
845
+ //add free product in cart
846
+ $product_added=false;
847
+ foreach ($product_to_enter_in_cart as $p_t_e){
848
+ $product_got_id = Mage::getModel('catalog/product')->getIdBySku((string)$p_t_e['productcode']);
849
+ if ($product_got_id>0){
850
+ $product_to_add = Mage::getModel('catalog/product')
851
+ ->setStoreId(Mage::app()->getStore()->getId())
852
+ ->load($product_got_id);
853
+ $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product_to_add);
854
+ $qty = $stockItem->getQty();
855
+ // to do, check if product inventory is managed otherwise this can become a minus qty
856
+ if($product_to_add->isSaleable()&&$qty >= 0) {
857
+ $cart->addProduct($product_to_add);
858
+ $product_added=true;
859
+ }else {
860
+ echo "error stock";
861
+ //$cart->addNotificationMessage($cart,'notice',(string)$product_to_enter_in_cart['productcode']. ' cannot be added to the cart!');
862
+ }
863
+ } else {
864
+ echo "error code";
865
+ //$cart->addNotificationMessage($cart,'notice',(string)$product_to_enter_in_cart['productcode']. ' '. $this->__(' cannot be added to the cart!'));
866
+ }
867
+ }
868
+ }
869
+
870
+ if ($product_added||$update_cart){
871
+ echo "cart update";
872
+ $cart->save();
873
+ }
874
+ */
875
+
876
+
877
+ //set own price
878
+ //$item->setCustomPrice($price);
879
+ //$item->setOriginalCustomPrice($price);
880
+ /*$promotions_xml=$result->RetrievePromotionsForProductsResult;
881
+ //print_r($result->RetrievePromotionsForProductsResult);*/
882
+
883
+ //store in database for promotions here
884
+ //$result->RetrievePromotionsForProductsResult
885
+
886
+
887
+ }
888
+ }
889
+ //print_r($new_cart_structure);
890
+ //die();
891
+ if (isset($new_cart_structure)&&count($new_cart_structure)>0)
892
+ {
893
+ return $new_cart_structure;
894
+ }
895
+ }
896
+
897
+ function run_import_promotionsForProducts(){
898
+
899
+ if (Mage::getStoreConfig('qixol/promo/enabled') == 0){
900
+ return;
901
+ }
902
+
903
+ $this->addExportStatus("process", 'promotions', '', 0);
904
+
905
+ $products_list = Mage::getModel('catalog/product')->getCollection()
906
+ ->addAttributeToSelect('*')->addAttributeToFilter('visibility', array('neq'=>1))
907
+ ->addAttributeToSort('entity_id', 'desc');
908
+
909
+ foreach ($products_list as $product) {
910
+ $data .= '<product productcode="'.$product->getSku().'" variantcode="" barcode="" price="'.$product->getPrice().'"><description>'.$this->CDT($product->getName()).'</description><imageurl>'.$this->CDT($product->getImage() != 'no_selection' ? $product->getImageUrl() : '').'</imageurl>';
911
+ $products_data.='<product productcode="'.$product->getSku().'" variantcode="" />';
912
+ if ($product->isConfigurable()){ //with variations
913
+ //$associatedAttributes = $product->getTypeInstance()->getConfigurableAttributesAsArray($product);
914
+ $childs_products_list=$product->getTypeInstance()->getUsedProducts();
915
+ foreach ($childs_products_list as $childProduct_tmp) {
916
+ $childProduct = Mage::getModel('catalog/product')->load($childProduct_tmp->getId());
917
+ $products_data.='<product productcode="'.$product->getSku().'" variantcode="'.$childProduct->getSku().'" />';
918
+ }
919
+ }
920
+
921
+ }
922
+
923
+ if ($products_data!=''){
924
+
925
+ $promotions='<request companykey="'.Mage::getStoreConfig('qixol/integraion/companykey').
926
+ '" validationdate="'.date("Y-m-d",strtotime("+ 1 DAY")).'T00:00:00" channel="'.Mage::getStoreConfig('qixol/syhchronized/channel').
927
+ '" storegroup="'.Mage::getStoreConfig('qixol/syhchronized/storegroup').'" store="'.Mage::getStoreConfig('qixol/syhchronized/channel').
928
+ '" validatefortime="false"><products>'.$products_data.'</products></request>';
929
+
930
+ $result = $this->promoService->PromotionsForProducts($promotions);
931
+
932
+ if ($result->success) {
933
+ if ($result->message != ''){
934
+ $this->promoService->parsePromotionsForProducts($result->message);
935
+ $this->addExportStatus("success", 'promotions', 'imported', 1);
936
+ } else {
937
+ $this->addExportStatus("success", 'promotions', 'imported - no promotions', 1);
938
+ }
939
+ } else {
940
+ $this->addExportStatus("error", 'promotions', addslashes($result->message), 1);
941
+ $this->pushLog("Finish import promotions error ".$result->message);
942
+ }
943
+ } else {
944
+ $this->addExportStatus("process", 'promotions', 'no products found for promotion retrieval', 1);
945
+ }
946
+ return;
947
+ }
948
+
949
+ function run_import_promotionsForBaskets(){
950
+
951
+ $this->addExportStatus("process", 'basketpromotions' ,'',0);
952
+ $promotions='<request companykey="'.Mage::getStoreConfig('qixol/integraion/companykey').
953
+ '" validationdate="'.date("Y-m-d",strtotime("+ 1 DAY")).'T00:00:00" channel="'.Mage::getStoreConfig('qixol/syhchronized/channel').
954
+ '" storegroup="'.Mage::getStoreConfig('qixol/syhchronized/storegroup').'" store="'.Mage::getStoreConfig('qixol/syhchronized/channel').
955
+ '" validatefortime="false"></request>';
956
+
957
+ $result = $this->promoService->PromotionsForBaskets($promotions);
958
+
959
+ if ($result->success)
960
+ {
961
+ $this->promoService->parsePromotionsForBaskets($result->message);
962
+ $this->addExportStatus("success", 'basketpromotions', 'imported', 1);
963
+ } else {
964
+ $this->addExportStatus("error", 'basketpromotions', addslashes($result->message), 1);
965
+ $this->pushLog("Finish import promotions error ".$result->message);
966
+ }
967
+ return;
968
+ }
969
+
970
+ function run_export_customerGroups() {
971
+
972
+ if (Mage::getStoreConfig('qixol/promo/enabled') == 0){
973
+ return;
974
+ }
975
+
976
+ if (Mage::getStoreConfig('qixol/syhchronized/synchcustomer') == 0){
977
+ return;
978
+ }
979
+
980
+ if ($this->isRunning('customers'))
981
+ {
982
+ return;
983
+ }
984
+
985
+ $this->addExportStatus("process", 'customers' ,'',0);
986
+
987
+ $list_map_names = Mage::getModel('qixol/Customergrouspmap')->getCollection();
988
+
989
+ $group_to_send='';
990
+ foreach ($list_map_names as $list_map){
991
+ $group_to_send .= '<item display="';
992
+ $group_to_send .= $list_map->getCustomerGroupName();
993
+ $group_to_send .= '">';
994
+ $group_to_send .= $list_map->getIntegrationCode();
995
+ $group_to_send .= '</item>';
996
+ }
997
+
998
+ if ($group_to_send != '')
999
+ {
1000
+ $data = '<import companykey="';
1001
+ $data .= Mage::getStoreConfig('qixol/integraion/companykey');
1002
+ $data .= '" attributetoken="customergroup"><items>';
1003
+ $data .= $group_to_send;
1004
+ $data .= '</items></import>';
1005
+
1006
+ $result = $this->promoService->CustomerGroupExport($data);
1007
+ if ($result->success)
1008
+ {
1009
+ $message = $result->message;
1010
+ $promoResult = $this->getPromoResult($message);
1011
+ $this->addExportStatus($promoResult, 'customers', addslashes($result->message),1);
1012
+ }
1013
+ else
1014
+ {
1015
+ $this->addExportStatus("error", 'customers', addslashes($result->message),1);
1016
+ }
1017
+ }
1018
+ }
1019
+
1020
+ function run_export_shippingMethods() {
1021
+
1022
+ if (Mage::getStoreConfig('qixol/promo/enabled') == 0)
1023
+ {
1024
+ return;
1025
+ }
1026
+
1027
+ if (Mage::getStoreConfig('qixol/syhchronized/synchship') == 0)
1028
+ {
1029
+ return;
1030
+ }
1031
+
1032
+ if ($this->isRunning('delivery'))
1033
+ {
1034
+ return;
1035
+ }
1036
+
1037
+ $this->addExportStatus("process", 'delivery' ,'',0);
1038
+
1039
+ $list_map_names = Mage::getModel('qixol/Shippingmap')->getCollection();
1040
+
1041
+ $list_map_names_exists=array();
1042
+
1043
+ foreach ($list_map_names as $list_map){
1044
+ $list_map_names_exists[$list_map->getShippingName()] = $list_map->getShippingNameMap();
1045
+ }
1046
+
1047
+ //$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
1048
+ $methods = Mage::getSingleton('shipping/config')->getAllCarriers();
1049
+
1050
+ $selectedgroups = Mage::getStoreConfig('qixol/shippings/list');
1051
+
1052
+ unset($selectedgroups_array);
1053
+
1054
+ if(trim($selectedgroups)!='')
1055
+ {
1056
+ $selectedgroups_array=explode(",",$selectedgroups);
1057
+ }
1058
+
1059
+ foreach($list_map_names as $list_map)
1060
+ {
1061
+ $shipping_to_send .= '<item display="';
1062
+ $shipping_to_send .= $list_map->getCarrierTitle() . ': ' . $list_map->getCarrierMethod();
1063
+ $shipping_to_send .= '">';
1064
+ $shipping_to_send .= $list_map->getIntegrationCode();
1065
+ $shipping_to_send .= '</item>';
1066
+ }
1067
+
1068
+ if ($shipping_to_send!='')
1069
+ {
1070
+ $data='<import companykey="'.Mage::getStoreConfig('qixol/integraion/companykey').'" attributetoken="deliverymethod"><items>'.$shipping_to_send.'</items></import>';
1071
+ $result = $this->promoService->ShippingMethodsExport($data);
1072
+ if ($result->success)
1073
+ {
1074
+ $message = $result->message;
1075
+ $promoResult = $this->getPromoResult($message);
1076
+ $this->addExportStatus($promoResult, 'delivery' ,addslashes($result->message),1);
1077
+ }
1078
+ else
1079
+ {
1080
+ $this->addExportStatus("error", 'delivery' ,addslashes($result->message),1);
1081
+ }
1082
+ }
1083
+ else
1084
+ {
1085
+ $this->addExportStatus("success", 'delivery', 'There are no shipping methods to send', 1);
1086
+ }
1087
+ }
1088
+
1089
+ function run_export_currencies()
1090
+ {
1091
+
1092
+ if (Mage::getStoreConfig('qixol/promo/enabled') == 0){
1093
+ return;
1094
+ }
1095
+
1096
+ if (Mage::getStoreConfig('qixol/syhchronized/synchcurrency') == 0){
1097
+ return;
1098
+ }
1099
+
1100
+ if ($this->isRunning('currency'))
1101
+ {
1102
+ return;
1103
+ }
1104
+
1105
+ $this->addExportStatus("process", 'currency' ,'',0);
1106
+ $currency_to_send='';
1107
+ $only_active_currency=Mage::getStoreConfig('currency/options/allow');
1108
+ $currencies_array = explode(',',$only_active_currency);
1109
+ foreach($currencies_array as $code_curr)
1110
+ {
1111
+ $currency_to_send .= '<item display="';
1112
+ $currency_to_send .= Mage::app()->getLocale()->currency( $code_curr )->getName();
1113
+ $currency_to_send .= '">';
1114
+ $currency_to_send .= $code_curr;
1115
+ $currency_to_send .= '</item>';
1116
+ }
1117
+
1118
+ if ($currency_to_send != '')
1119
+ {
1120
+ $data = '<import companykey="';
1121
+ $data .= Mage::getStoreConfig('qixol/integraion/companykey');
1122
+ $data .= '" attributetoken="currencycode"><items>';
1123
+ $data .= $currency_to_send;
1124
+ $data .= '</items></import>';
1125
+
1126
+ $result = $this->promoService->CurrenciesExport($data);
1127
+ if ($result->success)
1128
+ {
1129
+ $message = $result->message;
1130
+ $promoResult = $this->getPromoResult($message);
1131
+ $this->addExportStatus($promoResult, 'currency', addslashes($result->message), 1);
1132
+ }
1133
+ else
1134
+ {
1135
+ $this->addExportStatus("error", 'currency', addslashes($result->message), 1);
1136
+ }
1137
+ }
1138
+ else
1139
+ {
1140
+ $this->addExportStatus("success", 'currency', 'No currencies to send', 1);
1141
+ }
1142
+ }
1143
+
1144
+ function run_export_stores() {
1145
+
1146
+ if (Mage::getStoreConfig('qixol/promo/enabled') == 0){
1147
+ return;
1148
+ }
1149
+
1150
+ if (Mage::getStoreConfig('qixol/syhchronized/synchstores') == 0){
1151
+ return;
1152
+ }
1153
+
1154
+ if ($this->isRunning('store'))
1155
+ {
1156
+ return;
1157
+ }
1158
+
1159
+ $this->addExportStatus("process", 'store' ,'',0);
1160
+
1161
+ $list_store_integration_codes = Mage::getModel('qixol/Storesmap')->getCollection();
1162
+
1163
+ foreach ($list_store_integration_codes as $list_map)
1164
+ {
1165
+ $list_store_integration_codes_exists[$list_map->getWebsite()][$list_map->getStoreGroup()][$list_map->getStoreName()]=$list_map->getIntegrationCode();
1166
+ }
1167
+
1168
+ $xmlToSend = '';
1169
+
1170
+ foreach (Mage::app()->getWebsites() as $website)
1171
+ {
1172
+ $xmlChannel = '<channel display="';
1173
+ $xmlChannel .= $website->getName();
1174
+ $xmlChannel .= '" value="';
1175
+ $xmlChannel .= $website->getName();
1176
+ $xmlChannel .= '">';
1177
+
1178
+ $hasStoreGroups = false;
1179
+ foreach ($website->getGroups() as $group) {
1180
+ $xmlStoreGroup = '<storegroup display="';
1181
+ $xmlStoreGroup .= $group->getName();
1182
+ $xmlStoreGroup .= '" value="';
1183
+ $xmlStoreGroup .= $group->getName();
1184
+ $xmlStoreGroup .= '">';
1185
+
1186
+ $stores = $group->getStores();
1187
+
1188
+ $hasStores = false;
1189
+ foreach ($stores as $store) {
1190
+ $integrationCode = $list_store_integration_codes_exists[$website->getName()][$group->getName()][$store->getName()];
1191
+ if (!empty($integrationCode))
1192
+ {
1193
+ $hasStores = true;
1194
+ $xmlStore .= '<store display="';
1195
+ $xmlStore .= $store->getName();
1196
+ $xmlStore .= '" value="';
1197
+ $xmlStore .= $integrationCode;
1198
+ $xmlStore .= '" />';
1199
+ }
1200
+ }
1201
+ if ($hasStores)
1202
+ {
1203
+ $hasStoreGroups = true;
1204
+ $xmlStoreGroup .= $xmlStore;
1205
+ }
1206
+
1207
+ $xmlStoreGroup .= '</storegroup>';
1208
+ }
1209
+
1210
+ if ($hasStoreGroups)
1211
+ {
1212
+ $xmlChannel .= $xmlStoreGroup;
1213
+ $xmlChannel .= '</channel>';
1214
+
1215
+ $xmlToSend .= $xmlChannel;
1216
+ }
1217
+ }
1218
+
1219
+
1220
+ if ($xmlToSend != '')
1221
+ {
1222
+ $data = '<import companykey="';
1223
+ $data .= Mage::getStoreConfig('qixol/integraion/companykey');
1224
+ $data .= '" hierarchytoken="store">';
1225
+ $data .= $xmlToSend;
1226
+ $data .= '</import>';
1227
+
1228
+ $result =$this->promoService->StoresExport($data);
1229
+ if ($result->success)
1230
+ {
1231
+ $message = $result->message;
1232
+ $promoResult = $this->getPromoResult($message);
1233
+ $this->addExportStatus($promoResult, 'store', addslashes($result->message), 1);
1234
+ }
1235
+ else
1236
+ {
1237
+ $this->addExportStatus("error", 'store', addslashes($result->message), 1);
1238
+ }
1239
+ }
1240
+ else
1241
+ {
1242
+ $this->addExportStatus("success", 'store', 'There are no stores to send', 1);
1243
+ }
1244
+ }
1245
+
1246
+ function run_export_products() {
1247
+
1248
+ if (Mage::getStoreConfig('qixol/promo/enabled')==0) {
1249
+ return;
1250
+ }
1251
+
1252
+ if (Mage::getStoreConfig('qixol/syhchronized/synchproducts')==0) {
1253
+ return;
1254
+ }
1255
+
1256
+ if ($this->isRunning('products'))
1257
+ {
1258
+ return;
1259
+ }
1260
+
1261
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
1262
+ $write_data->query("
1263
+ delete from ".$this->process_export_status_table." where export_what='products'
1264
+ ");
1265
+
1266
+ //process products here
1267
+ $number_products_exported=0;
1268
+ $this->addExportStatus("process", 'products' ,'',0);
1269
+
1270
+ $products_list = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->addAttributeToFilter('visibility', array('neq'=>1))->addAttributeToSort('entity_id', 'desc');
1271
+
1272
+ $products_deleted = Mage::getModel('qixol/Deletedproduct')->getCollection();
1273
+ $remove_deleted=array();
1274
+
1275
+ if (count($products_list)||count($products_deleted)){
1276
+ $data = '<import companykey="'.Mage::getStoreConfig('qixol/integraion/companykey').'"><products>';
1277
+
1278
+ //assign deleted product first
1279
+ if (count($products_deleted))
1280
+ foreach ($products_deleted as $products_deleted_data) {
1281
+ $data .= '<product productcode="'.$products_deleted_data->getData('product_sku').'" variantcode="'.$products_deleted_data->getData('child_sku').'" barcode="" deleted="true"></product>';
1282
+ $remove_deleted[]=$products_deleted_data->getData('entity_id');
1283
+ }
1284
+
1285
+ if (count($products_list))
1286
+ foreach ($products_list as $product) {
1287
+ $send_product=true;
1288
+ $imageUrl = $this->CDT($product->getImage() != 'no_selection' ? $product->getImageUrl() : '');
1289
+ if (!$product->isConfigurable()){
1290
+ $parentId = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
1291
+ //sometimes could be grouped if such module installed
1292
+ /*try {
1293
+ if((!$parentId)||(!is_array($parentId)))
1294
+ $parentId = Mage::getResourceSingleton('catalog/product_type_grouped')->getParentIdsByChild($product->getId());
1295
+ }
1296
+ catch(Exception $e) {
1297
+ ; //if object not supported appears exception
1298
+ }*/
1299
+ if (is_array($parentId)&&count($parentId))
1300
+ {
1301
+ foreach ($parentId as $parent_product_id){
1302
+ $prod_parent_obj = Mage::getModel('catalog/product')->load($parent_product_id);
1303
+ //do not send if this product exists as child in any active parent product
1304
+ if (strtolower($prod_parent_obj->getAttributeText('status'))=='enabled'&&$prod_parent_obj->getVisibility()>1){
1305
+ $send_product=false;
1306
+ break;
1307
+ }
1308
+ }
1309
+ $parentProduct = Mage::getModel('catalog/product')->load($parentId[0]);
1310
+ if ($imageUrl == '') {
1311
+ $imageUrl = $parentProduct->getImageUrl();
1312
+ }
1313
+ }
1314
+ }
1315
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
1316
+ $send_product = false;
1317
+ }
1318
+ if ($product->getPrice() == '') {
1319
+ $send_product = false;
1320
+ }
1321
+ if ($send_product){
1322
+ $productCategories = $product->getCategoryIds();
1323
+ if (!$product->isConfigurable()) {
1324
+ $productCode = $product->getSku();
1325
+ $variantCode = '';
1326
+ $price = $product->getPrice();
1327
+ $description = $this->CDT($product->getName());
1328
+
1329
+ $data .= $this->productXmlElement($product, $productCode, $variantCode, $price, $description, $imageUrl, $productCategories);
1330
+ $number_products_exported++;
1331
+
1332
+ } else {
1333
+ //$associatedAttributes = $product->getTypeInstance()->getConfigurableAttributesAsArray($product);
1334
+ $childs_products_list=$product->getTypeInstance()->getUsedProducts();
1335
+ if (empty($childs_products_list) || (count($childs_products_list) == 0)) {
1336
+ $productCode = $product->getSku();
1337
+ $variantCode = '';
1338
+ $price = $product->getPrice();
1339
+ $description = $this->CDT($product->getName());
1340
+
1341
+ $data .= $this->productXmlElement($product, $productCode, $variantCode, $price, $description, $imageUrl, $productCategories);
1342
+ $number_products_exported++;
1343
+ } else {
1344
+ foreach ($childs_products_list as $childProduct_tmp) {
1345
+ $childProduct = Mage::getModel('catalog/product')->load($childProduct_tmp->getId());
1346
+ $productCode = $product->getSku();
1347
+ $variantCode = $childProduct->getSku();
1348
+ $price = $childProduct->getPrice();
1349
+ $description = $product->getName(); // $this->CDT($childProduct->getName());
1350
+ $image = $childProduct->getImage();
1351
+ if ($image == NULL) {
1352
+ $image = 'no_selection';
1353
+ }
1354
+ $imageUrl = ($image != 'no_selection' ? $childProduct->getImageUrl() : '');
1355
+
1356
+ $data .= $this->productXmlElement($product, $productCode, $variantCode, $price, $description, $imageUrl, $productCategories);
1357
+
1358
+ $number_products_exported++;
1359
+ }
1360
+ }
1361
+ }
1362
+ }
1363
+ }
1364
+
1365
+ $data .= '</products></import>';
1366
+ if ($data!=''){
1367
+ $result = $this->promoService->ProductsExport($data);
1368
+
1369
+ if ($result->success)
1370
+ {
1371
+ $message = $result->message;
1372
+ $promoResult = $this->getPromoResult($message);
1373
+ $this->addExportStatus($promoResult, 'products', addslashes($message), 1);
1374
+ if (is_array($remove_deleted)&&count($remove_deleted)>0)
1375
+ {
1376
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
1377
+ $write_data->query("delete from qixol_product_to_delete where entity_id in (".join(",",$remove_deleted).")");
1378
+ }
1379
+ }
1380
+ else {
1381
+ $this->addExportStatus("error", 'products', addslashes($result->message), 1);
1382
+ }
1383
+ }
1384
+ else
1385
+ {
1386
+ $this->addExportStatus("success", 'products', 'no products to send', 1);
1387
+ }
1388
+ }
1389
+ }
1390
+
1391
+ function attributeXmlElement($product, $productCategories) {
1392
+ $attributes=Mage::getStoreConfig('qixol/productattrib/attributes');
1393
+ $attributeXmlElement = '';
1394
+ $attributes_arr=explode(",",$attributes);
1395
+ if (count($attributes_arr)){
1396
+ foreach ($attributes_arr as $attribute_id){
1397
+ $attribute = $product->getResource()->getAttribute($attribute_id);
1398
+ if ($attribute != NULL) {
1399
+ $is_attribute_text_value = $attribute->getFrontend()->getValue($product);
1400
+ $attributeXmlElement .= '<attribute>';
1401
+ $attributeXmlElement .= '<name>'.$attribute_id.'</name>';
1402
+ $attributeXmlElement .= '<value>'.$this->CDT($is_attribute_text_value!=''?$is_attribute_text_value:$product->getData($attribute_id)).'</value>';
1403
+ $attributeXmlElement .= '</attribute>';
1404
+ }
1405
+ }
1406
+ }
1407
+ if (Mage::getStoreConfig('qixol/syhchronized/synchcatproducts')>0){
1408
+ foreach ($productCategories as $product_category_id){
1409
+ if ($product_category_id==0) continue;
1410
+ $current_ctaegory_id=$product_category_id;
1411
+ $category_name_push='';
1412
+ while($current_ctaegory_id != 0){
1413
+ $category = Mage::getModel('catalog/category')->load($current_ctaegory_id);
1414
+ $current_ctaegory_id=$category->getParentId();
1415
+ if (strtolower($category->getName())!='root catalog') {
1416
+ $category_name_push=$category->getName().($category_name_push!=''?" / ".$category_name_push:"");
1417
+ }
1418
+ }
1419
+ $attributeXmlElement .= '<attribute>';
1420
+ $attributeXmlElement .= '<name>categorycode</name>';
1421
+ $attributeXmlElement .= '<value>'.$this->CDT($category_name_push).'</value>';
1422
+ $attributeXmlElement .= '</attribute>';
1423
+ }
1424
+ }
1425
+
1426
+ if (!empty($attributeXmlElement)) {
1427
+ $attributeXmlElement = '<attributes>'.$attributeXmlElement.'</attributes>';
1428
+ }
1429
+ return $attributeXmlElement;
1430
+ }
1431
+
1432
+ function productXmlElement($product, $productCode, $variantCode, $price, $description, $imageUrl, $productCategories) {
1433
+ $productXmlElement = '<product productcode="'.$productCode.'" variantcode="'.$variantCode.'"';
1434
+ $productXmlElement .= ' barcode="" price="'.$price.'"><description>'.$description.'</description>';
1435
+ $productXmlElement .= '<imageurl>'.$imageUrl.'</imageurl>';
1436
+ $productXmlElement .= $this->attributeXmlElement($product, $productCategories);
1437
+ $productXmlElement .= '</product>';
1438
+
1439
+ return $productXmlElement;
1440
+ }
1441
+
1442
+ function run_export_qixolData(){
1443
+
1444
+ if (Mage::getStoreConfig('qixol/promo/enabled') == 0){
1445
+ return;
1446
+ }
1447
+
1448
+ $this->run_export_customerGroups();
1449
+ $this->run_export_shippingMethods();
1450
+ $this->run_export_currencies();
1451
+ $this->run_export_stores();
1452
+ $this->run_export_products();
1453
+ }
1454
+
1455
+ function CDT($in_str)
1456
+ {
1457
+ return "<![CDATA[".$in_str."]]>";
1458
+ }
1459
+
1460
+ public function getExportStatus($for='products'){
1461
+
1462
+ $query = "SELECT * FROM ";
1463
+ $query .= $this->process_export_status_table;
1464
+ $query .= " where export_what ='";
1465
+ $query .= $for;
1466
+ $query .= "' ORDER BY id DESC LIMIT 1";
1467
+
1468
+ $read_data = Mage::getSingleton('core/resource')->getConnection('core_read');
1469
+
1470
+ if ($readresult=$read_data->query($query))
1471
+ {
1472
+ $_status = $readresult->fetch();
1473
+ }
1474
+ else
1475
+ {
1476
+ $_status=array();
1477
+ }
1478
+
1479
+ if ($_status['id'] > 0)
1480
+ {
1481
+ // small fudge to cope with single quotes in XML failing the evalJSON function later on
1482
+ $last_message = str_replace("'", '"', $_status['last_message']);
1483
+ $extended_message = str_replace("'", '"', $_status['extended_message']);
1484
+ $messages=array('id'=>$_status['id'],
1485
+ 'message'=>$last_message,
1486
+ 'extended_message'=>$extended_message,
1487
+ 'error'=>((int)$_status['is_finished']<0?1:0),
1488
+ 'finished'=>((int)$_status['is_finished'] > 0 ? true : false),
1489
+ 'last_updated'=>$_status['exports_last_updated'],
1490
+ 'exports_start'=>$_status['exports_start']);
1491
+ }
1492
+ else
1493
+ {
1494
+ $messages=array('id'=>'0','message'=>'inactive', 'error'=>0, 'finished'=>true);
1495
+ }
1496
+
1497
+ return $messages;
1498
+ }
1499
+
1500
+ public function addExportStatus($message, $for ,$extended_message='',$finished=0){
1501
+ if (!isset($this->process_export_status_id[$for])||$this->process_export_status_id[$for]==0){
1502
+ $query="INSERT INTO ".$this->process_export_status_table."
1503
+ (last_message, export_what,exports_start,exports_last_updated,is_finished,extended_message)
1504
+ VALUES('".$message."','".$for."',now(),now(), '".(int)$finished."','".$extended_message."')";
1505
+
1506
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
1507
+ $write_data->query($query);
1508
+ $this->process_export_status_id[$for]=$write_data->lastInsertId();
1509
+ } else {
1510
+ $query="update ".$this->process_export_status_table."
1511
+ set last_message='".$message."', exports_last_updated=now(), is_finished='".(int)$finished."', extended_message='".$extended_message."'
1512
+ where id=".(int)$this->process_export_status_id[$for]."";
1513
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
1514
+ $write_data->query($query);
1515
+ }
1516
+
1517
+ //extended latst transactions stat table disabled as now it dublicate main status table function
1518
+ /* if ($this->export_poducts_statistic_id==0){
1519
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
1520
+ $write_data->query("
1521
+ insert into ".$this->export_poducts_statistic_table."
1522
+ (start_export,number_of_items,status_export,export_by,status_export_message)
1523
+ values(now(),0,'process','".$this->export_by."','export start')
1524
+ ");
1525
+ $this->export_poducts_statistic_id=$write_data->lastInsertId();
1526
+ }
1527
+ if($finished==0){
1528
+ $query = "UPDATE ".$this->export_poducts_statistic_table."
1529
+ SET status_export='".$message."' ,
1530
+ status_export_message='".addslashes($extended_message)."'
1531
+ WHERE export_id=".$this->export_poducts_statistic_id;
1532
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
1533
+ $write_data->query($query);
1534
+ } else {
1535
+ $query = "UPDATE ".$this->export_poducts_statistic_table."
1536
+ SET
1537
+ status_export='success',
1538
+ status_export_message='".addslashes($extended_message)."'
1539
+ finish_export=now()
1540
+ WHERE
1541
+ export_id=".$this->export_poducts_statistic_id;
1542
+ $write_data = Mage::getSingleton('core/resource')->getConnection('core_write');
1543
+ $write_data->query($query);
1544
+ }*/
1545
+ return ;
1546
+ }
1547
+
1548
+ function isRunning($exportType)
1549
+ {
1550
+ $current_state=$this->getExportStatus($exportType);
1551
+
1552
+ if ($current_state['id']==0) return false;
1553
+ if ($current_state['finished']) return false;
1554
+ if (strtotime($current_state['last_updated'])<strtotime("-1 hour")) return false;
1555
+
1556
+ return true;
1557
+ }
1558
+
1559
+ function getPromoResult($message)
1560
+ {
1561
+ libxml_use_internal_errors(true);
1562
+ $xml_message = simplexml_load_string($message);
1563
+ if (!$xml_message)
1564
+ {
1565
+ return "error";
1566
+ }
1567
+ if (!($xml_message instanceof SimpleXMLElement))
1568
+ {
1569
+ return "error";
1570
+ }
1571
+
1572
+ $promoResult = "error";
1573
+ foreach ($xml_message as $xml_root_key=>$xml_object_sub)
1574
+ {
1575
+ switch ($xml_root_key)
1576
+ {
1577
+ case "summary":
1578
+ $attributes = $xml_object_sub->attributes();
1579
+ if ($attributes['result']=="true")
1580
+ {
1581
+ $promoResult = "success";
1582
+ }
1583
+ else
1584
+ {
1585
+ $promoResult = "error";
1586
+ }
1587
+ break;
1588
+ default:
1589
+ break;
1590
+ }
1591
+ }
1592
+ return $promoResult;
1593
+ }
1594
+ }
app/code/community/Qixol/Promo/Model/Status.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Status extends Varien_Object {
3
+ const STATUS_DISABLED = 0;
4
+ const STATUS_ENABLED = 1;
5
+
6
+ static public function getOptionArray() {
7
+ return array(
8
+ self::STATUS_DISABLED => Mage::helper('qixol')->__('Disabled'),
9
+ self::STATUS_ENABLED => Mage::helper('qixol')->__('Enabled')
10
+ );
11
+ }
12
+
13
+ }
app/code/community/Qixol/Promo/Model/Sticker.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Sticker extends Mage_Core_Model_Abstract {
3
+ private $default_stickers=array('BOGOF'=>'BOGOF.png',
4
+ 'BOGOR'=>'BOGOR.png',
5
+ 'BUNDLE'=>'BUNDLE.png',
6
+ 'DEAL'=>'DEAL.png',
7
+ 'DELIVERYREDUCTION'=>'DELIVERYREDUCTION.png',
8
+ 'FREEPRODUCT'=>'FREEPRODUCT.png',
9
+ 'ISSUECOUPON'=>'ISSUECOUPON.png',
10
+ 'ISSUEPOINTS'=>'ISSUEPOINTS.png',
11
+ 'BASKETREDUCTION'=>'BASKETREDUCTION.png',
12
+ 'PRODUCTSREDUCTION'=>'PRODUCTSREDUCTION.png',
13
+ );
14
+ protected static $defaultstickerDir = null;
15
+ protected static $defaultstickerURL = null;
16
+
17
+ private $default_sticker_folder='frontend/base/default/images/qixol';
18
+
19
+ public function _construct() {
20
+ self::$defaultstickerDir = Mage::getBaseDir('skin') . DS;
21
+ self::$defaultstickerURL = Mage::getBaseUrl('skin');
22
+ parent::_construct();
23
+ $this->_init('qixol/sticker');
24
+ }
25
+
26
+ public function getAllAvailStickerIds(){
27
+ $collection = Mage::getResourceModel('qixol/sticker_collection')
28
+ ->getAllIds();
29
+ return $collection;
30
+ }
31
+
32
+ public function getAllStickers() {
33
+ $collection = Mage::getResourceModel('qixol/sticker_collection');
34
+ $collection->getSelect()->where('status = ?', 1);
35
+ $data = array();
36
+ foreach ($collection as $record) {
37
+ $data[$record->getId()] = array('value' => $record->getId(), 'label' => $record->getfilename());
38
+ }
39
+ return $data;
40
+ }
41
+
42
+ public function getDataByStickerIds($bannerIds) {
43
+ $data = array();
44
+ if ($bannerIds != '') {
45
+ $collection = Mage::getResourceModel('qixol/sticker_collection');
46
+ $collection->getSelect()->where('sticker_id IN (' . $bannerIds . ')')->order('sort_order');
47
+ foreach ($collection as $record) {
48
+ $status = $record->getStatus();
49
+ if ($status == 1) {
50
+ $data[] = $record;
51
+ }
52
+ }
53
+ }
54
+ return $data;
55
+ }
56
+
57
+ public function getDefaultSticker($stickername) {
58
+ $data='';
59
+ if ($stickername!=''&&$this->default_stickers[$stickername]!=''){
60
+ if (file_exists(self::$defaultstickerDir."/".$this->default_sticker_folder."/".$this->default_stickers[$stickername])){
61
+ $data=self::$defaultstickerURL."/".$this->default_sticker_folder."/".$this->default_stickers[$stickername];
62
+ }
63
+ }
64
+ return $data;
65
+ }
66
+
67
+ }
app/code/community/Qixol/Promo/Model/Storesmap.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_Storesmap extends Mage_Core_Model_Abstract {
3
+
4
+ public function _construct() {
5
+ parent::_construct();
6
+ $this->_init('qixol/storesmap', "store_name");
7
+ }
8
+
9
+ public function getOptionArray(){
10
+ $hlp = Mage::helper('qixol');
11
+ $collections=$this->getCollection();
12
+ $list_return=array();
13
+ foreach ($collections as $item){
14
+ $list_return[]=array(
15
+ 'value' => (string)$item->getStoreName(),
16
+ 'label' => $hlp->__((string)$item->getStoreName())
17
+ );
18
+ }
19
+ return $list_return;
20
+ }
21
+ }
app/code/community/Qixol/Promo/Model/System/Config/Source/Attributes.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_System_Config_Source_Attributes
3
+ {
4
+
5
+ public function toOptionArray(){
6
+ $hlp = Mage::helper('qixol');
7
+ $attributes_return=array();
8
+
9
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
10
+ ->getItems();
11
+
12
+ foreach ($attributes as $attribute){
13
+ $attributes_return[]=array(
14
+ 'value' => (string)$attribute->getAttributecode(),
15
+ 'label' => $hlp->__($attribute->getFrontendLabel()!=''?$attribute->getFrontendLabel():$attribute->getAttributecode())
16
+ );
17
+ }
18
+
19
+ return $attributes_return;
20
+ }
21
+ }
app/code/community/Qixol/Promo/Model/System/Config/Source/Cart/Settings.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_System_Config_Source_Cart_Settings
3
+ {
4
+
5
+ public function getAllOptions()
6
+ {
7
+ $hlp = Mage::helper('qixol');
8
+ return array(
9
+ array('label'=>$hlp->__('Show promotion end-user/customer description'), 'value'=>'displaytext'),
10
+ array('label'=>$hlp->__('Show promotion name'), 'value'=>'displayname'),
11
+ array('label'=>$hlp->__('Show promotion type'), 'value'=>'displaytype'),
12
+ array('label'=>$hlp->__("Don't display"), 'value'=>'dontdisplay'),
13
+ );
14
+ }
15
+
16
+ public function toOptionArray(){
17
+ $hlp = Mage::helper('qixol');
18
+
19
+ return array(
20
+ array(
21
+ 'value' => 'displaytext',
22
+ 'label' => $hlp->__('Show promotion end-user/customer description'),
23
+ ),
24
+ array(
25
+ 'value' => 'displayname',
26
+ 'label' => $hlp->__('Show promotion name'),
27
+ ),
28
+ array(
29
+ 'value' => 'displaytype',
30
+ 'label' => $hlp->__('Show promotion type'),
31
+ ),
32
+ array(
33
+ 'value' => 'dontdisplay',
34
+ 'label' => $hlp->__("Don't display"),
35
+ ),
36
+ );
37
+ }
38
+ }
app/code/community/Qixol/Promo/Model/System/Config/Source/Customers/List.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_System_Config_Source_Customers_List
3
+ {
4
+
5
+ public function toOptionArray(){
6
+ $hlp = Mage::helper('qixol');
7
+ $customerGroups=array();
8
+
9
+ $customerGroupModel = new Mage_Customer_Model_Group();
10
+ $customerGroups = array();
11
+ $allCustomerGroups = $customerGroupModel->getCollection()->toOptionHash();
12
+ foreach($allCustomerGroups as $key => $group){
13
+ $customerGroups[] = array('value'=>$key,'label'=>$hlp->__($group));
14
+ }
15
+
16
+ return $customerGroups;
17
+ }
18
+
19
+ }
app/code/community/Qixol/Promo/Model/System/Config/Source/IServiceProtocols/Values.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_System_Config_Source_IServiceProtocols_Values
3
+ {
4
+
5
+ public function getAllOptions()
6
+ {
7
+ $hlp = Mage::helper('qixol');
8
+ return array(
9
+ array('label'=>$hlp->__('REST services [RECOMMENDED]'), 'value'=>'REST'),
10
+ array('label'=>$hlp->__('SOAP services'), 'value'=>'SOAP')
11
+ );
12
+ }
13
+
14
+ public function toOptionArray(){
15
+ $hlp = Mage::helper('qixol');
16
+
17
+ return array(
18
+ array(
19
+ 'value' => 'REST',
20
+ 'label' => $hlp->__('REST services [RECOMMENDED]')
21
+ ),
22
+ array(
23
+ 'value' => 'SOAP',
24
+ 'label' => $hlp->__('SOAP services')
25
+ )
26
+ );
27
+ }
28
+ }
app/code/community/Qixol/Promo/Model/System/Config/Source/Iservices/Values.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_System_Config_Source_Iservices_Values
3
+ {
4
+
5
+ public function getAllOptions()
6
+ {
7
+ $hlp = Mage::helper('qixol');
8
+ return array(
9
+ array('label'=>$hlp->__('evaluation services'), 'value'=>'evaluation'),
10
+ array('label'=>$hlp->__('live services'), 'value'=>'live'),
11
+ array('label'=>$hlp->__('custom services'), 'value'=>'custom')
12
+ );
13
+ }
14
+
15
+ public function toOptionArray(){
16
+ $hlp = Mage::helper('qixol');
17
+
18
+ return array(
19
+ array(
20
+ 'value' => 'evaluation',
21
+ 'label' => $hlp->__('evaluation services'),
22
+ ),
23
+ array(
24
+ 'value' => 'live',
25
+ 'label' => $hlp->__('live services'),
26
+ ),
27
+ array(
28
+ 'value' => 'custom',
29
+ 'label' => $hlp->__('custom services')
30
+ )
31
+ );
32
+ }
33
+ }
app/code/community/Qixol/Promo/Model/System/Config/Source/Shippings/List.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_System_Config_Source_Shippings_List
3
+ {
4
+
5
+ public function toOptionArray(){
6
+ $hlp = Mage::helper('qixol');
7
+ //$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
8
+ $methods = Mage::getSingleton('shipping/config')->getAllCarriers();
9
+
10
+ $options = array();
11
+
12
+ foreach($methods as $_ccode => $_carrier)
13
+ {
14
+ $_methodOptions = array();
15
+ try{ //some methods not allowed getAllowedMethods
16
+ if($_methods = $_carrier->getAllowedMethods())
17
+ {
18
+ foreach($_methods as $_mcode => $_method)
19
+ {
20
+ $_code = $_ccode . '_' . $_mcode;
21
+ $_methodOptions[] = array('value' => $_code, 'label' => $hlp->__(trim($_method)==''?$_code:$_method));
22
+ }
23
+
24
+ if(!$_title = Mage::getStoreConfig("carriers/$_ccode/title"))
25
+ $_title = $_ccode;
26
+
27
+ $options[] = array('value' => $_methodOptions, 'label' => $hlp->__($_title));
28
+ }
29
+ }
30
+ catch(Exception $e) {
31
+ continue;
32
+ }
33
+ }
34
+
35
+ return $options;
36
+ }
37
+
38
+ }
app/code/community/Qixol/Promo/Model/System/Config/Source/Stores.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Model_System_Config_Source_Stores
3
+ {
4
+
5
+ public function toOptionArray(){
6
+ $hlp = Mage::helper('qixol');
7
+ $stores=array(
8
+ array(
9
+ 'value' => '0',
10
+ 'label' => $hlp->__('All stores'),
11
+ )
12
+ );
13
+ foreach (Mage::app()->getWebsites() as $website) {
14
+ foreach ($website->getGroups() as $group) {
15
+ $stores_list = $group->getStores();
16
+ foreach ($stores_list as $store) {
17
+ $stores[]=array('value' => (string)$store->getId(), 'label' => $hlp->__($store->getName()." - (".$store->getCode().")"));
18
+ }
19
+ }
20
+ }
21
+ return $stores;
22
+ }
23
+ }
app/code/community/Qixol/Promo/Model/Wysiwyg/Config.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage/Cms/Model/Wysiwyg/Config.php';
3
+ class Qixol_Promo_Model_Wysiwyg_Config extends Mage_Cms_Model_Wysiwyg_Config
4
+ {
5
+ public function getConfig($data = array())
6
+ {
7
+ $config = new Varien_Object();
8
+
9
+ $config->setData(array(
10
+ 'enabled' => $this->isEnabled(),
11
+ 'hidden' => $this->isHidden(),
12
+ 'use_container' => false,
13
+ 'add_variables' => false,
14
+ 'add_widgets' => false,
15
+ 'no_display' => false,
16
+ 'translator' => Mage::helper('qixol'),
17
+ 'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index'),
18
+ 'files_browser_window_width' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'),
19
+ 'files_browser_window_height' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height'),
20
+ 'encode_directives' => true,
21
+ 'directives_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive'),
22
+ 'popup_css' => Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css',
23
+ 'content_css' => Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css',
24
+ 'width' => '100%',
25
+ 'plugins' => array()
26
+ ));
27
+
28
+ $config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));
29
+
30
+ if (is_array($data)) {
31
+ $config->addData($data);
32
+ }
33
+
34
+ Mage::dispatchEvent('cms_wysiwyg_config_prepare', array('config' => $config));
35
+
36
+ return $config;
37
+ }
38
+ }
app/code/community/Qixol/Promo/Model/config.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ error_reporting(E_ALL);
4
+ ini_set('display_errors','On');
5
+ define("DIR_FS_CATALOG",dirname(__FILE__).((substr(dirname(__FILE__), -1)<>"/")? "/": ""));
6
+ define('TEMPORARY_DIRECTORY_FOR_FILES', Mage::getBaseDir()."var/");
7
+ define('LOG_PATH', TEMPORARY_DIRECTORY_FOR_FILES . 'logs_qixol/');
8
+ define('TMP_PATH', TEMPORARY_DIRECTORY_FOR_FILES . 'tmp/');
9
+ define('LOG_FILE', LOG_PATH.'product_export_'.date("_Y_m").'.log');
app/code/community/Qixol/Promo/Model/iPromoService.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this license header, choose License Headers in Project Properties.
5
+ * To change this template file, choose Tools | Templates
6
+ * and open the template in the editor.
7
+ */
8
+
9
+ /**
10
+ *
11
+ * @author ken
12
+ */
13
+ interface iPromoService
14
+ {
15
+ function CustomerGroupExport($data);
16
+ function ShippingMethodsExport($data);
17
+ function CurrenciesExport($data);
18
+ function StoresExport($data);
19
+ function ProductsExport($data);
20
+
21
+ function PromotionsForProducts($data);
22
+ function PromotionsForBaskets($data);
23
+ function CouponCodesImport();
24
+
25
+ function BasketValidate($data);
26
+ function CouponCodeValidate($couponCode);
27
+ function RetrieveValidatedBasket($basketRef);
28
+ function BasketCheck();
29
+ }
app/code/community/Qixol/Promo/controllers/Adminhtml/BannerController.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Adminhtml_BannerController extends Mage_Adminhtml_Controller_action {
3
+
4
+ protected function _initAction() {
5
+ $this->loadLayout()
6
+ ->_setActiveMenu('qixol/items')
7
+ ->_addBreadcrumb(Mage::helper('qixol')->__('Banner Manager'), Mage::helper('qixol')->__('Banner Manager'));
8
+
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction() {
13
+ $this->_initAction()
14
+ ->renderLayout();
15
+ }
16
+
17
+ public function editAction() {
18
+ $id = $this->getRequest()->getParam('id');
19
+ $model = Mage::getModel('qixol/banner')->load($id);
20
+
21
+ //$BannerImages = Mage::getModel('qixol/banner')->getBannerImages($id);
22
+
23
+
24
+ if ($model->getId() || $id == 0) {
25
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
26
+ if (!empty($data)) {
27
+ $model->setData($data);
28
+ }
29
+
30
+
31
+ Mage::register('banner_data', $model);
32
+
33
+ $this->loadLayout();
34
+ $this->_setActiveMenu('qixol/items');
35
+
36
+ $this->_addBreadcrumb(Mage::helper('qixol')->__('Banner Manager'), Mage::helper('qixol')->__('Banner Manager'));
37
+ $this->_addBreadcrumb(Mage::helper('qixol')->__('Item Banner'), Mage::helper('qixol')->__('Item Banner'));
38
+
39
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
40
+
41
+ $this->_addContent($this->getLayout()->createBlock('qixol/adminhtml_banner_edit'))
42
+ ->_addLeft($this->getLayout()->createBlock('qixol/adminhtml_banner_edit_tabs'));
43
+ $version = substr(Mage::getVersion(), 0, 3);
44
+ if (($version=='1.4' || $version=='1.5') && Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
45
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
46
+ }
47
+ $this->renderLayout();
48
+ } else {
49
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Item does not exist'));
50
+ $this->_redirect('*/*/');
51
+ }
52
+ }
53
+
54
+ public function newAction() {
55
+ $this->_forward('edit');
56
+ }
57
+
58
+ public function saveAction() {
59
+ if ($data = $this->getRequest()->getPost()) {
60
+ if (is_array($data['display_zone'])){
61
+ $data['display_zone']=join(",",$data['display_zone']);
62
+ }
63
+
64
+ $model = Mage::getModel('qixol/banner');
65
+ $model->setData($data)
66
+ ->setId($this->getRequest()->getParam('id'));
67
+
68
+ try {
69
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
70
+ $model->setCreatedTime(now())
71
+ ->setUpdateTime(now());
72
+ } else {
73
+ $model->setUpdateTime(now());
74
+ }
75
+
76
+ $model->save();
77
+
78
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully saved'));
79
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
80
+
81
+ if ($this->getRequest()->getParam('back')||$image_saved) {
82
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
83
+ return;
84
+ }
85
+ $this->_redirect('*/*/');
86
+ return;
87
+ } catch (Exception $e) {
88
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
89
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
90
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
91
+ return;
92
+ }
93
+ }
94
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Unable to find item to save'));
95
+ $this->_redirect('*/*/');
96
+ }
97
+
98
+ public function deleteAction() {
99
+ if ($this->getRequest()->getParam('id') > 0) {
100
+ try {
101
+ $model = Mage::getModel('qixol/banner')->load($this->getRequest()->getParam('id'));
102
+ $_helper = Mage::helper('qixol');
103
+ //$filePath = Mage::getBaseDir('media').DS.$_helper->updateDirSepereator($model->getFilename());
104
+ $model->delete();
105
+ //$this->removeFile($filePath);
106
+
107
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully deleted'));
108
+ $this->_redirect('*/*/');
109
+ } catch (Exception $e) {
110
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
111
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
112
+ }
113
+ }
114
+ $this->_redirect('*/*/');
115
+ }
116
+
117
+ public function massDeleteAction() {
118
+ $bannerIds = $this->getRequest()->getParam('banner');
119
+ if (!is_array($bannerIds)) {
120
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Please select item(s)'));
121
+ } else {
122
+ try {
123
+ foreach ($bannerIds as $bannerId) {
124
+ $model = Mage::getModel('qixol/banner')->load($bannerId);
125
+ $_helper = Mage::helper('qixol');
126
+ //$filePath = Mage::getBaseDir('media').DS.$_helper->updateDirSepereator($model->getFilename());
127
+ $model->delete();
128
+ //$this->removeFile($filePath);
129
+ }
130
+ Mage::getSingleton('adminhtml/session')->addSuccess(
131
+ Mage::helper('qixol')->__(
132
+ 'Total of %d record(s) were successfully deleted', count($bannerIds)
133
+ )
134
+ );
135
+ } catch (Exception $e) {
136
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
137
+ }
138
+ }
139
+ $this->_redirect('*/*/index');
140
+ }
141
+
142
+ public function massStatusAction() {
143
+ $bannerIds = $this->getRequest()->getParam('banner');
144
+ if (!is_array($bannerIds)) {
145
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
146
+ } else {
147
+ try {
148
+ foreach ($bannerIds as $bannerId) {
149
+ $banner = Mage::getSingleton('qixol/banner')
150
+ ->load($bannerId)
151
+ ->setStatus($this->getRequest()->getParam('status'))
152
+ ->setIsMassupdate(true)
153
+ ->save();
154
+ }
155
+ $this->_getSession()->addSuccess(
156
+ $this->__('Total of %d record(s) were successfully updated', count($bannerIds))
157
+ );
158
+ } catch (Exception $e) {
159
+ $this->_getSession()->addError($e->getMessage());
160
+ }
161
+ }
162
+ $this->_redirect('*/*/index');
163
+ }
164
+
165
+ public function exportCsvAction() {
166
+ $fileName = 'banner.csv';
167
+ $content = $this->getLayout()->createBlock('qixol/adminhtml_banner_grid')
168
+ ->getCsv();
169
+
170
+ $this->_sendUploadResponse($fileName, $content);
171
+ }
172
+
173
+ public function exportXmlAction() {
174
+ $fileName = 'banner.xml';
175
+ $content = $this->getLayout()->createBlock('qixol/adminhtml_banner_grid')
176
+ ->getXml();
177
+
178
+ $this->_sendUploadResponse($fileName, $content);
179
+ }
180
+
181
+ public function uploadAction()
182
+ {
183
+ try {
184
+ $uploader = new Mage_Core_Model_File_Uploader('image');
185
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
186
+ $uploader->addValidateCallback('catalog_product_image',
187
+ Mage::helper('catalog/image'), 'validateUploadFile');
188
+ $uploader->setAllowRenameFiles(true);
189
+ $uploader->setFilesDispersion(true);
190
+
191
+ // TODO: 'custom' and 'banners' to be read from config
192
+ // TODO: better folder / file naming convention
193
+ // $ext = substr($_FILES['filename']['name'], strrpos($_FILES['filename']['name'], '.') + 1);
194
+ // $fname = 'File-' . time() . '.' . $ext;
195
+ // $path = Mage::getBaseDir('media') . DS . 'custom' . DS . 'banners';
196
+ $result = $uploader->save(
197
+ Mage::getSingleton('catalog/product_media_config')->getBaseTmpMediaPath()
198
+ );
199
+
200
+ // Mage::dispatchEvent('catalog_product_gallery_upload_image_after', array(
201
+ // 'result' => $result,
202
+ // 'action' => $this
203
+ // ));
204
+
205
+ /**
206
+ * Workaround for prototype 1.7 methods "isJSON", "evalJSON" on Windows OS
207
+ */
208
+ $result['tmp_name'] = str_replace(DS, "/", $result['tmp_name']);
209
+ $result['path'] = str_replace(DS, "/", $result['path']);
210
+
211
+ $result['url'] = Mage::getSingleton('catalog/product_media_config')->getTmpMediaUrl($result['file']);
212
+ $result['file'] = $result['file'] . '.tmp';
213
+ $result['cookie'] = array(
214
+ 'name' => session_name(),
215
+ 'value' => $this->_getSession()->getSessionId(),
216
+ 'lifetime' => $this->_getSession()->getCookieLifetime(),
217
+ 'path' => $this->_getSession()->getCookiePath(),
218
+ 'domain' => $this->_getSession()->getCookieDomain()
219
+ );
220
+
221
+ } catch (Exception $e) {
222
+ $result = array(
223
+ 'error' => $e->getMessage(),
224
+ 'errorcode' => $e->getCode());
225
+ }
226
+
227
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
228
+ }
229
+
230
+ // public function addBannerImageAction() {
231
+ // $this->_forward('edit/bannerimage_edit');
232
+ // }
233
+ //
234
+ // protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream') {
235
+ // $response = $this->getResponse();
236
+ // $response->setHeader('HTTP/1.1 200 OK', '');
237
+ // $response->setHeader('Pragma', 'public', true);
238
+ // $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
239
+ // $response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
240
+ // $response->setHeader('Last-Modified', date('r'));
241
+ // $response->setHeader('Accept-Ranges', 'bytes');
242
+ // $response->setHeader('Content-Length', strlen($content));
243
+ // $response->setHeader('Content-type', $contentType);
244
+ // $response->setBody($content);
245
+ // $response->sendResponse();
246
+ // die;
247
+ // }
248
+
249
+ protected function removeFile($file) {
250
+ try {
251
+ $io = new Varien_Io_File();
252
+ $result = $io->rmdir($file, true);
253
+ } catch (Exception $e) {
254
+
255
+ }
256
+ }
257
+
258
+ }
app/code/community/Qixol/Promo/controllers/Adminhtml/BannerboxesController.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Adminhtml_BannerboxesController extends Mage_Adminhtml_Controller_action {
3
+
4
+ protected function _initAction() {
5
+ $this->loadLayout()
6
+ ->_setActiveMenu('qixol/bannerboxes')
7
+ ->_addBreadcrumb(Mage::helper('qixol')->__('Banner boxes Manager'), Mage::helper('qixol')->__('Banner boxes Manager'));
8
+
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction() {
13
+ $this->_initAction()
14
+ ->renderLayout();
15
+ }
16
+
17
+ public function editAction() {
18
+ $id = $this->getRequest()->getParam('id');
19
+ $model = Mage::getModel('qixol/bannerboxes')->load($id);
20
+
21
+ if ($model->getBannerBoxType() || $id == '') {
22
+
23
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
24
+ if (!empty($data)) {
25
+ $model->setData($data);
26
+ }
27
+
28
+ Mage::register('bannerbox_data', $model);
29
+
30
+ $this->loadLayout();
31
+ $this->_setActiveMenu('qixol/bannerboxes');
32
+
33
+ $this->_addBreadcrumb(Mage::helper('qixol')->__('Box Manager'), Mage::helper('qixol')->__('Box Manager'));
34
+
35
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
36
+
37
+ $this->_addContent($this->getLayout()->createBlock('qixol/adminhtml_bannerboxes_edit'))
38
+ ->_addLeft($this->getLayout()->createBlock('qixol/adminhtml_bannerboxes_edit_tabs'));
39
+ $version = substr(Mage::getVersion(), 0, 3);
40
+ $this->renderLayout();
41
+ } else {
42
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Item does not exist'));
43
+ $this->_redirect('*/*/');
44
+ }
45
+ }
46
+
47
+ public function newAction() {
48
+ $this->_forward('edit');
49
+ }
50
+
51
+ public function saveAction() {
52
+ $imagedata = array();
53
+
54
+ if ($data = $this->getRequest()->getPost()) {
55
+ $model = Mage::getModel('qixol/bannerboxes');
56
+ $model->setData($data)
57
+ ->setId($this->getRequest()->getParam('banner_box_type'));
58
+
59
+ try {
60
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
61
+ $model->setCreatedTime(now())
62
+ ->setUpdateTime(now());
63
+ } else {
64
+ $model->setUpdateTime(now());
65
+ }
66
+
67
+ $model->save();
68
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully saved'));
69
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
70
+
71
+ if ($this->getRequest()->getParam('back')) {
72
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
73
+ return;
74
+ }
75
+ $this->_redirect('*/*/');
76
+ return;
77
+ } catch (Exception $e) {
78
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
79
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
80
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
81
+ return;
82
+ }
83
+ }
84
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Unable to find item to save'));
85
+ $this->_redirect('*/*/');
86
+ }
87
+
88
+ public function deleteAction() {
89
+ if ($this->getRequest()->getParam('id') !='') {
90
+ try {
91
+ $model = Mage::getModel('qixol/bannerboxes')->load($this->getRequest()->getParam('id'));
92
+ $_helper = Mage::helper('qixol');
93
+ $model->delete();
94
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully deleted'));
95
+ $this->_redirect('*/*/');
96
+ } catch (Exception $e) {
97
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
98
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
99
+ }
100
+ }
101
+ $this->_redirect('*/*/');
102
+ }
103
+
104
+
105
+ }
app/code/community/Qixol/Promo/controllers/Adminhtml/BannerimageController.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Adminhtml_BannerimageController extends Mage_Adminhtml_Controller_action {
3
+
4
+ protected function _initAction() {
5
+ $this->loadLayout()
6
+ ->_setActiveMenu('qixol/items')
7
+ ->_addBreadcrumb(Mage::helper('qixol')->__('Banner Image Manager'), Mage::helper('qixol')->__('Banner Image Manager'));
8
+
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction() {
13
+ $this->_initAction()
14
+ ->renderLayout();
15
+ }
16
+
17
+ public function editAction() {
18
+ $id = $this->getRequest()->getParam('id');
19
+ $model = Mage::getModel('qixol/bannerimage')->load($id);
20
+
21
+ if ($model->getId() || $id == 0) {
22
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
23
+ if (!empty($data)) {
24
+ $model->setData($data);
25
+ }
26
+
27
+
28
+ Mage::register('bannerimage_data', $model);
29
+
30
+ $this->loadLayout();
31
+ $this->_setActiveMenu('qixol/items');
32
+
33
+ $this->_addBreadcrumb(Mage::helper('qixol')->__('Banner Image Manager'), Mage::helper('qixol')->__('Banner Image Manager'));
34
+ $this->_addBreadcrumb(Mage::helper('qixol')->__('Item Banner'), Mage::helper('qixol')->__('Item Banner'));
35
+
36
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
37
+
38
+ $this->_addContent($this->getLayout()->createBlock('qixol/adminhtml_bannerimage_edit'))
39
+ ->_addLeft($this->getLayout()->createBlock('qixol/adminhtml_bannerimage_edit_tabs'));
40
+ $version = substr(Mage::getVersion(), 0, 3);
41
+ if (($version=='1.4' || $version=='1.5') && Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
42
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
43
+ }
44
+ $this->renderLayout();
45
+ } else {
46
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Item does not exist'));
47
+ $this->_redirect('*/*/');
48
+ }
49
+ }
50
+
51
+ public function newAction() {
52
+ $this->_forward('edit');
53
+ }
54
+
55
+ public function saveAction() {
56
+ $imagedata = array();
57
+ if (!empty($_FILES['filename']['name'])) {
58
+ try {
59
+ $ext = substr($_FILES['filename']['name'], strrpos($_FILES['filename']['name'], '.') + 1);
60
+ $fname = 'File-' . time() . '.' . $ext;
61
+ $uploader = new Varien_File_Uploader('filename');
62
+ $uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png')); // or pdf or anything
63
+
64
+ $uploader->setAllowRenameFiles(true);
65
+ $uploader->setFilesDispersion(false);
66
+
67
+ $path = Mage::getBaseDir('media').DS.'custom'.DS.'banners';
68
+
69
+ $uploader->save($path, $fname);
70
+
71
+ $imagedata['filename'] = 'custom/banners/'.$fname;
72
+ } catch (Exception $e) {
73
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
74
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
75
+ return;
76
+ }
77
+ }
78
+ if ($data = $this->getRequest()->getPost()) {
79
+ if (!empty($imagedata['filename'])) {
80
+ $data['filename'] = $imagedata['filename'];
81
+ } else {
82
+ if (isset($data['filename']['delete']) && $data['filename']['delete'] == 1) {
83
+ if ($data['filename']['value'] != '') {
84
+ $_helper = Mage::helper('qixol');
85
+ $this->removeFile(Mage::getBaseDir('media').DS.'custom'.DS.'banners'.DS.$_helper->updateDirSepereator($data['filename']['value']));
86
+ }
87
+ $data['filename'] = '';
88
+ } else {
89
+ unset($data['filename']);
90
+ }
91
+ }
92
+ $model = Mage::getModel('qixol/bannerimage');
93
+ $model->setData($data)
94
+ ->setId($this->getRequest()->getParam('id'));
95
+
96
+ try {
97
+ $model->save();
98
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully saved'));
99
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
100
+
101
+ $this->_redirect('*/adminhtml_banner/edit', array('id' => $this->getRequest()->getParam('banner_id')));
102
+ return;
103
+ } catch (Exception $e) {
104
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
105
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
106
+ $this->_redirect('*/adminhtml_banner/edit', array('id' => $this->getRequest()->getParam('banner_id')));
107
+ return;
108
+ }
109
+ }
110
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Unable to find item to save'));
111
+ $this->_redirect('*/adminhtml_banner/');
112
+ }
113
+
114
+ public function deleteAction() {
115
+ if ($this->getRequest()->getParam('id') > 0) {
116
+ try {
117
+ $model = Mage::getModel('qixol/banner')->load($this->getRequest()->getParam('id'));
118
+ $_helper = Mage::helper('qixol');
119
+ //$filePath = Mage::getBaseDir('media').DS.$_helper->updateDirSepereator($model->getFilename());
120
+ $model->delete();
121
+ //$this->removeFile($filePath);
122
+
123
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully deleted'));
124
+ $this->_redirect('*/*/');
125
+ } catch (Exception $e) {
126
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
127
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
128
+ }
129
+ }
130
+ $this->_redirect('*/*/');
131
+ }
132
+
133
+ public function massDeleteAction() {
134
+ $bannerIds = $this->getRequest()->getParam('banner');
135
+ if (!is_array($bannerIds)) {
136
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Please select item(s)'));
137
+ } else {
138
+ try {
139
+ foreach ($bannerIds as $bannerId) {
140
+ $model = Mage::getModel('qixol/banner')->load($bannerId);
141
+ $_helper = Mage::helper('qixol');
142
+ //$filePath = Mage::getBaseDir('media').DS.$_helper->updateDirSepereator($model->getFilename());
143
+ $model->delete();
144
+ //$this->removeFile($filePath);
145
+ }
146
+ Mage::getSingleton('adminhtml/session')->addSuccess(
147
+ Mage::helper('qixol')->__(
148
+ 'Total of %d record(s) were successfully deleted', count($bannerIds)
149
+ )
150
+ );
151
+ } catch (Exception $e) {
152
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
153
+ }
154
+ }
155
+ $this->_redirect('*/*/index');
156
+ }
157
+
158
+ public function massStatusAction() {
159
+ $bannerIds = $this->getRequest()->getParam('banner');
160
+ if (!is_array($bannerIds)) {
161
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
162
+ } else {
163
+ try {
164
+ foreach ($bannerIds as $bannerId) {
165
+ $banner = Mage::getSingleton('qixol/banner')
166
+ ->load($bannerId)
167
+ ->setStatus($this->getRequest()->getParam('status'))
168
+ ->setIsMassupdate(true)
169
+ ->save();
170
+ }
171
+ $this->_getSession()->addSuccess(
172
+ $this->__('Total of %d record(s) were successfully updated', count($bannerIds))
173
+ );
174
+ } catch (Exception $e) {
175
+ $this->_getSession()->addError($e->getMessage());
176
+ }
177
+ }
178
+ $this->_redirect('*/*/index');
179
+ }
180
+
181
+ public function uploadAction()
182
+ {
183
+ try {
184
+ $uploader = new Mage_Core_Model_File_Uploader('image');
185
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
186
+ $uploader->addValidateCallback('catalog_product_image',
187
+ Mage::helper('catalog/image'), 'validateUploadFile');
188
+ $uploader->setAllowRenameFiles(true);
189
+ $uploader->setFilesDispersion(true);
190
+
191
+ // TODO: 'custom' and 'banners' to be read from config
192
+ // TODO: better folder / file naming convention
193
+ // $ext = substr($_FILES['filename']['name'], strrpos($_FILES['filename']['name'], '.') + 1);
194
+ // $fname = 'File-' . time() . '.' . $ext;
195
+ // $path = Mage::getBaseDir('media') . DS . 'custom' . DS . 'banners';
196
+ $result = $uploader->save(
197
+ Mage::getSingleton('catalog/product_media_config')->getBaseTmpMediaPath()
198
+ );
199
+
200
+ // Mage::dispatchEvent('catalog_product_gallery_upload_image_after', array(
201
+ // 'result' => $result,
202
+ // 'action' => $this
203
+ // ));
204
+
205
+ /**
206
+ * Workaround for prototype 1.7 methods "isJSON", "evalJSON" on Windows OS
207
+ */
208
+ $result['tmp_name'] = str_replace(DS, "/", $result['tmp_name']);
209
+ $result['path'] = str_replace(DS, "/", $result['path']);
210
+
211
+ $result['url'] = Mage::getSingleton('catalog/product_media_config')->getTmpMediaUrl($result['file']);
212
+ $result['file'] = $result['file'] . '.tmp';
213
+ $result['cookie'] = array(
214
+ 'name' => session_name(),
215
+ 'value' => $this->_getSession()->getSessionId(),
216
+ 'lifetime' => $this->_getSession()->getCookieLifetime(),
217
+ 'path' => $this->_getSession()->getCookiePath(),
218
+ 'domain' => $this->_getSession()->getCookieDomain()
219
+ );
220
+
221
+ } catch (Exception $e) {
222
+ $result = array(
223
+ 'error' => $e->getMessage(),
224
+ 'errorcode' => $e->getCode());
225
+ }
226
+
227
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
228
+ }
229
+
230
+ public function addBannerImageAction() {
231
+ $this->_forward('edit');
232
+ }
233
+
234
+ // protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream') {
235
+ // $response = $this->getResponse();
236
+ // $response->setHeader('HTTP/1.1 200 OK', '');
237
+ // $response->setHeader('Pragma', 'public', true);
238
+ // $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
239
+ // $response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
240
+ // $response->setHeader('Last-Modified', date('r'));
241
+ // $response->setHeader('Accept-Ranges', 'bytes');
242
+ // $response->setHeader('Content-Length', strlen($content));
243
+ // $response->setHeader('Content-type', $contentType);
244
+ // $response->setBody($content);
245
+ // $response->sendResponse();
246
+ // die;
247
+ // }
248
+
249
+ protected function removeFile($file) {
250
+ try {
251
+ $io = new Varien_Io_File();
252
+ $result = $io->rmdir($file, true);
253
+ } catch (Exception $e) {
254
+
255
+ }
256
+ }
257
+
258
+ }
app/code/community/Qixol/Promo/controllers/Adminhtml/CustomergrouspmapController.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Adminhtml_CustomergrouspmapController extends Mage_Adminhtml_Controller_action {
3
+
4
+ protected function _initAction() {
5
+ $this->loadLayout()
6
+ ->_setActiveMenu('qixol/customergrouspmap')
7
+ ->_addBreadcrumb(Mage::helper('qixol')->__('Customer Group Integration Codes'), Mage::helper('qixol')->__('Customer Group Integration Codes'));
8
+
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction() {
13
+ $this->_initAction()
14
+ ->renderLayout();
15
+ }
16
+
17
+ public function editAction() {
18
+ $id = $this->getRequest()->getParam('id');
19
+ $model = Mage::getModel('qixol/customergrouspmap')->load($id);
20
+
21
+ if ($model->getCustomerGroupName() || $id == '') {
22
+
23
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
24
+ if (!empty($data)) {
25
+ $model->setData($data);
26
+ }
27
+
28
+ Mage::register('customergrouspmap_data', $model);
29
+
30
+ $this->loadLayout();
31
+ $this->_setActiveMenu('qixol/customergrouspmap');
32
+
33
+ $this->_addBreadcrumb(Mage::helper('qixol')->__('Customer Group Integration Codes'), Mage::helper('qixol')->__('Customer Group Integration Codes'));
34
+
35
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
36
+
37
+ $this->_addContent($this->getLayout()->createBlock('qixol/adminhtml_customergrouspmap_edit'))
38
+ ->_addLeft($this->getLayout()->createBlock('qixol/adminhtml_customergrouspmap_edit_tabs'));
39
+ $version = substr(Mage::getVersion(), 0, 3);
40
+ $this->renderLayout();
41
+ } else {
42
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Item does not exist'));
43
+ $this->_redirect('*/*/');
44
+ }
45
+ }
46
+
47
+ public function newAction() {
48
+ $this->_forward('edit');
49
+ }
50
+
51
+ public function saveAction() {
52
+ $imagedata = array();
53
+
54
+ if ($data = $this->getRequest()->getPost()) {
55
+ $model = Mage::getModel('qixol/customergrouspmap');
56
+ $model->setData($data)
57
+ ->setId($this->getRequest()->getParam('customer_group_name'));
58
+
59
+ try {
60
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
61
+ $model->setCreatedTime(now())
62
+ ->setUpdateTime(now());
63
+ } else {
64
+ $model->setUpdateTime(now());
65
+ }
66
+
67
+ $model->save();
68
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully saved'));
69
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
70
+
71
+ if ($this->getRequest()->getParam('back')) {
72
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
73
+ return;
74
+ }
75
+ $this->_redirect('*/*/');
76
+ return;
77
+ } catch (Exception $e) {
78
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
79
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
80
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
81
+ return;
82
+ }
83
+ }
84
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Unable to find item to save'));
85
+ $this->_redirect('*/*/');
86
+ }
87
+
88
+ public function deleteAction() {
89
+ if ($this->getRequest()->getParam('id') !='') {
90
+ try {
91
+ $model = Mage::getModel('qixol/customergrouspmap')->load($this->getRequest()->getParam('id'));
92
+ $_helper = Mage::helper('qixol');
93
+ $model->delete();
94
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully deleted'));
95
+ $this->_redirect('*/*/');
96
+ } catch (Exception $e) {
97
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
98
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
99
+ }
100
+ }
101
+ $this->_redirect('*/*/');
102
+ }
103
+
104
+
105
+ }
app/code/community/Qixol/Promo/controllers/Adminhtml/QixolbackendController.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Adminhtml_QixolbackendController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->_setActiveMenu('qixol/items');
8
+ $this->_title($this->__("Qixol"));
9
+ $this->renderLayout();
10
+ }
11
+ }
app/code/community/Qixol/Promo/controllers/Adminhtml/ShippingmapController.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Adminhtml_ShippingmapController extends Mage_Adminhtml_Controller_action {
3
+
4
+ protected function _initAction() {
5
+ $this->loadLayout()
6
+ ->_setActiveMenu('qixol/shippingmap')
7
+ ->_addBreadcrumb(Mage::helper('qixol')->__('Shipping Method Integration Codes'), Mage::helper('qixol')->__('Shipping Method Integration Codes'));
8
+
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction() {
13
+ $this->_initAction()
14
+ ->renderLayout();
15
+ }
16
+
17
+ public function editAction() {
18
+ $id = $this->getRequest()->getParam('id');
19
+ $model = Mage::getModel('qixol/shippingmap')->load($id);
20
+
21
+ if ($model->getShippingName() || $id == '') {
22
+
23
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
24
+ if (!empty($data)) {
25
+ $model->setData($data);
26
+ }
27
+
28
+ Mage::register('shippingmap_data', $model);
29
+
30
+ $this->loadLayout();
31
+ $this->_setActiveMenu('qixol/shippingmap');
32
+
33
+ $this->_addBreadcrumb(Mage::helper('qixol')->__('Shippings Map'), Mage::helper('qixol')->__('Shippings Map'));
34
+
35
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
36
+
37
+ $this->_addContent($this->getLayout()->createBlock('qixol/adminhtml_shippingmap_edit'))
38
+ ->_addLeft($this->getLayout()->createBlock('qixol/adminhtml_shippingmap_edit_tabs'));
39
+ $version = substr(Mage::getVersion(), 0, 3);
40
+ $this->renderLayout();
41
+ } else {
42
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Item does not exist'));
43
+ $this->_redirect('*/*/');
44
+ }
45
+ }
46
+
47
+ public function newAction() {
48
+ $this->_forward('edit');
49
+ }
50
+
51
+ public function saveAction() {
52
+ $imagedata = array();
53
+
54
+ if ($data = $this->getRequest()->getPost()) {
55
+ $model = Mage::getModel('qixol/shippingmap');
56
+ $model->setData($data)
57
+ ->setId($this->getRequest()->getParam('shipping_name'));
58
+
59
+ try {
60
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
61
+ $model->setCreatedTime(now())
62
+ ->setUpdateTime(now());
63
+ } else {
64
+ $model->setUpdateTime(now());
65
+ }
66
+
67
+ $model->save();
68
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully saved'));
69
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
70
+
71
+ if ($this->getRequest()->getParam('back')) {
72
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
73
+ return;
74
+ }
75
+ $this->_redirect('*/*/');
76
+ return;
77
+ } catch (Exception $e) {
78
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
79
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
80
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
81
+ return;
82
+ }
83
+ }
84
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Unable to find item to save'));
85
+ $this->_redirect('*/*/');
86
+ }
87
+
88
+ public function deleteAction() {
89
+ if ($this->getRequest()->getParam('id') !='') {
90
+ try {
91
+ $model = Mage::getModel('qixol/shippingmap')->load($this->getRequest()->getParam('id'));
92
+ $_helper = Mage::helper('qixol');
93
+ $model->delete();
94
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully deleted'));
95
+ $this->_redirect('*/*/');
96
+ } catch (Exception $e) {
97
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
98
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
99
+ }
100
+ }
101
+ $this->_redirect('*/*/');
102
+ }
103
+
104
+
105
+ }
app/code/community/Qixol/Promo/controllers/Adminhtml/StickerController.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Adminhtml_StickerController extends Mage_Adminhtml_Controller_action {
3
+
4
+ protected function _initAction() {
5
+ $this->loadLayout()
6
+ ->_setActiveMenu('qixol/items')
7
+ ->_addBreadcrumb(Mage::helper('qixol')->__('Sticker Manager'), Mage::helper('qixol')->__('Sticker Manager'));
8
+
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction() {
13
+ $this->_initAction()
14
+ ->renderLayout();
15
+ }
16
+
17
+ public function editAction() {
18
+ $id = $this->getRequest()->getParam('id');
19
+ $model = Mage::getModel('qixol/sticker')->load($id);
20
+
21
+ if ($model->getId() || $id == 0) {
22
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
23
+ if (!empty($data)) {
24
+ $model->setData($data);
25
+ }
26
+
27
+ Mage::register('sticker_data', $model);
28
+
29
+ $this->loadLayout();
30
+ $this->_setActiveMenu('qixol/items');
31
+
32
+ $this->_addBreadcrumb(Mage::helper('qixol')->__('Sticker Manager'), Mage::helper('qixol')->__('Sticker Manager'));
33
+ $this->_addBreadcrumb(Mage::helper('qixol')->__('Item Sticker'), Mage::helper('qixol')->__('Item Sticker'));
34
+
35
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
36
+
37
+ $this->_addContent($this->getLayout()->createBlock('qixol/adminhtml_sticker_edit'))
38
+ ->_addLeft($this->getLayout()->createBlock('qixol/adminhtml_sticker_edit_tabs'));
39
+ $version = substr(Mage::getVersion(), 0, 3);
40
+ if (($version=='1.4' || $version=='1.5') && Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
41
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
42
+ }
43
+ $this->renderLayout();
44
+ } else {
45
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Sticker does not exist'));
46
+ $this->_redirect('*/*/');
47
+ }
48
+ }
49
+
50
+ public function newAction() {
51
+ $this->_forward('edit');
52
+ }
53
+
54
+ public function saveAction() {
55
+ $imagedata = array();
56
+ if (!empty($_FILES['filename']['name'])) {
57
+ try {
58
+ $ext = substr($_FILES['filename']['name'], strrpos($_FILES['filename']['name'], '.') + 1);
59
+ $fname = 'File-' . time() . '.' . $ext;
60
+ $uploader = new Varien_File_Uploader('filename');
61
+ $uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png')); // or pdf or anything
62
+
63
+ $uploader->setAllowRenameFiles(true);
64
+ $uploader->setFilesDispersion(false);
65
+
66
+ $path = Mage::getBaseDir('media').DS.'custom'.DS.'stickers';
67
+
68
+ $uploader->save($path, $fname);
69
+
70
+ $imagedata['filename'] = 'custom/stickers/'.$fname;
71
+ } catch (Exception $e) {
72
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
73
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
74
+ return;
75
+ }
76
+ }
77
+ if ($data = $this->getRequest()->getPost()) {
78
+ if (!empty($imagedata['filename'])) {
79
+ $data['filename'] = $imagedata['filename'];
80
+ } else {
81
+ if (isset($data['filename']['delete']) && $data['filename']['delete'] == 1) {
82
+ if ($data['filename']['value'] != '') {
83
+ $_helper = Mage::helper('qixol');
84
+ $this->removeFile(Mage::getBaseDir('media').DS.'custom'.DS.'stickers'.DS.$_helper->updateDirSepereator($data['filename']['value']));
85
+ }
86
+ $data['filename'] = '';
87
+ } else {
88
+ unset($data['filename']);
89
+ }
90
+ }
91
+ $model = Mage::getModel('qixol/sticker');
92
+ $model->setData($data)
93
+ ->setId($this->getRequest()->getParam('id'));
94
+
95
+ try {
96
+ $model->save();
97
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully saved'));
98
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
99
+
100
+ if ($this->getRequest()->getParam('back')) {
101
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
102
+ return;
103
+ }
104
+ $this->_redirect('*/*/');
105
+ return;
106
+ } catch (Exception $e) {
107
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
108
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
109
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
110
+ return;
111
+ }
112
+ }
113
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Unable to find item to save'));
114
+ $this->_redirect('*/*/');
115
+ }
116
+
117
+ public function deleteAction() {
118
+ if ($this->getRequest()->getParam('id') > 0) {
119
+ try {
120
+ $model = Mage::getModel('qixol/sticker')->load($this->getRequest()->getParam('id'));
121
+ $_helper = Mage::helper('qixol');
122
+ $filePath = Mage::getBaseDir('media').DS.'custom'.DS.'stickers'.DS.$_helper->updateDirSepereator($model->getFilename());
123
+ $model->delete();
124
+ $this->removeFile($filePath);
125
+
126
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully deleted'));
127
+ $this->_redirect('*/*/');
128
+ } catch (Exception $e) {
129
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
130
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
131
+ }
132
+ }
133
+ $this->_redirect('*/*/');
134
+ }
135
+
136
+ public function massDeleteAction() {
137
+ $bannerIds = $this->getRequest()->getParam('sticker');
138
+ if (!is_array($bannerIds)) {
139
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Please select item(s)'));
140
+ } else {
141
+ try {
142
+ foreach ($bannerIds as $bannerId) {
143
+ $model = Mage::getModel('qixol/sticker')->load($bannerId);
144
+ $_helper = Mage::helper('qixol');
145
+ $filePath = Mage::getBaseDir('media').DS.'custom'.DS.'stickers'.DS.$_helper->updateDirSepereator($model->getFilename());
146
+ $model->delete();
147
+ $this->removeFile($filePath);
148
+ }
149
+ Mage::getSingleton('adminhtml/session')->addSuccess(
150
+ Mage::helper('qixol')->__(
151
+ 'Total of %d record(s) were successfully deleted', count($bannerIds)
152
+ )
153
+ );
154
+ } catch (Exception $e) {
155
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
156
+ }
157
+ }
158
+ $this->_redirect('*/*/index');
159
+ }
160
+
161
+ public function massStatusAction() {
162
+ $bannerIds = $this->getRequest()->getParam('sticker');
163
+ if (!is_array($bannerIds)) {
164
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
165
+ } else {
166
+ try {
167
+ foreach ($bannerIds as $bannerId) {
168
+ $banner = Mage::getSingleton('qixol/sticker')
169
+ ->load($bannerId)
170
+ ->setStatus($this->getRequest()->getParam('status'))
171
+ ->setIsMassupdate(true)
172
+ ->save();
173
+ }
174
+ $this->_getSession()->addSuccess(
175
+ $this->__('Total of %d record(s) were successfully updated', count($bannerIds))
176
+ );
177
+ } catch (Exception $e) {
178
+ $this->_getSession()->addError($e->getMessage());
179
+ }
180
+ }
181
+ $this->_redirect('*/*/index');
182
+ }
183
+
184
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream') {
185
+ $response = $this->getResponse();
186
+ $response->setHeader('HTTP/1.1 200 OK', '');
187
+ $response->setHeader('Pragma', 'public', true);
188
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
189
+ $response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
190
+ $response->setHeader('Last-Modified', date('r'));
191
+ $response->setHeader('Accept-Ranges', 'bytes');
192
+ $response->setHeader('Content-Length', strlen($content));
193
+ $response->setHeader('Content-type', $contentType);
194
+ $response->setBody($content);
195
+ $response->sendResponse();
196
+ die;
197
+ }
198
+
199
+ protected function removeFile($file) {
200
+ try {
201
+ $io = new Varien_Io_File();
202
+ $result = $io->rmdir($file, true);
203
+ } catch (Exception $e) {
204
+
205
+ }
206
+ }
207
+
208
+ }
app/code/community/Qixol/Promo/controllers/Adminhtml/StoresmapController.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_Adminhtml_StoresmapController extends Mage_Adminhtml_Controller_action {
3
+
4
+ protected function _initAction() {
5
+ $this->loadLayout()
6
+ ->_setActiveMenu('qixol/storesmap')
7
+ ->_addBreadcrumb(Mage::helper('qixol')->__('Store Integration Codes'), Mage::helper('qixol')->__('Store Integration Codes'));
8
+
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction() {
13
+ $this->_initAction()
14
+ ->renderLayout();
15
+ }
16
+
17
+ public function editAction() {
18
+ $id = $this->getRequest()->getParam('id');
19
+ $model = Mage::getModel('qixol/storesmap')->load($id);
20
+
21
+ if ($model->getStoreName() || $id == '') {
22
+
23
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
24
+ if (!empty($data)) {
25
+ $model->setData($data);
26
+ }
27
+
28
+ Mage::register('storesmap_data', $model);
29
+
30
+ $this->loadLayout();
31
+ $this->_setActiveMenu('qixol/storesmap');
32
+
33
+ $this->_addBreadcrumb(Mage::helper('qixol')->__('Stores Map'), Mage::helper('qixol')->__('Stores Map'));
34
+
35
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
36
+
37
+ $this->_addContent($this->getLayout()->createBlock('qixol/adminhtml_storesmap_edit'))
38
+ ->_addLeft($this->getLayout()->createBlock('qixol/adminhtml_storesmap_edit_tabs'));
39
+ $version = substr(Mage::getVersion(), 0, 3);
40
+ $this->renderLayout();
41
+ } else {
42
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Item does not exist'));
43
+ $this->_redirect('*/*/');
44
+ }
45
+ }
46
+
47
+ public function newAction() {
48
+ $this->_forward('edit');
49
+ }
50
+
51
+ public function saveAction() {
52
+ $imagedata = array();
53
+
54
+ if ($data = $this->getRequest()->getPost()) {
55
+ $model = Mage::getModel('qixol/storesmap');
56
+ $model->setData($data)
57
+ ->setId($this->getRequest()->getParam('store_name'));
58
+
59
+ try {
60
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
61
+ $model->setCreatedTime(now())
62
+ ->setUpdateTime(now());
63
+ } else {
64
+ $model->setUpdateTime(now());
65
+ }
66
+
67
+ $model->save();
68
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully saved'));
69
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
70
+
71
+ if ($this->getRequest()->getParam('back')) {
72
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
73
+ return;
74
+ }
75
+ $this->_redirect('*/*/');
76
+ return;
77
+ } catch (Exception $e) {
78
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
79
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
80
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
81
+ return;
82
+ }
83
+ }
84
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('qixol')->__('Unable to find item to save'));
85
+ $this->_redirect('*/*/');
86
+ }
87
+
88
+ public function deleteAction() {
89
+ if ($this->getRequest()->getParam('id') !='') {
90
+ try {
91
+ $model = Mage::getModel('qixol/storesmap')->load($this->getRequest()->getParam('id'));
92
+ $_helper = Mage::helper('qixol');
93
+ $model->delete();
94
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('qixol')->__('Item was successfully deleted'));
95
+ $this->_redirect('*/*/');
96
+ } catch (Exception $e) {
97
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
98
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
99
+ }
100
+ }
101
+ $this->_redirect('*/*/');
102
+ }
103
+
104
+
105
+ }
app/code/community/Qixol/Promo/controllers/AjaxController.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_AjaxController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ var $_logFile;
5
+
6
+ public function UpdateExportStatusAction()
7
+ {
8
+ $_hlp = Mage::helper('qixol');
9
+ $export = Mage::getModel('qixol/sinch');
10
+ $message_output = '';
11
+ $finished = true;
12
+ $error = false;
13
+ // TODO: near duplicate of code in Startexportbutton.php
14
+ $last_export_statuses = $export->getDataOfLatestExport();
15
+ foreach ($last_export_statuses as $last_export_status)
16
+ {
17
+ $message = $last_export_status['last_message'];
18
+ switch ($message)
19
+ {
20
+ case 'error':
21
+ $message_output .= '<hr /><p class="sinch-error">';
22
+ $message_output .= $last_export_status['export_what'];
23
+ $message_output .= ' export failed</p><p>';
24
+ $message_output .= $last_export_status['exports_start'];
25
+ $message_output .= '</p><p>';
26
+ $message_output .= $last_export_status['status_export_message'];
27
+ $message_output .= '</p>';
28
+ $error = true;
29
+ break;
30
+ case 'success':
31
+ $message_output .= '<hr/><p class="sinch-success">';
32
+ $message_output .= $last_export_status['export_what'];
33
+ $message_output .= ' exported succesfully</p>';
34
+ $message_output .= '<p>';
35
+ $message_output .= $last_export_status['exports_start'];
36
+ $message_output .= '</p>';
37
+ break;
38
+ case 'process':
39
+ $message_output .= '<hr/><p>';
40
+ $message_output .= $last_export_status['export_what'];
41
+ $message_output .= ' is running now</p>';
42
+ $message_output .= '<p>';
43
+ $message_output .= $last_export_status['exports_start'];
44
+ $message_output .= '</p>';
45
+ $finished = false;
46
+ break;
47
+ // TODO: not started / not enabled?
48
+ default:
49
+ break;
50
+ }
51
+ }
52
+
53
+ if ($message_output!='') {
54
+ print '{ "error": "'.$error.'", "message": "'.addslashes(nl2br((string)$message_output)).'", "finished": "'. $finished .'"}';
55
+ }
56
+ else{
57
+ print '{ "message": "", "finished": "0"}';
58
+ }
59
+
60
+ return;
61
+ }
62
+
63
+
64
+ public function UpdateImportStatusAction() {
65
+
66
+ $_hlp = Mage::helper('qixol');
67
+ $import = Mage::getModel('qixol/sinch');
68
+ $message_output = '';
69
+ $finished = true;
70
+ $error = false;
71
+ // TODO: near duplicate of code in Startimportbutton.php
72
+ $last_import_statuses = $import->getDataOfLatestImport();
73
+ foreach ($last_import_statuses as $last_import_status)
74
+ {
75
+ $message = $last_import_status['last_message'];
76
+ switch ($message)
77
+ {
78
+ case 'error':
79
+ $message_output .= '<hr /><p class="sinch-error">';
80
+ $message_output .= $last_import_status['import_what'];
81
+ $message_output .= ' import failed</p><p>';
82
+ $message_output .= $last_import_status['imports_start'];
83
+ $message_output .= '</p><p>';
84
+ $message_output .= $last_import_status['status_import_message'];
85
+ $message_output .= '</p>';
86
+ $error = true;
87
+ break;
88
+ case 'success':
89
+ $message_output .= '<hr/><p class="sinch-success">';
90
+ $message_output .= $last_import_status['import_what'];
91
+ $message_output .= ' imported succesfully</p>';
92
+ $message_output .= '<p>';
93
+ $message_output .= $last_import_status['imports_start'];
94
+ $message_output .= '</p>';
95
+ break;
96
+ case 'process':
97
+ $message_output .= '<hr/><p>';
98
+ $message_output .= $last_import_status['import_what'];
99
+ $message_output .= ' is running now</p>';
100
+ $message_output .= '<p>';
101
+ $message_output .= $last_import_status['imports_start'];
102
+ $message_output .= '</p>';
103
+ $finished = false;
104
+ break;
105
+ // TODO: not started / not enabled?
106
+ default:
107
+ break;
108
+ }
109
+ }
110
+
111
+ if ($message_output!='') {
112
+ print '{ "error": "'.$error.'", "message": "'.addslashes(nl2br((string)$message_output)).'", "finished": "'. $finished .'"}';
113
+ }
114
+ else{
115
+ print '{ "message": "", "finished": "0"}';
116
+ }
117
+
118
+ return;
119
+ }
120
+
121
+ public function indexAction(){
122
+ $export=Mage::getModel('qixol/sinch');
123
+ //echo "Start export <br>";
124
+ //$dir = dirname(__FILE__);
125
+ $export->run_export();
126
+ //exec("nohup ".$sinch->php_run_string.$dir."/../sinch_import_start_ajax.php > /dev/null & echo $!");
127
+ //echo "Finish export<br>";
128
+
129
+ }
130
+
131
+ public function ExportProductAction(){
132
+ $export=Mage::getModel('qixol/sinch');
133
+ //echo "Start export <br>";
134
+ //$dir = dirname(__FILE__);
135
+ $export->run_export();
136
+ //exec("nohup ".$sinch->php_run_string.$dir."/../sinch_import_start_ajax.php > /dev/null & echo $!");
137
+ //echo "Finish export<br>";
138
+
139
+ }
140
+
141
+ public function ImportPromotionAction(){
142
+ $export=Mage::getModel('qixol/sinch');
143
+ //echo "Start export <br>";
144
+ //$dir = dirname(__FILE__);
145
+ $export->run_import();
146
+ //exec("nohup ".$sinch->php_run_string.$dir."/../sinch_import_start_ajax.php > /dev/null & echo $!");
147
+ //echo "Finish export<br>";
148
+
149
+ }
150
+
151
+ }
152
+ ?>
app/code/community/Qixol/Promo/controllers/CartController.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage/Checkout/controllers/CartController.php';
3
+ class Qixol_Promo_CartController extends Mage_Checkout_CartController {
4
+
5
+ public function applypointsAction() {
6
+ global $_SESSION;
7
+ $_Cart=Mage::getModel('checkout/cart');
8
+ $session = Mage::getSingleton('checkout/session');
9
+ if (!$_Cart->getQuote()->getItemsCount()) {
10
+ $session->addError($this->__('Emopty shopping cart!.'));
11
+ $this->_redirect('checkout/cart');
12
+ return;
13
+ }
14
+ if ($this->getRequest()->getParam('removepoints') == 1) {
15
+ $points_amount='';
16
+ Mage::getSingleton('customer/session')->setPointsAmount($points_amount);
17
+ $session->addSuccess($this->__('Points was canceled.'));
18
+ }
19
+ else {
20
+ $points_amount = (string) $this->getRequest()->getParam('reward_points');
21
+ if ((int)Mage::getStoreConfig('qixol/issuedpoints/convertrate')>0)
22
+ $points_amount_money=$points_amount/(int)Mage::getStoreConfig('qixol/issuedpoints/convertrate');
23
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
24
+ if ($customerId==0) {
25
+ $session->addError($this->__('Login First.'));
26
+ } else {
27
+
28
+ $validtotal = $_Cart->getQuote()->getSubtotal();
29
+ $bonuspoints = Mage::getModel('qixol/bonuspoints')->load($customerId);
30
+ $leftpoints = $bonuspoints->getCurrentPoints();
31
+
32
+ if (isset($_SESSION['qixol_quoted_items']['cart_data']['deliverytotaldiscount'])&&$_SESSION['qixol_quoted_items']['cart_data']['deliverytotaldiscount']>0){
33
+ $validtotal-=$_SESSION['qixol_quoted_items']['cart_data']['deliverytotaldiscount'];
34
+ }
35
+ if (isset($_SESSION['qixol_quoted_items']['cart_data']['totaldiscount'])&&$_SESSION['qixol_quoted_items']['cart_data']['totaldiscount']>0){
36
+ $validtotal-=$_SESSION['qixol_quoted_items']['cart_data']['totaldiscount'];
37
+ }
38
+ if ((double)$leftpoints>=(double)$points_amount_money&&(double)$points_amount_money<$validtotal){
39
+ Mage::getSingleton('customer/session')->setPointsAmount($points_amount);
40
+ $session->addSuccess(
41
+ $session->addSuccess('Reward Points "'.Mage::helper('core')->escapeHtml($points_amount).'" was applied.')
42
+ );
43
+
44
+
45
+ }elseif((int)$leftpoints<(int)$points_amount) {
46
+ $session->addError($this->__('Not enouhgt points!'));
47
+ }else{
48
+ $session->addError('reward Points "'.Mage::helper('core')->escapeHtml($points_amount).'" is not valid.');
49
+ }
50
+
51
+ }
52
+ }
53
+ $this->_redirect('checkout/cart');
54
+ return;
55
+ }
56
+
57
+ }
app/code/community/Qixol/Promo/controllers/IndexController.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qixol_Promo_IndexController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ /*var $_logFile;
5
+
6
+ public function indexAction(){
7
+
8
+ echo "Start export <br>";
9
+
10
+ $export=Mage::getModel('qixol/sinch');
11
+
12
+ $export->run_export();
13
+
14
+ echo "Finish export<br>";
15
+
16
+ }*/
17
+ public function indexAction() {
18
+ $this->loadLayout();
19
+ $this->renderLayout();
20
+ }
21
+
22
+ }
app/code/community/Qixol/Promo/controllers/IssuedcouponController.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Qixol_Promo_IssuedcouponController extends Mage_Core_Controller_Front_Action {
4
+
5
+ public function indexAction() {
6
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
7
+ $this->_redirect('customer/account/login');
8
+ return;
9
+ }
10
+ $this->loadLayout();
11
+ $this->_initLayoutMessages('customer/session');
12
+ $this->_initLayoutMessages('catalog/session');
13
+
14
+ $this->renderLayout();
15
+ }
16
+
17
+ }
app/code/community/Qixol/Promo/etc/adminhtml.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <qixol>
12
+ <title>Promo Setting</title>
13
+ </qixol>
14
+ <stickers>
15
+ <title>Stickers</title>
16
+ </stickers>
17
+ </children>
18
+ </config>
19
+ </children>
20
+ </system>
21
+ </children>
22
+ </admin>
23
+ </resources>
24
+ </acl>
25
+ </config>
app/code/community/Qixol/Promo/etc/config.xml ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <default>
4
+ <qixol>
5
+ <integraion>
6
+ <dropdown>evaluation</dropdown>
7
+ </integraion>
8
+ </qixol>
9
+ </default>
10
+ <modules>
11
+ <Qixol_Promo>
12
+ <version>1.0.0</version>
13
+ </Qixol_Promo>
14
+ </modules>
15
+ <global>
16
+ <helpers>
17
+ <qixol>
18
+ <class>Qixol_Promo_Helper</class>
19
+ </qixol>
20
+ </helpers>
21
+ <blocks>
22
+ <qixol>
23
+ <class>Qixol_Promo_Block</class>
24
+ </qixol>
25
+ </blocks>
26
+ <fieldsets>
27
+ <sales_convert_quote_address>
28
+ <points_amount><to_order>*</to_order></points_amount>
29
+ <base_points_amount><to_order>*</to_order></base_points_amount>
30
+ </sales_convert_quote_address>
31
+ <sales_convert_order>
32
+ <points_amount><to_invoice>*</to_invoice></points_amount>
33
+ <base_points_amount><to_invoice>*</to_invoice></base_points_amount>
34
+ </sales_convert_order>
35
+ </fieldsets>
36
+ <pdf>
37
+ <totals>
38
+ <points translate="title">
39
+ <title>Rewards points discount</title>
40
+ <source_field>points_amount</source_field>
41
+ <font_size>7</font_size>
42
+ <display_zero>0</display_zero>
43
+ <sort_order>650</sort_order>
44
+ <amount_prefix>-</amount_prefix>
45
+ </points>
46
+ </totals>
47
+ </pdf>
48
+ <sales>
49
+ <quote>
50
+ <totals>
51
+ <points>
52
+ <class>Qixol_Promo_Model_Ordertotalpoints</class>
53
+ <after>subtotal</after>
54
+ </points>
55
+ </totals>
56
+ </quote>
57
+ <order_invoice>
58
+ <totals>
59
+ <points>
60
+ <class>Qixol_Promo__Model_Invoicepoints</class>
61
+ <after>subtotal</after>
62
+ </points>
63
+ </totals>
64
+ </order_invoice>
65
+ <order_creditmemo>
66
+ <totals>
67
+ <points>
68
+ <class>Qixol_Promo_Model_Creditmemopoints</class>
69
+ <after>subtotal</after>
70
+ </points>
71
+ </totals>
72
+ </order_creditmemo>
73
+ </sales>
74
+ <models>
75
+ <qixol>
76
+ <class>Qixol_Promo_Model</class>
77
+ <resourceModel>qixol_mysql4</resourceModel>
78
+ </qixol>
79
+ <qixol_mysql4>
80
+ <class>Qixol_Promo_Model_Mysql4</class>
81
+ <entities>
82
+ <promotions>
83
+ <table>qixol_promotions_type</table>
84
+ </promotions>
85
+ <promotionhasproduct>
86
+ <table>qixol_promotion_has_product</table>
87
+ </promotionhasproduct>
88
+ <banner>
89
+ <table>qixol_banners</table>
90
+ </banner>
91
+ <bannerimage>
92
+ <table>qixol_banner_image</table>
93
+ <!--<table>admin_user</table>-->
94
+ </bannerimage>
95
+ <sticker>
96
+ <table>qixol_stickers</table>
97
+ </sticker>
98
+ <bannerboxes>
99
+ <table>qixol_banner_box</table>
100
+ </bannerboxes>
101
+ <exprpocessstat>
102
+ <table>qixol_process_export_status_table</table>
103
+ </exprpocessstat>
104
+ <deletedproduct>
105
+ <table>qixol_product_to_delete</table>
106
+ </deletedproduct>
107
+ <customergrouspmap>
108
+ <table>qixol_customers_groups_name_map</table>
109
+ </customergrouspmap>
110
+ <shippingmap>
111
+ <table>qixol_shipping_name_map</table>
112
+ </shippingmap>
113
+ <issuedcoupon>
114
+ <table>qixol_coupon_issued</table>
115
+ </issuedcoupon>
116
+ <storesmap>
117
+ <table>qixol_stores_name_map</table>
118
+ </storesmap>
119
+ <bonuspoints>
120
+ <table>qixol_cutomer_points</table>
121
+ </bonuspoints>
122
+ </entities>
123
+ </qixol_mysql4>
124
+ </models>
125
+ <resources>
126
+ <qixol_setup>
127
+ <setup>
128
+ <module>Qixol_Promo</module>
129
+ </setup>
130
+ <connection>
131
+ <use>core_setup</use>
132
+ </connection>
133
+ </qixol_setup>
134
+ <qixol_write>
135
+ <connection>
136
+ <use>core_write</use>
137
+ </connection>
138
+ </qixol_write>
139
+ <qixol_read>
140
+ <connection>
141
+ <use>core_read</use>
142
+ </connection>
143
+ </qixol_read>
144
+ </resources>
145
+ <events>
146
+ <catalog_product_delete_before> <!-- identifier of the event we want to catch -->
147
+ <observers>
148
+ <catalog_product_delete_before_handler> <!-- identifier of the event handler -->
149
+ <type>model</type> <!-- class method call type; valid are model, object and singleton -->
150
+ <class>qixol/observer</class> <!-- observers class alias -->
151
+ <method>markDletedProduct</method> <!-- observer's method to be called -->
152
+ <args></args> <!-- additional arguments passed to observer -->
153
+ </catalog_product_delete_before_handler>
154
+ </observers>
155
+ </catalog_product_delete_before>
156
+ <checkout_cart_save_after> <!-- identifier of the event we want to catch -->
157
+ <observers>
158
+ <checkout_cart_save_after_handler> <!-- identifier of the event handler -->
159
+ <type>model</type> <!-- class method call type; valid are model, object and singleton -->
160
+ <class>qixol/observer</class> <!-- observers class alias -->
161
+ <method>processGetCartPromo</method> <!-- observer's method to be called -->
162
+ <args></args> <!-- additional arguments passed to observer -->
163
+ </checkout_cart_save_after_handler>
164
+ </observers>
165
+ </checkout_cart_save_after>
166
+
167
+ <checkout_controller_onepage_save_shipping_method> <!-- identifier of the event we want to catch -->
168
+ <observers>
169
+ <checkout_controller_onepage_save_shipping_method_handler> <!-- identifier of the event handler -->
170
+ <type>model</type> <!-- class method call type; valid are model, object and singleton -->
171
+ <class>qixol/observer</class> <!-- observers class alias -->
172
+ <method>processShippingUpdated</method> <!-- observer's method to be called -->
173
+ <args></args> <!-- additional arguments passed to observer -->
174
+ </checkout_controller_onepage_save_shipping_method_handler>
175
+ </observers>
176
+ </checkout_controller_onepage_save_shipping_method>
177
+
178
+ <sales_convert_quote_to_order> <!-- identifier of the event we want to catch -->
179
+ <observers>
180
+ <sales_convert_quote_to_order_handler> <!-- identifier of the event handler -->
181
+ <type>model</type> <!-- class method call type; valid are model, object and singleton -->
182
+ <class>qixol/observer</class> <!-- observers class alias -->
183
+ <method>processApplyCartPromo</method> <!-- observer's method to be called -->
184
+ <args></args> <!-- additional arguments passed to observer -->
185
+ </sales_convert_quote_to_order_handler>
186
+ </observers>
187
+ </sales_convert_quote_to_order>
188
+
189
+ <checkout_type_onepage_save_order_after>
190
+ <observers>
191
+ <checkout_type_onepage_save_order_after_handler>
192
+ <class>qixol/observer</class>
193
+ <method>processSavePromotionsToOrder</method>
194
+ </checkout_type_onepage_save_order_after_handler>
195
+ </observers>
196
+ </checkout_type_onepage_save_order_after>
197
+
198
+ <controller_action_predispatch_checkout_cart_couponPost>
199
+ <observers>
200
+ <controller_action_before>
201
+ <type>model</type>
202
+ <class>qixol/observer</class>
203
+ <method>checkQixolCoupon</method>
204
+ </controller_action_before>
205
+ </observers>
206
+ </controller_action_predispatch_checkout_cart_couponPost>
207
+ <controller_action_predispatch_checkout_cart_delete>
208
+ <observers>
209
+ <controller_action_before>
210
+ <type>model</type>
211
+ <class>qixol/observer</class>
212
+ <method>deleteCartAction</method>
213
+ </controller_action_before>
214
+ </observers>
215
+ </controller_action_predispatch_checkout_cart_delete>
216
+ <controller_action_predispatch_checkout_cart_updatePost>
217
+ <observers>
218
+ <controller_action_before>
219
+ <type>model</type>
220
+ <class>qixol/observer</class>
221
+ <method>updateCartPostAction</method>
222
+ </controller_action_before>
223
+ </observers>
224
+ </controller_action_predispatch_checkout_cart_updatePost>
225
+ <controller_action_predispatch_checkout_cart_ajaxUpdate>
226
+ <observers>
227
+ <controller_action_before>
228
+ <type>model</type>
229
+ <class>qixol/observer</class>
230
+ <method>updateCartAjaxUpdate</method>
231
+ </controller_action_before>
232
+ </observers>
233
+ </controller_action_predispatch_checkout_cart_ajaxUpdate>
234
+ <controller_action_predispatch_checkout_cart_ajaxDelete>
235
+ <observers>
236
+ <controller_action_before>
237
+ <type>model</type>
238
+ <class>qixol/observer</class>
239
+ <method>updateCartAjaxDelete</method>
240
+ </controller_action_before>
241
+ </observers>
242
+ </controller_action_predispatch_checkout_cart_ajaxDelete>
243
+ </events>
244
+ </global>
245
+ <admin>
246
+ <routers>
247
+ <qixol_admin>
248
+ <use>admin</use>
249
+ <args>
250
+ <module>Qixol_Promo</module>
251
+ <frontName>qixol_admin</frontName>
252
+ </args>
253
+ </qixol_admin>
254
+ </routers>
255
+ </admin>
256
+ <adminhtml>
257
+ <menu>
258
+ <qixol module="qixol">
259
+ <title>Qixol Promo</title>
260
+ <sort_order>100</sort_order>
261
+ <children>
262
+ <banner module="qixol">
263
+ <title>Banners</title>
264
+ <sort_order>2</sort_order>
265
+ <action>qixol_admin/adminhtml_banner</action>
266
+ </banner>
267
+ <sticker module="qixol">
268
+ <title>Stickers</title>
269
+ <sort_order>1</sort_order>
270
+ <action>qixol_admin/adminhtml_sticker</action>
271
+ </sticker>
272
+ <bannerboxes module="qixol">
273
+ <title>Banner Position</title>
274
+ <sort_order>3</sort_order>
275
+ <action>qixol_admin/adminhtml_bannerboxes</action>
276
+ </bannerboxes>
277
+ <!--
278
+ <qixolbackend module="qixol">
279
+ <title>Qixol</title>
280
+ <sort_order>3</sort_order>
281
+ <action>qixol_admin/adminhtml_qixolbackend</action>
282
+ </qixolbackend>
283
+ -->
284
+ <customergrouspmap module="qixol">
285
+ <title>Customer Group Integration Codes</title>
286
+ <sort_order>4</sort_order>
287
+ <action>qixol_admin/adminhtml_customergrouspmap</action>
288
+ </customergrouspmap>
289
+ <shippingmap module="qixol">
290
+ <title>Shipping Method Integration Codes</title>
291
+ <sort_order>5</sort_order>
292
+ <action>qixol_admin/adminhtml_shippingmap</action>
293
+ </shippingmap>
294
+ <storesmap module="qixol">
295
+ <title>Store Integration Codes</title>
296
+ <sort_order>6</sort_order>
297
+ <action>qixol_admin/adminhtml_storesmap</action>
298
+ </storesmap>
299
+ </children>
300
+ </qixol>
301
+
302
+ <promo>
303
+ <disabled>1</disabled>
304
+ <children>
305
+ <quote>
306
+ <disabled>1</disabled>
307
+ </quote>
308
+ <catalog>
309
+ <disabled>1</disabled>
310
+ </catalog>
311
+ </children>
312
+ </promo>
313
+
314
+ </menu>
315
+ <acl>
316
+ <resources>
317
+ <all>
318
+ <title>Allow Everything</title>
319
+ </all>
320
+ <admin>
321
+ <children>
322
+ <qixol translate="title" module="qixol">
323
+ <title>Qixol Promo</title>
324
+ <sort_order>1000</sort_order>
325
+ <children>
326
+ <qixolbackend translate="title">
327
+ <title>Qixol Promo</title>
328
+ </qixolbackend>
329
+ </children>
330
+ </qixol>
331
+ </children>
332
+ </admin>
333
+ </resources>
334
+ </acl>
335
+ <layout>
336
+ <updates>
337
+ <qixol>
338
+ <file>qixol.xml</file>
339
+ </qixol>
340
+ </updates>
341
+ </layout>
342
+ <translate>
343
+ <modules>
344
+ <Qixol_Promo>
345
+ <files>
346
+ <default>Qixol_Promo.csv</default>
347
+ </files>
348
+ </Qixol_Promo>
349
+ </modules>
350
+ </translate>
351
+ </adminhtml>
352
+
353
+ <frontend>
354
+ <routers>
355
+ <qixol>
356
+ <use>standard</use>
357
+ <args>
358
+ <module>Qixol_Promo</module>
359
+ <frontName>qixol</frontName>
360
+ </args>
361
+ </qixol>
362
+ </routers>
363
+ <layout>
364
+ <updates>
365
+ <qixol>
366
+ <file>qixol.xml</file>
367
+ </qixol>
368
+ </updates>
369
+ </layout>
370
+ <translate>
371
+ <modules>
372
+ <Qixol_Promo>
373
+ <files>
374
+ <default>Qixol_Promo.csv</default>
375
+ </files>
376
+ </Qixol_Promo>
377
+ </modules>
378
+ </translate>
379
+ </frontend>
380
+
381
+ <crontab>
382
+ <jobs>
383
+ <qixol_runexportsynch>
384
+ <schedule><cron_expr>* */2 * * *</cron_expr></schedule>
385
+ <run><model>qixol/cron::runExportSynch</model></run>
386
+ </qixol_runexportsynch>
387
+ <qixol_runimportpromosynch>
388
+ <schedule><cron_expr>*/15 * * * *</cron_expr></schedule>
389
+ <run><model>qixol/cron::runImportProductPromotionSynch</model></run>
390
+ </qixol_runimportpromosynch>
391
+ </jobs>
392
+ </crontab>
393
+ </config>
app/code/community/Qixol/Promo/etc/system.xml ADDED
@@ -0,0 +1,482 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <qixol translate="label" module="qixol">
5
+ <label>Qixol Promo</label>
6
+ <sort_order>333</sort_order>
7
+ </qixol>
8
+ </tabs>
9
+ <sections>
10
+ <qixol translate="label">
11
+ <label>Promo Setting</label>
12
+ <tab>qixol</tab>
13
+ <sort_order>100</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <integraion translate="label">
19
+ <label>General / Integration</label>
20
+ <sort_order>50</sort_order>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>0</show_in_website>
23
+ <show_in_store>0</show_in_store>
24
+ <comment><![CDATA[The main configuration]]></comment>
25
+ <fields>
26
+ <enabled translate="label">
27
+ <label>Enabled</label>
28
+ <frontend_type>select</frontend_type>
29
+ <config_path>qixol/promo/enabled</config_path>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>1</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>0</show_in_website>
34
+ <show_in_store>0</show_in_store>
35
+ </enabled>
36
+ <companykey translate="label">
37
+ <label>Company Key</label>
38
+ <frontend_type>text</frontend_type>
39
+ <comment><![CDATA[Company key assigned to you when you register in Qixol Promo <a href="http://www.qixolpromo.com">click</a>.]]></comment>
40
+ <sort_order>2</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>0</show_in_website>
43
+ <show_in_store>0</show_in_store>
44
+ </companykey>
45
+ <services translate="label comment">
46
+ <label>Integration Services</label>
47
+ <comment>Integration Services</comment>
48
+ <frontend_type>select</frontend_type>
49
+ <source_model>qixol/system_config_source_iservices_values</source_model>
50
+ <sort_order>30</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>0</show_in_website>
53
+ <show_in_store>0</show_in_store>
54
+ </services>
55
+ <serviceProtocol translate="label comment">
56
+ <label>Service Protocol</label>
57
+ <comment>Service Protocol</comment>
58
+ <frontend_type>select</frontend_type>
59
+ <source_model>qixol/System_Config_Source_IServiceProtocols_Values</source_model>
60
+ <sort_order>31</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>0</show_in_website>
63
+ <show_in_store>0</show_in_store>
64
+ </serviceProtocol>
65
+ <restServiceAddress translate="label comment">
66
+ <label>REST Service Address</label>
67
+ <comment>REST Service Address</comment>
68
+ <depends>
69
+ <services>custom</services>
70
+ <serviceProtocol>REST</serviceProtocol>
71
+ </depends>
72
+ <frontend_type>text</frontend_type>
73
+ <sort_order>301</sort_order>
74
+ <show_in_default>1</show_in_default>
75
+ <show_in_website>0</show_in_website>
76
+ <show_in_store>0</show_in_store>
77
+ </restServiceAddress>
78
+ <importManagerServiceAddress translate="label comment">
79
+ <label>Import Manager Service Address</label>
80
+ <comment>Import Manager Service Address</comment>
81
+ <depends>
82
+ <services>custom</services>
83
+ <serviceProtocol>SOAP</serviceProtocol>
84
+ </depends>
85
+ <frontend_type>text</frontend_type>
86
+ <sort_order>302</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>0</show_in_website>
89
+ <show_in_store>0</show_in_store>
90
+ </importManagerServiceAddress>
91
+ <exportManagerServiceAddress translate="label comment">
92
+ <label>Export Manager Service Address</label>
93
+ <comment>Export Manager Service Address</comment>
94
+ <depends>
95
+ <services>custom</services>
96
+ <serviceProtocol>SOAP</serviceProtocol>
97
+ </depends>
98
+ <frontend_type>text</frontend_type>
99
+ <sort_order>303</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>0</show_in_website>
102
+ <show_in_store>0</show_in_store>
103
+ </exportManagerServiceAddress>
104
+ <basketManagerServiceAddress translate="label comment">
105
+ <label>Basket Manager Service Address</label>
106
+ <comment>Basket Manager Service Address</comment>
107
+ <depends>
108
+ <services>custom</services>
109
+ <serviceProtocol>SOAP</serviceProtocol>
110
+ </depends>
111
+ <frontend_type>text</frontend_type>
112
+ <sort_order>304</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>0</show_in_website>
115
+ <show_in_store>0</show_in_store>
116
+ </basketManagerServiceAddress>
117
+ </fields>
118
+ </integraion>
119
+ <!--
120
+ <frontend translate="label">
121
+ <label>Front-End Settings</label>
122
+ <sort_order>60</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>0</show_in_website>
125
+ <show_in_store>0</show_in_store>
126
+ <fields>
127
+ <onepagejavascr translate="label">
128
+ <label>Use Javascript onepage update.</label>
129
+ <comment>One one page chackout use javascript cart update.</comment>
130
+ <frontend_type>select</frontend_type>
131
+ <source_model>adminhtml/system_config_source_yesno</source_model>
132
+ <sort_order>10</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ </onepagejavascr>
137
+ <cartjavascr translate="label">
138
+ <label>Use Javascript cart update.</label>
139
+ <comment>Cart confirmation use javascript replace.</comment>
140
+ <frontend_type>select</frontend_type>
141
+ <source_model>adminhtml/system_config_source_yesno</source_model>
142
+ <sort_order>20</sort_order>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ <show_in_store>1</show_in_store>
146
+ </cartjavascr>
147
+ <mcartjavascr translate="label">
148
+ <label>Use Javascript topcart update.</label>
149
+ <comment>Top cart javascript replace.</comment>
150
+ <frontend_type>select</frontend_type>
151
+ <source_model>adminhtml/system_config_source_yesno</source_model>
152
+ <sort_order>20</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>1</show_in_store>
156
+ </mcartjavascr>
157
+ </fields>
158
+ </frontend>
159
+ -->
160
+ <advanced translate="label">
161
+ <label>Advanced</label>
162
+ <sort_order>60</sort_order>
163
+ <show_in_default>1</show_in_default>
164
+ <show_in_website>0</show_in_website>
165
+ <show_in_store>0</show_in_store>
166
+ <fields>
167
+ <basketval translate="label">
168
+ <label>Multi-currency Basket Validation</label>
169
+ <comment>When submitting baskets used selected currency</comment>
170
+ <frontend_type>select</frontend_type>
171
+ <source_model>adminhtml/system_config_source_yesno</source_model>
172
+ <sort_order>1</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>0</show_in_website>
175
+ <show_in_store>0</show_in_store>
176
+ </basketval>
177
+ <services translate="label comment">
178
+ <label>Shopping Cart Configuration</label>
179
+ <comment>Show promotional details</comment>
180
+ <frontend_type>select</frontend_type>
181
+ <source_model>qixol/system_config_source_cart_settings</source_model>
182
+ <sort_order>30</sort_order>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>0</show_in_website>
185
+ <show_in_store>0</show_in_store>
186
+ </services>
187
+ </fields>
188
+ </advanced>
189
+
190
+ <syhchronized translate="label">
191
+ <label>Synchronised Items</label>
192
+ <sort_order>61</sort_order>
193
+ <show_in_default>1</show_in_default>
194
+ <show_in_website>0</show_in_website>
195
+ <show_in_store>0</show_in_store>
196
+ <comment><![CDATA[Synchronization Config]]></comment>
197
+ <fields>
198
+ <synchproducts translate="label">
199
+ <label>Synchronise Products</label>
200
+ <frontend_type>select</frontend_type>
201
+ <source_model>adminhtml/system_config_source_yesno</source_model>
202
+ <sort_order>1</sort_order>
203
+ <show_in_default>1</show_in_default>
204
+ <show_in_website>0</show_in_website>
205
+ <show_in_store>0</show_in_store>
206
+ </synchproducts>
207
+ <synchcatproducts translate="label">
208
+ <label>Synchronise category with product</label>
209
+ <depends>
210
+ <synchproducts>1</synchproducts>
211
+ </depends>
212
+ <comment>Send product categories in attribute categorycode</comment>
213
+ <frontend_type>select</frontend_type>
214
+ <source_model>adminhtml/system_config_source_yesno</source_model>
215
+ <sort_order>2</sort_order>
216
+ <show_in_default>1</show_in_default>
217
+ <show_in_website>0</show_in_website>
218
+ <show_in_store>0</show_in_store>
219
+ </synchcatproducts>
220
+ <storeuse translate="label">
221
+ <label>Stores</label>
222
+ <comment>For stores</comment>
223
+ <frontend_type>select</frontend_type>
224
+ <source_model>qixol/system_config_source_stores</source_model>
225
+ <sort_order>3</sort_order>
226
+ <show_in_default>1</show_in_default>
227
+ <show_in_website>0</show_in_website>
228
+ <show_in_store>0</show_in_store>
229
+ </storeuse>
230
+ <synchcustomer translate="label">
231
+ <label>Synchronise Customer groups</label>
232
+ <frontend_type>select</frontend_type>
233
+ <source_model>adminhtml/system_config_source_yesno</source_model>
234
+ <sort_order>4</sort_order>
235
+ <show_in_default>1</show_in_default>
236
+ <show_in_website>0</show_in_website>
237
+ <show_in_store>0</show_in_store>
238
+ </synchcustomer>
239
+ <synchship translate="label">
240
+ <label>Synchronise Shipping Methods</label>
241
+ <frontend_type>select</frontend_type>
242
+ <source_model>adminhtml/system_config_source_yesno</source_model>
243
+ <sort_order>5</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>0</show_in_website>
246
+ <show_in_store>0</show_in_store>
247
+ </synchship>
248
+ <synchcurrency translate="label">
249
+ <label>Synchronise Currency List</label>
250
+ <frontend_type>select</frontend_type>
251
+ <source_model>adminhtml/system_config_source_yesno</source_model>
252
+ <sort_order>5</sort_order>
253
+ <show_in_default>1</show_in_default>
254
+ <show_in_website>0</show_in_website>
255
+ <show_in_store>0</show_in_store>
256
+ </synchcurrency>
257
+ <synchstores translate="label">
258
+ <label>Synchronise Stores</label>
259
+ <frontend_type>select</frontend_type>
260
+ <source_model>adminhtml/system_config_source_yesno</source_model>
261
+ <sort_order>6</sort_order>
262
+ <show_in_default>1</show_in_default>
263
+ <show_in_website>0</show_in_website>
264
+ <show_in_store>0</show_in_store>
265
+ </synchstores>
266
+ <!--
267
+ <channel translate="label">
268
+ <label>Channel</label>
269
+ <frontend_type>text</frontend_type>
270
+ <sort_order>7</sort_order>
271
+ <show_in_default>1</show_in_default>
272
+ <show_in_website>0</show_in_website>
273
+ <show_in_store>0</show_in_store>
274
+ </channel>
275
+ <storegroup translate="label">
276
+ <label>Store Group</label>
277
+ <frontend_type>text</frontend_type>
278
+ <comment><![CDATA[The channel and store group are used in the store hierarchy submited to Promo.]]></comment>
279
+ <sort_order>8</sort_order>
280
+ <show_in_default>1</show_in_default>
281
+ <show_in_website>0</show_in_website>
282
+ <show_in_store>0</show_in_store>
283
+ </storegroup>
284
+ -->
285
+ <synchonsaving translate="label">
286
+ <label>Synchronise on Saving</label>
287
+ <frontend_type>select</frontend_type>
288
+ <source_model>adminhtml/system_config_source_yesno</source_model>
289
+ <sort_order>9</sort_order>
290
+ <show_in_default>1</show_in_default>
291
+ <show_in_website>0</show_in_website>
292
+ <show_in_store>0</show_in_store>
293
+ </synchonsaving>
294
+ </fields>
295
+ </syhchronized>
296
+ <!--
297
+ <customers translate="label">
298
+ <label>Customers</label>
299
+ <sort_order>77</sort_order>
300
+ <show_in_default>1</show_in_default>
301
+ <show_in_website>0</show_in_website>
302
+ <show_in_store>0</show_in_store>
303
+ <comment><![CDATA[Synchronization Config]]></comment>
304
+ <fields>
305
+ <list translate="label">
306
+ <label>Only synchronise these types</label>
307
+ <frontend_type>Multiselect</frontend_type>
308
+ <source_model>qixol/system_config_source_customers_list</source_model>
309
+ <sort_order>14</sort_order>
310
+ <show_in_default>1</show_in_default>
311
+ <show_in_website>1</show_in_website>
312
+ <show_in_store>1</show_in_store>
313
+ </list>
314
+ </fields>
315
+ </customers>
316
+
317
+ <shippings translate="label">
318
+ <label>Shipping Methods</label>
319
+ <sort_order>77</sort_order>
320
+ <show_in_default>1</show_in_default>
321
+ <show_in_website>0</show_in_website>
322
+ <show_in_store>0</show_in_store>
323
+ <comment><![CDATA[Synchronization Config]]></comment>
324
+ <fields>
325
+ <onlyactive translate="label">
326
+ <label>Only active</label>
327
+ <frontend_type>select</frontend_type>
328
+ <source_model>adminhtml/system_config_source_yesno</source_model>
329
+ <sort_order>1</sort_order>
330
+ <show_in_default>1</show_in_default>
331
+ <show_in_website>0</show_in_website>
332
+ <show_in_store>0</show_in_store>
333
+ </onlyactive>
334
+ <list translate="label">
335
+ <label>Only synchronise these methods</label>
336
+ <frontend_type>Multiselect</frontend_type>
337
+ <source_model>qixol/system_config_source_shippings_list</source_model>
338
+ <sort_order>14</sort_order>
339
+ <show_in_default>1</show_in_default>
340
+ <show_in_website>1</show_in_website>
341
+ <show_in_store>1</show_in_store>
342
+ </list>
343
+ </fields>
344
+ </shippings>
345
+ -->
346
+
347
+ <productattrib translate="label">
348
+ <label>Product Attributes</label>
349
+ <sort_order>72</sort_order>
350
+ <show_in_default>1</show_in_default>
351
+ <show_in_website>0</show_in_website>
352
+ <show_in_store>0</show_in_store>
353
+ <comment><![CDATA[Synchronization Config]]></comment>
354
+ <fields>
355
+ <attributes translate="label">
356
+ <label>Include with synchronised products:</label>
357
+ <frontend_type>checkboxes</frontend_type>
358
+ <source_model>qixol/system_config_source_attributes</source_model>
359
+ <frontend_model>qixol/adminhtml_system_config_attributes</frontend_model>
360
+ <sort_order>14</sort_order>
361
+ <show_in_default>1</show_in_default>
362
+ <show_in_website>1</show_in_website>
363
+ <show_in_store>1</show_in_store>
364
+ </attributes>
365
+ </fields>
366
+ </productattrib>
367
+
368
+ <!--
369
+ <issuedpoints translate="label">
370
+ <label>Issued Points</label>
371
+ <sort_order>72</sort_order>
372
+ <show_in_default>1</show_in_default>
373
+ <show_in_website>0</show_in_website>
374
+ <show_in_store>0</show_in_store>
375
+ <comment><![CDATA[Bonus points Config]]></comment>
376
+ <fields>
377
+ <convertrate translate="label">
378
+ <label>Conversion rate</label>
379
+ <frontend_type>text</frontend_type>
380
+ <comment><![CDATA[will be divided on this value (1/x)]]></comment>
381
+ <sort_order>8</sort_order>
382
+ <show_in_default>1</show_in_default>
383
+ <show_in_website>0</show_in_website>
384
+ <show_in_store>0</show_in_store>
385
+ </convertrate>
386
+ </fields>
387
+ </issuedpoints>
388
+ -->
389
+ <sinch_explort_products translate="label">
390
+ <label>Synchronise items to Promo</label>
391
+ <frontend_type>text</frontend_type>
392
+ <comment>Export items to Promo</comment>
393
+ <sort_order>150</sort_order>
394
+ <show_in_default>1</show_in_default>
395
+ <show_in_website>1</show_in_website>
396
+ <show_in_store>1</show_in_store>
397
+ <fields>
398
+ <start_sinch_export translate="label">
399
+ <frontend_type>button</frontend_type>
400
+ <frontend_model>qixol/startexportbutton</frontend_model>
401
+ <sort_order>4</sort_order>
402
+ <show_in_default>1</show_in_default>
403
+ <show_in_website>0</show_in_website>
404
+ <show_in_store>0</show_in_store>
405
+ </start_sinch_export>
406
+ </fields>
407
+ </sinch_explort_products>
408
+ <sinch_import_promotion translate="label">
409
+ <label>Run import promotions</label>
410
+ <frontend_type>text</frontend_type>
411
+ <comment>Import promotions from qixol.</comment>
412
+ <sort_order>180</sort_order>
413
+ <show_in_default>1</show_in_default>
414
+ <show_in_website>1</show_in_website>
415
+ <show_in_store>1</show_in_store>
416
+ <fields>
417
+ <start_sinch_import translate="label">
418
+ <frontend_type>button</frontend_type>
419
+ <frontend_model>qixol/startimportbutton</frontend_model>
420
+ <sort_order>4</sort_order>
421
+ <show_in_default>1</show_in_default>
422
+ <show_in_website>0</show_in_website>
423
+ <show_in_store>0</show_in_store>
424
+ </start_sinch_import>
425
+ </fields>
426
+ </sinch_import_promotion>
427
+ </groups>
428
+ </qixol>
429
+ </sections>
430
+ <sections>
431
+ <stickers translate="label">
432
+ <label>Stickers</label>
433
+ <tab>qixol</tab>
434
+ <sort_order>110</sort_order>
435
+ <show_in_default>1</show_in_default>
436
+ <show_in_website>1</show_in_website>
437
+ <show_in_store>1</show_in_store>
438
+ <groups>
439
+ <general translate="label">
440
+ <label>General</label>
441
+ <sort_order>50</sort_order>
442
+ <show_in_default>1</show_in_default>
443
+ <show_in_website>0</show_in_website>
444
+ <show_in_store>0</show_in_store>
445
+ <comment><![CDATA[Stickers configuration]]></comment>
446
+ <fields>
447
+ <showStickersOnCataloguePage translate="label">
448
+ <label>Show promotion stickers on catalogue page</label>
449
+ <frontend_type>select</frontend_type>
450
+ <config_path>qixol/stickers/showStickersOnCataloguePage</config_path>
451
+ <source_model>adminhtml/system_config_source_yesno</source_model>
452
+ <sort_order>1</sort_order>
453
+ <show_in_default>1</show_in_default>
454
+ <show_in_website>0</show_in_website>
455
+ <show_in_store>0</show_in_store>
456
+ </showStickersOnCataloguePage>
457
+ <showStickersOnProductPage translate="label">
458
+ <label>Show promotion stickers on product page</label>
459
+ <frontend_type>select</frontend_type>
460
+ <config_path>qixol/stickers/showStickersOnProductPage</config_path>
461
+ <source_model>adminhtml/system_config_source_yesno</source_model>
462
+ <sort_order>2</sort_order>
463
+ <show_in_default>1</show_in_default>
464
+ <show_in_website>0</show_in_website>
465
+ <show_in_store>0</show_in_store>
466
+ </showStickersOnProductPage>
467
+ <showPromoBoxOnProductPage translate="label">
468
+ <label>Show available promotions on product page</label>
469
+ <frontend_type>select</frontend_type>
470
+ <config_path>qixol/stickers/showPromoBoxOnProductPage</config_path>
471
+ <source_model>adminhtml/system_config_source_yesno</source_model>
472
+ <sort_order>3</sort_order>
473
+ <show_in_default>1</show_in_default>
474
+ <show_in_website>0</show_in_website>
475
+ <show_in_store>0</show_in_store>
476
+ </showPromoBoxOnProductPage>
477
+ </fields>
478
+ </general>
479
+ </groups>
480
+ </stickers>
481
+ </sections>
482
+ </config>
app/code/community/Qixol/Promo/sql/qixol_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $sql=<<<SQLTEXT
7
+ create table {$installer->getTable('qixol_product_to_delete')}(
8
+ entity_id int unsigned not null default 0,
9
+ product_sku varchar(128),
10
+ child_sku varchar(128),
11
+ deleted_time datetime,
12
+ primary key (entity_id)
13
+ );
14
+
15
+ SQLTEXT;
16
+
17
+ $installer->run($sql);
18
+
19
+ $sql=<<<SQLTEXT
20
+ create table {$installer->getTable('qixol_process_export_status_table')}(
21
+ id int(11) NOT NULL auto_increment,
22
+ last_message varchar(255),
23
+ export_what varchar(32),
24
+ exports_start datetime,
25
+ exports_last_updated datetime,
26
+ is_finished int(1) default 0,
27
+ extended_message text,
28
+ PRIMARY KEY (id)
29
+ );
30
+ SQLTEXT;
31
+
32
+ $installer->run($sql);
33
+
34
+ $sql=<<<SQLTEXT
35
+ CREATE TABLE {$installer->getTable('qixol_banners')}(
36
+ `banner_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
37
+ `title` varchar(255) NOT NULL DEFAULT '',
38
+ `display_zone` varchar(255) NOT NULL DEFAULT '',
39
+ `status` smallint(6) NOT NULL DEFAULT '0',
40
+ `created_time` datetime DEFAULT NULL,
41
+ `update_time` datetime DEFAULT NULL,
42
+ PRIMARY KEY (`banner_id`)
43
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
44
+ SQLTEXT;
45
+
46
+ $installer->run($sql);
47
+
48
+ $sql=<<<SQLTEXT
49
+ CREATE TABLE {$installer->getTable('qixol_banner_image')}(
50
+ `banner_image_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
51
+ `filename` varchar(255) NOT NULL DEFAULT '',
52
+ `banner_id` int(11) unsigned NOT NULL,
53
+ `sort_order` int(11) NOT NULL DEFAULT '0',
54
+ `promotion_reference` varchar(255) not null default '',
55
+ `comment` varchar(255),
56
+ `url` varchar(255),
57
+ PRIMARY KEY (`banner_image_id`),
58
+ CONSTRAINT `FK_qixol_banner_image_banner_id` FOREIGN KEY (`banner_id`) REFERENCES `qixol_banners` (`banner_id`) ON DELETE CASCADE ON UPDATE CASCADE
59
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
60
+ SQLTEXT;
61
+
62
+ $installer->run($sql);
63
+
64
+ $sql=<<<SQLTEXT
65
+ CREATE TABLE {$installer->getTable('qixol_promotions_type')}(
66
+ `promotion_id` int(11) unsigned NOT NULL default 0,
67
+ `promotion_type` varchar(255) NOT NULL DEFAULT '',
68
+ `promotion_name` varchar(255) NOT NULL DEFAULT '',
69
+ `promotion_text` text,
70
+ `yourref` varchar(255) NOT NULL DEFAULT '',
71
+ `bundleprice` decimal(12,2) NOT NULL DEFAULT '0.00',
72
+ `discountpercent` decimal(8,2) NOT NULL DEFAULT '0.00',
73
+ `discountamount` decimal(10,2) NOT NULL DEFAULT '0.00',
74
+ `hascouponrestrictions` tinyint not null default 0,
75
+ `is_everyday` tinyint not null default 0,
76
+ `till_date` datetime not null default '9999-12-31 00:00:00',
77
+ `from_date` datetime not null default '1000-01-01 00:00:00',
78
+ `created_time` datetime DEFAULT NULL,
79
+ `update_time` datetime DEFAULT NULL,
80
+ `is_for_product` tinyint not null default 0,
81
+ PRIMARY KEY (`promotion_id`)
82
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
83
+ SQLTEXT;
84
+
85
+
86
+ $installer->run($sql);
87
+
88
+ $sql=<<<SQLTEXT
89
+ CREATE TABLE {$installer->getTable('qixol_promotion_has_product')}(
90
+ `product_id` int(11) unsigned NOT NULL default 0,
91
+ `parent_product_id` int(11) unsigned NOT NULL default 0,
92
+ `promotion_id` int(11) unsigned NOT NULL default 0,
93
+ `parentsku` varchar(255) NOT NULL DEFAULT '',
94
+ `sku` varchar(255) NOT NULL DEFAULT '',
95
+ `requiredqty` tinyint not null default 0,
96
+ `multipleproductrestrictions` tinyint not null default 0,
97
+ `created_time` datetime DEFAULT NULL,
98
+ `update_time` datetime DEFAULT NULL,
99
+ PRIMARY KEY (`product_id`,`parent_product_id`,`promotion_id`),
100
+ INDEX `idx_qixol_promotion_sku`(`sku`)
101
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
102
+ SQLTEXT;
103
+
104
+
105
+ $installer->run($sql);
106
+
107
+ $sql=<<<SQLTEXT
108
+ CREATE TABLE {$installer->getTable('qixol_banner_box')}(
109
+ banner_box_type varchar(64) not null default '',
110
+ banner_box_is_active tinyint not null default 0,
111
+ banner_box_translation_type varchar(32) not null default '',
112
+ `created_time` datetime DEFAULT NULL,
113
+ `update_time` datetime DEFAULT NULL,
114
+ PRIMARY KEY (`banner_box_type`)
115
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
116
+ SQLTEXT;
117
+
118
+
119
+ $installer->run($sql);
120
+
121
+ $sql=<<<SQLTEXT
122
+ CREATE TABLE {$installer->getTable('qixol_shipping_name_map')}(
123
+ shipping_name varchar(255) not null default '',
124
+ carrier_title varchar(255) not null default '',
125
+ carrier_method varchar(255) not null default '',
126
+ integration_code varchar(255) not null default '',
127
+ `created_time` datetime DEFAULT NULL,
128
+ `update_time` datetime DEFAULT NULL,
129
+ PRIMARY KEY (`shipping_name`),
130
+ UNIQUE KEY `shipping_name_to_shipping_name_map` (`shipping_name`,`integration_code`)
131
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
132
+ SQLTEXT;
133
+
134
+
135
+ $installer->run($sql);
136
+
137
+ $sql=<<<SQLTEXT
138
+ CREATE TABLE {$installer->getTable('qixol_coupon_issued')}(
139
+ entity_id int unsigned not null auto_increment,
140
+ customer_id int unsigned not null default 0,
141
+ coupon_code_value varchar(255) not null default '',
142
+ coupon_valid_till datetime,
143
+ is_used tinyint unsigned not null default 0,
144
+ coupon_description varchar(255) not null default '',
145
+ `created_time` datetime DEFAULT NULL,
146
+ PRIMARY KEY (`entity_id`),
147
+ KEY `IDX_qixol_coupon_issued_customer_id` (`entity_id`),
148
+ CONSTRAINT `FK_qixol_coupon_issued_customer_id_CUSTOMER_ENTITY_ENTITY_ID` FOREIGN KEY (`customer_id`) REFERENCES `customer_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
149
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
150
+ SQLTEXT;
151
+
152
+ $sql=<<<SQLTEXT
153
+ CREATE TABLE {$installer->getTable('qixol_customers_groups_name_map')}(
154
+ customer_group_name varchar(255) not null default '',
155
+ integration_code varchar(255) not null default '',
156
+ `created_time` datetime DEFAULT NULL,
157
+ `update_time` datetime DEFAULT NULL,
158
+ PRIMARY KEY (`customer_group_name`),
159
+ UNIQUE KEY `customer_group_name_to_integration_code` (`customer_group_name`,`integration_code`)
160
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
161
+ SQLTEXT;
162
+
163
+
164
+ $installer->run($sql);
165
+
166
+
167
+ $sql=<<<SQLTEXT
168
+ CREATE TABLE {$installer->getTable('qixol_stores_name_map')}(
169
+ `website` VARCHAR( 255 ) NOT NULL DEFAULT '',
170
+ `store_group` VARCHAR( 255 ) NOT NULL DEFAULT '',
171
+ store_name varchar(255) not null default '',
172
+ integration_code varchar(255) not null default '',
173
+ `created_time` datetime DEFAULT NULL,
174
+ `update_time` datetime DEFAULT NULL,
175
+ PRIMARY KEY (`store_name`),
176
+ UNIQUE KEY `store_name_to_integration_code` (`store_name`,`integration_code`)
177
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
178
+ SQLTEXT;
179
+
180
+
181
+ $installer->run($sql);
182
+
183
+
184
+ $sql=<<<SQLTEXT
185
+ CREATE TABLE {$installer->getTable('qixol_stickers')}(
186
+ `sticker_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
187
+ `filename` varchar(255) NOT NULL DEFAULT '',
188
+ `promo_reference` varchar(255) NOT NULL DEFAULT '',
189
+ `promo_type_name` varchar(255) NOT NULL DEFAULT '',
190
+ `is_default_for_type` tinyint not null default '0',
191
+ `is_system_default_for_type` tinyint not null default '0',
192
+ PRIMARY KEY (`sticker_id`)
193
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
194
+ SQLTEXT;
195
+
196
+ $installer->run($sql);
197
+
198
+
199
+ $sql=<<<SQLTEXT
200
+ CREATE TABLE {$installer->getTable('qixol_cutomer_points')}(
201
+ points_account_id int(11) unsigned NOT NULL AUTO_INCREMENT,
202
+ customer_id int unsigned not null default 0,
203
+ store_id smallint(5) unsigned NOT NULL DEFAULT '0',
204
+ current_points int(5) unsigned NOT NULL DEFAULT '0',
205
+ earned_points int unsigned not null default 0,
206
+ spent_points int unsigned not null default 0,
207
+ PRIMARY KEY (`points_account_id`),
208
+ KEY `FK_catalog_category_ENTITY_STORE` (`store_id`),
209
+ CONSTRAINT `FK_qixol_cutomer_points_customer_id_CUSTOMER_ENTITY_ENTITY_ID` FOREIGN KEY (`customer_id`) REFERENCES `customer_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
210
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
211
+ SQLTEXT;
212
+
213
+ $installer->run($sql);
214
+
215
+
216
+ $sql=<<<SQLTEXT
217
+ ALTER TABLE {$installer->getTable('sales/quote_address')} ADD `points_amount` DECIMAL( 10, 2 ) NOT NULL;
218
+ ALTER TABLE {$installer->getTable('sales/quote_address')} ADD `base_points_amount` DECIMAL( 10, 2 ) NOT NULL;
219
+
220
+ alter table {$installer->getTable('sales/order')} add column promotion_data_applied text;
221
+ ALTER TABLE {$installer->getTable('sales/order')} ADD `points_amount` DECIMAL( 10, 2 ) NOT NULL;
222
+ ALTER TABLE {$installer->getTable('sales/order')} ADD `base_points_amount` DECIMAL( 10, 2 ) NOT NULL;
223
+
224
+ ALTER TABLE {$installer->getTable('sales/invoice')} ADD `points_amount` DECIMAL( 10, 2 ) NOT NULL;
225
+ ALTER TABLE {$installer->getTable('sales/invoice')} ADD `base_points_amount` DECIMAL( 10, 2 ) NOT NULL;
226
+ SQLTEXT;
227
+ $installer->run($sql);
228
+
229
+ $sql=<<<SQLTEXT
230
+ insert into qixol_stickers (`filename`, `promo_type_name`, `is_default_for_type`, `is_system_default_for_type`) VALUES ('custom/stickers/bogof.png', 'BOGOF',1,1);
231
+ INSERT INTO qixol_stickers (`filename`, `promo_type_name`, `is_default_for_type`, `is_system_default_for_type`) VALUES ('custom/stickers/bogor.png','BOGOR',1,1);
232
+ INSERT INTO qixol_stickers (`filename`, `promo_type_name`, `is_default_for_type`, `is_system_default_for_type`) VALUES ('custom/stickers/bundle.png','BUNDLE',1,1);
233
+ INSERT INTO qixol_stickers (`filename`, `promo_type_name`, `is_default_for_type`, `is_system_default_for_type`) VALUES ('custom/stickers/deal.png','DEAL',1,1);
234
+ INSERT INTO qixol_stickers (`filename`, `promo_type_name`, `is_default_for_type`, `is_system_default_for_type`) VALUES ('custom/stickers/freeproduct.png','FREEPRODUCT',1,1);
235
+ INSERT INTO qixol_stickers (`filename`, `promo_type_name`, `is_default_for_type`, `is_system_default_for_type`) VALUES ('custom/stickers/issuecoupon.png','ISSUECOUPON',1,1);
236
+ INSERT INTO qixol_stickers (`filename`, `promo_type_name`, `is_default_for_type`, `is_system_default_for_type`) VALUES ('custom/stickers/issuepoints.png','ISSUEPOINTS',1,1);
237
+ INSERT INTO qixol_stickers (`filename`, `promo_type_name`, `is_default_for_type`, `is_system_default_for_type`) VALUES ('custom/stickers/offers.png','MULTIPLE',1,1);
238
+ INSERT INTO qixol_stickers (`filename`, `promo_type_name`, `is_default_for_type`, `is_system_default_for_type`) VALUES ('custom/stickers/productsreduction.png','PRODUCTSREDUCTION',1,1);
239
+ SQLTEXT;
240
+ $installer->run($sql);
241
+
242
+ //demo
243
+ //Mage::getModel('core/url_rewrite')->setId(null);
244
+ //demo
245
+ $installer->endSetup();
246
+
247
+ ?>
app/design/adminhtml/default/default/layout/qixol.xml ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="1.0.0">
3
+ <qixol_admin_adminhtml_qixolbackend_index>
4
+ <reference name="content">
5
+ <block type="qixol/adminhtml_qixolbackend" name="qixolbackend" template="qixol/qixolbackend.phtml"/>
6
+ </reference>
7
+ </qixol_admin_adminhtml_qixolbackend_index>
8
+ <qixol_admin_adminhtml_banner_edit>
9
+ <update handle="editor"/>
10
+ </qixol_admin_adminhtml_banner_edit>
11
+ <qixol_admin_adminhtml_banner_index>
12
+ <reference name="content">
13
+ <block type="qixol/adminhtml_banner" name="banner" />
14
+ </reference>
15
+ </qixol_admin_adminhtml_banner_index>
16
+
17
+ <qixol_admin_adminhtml_sticker_edit>
18
+ <!--reference name="head">
19
+ <action method="addJs"><script>lib/jquery/jquery-1.10.2.min.js</script></action>
20
+ </reference-->
21
+ <update handle="editor"/>
22
+ </qixol_admin_adminhtml_sticker_edit>
23
+ <qixol_admin_adminhtml_sticker_index>
24
+ <reference name="content">
25
+ <block type="qixol/adminhtml_sticker" name="sticker" />
26
+ </reference>
27
+ </qixol_admin_adminhtml_sticker_index>
28
+
29
+ <qixol_admin_adminhtml_bannerboxes_edit>
30
+ <update handle="editor"/>
31
+ </qixol_admin_adminhtml_bannerboxes_edit>
32
+ <qixol_admin_adminhtml_bannerboxes_index>
33
+ <reference name="content">
34
+ <block type="qixol/adminhtml_bannerboxes" name="bannerboxes" />
35
+ </reference>
36
+ </qixol_admin_adminhtml_bannerboxes_index>
37
+
38
+ <qixol_admin_adminhtml_shippingmap_edit>
39
+ <update handle="editor"/>
40
+ </qixol_admin_adminhtml_shippingmap_edit>
41
+
42
+ <qixol_admin_adminhtml_shippingmap_index>
43
+ <reference name="content">
44
+ <block type="qixol/adminhtml_shippingmap" name="shippingmap" />
45
+ </reference>
46
+ </qixol_admin_adminhtml_shippingmap_index>
47
+
48
+
49
+ <qixol_admin_adminhtml_customergrouspmap_edit>
50
+ <update handle="editor"/>
51
+ </qixol_admin_adminhtml_customergrouspmap_edit>
52
+
53
+ <qixol_admin_adminhtml_customergrouspmap_index>
54
+ <reference name="content">
55
+ <block type="qixol/adminhtml_customergrouspmap" name="customergrouspmap" />
56
+ </reference>
57
+ </qixol_admin_adminhtml_customergrouspmap_index>
58
+
59
+ <qixol_admin_adminhtml_storesmap_edit>
60
+ <update handle="editor"/>
61
+ </qixol_admin_adminhtml_storesmap_edit>
62
+
63
+ <qixol_admin_adminhtml_storesmap_index>
64
+ <reference name="content">
65
+ <block type="qixol/adminhtml_storesmap" name="storesmap" />
66
+ </reference>
67
+ </qixol_admin_adminhtml_storesmap_index>
68
+
69
+ <adminhtml_sales_order_view>
70
+ <reference name="left">
71
+ <block type="adminhtml/sales_order_view_items" name="qixolorderitemswrap" as="qixolorderitemswrap" template="qixol/order/advert.phtml"/>
72
+ </reference>
73
+ <reference name="order_totals">
74
+ <block type="qixol/adminhtml_sales_order_total" name="qixol.sales.order.total" />
75
+ </reference>
76
+ </adminhtml_sales_order_view>
77
+
78
+ <!--adminhtml_sales_order_invoice_new>
79
+ <reference name="invoice_totals">
80
+ <block type="qixol/adminhtml_sales_order_total" name="qixol.sales.order.total" />
81
+ </reference>
82
+ </adminhtml_sales_order_invoice_new>
83
+
84
+ <adminhtml_sales_order_invoice_updateqty>
85
+ <reference name="invoice_totals">
86
+ <block type="qixol/adminhtml_sales_order_total" name="qixol.sales.order.total" />
87
+ </reference>
88
+ </adminhtml_sales_order_invoice_updateqty-->
89
+
90
+ <adminhtml_sales_order_invoice_view>
91
+ <reference name="invoice_totals">
92
+ <block type="qixol/adminhtml_sales_order_total" name="qixol.sales.order.total" />
93
+ </reference>
94
+ </adminhtml_sales_order_invoice_view>
95
+
96
+ <adminhtml_sales_order_creditmemo_view>
97
+ <reference name="creditmemo_totals">
98
+ <block type="qixol/adminhtml_sales_order_total" name="qixol.sales.order.total" />
99
+ </reference>
100
+ </adminhtml_sales_order_creditmemo_view>
101
+
102
+ </layout>
app/design/adminhtml/default/default/template/qixol/bannerboxes.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->getTabsHtml() ?>
app/design/adminhtml/default/default/template/qixol/bannerimage.phtml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php ?>
2
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Banner images') ?></h4>
3
+
4
+ <!--<script type="text/javascript">
5
+
6
+ function addImage() {
7
+ window.location.href = '<?php $this->getUrl('*/*/saverole') ?>';
8
+ }
9
+
10
+ </script>
11
+
12
+ <button id="id_<?php $this->getHtmlId() ?>" title="Add image" type="button" class="scalable save" onclick="addImage()" style=""><span><span><span>Add image</span></span></span></button>-->
13
+
14
+ <?php echo $this->_getGridHtml() ?>
app/design/adminhtml/default/default/template/qixol/banners.phtml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getTabsHtml() ?>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+ function load_banner_funcs(){
5
+ <?php if (($block = $this->getLayout()->getBlock('bannergroup.grid.banner')) && ($_gridJsObject = $block->getJsObjectName())): ?>
6
+ if(!$('in_bannergroup_banners')){
7
+ setTimeout('load_banner_funcs()',500);
8
+ return false;
9
+ }
10
+ var selectedBanners=$H(<?php echo $this->getBannersJson(); ?>);
11
+ $('in_bannergroup_banners').value = selectedBanners.toQueryString();
12
+
13
+ function registerSelectedBanner(grid, element, checked){
14
+ if(checked){
15
+ selectedBanners.set(element.value, element.value);
16
+ }
17
+ else{
18
+ selectedBanners.unset(element.value);
19
+ }
20
+ $('in_bannergroup_banners').value = selectedBanners.toQueryString();
21
+ grid.reloadParams = {'selected_banners[]':selectedBanners.keys()};
22
+ }
23
+ function selectedBannerRowClick(grid, event){
24
+ var trElement = Event.findElement(event, 'tr');
25
+ var isInput = Event.element(event).tagName == 'INPUT';
26
+ if(trElement){
27
+ var checkbox = Element.getElementsBySelector(trElement, 'input');
28
+ if(checkbox[0]){
29
+ var checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
30
+ <?php echo $_gridJsObject ?>.setCheckboxChecked(checkbox[0], checked);
31
+ }
32
+ }
33
+ }
34
+
35
+ var tabIndex = 1000;
36
+ function selectedBannerRowInit(grid, row){
37
+ var checkbox = $(row).getElementsByClassName('checkbox')[0];
38
+ }
39
+
40
+
41
+ <?php echo $_gridJsObject ?>.rowClickCallback = selectedBannerRowClick;
42
+ <?php echo $_gridJsObject ?>.initRowCallback = selectedBannerRowInit;
43
+ <?php echo $_gridJsObject ?>.checkboxCheckCallback = registerSelectedBanner;
44
+ <?php echo $_gridJsObject ?>.rows.each(function(row){selectedBannerRowInit(<?php echo $_gridJsObject ?>, row)});
45
+
46
+ <?php endif; ?>
47
+ }
48
+ load_banner_funcs();
49
+ //]]>
50
+ </script>
app/design/adminhtml/default/default/template/qixol/customergrouspmap.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->getTabsHtml() ?>
app/design/adminhtml/default/default/template/qixol/order/advert.phtml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $order = $this->getOrder();
3
+ $promotions_raw=$order->getPromotionDataApplied();
4
+ $inline_item_advert='';
5
+ if(strlen($promotions_raw)>3){
6
+ $promotions_data_array=unserialize($promotions_raw);
7
+ if (is_array($promotions_data_array['items'])&&count($promotions_data_array['items'])>0){
8
+
9
+ foreach ($order->getAllItems() as $item) {
10
+ if (isset($promotions_data_array['items'][$item->getQuoteItemId()]['promotions'])){
11
+ foreach ($promotions_data_array['items'][$item->getQuoteItemId()]['promotions'] as $promotion_data){
12
+ if ($promotion_data['description']!=''){
13
+ $inline_item_advert.="$('<div class=\"order_inline_item_advert\" style=\"font-weight:bold;color:#6666FF\">".$promotion_data['description']."</div>').appendTo($('#order_item_".$item->getId()."'));";
14
+ }
15
+ }
16
+ }
17
+ ;
18
+ }
19
+
20
+ if (isset($promotions_data_array['promotion_summary'])){
21
+ foreach ($promotions_data_array['promotion_summary'] as $inline_cart_promotion)
22
+ if($inline_cart_promotion['data']['basketlevel']>0){
23
+ switch ($inline_cart_promotion['data']['type']){
24
+ case 'ISSUEPOINTS';
25
+ $inline_item_advert.="$('<div class=\"order_total_advert\" style=\"font-weight:bold;color:#6666FF\">".$inline_cart_promotion['data']['issuedpoints']."&nbsp;pt."."</div>').appendTo($('#order-totals'));";
26
+ break;
27
+ }
28
+ }
29
+ }
30
+
31
+
32
+ ?><script type="text/javascript" src="/js/lib/jquery/jquery-1.10.2.min.js"></script><script type="text/javascript">$.noConflict();jQuery( document ).ready(function( $ ) { <?php
33
+ echo $inline_item_advert;
34
+ ?>});</script><?php
35
+
36
+ }
37
+ }
38
+ ?>
app/design/adminhtml/default/default/template/qixol/qixolbackend.phtml ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $run_pic=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)."adminhtml/default/default/images/_run.gif";
4
+ $post_url=$this->getUrl('qixol_admin/ajax');
5
+ $post_url_upd=$this->getUrl('qixol_admin/ajax/UpdateStatus');
6
+
7
+ ?><div id="qixolexport_status_template" name="qixolexpor_status_template" style="display:none">
8
+ <ul>
9
+ <li>
10
+ Start export
11
+ &nbsp
12
+ <span id='qixolexport_process'>
13
+ <img src='<?php echo $run_pic?>'
14
+ alt='product export run' />
15
+ </span>
16
+ </li>
17
+ <!--li>
18
+ Export finished
19
+ &nbsp
20
+ <span id='qixolexport_export_done'>
21
+ <img src='<?php echo $run_pic?>'
22
+ alt='Export finished' />
23
+ </span>
24
+ </li-->
25
+ </ul>
26
+ </div>
27
+ <?php
28
+ $start_import_button = $this->getLayout()->createBlock('adminhtml/widget_button')
29
+ ->setType('button')
30
+ ->setClass('scalable')
31
+ ->setLabel('Export now')
32
+ ->setOnClick("start_product_export()")
33
+ ->toHtml();
34
+ $safe_mode_set = ini_get('safe_mode');
35
+ if($safe_mode_set){
36
+ $html .="<p class='sinch-error'><b>You can't start export (safe_mode is 'On'. set safe_mode = Off in php.ini )<b></p>";
37
+ } else {
38
+ $html .= $start_import_button;
39
+ }
40
+
41
+ $export=Mage::getModel('qixol/sinch');
42
+ $last_export=$export->getDataOfLatestExportProduct();
43
+ $last_exp_status=$last_import['status_export'];
44
+ if($last_exp_status=='error'){
45
+ $html.='<div id="export_current_status_message" name="export_current_status_message" style="display:true"><br><br><hr/><p class="sinch-error">The export has failed.<br> Error reporting : "'.$last_import['status_export_message'].'"</p></div>';
46
+ }elseif($last_imp_status=='success'){
47
+ $html.='<div id="export_current_status_message" name="export_current_status_message" style="display:true"><br><br><hr/><p class="sinch-success">'.$last_import['number_of_products'].' products imported succesfully!</p></div>';
48
+ }elseif($last_imp_status=='process'){
49
+ $html.='<div id="export_current_status_message" name="export_current_status_message" style="display:true"><br><br><hr/><p>Export is running now</p></div>';
50
+ }else{
51
+ $html.='<div id="export_current_status_message" name="export_current_status_message" style="display:true"></div>';
52
+ }
53
+
54
+ echo $html;
55
+
56
+ ?>
57
+ <script>
58
+ function start_product_export(){
59
+ set_run_icon();
60
+ status_data=document.getElementById('qixolexport_status_template');
61
+ curr_status_data=document.getElementById('export_current_status_message');
62
+ curr_status_data.style.display='none';
63
+ status_data.style.display='';
64
+ // status_data.innerHTML='';
65
+ sinch = new Sinch('<?php echo $post_url?>','<?php echo $post_url_upd?>');
66
+ sinch.startProductExport();
67
+
68
+ //
69
+ }
70
+ function set_run_icon(){
71
+ run_pic='<img src=\"<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)."adminhtml/default/default/images/_run.gif"; ?>"/>';
72
+ document.getElementById('qixolexport_process').innerHTML=run_pic;
73
+ //document.getElementById('qixolexport_export_done').innerHTML=run_pic;
74
+
75
+
76
+
77
+ }
78
+
79
+ var Sinch = Class.create();
80
+ Sinch.prototype = {
81
+
82
+ initialize: function(postUrl, postUrlUpd) {
83
+ this.postUrl = postUrl;
84
+ this.postUrlUpd = postUrlUpd;
85
+ this.failureUrl = document.URL;
86
+ // unique user session ID
87
+ this.SID = null;
88
+ // object with event message data
89
+ this.objectMsg = null;
90
+ this.prevMsg = '';
91
+ // interval object
92
+ this.updateTimer = null;
93
+ // default shipping code. Display on errors
94
+
95
+ elem = 'checkoutSteps';
96
+ clickableEntity = '.head';
97
+
98
+ // overwrite Accordion class method
99
+ var headers = $$('#' + elem + ' .section ' + clickableEntity);
100
+ headers.each(function(header) {
101
+ Event.observe(header,'click',this.sectionClicked.bindAsEventListener(this));
102
+ }.bind(this));
103
+ },
104
+ startProductExport: function () {
105
+ _this = this;
106
+ new Ajax.Request(this.postUrl,
107
+ {
108
+ method:'post',
109
+ parameters: '',
110
+ requestTimeout: 10,
111
+ /*
112
+ onLoading:function(){
113
+ alert('onLoading');
114
+ },
115
+ onLoaded:function(){
116
+ alert('onLoaded');
117
+ },
118
+ */
119
+ onSuccess: function(transport) {
120
+ var response = transport.responseText || null;
121
+ _this.SID = response;
122
+ if (_this.SID) {
123
+ _this.updateTimer = setInterval(function(){_this.updateEvent();},7000);
124
+ $('session_id').value = _this.SID;
125
+ } else {
126
+ alert('Can not get your session ID. Please reload the page!');
127
+ }
128
+ },
129
+ onTimeout: function() { alert('Can not get your session ID. Timeout!'); },
130
+ onFailure: function() { alert('Something went wrong...') }
131
+ });
132
+
133
+ },
134
+
135
+ updateEvent: function () {
136
+ _this = this;
137
+ new Ajax.Request(this.postUrlUpd,
138
+ {
139
+ method: 'post',
140
+ parameters: {session_id: this.SID},
141
+ onSuccess: function(transport) {
142
+ _this.objectMsg = transport.responseText.evalJSON();
143
+ _this.prevMsg = _this.objectMsg.message;
144
+ if(_this.prevMsg!=''){
145
+ _this.updateStatusHtml();
146
+ }
147
+
148
+ if (_this.objectMsg.error == 1) {
149
+ // Do something on error
150
+ _this.clearUpdateInterval();
151
+ }
152
+
153
+ if (_this.objectMsg.finished == 1) {
154
+ _this.objectMsg.message='Import finished';
155
+ _this.updateStatusHtml();
156
+ _this.clearUpdateInterval();
157
+
158
+ }
159
+
160
+ },
161
+ onFailure: this.ajaxFailure.bind(),
162
+ });
163
+ },
164
+
165
+ updateStatusHtml: function(){
166
+ message=this.objectMsg.message.toLowerCase();
167
+ extendedmessage=this.objectMsg.extmessage.toLowerCase();
168
+ mess_id='qixolexport_'+message.replace(/\s+/g, '_');
169
+ if(!document.getElementById(mess_id)){
170
+ // alert(mess_id+' - not exist');
171
+ }
172
+ else{
173
+ //alert (mess_id+' - exist');
174
+ $(mess_id).innerHTML='<img src=\"".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)."adminhtml/default/default/images/_yes.gif"."\"/>'
175
+ if (mess_id=='qixolexport_export_done'){//if processed quicker
176
+ $('qixolexport_process').innerHTML='<img src=\"".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)."adminhtml/default/default/images/_yes.gif"."\"/>'
177
+ }
178
+ }
179
+ if (extendedmessage!='')
180
+ $('qixolexport_status_template').innerHTML=extendedmessage;
181
+ //$('qixolexport_status_template').innerHTML=htm+'<br>'+this.objectMsg.message;
182
+ },
183
+
184
+ ajaxFailure: function(){
185
+ this.clearUpdateInterval();
186
+ location.href = this.failureUrl;
187
+ },
188
+
189
+ clearUpdateInterval: function () {
190
+ clearInterval(this.updateTimer);
191
+ },
192
+
193
+
194
+ }
195
+ </script>
196
+
app/design/adminhtml/default/default/template/qixol/shippingmap.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->getTabsHtml() ?>
app/design/adminhtml/default/default/template/qixol/stickers.phtml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getTabsHtml() ?>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+ function load_banner_funcs(){
5
+ <?php if (($block = $this->getLayout()->getBlock('bannergroup.grid.banner')) && ($_gridJsObject = $block->getJsObjectName())): ?>
6
+ if(!$('in_bannergroup_banners')){
7
+ setTimeout('load_banner_funcs()',500);
8
+ return false;
9
+ }
10
+ var selectedBanners=$H(<?php echo $this->getBannersJson(); ?>);
11
+ $('in_bannergroup_banners').value = selectedBanners.toQueryString();
12
+
13
+ function registerSelectedBanner(grid, element, checked){
14
+ if(checked){
15
+ selectedBanners.set(element.value, element.value);
16
+ }
17
+ else{
18
+ selectedBanners.unset(element.value);
19
+ }
20
+ $('in_bannergroup_banners').value = selectedBanners.toQueryString();
21
+ grid.reloadParams = {'selected_banners[]':selectedBanners.keys()};
22
+ }
23
+ function selectedBannerRowClick(grid, event){
24
+ var trElement = Event.findElement(event, 'tr');
25
+ var isInput = Event.element(event).tagName == 'INPUT';
26
+ if(trElement){
27
+ var checkbox = Element.getElementsBySelector(trElement, 'input');
28
+ if(checkbox[0]){
29
+ var checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
30
+ <?php echo $_gridJsObject ?>.setCheckboxChecked(checkbox[0], checked);
31
+ }
32
+ }
33
+ }
34
+
35
+ var tabIndex = 1000;
36
+ function selectedBannerRowInit(grid, row){
37
+ var checkbox = $(row).getElementsByClassName('checkbox')[0];
38
+ }
39
+
40
+
41
+ <?php echo $_gridJsObject ?>.rowClickCallback = selectedBannerRowClick;
42
+ <?php echo $_gridJsObject ?>.initRowCallback = selectedBannerRowInit;
43
+ <?php echo $_gridJsObject ?>.checkboxCheckCallback = registerSelectedBanner;
44
+ <?php echo $_gridJsObject ?>.rows.each(function(row){selectedBannerRowInit(<?php echo $_gridJsObject ?>, row)});
45
+
46
+ <?php endif; ?>
47
+ }
48
+ load_banner_funcs();
49
+ //]]>
50
+ </script>
app/design/adminhtml/default/default/template/qixol/storesmap.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->getTabsHtml() ?>
app/design/adminhtml/default/default/template/qixol/system/config/attributes.phtml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <input type="hidden" name="<?php echo $this->getNamePrefix() ?>" value="" /><!-- this is send if nothing is checked -->
2
+ <ul class="checkboxes">
3
+ <?php foreach ($this->getValues() as $name => $label): ?>
4
+ <li>
5
+ <input type="checkbox" value="<?php echo $name?>" name="<?php echo $this->getNamePrefix() ?>[]" id="<?php echo $this->getHtmlId() . '_' . $name ?>"<?php echo ($this->getIsChecked($name) ? ' checked="checked"' : '') ?>/><label for="<?php echo $this->getHtmlId() . '_' . $name ?>">
6
+ <?php echo $label ?>
7
+ </label>
8
+ </li>
9
+ <?php endforeach;?>
10
+ </ul>
app/design/frontend/base/default/layout/qixol.xml ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="1.0.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addItem"><type>skin_css</type><name>css/qixol.css</name></action>
6
+ </reference>
7
+ <reference name="minicart_content">
8
+ <action method="setTemplate"><template>qixol/minicart/mincart.phtml</template></action>
9
+ <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>qixol/minicart/default.phtml</template></action>
10
+ <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>qixol/minicart/default.phtml</template></action>
11
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>qixol/minicart/default.phtml</template></action>
12
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>qixol/minicart/default.phtml</template></action>
13
+ <block type="checkout/onepage_link" name="qixolmincartwrap" as="qixolmincartwrap" template="qixol/minicart/advert.phtml"/>
14
+ </reference>
15
+ </default>
16
+
17
+ <catalog_product_view>
18
+ <reference name="content">
19
+ <block type="catalog/product_view" after='-' name="qixol-promo-wrap-data" template="qixol/product/qixol_product_info.phtml"/>
20
+ </reference>
21
+ <reference name="product.info.addtocart">
22
+ <block type="catalog/product_view" name="qixol-promo-details" template="qixol/product/qixol_info_details.phtml"/>
23
+ </reference>
24
+ </catalog_product_view>
25
+
26
+ <catalog_category_default>
27
+ <reference name="content">
28
+ <block type="catalog/product_list" name="qixol-wrap-text" after="category.products" template="qixol/product/qixol_adv.phtml"/>
29
+ </reference>
30
+ </catalog_category_default>
31
+
32
+ <catalog_category_layered>
33
+ <reference name="content">
34
+ <block type="catalog/product_list" name="qixol-wrap-text" after="category.products" template="qixol/product/qixol_adv.phtml"/>
35
+ </reference>
36
+ </catalog_category_layered>
37
+
38
+ <checkout_cart_index>
39
+ <reference name="checkout.cart">
40
+ <action method="setTemplate"><template>qixol/cart/cart.phtml</template></action>
41
+ <action method="addItemRender">
42
+ <type>simple</type><block>checkout/cart_item_renderer</block><template>qixol/cart/item/default.phtml</template>
43
+ </action>
44
+ <action method="addItemRender">
45
+ <type>grouped</type><block>checkout/cart_item_renderer</block><template>qixol/cart/item/default.phtml</template>
46
+ </action>
47
+ <action method="addItemRender">
48
+ <type>configurable</type><block>checkout/cart_item_renderer</block><template>qixol/cart/item/default.phtml</template>
49
+ </action>
50
+ <block type="checkout/cart_totals" name="promo.checkout.cart.totals" as="totals" template="qixol/cart/totals.phtml"/>
51
+ </reference>
52
+ <reference name="checkout.cart.extra">
53
+ <block type="core/template" name="bonuspointsbox" as="bonuspointsbox" template="qixol/cart/bonuspointbox.phtml" />
54
+ </reference>
55
+ <reference name="content">
56
+ <block type="checkout/onepage_link" name="qixolcartwrap" as="qixolcartwrap" template="qixol/cart/advert.phtml"/>
57
+ </reference>
58
+ </checkout_cart_index>
59
+
60
+
61
+ <checkout_onepage_review>
62
+ <reference name="root">
63
+ <action method="setTemplate"><template>qixol/onepage/review.phtml</template></action>
64
+ <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>qixol/onepage/item.phtml</template></action>
65
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>qixol/onepage/item.phtml</template></action>
66
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>qixol/onepage/item.phtml</template></action>
67
+ </reference>
68
+ <reference name="checkout.onepage.review.info.items.after">
69
+ <block type="checkout/onepage_link" name="qixolreviewwrap" as="qixolreviewwrap" template="qixol/onepage/advert.phtml"/>
70
+ </reference>
71
+ </checkout_onepage_review>
72
+
73
+ <customer_account>
74
+ <!-- Qixol issued coupons -->
75
+ <reference name="customer_account_navigation">
76
+ <action method="addLink" translate="label" module="qixol"><name>issuedcoupon</name><path>qixol/issuedcoupon</path><label>Issued Coupons</label></action>
77
+ </reference>
78
+ </customer_account>
79
+
80
+ <customer_account_index>
81
+ <!-- Qixol issued points -->
82
+ <reference name="customer_account_dashboard_top">
83
+ <action method="setTemplate"><template>qixol/issuedpoints/box.phtml</template></action>
84
+ <block type="core/template" name="customer_account_points" as="points" template="qixol/issuedpoints/dashboard_points.phtml"/>
85
+ </reference>
86
+ </customer_account_index>
87
+
88
+ <qixol_issuedcoupon_index translate="label">
89
+ <label>Customer Qixol Issued Coupons</label>
90
+ <update handle="customer_account"/>
91
+ <reference name="my.account.wrapper">
92
+ <block type="qixol/issuedcoupon" name="qixol-issuedcoupon" template="qixol/issuedcoupon/list.phtml"/>
93
+ </reference>
94
+ </qixol_issuedcoupon_index>
95
+
96
+ <sales_order_view>
97
+ <reference name="order_items">
98
+ <action method="setTemplate"><template>qixol/myaccount/order/items/items.phtml</template></action>
99
+ <action method="addItemRender"><type>default</type><block>sales/order_item_renderer_default</block><template>qixol/myaccount/order/items/default.phtml</template></action>
100
+ <action method="addItemRender"><type>grouped</type><block>sales/order_item_renderer_grouped</block><template>qixol/myaccount/order/items/default.phtml</template></action>
101
+ </reference>
102
+ <reference name="order_totals">
103
+ <block type="qixol/sales_order_total" name="qixol.sales.order.total" />
104
+ </reference>
105
+ </sales_order_view>
106
+
107
+ <sales_order_print>
108
+ <reference name="sales.order.print">
109
+ <action method="setTemplate"><template>qixol/myaccount/order/print/print.phtml</template></action>
110
+ <action method="addItemRender"><type>default</type><block>sales/order_item_renderer_default</block><template>qixol/myaccount/order/print/default.phtml</template></action>
111
+ <action method="addItemRender"><type>grouped</type><block>sales/order_item_renderer_grouped</block><template>qixol/myaccount/order/print/default.phtml</template></action>
112
+ </reference>
113
+ <reference name="order_totals">
114
+ <block type="qixol/sales_order_total" name="qixol.sales.order.total" />
115
+ </reference>
116
+ </sales_order_print>
117
+
118
+ <sales_email_order_items>
119
+ <reference name="items">
120
+ <action method="setTemplate"><template>qixol/myaccount/order/email/items.phtml</template></action>
121
+ <action method="addItemRender"><type>default</type><block>sales/order_email_items_order_default</block><template>qixol/myaccount/order/email/default.phtml</template></action>
122
+ <action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>qixol/myaccount/order/email/default.phtml</template></action>
123
+ </reference>
124
+ <reference name="order_totals">
125
+ <block type="qixol/sales_order_total" name="qixol.sales.order.total" />
126
+ </reference>
127
+ </sales_email_order_items>
128
+
129
+ <sales_email_order_invoice_items>
130
+ <reference name="invoice_totals">
131
+ <block type="qixol/sales_order_total" name="qixol.sales.order.total" />
132
+ </reference>
133
+ </sales_email_order_invoice_items>
134
+
135
+ <sales_order_invoice>
136
+ <reference name="invoice_totals">
137
+ <block type="qixol/sales_order_total" name="qixol.sales.order.total" />
138
+ </reference>
139
+ </sales_order_invoice>
140
+
141
+ <sales_order_printinvoice>
142
+ <reference name="invoice_totals">
143
+ <block type="qixol/sales_order_total" name="qixol.sales.order.total" />
144
+ </reference>
145
+ </sales_order_printinvoice>
146
+ <sales_order_creditmemo>
147
+ <reference name="creditmemo_totals">
148
+ <block type="qixol/sales_order_total" name="qixol.sales.order.total" />
149
+ </reference>
150
+ </sales_order_creditmemo>
151
+ <sales_order_printcreditmemo>
152
+ <reference name="creditmemo_totals">
153
+ <block type="qixol/sales_order_total" name="qixol.sales.order.total" />
154
+ </reference>
155
+ </sales_order_printcreditmemo>
156
+ <sales_email_order_creditmemo_items>
157
+ <reference name="creditmemo_totals">
158
+ <block type="qixol/sales_order_total" name="qixol.sales.order.total" />
159
+ </reference>
160
+ </sales_email_order_creditmemo_items>
161
+ </layout>
162
+
app/design/frontend/base/default/template/qixol/cart/advert.phtml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //$place_box_in_design_after_pattern=Mage::getStoreConfig('qixol/integraion/boxcartpromotion')
3
+ $place_box_in_design_after_pattern='.cart';
4
+
5
+
6
+ $cart_advertisment_=Mage::getModel('qixol/advert');
7
+
8
+ $inline_cart_advert='';
9
+ $total_discount_amount=0;
10
+ $delivery_discount_amount=0;
11
+ //for cart items
12
+ $cart = Mage::getModel('checkout/cart')->getQuote();
13
+ foreach ($cart->getAllItems() as $item) {
14
+ if (isset($_SESSION['qixol_quoted_items'])&&isset($_SESSION['qixol_quoted_items']['items'][$item->getId()])){
15
+ if ((int)Mage::getStoreConfig('qixol/frontend/cartjavascr')>0 && Mage::getStoreConfig('qixol/advanced/services')!='dontdisplay' &&
16
+ isset($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions']))
17
+ foreach ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'] as $promotion){
18
+ //inline level promotion
19
+ $promotionDisplayText = $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display_text'];
20
+ if (empty($promotionDisplayText)) {
21
+ $promotionDisplayText = $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['name'];
22
+ }
23
+ if ((int)$promotion['basketlevel'] == 0 && isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]) && Mage::getStoreConfig('qixol/advanced/services')=='displaytext'){
24
+ $inline_cart_advert .= "$('<div class=\"cart_inline_item_promo\">";
25
+ $inline_cart_advert .= addslashes($promotionDisplayText);
26
+ $inline_cart_advert .= "</div>').appendTo($('#qixol_idx_cart_item_name_";
27
+ $inline_cart_advert .= $item->getId();
28
+ $inline_cart_advert .= "'));";
29
+ } elseif((int)$promotion['basketlevel'] == 0 && isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]) && Mage::getStoreConfig('qixol/advanced/services')=='displayname') {
30
+ $inline_cart_advert .= "$('<div class=\"cart_inline_item_promo\">";
31
+ $inline_cart_advert .= addslashes($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['name']);
32
+ $inline_cart_advert .= "</div>').appendTo($('#qixol_idx_cart_item_name_";
33
+ $inline_cart_advert .= $item->getId();
34
+ $inline_cart_advert .= "'));";
35
+
36
+ } elseif((int)$promotion['basketlevel'] == 0 && isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displaytype') {
37
+ $inline_cart_advert .= "$('<div class=\"cart_inline_item_promo\">";
38
+ $inline_cart_advert .= addslashes($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display']);
39
+ $inline_cart_advert .= "</div>').appendTo($('#qixol_idx_cart_item_name_";
40
+ $inline_cart_advert .= $item->getId();
41
+ $inline_cart_advert .= "'));";
42
+ }
43
+
44
+ //if quantity changed (get one + one free so will be splited to 2 products with 1 free)
45
+ if ((int)Mage::getStoreConfig('qixol/frontend/cartjavascr')>0 &&$_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_qty']>0)
46
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_new_qty\">For&nbsp;promo&nbsp;".addslashes($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['quantity'])."&nbsp;Qty</div>').appendTo($('#qixol_idx_cart_item_qty_".$item->getId()."'));";
47
+
48
+ if ((int)Mage::getStoreConfig('qixol/frontend/cartjavascr')>0 &&$_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_price']>0)
49
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_new_price\">Only for - 1 ".addslashes($this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['lineamount']))."</div>').appendTo($('#qixol_idx_cart_item_price_".$item->getId()."'));";
50
+
51
+ }
52
+ }
53
+
54
+ if (isset($_SESSION['qixol_quoted_items']['items'])){
55
+ foreach ($_SESSION['qixol_quoted_items']['items'] as $cart_item_process){
56
+ if ($cart_item_process['data']['totaldiscount']>0&&$cart_item_process['new']==0&&((int)Mage::getStoreConfig('qixol/advanced/separateitem')>0||$cart_item_process['data']['generated']==false)){
57
+ $total_discount_amount+=$cart_item_process['data']['totaldiscount'];
58
+ }/*elseif($cart_item_process['data']['totaldiscount']>0&&$cart_item_process['new']==0&&((int)Mage::getStoreConfig('qixol/advanced/separateitem')==0&&$cart_item_process['data']['generated']==true)){
59
+ $total_discount_amount-=$cart_item_process['data']['totaldiscount'];
60
+ }*/
61
+ /*elseif($cart_item_process['data']['isdelivery']){
62
+ foreach ($cart_item_process['promotions'] as $delivery_promotion){
63
+ if ($delivery_promotion['discountamount']>0){
64
+ $delivery_discount_amount+=$delivery_promotion['discountamount'];
65
+ }
66
+ }
67
+ }*/
68
+ }
69
+ if (isset($_SESSION['qixol_quoted_items']['cart_data']['deliverytotaldiscount'])){
70
+ $delivery_discount_amount=$_SESSION['qixol_quoted_items']['cart_data']['deliverytotaldiscount'];
71
+ }
72
+ }
73
+
74
+ if (isset($_SESSION['qixol_quoted_items']['summary'])){
75
+ foreach ($_SESSION['qixol_quoted_items']['summary'] as $cart_total_process){
76
+ if ($cart_total_process['data']['discountamount']>0&&$cart_total_process['data']['type']=='BASKETREDUCTION'){
77
+ $total_discount_amount+=$cart_total_process['data']['discountamount'];
78
+ }
79
+ }
80
+ }
81
+ }
app/design/frontend/base/default/template/qixol/cart/bonuspointbox.phtml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style>
2
+ #bonuspoints .input-text{
3
+ float:left;
4
+ border-radius: 0;
5
+ height: 30px;
6
+ margin: 4px 10px 0 0;
7
+ width: 100px;
8
+ }
9
+
10
+ #bonuspoints .button-wrapper{
11
+ float: left;
12
+ }
13
+
14
+ #bonuspoints label{
15
+ float:left;
16
+ font-family: "Raleway", "Helvetica Neue", Verdana, Arial, sans-serif;
17
+ font-size: 12px;
18
+ font-weight: 400;
19
+ text-align: left;
20
+ text-transform: uppercase;
21
+ min-width: 90px;
22
+ display: inline-block;
23
+ margin-right: 10px;
24
+ line-height:32px;
25
+ }
26
+ .discount h2{
27
+ font-weight:bold;
28
+ font-size:12px;
29
+ }
30
+ </style>
31
+ <?php
32
+ $customerId = Mage::getModel('customer/session')->getCustomerId();
33
+ $customerPoints = Mage::getModel('qixol/Bonuspoints')->load($customerId);
34
+ ?>
35
+ <div class="discount">
36
+ <h2>Reward Points</h2>
37
+ <?php $r_disc = Mage::getSingleton('customer/session')->getPointsAmount(); ?>
38
+ <form action="<?php echo Mage::getUrl('qixol/cart/applypoints') ?>" id="bonuspoints" method="post">
39
+
40
+ <div class="discount-form">
41
+ <label for="coupon_code"><?php echo $this->__('Points') ?></label>
42
+ <input type="hidden" name="removepoints" id="remove-points" value="0" />
43
+ <div class="field-wrapper">
44
+ <input class="input-text" type="text" id="reward_points" name="reward_points" value="<?php echo $r_disc; ?>" />
45
+ <div class="button-wrapper">
46
+ <button type="button" title="<?php echo $this->__('Apply') ?>" class="button2" onclick="rewardForm.submit(false)" value="<?php echo $this->__('Apply') ?>"><span><span><?php echo $this->__('Apply') ?></span></span></button>
47
+
48
+ <?php if(strlen($r_disc > 0)): ?>
49
+ <button type="button" title="<?php echo $this->__('Cancel') ?>" class="button2 cancel-coupon" onclick="rewardForm.submit(true)" value="<?php echo $this->__('Cancel') ?>"><span><span><?php echo $this->__('Cancel') ?></span></span>
50
+ </button>
51
+ <?php endif;?>
52
+
53
+ </div>
54
+ </div><br>
55
+ <div style="padding-top:20px;"><?php echo $this->__('Balance Available') ?> : <?= sprintf('%d',$customerPoints->getCurrentPoints()); ?> </div>
56
+ </div>
57
+ </form>
58
+
59
+ </div>
60
+
61
+ <script type="text/javascript">
62
+ //<![CDATA[
63
+ var rewardForm = new VarienForm('bonuspoints');
64
+ rewardForm.submit = function (isRemove) {
65
+ if (isRemove) {
66
+ $('reward_points').removeClassName('required-entry');
67
+ $('remove-points').value = "1";
68
+ } else {
69
+ $('reward_points').addClassName('required-entry');
70
+ $('remove-points').value = "0";
71
+ }
72
+ return VarienForm.prototype.submit.bind(rewardForm)();
73
+ }
74
+ //]]>
75
+ </script>
app/design/frontend/base/default/template/qixol/cart/cart.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 rwd_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Shopping cart template
30
+ *
31
+ * @var $this Mage_Checkout_Block_Cart
32
+ */
33
+ ?>
34
+ <?php $_priceDisplay = ($this->helper('tax')->displayCartBothPrices()) ? 'display-both-prices' : 'display-single-price'; ?>
35
+ <div class="cart <?php echo $_priceDisplay; ?>">
36
+ <div class="page-title title-buttons">
37
+ <h1><?php echo $this->__('Shopping Cart') ?></h1>
38
+ <?php if(!$this->hasError()): ?>
39
+ <ul class="checkout-types top">
40
+ <?php foreach ($this->getMethods('top_methods') as $method): ?>
41
+ <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
42
+ <li><?php echo $methodHtml; ?></li>
43
+ <?php endif; ?>
44
+ <?php endforeach; ?>
45
+ </ul>
46
+ <?php endif; ?>
47
+ </div>
48
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
49
+ <?php echo $this->getChildHtml('form_before') ?>
50
+ <form action="<?php echo $this->getFormActionUrl() ?>" method="post">
51
+ <?php echo $this->getBlockHtml('formkey'); ?>
52
+ <table id="shopping-cart-table" class="cart-table data-table">
53
+ <col width="1" />
54
+ <col width="1" />
55
+ <col width="1" />
56
+ <col width="1" />
57
+ <col width="1" />
58
+ <col width="1" />
59
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
60
+ <col width="1" />
61
+ <col width="1" />
62
+ <?php endif; ?>
63
+
64
+ <?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 2 : 1); ?>
65
+ <thead>
66
+ <tr>
67
+ <th rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Product') ?></span></th>
68
+
69
+ <th rowspan="<?php echo $mergedCells; ?>">&nbsp;</th>
70
+
71
+ <th class="a-center cart-price-head" colspan="<?php echo $mergedCells; ?>">
72
+ <!-- <div class="cart-price-placeholder">-->
73
+ <span class="nobr"><?php echo $this->__('Price') ?></span>
74
+ <!-- </div>-->
75
+ </th>
76
+
77
+ <th rowspan="<?php echo $mergedCells; ?>" class="a-center">
78
+ <?php echo $this->__('Qty') ?>
79
+
80
+ <?php /*if ($this->helper('wishlist')->isAllowInCart()) : ?>
81
+ <span class="nobr"><?php echo $this->__('Move to Wishlist') ?></span>
82
+ <?php endif*/ ?>
83
+
84
+ </th>
85
+
86
+ <th class="a-center cart-total-head" colspan="<?php echo $mergedCells; ?>">
87
+ <!-- <div class="cart-total-placeholder">-->
88
+ <?php echo $this->__('Subtotal') ?>
89
+ <!-- </div>-->
90
+ </th>
91
+
92
+ <th class="a-center" rowspan="<?php echo $mergedCells; ?>">&nbsp;</th>
93
+
94
+ </tr>
95
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
96
+ <tr>
97
+ <th class="a-center cart-price-head"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
98
+ <th class="a-center cart-price-head"><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
99
+ <th class="a-center cart-total-head"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
100
+ <th class="a-center cart-total-head"><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
101
+ </tr>
102
+ <?php endif; ?>
103
+ </thead>
104
+ <tfoot>
105
+ <tr>
106
+ <td colspan="50" class="a-right cart-footer-actions">
107
+
108
+ <!-- Make this button the first responder rather than empty cart -->
109
+ <button type="submit" style="visibility:hidden;" data-cart-item-update name="update_cart_action" value="update_qty" title="<?php echo $this->quoteEscape($this->__('Update Shopping Cart')); ?>" class="button2 btn-update"><span><span><?php echo $this->__('Update Shopping Cart'); ?></span></span></button>
110
+
111
+ <button type="submit" name="update_cart_action" data-cart-empty value="empty_cart" title="<?php echo $this->quoteEscape($this->__('Empty Cart')); ?>" class="button2 btn-empty" id="empty_cart_button"><span><span><?php echo $this->__('Empty Cart'); ?></span></span></button>
112
+
113
+ <button type="submit" name="update_cart_action" data-cart-item-update value="update_qty" title="<?php echo $this->quoteEscape($this->__('Update Shopping Cart')); ?>" class="button2 btn-update"><span><span><?php echo $this->__('Update Shopping Cart'); ?></span></span></button>
114
+
115
+ <span class="or">-<?php echo $this->__('or'); ?>-</span>
116
+
117
+ <?php if($this->getContinueShoppingUrl()): ?>
118
+ <button type="button" title="<?php echo $this->quoteEscape($this->__('Continue Shopping')) ?>" class="button2 btn-continue" onclick="setLocation('<?php echo Mage::helper('core')->quoteEscape($this->getContinueShoppingUrl()) ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
119
+ <?php endif; ?>
120
+ <!--[if lt IE 8]>
121
+ <input type="hidden" id="update_cart_action_container" data-cart-item-update />
122
+ <script type="text/javascript">
123
+ //<![CDATA[
124
+ Event.observe(window, 'load', function()
125
+ {
126
+ // Internet Explorer (lt 8) does not support value attribute in button elements
127
+ $emptyCartButton = $('empty_cart_button');
128
+ $cartActionContainer = $('update_cart_action_container');
129
+ if ($emptyCartButton && $cartActionContainer) {
130
+ Event.observe($emptyCartButton, 'click', function()
131
+ {
132
+ $emptyCartButton.setAttribute('name', 'update_cart_action_temp');
133
+ $cartActionContainer.setAttribute('name', 'update_cart_action');
134
+ $cartActionContainer.setValue('empty_cart');
135
+ });
136
+ }
137
+
138
+ });
139
+ //]]>
140
+ </script>
141
+ <![endif]-->
142
+ </td>
143
+ </tr>
144
+ </tfoot>
145
+ <tbody>
146
+ <?php foreach($this->getItems() as $_item): ?>
147
+ <?php
148
+ //{{qixol start wrap block
149
+ if ((int)Mage::getStoreConfig('qixol/frontend/cartjavascr')==0&&($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']>0)){
150
+ $multiple_coeff=((float)$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['quantity']/(float)$_item->getQty());
151
+ $_item->setQty((string)$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['quantity']);
152
+ //$_item->setPrice($_item->getPrice()*$multiple_coeff);
153
+ //$_item->setBasePrice($_item->getBasePrice()*$multiple_coeff);
154
+ //$_item->setPriceInclTax($_item->getPriceInclTax()*$multiple_coeff);
155
+ //$_item->setBasePriceInclTax($_item->getBasePriceInclTax()*$multiple_coeff);
156
+ //$_item->setBasePriceInclTax($_item->getBasePriceInclTax()*$multiple_coeff);
157
+ $_item->setRowTotal($_item->getRowTotal()*$multiple_coeff);
158
+ $_item->setBaseRowTotal($_item->getBaseRowTotal()*$multiple_coeff);
159
+ $_item->setRowTotalInclTax($_item->getRowTotalInclTax()*$multiple_coeff);
160
+ $_item->setBaseRowTotalInclTax($_item->getBaseRowTotalInclTax()*$multiple_coeff);
161
+
162
+
163
+ unset($multiple_coeff);
164
+ }
165
+ // }} qixol
166
+ ?>
167
+ <?php echo $this->getItemHtml($_item) ?>
168
+ <?php endforeach ?>
169
+ <?php
170
+ //{{qixol start wrap block
171
+
172
+ if (isset($_SESSION['qixol_quoted_items'])){
173
+ foreach ($_SESSION['qixol_quoted_items']['items'] as $idx_cart=>$item_to_show){
174
+ if ($item_to_show['new']>0&&(int)$item_to_show['data']['isdelivery']==0&&(int)$item_to_show['data']['splitfromlineid']==0){
175
+ if ($productId=Mage::getModel('catalog/product')->getIdBySku((string)$item_to_show['data']['variantcode']!=''?(string)$item_to_show['data']['variantcode']:(string)$item_to_show['data']['productcode'])){
176
+
177
+ $productObj = Mage::getModel('catalog/product')->load($productId);
178
+ $quoteItem = Mage::getModel('sales/quote_item')->setStoreId(Mage::app()->getStore()->getId())->setProduct($productObj);
179
+ $quoteItem->setConvertedPrice((string)$item_to_show['data']['price']);
180
+ $quoteItem->setRowTotal((string)$item_to_show['data']['price']);
181
+ $quoteItem->setBaseRowTotal((string)$item_to_show['data']['price']);
182
+ $quoteItem->setQty((string)$item_to_show['data']['quantity']);
183
+ $quoteItem->setFreeProduct((int)$item_to_show['free_added']);
184
+ $quoteItem->setQuote($this);
185
+ $quoteItem->setId($idx_cart);
186
+ echo $this->getItemHtml($quoteItem);
187
+ }
188
+ }
189
+ }
190
+
191
+ //if (isset($_SESSION['qixol_quoted_items']['summary'])){
192
+ //foreach ($_SESSION['qixol_quoted_items']['summary'] as $inline_cart_promotion)
193
+ // if($inline_cart_promotion['data']['basketlevel']>0){
194
+ ?>
195
+ <!--<tr class='promotion_cart_inline_box'>
196
+ <td class="product-cart-image">&nbsp;</td>
197
+ <td class="product-cart-info" colspan='3'><?php //echo $inline_cart_promotion['data']['display_text']; ?></td>
198
+ <td class="product-cart-total" colspan='2'><?php
199
+ //switch ($inline_cart_promotion['data']['type']){
200
+ //case 'ISSUEPOINTS';
201
+ // echo $inline_cart_promotion['data']['issuedpoints']."&nbsp;pt.";
202
+ //break;
203
+ //case 'DELIVERYREDUCTION';
204
+ // echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
205
+ //break;
206
+ //case 'BASKETREDUCTION';
207
+ // echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
208
+ //break;
209
+ //}
210
+ ?></td>
211
+ </tr>-->
212
+ <?php
213
+ // }
214
+ //}
215
+ }
216
+ //}} qixol end wrap block
217
+ ?>
218
+ </tbody>
219
+ </table>
220
+ <script type="text/javascript">decorateTable('shopping-cart-table')</script>
221
+ </form>
222
+
223
+ <?php echo $this->getChildHtml('shopping.cart.table.after'); ?>
224
+ <div class="cart-forms">
225
+ <?php /* Extensions placeholder */ ?>
226
+ <?php echo $this->getChildHtml('checkout_cart_widget') ?>
227
+ <?php echo $this->getChildHtml('coupon') ?>
228
+ <?php echo $this->getChildHtml('checkout.cart.extra') ?>
229
+ <?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
230
+ </div>
231
+ <div class="cart-totals-wrapper">
232
+ <div class="cart-totals">
233
+ <?php echo $this->getChildHtml('totals'); ?>
234
+ <?php if(!$this->hasError()): ?>
235
+ <ul class="checkout-types bottom">
236
+ <?php foreach ($this->getMethods('methods') as $method): ?>
237
+ <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
238
+ <li class="method-<?php echo preg_replace("/[^_a-zA-Z0-9-]/", '-', $method); ?>"><?php echo $methodHtml; ?></li>
239
+ <?php endif; ?>
240
+ <?php endforeach; ?>
241
+ </ul>
242
+ <?php endif; ?>
243
+ </div>
244
+ </div>
245
+ <?php echo $this->getChildHtml('crosssell') ?>
246
+ </div>
app/design/frontend/base/default/template/qixol/cart/item/default.phtml ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 rwd_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ $_item = $this->getItem();
29
+ $isVisibleProduct = $_item->getProduct()?$_item->getProduct()->isVisibleInSiteVisibility():0;
30
+ $canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
31
+ ?>
32
+ <?php /* {{ qixol should be added id */ ?>
33
+ <tr id='qixol_idx_cart_item_<?php echo $_item->getId(); ?>'>
34
+ <?php /* }} qixol end should be added id */ ?>
35
+ <td class="product-cart-image">
36
+ <?php if ($this->hasProductUrl()):?>
37
+ <a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image">
38
+ <?php endif;?>
39
+ <img src="<?php echo $this->getProductThumbnail()->resize(180); ?>" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" />
40
+ <?php if ($this->hasProductUrl()):?>
41
+ </a>
42
+ <?php endif;?>
43
+
44
+ <ul class="cart-links">
45
+ <?php if ($isVisibleProduct): ?>
46
+ <li>
47
+ <a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Edit item parameters')) ?>"><?php echo $this->__('Edit') ?></a>
48
+ </li>
49
+ <?php endif ?>
50
+
51
+ <?php if ($this->helper('wishlist')->isAllowInCart() && $isVisibleProduct) : ?>
52
+ <li>
53
+ <a href="<?php echo $this->helper('wishlist')->getMoveFromCartUrl($_item->getId()); ?>" class="link-wishlist use-ajax"><?php echo $this->__('Move to wishlist'); ?></a>
54
+ </li>
55
+ <?php endif ?>
56
+ </ul>
57
+ </td>
58
+
59
+ <?php /* {{ qixol should be added id */ ?>
60
+ <td class="product-cart-info" id='qixol_idx_cart_item_name_<?php echo $_item->getId(); ?>'>
61
+ <?php /* }} qixol end should be added id */ ?>
62
+
63
+ <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>
64
+
65
+ <h2 class="product-name">
66
+ <?php if ($this->hasProductUrl()):?>
67
+ <a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->escapeHtml($this->getProductName()) ?></a>
68
+ <?php else: ?>
69
+ <?php echo $this->escapeHtml($this->getProductName()) ?>
70
+ <?php endif; ?>
71
+ </h2>
72
+
73
+ <div class="product-cart-sku">
74
+ <span class="label"><?php echo $this->__('SKU'); ?>:</span> <?php echo $this->escapeHtml($_item->getSku()); ?>
75
+ </div>
76
+
77
+ <?php if ($_options = $this->getOptionList()):?>
78
+ <dl class="item-options">
79
+ <?php foreach ($_options as $_option) : ?>
80
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
81
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
82
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
83
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
84
+ <div class="truncated_full_value">
85
+ <dl class="item-options">
86
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
87
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
88
+ </dl>
89
+ </div>
90
+ <?php endif; ?>
91
+ </dd>
92
+ <?php endforeach; ?>
93
+ </dl>
94
+ <?php endif;?>
95
+
96
+ <?php if ($messages = $this->getMessages()): ?>
97
+ <?php foreach ($messages as $message): ?>
98
+ <p class="item-msg <?php echo $message['type'] ?>">
99
+ * <?php echo $this->escapeHtml($message['text']) ?>
100
+ </p>
101
+ <?php endforeach; ?>
102
+ <?php endif; ?>
103
+
104
+ <?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
105
+ <?php if ($addInfoBlock): ?>
106
+ <?php echo $addInfoBlock->setItem($_item)->toHtml() ?>
107
+ <?php endif;
108
+ /* qixol {{ */
109
+ if ((int)Mage::getStoreConfig('qixol/frontend/cartjavascr')==0&&Mage::getStoreConfig('qixol/advanced/services')!='dontdisplay'):
110
+ foreach ($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['promotions'] as $promotion){
111
+ //inline level promotion
112
+ $promotionDisplayText = $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display_text'];
113
+ if (empty($promotionDisplayText)) {
114
+ $promotionDisplayText = $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['name'];
115
+ }
116
+ $is_generated=($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']>0?$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']:$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']);
117
+ if (((int)$promotion['basketlevel']==0||$is_generated>0)&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displaytext'){
118
+ ?><div class="cart_inline_item_promo"><?php echo $promotionDisplayText; ?></div><?php
119
+ }elseif(((int)$promotion['basketlevel']==0||$is_generated>0)&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displayname'){
120
+ ?><div class="cart_inline_item_promo"><?php echo $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['name']; ?></div><?php
121
+ }elseif(((int)$promotion['basketlevel']==0||$is_generated>0)&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displaytype'){
122
+ ?><div class="cart_inline_item_promo"><?php echo $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display']; ?></div><?php
123
+ }
124
+
125
+ }
126
+ endif;
127
+ /* }} end qixol */ ?>
128
+
129
+ </td>
130
+
131
+ <?php if ($canApplyMsrp): ?>
132
+ <td class="a-center product-cart-price"<?php if ($this->helper('tax')->displayCartBothPrices()): ?> colspan="2"<?php endif; ?>>
133
+ <span class="cart-price">
134
+ <span class="cart-msrp-unit"><?php echo $this->__('See price before order confirmation.'); ?></span>
135
+ <?php $helpLinkId = 'cart-msrp-help-' . $_item->getId(); ?>
136
+ <a id="<?php echo $helpLinkId ?>" href="#" class="map-help-link"><?php echo $this->__("What's this?"); ?></a>
137
+
138
+ <script type="text/javascript">
139
+ Catalog.Map.addHelpLink($('<?php echo $helpLinkId ?>'), "<?php echo $this->__("What&#39;s this?") ?>");
140
+ </script>
141
+
142
+ </span>
143
+ </td>
144
+ <?php else: ?>
145
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
146
+ <td class="product-cart-price" data-rwd-label="<?php echo $this->__('Price'); ?>" data-rwd-tax-label="<?php echo $this->__('Excl. Tax'); ?>" >
147
+
148
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
149
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
150
+ <?php else: ?>
151
+ <span class="cart-price">
152
+ <?php endif; ?>
153
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
154
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
155
+ <?php else: ?>
156
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
157
+ <?php endif; ?>
158
+
159
+ </span>
160
+
161
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
162
+
163
+ <div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
164
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
165
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
166
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
167
+ <?php endforeach; ?>
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="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
171
+ <?php endforeach; ?>
172
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
173
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
174
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
175
+ <?php endforeach; ?>
176
+ <?php endif; ?>
177
+ </div>
178
+
179
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
180
+ <div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
181
+ <span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
182
+ </div>
183
+ <?php endif; ?>
184
+ <?php endif; ?>
185
+ </td>
186
+ <?php endif; ?><!-- inclusive price starts here -->
187
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
188
+ <td class="product-cart-price" data-rwd-label="<?php echo $this->__('Price'); ?>" data-rwd-tax-label="<?php echo $this->__('Incl. Tax'); ?>">
189
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
190
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
191
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
192
+ <?php else: ?>
193
+ <span class="cart-price">
194
+ <?php endif; ?>
195
+
196
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
197
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
198
+ <?php else: ?>
199
+ <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
200
+ <?php endif; ?>
201
+
202
+ </span>
203
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
204
+
205
+ <div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
206
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, '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['amount_incl_tax'],true,true); ?></span>
209
+ <?php endforeach; ?>
210
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, '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['amount_incl_tax'],true,true); ?></span>
213
+ <?php endforeach; ?>
214
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
215
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
216
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
217
+ <?php endforeach; ?>
218
+ <?php endif; ?>
219
+ </div>
220
+
221
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
222
+ <div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
223
+ <span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
224
+ </div>
225
+ <?php endif; ?>
226
+ <?php endif; ?>
227
+ </td>
228
+ <?php endif; ?>
229
+ <?php endif; ?>
230
+ <?php /* qixol should be added id */ ?>
231
+ <td class="product-cart-actions" data-rwd-label="<?php echo $this->__('Qty'); ?>" id='qixol_idx_cart_item_qty_<?php echo $_item->getId(); ?>'>
232
+ <?php /* qixol add */ ?>
233
+ <?php /*if ($_item->getFreeProduct()>0): ?>
234
+ <div class="cart_inline_item_promo"><?php echo $this->__('free '.$_item->getFreeProduct().' item'); ?><br>
235
+ <button title="<?php echo Mage::helper('qixol')->quoteEscape($this->__('Add More')) ?>" class="button btn-cart" style="display:inline-block !important" onclick="setLocation('<?php echo $this->helper('checkout/cart')->getAddUrl($_item->getProduct())/*$_item->getProduct()->getProductUrl()*//*; ?>')"><span><span><?php echo $this->__('Add More') ?></span></span></button>
236
+ </div>
237
+ <?php else :*/ ?>
238
+ <?php /* end qixol add */ ?>
239
+ <input type="text" pattern="\d*" name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4"
240
+ data-cart-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>"
241
+ title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" maxlength="12" />
242
+
243
+ <button type="submit" name="update_cart_action" data-cart-item-update value="update_qty" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Update')); ?>" class="button btn-update"><span><span><?php echo $this->__('Update'); ?></span></span>
244
+ </button>
245
+
246
+ <ul class="cart-links">
247
+ <?php if ($isVisibleProduct): ?>
248
+ <li>
249
+ <a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Edit item parameters')) ?>"><?php echo $this->__('Edit') ?></a>
250
+ </li>
251
+ <?php endif ?>
252
+
253
+ <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
254
+ <li>
255
+ <?php if ($isVisibleProduct): ?>
256
+ <a href="<?php echo $this->helper('wishlist')->getMoveFromCartUrl($_item->getId()); ?>" class="link-wishlist use-ajax"><?php echo $this->__('Move to wishlist'); ?></a>
257
+ <?php endif ?>
258
+ </li>
259
+ <?php endif ?>
260
+ </ul>
261
+ <?php /* qixol add */ ?>
262
+ <?php //endif ?>
263
+ <?php /* end qixol add */ ?>
264
+ <?php
265
+ //{{qixol
266
+ /*if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['updated_qty']>0){
267
+ ?><div class="cart_inline_item_new_qty">For&nbsp;<?php echo $_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['quantity']; ?>&nbsp;Qty</div><?php
268
+ }*/
269
+ //}}qixol end
270
+ ?>
271
+ </td>
272
+
273
+ <!--Sub total starts here -->
274
+ <?php if (($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
275
+ <?php /* qixol should be added id */ ?>
276
+ <td class="product-cart-total" data-rwd-label="<?php echo $this->__('Subtotal'); ?>" id='qixol_idx_cart_item_price_<?php echo $_item->getId(); ?>'>
277
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
278
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
279
+ <?php else: ?>
280
+ <span class="cart-price">
281
+ <?php endif; ?>
282
+
283
+ <?php if ($canApplyMsrp): ?>
284
+ <span class="cart-msrp-subtotal">--</span>
285
+ <?php else: ?>
286
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
287
+ <?php echo $this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['lineamount']+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
288
+ <?php else: ?>
289
+ <?php echo $this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['lineamount']); ?>
290
+ <?php endif; ?>
291
+ <?php endif; ?>
292
+
293
+ </span>
294
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
295
+
296
+ <div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
297
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
298
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
299
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
300
+ <?php endforeach; ?>
301
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
302
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
303
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
304
+ <?php endforeach; ?>
305
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
306
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
307
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
308
+ <?php endforeach; ?>
309
+ <?php endif; ?>
310
+ </div>
311
+
312
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
313
+ <div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
314
+ <span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['lineamount']+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
315
+ </div>
316
+ <?php endif; ?>
317
+ <?php endif; ?>
318
+ <?php
319
+ //{{qixol
320
+ if ((int)Mage::getStoreConfig('qixol/frontend/cartjavascr')==0&&($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['updated_price']>0)){
321
+ ?><div class="cart_inline_item_new_price">You save&nbsp;<?php echo $this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['totaldiscount']); ?></div><?php
322
+ }
323
+ if ((int)Mage::getStoreConfig('qixol/frontend/cartjavascr')==0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['new']>0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']>0){
324
+ ?><div class="cart_inline_item_new_price"><?php echo $this->__('Discount: -').$this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalprice']); ?></div><?php
325
+ }else if ((int)Mage::getStoreConfig('qixol/frontend/cartjavascr')==0&&($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']>0)){
326
+ ?><div class="cart_inline_item_new_price"><?php echo $this->__('Discount: -').$this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalprice']*$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']); ?></div><?php
327
+ }
328
+ //}}qixol end
329
+ ?>
330
+ </td>
331
+ <?php endif; ?>
332
+ <?php if (($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()) && !$_item->getNoSubtotal()): ?>
333
+ <?php /* qixol should be added id */ ?>
334
+ <td class="product-cart-total" data-rwd-label="<?php echo $this->__('Subtotal'); ?>" id='qixol_idx_cart_item_price_<?php echo $_item->getId(); ?>'>
335
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
336
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
337
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
338
+ <?php else: ?>
339
+ <span class="cart-price">
340
+ <?php endif; ?>
341
+
342
+ <?php if ($canApplyMsrp): ?>
343
+ <span class="cart-msrp-subtotal">--</span>
344
+ <?php else: ?>
345
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
346
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
347
+ <?php else: ?>
348
+ <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
349
+ <?php endif; ?>
350
+ <?php endif; ?>
351
+
352
+ </span>
353
+
354
+
355
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
356
+
357
+ <div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
358
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
359
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
360
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
361
+ <?php endforeach; ?>
362
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
363
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
364
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
365
+ <?php endforeach; ?>
366
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
367
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
368
+ <span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
369
+ <?php endforeach; ?>
370
+ <?php endif; ?>
371
+ </div>
372
+
373
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
374
+ <div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
375
+ <span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
376
+ </div>
377
+ <?php endif; ?>
378
+ <?php endif; ?>
379
+ </td>
380
+ <?php endif; ?>
381
+ <td class="a-center product-cart-remove">
382
+ <?php /* qixol */ ?>
383
+ <?php if ($_item->getFreeProduct()==0): ?>
384
+ <?php /* qixol end */ ?>
385
+ <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>
386
+ <?php /* qixol */ ?>
387
+ <?php endif; ?>
388
+ <?php /* qixol end */ ?>
389
+ </td>
390
+ </tr>
app/design/frontend/base/default/template/qixol/cart/totals.phtml ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_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
28
+ /**
29
+ * Shopping cart totals template
30
+ *
31
+ * @see Mage_Checkout_Block_Cart_Totals
32
+ * @var $this Mage_Checkout_Block_Cart_Totals
33
+ */
34
+
35
+ $basketTotal = 0;
36
+ $basketDiscount = 0;
37
+ $deliveryDiscount = 0;
38
+
39
+ $deliverySubtotal = 0;
40
+ $basketSubtotal = 0;
41
+
42
+ if (isset($_SESSION['qixol_quoted_items'])) {
43
+ $basketTotal = $_SESSION['qixol_quoted_items']['cart_data']['baskettotal'];
44
+ $basketDiscount = $_SESSION['qixol_quoted_items']['cart_data']['basketdiscount'];
45
+ $deliveryDiscount = $_SESSION['qixol_quoted_items']['cart_data']['deliverytotaldiscount'];
46
+
47
+ $deliverySubtotal = $_SESSION['qixol_quoted_items']['cart_data']['deliveryoriginalprice'];
48
+ $basketSubtotal = $basketTotal + $basketDiscount - $_SESSION['qixol_quoted_items']['cart_data']['deliveryprice'];
49
+
50
+ $promotions = $_SESSION['qixol_quoted_items']['summary'];
51
+
52
+ foreach ($promotions as $promotion){
53
+ if ((bool)$promotion['data']['basketlevel']) {
54
+ if ((bool)$promotion['data']['deliverylevel']) {
55
+ $deliveryPromotionDisplay = $promotion['data']['display'];
56
+ $deliveryPromotionDisplayText = $promotion['data']['display_text'];
57
+ $deliveryPromotionName = $promotion['data']['name'];
58
+ $deliveryPromotionType = $promotion['data']['type'];
59
+ if (empty($deliveryPromotionDisplayText)) {
60
+ $deliveryPromotionDisplayText = $deliveryPromotionName;
61
+ }
62
+ } else {
63
+ $basketPromotionDisplay = $promotion['data']['display'];
64
+ $basketPromotionDisplayText = $promotion['data']['display_text'];
65
+ $basketPromotionName = $promotion['data']['name'];
66
+ $basketPromotionType = $promotion['data']['type'];
67
+ if (empty($basketPromotionDisplayText)) {
68
+ $basketPromotionDisplayText = $basketPromotionName;
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ // var_dump($_SESSION['qixol_quoted_items']);
75
+ }
76
+
77
+ ?>
78
+ <?php if ($this->canApplyMsrp()): ?>
79
+ <div class="cart-msrp-totals"><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></div>
80
+ <?php else: ?>
81
+ <table id="shopping-cart-totals-table">
82
+ <col />
83
+ <col width="1" />
84
+ <tfoot>
85
+ <tr>
86
+ <td style="" class="a-right" colspan="1">
87
+ <strong>Grand Total</strong>
88
+ </td>
89
+ <td style="" class="a-right">
90
+ <strong><span class="price"><?php echo $this->helper('checkout')->formatPrice($basketTotal); ?></span></strong>
91
+ </td>
92
+ </tr>
93
+ </tfoot>
94
+ <tbody>
95
+ <tr>
96
+ <td style="" class="a-right" colspan="1">
97
+ Subtotal </td>
98
+ <td style="" class="a-right">
99
+ <span class="price"><?php echo $this->helper('checkout')->formatPrice($basketSubtotal); ?></span> </td>
100
+ </tr>
101
+ <?php if ($basketDiscount > 0): ?>
102
+ <tr class="qixol_discount">
103
+ <td style="" class="a-right" colspan="1"><?php echo $basketPromotionDisplayText ?></td>
104
+ <td style="" class="a-right">
105
+ <span class="price qixol_total_price">(<?php echo $this->helper('checkout')->formatPrice($basketDiscount); ?>)</span> </td>
106
+ </tr>
107
+ <?php endif; ?>
108
+ <?php if ($deliverySubtotal > 0): ?>
109
+ <tr>
110
+ <td style="" class="a-right" colspan="1">
111
+ Shipping</td>
112
+ <td style="" class="a-right">
113
+ <span class="price"><?php echo $this->helper('checkout')->formatPrice($deliverySubtotal); ?></span> </td>
114
+ </tr>
115
+ <?php if ($deliveryDiscount > 0): ?>
116
+ <tr class="qixol_discount">
117
+ <td style="" class="a-right" colspan="1"><?php echo $deliveryPromotionDisplayText ?></td>
118
+ <td style="" class="a-right">
119
+ <span class="price qixol_total_price">(<?php echo $this->helper('checkout')->formatPrice($deliveryDiscount); ?>)</span> </td>
120
+ </tr>
121
+ <?php endif; ?>
122
+ <?php endif; ?>
123
+ <!--<tr>
124
+ <td style="" class="a-right" colspan="1">
125
+ Tax </td>
126
+ <td style="" class="a-right"><span class="price">TO BE COMPLETED</span></td>
127
+ </tr>-->
128
+ </tbody>
129
+ </table>
130
+ <?php endif; ?>
app/design/frontend/base/default/template/qixol/issuedcoupon/list.phtml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
4
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
5
+ $list_coupons_collection=Mage::getModel('qixol/issuedcoupon')->getCustomerIssuedcoupons($customerData->getId());
6
+
7
+ ?>
8
+ <div class="page-title">
9
+ <h1><?php echo $this->__('Issued Coupons') ?></h1>
10
+ </div>
11
+ <?php if($list_coupons_collection->getSize()): ?>
12
+
13
+
14
+ <table class="data-table">
15
+ <col width="60" />
16
+ <col width="60" />
17
+ <col width="160" />
18
+ <col />
19
+ <thead>
20
+ <tr>
21
+ <th><?php echo $this->__('Code') ?></th>
22
+ <th><?php echo $this->__('Status') ?></th>
23
+ <th><?php echo $this->__('Valid To') ?></th>
24
+ <th><?php echo $this->__('Description') ?></th>
25
+ </tr>
26
+ </thead>
27
+ <tbody>
28
+ <?php foreach($list_coupons_collection as $item): ?>
29
+ <?php
30
+
31
+ $soapclient_coupon = new soapclient('http://evaluation.qixolpromo.com/BasketService.svc?singleWsdl', array('trace' => 1));
32
+ try {
33
+ $update_item=false;
34
+ $result_coupon = $soapclient_coupon->__soapCall('ValidateCouponCode', array('ValidateCouponCode' => array('companyKey' => Mage::getStoreConfig('qixol/integraion/companykey'),'couponCode' => $item->getCouponCodeValue())));
35
+ $xml_coupon_code_validated=$result_coupon->ValidateCouponCodeResult;
36
+ if (strlen($xml_coupon_code_validated)>10){
37
+ $xml_coupon_object = simplexml_load_string($xml_coupon_code_validated);
38
+ foreach ($xml_coupon_object as $xml_coupon_object_root_key=>$xml_coupon_object_object_sub){
39
+ if ($xml_coupon_object_root_key=='summary'){
40
+ $xml_coupon_object_object_coupon_summary=$xml_coupon_object_object_sub->attributes();
41
+ if ($xml_coupon_object_object_coupon_summary['result']=='false'){
42
+ $item->setIsUsed(1);
43
+ $update_item=true;
44
+ }
45
+ }
46
+ else if ($xml_coupon_object_root_key=='coupon'){
47
+ foreach ($xml_coupon_object_object_sub as $xml_coupon_object_coupon_key=>$xml_coupon_object_object_coupon){
48
+ if ($xml_coupon_object_coupon_key=='codes'){
49
+ foreach ($xml_coupon_object_object_coupon as $xml_coupon_object_object_coupon_obj){
50
+ $xml_coupon_object_object_coupon_attributes=$xml_coupon_object_object_coupon_obj->attributes();
51
+ if ((string)$xml_coupon_object_object_coupon_attributes['isredeemable']!='true'){
52
+ $item->setIsUsed(1);
53
+ $update_item=true;
54
+ }
55
+ if (date("Y-m-d H:i:s",strtotime((string)$xml_coupon_object_object_coupon_attributes['validto']))!=$item->getCouponValidTill()){
56
+ $item->setCouponValidTill(date("Y-m-d H:i:s",strtotime((string)$xml_coupon_object_object_coupon_attributes['validto'])));
57
+ $update_item=true;
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+ }
66
+ } catch (SoapFault $e) {
67
+
68
+ }
69
+
70
+ ?>
71
+ <tr>
72
+ <td><?php echo $item->getCouponCodeValue() ?></td>
73
+ <td><?php echo (((int)$item->getIsUsed()>0)?($this->__('Inactive')):(($item->getCouponValidTill()!=''&&$item->getCouponValidTill()!='0000-00-00 00:00:00'&&$item->getCouponValidTill()!='1970-01-01 00:00:00'&&strtotime($item->getCouponValidTill())<time())?$this->__('Expired'):$this->__('Active'))) ?></td>
74
+ <td><?php echo (($item->getCouponValidTill()!='0000-00-00 00:00:00'&&$item->getCouponValidTill()!='1970-01-01 00:00:00')?$item->getCouponValidTill():"Unlimited"); ?></td>
75
+ <td><?php echo $item->getCouponDescription(); ?></td>
76
+ </tr>
77
+ <?php
78
+ if ($update_item){
79
+ $item->save();
80
+ }
81
+ ?>
82
+ <?php endforeach ?>
83
+ </tbody>
84
+ </table>
85
+
86
+
87
+ <?php else: ?>
88
+ <p><?php echo $this->__('You are having no issued coupons yet.'); ?></p>
89
+ <div class="buttons-set">
90
+ <p class="back-link"><a href="<?php echo $this->getUrl('customer/account') ?>"><small>&laquo; </small><?php echo $this->__('Back - link to the previously viewed page'); ?></a></p>
91
+ </div>
92
+ <?php endif ?>
93
+ <?php
94
+ }
95
+ ?>
app/design/frontend/base/default/template/qixol/issuedpoints/box.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <div class="account-box ad-account-info">
2
+ <div class="box-head">
3
+ <h4><?php echo $this->__('Points') ?></h4>
4
+ </div>
5
+ <?php echo $this->getChildHtml('points'); ?>
6
+ </div>
app/design/frontend/base/default/template/qixol/issuedpoints/dashboard_points.phtml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $customerId = Mage::getModel('customer/session')->getCustomerId();
3
+ $customerPoints = Mage::getModel('qixol/Bonuspoints')->load($customerId);
4
+ ?>
5
+ Your Points: <?= sprintf('%d',$customerPoints->getCurrentPoints()); ?>
6
+ <br/>
7
+ Total Points Accumulated: <?= sprintf('%d',$customerPoints->getEarnedPoints()); ?>
8
+ <br/>
9
+ Total Points Spent: <?= sprintf('%d',$customerPoints->getSpentPoints()); ?>
10
+ <br/>
app/design/frontend/base/default/template/qixol/minicart/advert.phtml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ moved to mincart
4
+ //$place_box_in_design_after_pattern=Mage::getStoreConfig('qixol/integraion/boxcartpromotion')
5
+ $place_box_in_design_after_pattern='.cart';
6
+
7
+ /*
8
+ $inline_cart_advert='';
9
+
10
+ //for cart items
11
+ $cart = Mage::getModel('checkout/cart')->getQuote();
12
+ foreach ($cart->getAllItems() as $item) {
13
+ if (isset($_SESSION['qixol_quoted_items'])&&isset($_SESSION['qixol_quoted_items']['items'][$item->getId()])){
14
+ if (isset($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions']))
15
+ foreach ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'] as $promotion){
16
+ //inline level promotion
17
+ if ((int)$promotion['basketlevel']==0&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]))
18
+ $inline_cart_advert.="
19
+ $('<div class=\"cart_inline_item_promo\">".addslashes($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display_text'])."</div>').appendTo($('#qixol_idx_mcart_item_name_".$item->getId()."'));
20
+ ";
21
+ //basket level promotion
22
+ if ((int)$promotion['basketlevel']==1&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]))
23
+ $text_to_show_cart_adv.='';//should be also added??? $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['display_text'];
24
+
25
+ }
26
+
27
+ //if quantity changed (get one + one free so will be splited to 2 products with 1 free)
28
+ if ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_qty']>0)
29
+ $inline_cart_advert.="
30
+ $('<div class=\"cart_inline_item_new_qty\">For&nbsp;promo&nbsp;".addslashes($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['quantity'])."&nbsp;Qty</div>').appendTo($('#qixol_idx_mcart_item_qty_".$item->getId()."'));
31
+ ";
32
+
33
+ if ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_price']>0)
34
+ $inline_cart_advert.="
35
+ $('<div class=\"cart_inline_item_new_price\">Only for ".addslashes($this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['lineamount']))."</div>').appendTo($('#qixol_idx_mcart_item_price_".$item->getId()."'));
36
+ ";
37
+
38
+ }
39
+ }
40
+ $total_discount_amount=0;
41
+ if (isset($_SESSION['qixol_quoted_items']['items'])){
42
+ foreach ($_SESSION['qixol_quoted_items']['items'] as $cart_item_process){
43
+ if ($cart_item_process['data']['totaldiscount']>0&&(int)$cart_item_process['new']==0){
44
+ $total_discount_amount+=$cart_item_process['data']['totaldiscount'];
45
+ }
46
+ }
47
+ }
48
+
49
+ if ($text_to_show_cart_adv!==false&&strlen($text_to_show_cart_adv)>5||$inline_cart_advert!=''){
50
+ ?><script type="text/javascript" src="/js/lib/jquery/jquery-1.10.2.min.js"></script><script type="text/javascript">$.noConflict();jQuery( document ).ready(function( $ ) { <?php
51
+ /*if ($text_to_show_cart_adv!==false&&strlen($text_to_show_cart_adv)>5)
52
+ echo '$("'.$place_box_in_design_after_pattern.'").after("<div class=\'qixolcartpromo\'>'.$text_to_show_cart_adv.'</div>");';*//*
53
+ if ($inline_cart_advert!='')
54
+ echo preg_replace("/[\n\r]+/","",$inline_cart_advert);
55
+ if ($total_discount_amount>0){
56
+ /*?>$('<tr class="qixol_discount"><td class="a-right" colspan="1" > Discount</td><td class="a-right" ><span class="qixol_total_price"><?php echo $this->helper('checkout')->formatPrice($total_discount_amount);; ?></span></td></tr>').appendTo($('#shopping-cart-totals-table tbody'));<?php*//*
57
+ ?>$('#header-cart .subtotal .price').addClass('qixol_price_cross');$('<?php echo $this->helper('checkout')->formatPrice($cart->getGrandTotal()-$total_discount_amount); ?>').appendTo($('#header-cart .subtotal .price').parent());<?php
58
+ }
59
+ ?>});</script><?php
60
+ }*/
61
+ ?>
app/design/frontend/base/default/template/qixol/minicart/default.phtml ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 rwd_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ $_item = $this->getItem();
29
+ $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
30
+ $canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
31
+ ?>
32
+ <?php /* {{ qixol should be added id */ ?>
33
+ <li class="item" xmlns="http://www.w3.org/1999/html" id='qixol_idx_mcart_item_<?php echo $_item->getId(); ?>'>
34
+ <?php if ($this->hasProductUrl()): ?>
35
+ <a href="<?php echo $this->getProductUrl()?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></a>
36
+ <?php else: ?>
37
+ <span class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></span>
38
+ <?php endif; ?>
39
+ <div class="product-details">
40
+ <?php /* qixol should be added id */ ?>
41
+ <p class="product-name" id='qixol_idx_mcart_item_name_<?php echo $_item->getId(); ?>'><?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;
42
+ /* qixol {{ */
43
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&Mage::getStoreConfig('qixol/advanced/services')!='dontdisplay'):
44
+ foreach ($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['promotions'] as $promotion){
45
+ //inline level promotion
46
+ $is_generated=($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']>0?$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']:$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']);
47
+ if (((int)$promotion['basketlevel']==0||$is_generated>0)&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displaytext'){
48
+ ?><div class="cart_inline_item_promo"><?php echo $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display_text']; ?></div><?php
49
+ }elseif(((int)$promotion['basketlevel']==0||$is_generated>0)&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displayname'){
50
+ ?><div class="cart_inline_item_promo"><?php echo $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['name']; ?></div><?php
51
+ }elseif(((int)$promotion['basketlevel']==0||$is_generated>0)&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displaytype'){
52
+ ?><div class="cart_inline_item_promo"><?php echo $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display']; ?></div><?php
53
+ }
54
+
55
+ }
56
+ endif;
57
+ /* }} end qixol */ ?></p>
58
+
59
+
60
+ <table class="info-wrapper">
61
+ <tbody>
62
+ <tr>
63
+ <th><?php echo $this->__('Price'); ?></th>
64
+ <td id='qixol_idx_mcart_item_price_<?php echo $_item->getId(); ?>'>
65
+ <?php if ($canApplyMsrp): ?>
66
+
67
+ <span class="map-cart-sidebar-item"><?php echo $this->__('See price before order confirmation.'); ?></span>
68
+
69
+ <?php else: ?>
70
+
71
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
72
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
73
+ <?php echo $this->__('Excl. Tax'); ?>:
74
+ <?php endif; ?>
75
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
76
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
77
+ <?php else: ?>
78
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
79
+ <?php endif; ?>
80
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
81
+ <br />
82
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
83
+ <small>
84
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
85
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
86
+ <?php endforeach; ?>
87
+ </small>
88
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
89
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
90
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
91
+ <?php endforeach; ?>
92
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
93
+ <small>
94
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
95
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
96
+ <?php endforeach; ?>
97
+ </small>
98
+ <?php endif; ?>
99
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
100
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
101
+ <?php endif; ?>
102
+ <?php endif; ?>
103
+ <?php endif; ?>
104
+
105
+
106
+
107
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
108
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
109
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
110
+ <br /><?php echo $this->__('Incl. Tax'); ?>:
111
+ <?php endif; ?>
112
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
113
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
114
+ <?php else: ?>
115
+ <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
116
+ <?php endif; ?>
117
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
118
+ <br />
119
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
120
+ <small>
121
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
122
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
123
+ <?php endforeach; ?>
124
+ </small>
125
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
126
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
127
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span>
128
+ <?php endforeach; ?>
129
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
130
+ <small>
131
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
132
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
133
+ <?php endforeach; ?>
134
+ </small>
135
+ <?php endif; ?>
136
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
137
+ <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>
138
+ <?php endif; ?>
139
+ <?php endif; ?>
140
+ <?php endif; ?>
141
+
142
+ <?php endif; //Can apply MSRP ?>
143
+ <?php
144
+ //{{qixol
145
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['updated_price']>0){
146
+ ?><div class="cart_inline_item_new_price">Only for - 3 <?php echo $this->helper('checkout')->formatPrice(($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalamount']-$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['totaldiscount'])/$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalquantity']);?></div><?php
147
+ }
148
+ //}}qixol end
149
+ ?>
150
+ </td>
151
+ </tr>
152
+ <tr class="qty-wrapper">
153
+ <th><?php echo $this->__('Qty'); ?></th>
154
+
155
+ <?php /* qixol should be added id */ ?>
156
+ <td id='qixol_idx_mcart_item_qty_<?php echo $_item->getId(); ?>'>
157
+ <?php /*if ($_item->getFreeProduct()>0): ?>
158
+ <div class="cart_inline_item_promo"><?php echo $this->__('free item'); ?></div>
159
+ <?php else :*/ ?>
160
+ <?php /* end qixol add */ ?>
161
+ <input
162
+ id="qinput-<?php echo $_item->getId(); ?>"
163
+ data-link="<?php echo $this->getAjaxUpdateUrl() ?>"
164
+ data-item-id="<?php echo $_item->getId(); ?>"
165
+ data-cart-item-id="<?php echo $_item->getSku(); ?>"
166
+ class="qty cart-item-quantity input-text" name=""
167
+ value="<?php echo $this->getQty()?>"
168
+ <?php if ($this->isOnCheckoutPage()) echo 'disabled'; ?>
169
+ />
170
+
171
+ <button id="qbutton-<?php echo $_item->getId(); ?>"
172
+ data-item-id="<?php echo $_item->getId(); ?>"
173
+ disabled="disabled"
174
+ data-update
175
+ data-cart-item-update
176
+ class="button quantity-button">
177
+ <?php echo $this->__('ok'); ?>
178
+ </button>
179
+ <?php
180
+ //{{qixol
181
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['updated_price']>0)){
182
+ ?><div class="cart_inline_item_new_price">Only for - 4 <?php echo $this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalamount']-$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['totaldiscount']); ?></div><?php
183
+ }
184
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['new']>0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']>0){
185
+ ?><div class="cart_inline_item_new_price"><?php echo $this->__('Discount: -').$this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalprice']); ?></div><?php
186
+ }else if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']>0)){
187
+ ?><div class="cart_inline_item_new_price"><?php echo $this->__('Discount: -').$this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalprice']*$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']); ?></div><?php
188
+ }
189
+ //}}qixol end
190
+ ?>
191
+ <?php /* qixol add */ ?>
192
+ <?php //endif ?>
193
+ <?php /* end qixol add */ ?>
194
+ </td>
195
+ </tr>
196
+ </tbody>
197
+ </table>
198
+
199
+ <?php if ($isVisibleProduct&&($_item->getFreeProduct()==0)): ?>
200
+ <a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Edit item')) ?>" class="btn-edit">
201
+ <?php echo $this->__('Edit item')?>
202
+ </a>
203
+ |
204
+ <?php if (!$this->isOnCheckoutPage()): ?>
205
+ <a href="<?php echo $this->getAjaxDeleteUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Remove This Item')) ?>"
206
+ data-confirm="<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>"
207
+ class="remove">
208
+ <?php echo $this->__('Remove Item') ?>
209
+ </a>
210
+ <?php else: ?>
211
+ <span><?php echo $this->__('Remove Item') ?></span>
212
+ <?php endif; ?>
213
+ <?php endif ?>
214
+
215
+
216
+
217
+ <?php if ($_options = $this->getOptionList()):?>
218
+ <div class="truncated">
219
+ <div class="truncated_full_value">
220
+ <dl class="item-options">
221
+ <?php foreach ($_options as $_option) : ?>
222
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
223
+ <dd>
224
+ <?php if (is_array($_option['value'])): ?>
225
+ <?php echo nl2br(implode("\n", $_option['value'])) ?>
226
+ <?php else: ?>
227
+ <?php echo $_option['value'] ?>
228
+ <?php endif; ?>
229
+ </dd>
230
+ <?php endforeach; ?>
231
+ </dl>
232
+ </div>
233
+ <a href="#" onclick="return false;" class="details"><?php echo $this->__('Details') ?></a>
234
+ </div>
235
+ <?php endif; ?>
236
+
237
+ </div>
238
+ </li>
app/design/frontend/base/default/template/qixol/minicart/mincart.phtml ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 rwd_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Shoping cart sidebar
29
+ *
30
+ * @var Mage_Checkout_Block_Cart_Minicart $this
31
+ */
32
+ ?>
33
+ <?php
34
+ $_cartQty = $this->getSummaryCount();
35
+ if(empty($_cartQty)) {
36
+ $_cartQty = 0;
37
+ }
38
+ ?>
39
+ <div id="minicart-error-message" class="minicart-message"></div>
40
+ <div id="minicart-success-message" class="minicart-message"></div>
41
+
42
+ <div class="minicart-wrapper">
43
+
44
+ <p class="block-subtitle">
45
+ <?php echo $this->__('Recently added item(s)') ?>
46
+ <a class="close skip-link-close" href="#" title="<?php echo $this->quoteEscape($this->__('Close')); ?>">&times;</a>
47
+ </p>
48
+
49
+ <?php $_items = $this->getRecentItems() ?>
50
+ <?php $countItems = count($_items); ?>
51
+ <?php if($countItems): ?>
52
+ <div>
53
+ <ul id="cart-sidebar" class="mini-products-list">
54
+ <?php foreach($_items as $_item): ?>
55
+ <?php
56
+ //{{qixol start wrap block
57
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']>0)){
58
+ $multiple_coeff=((float)$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['quantity']/(float)$_item->getQty());
59
+ $_item->setQty((string)$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['quantity']);
60
+ //$_item->setPrice($_item->getPrice()*$multiple_coeff);
61
+ //$_item->setBasePrice($_item->getBasePrice()*$multiple_coeff);
62
+ //$_item->setPriceInclTax($_item->getPriceInclTax()*$multiple_coeff);
63
+ //$_item->setBasePriceInclTax($_item->getBasePriceInclTax()*$multiple_coeff);
64
+ //$_item->setBasePriceInclTax($_item->getBasePriceInclTax()*$multiple_coeff);
65
+ $_item->setRowTotal($_item->getRowTotal()*$multiple_coeff);
66
+ $_item->setBaseRowTotal($_item->getBaseRowTotal()*$multiple_coeff);
67
+ $_item->setRowTotalInclTax($_item->getRowTotalInclTax()*$multiple_coeff);
68
+ $_item->setBaseRowTotalInclTax($_item->getBaseRowTotalInclTax()*$multiple_coeff);
69
+
70
+
71
+ unset($multiple_coeff);
72
+ }
73
+ // }} qixol
74
+ ?>
75
+ <?php echo $this->getItemHtml($_item) ?>
76
+ <?php endforeach; ?>
77
+ <?php
78
+ //{{qixol start wrap block
79
+
80
+ if (isset($_SESSION['qixol_quoted_items'])){
81
+ foreach ($_SESSION['qixol_quoted_items']['items'] as $idx_cart=>$item_to_show){
82
+ if ($item_to_show['new']>0&&(int)$item_to_show['data']['isdelivery']==0&&(int)$item_to_show['data']['splitfromlineid']==0){
83
+ if ($productId=Mage::getModel('catalog/product')->getIdBySku((string)$item_to_show['data']['variantcode']!=''?(string)$item_to_show['data']['variantcode']:(string)$item_to_show['data']['productcode'])){
84
+ $productObj = Mage::getModel('catalog/product')->load($productId);
85
+ $quoteItem = Mage::getModel('sales/quote_item')->setStoreId(Mage::app()->getStore()->getId())->setProduct($productObj);
86
+ $quoteItem->setConvertedPrice((string)$item_to_show['data']['price']);
87
+ $quoteItem->setQty((string)$item_to_show['data']['quantity']);
88
+ $quoteItem->setFreeProduct((int)$item_to_show['free_added']);
89
+ $quoteItem->setQuote($this);
90
+ $quoteItem->setId($idx_cart);
91
+ echo $this->getItemHtml($quoteItem);
92
+ }
93
+ }
94
+ }
95
+ if (isset($_SESSION['qixol_quoted_items']['summary'])){
96
+ foreach ($_SESSION['qixol_quoted_items']['summary'] as $inline_cart_promotion)
97
+ if($inline_cart_promotion['data']['basketlevel']>0){
98
+ ?>
99
+ <li class="item odd" xmlns="http://www.w3.org/1999/html">
100
+ <div class="promotion_cart_inline_box" ><?php echo $inline_cart_promotion['data']['display_text'] ?>&nbsp;&nbsp;:&nbsp;&nbsp;<?php
101
+ switch ($inline_cart_promotion['data']['type']){
102
+ case 'DELIVERYREDUCTION';
103
+ echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
104
+ break;
105
+ case 'ISSUEPOINTS';
106
+ echo $inline_cart_promotion['data']['issuedpoints']."&nbsp;pt.";
107
+ break;
108
+ case 'BASKETREDUCTION';
109
+ echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
110
+ break;
111
+ }
112
+ ?></div>
113
+ </li>
114
+ <?php
115
+ }
116
+ }
117
+ }
118
+ //}} qixol end wrap block
119
+ ?>
120
+ </ul>
121
+ </div>
122
+ <script type="text/javascript">
123
+ truncateOptions();
124
+ decorateList('cart-sidebar', 'none-recursive');
125
+ $j('document').ready(function() {
126
+ var minicartOptions = {
127
+ formKey: "<?php echo $this->getFormKey();?>"
128
+ }
129
+ var Mini = new Minicart(minicartOptions);
130
+ Mini.init();
131
+ });
132
+ </script>
133
+
134
+ <div id="minicart-widgets">
135
+ <?php echo $this->getChildHtml('cart_promotion') ?>
136
+ </div>
137
+ <div class="block-content">
138
+ <p class="subtotal">
139
+ <?php if ($this->canApplyMsrp()): ?>
140
+ <span class="map-cart-sidebar-total"><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></span>
141
+ <?php else: ?>
142
+ <span class="label"><?php echo $this->__('Cart Subtotal:') ?></span> <?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?>
143
+ <?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
144
+ <br />(<?php echo Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper('tax')->getIncExcText(true) ?>)
145
+ <?php endif; ?>
146
+ <?php endif; ?>
147
+ </p>
148
+ </div>
149
+
150
+
151
+ <div class="minicart-actions">
152
+ <?php if($_cartQty && $this->isPossibleOnepageCheckout()): ?>
153
+ <ul class="checkout-types minicart">
154
+ <?php echo $this->getChildHtml('extra_actions') ?>
155
+ <li>
156
+ <a title="<?php echo $this->quoteEscape($this->__('Checkout')) ?>" class="button checkout-button" href="<?php echo $this->getCheckoutUrl() ?>">
157
+ <?php echo $this->__('Checkout') ?>
158
+ </a>
159
+ </li>
160
+ </ul>
161
+ <?php endif ?>
162
+ <a class="cart-link" href="<?php echo $this->getUrl('checkout/cart'); ?>">
163
+ <?php echo $this->__('View Shopping Cart'); ?>
164
+ </a>
165
+ </div>
166
+
167
+ <?php else: ?>
168
+ <p class="empty"><?php echo $this->__('You have no items in your shopping cart.') ?></p>
169
+
170
+ <?php endif ?>
171
+ </div>
172
+ <!-- // qixol //-->
173
+ <?php
174
+ //$place_box_in_design_after_pattern=Mage::getStoreConfig('qixol/integraion/boxcartpromotion')
175
+ $place_box_in_design_after_pattern='.cart';
176
+
177
+ $inline_cart_advert='';
178
+
179
+ //for cart items
180
+ $cart = Mage::getModel('checkout/cart')->getQuote();
181
+ foreach ($cart->getAllItems() as $item) {
182
+ if (isset($_SESSION['qixol_quoted_items'])&&isset($_SESSION['qixol_quoted_items']['items'][$item->getId()])){
183
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')>0 && Mage::getStoreConfig('qixol/advanced/services')!='dontdisplay' &&
184
+ isset($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions']))
185
+ foreach ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'] as $promotion){
186
+
187
+ //inline level promotion
188
+ if ((int)$promotion['basketlevel']==0&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displayname'){
189
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_promo\">".addslashes($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display_text'])."</div>').appendTo($('#qixol_idx_cart_item_name_".$item->getId()."'));";
190
+ } elseif((int)$promotion['basketlevel']==0&&(Mage::getStoreConfig('qixol/advanced/services')=='displaytext'||Mage::getStoreConfig('qixol/advanced/services')=='displaytype')) {
191
+ if ($cart_promotion_data=Mage::getModel('qixol/promotions')->load($promotion['id'])){
192
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_promo\">".addslashes(Mage::getStoreConfig('qixol/advanced/services')=='displaytype'?$cart_promotion_data->getPromotionType():$cart_promotion_data->getPromotionText())."</div>').appendTo($('#qixol_idx_cart_item_name_".$item->getId()."'));";
193
+ }
194
+ }
195
+
196
+ //if quantity changed (get one + one free so will be splited to 2 products with 1 free)
197
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')>0&&$_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_qty']>0)
198
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_new_qty\">For&nbsp;promo&nbsp;".addslashes($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['quantity'])."&nbsp;Qty</div>').appendTo($('#qixol_idx_mcart_item_qty_".$item->getId()."'));";
199
+
200
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')>0&&$_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_price']>0)
201
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_new_price\">Only for - 5 ".addslashes($this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['lineamount']))."</div>').appendTo($('#qixol_idx_mcart_item_price_".$item->getId()."'));";
202
+
203
+ }
204
+ }
205
+ $total_discount_amount=0;
206
+ if (isset($_SESSION['qixol_quoted_items']['items'])){
207
+ foreach ($_SESSION['qixol_quoted_items']['items'] as $cart_item_process){
208
+ if ($cart_item_process['data']['totaldiscount']>0&&$cart_item_process['new']==0&&((int)Mage::getStoreConfig('qixol/advanced/separateitem')>0||$cart_item_process['data']['generated']==false)){
209
+ $total_discount_amount+=$cart_item_process['data']['totaldiscount'];
210
+ }
211
+ //subtotal are not including delivery
212
+ /*elseif($cart_item_process['data']['totaldiscount']>0&&$cart_item_process['data']['type']=='DELIVERYREDUCTION'){
213
+ $total_discount_amount+=$cart_item_process['data']['totaldiscount'];
214
+ }*/
215
+ }
216
+
217
+ }
218
+
219
+ if (isset($_SESSION['qixol_quoted_items']['summary'])){
220
+ foreach ($_SESSION['qixol_quoted_items']['summary'] as $cart_total_process){
221
+ if ($cart_total_process['data']['discountamount']>0&&$cart_total_process['data']['type']=='BASKETREDUCTION'){
222
+ $total_discount_amount+=$cart_total_process['data']['discountamount'];
223
+ }
224
+ }
225
+ }
226
+
227
+ }
app/design/frontend/base/default/template/qixol/myaccount/order/email/default.phtml ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 rwd_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (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 $_order = $this->getItem()->getOrder() ?>
29
+ <?php
30
+ $promotions_raw=$_order->getPromotionDataApplied();
31
+ if(strlen($promotions_raw)>3){
32
+ $promotions_data_array=unserialize($promotions_raw);
33
+ }
34
+ ?>
35
+ <tbody>
36
+ <tr>
37
+ <td class="cell-content product-info">
38
+ <p class="product-name"><?php echo $this->escapeHtml($_item->getName()) ?></p>
39
+ <p class="sku"><?php echo $this->__('SKU'); ?>: <?php echo $this->escapeHtml($this->getSku($_item)) ?></p>
40
+ <?php if ($this->getItemOptions()): ?>
41
+ <dl style="margin:0; padding:0;">
42
+ <?php foreach ($this->getItemOptions() as $option): ?>
43
+ <dt><strong><em><?php echo $option['label'] ?></em></strong></dt>
44
+ <dd style="margin:0; padding:0 0 0 9px;">
45
+ <?php echo nl2br($option['value']) ?>
46
+ </dd>
47
+ <?php endforeach; ?>
48
+ </dl>
49
+ <?php endif; ?>
50
+ <?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
51
+ <?php if ($addInfoBlock) :?>
52
+ <?php echo $addInfoBlock->setItem($_item)->toHtml(); ?>
53
+ <?php endif; ?>
54
+ <?php
55
+ //{ qixol
56
+ //maybe should be redeveloped as additional.product.info template block
57
+ if (isset($promotions_data_array['items'][$_item->getQuoteItemId()]['promotions'])){
58
+ foreach ($promotions_data_array['items'][$_item->getQuoteItemId()]['promotions'] as $promotion_data){
59
+ if ($promotion_data['description']!=''){
60
+ echo "<br><span class='cart_inline_item_new_price'>".$this->escapeHtml($promotion_data['description'])."</span><br>";
61
+ }
62
+ }
63
+
64
+ }
65
+ // } end qixol
66
+ ?>
67
+ <?php echo $this->escapeHtml($_item->getDescription()) ?>
68
+ </td>
69
+ <td class="cell-content align-center"><?php echo $_item->getQtyOrdered()*1 ?></td>
70
+ <td class="cell-content align-right">
71
+ <?php if ($this->helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
72
+ <?php if ($this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
73
+ <span class="label"><?php echo Mage::helper('tax')->__('Excl. Tax'); ?>:</span>
74
+ <?php endif; ?>
75
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
76
+ <?php echo $_order->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
77
+ <?php else: ?>
78
+ <?php echo $_order->formatPrice($_item->getRowTotal()) ?>
79
+ <?php endif; ?>
80
+
81
+
82
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
83
+ <br />
84
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
85
+ <small>
86
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
87
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></span><br />
88
+ <?php endforeach; ?>
89
+ </small>
90
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
91
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
92
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></small></span><br />
93
+ <?php endforeach; ?>
94
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
95
+ <small>
96
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
97
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'],true,true); ?></span><br />
98
+ <?php endforeach; ?>
99
+ </small>
100
+ <?php endif; ?>
101
+
102
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
103
+ <br />
104
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $_order->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
105
+ <?php endif; ?>
106
+ <?php endif; ?>
107
+ <?php endif; ?>
108
+
109
+
110
+ <?php if ($this->helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
111
+ <?php if ($this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
112
+ <br /><span class="label"><?php echo Mage::helper('tax')->__('Incl. Tax'); ?>:</span>
113
+ <?php endif; ?>
114
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
115
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
116
+ <?php echo $_order->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
117
+ <?php else: ?>
118
+ <?php echo $_order->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
119
+ <?php endif; ?>
120
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
121
+ <br />
122
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
123
+ <small>
124
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
125
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
126
+ <?php endforeach; ?>
127
+ </small>
128
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
129
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
130
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
131
+ <?php endforeach; ?>
132
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
133
+ <small>
134
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
135
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
136
+ <?php endforeach; ?>
137
+ </small>
138
+ <?php endif; ?>
139
+
140
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
141
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $_order->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
142
+ <?php endif; ?>
143
+ <?php endif; ?>
144
+ <?php endif; ?>
145
+ <?php
146
+ if (isset($promotions_data_array['items'][$_item->getQuoteItemId()])&&(int)$promotions_data_array['items'][$_item->getQuoteItemId()]['basketlevel']==0&&(float)$promotions_data_array['items'][$_item->getQuoteItemId()]['discount']>0){
147
+ echo '<div class="cart_inline_item_new_price">'.Mage::helper('qixol')->__("Discount:-").$this->getOrder()->formatPrice($promotions_data_array['items'][$_item->getQuoteItemId()]['discount'])."<div>";
148
+ }
149
+ ?>
150
+
151
+ </td>
152
+ </tr>
153
+ <?php if ($_item->getGiftMessageId() && $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_item->getGiftMessageId())): ?>
154
+ <tr>
155
+ <td colspan="4" style=" border-bottom:2px solid #CCCCCC; padding:3px 9px;">
156
+ <strong style="color:#444444; font-size:11px;"><?php echo $this->__('Gift Message') ?></strong>
157
+ <?php echo $this->__('From:'); ?> <?php echo $this->escapeHtml($_giftMessage->getSender()) ?><br />
158
+ <?php echo $this->__('To:'); ?> <?php echo $this->escapeHtml($_giftMessage->getRecipient()) ?><br />
159
+ <strong><?php echo $this->__('Message:'); ?></strong><br /><?php echo $this->escapeHtml($_giftMessage->getMessage()) ?>
160
+ </td>
161
+ </tr>
162
+ <?php endif; ?>
163
+ </tbody>
app/design/frontend/base/default/template/qixol/myaccount/order/email/items.phtml ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 rwd_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <?php $_order = $this->getOrder(); ?>
29
+
30
+ <?php if ($_order): ?>
31
+ <?php
32
+ $promotions_raw=$_order->getPromotionDataApplied();
33
+ if(strlen($promotions_raw)>3){
34
+ $promotions_data_array=unserialize($promotions_raw);
35
+ }
36
+ ?>
37
+ <?php $_items = $_order->getAllItems(); ?>
38
+ <?php $_itemCount = count($_items); ?>
39
+ <tr>
40
+ <td>
41
+ <table class="items" cellpadding="0" cellspacing="0" border="0">
42
+ <thead>
43
+ <tr>
44
+ <th class="cell-name">
45
+ <?php if($_itemCount > 1): ?>
46
+ <?php echo $this->__('Items in your order'); ?>
47
+ <?php else: ?>
48
+ <?php echo $this->__('Item in your order'); ?>
49
+ <?php endif; ?>
50
+ </th>
51
+ <th class="cell-name align-center">
52
+ <?php echo $this->__('Qty'); ?>
53
+ </th>
54
+ <th class="cell-name align-right">
55
+ <?php echo $this->__('Price'); ?>
56
+ </th>
57
+ </tr>
58
+ </thead>
59
+ <?php $i=0; foreach ($_order->getAllItems() as $_item): ?>
60
+ <?php if($_item->getParentItem()) continue; else $i++; ?>
61
+ <?php echo $this->getItemHtml($_item) ?>
62
+ <?php endforeach; ?>
63
+ <?php
64
+ if (is_array($promotions_data_array['promotion_summary'])&&count($promotions_data_array['promotion_summary'])>0){
65
+ foreach ($promotions_data_array['promotion_summary'] as $inline_cart_promotion){
66
+ if($inline_cart_promotion['data']['basketlevel']>0||$inline_cart_promotion['data']['type']=='ISSUEPOINTS'){
67
+ ?>
68
+ <tbody>
69
+ <tr class='promotion_cart_inline_box'>
70
+ <td class="product-cart-info" colspan='1'><?php echo $inline_cart_promotion['data']['display_text']; ?></td>
71
+ <td class="product-cart-total" colspan='2' style="text-align:right;"><?php
72
+ switch ($inline_cart_promotion['data']['type']){
73
+ case 'DELIVERYREDUCTION';
74
+ echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
75
+ break;
76
+ case 'ISSUEPOINTS';
77
+ echo $inline_cart_promotion['data']['issuedpoints']."&nbsp;pt.";
78
+ break;
79
+ case 'BASKETREDUCTION';
80
+ echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
81
+ break;
82
+ }
83
+ ?></td>
84
+ </tr>
85
+ </tbody>
86
+ <?php
87
+ }
88
+ }
89
+ }
90
+ ?>
91
+ </table>
92
+ </td>
93
+ </tr>
94
+ <tr>
95
+ <td>
96
+ <?php echo $this->getChildHtml('order_totals') ?>
97
+ </td>
98
+ </tr>
99
+ <?php if ($this->helper('giftmessage/message')->isMessagesAvailable('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?>
100
+ <?php $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_order->getGiftMessageId()); ?>
101
+ <?php if ($_giftMessage): ?>
102
+ <br />
103
+ <table cellspacing="0" cellpadding="0" border="0" width="100%" style="border:1px solid #EAEAEA;">
104
+ <thead>
105
+ <tr>
106
+ <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><strong><?php echo $this->__('Gift Message for this Order') ?></strong></th>
107
+ </tr>
108
+ </thead>
109
+
110
+ <tbody>
111
+
112
+ <tr>
113
+ <td colspan="4" align="left" style="padding:3px 9px">
114
+ <strong><?php echo $this->__('From:'); ?></strong> <?php echo $this->escapeHtml($_giftMessage->getSender()) ?>
115
+ <br /><strong><?php echo $this->__('To:'); ?></strong> <?php echo $this->escapeHtml($_giftMessage->getRecipient()) ?>
116
+ <br /><strong><?php echo $this->__('Message:'); ?></strong><br /> <?php echo $this->escapeHtml($_giftMessage->getMessage()) ?>
117
+ </td>
118
+ </tr>
119
+ </tbody>
120
+ </table>
121
+ <?php endif; ?>
122
+ <?php endif; ?>
123
+ <?php $_history = $_order->getVisibleStatusHistory() ?>
124
+ <?php if (count($_history)): ?>
125
+ <tr>
126
+ <td>
127
+ <div class="order-additional order-comments">
128
+ <dl class="order-about">
129
+ <?php foreach ($_history as $_historyItem): ?>
130
+ <dt><?php echo $this->formatDate($_historyItem->getCreatedAtStoreDate(), 'medium', true) ?></dt>
131
+ <dd><?php echo $this->escapeHtml($_historyItem->getComment()) ?></dd>
132
+ <?php endforeach; ?>
133
+ </dl>
134
+ </div>
135
+ </td>
136
+ </tr>
137
+ <?php endif; ?>
138
+ <?php endif; ?>
app/design/frontend/base/default/template/qixol/myaccount/order/invoice/default.phtml ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (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 $_order = $this->getItem()->getOrderItem()->getOrder() ?>
29
+ <tr class="border" id="order-item-row-<?php echo $_item->getId() ?>">
30
+ <td><h4 class="product-name"><?php echo $this->escapeHtml($_item->getName()) ?></h4>
31
+ <?php if ($_options = $this->getItemOptions()): ?>
32
+ <dl class="item-options">
33
+ <?php foreach ($_options as $_option) : ?>
34
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
35
+ <?php if (!$this->getPrintStatus()): ?>
36
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
37
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>>
38
+ <?php echo $_formatedOptionValue['value'] ?>
39
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
40
+ <div class="truncated_full_value">
41
+ <dl class="item-options">
42
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
43
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
44
+ </dl>
45
+ </div>
46
+ <?php endif; ?>
47
+ </dd>
48
+ <?php else: ?>
49
+ <dd><?php echo $this->escapeHtml((isset($_option['print_value']) ? $_option['print_value'] : $_option['value'])) ?></dd>
50
+ <?php endif; ?>
51
+ <?php endforeach; ?>
52
+ </dl>
53
+ <?php endif; ?>
54
+ <?php $addInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
55
+ <?php if ($addInfoBlock) : ?>
56
+ <?php echo $addInfoBlock->setItem($_item->getOrderItem())->toHtml(); ?>
57
+ <?php endif; ?>
58
+ <?php echo $this->escapeHtml($_item->getDescription()) ?>
59
+ <?php if ($this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item->getOrderItem()) && $_item->getGiftMessageId()): ?>
60
+ <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link"
61
+ onclick="return giftMessageToogle('<?php echo $_item->getId() ?>')"><?php echo $this->__('Gift Message') ?></a>
62
+ <?php endif; ?>
63
+ </td>
64
+ <td><?php echo $this->escapeHtml(Mage::helper('core/string')->splitInjection($this->getSku())) ?></td>
65
+ <td class="a-right">
66
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
67
+ <span class="price-excl-tax">
68
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
69
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
70
+ <span class="cart-price">
71
+ <?php endif; ?>
72
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
73
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
74
+ </span>
75
+ <?php endif; ?>
76
+ <?php endif; ?>
77
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
78
+ <span class="cart-tax-total"
79
+ onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
80
+ <?php else: ?>
81
+ <span class="cart-price">
82
+ <?php endif; ?>
83
+
84
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
85
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice() + $this->getItem()->getWeeeTaxAppliedAmount() + $this->getItem()->getWeeeTaxDisposition()); ?>
86
+ <?php else: ?>
87
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()) ?>
88
+ <?php endif; ?>
89
+
90
+ </span>
91
+
92
+
93
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
94
+
95
+ <span class="cart-tax-info" id="eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>"
96
+ style="display:none;">
97
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
98
+ <small>
99
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
100
+ <span class="nobr"><?php echo $tax['title']; ?>
101
+ : <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
102
+ <?php endforeach; ?>
103
+ </small>
104
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
105
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
106
+ <span class="nobr"><small><?php echo $tax['title']; ?>
107
+ : <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></small></span>
108
+ <?php endforeach; ?>
109
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
110
+ <small>
111
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
112
+ <span class="nobr"><?php echo $tax['title']; ?>
113
+ : <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
114
+ <?php endforeach; ?>
115
+ </small>
116
+ <?php endif; ?>
117
+ </span>
118
+
119
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
120
+ <span class="cart-tax-total"
121
+ onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
122
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
123
+ :<br/> <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice() + $this->getItem()->getWeeeTaxAppliedAmount() + $this->getItem()->getWeeeTaxDisposition()); ?></span>
124
+ </span>
125
+ <?php endif; ?>
126
+ <?php endif; ?>
127
+ </span>
128
+ <br/>
129
+ <?php endif; ?>
130
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
131
+ <span class="price-incl-tax">
132
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
133
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
134
+ <span class="cart-price">
135
+ <?php endif; ?>
136
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
137
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
138
+ </span>
139
+ <?php endif; ?>
140
+ <?php endif; ?>
141
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($this->getItem()); ?>
142
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
143
+ <span class="cart-tax-total"
144
+ onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
145
+ <?php else: ?>
146
+ <span class="cart-price">
147
+ <?php endif; ?>
148
+
149
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
150
+ <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
151
+ <?php else: ?>
152
+ <?php echo $this->getOrder()->formatPrice($_incl - $this->getItem()->getWeeeTaxDisposition()) ?>
153
+ <?php endif; ?>
154
+
155
+ </span>
156
+
157
+
158
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
159
+
160
+ <span class="cart-tax-info" id="unit-item-tax-details<?php echo $this->getItem()->getId(); ?>"
161
+ style="display:none;">
162
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
163
+ <small>
164
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
165
+ <span class="nobr"><?php echo $tax['title']; ?>
166
+ : <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
167
+ <?php endforeach; ?>
168
+ </small>
169
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
170
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
171
+ <span class="nobr"><small><?php echo $tax['title']; ?>
172
+ : <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></small></span>
173
+ <?php endforeach; ?>
174
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
175
+ <small>
176
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
177
+ <span class="nobr"><?php echo $tax['title']; ?>
178
+ : <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
179
+ <?php endforeach; ?>
180
+ </small>
181
+ <?php endif; ?>
182
+ </span>
183
+
184
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
185
+ <span class="cart-tax-total"
186
+ onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
187
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>
188
+ :<br/> <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
189
+ </span>
190
+ <?php endif; ?>
191
+ <?php endif; ?>
192
+ </span>
193
+ <?php endif; ?>
194
+ </td>
195
+ <td class="a-center"><?php echo $_item->getQty() * 1 ?> </td>
196
+ <td class="a-right">
197
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
198
+ <span class="price-excl-tax">
199
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
200
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
201
+ <span class="cart-price">
202
+ <?php endif; ?>
203
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
204
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
205
+ </span>
206
+ <?php endif; ?>
207
+ <?php endif; ?>
208
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
209
+ <span class="cart-tax-total"
210
+ onclick="taxToggle('esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
211
+ <?php else: ?>
212
+ <span class="cart-price">
213
+ <?php endif; ?>
214
+
215
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
216
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal() + $this->getItem()->getWeeeTaxAppliedRowAmount() + $this->getItem()->getWeeeTaxRowDisposition()); ?>
217
+ <?php else: ?>
218
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
219
+ <?php endif; ?>
220
+
221
+ </span>
222
+
223
+
224
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
225
+
226
+ <span class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>"
227
+ style="display:none;">
228
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
229
+ <small>
230
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
231
+ <span class="nobr"><?php echo $tax['title']; ?>
232
+ : <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></span>
233
+ <?php endforeach; ?>
234
+ </small>
235
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
236
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
237
+ <span class="nobr"><small><?php echo $tax['title']; ?>
238
+ : <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></small></span>
239
+ <?php endforeach; ?>
240
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
241
+ <small>
242
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
243
+ <span class="nobr"><?php echo $tax['title']; ?>
244
+ : <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></span>
245
+ <?php endforeach; ?>
246
+ </small>
247
+ <?php endif; ?>
248
+ </span>
249
+
250
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
251
+ <span class="cart-tax-total"
252
+ onclick="taxToggle('esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
253
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>
254
+ :<br/> <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal() + $this->getItem()->getWeeeTaxAppliedRowAmount() + $this->getItem()->getWeeeTaxRowDisposition()); ?></span>
255
+ </span>
256
+ <?php endif; ?>
257
+ <?php endif; ?>
258
+ </span>
259
+ <br/>
260
+ <?php endif; ?>
261
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
262
+ <span class="price-incl-tax">
263
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
264
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
265
+ <span class="cart-price">
266
+ <?php endif; ?>
267
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
268
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
269
+ </span>
270
+ <?php endif; ?>
271
+ <?php endif; ?>
272
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($this->getItem()); ?>
273
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
274
+ <span class="cart-tax-total"
275
+ onclick="taxToggle('subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
276
+ <?php else: ?>
277
+ <span class="cart-price">
278
+ <?php endif; ?>
279
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
280
+ <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
281
+ <?php else: ?>
282
+ <?php echo $this->getOrder()->formatPrice($_incl - $this->getItem()->getWeeeTaxRowDisposition()) ?>
283
+ <?php endif; ?>
284
+
285
+ </span>
286
+
287
+
288
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
289
+
290
+ <span class="cart-tax-info" id="subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>"
291
+ style="display:none;">
292
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
293
+ <small>
294
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
295
+ <span class="nobr"><?php echo $tax['title']; ?>
296
+ : <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></span>
297
+ <?php endforeach; ?>
298
+ </small>
299
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
300
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
301
+ <span class="nobr"><small><?php echo $tax['title']; ?>
302
+ : <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></small></span>
303
+ <?php endforeach; ?>
304
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
305
+ <small>
306
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
307
+ <span class="nobr"><?php echo $tax['title']; ?>
308
+ : <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></span>
309
+ <?php endforeach; ?>
310
+ </small>
311
+ <?php endif; ?>
312
+ </span>
313
+
314
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
315
+ <span class="cart-tax-total"
316
+ onclick="taxToggle('subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
317
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>
318
+ :<br/> <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
319
+ </span>
320
+ <?php endif; ?>
321
+ <?php endif; ?>
322
+
323
+
324
+
325
+ </span>
326
+ <?php endif; ?>
327
+ </td>
328
+ </tr>
app/design/frontend/base/default/template/qixol/myaccount/order/invoice/invoice.phtml ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $_order = $this->getOrder() ?>
28
+ <?php
29
+ $promotions_raw=$_order->getPromotionDataApplied();
30
+ if(strlen($promotions_raw)>3){
31
+ $promotions_data_array=unserialize($promotions_raw);
32
+ }
33
+ ?>
34
+ <h1><?php echo $this->__('Order #%s', $_order->getRealOrderId()) ?></h1>
35
+ <p class="order-date"><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
36
+ <?php $_invoice = $this->getInvoice() ?>
37
+ <?php if($_invoice): ?>
38
+ <?php $_invoices = array($_invoice); ?>
39
+ <?php else: ?>
40
+ <?php $_invoices = $_order->getInvoiceCollection() ?>
41
+ <?php endif; ?>
42
+ <?php foreach ($_invoices as $_invoice): ?>
43
+ <h2 class="h2"><?php echo $this->__('Invoice #%s', $_invoice->getIncrementId()) ?></h2>
44
+ <div class="col2-set">
45
+ <div class="col-1">
46
+ <?php if (!$_order->getIsVirtual()): ?>
47
+ <h3><?php echo $this->__('Shipping Address') ?></h3>
48
+ <?php $_shipping = $_invoice->getShippingAddress() ?>
49
+ <address><?php echo $_shipping->format('html') ?></address>
50
+ </div>
51
+ <div class="col-2">
52
+ <?php endif; ?>
53
+ <h3><?php echo $this->__('Billing Address') ?></h3>
54
+ <?php $_billing = $_invoice->getbillingAddress() ?>
55
+ <address><?php echo $_order->getBillingAddress()->format('html') ?></address>
56
+ </div>
57
+ <?php if (!$_order->getIsVirtual()): ?>
58
+ </div>
59
+ <div class="col2-set">
60
+ <div class="col-1">
61
+ <h3><?php echo $this->__('Shipping Method') ?></h3>
62
+ <?php echo $this->escapeHtml($_order->getShippingDescription()) ?>
63
+ </div>
64
+ <?php endif; ?>
65
+ <div class="col-2">
66
+ <h3><?php echo $this->__('Payment Method') ?></h3>
67
+ <?php echo $this->getPaymentInfoHtml() ?>
68
+ </div>
69
+ </div>
70
+ <h3><?php echo $this->__('Items Invoiced') ?></h3>
71
+ <table class="data-table" id="my-invoice-table-<?php echo $_invoice->getId(); ?>">
72
+ <col />
73
+ <col width="1" />
74
+ <col width="1" />
75
+ <col width="1" />
76
+ <col width="1" />
77
+ <thead>
78
+ <tr>
79
+ <th><?php echo $this->__('Product Name') ?></th>
80
+ <th><?php echo $this->__('SKU') ?></th>
81
+ <th class="a-right"><?php echo $this->__('Price') ?></th>
82
+ <th class="a-center"><span class="nobr"><?php echo $this->__('Qty Invoiced') ?></span></th>
83
+ <th class="a-right"><?php echo $this->__('Subtotal') ?></th>
84
+ </tr>
85
+ </thead>
86
+ <tfoot>
87
+ <?php echo $this->getInvoiceTotalsHtml($_invoice)?>
88
+ </tfoot>
89
+ <?php $_items = $_invoice->getItemsCollection(); ?>
90
+ <?php $_count = $_items->count(); ?>
91
+ <?php foreach ($_items as $_item): ?>
92
+ <?php if ($_item->getOrderItem()->getParentItem()) continue; ?>
93
+ <tbody>
94
+ <?php echo $this->getItemHtml($_item) ?>
95
+ </tbody>
96
+ <?php endforeach; ?>
97
+ <?php
98
+ if (is_array($promotions_data_array['promotion_summary'])&&count($promotions_data_array['promotion_summary'])>0){
99
+ foreach ($promotions_data_array['promotion_summary'] as $inline_cart_promotion){
100
+ if($inline_cart_promotion['data']['basketlevel']>0||$inline_cart_promotion['data']['type']=='ISSUEPOINTS'){
101
+ ?>
102
+ <tbody>
103
+ <tr class='promotion_cart_inline_box'>
104
+ <td class="product-cart-info" colspan='1'><?php echo $inline_cart_promotion['data']['display_text']; ?></td>
105
+ <td class="product-cart-total" colspan='2' style="text-align:right;"><?php
106
+ switch ($inline_cart_promotion['data']['type']){
107
+ case 'DELIVERYREDUCTION';
108
+ echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
109
+ break;
110
+ case 'ISSUEPOINTS';
111
+ echo $inline_cart_promotion['data']['issuedpoints']."&nbsp;pt.";
112
+ break;
113
+ case 'BASKETREDUCTION';
114
+ echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
115
+ break;
116
+ }
117
+ ?></td>
118
+ </tr>
119
+ </tbody>
120
+ <?php
121
+ }
122
+ }
123
+ }
124
+ ?>
125
+ </table>
126
+ <script type="text/javascript">decorateTable('my-invoice-table-<?php echo $_invoice->getId(); ?>', {'tbody' : ['odd', 'even'], 'tbody tr' : ['first', 'last']})</script>
127
+ <?php endforeach; ?>
128
+ <script type="text/javascript">window.print();</script>
app/design/frontend/base/default/template/qixol/myaccount/order/items/default.phtml ADDED
@@ -0,0 +1,347 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (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
29
+ $promotions_raw=$_item->getOrder()->getPromotionDataApplied();
30
+ if(strlen($promotions_raw)>3){
31
+ $promotions_data_array=unserialize($promotions_raw);
32
+ }
33
+ ?>
34
+ <tr class="border" id="order-item-row-<?php echo $_item->getId() ?>">
35
+ <td><h3 class="product-name"><?php echo $this->escapeHtml($_item->getName()) ?></h3>
36
+ <?php if($_options = $this->getItemOptions()): ?>
37
+ <dl class="item-options">
38
+ <?php foreach ($_options as $_option) : ?>
39
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
40
+ <?php if (!$this->getPrintStatus()): ?>
41
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
42
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>>
43
+ <?php echo $_formatedOptionValue['value'] ?>
44
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
45
+ <div class="truncated_full_value">
46
+ <dl class="item-options">
47
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
48
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
49
+ </dl>
50
+ </div>
51
+ <?php endif; ?>
52
+ </dd>
53
+ <?php else: ?>
54
+ <dd>
55
+ <?php echo nl2br($this->escapeHtml( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) )) ?>
56
+ </dd>
57
+ <?php endif; ?>
58
+ <?php endforeach; ?>
59
+ </dl>
60
+ <?php endif; ?>
61
+ <?php
62
+ //{ qixol
63
+ //maybe should be redeveloped as additional.product.info template block
64
+ if (isset($promotions_data_array['items'][$_item->getQuoteItemId()]['promotions'])){
65
+ foreach ($promotions_data_array['items'][$_item->getQuoteItemId()]['promotions'] as $promotion_data){
66
+ if ($promotion_data['description']!=''){
67
+ echo "<span class='cart_inline_item_new_price'>".$this->escapeHtml($promotion_data['description'])."</span><br>";
68
+ }
69
+ }
70
+
71
+ }
72
+ // } end qixol
73
+ ?>
74
+ <?php $addtInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
75
+ <?php if ($addtInfoBlock) :?>
76
+ <?php echo $addtInfoBlock->setItem($_item)->toHtml(); ?>
77
+ <?php endif; ?>
78
+ <?php echo $this->escapeHtml($_item->getDescription()) ?>
79
+ <?php if($this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?>
80
+ <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" onclick="return giftMessageToogle('<?php echo $_item->getId() ?>')"><?php echo $this->__('Gift Message') ?></a>
81
+ <?php endif; ?>
82
+ </td>
83
+ <td><?php echo $this->escapeHtml(Mage::helper('core/string')->splitInjection($this->getSku())) ?></td>
84
+ <td class="a-right">
85
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
86
+ <span class="price-excl-tax">
87
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
88
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
89
+ <span class="cart-price">
90
+ <?php endif; ?>
91
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
92
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
93
+ </span>
94
+ <?php endif; ?>
95
+ <?php endif; ?>
96
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
97
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
98
+ <?php else: ?>
99
+ <span class="cart-price">
100
+ <?php endif; ?>
101
+
102
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
103
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice() + $this->getItem()->getWeeeTaxAppliedAmount() + $this->getItem()->getWeeeTaxDisposition()); ?>
104
+ <?php else: ?>
105
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()) ?>
106
+ <?php endif; ?>
107
+
108
+ </span>
109
+
110
+
111
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
112
+
113
+ <span class="cart-tax-info" id="eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
114
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
115
+ <small>
116
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
117
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
118
+ <?php endforeach; ?>
119
+ </small>
120
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
121
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
122
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></small></span>
123
+ <?php endforeach; ?>
124
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
125
+ <small>
126
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
127
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
128
+ <?php endforeach; ?>
129
+ </small>
130
+ <?php endif; ?>
131
+ </span>
132
+
133
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
134
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
135
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?></span>
136
+ </span>
137
+ <?php endif; ?>
138
+ <?php endif; ?>
139
+ </span>
140
+ <br />
141
+ <?php endif; ?>
142
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
143
+ <span class="price-incl-tax">
144
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
145
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
146
+ <span class="cart-price">
147
+ <?php endif; ?>
148
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
149
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
150
+ </span>
151
+ <?php endif; ?>
152
+ <?php endif; ?>
153
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($this->getItem()); ?>
154
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
155
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
156
+ <?php else: ?>
157
+ <span class="cart-price">
158
+ <?php endif; ?>
159
+
160
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
161
+ <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
162
+ <?php else: ?>
163
+ <?php echo $this->getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxDisposition()) ?>
164
+ <?php endif; ?>
165
+
166
+ </span>
167
+
168
+
169
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
170
+
171
+ <span class="cart-tax-info" id="unit-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
172
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
173
+ <small>
174
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
175
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
176
+ <?php endforeach; ?>
177
+ </small>
178
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
179
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
180
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></small></span>
181
+ <?php endforeach; ?>
182
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
183
+ <small>
184
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
185
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
186
+ <?php endforeach; ?>
187
+ </small>
188
+ <?php endif; ?>
189
+ </span>
190
+
191
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
192
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
193
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
194
+ </span>
195
+ <?php endif; ?>
196
+ <?php endif; ?>
197
+ </span>
198
+ <?php endif; ?>
199
+ </td>
200
+ <td class="a-right">
201
+ <span class="nobr">
202
+ <?php if ($this->getItem()->getQtyOrdered() > 0): ?>
203
+ <?php echo $this->__('Ordered'); ?>: <strong><?php echo $this->getItem()->getQtyOrdered()*1 ?></strong><br />
204
+ <?php endif; ?>
205
+ <?php if ($this->getItem()->getQtyShipped() > 0): ?>
206
+ <?php echo $this->__('Shipped'); ?>: <strong><?php echo $this->getItem()->getQtyShipped()*1 ?></strong><br />
207
+ <?php endif; ?>
208
+ <?php if ($this->getItem()->getQtyCanceled() > 0): ?>
209
+ <?php echo $this->__('Canceled'); ?>: <strong><?php echo $this->getItem()->getQtyCanceled()*1 ?></strong><br />
210
+ <?php endif; ?>
211
+ <?php if ($this->getItem()->getQtyRefunded() > 0): ?>
212
+ <?php echo $this->__('Refunded'); ?>: <strong><?php echo $this->getItem()->getQtyRefunded()*1 ?></strong><br />
213
+ <?php endif; ?>
214
+ </span>
215
+ </td>
216
+ <td class="a-right">
217
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
218
+ <span class="price-excl-tax">
219
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
220
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
221
+ <span class="cart-price">
222
+ <?php endif; ?>
223
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
224
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
225
+ </span>
226
+ <?php endif; ?>
227
+ <?php endif; ?>
228
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
229
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
230
+ <?php else: ?>
231
+ <span class="cart-price">
232
+ <?php endif; ?>
233
+
234
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
235
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
236
+ <?php else: ?>
237
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
238
+ <?php endif; ?>
239
+
240
+ </span>
241
+
242
+
243
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
244
+
245
+ <span class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
246
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
247
+ <small>
248
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
249
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></span>
250
+ <?php endforeach; ?>
251
+ </small>
252
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
253
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
254
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?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']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></span>
260
+ <?php endforeach; ?>
261
+ </small>
262
+ <?php endif; ?>
263
+ </span>
264
+
265
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
266
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
267
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?></span>
268
+ </span>
269
+ <?php endif; ?>
270
+ <?php endif; ?>
271
+ </span>
272
+ <br />
273
+ <?php endif; ?>
274
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
275
+ <span class="price-incl-tax">
276
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
277
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
278
+ <span class="cart-price">
279
+ <?php endif; ?>
280
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
281
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
282
+ </span>
283
+ <?php endif; ?>
284
+ <?php endif; ?>
285
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($this->getItem()); ?>
286
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
287
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
288
+ <?php else: ?>
289
+ <span class="cart-price">
290
+ <?php endif; ?>
291
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
292
+ <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
293
+ <?php else: ?>
294
+ <?php echo $this->getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxRowDisposition()) ?>
295
+ <?php endif; ?>
296
+
297
+ </span>
298
+
299
+
300
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
301
+
302
+ <span class="cart-tax-info" id="subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
303
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
304
+ <small>
305
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
306
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></span>
307
+ <?php endforeach; ?>
308
+ </small>
309
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
310
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
311
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></small></span>
312
+ <?php endforeach; ?>
313
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
314
+ <small>
315
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
316
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></span>
317
+ <?php endforeach; ?>
318
+ </small>
319
+ <?php endif; ?>
320
+ </span>
321
+
322
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
323
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
324
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
325
+ </span>
326
+ <?php endif; ?>
327
+ <?php endif; ?>
328
+
329
+
330
+
331
+ </span>
332
+ <?php endif; ?>
333
+ <?php
334
+ if (isset($promotions_data_array['items'][$_item->getQuoteItemId()])&&(int)$promotions_data_array['items'][$_item->getQuoteItemId()]['basketlevel']==0&&(float)$promotions_data_array['items'][$_item->getQuoteItemId()]['discount']>0){
335
+ echo '<div class="cart_inline_item_new_price">'.Mage::helper('qixol')->__("Discount:-").$this->getOrder()->formatPrice($promotions_data_array['items'][$_item->getQuoteItemId()]['discount'])."<div>";
336
+ }
337
+ ?>
338
+ </td>
339
+ <!--
340
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
341
+ <th class="a-right"><?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()) ?></th>
342
+ <?php endif; ?>
343
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
344
+ <th class="a-right"><?php echo $this->getOrder()->formatPrice($this->helper('checkout')->getSubtotalInclTax($this->getItem())); ?></th>
345
+ <?php endif; ?>
346
+ -->
347
+ </tr>
app/design/frontend/base/default/template/qixol/myaccount/order/items/items.phtml ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $_order = $this->getOrder(); ?>
28
+ <?php
29
+ $promotions_raw=$_order->getPromotionDataApplied();
30
+ if(strlen($promotions_raw)>3){
31
+ $promotions_data_array=unserialize($promotions_raw);
32
+ }
33
+ ?>
34
+ <table class="data-table" id="my-orders-table" summary="<?php echo Mage::helper('core')->quoteEscape($this->__('Items Ordered')) ?>">
35
+ <col />
36
+ <col width="1" />
37
+ <col width="1" />
38
+ <col width="1" />
39
+ <col width="1" />
40
+ <thead>
41
+ <tr>
42
+ <th><?php echo $this->__('Product Name') ?></th>
43
+ <th><?php echo $this->__('SKU') ?></th>
44
+ <th class="a-right"><?php echo $this->__('Price') ?></th>
45
+ <th class="a-center"><?php echo $this->__('Qty') ?></th>
46
+ <th class="a-right"><?php echo $this->__('Subtotal') ?></th>
47
+ </tr>
48
+ </thead>
49
+ <tfoot>
50
+ <?php echo $this->getChildHtml('order_totals') ?>
51
+ </tfoot>
52
+ <?php $_items = $_order->getItemsCollection(); ?>
53
+ <?php $_index = 0; ?>
54
+ <?php $_count = $_items->count(); ?>
55
+ <?php foreach ($_items as $_item): ?>
56
+ <?php if ($_item->getParentItem()) continue; ?>
57
+ <tbody>
58
+ <?php echo $this->getItemHtml($_item) ?>
59
+ <?php if($this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?>
60
+ <tr class="border<?php echo ($_index++ > $_count ?' last':'') ?>" id="order-item-gift-message-<?php echo $_item->getId() ?>" style="display:none;">
61
+ <?php $_giftMessage=$this->helper('giftmessage/message')->getGiftMessageForEntity($_item); ?>
62
+ <td class="gift-message-row" colspan="7">
63
+ <a href="#" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Close')) ?>" onclick="return giftMessageToogle('<?php echo $_item->getId() ?>');" class="btn-close"><?php echo $this->__('Close') ?></a>
64
+ <dl class="gift-message">
65
+ <dt><strong><?php echo $this->__('From:') ?></strong> <?php echo $this->escapeHtml($_giftMessage->getRecipient()) ?></dt>
66
+ <dt><strong><?php echo $this->__('To:') ?></strong> <?php echo $this->escapeHtml($_giftMessage->getSender()) ?></dt>
67
+ <dd><?php echo $this->helper('giftmessage/message')->getEscapedGiftMessage($_item) ?></dd>
68
+ </dl>
69
+ </td>
70
+ </tr>
71
+ <?php endif ?>
72
+ </tbody>
73
+ <?php endforeach; ?>
74
+ <?php
75
+
76
+
77
+
78
+
79
+ if (is_array($promotions_data_array['promotion_summary'])&&count($promotions_data_array['promotion_summary'])>0){
80
+ foreach ($promotions_data_array['promotion_summary'] as $inline_cart_promotion){
81
+ if($inline_cart_promotion['data']['basketlevel']>0||$inline_cart_promotion['data']['type']=='ISSUEPOINTS'){
82
+ ?>
83
+ <tbody>
84
+ <tr class='promotion_cart_inline_box'>
85
+ <td class="product-cart-info" colspan='3'><?php echo $inline_cart_promotion['data']['display_text']; ?></td>
86
+ <td class="product-cart-total" colspan='2' style="text-align:right;"><?php
87
+ switch ($inline_cart_promotion['data']['type']){
88
+ case 'DELIVERYREDUCTION';
89
+ echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
90
+ break;
91
+ case 'ISSUEPOINTS';
92
+ echo $inline_cart_promotion['data']['issuedpoints']."&nbsp;pt.";
93
+ break;
94
+ case 'BASKETREDUCTION';
95
+ echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
96
+ break;
97
+ }
98
+ ?></td>
99
+ </tr>
100
+ </tbody>
101
+ <?php
102
+ }
103
+ }
104
+ }
105
+
106
+ ?>
107
+
108
+ </table>
109
+ <script type="text/javascript">decorateTable('my-orders-table', {'tbody' : ['odd', 'even'], 'tbody tr' : ['first', 'last']})</script>
app/design/frontend/base/default/template/qixol/myaccount/order/print/default.phtml ADDED
@@ -0,0 +1,347 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (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
29
+ $promotions_raw=$_item->getOrder()->getPromotionDataApplied();
30
+ if(strlen($promotions_raw)>3){
31
+ $promotions_data_array=unserialize($promotions_raw);
32
+ }
33
+ ?>
34
+ <tr class="border" id="order-item-row-<?php echo $_item->getId() ?>">
35
+ <td><h3 class="product-name"><?php echo $this->escapeHtml($_item->getName()) ?></h3>
36
+ <?php if($_options = $this->getItemOptions()): ?>
37
+ <dl class="item-options">
38
+ <?php foreach ($_options as $_option) : ?>
39
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
40
+ <?php if (!$this->getPrintStatus()): ?>
41
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
42
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>>
43
+ <?php echo $_formatedOptionValue['value'] ?>
44
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
45
+ <div class="truncated_full_value">
46
+ <dl class="item-options">
47
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
48
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
49
+ </dl>
50
+ </div>
51
+ <?php endif; ?>
52
+ </dd>
53
+ <?php else: ?>
54
+ <dd>
55
+ <?php echo nl2br($this->escapeHtml( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) )) ?>
56
+ </dd>
57
+ <?php endif; ?>
58
+ <?php endforeach; ?>
59
+ </dl>
60
+ <?php endif; ?>
61
+ <?php $addtInfoBlock = $this->getProductAdditionalInformationBlock(); ?>
62
+ <?php
63
+ //{ qixol
64
+ //maybe should be redeveloped as additional.product.info template block
65
+ if (isset($promotions_data_array['items'][$_item->getQuoteItemId()]['promotions'])){
66
+ foreach ($promotions_data_array['items'][$_item->getQuoteItemId()]['promotions'] as $promotion_data){
67
+ if ($promotion_data['description']!=''){
68
+ echo "<span class='cart_inline_item_new_price'><b>".$this->escapeHtml($promotion_data['description'])."</b></span><br>";
69
+ }
70
+ }
71
+
72
+ }
73
+ // } end qixol
74
+ ?>
75
+ <?php if ($addtInfoBlock) :?>
76
+ <?php echo $addtInfoBlock->setItem($_item)->toHtml(); ?>
77
+ <?php endif; ?>
78
+ <?php echo $this->escapeHtml($_item->getDescription()) ?>
79
+ <?php if($this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?>
80
+ <a href="#" id="order-item-gift-message-link-<?php echo $_item->getId() ?>" class="gift-message-link" onclick="return giftMessageToogle('<?php echo $_item->getId() ?>')"><?php echo $this->__('Gift Message') ?></a>
81
+ <?php endif; ?>
82
+ </td>
83
+ <td><?php echo $this->escapeHtml(Mage::helper('core/string')->splitInjection($this->getSku())) ?></td>
84
+ <td class="a-right">
85
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
86
+ <span class="price-excl-tax">
87
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
88
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
89
+ <span class="cart-price">
90
+ <?php endif; ?>
91
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
92
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
93
+ </span>
94
+ <?php endif; ?>
95
+ <?php endif; ?>
96
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
97
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
98
+ <?php else: ?>
99
+ <span class="cart-price">
100
+ <?php endif; ?>
101
+
102
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
103
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice() + $this->getItem()->getWeeeTaxAppliedAmount() + $this->getItem()->getWeeeTaxDisposition()); ?>
104
+ <?php else: ?>
105
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()) ?>
106
+ <?php endif; ?>
107
+
108
+ </span>
109
+
110
+
111
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
112
+
113
+ <span class="cart-tax-info" id="eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
114
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
115
+ <small>
116
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
117
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
118
+ <?php endforeach; ?>
119
+ </small>
120
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
121
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
122
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></small></span>
123
+ <?php endforeach; ?>
124
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
125
+ <small>
126
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
127
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount']); ?></span>
128
+ <?php endforeach; ?>
129
+ </small>
130
+ <?php endif; ?>
131
+ </span>
132
+
133
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
134
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
135
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?></span>
136
+ </span>
137
+ <?php endif; ?>
138
+ <?php endif; ?>
139
+ </span>
140
+ <br />
141
+ <?php endif; ?>
142
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
143
+ <span class="price-incl-tax">
144
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
145
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
146
+ <span class="cart-price">
147
+ <?php endif; ?>
148
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
149
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
150
+ </span>
151
+ <?php endif; ?>
152
+ <?php endif; ?>
153
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($this->getItem()); ?>
154
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
155
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
156
+ <?php else: ?>
157
+ <span class="cart-price">
158
+ <?php endif; ?>
159
+
160
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
161
+ <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
162
+ <?php else: ?>
163
+ <?php echo $this->getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxDisposition()) ?>
164
+ <?php endif; ?>
165
+
166
+ </span>
167
+
168
+
169
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
170
+
171
+ <span class="cart-tax-info" id="unit-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
172
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
173
+ <small>
174
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
175
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
176
+ <?php endforeach; ?>
177
+ </small>
178
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
179
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
180
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></small></span>
181
+ <?php endforeach; ?>
182
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
183
+ <small>
184
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
185
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['amount_incl_tax']); ?></span>
186
+ <?php endforeach; ?>
187
+ </small>
188
+ <?php endif; ?>
189
+ </span>
190
+
191
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
192
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
193
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?></span>
194
+ </span>
195
+ <?php endif; ?>
196
+ <?php endif; ?>
197
+ </span>
198
+ <?php endif; ?>
199
+ </td>
200
+ <td class="a-right">
201
+ <span class="nobr">
202
+ <?php if ($this->getItem()->getQtyOrdered() > 0): ?>
203
+ <?php echo $this->__('Ordered'); ?>: <strong><?php echo $this->getItem()->getQtyOrdered()*1 ?></strong><br />
204
+ <?php endif; ?>
205
+ <?php if ($this->getItem()->getQtyShipped() > 0): ?>
206
+ <?php echo $this->__('Shipped'); ?>: <strong><?php echo $this->getItem()->getQtyShipped()*1 ?></strong><br />
207
+ <?php endif; ?>
208
+ <?php if ($this->getItem()->getQtyCanceled() > 0): ?>
209
+ <?php echo $this->__('Canceled'); ?>: <strong><?php echo $this->getItem()->getQtyCanceled()*1 ?></strong><br />
210
+ <?php endif; ?>
211
+ <?php if ($this->getItem()->getQtyRefunded() > 0): ?>
212
+ <?php echo $this->__('Refunded'); ?>: <strong><?php echo $this->getItem()->getQtyRefunded()*1 ?></strong><br />
213
+ <?php endif; ?>
214
+ </span>
215
+ </td>
216
+ <td class="a-right">
217
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
218
+ <span class="price-excl-tax">
219
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
220
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
221
+ <span class="cart-price">
222
+ <?php endif; ?>
223
+ <span class="label"><?php echo $this->__('Excl. Tax'); ?>:</span>
224
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
225
+ </span>
226
+ <?php endif; ?>
227
+ <?php endif; ?>
228
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
229
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
230
+ <?php else: ?>
231
+ <span class="cart-price">
232
+ <?php endif; ?>
233
+
234
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
235
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
236
+ <?php else: ?>
237
+ <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
238
+ <?php endif; ?>
239
+
240
+ </span>
241
+
242
+
243
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
244
+
245
+ <span class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
246
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
247
+ <small>
248
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
249
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></span>
250
+ <?php endforeach; ?>
251
+ </small>
252
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
253
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
254
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?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']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount']); ?></span>
260
+ <?php endforeach; ?>
261
+ </small>
262
+ <?php endif; ?>
263
+ </span>
264
+
265
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
266
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
267
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?></span>
268
+ </span>
269
+ <?php endif; ?>
270
+ <?php endif; ?>
271
+ </span>
272
+ <br />
273
+ <?php endif; ?>
274
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
275
+ <span class="price-incl-tax">
276
+ <?php if ($this->helper('tax')->displaySalesBothPrices()): ?>
277
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
278
+ <span class="cart-price">
279
+ <?php endif; ?>
280
+ <span class="label"><?php echo $this->__('Incl. Tax'); ?>:</span>
281
+ <?php if (!Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
282
+ </span>
283
+ <?php endif; ?>
284
+ <?php endif; ?>
285
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($this->getItem()); ?>
286
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
287
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
288
+ <?php else: ?>
289
+ <span class="cart-price">
290
+ <?php endif; ?>
291
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
292
+ <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
293
+ <?php else: ?>
294
+ <?php echo $this->getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxRowDisposition()) ?>
295
+ <?php endif; ?>
296
+
297
+ </span>
298
+
299
+
300
+ <?php if (Mage::helper('weee')->getApplied($this->getItem())): ?>
301
+
302
+ <span class="cart-tax-info" id="subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>" style="display:none;">
303
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
304
+ <small>
305
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
306
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></span>
307
+ <?php endforeach; ?>
308
+ </small>
309
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
310
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
311
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></small></span>
312
+ <?php endforeach; ?>
313
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
314
+ <small>
315
+ <?php foreach (Mage::helper('weee')->getApplied($this->getItem()) as $tax): ?>
316
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $this->getOrder()->formatPrice($tax['row_amount_incl_tax']); ?></span>
317
+ <?php endforeach; ?>
318
+ </small>
319
+ <?php endif; ?>
320
+ </span>
321
+
322
+ <?php if (Mage::helper('weee')->typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
323
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $this->getItem()->getId(); ?>', this, 'cart-tax-total-expanded');">
324
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->getOrder()->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?></span>
325
+ </span>
326
+ <?php endif; ?>
327
+ <?php endif; ?>
328
+
329
+
330
+
331
+ </span>
332
+ <?php endif; ?>
333
+ <?php
334
+ if (isset($promotions_data_array['items'][$_item->getQuoteItemId()])&&(int)$promotions_data_array['items'][$_item->getQuoteItemId()]['basketlevel']==0&&(float)$promotions_data_array['items'][$_item->getQuoteItemId()]['discount']>0){
335
+ echo '<div class="cart_inline_item_new_price"><b>'.Mage::helper('qixol')->__("Discount:-").$this->getOrder()->formatPrice($promotions_data_array['items'][$_item->getQuoteItemId()]['discount'])."</b><div>";
336
+ }
337
+ ?>
338
+ </td>
339
+ <!--
340
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
341
+ <th class="a-right"><?php echo $this->getOrder()->formatPrice($this->getItem()->getRowTotal()) ?></th>
342
+ <?php endif; ?>
343
+ <?php if ($this->helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
344
+ <th class="a-right"><?php echo $this->getOrder()->formatPrice($this->helper('checkout')->getSubtotalInclTax($this->getItem())); ?></th>
345
+ <?php endif; ?>
346
+ -->
347
+ </tr>
app/design/frontend/base/default/template/qixol/myaccount/order/print/messages.phtml ADDED
@@ -0,0 +1 @@
 
1
+ !!!!!
app/design/frontend/base/default/template/qixol/myaccount/order/print/print.phtml ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $_order = $this->getOrder() ?>
28
+ <?php
29
+ $promotions_raw=$_order->getPromotionDataApplied();
30
+ if(strlen($promotions_raw)>3){
31
+ $promotions_data_array=unserialize($promotions_raw);
32
+ }
33
+ ?>
34
+ <h1><?php echo $this->__('Order #%s', $_order->getRealOrderId()) ?></h1>
35
+ <p class="order-date"><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
36
+ <div class="col2-set">
37
+ <?php if (!$_order->getIsVirtual()): ?>
38
+ <div class="col-1">
39
+ <h2><?php echo $this->__('Shipping Address') ?></h2>
40
+ <address><?php echo $_order->getShippingAddress()->format('html') ?></address>
41
+ </div>
42
+ <div class="col-2">
43
+ <?php else: ?>
44
+ <div class="col-1">
45
+ <?php endif; ?>
46
+ <h2><?php echo $this->__('Billing Address') ?></h2>
47
+ <address><?php echo $_order->getBillingAddress()->format('html') ?></address>
48
+ </div>
49
+ <?php if (!$_order->getIsVirtual()): ?>
50
+ </div>
51
+ <div class="col2-set">
52
+ <div class="col-1">
53
+ <h2><?php echo $this->__('Shipping Method') ?></h2>
54
+ <?php echo $this->escapeHtml($_order->getShippingDescription()) ?>
55
+ </div>
56
+ <?php endif; ?>
57
+ <div class="col-2">
58
+ <h2><?php echo $this->__('Payment Method') ?></h2>
59
+ <?php echo $this->getPaymentInfoHtml() ?>
60
+ </div>
61
+ </div>
62
+ <h2><?php echo $this->__('Items Ordered') ?></h2>
63
+ <table class="data-table" id="my-orders-table">
64
+ <col />
65
+ <col width="1" />
66
+ <col width="1" />
67
+ <col width="1" />
68
+ <col width="1" />
69
+ <thead>
70
+ <tr>
71
+ <th><?php echo $this->__('Product Name') ?></th>
72
+ <th><?php echo $this->__('SKU') ?></th>
73
+ <th class="a-right"><?php echo $this->__('Price') ?></th>
74
+ <th class="a-center"><?php echo $this->__('Qty') ?></th>
75
+ <th class="a-right"><?php echo $this->__('Subtotal') ?></th>
76
+ </tr>
77
+ </thead>
78
+ <tfoot>
79
+ <?php echo $this->getChildHtml('order_totals') ?>
80
+ </tfoot>
81
+ <?php $_items = $_order->getItemsCollection(); ?>
82
+ <?php $_count = $_items->count(); ?>
83
+ <?php foreach ($_items as $_item): ?>
84
+ <?php if ($_item->getParentItem()) continue; ?>
85
+ <tbody>
86
+ <?php echo $this->getItemHtml($_item) ?>
87
+ </tbody>
88
+ <?php endforeach; ?>
89
+ <?php
90
+
91
+ if (is_array($promotions_data_array['promotion_summary'])&&count($promotions_data_array['promotion_summary'])>0){
92
+ foreach ($promotions_data_array['promotion_summary'] as $inline_cart_promotion){
93
+ if($inline_cart_promotion['data']['basketlevel']>0||$inline_cart_promotion['data']['type']=='ISSUEPOINTS'){
94
+ ?>
95
+ <tbody>
96
+ <tr class='promotion_cart_inline_box'>
97
+ <td class="product-cart-info" colspan='3'><?php echo $inline_cart_promotion['data']['display_text']; ?></td>
98
+ <td class="product-cart-total" colspan='2' style="text-align:right;"><?php
99
+ switch ($inline_cart_promotion['data']['type']){
100
+ case 'DELIVERYREDUCTION';
101
+ echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
102
+ break;
103
+ case 'ISSUEPOINTS';
104
+ echo $inline_cart_promotion['data']['issuedpoints']."&nbsp;pt.";
105
+ break;
106
+ case 'BASKETREDUCTION';
107
+ echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
108
+ break;
109
+ }
110
+ ?></td>
111
+ </tr>
112
+ </tbody>
113
+ <?php
114
+ }
115
+ }
116
+ }
117
+
118
+ ?>
119
+ </table>
120
+ <script type="text/javascript">decorateTable('my-orders-table', {'tbody' : ['odd', 'even'], 'tbody tr' : ['first', 'last']})</script>
121
+ <script type="text/javascript">window.print();</script>
122
+ <?php $_history = $this->getOrder()->getVisibleStatusHistory() ?>
123
+ <?php if (count($_history)): ?>
124
+ <div class="order-additional order-comments">
125
+ <dl class="order-about">
126
+ <?php foreach ($_history as $_historyItem): ?>
127
+ <dt><?php echo $this->formatDate($_historyItem->getCreatedAtStoreDate(), 'medium', true) ?></dt>
128
+ <dd><?php echo $this->escapeHtml($_historyItem->getComment()) ?></dd>
129
+ <?php endforeach; ?>
130
+ </dl>
131
+ </div>
132
+ <?php endif; ?>
app/design/frontend/base/default/template/qixol/onepage/advert.phtml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //$place_box_in_design_after_pattern=Mage::getStoreConfig('qixol/integraion/boxcartpromotion')
3
+ $place_box_in_design_after_pattern='.cart';
4
+
5
+ $inline_cart_advert='';
6
+ $total_discount_amount=0;
7
+ $delivery_discount_amount=0;
8
+ //for cart items
9
+ $cart = Mage::getModel('checkout/cart')->getQuote();
10
+ foreach ($cart->getAllItems() as $item) {
11
+ if (isset($_SESSION['qixol_quoted_items'])&&isset($_SESSION['qixol_quoted_items']['items'][$item->getId()])){
12
+ if ((int)Mage::getStoreConfig('qixol/frontend/onepagejavascr')>0 && Mage::getStoreConfig('qixol/advanced/services')!='dontdisplay' &&
13
+ isset($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions']))
14
+ foreach ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'] as $promotion){
15
+ //inline level promotion
16
+ if ((int)$promotion['basketlevel']==0&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displaytext'){
17
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_promo\">".addslashes($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display_text'])."</div>').appendTo($('#qixol_idx_cart_item_name_".$item->getId()."'));";
18
+ } elseif((int)$promotion['basketlevel']==0&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displayname') {
19
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_promo\">".addslashes($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['name'])."</div>').appendTo($('#qixol_idx_cart_item_name_".$item->getId()."'));";
20
+
21
+ } elseif((int)$promotion['basketlevel']==0&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displaytype') {
22
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_promo\">".addslashes($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display'])."</div>').appendTo($('#qixol_idx_cart_item_name_".$item->getId()."'));";
23
+
24
+ }
25
+
26
+ //if quantity changed (get one + one free so will be splited to 2 products with 1 free)
27
+ if ((int)Mage::getStoreConfig('qixol/frontend/onepagejavascr')>0 && $_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_qty']>0)
28
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_new_qty\">For&nbsp;promo&nbsp;".addslashes($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['quantity'])."&nbsp;Qty</div>').appendTo($('#qixol_idx_cart_item_qty_".$item->getId()."'));";
29
+
30
+ if ((int)Mage::getStoreConfig('qixol/frontend/onepagejavascr')>0 && $_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_price']>0)
31
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_new_price\">Only for - 6 ".addslashes($this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['lineamount']))."</div>').appendTo($('#qixol_idx_cart_item_price_".$item->getId()."'));";
32
+ }
33
+ }
34
+
35
+ if (isset($_SESSION['qixol_quoted_items']['items'])){
36
+ foreach ($_SESSION['qixol_quoted_items']['items'] as $cart_item_process){
37
+ if ($cart_item_process['data']['totaldiscount']>0&&$cart_item_process['new']==0&&((int)Mage::getStoreConfig('qixol/advanced/separateitem')>0||$cart_item_process['data']['generated']==false)){
38
+ $total_discount_amount+=$cart_item_process['data']['totaldiscount'];
39
+ }/*elseif($cart_item_process['data']['isdelivery']){
40
+ foreach ($cart_item_process['promotions'] as $delivery_promotion){
41
+ if ($delivery_promotion['discountamount']>0){
42
+ $delivery_discount_amount+=$delivery_promotion['discountamount'];
43
+ }
44
+ }
45
+ }*/
46
+ }
47
+ }
48
+ if (isset($_SESSION['qixol_quoted_items']['cart_data']['deliverytotaldiscount'])){
49
+ $delivery_discount_amount=$_SESSION['qixol_quoted_items']['cart_data']['deliverytotaldiscount'];
50
+ }
51
+
52
+ if (isset($_SESSION['qixol_quoted_items']['summary'])){
53
+ foreach ($_SESSION['qixol_quoted_items']['summary'] as $cart_total_process){
54
+ if ($cart_total_process['data']['discountamount']>0&&$cart_total_process['data']['type']=='BASKETREDUCTION'){
55
+ $total_discount_amount+=$cart_total_process['data']['discountamount'];
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ?>
app/design/frontend/base/default/template/qixol/onepage/item.phtml ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (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 /* {{ qixol should be added id */ ?>
29
+ <tr id='qixol_idx_cart_item_<?php echo $_item->getId(); ?>'>
30
+ <?php /* }} qixol end should be added id */ ?>
31
+ <?php /* {{ qixol should be added id */ ?>
32
+ <td id='qixol_idx_cart_item_name_<?php echo $_item->getId(); ?>'><h3 class="product-name"><?php echo $this->escapeHtml($this->getProductName()) ?></h3>
33
+ <?php if ($_options = $this->getOptionList()):?>
34
+ <dl class="item-options">
35
+ <?php foreach ($_options as $_option) : ?>
36
+ <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
37
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
38
+ <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
39
+ <?php if (isset($_formatedOptionValue['full_view'])): ?>
40
+ <div class="truncated_full_value">
41
+ <dl class="item-options">
42
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
43
+ <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
44
+ </dl>
45
+ </div>
46
+ <?php endif; ?>
47
+ </dd>
48
+ <?php endforeach; ?>
49
+ </dl>
50
+ <?php endif;?>
51
+ <?php if ($addtInfoBlock = $this->getProductAdditionalInformationBlock()):?>
52
+ <?php echo $addtInfoBlock->setItem($_item)->toHtml() ?>
53
+ <?php endif; /* qixol {{ */
54
+ if ((int)Mage::getStoreConfig('qixol/frontend/onepagejavascr')==0&&Mage::getStoreConfig('qixol/advanced/services')!='dontdisplay'):
55
+ foreach ($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['promotions'] as $promotion){
56
+ //inline level promotion
57
+ $is_generated=($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']>0?$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']:$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']);
58
+ if (((int)$promotion['basketlevel']==0||$is_generated>0)&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displaytext'){
59
+ ?><div class="cart_inline_item_promo"><?php echo $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display_text']; ?></div><?php
60
+ }elseif(((int)$promotion['basketlevel']==0||$is_generated>0)&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displayname'){
61
+ ?><div class="cart_inline_item_promo"><?php echo $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['name']; ?></div><?php
62
+ }elseif(((int)$promotion['basketlevel']==0||$is_generated>0)&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displaytype'){
63
+ ?><div class="cart_inline_item_promo"><?php echo $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display']; ?></div><?php
64
+ }
65
+
66
+ }
67
+ endif;
68
+ /* }} end qixol */ ?>
69
+ </td>
70
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
71
+ <td class="a-right">
72
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
73
+ <span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
74
+ <?php else: ?>
75
+ <span class="cart-price">
76
+ <?php endif; ?>
77
+
78
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
79
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
80
+ <?php else: ?>
81
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
82
+ <?php endif; ?>
83
+
84
+ </span>
85
+
86
+
87
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
88
+
89
+ <div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
90
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
91
+ <small>
92
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
93
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
94
+ <?php endforeach; ?>
95
+ </small>
96
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
97
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
98
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></small></span><br />
99
+ <?php endforeach; ?>
100
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
101
+ <small>
102
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
103
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
104
+ <?php endforeach; ?>
105
+ </small>
106
+ <?php endif; ?>
107
+ </div>
108
+
109
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
110
+ <div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
111
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
112
+ </div>
113
+ <?php endif; ?>
114
+ <?php endif; ?>
115
+ </td>
116
+ <?php endif; ?>
117
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
118
+ <td>
119
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
120
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
121
+ <span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
122
+ <?php else: ?>
123
+ <span class="cart-price">
124
+ <?php endif; ?>
125
+
126
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
127
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
128
+ <?php else: ?>
129
+ <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
130
+ <?php endif; ?>
131
+
132
+ </span>
133
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
134
+
135
+ <div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
136
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
137
+ <small>
138
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
139
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
140
+ <?php endforeach; ?>
141
+ </small>
142
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
143
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
144
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
145
+ <?php endforeach; ?>
146
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
147
+ <small>
148
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
149
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
150
+ <?php endforeach; ?>
151
+ </small>
152
+ <?php endif; ?>
153
+ </div>
154
+
155
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
156
+ <div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
157
+ <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>
158
+ </div>
159
+ <?php endif; ?>
160
+ <?php endif; ?>
161
+ </td>
162
+ <?php endif; ?>
163
+ <?php /* qixol should be added id */ ?>
164
+ <td class="a-center" id='qixol_idx_cart_item_qty_<?php echo $_item->getId(); ?>'><?php echo $_item->getQty();
165
+ //{{qixol
166
+ /*if ((int)Mage::getStoreConfig('qixol/frontend/onepagejavascr')==0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['updated_qty']>0){
167
+ ?><div class="cart_inline_item_new_qty">For&nbsp;promo&nbsp;<?php echo $_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['quantity'];?>&nbsp;Qty</div><?php
168
+ }
169
+ if ((int)Mage::getStoreConfig('qixol/frontend/onepagejavascr')==0&&($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']>0)){
170
+ ?><div class="cart_inline_item_new_price">+ <?php echo $_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']; ?> free</div><?php
171
+ }*/
172
+ //}}qixol end
173
+ ?></td>
174
+ <!-- sub total starts here -->
175
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
176
+ <?php /* qixol should be added id */ ?>
177
+ <td class="a-right" id='a_qixol_idx_cart_item_price_<?php echo $_item->getId(); ?>'>
178
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
179
+ <span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
180
+ <?php else: ?>
181
+ <span class="cart-price">
182
+ <?php endif; ?>
183
+
184
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
185
+ <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
186
+ <?php else: ?>
187
+ <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>
188
+ <?php endif; ?>
189
+
190
+ </span>
191
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
192
+
193
+ <div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
194
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
195
+ <small>
196
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
197
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span><br />
198
+ <?php endforeach; ?>
199
+ </small>
200
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
201
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
202
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></small></span><br />
203
+ <?php endforeach; ?>
204
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
205
+ <small>
206
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
207
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span><br />
208
+ <?php endforeach; ?>
209
+ </small>
210
+ <?php endif; ?>
211
+ </div>
212
+
213
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
214
+ <div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
215
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
216
+ </div>
217
+ <?php endif; ?>
218
+ <?php endif; ?>
219
+ <?php
220
+ //{{qixol
221
+ if ((int)Mage::getStoreConfig('qixol/frontend/onepagejavascr')==0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['updated_price']>0){
222
+ ?><div class="cart_inline_item_new_price">Only for - 7 <?php echo $this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalamount']-$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['totaldiscount']); ?></div><?php
223
+ }
224
+ if ((int)Mage::getStoreConfig('qixol/frontend/onepagejavascr')==0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['new']>0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']>0){
225
+ ?><div class="cart_inline_item_new_price"><?php echo $this->__('Discount: -').$this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalprice']); ?></div><?php
226
+ }else if ((int)Mage::getStoreConfig('qixol/frontend/onepagejavascr')==0&&($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']>0)){
227
+ ?><div class="cart_inline_item_new_price"><?php echo $this->__('Discount: -').$this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalprice']*$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']); ?></div><?php
228
+ }
229
+ //}}qixol end
230
+ ?>
231
+ </td>
232
+ <?php endif; ?>
233
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
234
+ <td id='b_qixol_idx_cart_item_price_<?php echo $_item->getId(); ?>'>
235
+ <?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
236
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
237
+ <span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
238
+ <?php else: ?>
239
+ <span class="cart-price">
240
+ <?php endif; ?>
241
+
242
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
243
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getRowWeeeTaxInclTax($_item)); ?>
244
+ <?php else: ?>
245
+ <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
246
+ <?php endif; ?>
247
+
248
+ </span>
249
+
250
+
251
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
252
+
253
+ <div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
254
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
255
+ <small>
256
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
257
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
258
+ <?php endforeach; ?>
259
+ </small>
260
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
261
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
262
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
263
+ <?php endforeach; ?>
264
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
265
+ <small>
266
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
267
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
268
+ <?php endforeach; ?>
269
+ </small>
270
+ <?php endif; ?>
271
+ </div>
272
+
273
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
274
+ <div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
275
+ <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>
276
+ </div>
277
+ <?php endif; ?>
278
+ <?php endif; ?>
279
+ <?php
280
+ //{{qixol
281
+ if ((int)Mage::getStoreConfig('qixol/frontend/onepagejavascr')==0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['updated_price']>0){
282
+ ?><div class="cart_inline_item_new_price">Only for - 8 <?php echo $this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['lineamount']); ?></div><?php
283
+ }
284
+ //}}qixol end
285
+ ?>
286
+ </td>
287
+ <?php endif; ?>
288
+ </tr>
app/design/frontend/base/default/template/qixol/onepage/review.phtml ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php echo $this->getChildHtml('items_before'); ?>
28
+ <div id="checkout-review-table-wrapper">
29
+ <table class="data-table" id="checkout-review-table">
30
+ <?php if ($this->helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
31
+ <col />
32
+ <col width="1" />
33
+ <col width="1" />
34
+ <col width="1" />
35
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
36
+ <col width="1" />
37
+ <col width="1" />
38
+ <?php endif; ?>
39
+ <thead>
40
+ <tr>
41
+ <th rowspan="<?php echo $rowspan ?>"><?php echo $this->__('Product Name') ?></th>
42
+ <th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Price') ?></th>
43
+ <th rowspan="<?php echo $rowspan ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
44
+ <th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Subtotal') ?></th>
45
+ </tr>
46
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
47
+ <tr>
48
+ <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
49
+ <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
50
+ <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
51
+ <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
52
+ </tr>
53
+ <?php endif; ?>
54
+ </thead>
55
+ <?php echo $this->getChildHtml('totals'); ?>
56
+ <tbody>
57
+ <?php foreach($this->getItems() as $_item): ?>
58
+ <?php
59
+ //{{qixol start wrap block
60
+ if ((int)Mage::getStoreConfig('qixol/frontend/onepagejavascr')==0&&($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']>0)){
61
+ $multiple_coeff=((float)$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['quantity']/(float)$_item->getQty());
62
+ $_item->setQty((string)$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['quantity']);
63
+ //$_item->setPrice($_item->getPrice()*$multiple_coeff);
64
+ //$_item->setBasePrice($_item->getBasePrice()*$multiple_coeff);
65
+ //$_item->setPriceInclTax($_item->getPriceInclTax()*$multiple_coeff);
66
+ //$_item->setBasePriceInclTax($_item->getBasePriceInclTax()*$multiple_coeff);
67
+ //$_item->setBasePriceInclTax($_item->getBasePriceInclTax()*$multiple_coeff);
68
+ $_item->setRowTotal($_item->getRowTotal()*$multiple_coeff);
69
+ $_item->setBaseRowTotal($_item->getBaseRowTotal()*$multiple_coeff);
70
+ $_item->setRowTotalInclTax($_item->getRowTotalInclTax()*$multiple_coeff);
71
+ $_item->setBaseRowTotalInclTax($_item->getBaseRowTotalInclTax()*$multiple_coeff);
72
+
73
+
74
+ unset($multiple_coeff);
75
+ }
76
+ //}} qixol
77
+ ?>
78
+ <?php echo $this->getItemHtml($_item)?>
79
+ <?php endforeach ?>
80
+ <?php
81
+ //{{qixol start wrap block
82
+
83
+ if (isset($_SESSION['qixol_quoted_items'])){
84
+ foreach ($_SESSION['qixol_quoted_items']['items'] as $idx_cart=>$item_to_show){
85
+ if ($item_to_show['new']>0&&(int)$item_to_show['data']['isdelivery']==0&&(int)$item_to_show['data']['splitfromlineid']==0){
86
+ if ($productId=Mage::getModel('catalog/product')->getIdBySku((string)$item_to_show['data']['variantcode']!=''?(string)$item_to_show['data']['variantcode']:(string)$item_to_show['data']['productcode'])){
87
+ $productObj = Mage::getModel('catalog/product')->load($productId);
88
+ $quoteItem = Mage::getModel('sales/quote_item')->setStoreId(Mage::app()->getStore()->getId())->setProduct($productObj);
89
+ $quoteItem->setConvertedPrice((string)$item_to_show['data']['price']);
90
+ $quoteItem->setQty((string)$item_to_show['data']['quantity']);
91
+ $quoteItem->setFreeProduct((int)$item_to_show['free_added']);
92
+ $quoteItem->setQuote($this);
93
+ $quoteItem->setId($idx_cart);
94
+ echo $this->getItemHtml($quoteItem);
95
+ }
96
+ }
97
+ }
98
+ if (isset($_SESSION['qixol_quoted_items']['summary'])){
99
+ foreach ($_SESSION['qixol_quoted_items']['summary'] as $inline_cart_promotion)
100
+ if($inline_cart_promotion['data']['basketlevel']>0){
101
+ ?>
102
+ <tr class='promotion_review_inline_box'>
103
+ <td class="product-cart-info" colspan='2'><?php echo $inline_cart_promotion['data']['display_text']."&nbsp;"; ?></td>
104
+ <td class="product-cart-total" colspan='2' style="text-align:right;"><?php
105
+ switch ($inline_cart_promotion['data']['type']){
106
+ case 'DELIVERYREDUCTION';
107
+ echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
108
+ break;
109
+ case 'ISSUEPOINTS';
110
+ echo $inline_cart_promotion['data']['issuedpoints']."&nbsp;pt.";
111
+ break;
112
+ case 'BASKETREDUCTION';
113
+ echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
114
+ break;
115
+ }
116
+ ?></td>
117
+ </tr>
118
+ <?php
119
+ }
120
+ }
121
+ }
122
+ //}} qixol end wrap block
123
+ ?>
124
+ </tbody>
125
+ </table>
126
+ </div>
127
+ <?php echo $this->getChildHtml('items_after'); ?>
128
+ <script type="text/javascript">
129
+ //<![CDATA[
130
+ decorateTable('checkout-review-table');
131
+ truncateOptions();
132
+ //]]>
133
+ </script>
134
+ <div id="checkout-review-submit">
135
+ <?php echo $this->getChildHtml('agreements') ?>
136
+ <div class="buttons-set" id="review-buttons-container">
137
+ <p class="f-left"><?php echo $this->__('Forgot an Item?') ?> <a href="<?php echo $this->getUrl('checkout/cart') ?>"><?php echo $this->__('Edit Your Cart') ?></a></p>
138
+ <?php echo $this->getChildHtml('button') ?>
139
+ <span class="please-wait" id="review-please-wait" style="display:none;">
140
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo Mage::helper('core')->quoteEscape($this->__('Submitting order information...')) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Submitting order information...')) ?>" class="v-middle" /> <?php echo $this->__('Submitting order information...') ?>
141
+ </span>
142
+ </div>
143
+ <script type="text/javascript">
144
+ //<![CDATA[
145
+ review = new Review('<?php echo $this->getUrl('checkout/onepage/saveOrder', array('form_key' => Mage::getSingleton('core/session')->getFormKey())) ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'));
146
+ //]]>
147
+ </script>
148
+ </div>
app/design/frontend/base/default/template/qixol/product/qixol_adv.phtml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (Mage::getStoreConfig('qixol/promo/enabled') == 0) {
3
+ return;
4
+ }
5
+
6
+ $_productCollection=$this->getLoadedProductCollection();
7
+ $qixol_advertisment=Mage::getModel('qixol/advert');
8
+
9
+ // banners - start
10
+
11
+ $qixol_bannerbox_category_top = Mage::getModel('qixol/bannerboxes')->load('CATEGORY_TOP');
12
+ if ($qixol_bannerbox_category_top->getBannerBoxIsActive() > 0) {
13
+ $qixol_top_advertisment_text=$qixol_advertisment->getCategoryTopAdv($_productCollection);
14
+ $qixol_catalog_all_scripts_inside='';
15
+ if (trim($qixol_top_advertisment_text)!=''){
16
+ $qixol_catalog_all_scripts_inside .= '$(".category-title").after("<div id=category_top_ class=\'cycle-slideshow\' ';
17
+ $qixol_catalog_all_scripts_inside .= 'data-cycle-fx=\'';
18
+ $qixol_catalog_all_scripts_inside .= $qixol_bannerbox_category_top->getBannerBoxTranslationType();
19
+ $qixol_catalog_all_scripts_inside .= '\' data-cycle-timeout=\'1500\' data-cycle-slides=\'> div\'>';
20
+ $qixol_catalog_all_scripts_inside .= addslashes(preg_replace("/[\n\r]+/","",$qixol_top_advertisment_text));
21
+ $qixol_catalog_all_scripts_inside .= '</div>");$(\'#category_top_\').cycle();';
22
+ ?>
23
+ <?php
24
+ }
25
+ }
26
+
27
+ // banners - end
28
+
29
+ // stickers - start
30
+
31
+ if (Mage::getStoreConfig('qixol/stickers/showStickersOnCataloguePage') == 0) {
32
+ return;
33
+ }
34
+
35
+ $_helper = $this->helper('catalog/output');
36
+ $style = 'position: absolute; right: 65; top: 0; width: 44px; height: 44px; display: block; z-index: 2;';
37
+ foreach ($_productCollection as $_product) {
38
+ $is_sticker_image = $qixol_advertisment->isSticked($_product);
39
+ //$is_sticker_image = 'http://localhost.magento.com/media/custom/stickers/File-1467816895.png';
40
+
41
+ if ($is_sticker_image !== false) {
42
+ if (is_array($is_sticker_image)) {
43
+ $images_list = '';
44
+ foreach ($is_sticker_image as $image_add) {
45
+ $images_list .= '<div style=\'width: 44px; height: 44px; display: block; z-index: 2; background:url(\"';
46
+ $images_list .= $image_add;
47
+ $images_list .= '\") 0 0 no-repeat;background-size:contain;\'></div>';
48
+ }
49
+ if ($images_list!='') {
50
+ $qixol_catalog_all_scripts_inside .= '$("#product-collection-image-';
51
+ $qixol_catalog_all_scripts_inside .= $_product->getId();
52
+ $qixol_catalog_all_scripts_inside .= '").after("<div style=\'';
53
+ $qixol_catalog_all_scripts_inside .= $style;
54
+ $qixol_catalog_all_scripts_inside .= '\' id=stickers_';
55
+ $qixol_catalog_all_scripts_inside .= $_product->getId();
56
+ $qixol_catalog_all_scripts_inside .= ' class=\'cycle-slideshow\' data-cycle-fx=\'';
57
+ $qixol_catalog_all_scripts_inside .= 'fadeout';
58
+ $qixol_catalog_all_scripts_inside .= '\' data-cycle-timeout=\'555\' data-cycle-slides=\'> div\'>';
59
+ $qixol_catalog_all_scripts_inside .= $images_list;
60
+ $qixol_catalog_all_scripts_inside .= '</div>");$(\'#stickers_';
61
+ $qixol_catalog_all_scripts_inside .= $_product->getId();
62
+ $qixol_catalog_all_scripts_inside .= '\').cycle();';
63
+ }
64
+ } else {
65
+ $qixol_catalog_all_scripts_inside .= '$("#product-collection-image-';
66
+ $qixol_catalog_all_scripts_inside .= $_product->getId();
67
+ $qixol_catalog_all_scripts_inside .= '").after("<div style=\'';
68
+ $qixol_catalog_all_scripts_inside .= $style;
69
+ $qixol_catalog_all_scripts_inside .= 'background:url(\"';
70
+ $qixol_catalog_all_scripts_inside .= $is_sticker_image;
71
+ $qixol_catalog_all_scripts_inside .= '\") 0 0 no-repeat;background-size:contain;\'></div>");';
72
+ }
73
+ }
74
+ }
75
+
76
+ // stickers - end
77
+
78
+ if ($qixol_catalog_all_scripts_inside!=''){
79
+ ?><script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>lib/jquery/jquery-1.10.2.min.js"></script>
80
+ <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>/skin/frontend/base/default/js/lib/jquery.cycle2.min.js"></script>
81
+ <script type="text/javascript">$.noConflict();jQuery( document ).ready(function( $ ) { <?php echo $qixol_catalog_all_scripts_inside;?>});</script><?php
82
+ }
83
+
84
+ ?>
85
+
app/design/frontend/base/default/template/qixol/product/qixol_info_details.phtml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (Mage::getStoreConfig('qixol/promo/enabled') == 0) {
3
+ return;
4
+ }
5
+
6
+ if (Mage::getStoreConfig('qixol/stickers/showPromoBoxOnProductPage') == 0) {
7
+ return;
8
+ }
9
+ ?>
10
+ <?php $_helper = $this->helper('catalog/output'); ?>
11
+ <?php $_product = $this->getProduct(); ?>
12
+ <?php
13
+
14
+ $qixol_product_bottom_box=Mage::getModel('qixol/bannerboxes')->load('PRODUCT_BOTTOM');
15
+ if ($qixol_product_bottom_box->getBannerBoxIsActive()>0){
16
+
17
+ $bottom_advertisment_=Mage::getModel('qixol/advert');
18
+ $bottom_advertisment_text=$bottom_advertisment_->getProductBottmAdv($_product);
19
+
20
+ }
21
+
22
+ if ($bottom_advertisment_text != '') {
23
+ $bottom_advertisment_text = '<div style="display:block;"><div id=product_bottom_ class="cycle-slideshow" data-cycle-fx="';
24
+ $bottom_advertisment_text .= $qixol_product_bottom_box->getBannerBoxTranslationType();
25
+ $bottom_advertisment_text .= '" data-cycle-timeout="1500" data-cycle-slides="> div">';
26
+ $bottom_advertisment_text .= preg_replace("/[\n\r]+/","",$bottom_advertisment_text);
27
+ $bottom_advertisment_text .= '</div></div>';
28
+
29
+ //echo $bottom_advertisment_text;
30
+ ?><script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>lib/jquery/jquery-1.10.2.min.js"></script>
31
+ <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>/skin/frontend/base/default/js/lib/jquery.cycle2.min.js"></script>
32
+ <script type="text/javascript">
33
+ $.noConflict();
34
+ jQuery( document ).ready(function( $ ) {
35
+ $(".add-to-cart").after('<?php echo addslashes($bottom_advertisment_text)?>');
36
+ $('#product_bottom_').cycle();
37
+ });
38
+ </script><?php
39
+ }
40
+
41
+
42
+ ?>
app/design/frontend/base/default/template/qixol/product/qixol_product_info.phtml ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (Mage::getStoreConfig('qixol/promo/enabled') == 0){
3
+ return;
4
+ }
5
+ ?>
6
+ <?php $_helper = $this->helper('catalog/output'); ?>
7
+ <?php $_product = $this->getProduct(); ?>
8
+ <?php
9
+ $qixol_advertisment=Mage::getModel('qixol/advert');
10
+ $qixol_product_all_scripts_inside='';
11
+
12
+ /* BANNER - START */
13
+
14
+ $qixol_product_top_box = Mage::getModel('qixol/bannerboxes')->load('PRODUCT_TOP');
15
+
16
+ //if ($qixol_product_top_box->getBannerBoxIsActive()>0){
17
+ $qixol_top_advertisment_text = $qixol_advertisment->getProductInfoTopAdv($_product);
18
+
19
+ echo "<!-- PRODUCT BANNER: " . $qixol_top_advertisment_text . " -->";
20
+
21
+ if ($qixol_top_advertisment_text!=''){
22
+ $qixol_product_all_scripts_inside .= '$("#messages_product_view").after("<div id=product_top_ class=\'cycle-slideshow\' data-cycle-fx=\'';
23
+ $qixol_product_all_scripts_inside .= $qixol_product_top_box->getBannerBoxTranslationType();
24
+ $qixol_product_all_scripts_inside .= '\' data-cycle-timeout=\'1500\' data-cycle-slides=\'> div\'>';
25
+ $qixol_product_all_scripts_inside .= preg_replace("/[\n\r]+/","",$qixol_top_advertisment_text);
26
+ $qixol_product_all_scripts_inside .= '</div>"); $(\'#product_top_\').cycle();';
27
+ }
28
+ //}
29
+
30
+ $qixol_product_inline_box=Mage::getModel('qixol/bannerboxes')->load('PRODUCT_INLINE');
31
+
32
+ if ($qixol_product_inline_box->getBannerBoxIsActive()>0){
33
+ $qixol_inline_advertisment_text=$qixol_advertisment->getProductInlineAdv($_product);
34
+
35
+ if ($qixol_inline_advertisment_text!=''){
36
+ $qixol_product_all_scripts_inside .= '$(".extra-info").after("<div=\'product_inline\' style=\'float: left;width: 100%;\' id=product_inline_ class=\'cycle-slideshow\' data-cycle-fx=\''.$qixol_product_inline_box->getBannerBoxTranslationType().'\' data-cycle-timeout=\'1500\' data-cycle-slides=\'> div\'>'.addslashes($qixol_inline_advertisment_text).'</div>");$(\'#product_inline_\').cycle();';
37
+ }
38
+ }
39
+
40
+ /* BANNER - END */
41
+
42
+ /* Promotion box on product page - START */
43
+
44
+ if (Mage::getStoreConfig('qixol/stickers/showPromoBoxOnProductPage')>0){
45
+ $qixol_all_promotions_text = $qixol_advertisment->getAllProductAdv($_product);
46
+ if ($qixol_all_promotions_text!=''){
47
+ // $qixol_product_all_scripts_inside .= '$(".add-to-box").after("<div id=product_advertisment_ class=\'cycle-slideshow\' data-cycle-fx=\'scrollHorz\' data-cycle-timeout=\'1500\' data-cycle-slides=\'> div\'>'.preg_replace("/[\n\r]+/","",$qixol_all_promotions_text).'</div>"); $(\'#product_advertisment_\').cycle();';
48
+ $qixol_product_all_scripts_inside .= '$(".add-to-cart").before("<div class=\'product_all_promotions\'><table style=\'width:100%\'><th>Offers</th>';
49
+ $qixol_product_all_scripts_inside .= '<th style=\'width:100px;\'>You Save</th>';
50
+ $qixol_product_all_scripts_inside .= preg_replace("/[\n\r]+/","",$qixol_all_promotions_text);
51
+ $qixol_product_all_scripts_inside .= '</div></table>");';
52
+ }
53
+ }
54
+
55
+ /* Promotion box on product page - END */
56
+
57
+ /* STICKERS - START */
58
+
59
+ if (Mage::getStoreConfig('qixol/stickers/showStickersOnProductPage')>0) {
60
+
61
+ $is_sticker_image = $qixol_advertisment->isSticked($_product);
62
+
63
+ // $is_sticker_image = [
64
+ // 1 => 'http://localhost.magento.com/media/custom/stickers/File-1467816895.png',
65
+ // 2 => 'http://localhost.magento.com/media/custom/stickers/bogof.png'];
66
+
67
+ // $is_sticker_image = 'http://localhost.magento.com/media/custom/stickers/File-1467816895.png';
68
+ // $is_sticker_image = 'http://localhost.magento.com/media/custom/stickers/bogof.png';
69
+
70
+ // TODO: move this into css as a class
71
+ $style = 'position: absolute; right: 65; top: 0; width: 100px; height: 100px; display: block; z-index: 2;';
72
+ if ($is_sticker_image !== false){
73
+ if (is_array($is_sticker_image)){
74
+ $images_list='';
75
+ foreach ($is_sticker_image as $image_add){
76
+ $images_list.='<div style=\''.$style.' background:url(\"'.$image_add.'\") 0 0 no-repeat;background-size:contain;\'></div>';
77
+ }
78
+ if ($images_list!='')
79
+ $qixol_product_all_scripts_inside.='$(".product-image-gallery").after("<div id=stickers_ ';
80
+ $qixol_product_all_scripts_inside.=' style=\''.$style.'\'';
81
+ $qixol_product_all_scripts_inside.=' class=\'cycle-slideshow\' ';
82
+ //$qixol_product_all_scripts_inside.='data-cycle-fx=\''.$qixol_bannerbox_product_stickers->getBannerBoxTranslationType().'\' ";';
83
+ $qixol_product_all_scripts_inside.='data-cycle-fx=\''.'fadeout'.'\' ';
84
+ $qixol_product_all_scripts_inside.='data-cycle-timeout=\'555\' data-cycle-slides=\'> div\'>';
85
+ $qixol_product_all_scripts_inside.=$images_list;
86
+ $qixol_product_all_scripts_inside.='</div>");$(\'#stickers_\').cycle();';
87
+
88
+ } else {
89
+ $qixol_product_all_scripts_inside.='$(".product-image-gallery").after("<div style=\''.$style.' background:url(\"'.$is_sticker_image.'\") 0 0 no-repeat;\'></div>");';
90
+ }
91
+
92
+ }
93
+ }
94
+
95
+ /* STICKERS - END */
96
+
97
+ if ($qixol_product_all_scripts_inside!=''){
98
+ ?><script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>lib/jquery/jquery-1.10.2.min.js"></script><script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>/skin/frontend/base/default/js/lib/jquery.cycle2.min.js"></script><script type="text/javascript">$.noConflict();jQuery( document ).ready(function( $ ) { <?php echo $qixol_product_all_scripts_inside;?>});</script><?php
99
+ }
app/design/frontend/base/default/template/qixol/sidebar/advert.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //$place_box_in_design_after_pattern=Mage::getStoreConfig('qixol/integraion/boxcartpromotion')
3
+ $place_box_in_design_after_pattern='.cart';
4
+
5
+ $inline_cart_advert='';
6
+
7
+ //for cart items
8
+ $cart = Mage::getModel('checkout/cart')->getQuote();
9
+ foreach ($cart->getAllItems() as $item) {
10
+ if (isset($_SESSION['qixol_quoted_items'])&&isset($_SESSION['qixol_quoted_items']['items'][$item->getId()])){
11
+ if (isset($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions']))
12
+ foreach ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'] as $promotion){
13
+ //inline level promotion
14
+ if ((int)$promotion['basketlevel']==0&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]))
15
+ $inline_cart_advert.="
16
+ $('<div class=\"cart_inline_item_promo\">".addslashes($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display_text'])."</div>').appendTo($('#qixol_idx_cart_item_name_".$item->getId()."'));
17
+ ";
18
+ }
19
+
20
+ //if quantity changed (get one + one free so will be splited to 2 products with 1 free)
21
+ if ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_qty']>0)
22
+ $inline_cart_advert.="
23
+ $('<div class=\"cart_inline_item_new_qty\">For&nbsp;promo&nbsp;".addslashes($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['quantity'])."&nbsp;Qty</div>').appendTo($('#qixol_idx_cart_item_qty_".$item->getId()."'));
24
+ ";
25
+
26
+ if ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_price']>0)
27
+ $inline_cart_advert.="
28
+ $('<div class=\"cart_inline_item_new_price\">Only for - 9 ".addslashes($this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['lineamount']))."</div>').appendTo($('#qixol_idx_cart_item_price_".$item->getId()."'));
29
+ ";
30
+
31
+ }
32
+ }
33
+ $total_discount_amount=0;
34
+ if (isset($_SESSION['qixol_quoted_items']['items'])){
35
+ foreach ($_SESSION['qixol_quoted_items']['items'] as $cart_item_process){
36
+ if ($cart_item_process['data']['totaldiscount']>0){
37
+ $total_discount_amount+=$cart_item_process['data']['totaldiscount'];
38
+ }
39
+ }
40
+ }
app/design/frontend/base/default/template/qixol/sidebar/default.phtml ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ $_item = $this->getItem();
29
+ $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
30
+ $canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
31
+ ?>
32
+ <li class="item">
33
+ <?php if ($this->hasProductUrl()): ?>
34
+ <a href="<?php echo $this->getProductUrl()?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></a>
35
+ <?php else: ?>
36
+ <span class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></span>
37
+ <?php endif; ?>
38
+ <div class="product-details">
39
+ <a href="<?php echo $this->getDeleteUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Remove This Item')) ?>" onclick="return confirm('<?php echo Mage::helper('core')->quoteEscape($this->__('Are you sure you would like to remove this item from the shopping cart?'), true) ?>');" class="btn-remove"><?php echo $this->__('Remove This Item') ?></a>
40
+ <?php if ($isVisibleProduct): ?>
41
+ <a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Edit item')) ?>" class="btn-edit"><?php echo $this->__('Edit item')?></a>
42
+ <?php endif ?>
43
+ <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>
44
+ <strong><?php echo $this->getQty() ?></strong> x
45
+
46
+ <?php if ($canApplyMsrp): ?>
47
+
48
+ <span class="map-cart-sidebar-item"><?php echo $this->__('See price before order confirmation.'); ?></span>
49
+
50
+ <?php else: ?>
51
+
52
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
53
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
54
+ <?php echo $this->__('Excl. Tax'); ?>:
55
+ <?php endif; ?>
56
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
57
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
58
+ <?php else: ?>
59
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
60
+ <?php endif; ?>
61
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
62
+ <br />
63
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
64
+ <small>
65
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
66
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
67
+ <?php endforeach; ?>
68
+ </small>
69
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
70
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
71
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
72
+ <?php endforeach; ?>
73
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
74
+ <small>
75
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
76
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
77
+ <?php endforeach; ?>
78
+ </small>
79
+ <?php endif; ?>
80
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
81
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
82
+ <?php endif; ?>
83
+ <?php endif; ?>
84
+ <?php endif; ?>
85
+
86
+
87
+
88
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
89
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
90
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
91
+ <br /><?php echo $this->__('Incl. Tax'); ?>:
92
+ <?php endif; ?>
93
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
94
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
95
+ <?php else: ?>
96
+ <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
97
+ <?php endif; ?>
98
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
99
+ <br />
100
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
101
+ <small>
102
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
103
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
104
+ <?php endforeach; ?>
105
+ </small>
106
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
107
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
108
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
109
+ <?php endforeach; ?>
110
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
111
+ <small>
112
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
113
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
114
+ <?php endforeach; ?>
115
+ </small>
116
+ <?php endif; ?>
117
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
118
+ <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>
119
+ <?php endif; ?>
120
+ <?php endif; ?>
121
+ <?php endif; ?>
122
+
123
+ <?php endif; //Can apply MSRP ?>
124
+
125
+ <?php if ($_options = $this->getOptionList()):?>
126
+ <div class="truncated">
127
+ <div class="truncated_full_value">
128
+ <dl class="item-options">
129
+ <?php foreach ($_options as $_option) : ?>
130
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
131
+ <dd>
132
+ <?php if (is_array($_option['value'])): ?>
133
+ <?php echo nl2br(implode("\n", $_option['value'])) ?>
134
+ <?php else: ?>
135
+ <?php echo $_option['value'] ?>
136
+ <?php endif; ?>
137
+ </dd>
138
+ <?php endforeach; ?>
139
+ </dl>
140
+ </div>
141
+ <a href="#" onclick="return false;" class="details"><?php echo $this->__('Details') ?></a>
142
+ </div>
143
+ <?php endif; ?>
144
+ </div>
145
+ </li>
app/design/frontend/base/default/template/qixol/sidebar/sidebar.phtml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Shoping cart sidebar
29
+ *
30
+ * @see Mage_Checkout_Block_Cart_Sidebar
31
+ */
32
+
33
+ ?>
34
+ <?php if ($this->getIsNeedToDisplaySideBar()):?>
35
+ <div class="block block-cart">
36
+ <?php $_cartQty = $this->getSummaryCount() ?>
37
+ <div class="block-title">
38
+ <strong><span><?php echo $this->__('My Cart') ?></span></strong>
39
+ </div>
40
+ <div class="block-content">
41
+ <?php if ($_cartQty>0): ?>
42
+ <div class="summary">
43
+ <?php if ($_cartQty==1): ?>
44
+ <p class="amount"><?php echo $this->__('There is <a href="%s">1 item</a> in your cart.', $this->getUrl('checkout/cart')) ?></p>
45
+ <?php else: ?>
46
+ <p class="amount"><?php echo $this->__('There are <a href="%s">%s items</a> in your cart.', $this->getUrl('checkout/cart'), $_cartQty) ?></p>
47
+ <?php endif ?>
48
+ <p class="subtotal">
49
+ <?php if ($this->canApplyMsrp()): ?>
50
+ <span class="map-cart-sidebar-total"><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></span>
51
+ <?php else: ?>
52
+ <span class="label"><?php echo $this->__('Cart Subtotal:') ?></span> <?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?>
53
+ <?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
54
+ <br />(<?php echo Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper('tax')->getIncExcText(true) ?>)
55
+ <?php endif; ?>
56
+ <?php endif; ?>
57
+ </p>
58
+ </div>
59
+ <?php endif ?>
60
+ <?php if($_cartQty && $this->isPossibleOnepageCheckout()): ?>
61
+ <div class="actions">
62
+ <?php echo $this->getChildHtml('extra_actions') ?>
63
+ <button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Checkout')) ?>" class="button" onclick="setLocation('<?php echo $this->getCheckoutUrl() ?>')"><span><span><?php echo $this->__('Checkout') ?></span></span></button>
64
+ </div>
65
+ <?php endif ?>
66
+ <?php $_items = $this->getRecentItems() ?>
67
+ <?php if(count($_items)): ?>
68
+ <p class="block-subtitle"><?php echo $this->__('Recently added item(s)') ?></p>
69
+ <ol id="cart-sidebar" class="mini-products-list">
70
+ <?php foreach($_items as $_item): ?>
71
+ <?php echo $this->getItemHtml($_item) ?>
72
+ <?php endforeach; ?>
73
+ </ol>
74
+ <script type="text/javascript">decorateList('cart-sidebar', 'none-recursive')</script>
75
+ <?php else: ?>
76
+ <p class="empty"><?php echo $this->__('You have no items in your shopping cart.') ?></p>
77
+ <?php endif ?>
78
+ </div>
79
+ </div>
80
+ <?php endif;?>
app/design/frontend/rwd/default/template/qixol/minicart/advert.phtml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ moved to mincart
4
+ //$place_box_in_design_after_pattern=Mage::getStoreConfig('qixol/integraion/boxcartpromotion')
5
+ $place_box_in_design_after_pattern='.cart';
6
+
7
+ /*
8
+ $inline_cart_advert='';
9
+
10
+ //for cart items
11
+ $cart = Mage::getModel('checkout/cart')->getQuote();
12
+ foreach ($cart->getAllItems() as $item) {
13
+ if (isset($_SESSION['qixol_quoted_items'])&&isset($_SESSION['qixol_quoted_items']['items'][$item->getId()])){
14
+ if (isset($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions']))
15
+ foreach ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'] as $promotion){
16
+ //inline level promotion
17
+ if ((int)$promotion['basketlevel']==0&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]))
18
+ $inline_cart_advert.="
19
+ $('<div class=\"cart_inline_item_promo\">".addslashes($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display_text'])."</div>').appendTo($('#qixol_idx_mcart_item_name_".$item->getId()."'));
20
+ ";
21
+ //basket level promotion
22
+ if ((int)$promotion['basketlevel']==1&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]))
23
+ $text_to_show_cart_adv.='';//should be also added??? $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['display_text'];
24
+
25
+ }
26
+
27
+ //if quantity changed (get one + one free so will be splited to 2 products with 1 free)
28
+ if ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_qty']>0)
29
+ $inline_cart_advert.="
30
+ $('<div class=\"cart_inline_item_new_qty\">For&nbsp;promo&nbsp;".addslashes($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['quantity'])."&nbsp;Qty</div>').appendTo($('#qixol_idx_mcart_item_qty_".$item->getId()."'));
31
+ ";
32
+
33
+ if ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_price']>0)
34
+ $inline_cart_advert.="
35
+ $('<div class=\"cart_inline_item_new_price\">Only for ".addslashes($this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['lineamount']))."</div>').appendTo($('#qixol_idx_mcart_item_price_".$item->getId()."'));
36
+ ";
37
+
38
+ }
39
+ }
40
+ $total_discount_amount=0;
41
+ if (isset($_SESSION['qixol_quoted_items']['items'])){
42
+ foreach ($_SESSION['qixol_quoted_items']['items'] as $cart_item_process){
43
+ if ($cart_item_process['data']['totaldiscount']>0&&(int)$cart_item_process['new']==0){
44
+ $total_discount_amount+=$cart_item_process['data']['totaldiscount'];
45
+ }
46
+ }
47
+ }
48
+
49
+ if ($text_to_show_cart_adv!==false&&strlen($text_to_show_cart_adv)>5||$inline_cart_advert!=''){
50
+ ?><script type="text/javascript" src="/js/lib/jquery/jquery-1.10.2.min.js"></script><script type="text/javascript">$.noConflict();jQuery( document ).ready(function( $ ) { <?php
51
+ /*if ($text_to_show_cart_adv!==false&&strlen($text_to_show_cart_adv)>5)
52
+ echo '$("'.$place_box_in_design_after_pattern.'").after("<div class=\'qixolcartpromo\'>'.$text_to_show_cart_adv.'</div>");';*//*
53
+ if ($inline_cart_advert!='')
54
+ echo preg_replace("/[\n\r]+/","",$inline_cart_advert);
55
+ if ($total_discount_amount>0){
56
+ /*?>$('<tr class="qixol_discount"><td class="a-right" colspan="1" > Discount</td><td class="a-right" ><span class="qixol_total_price"><?php echo $this->helper('checkout')->formatPrice($total_discount_amount);; ?></span></td></tr>').appendTo($('#shopping-cart-totals-table tbody'));<?php*//*
57
+ ?>$('#header-cart .subtotal .price').addClass('qixol_price_cross');$('<?php echo $this->helper('checkout')->formatPrice($cart->getGrandTotal()-$total_discount_amount); ?>').appendTo($('#header-cart .subtotal .price').parent());<?php
58
+ }
59
+ ?>});</script><?php
60
+ }*/
61
+ ?>
app/design/frontend/rwd/default/template/qixol/minicart/default.phtml ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 rwd_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ $_item = $this->getItem();
29
+ $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
30
+ $canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
31
+ ?>
32
+ <?php /* {{ qixol should be added id */ ?>
33
+ <li class="item" xmlns="http://www.w3.org/1999/html" id='qixol_idx_mcart_item_<?php echo $_item->getId(); ?>'>
34
+ <?php if ($this->hasProductUrl()): ?>
35
+ <a href="<?php echo $this->getProductUrl()?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></a>
36
+ <?php else: ?>
37
+ <span class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></span>
38
+ <?php endif; ?>
39
+ <div class="product-details">
40
+ <?php /* qixol should be added id */ ?>
41
+ <p class="product-name" id='qixol_idx_mcart_item_name_<?php echo $_item->getId(); ?>'><?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;
42
+ /* qixol {{ */
43
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&Mage::getStoreConfig('qixol/advanced/services')!='dontdisplay'):
44
+ foreach ($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['promotions'] as $promotion){
45
+ //inline level promotion
46
+ $is_generated=($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']>0?$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']:$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']);
47
+ if (((int)$promotion['basketlevel']==0||$is_generated>0)&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displaytext'){
48
+ ?><div class="cart_inline_item_promo"><?php echo $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display_text']; ?></div><?php
49
+ }elseif(((int)$promotion['basketlevel']==0||$is_generated>0)&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displayname'){
50
+ ?><div class="cart_inline_item_promo"><?php echo $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['name']; ?></div><?php
51
+ }elseif(((int)$promotion['basketlevel']==0||$is_generated>0)&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displaytype'){
52
+ ?><div class="cart_inline_item_promo"><?php echo $_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display']; ?></div><?php
53
+ }
54
+
55
+ }
56
+ endif;
57
+ /* }} end qixol */ ?></p>
58
+
59
+
60
+ <table class="info-wrapper">
61
+ <tbody>
62
+ <tr>
63
+ <th><?php echo $this->__('Price'); ?></th>
64
+ <td id='qixol_idx_mcart_item_price_<?php echo $_item->getId(); ?>'>
65
+ <?php if ($canApplyMsrp): ?>
66
+
67
+ <span class="map-cart-sidebar-item"><?php echo $this->__('See price before order confirmation.'); ?></span>
68
+
69
+ <?php else: ?>
70
+
71
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
72
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
73
+ <?php echo $this->__('Excl. Tax'); ?>:
74
+ <?php endif; ?>
75
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
76
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
77
+ <?php else: ?>
78
+ <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
79
+ <?php endif; ?>
80
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
81
+ <br />
82
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
83
+ <small>
84
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
85
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
86
+ <?php endforeach; ?>
87
+ </small>
88
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
89
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
90
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
91
+ <?php endforeach; ?>
92
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
93
+ <small>
94
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
95
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
96
+ <?php endforeach; ?>
97
+ </small>
98
+ <?php endif; ?>
99
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
100
+ <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
101
+ <?php endif; ?>
102
+ <?php endif; ?>
103
+ <?php endif; ?>
104
+
105
+
106
+
107
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
108
+ <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
109
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
110
+ <br /><?php echo $this->__('Incl. Tax'); ?>:
111
+ <?php endif; ?>
112
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
113
+ <?php echo $this->helper('checkout')->formatPrice($_incl + Mage::helper('weee')->getWeeeTaxInclTax($_item)); ?>
114
+ <?php else: ?>
115
+ <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
116
+ <?php endif; ?>
117
+ <?php if (Mage::helper('weee')->getApplied($_item)): ?>
118
+ <br />
119
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
120
+ <small>
121
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
122
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
123
+ <?php endforeach; ?>
124
+ </small>
125
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
126
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
127
+ <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span>
128
+ <?php endforeach; ?>
129
+ <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
130
+ <small>
131
+ <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
132
+ <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
133
+ <?php endforeach; ?>
134
+ </small>
135
+ <?php endif; ?>
136
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
137
+ <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>
138
+ <?php endif; ?>
139
+ <?php endif; ?>
140
+ <?php endif; ?>
141
+
142
+ <?php endif; //Can apply MSRP ?>
143
+ <?php
144
+ //{{qixol
145
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['updated_price']>0){
146
+ ?><div class="cart_inline_item_new_price">Only for - 10 <?php echo $this->helper('checkout')->formatPrice(($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalamount']-$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['totaldiscount'])/$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalquantity']);?></div><?php
147
+ }
148
+ //}}qixol end
149
+ ?>
150
+ </td>
151
+ </tr>
152
+ <tr class="qty-wrapper">
153
+ <th><?php echo $this->__('Qty'); ?></th>
154
+
155
+ <?php /* qixol should be added id */ ?>
156
+ <td id='qixol_idx_mcart_item_qty_<?php echo $_item->getId(); ?>'>
157
+ <?php /*if ($_item->getFreeProduct()>0): ?>
158
+ <div class="cart_inline_item_promo"><?php echo $this->__('free item'); ?></div>
159
+ <?php else :*/ ?>
160
+ <?php /* end qixol add */ ?>
161
+ <input
162
+ id="qinput-<?php echo $_item->getId(); ?>"
163
+ data-link="<?php echo $this->getAjaxUpdateUrl() ?>"
164
+ data-item-id="<?php echo $_item->getId(); ?>"
165
+ data-cart-item-id="<?php echo $_item->getSku(); ?>"
166
+ class="qty cart-item-quantity input-text" name=""
167
+ value="<?php echo $this->getQty()?>"
168
+ <?php if ($this->isOnCheckoutPage()) echo 'disabled'; ?>
169
+ />
170
+
171
+ <button id="qbutton-<?php echo $_item->getId(); ?>"
172
+ data-item-id="<?php echo $_item->getId(); ?>"
173
+ disabled="disabled"
174
+ data-update
175
+ data-cart-item-update
176
+ class="button quantity-button">
177
+ <?php echo $this->__('ok'); ?>
178
+ </button>
179
+ <?php
180
+ //{{qixol
181
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['updated_price']>0)){
182
+ ?><div class="cart_inline_item_new_price">Only for - 11 <?php echo $this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalamount']-$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['totaldiscount']); ?></div><?php
183
+ }
184
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['new']>0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']>0){
185
+ ?><div class="cart_inline_item_new_price"><?php echo $this->__('Discount: -').$this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalprice']); ?></div><?php
186
+ }else if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']>0)){
187
+ ?><div class="cart_inline_item_new_price"><?php echo $this->__('Discount: -').$this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalprice']*$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']); ?></div><?php
188
+ }
189
+ //}}qixol end
190
+ ?>
191
+ <?php /* qixol add */ ?>
192
+ <?php //endif ?>
193
+ <?php /* end qixol add */ ?>
194
+ </td>
195
+ </tr>
196
+ </tbody>
197
+ </table>
198
+
199
+ <?php if ($isVisibleProduct&&($_item->getFreeProduct()==0)): ?>
200
+ <?php
201
+ //{{qixol
202
+ if ($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']==0&&$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']==0):
203
+ //}}qixol
204
+ ?>
205
+ <a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Edit item')) ?>" class="btn-edit">
206
+ <?php echo $this->__('Edit item')?>
207
+ </a>
208
+ |
209
+ <?php
210
+ //{{qixol
211
+ endif;
212
+ //}}qixol
213
+ ?>
214
+ <?php
215
+ //{{qixol
216
+ if ($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['generated']==0||$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['originalquantity']!=$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['quantity']):
217
+ //}}qixol
218
+ ?>
219
+ <?php if (!$this->isOnCheckoutPage()): ?>
220
+ <a href="<?php echo $this->getAjaxDeleteUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Remove This Item')) ?>"
221
+ data-confirm="<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>"
222
+ class="remove">
223
+ <?php echo $this->__('Remove Item') ?>
224
+ </a>
225
+ <?php else: ?>
226
+ <span><?php echo $this->__('Remove Item') ?></span>
227
+ <?php endif; ?>
228
+ <?php
229
+ //{{qixol
230
+ endif;
231
+ //}}qixol
232
+ ?>
233
+ <?php endif ?>
234
+
235
+
236
+
237
+ <?php if ($_options = $this->getOptionList()):?>
238
+ <div class="truncated">
239
+ <div class="truncated_full_value">
240
+ <dl class="item-options">
241
+ <?php foreach ($_options as $_option) : ?>
242
+ <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
243
+ <dd>
244
+ <?php if (is_array($_option['value'])): ?>
245
+ <?php echo nl2br(implode("\n", $_option['value'])) ?>
246
+ <?php else: ?>
247
+ <?php echo $_option['value'] ?>
248
+ <?php endif; ?>
249
+ </dd>
250
+ <?php endforeach; ?>
251
+ </dl>
252
+ </div>
253
+ <a href="#" onclick="return false;" class="details"><?php echo $this->__('Details') ?></a>
254
+ </div>
255
+ <?php endif; ?>
256
+
257
+ </div>
258
+ </li>
app/design/frontend/rwd/default/template/qixol/minicart/mincart.phtml ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 rwd_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Shoping cart sidebar
29
+ *
30
+ * @var Mage_Checkout_Block_Cart_Minicart $this
31
+ */
32
+ ?>
33
+ <?php
34
+ $_cartQty = $this->getSummaryCount();
35
+ if(empty($_cartQty)) {
36
+ $_cartQty = 0;
37
+ }
38
+ ?>
39
+ <div id="minicart-error-message" class="minicart-message"></div>
40
+ <div id="minicart-success-message" class="minicart-message"></div>
41
+
42
+ <div class="minicart-wrapper">
43
+
44
+ <p class="block-subtitle">
45
+ <?php echo $this->__('Recently added item(s)') ?>
46
+ <a class="close skip-link-close" href="#" title="<?php echo $this->quoteEscape($this->__('Close')); ?>">&times;</a>
47
+ </p>
48
+
49
+ <?php $_items = $this->getRecentItems() ?>
50
+ <?php $countItems = count($_items); ?>
51
+ <?php if($countItems): ?>
52
+ <div>
53
+ <ul id="cart-sidebar" class="mini-products-list">
54
+ <?php foreach($_items as $_item): ?>
55
+ <?php
56
+ //{{qixol start wrap block
57
+ // KEN START COMMENT
58
+ //if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')==0&&($_SESSION['qixol_quoted_items']['items'][$_item->getId()]['free_added']>0)){
59
+ // $multiple_coeff=((float)$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['quantity']/(float)$_item->getQty());
60
+ // $_item->setQty((string)$_SESSION['qixol_quoted_items']['items'][$_item->getId()]['data']['quantity']);
61
+ // //$_item->setPrice($_item->getPrice()*$multiple_coeff);
62
+ // //$_item->setBasePrice($_item->getBasePrice()*$multiple_coeff);
63
+ // //$_item->setPriceInclTax($_item->getPriceInclTax()*$multiple_coeff);
64
+ // //$_item->setBasePriceInclTax($_item->getBasePriceInclTax()*$multiple_coeff);
65
+ // //$_item->setBasePriceInclTax($_item->getBasePriceInclTax()*$multiple_coeff);
66
+ // $_item->setRowTotal($_item->getRowTotal()*$multiple_coeff);
67
+ // $_item->setBaseRowTotal($_item->getBaseRowTotal()*$multiple_coeff);
68
+ // $_item->setRowTotalInclTax($_item->getRowTotalInclTax()*$multiple_coeff);
69
+ // $_item->setBaseRowTotalInclTax($_item->getBaseRowTotalInclTax()*$multiple_coeff);
70
+ //
71
+ //
72
+ // unset($multiple_coeff);
73
+ //}
74
+ //// }} qixol
75
+ // KEN END COMMENT
76
+ ?>
77
+ <?php echo $this->getItemHtml($_item) ?>
78
+ <?php endforeach; ?>
79
+ <?php
80
+ // KEN START COMMENT
81
+ ////{{qixol start wrap block
82
+ //
83
+ //if (isset($_SESSION['qixol_quoted_items'])){
84
+ //foreach ($_SESSION['qixol_quoted_items']['items'] as $idx_cart=>$item_to_show){
85
+ // if ($item_to_show['new']>0&&(int)$item_to_show['data']['isdelivery']==0&&(int)$item_to_show['data']['splitfromlineid']==0){
86
+ // if ($productId=Mage::getModel('catalog/product')->getIdBySku((string)$item_to_show['data']['variantcode']!=''?(string)$item_to_show['data']['variantcode']:(string)$item_to_show['data']['productcode'])){
87
+ // $productObj = Mage::getModel('catalog/product')->load($productId);
88
+ // $quoteItem = Mage::getModel('sales/quote_item')->setStoreId(Mage::app()->getStore()->getId())->setProduct($productObj);
89
+ // $quoteItem->setConvertedPrice((string)$item_to_show['data']['price']);
90
+ // $quoteItem->setQty((string)$item_to_show['data']['quantity']);
91
+ // $quoteItem->setFreeProduct((int)$item_to_show['free_added']);
92
+ // $quoteItem->setQuote($this);
93
+ // $quoteItem->setId($idx_cart);
94
+ // echo $this->getItemHtml($quoteItem);
95
+ // }
96
+ // }
97
+ //}
98
+ //if (isset($_SESSION['qixol_quoted_items']['summary'])){
99
+ //foreach ($_SESSION['qixol_quoted_items']['summary'] as $inline_cart_promotion)
100
+ // if($inline_cart_promotion['data']['basketlevel']>0){
101
+ // KEN - COMMENT CONTINUES INTO HTML
102
+ ?>
103
+ <!--
104
+ <li class="item odd" xmlns="http://www.w3.org/1999/html">
105
+ <div class="promotion_cart_inline_box" ><?php //echo $inline_cart_promotion['data']['display_text'] ?>&nbsp;&nbsp;:&nbsp;&nbsp;<?php
106
+ //switch ($inline_cart_promotion['data']['type']){
107
+ //case 'DELIVERYREDUCTION';
108
+ // echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
109
+ //break;
110
+ //case 'ISSUEPOINTS';
111
+ // echo $inline_cart_promotion['data']['issuedpoints']."&nbsp;pt.";
112
+ //break;
113
+ //case 'BASKETREDUCTION';
114
+ // echo $this->helper('checkout')->formatPrice($inline_cart_promotion['data']['discountamount']);
115
+ //break;
116
+ //}
117
+ ?></div>
118
+ </li>-->
119
+ <?
120
+ // }
121
+ //}
122
+ //}
123
+ ////}} qixol end wrap block
124
+ ?>
125
+ </ul>
126
+ </div>
127
+ <script type="text/javascript">
128
+ truncateOptions();
129
+ decorateList('cart-sidebar', 'none-recursive');
130
+ $j('document').ready(function() {
131
+ var minicartOptions = {
132
+ formKey: "<?php echo $this->getFormKey();?>"
133
+ }
134
+ var Mini = new Minicart(minicartOptions);
135
+ Mini.init();
136
+ });
137
+ </script>
138
+
139
+ <div id="minicart-widgets">
140
+ <?php echo $this->getChildHtml('cart_promotion') ?>
141
+ </div>
142
+ <div class="block-content">
143
+ <p class="subtotal">
144
+ <?php if ($this->canApplyMsrp()): ?>
145
+ <span class="map-cart-sidebar-total"><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></span>
146
+ <?php else: ?>
147
+ <span class="label"><?php echo $this->__('Cart Subtotal:') ?></span> <?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?>
148
+ <?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
149
+ <br />(<?php echo Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper('tax')->getIncExcText(true) ?>)
150
+ <?php endif; ?>
151
+ <?php endif; ?>
152
+ </p>
153
+ </div>
154
+
155
+
156
+ <div class="minicart-actions">
157
+ <?php if($_cartQty && $this->isPossibleOnepageCheckout()): ?>
158
+ <ul class="checkout-types minicart">
159
+ <?php echo $this->getChildHtml('extra_actions') ?>
160
+ <li>
161
+ <a title="<?php echo $this->quoteEscape($this->__('Checkout')) ?>" class="button checkout-button" href="<?php echo $this->getCheckoutUrl() ?>">
162
+ <?php echo $this->__('Checkout') ?>
163
+ </a>
164
+ </li>
165
+ </ul>
166
+ <?php endif ?>
167
+ <a class="cart-link" href="<?php echo $this->getUrl('checkout/cart'); ?>">
168
+ <?php echo $this->__('View Shopping Cart'); ?>
169
+ </a>
170
+ </div>
171
+
172
+ <?php else: ?>
173
+ <p class="empty"><?php echo $this->__('You have no items in your shopping cart.') ?></p>
174
+
175
+ <?php endif ?>
176
+ </div>
177
+ <!-- // qixol //-->
178
+ <?php
179
+ //$place_box_in_design_after_pattern=Mage::getStoreConfig('qixol/integraion/boxcartpromotion')
180
+ $place_box_in_design_after_pattern='.cart';
181
+
182
+ $inline_cart_advert='';
183
+
184
+ //for cart items
185
+ $cart = Mage::getModel('checkout/cart')->getQuote();
186
+ foreach ($cart->getAllItems() as $item) {
187
+ if (isset($_SESSION['qixol_quoted_items'])&&isset($_SESSION['qixol_quoted_items']['items'][$item->getId()])){
188
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')>0 && Mage::getStoreConfig('qixol/advanced/services')!='dontdisplay' &&
189
+ isset($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions']))
190
+ foreach ($_SESSION['qixol_quoted_items']['items'][$item->getId()]['promotions'] as $promotion){
191
+
192
+ //inline level promotion
193
+ if ((int)$promotion['basketlevel']==0&&isset($_SESSION['qixol_quoted_items']['summary'][$promotion['id']])&&Mage::getStoreConfig('qixol/advanced/services')=='displayname'){
194
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_promo\">".addslashes($_SESSION['qixol_quoted_items']['summary'][$promotion['id']]['data']['display_text'])."</div>').appendTo($('#qixol_idx_cart_item_name_".$item->getId()."'));";
195
+ } elseif((int)$promotion['basketlevel']==0&&(Mage::getStoreConfig('qixol/advanced/services')=='displaytext'||Mage::getStoreConfig('qixol/advanced/services')=='displaytype')) {
196
+ if ($cart_promotion_data=Mage::getModel('qixol/promotions')->load($promotion['id'])){
197
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_promo\">".addslashes(Mage::getStoreConfig('qixol/advanced/services')=='displaytype'?$cart_promotion_data->getPromotionType():$cart_promotion_data->getPromotionText())."</div>').appendTo($('#qixol_idx_cart_item_name_".$item->getId()."'));";
198
+ }
199
+ }
200
+
201
+ //if quantity changed (get one + one free so will be splited to 2 products with 1 free)
202
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')>0&&$_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_qty']>0)
203
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_new_qty\">For&nbsp;promo&nbsp;".addslashes($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['quantity'])."&nbsp;Qty</div>').appendTo($('#qixol_idx_mcart_item_qty_".$item->getId()."'));";
204
+
205
+ if ((int)Mage::getStoreConfig('qixol/frontend/mcartjavascr')>0&&$_SESSION['qixol_quoted_items']['items'][$item->getId()]['updated_price']>0)
206
+ $inline_cart_advert.="$('<div class=\"cart_inline_item_new_price\">Only for - 12 ".addslashes($this->helper('checkout')->formatPrice($_SESSION['qixol_quoted_items']['items'][$item->getId()]['data']['lineamount']))."</div>').appendTo($('#qixol_idx_mcart_item_price_".$item->getId()."'));";
207
+
208
+ }
209
+ }
210
+ $total_discount_amount=0;
211
+ if (isset($_SESSION['qixol_quoted_items']['items'])){
212
+ foreach ($_SESSION['qixol_quoted_items']['items'] as $cart_item_process){
213
+ if ($cart_item_process['data']['totaldiscount']>0&&$cart_item_process['new']==0&&((int)Mage::getStoreConfig('qixol/advanced/separateitem')>0||$cart_item_process['data']['generated']==false)){
214
+ $total_discount_amount+=$cart_item_process['data']['totaldiscount'];
215
+ }
216
+ //subtotal are not including delivery
217
+ /*elseif($cart_item_process['data']['totaldiscount']>0&&$cart_item_process['data']['type']=='DELIVERYREDUCTION'){
218
+ $total_discount_amount+=$cart_item_process['data']['totaldiscount'];
219
+ }*/
220
+ }
221
+
222
+ }
223
+
224
+ if (isset($_SESSION['qixol_quoted_items']['summary'])){
225
+ foreach ($_SESSION['qixol_quoted_items']['summary'] as $cart_total_process){
226
+ if ($cart_total_process['data']['discountamount']>0&&$cart_total_process['data']['type']=='BASKETREDUCTION'){
227
+ $total_discount_amount+=$cart_total_process['data']['discountamount'];
228
+ }
229
+ }
230
+ }
231
+ }
app/etc/modules/Qixol_Promo.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Qixol_Promo>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>1.0.0</version>
8
+ </Qixol_Promo>
9
+ </modules>
10
+ </config>
app/locale/en_US/Qixol_Promo.csv ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "%s","%s"
2
+ "Banner Box Manager","Banner Box Manager"
3
+ "Add Banner box","Add Banner box"
4
+ "Banner Manager","Banner Manager"
5
+ "Add Banner Item","Add Banner Item"
6
+ "Add Shipping Method Integration Code","Add Shipping Method Integration Code"
7
+ "Wrong column format","Wrong column format"
8
+ "Shipping Method","Shipping Method"
9
+ "Integration Code","Integration Code"
10
+ "Edit","Edit"
11
+ "Delete","Delete"
12
+ "Shipping Method","Shipping Method"
13
+ "Item information","Item information"
14
+ "Code to be sent to Promo.","Code to be sent to Promo."
15
+ "Save Item","Save Item"
16
+ "Delete Item","Delete Item"
17
+ "Save And Continue Edit","Save And Continue Edit"
18
+ "Add Item","Add Item"
19
+ "Edit Item '%s'","Edit Item '%s'"
20
+ "Banner Box Type","Banner Box Type"
21
+ "Enabled?","Enabled?"
22
+ "Translate Type","Translate Type"
23
+ "Action","Action"
24
+ "ID","ID"
25
+ "Image","Image"
26
+ "Link Name","Link Name"
27
+ "Title","Title"
28
+ "Banner Group","Banner Group"
29
+ "Not defined","Not defined"
30
+ "Buy one get one free","Buy one get one free"
31
+ "Buy one get one reduced","Buy one get one reduced"
32
+ "Bundle","Bundle"
33
+ "Deal","Deal"
34
+ "Free product","Free product"
35
+ "Issue points","Issue points"
36
+ "Basket reduction","Basket reduction"
37
+ "Delivery coupon","Delivery coupon"
38
+ "Product reduction","Product reduction"
39
+ "Promotion type name","Promotion type name"
40
+ "Sort Order","Sort Order"
41
+ "Default?","Default?"
42
+ "Are you sure?","Are you sure?"
43
+ "Change status","Change status"
44
+ "Store Integration Codes","Store Integration Codes"
45
+ "Banner Position","Banner Position"
46
+ "Shipping Method Integration Codes","Shipping Method Integration Codes"
47
+ "Qixol Promo","Qixol Promo"
48
+ "Promo Setting","Promo Setting"
49
+ "General / Integration","General / Integration"
50
+ "Enabled","Enabled"
51
+ "Company Key","Company Key"
52
+ "Company key assigned to you when you register in Qixol Promo <a href=\"http://www.qixolpromo.com\">click</a>.","Company key assigned to you when you register in Qixol Promo <a href=\"http://www.qixolpromo.com\">click</a>."
53
+ "Integration Services","Integration Services"
54
+ "Service Protocol","Service Protocol"
55
+ "REST services [RECOMMENDED]","REST Services [RECOMMENDED]"
56
+ "SOAP services","SOAP services"
57
+ "REST Service Address","REST Service Address"
58
+ "Import Manager Service Address","Import Manager Service Address"
59
+ "Export Manager Service Address","Export Manager Service Address"
60
+ "Basket Manager Service Address","Basket Manager Service Address"
61
+ "Front-End Settings","Front-End Settings"
62
+ "Use Javascript onepage update.","Use Javascript onepage update."
63
+ "One one page chackout use javascript cart update.","One one page chackout use javascript cart update."
64
+ "Use Javascript cart update.","Use Javascript cart update."
65
+ "Cart confirmation use javascript replace.","Cart confirmation use javascript replace."
66
+ "Use Javascript topcart update.","Use Javascript topcart update."
67
+ "Top cart javascript replace.","Top cart javascript replace."
68
+ "Advanced","Advanced"
69
+ "Multi-currency Basket Validation","Multi-currency Basket Validation"
70
+ "Shopping Cart Configuration","Shopping Cart Configuration"
71
+ "Show promotional details","Show promotional details"
72
+ "Synchronised Items","Synchronised Items"
73
+ "Synchronization Config","Synchronization Config"
74
+ "Synchronise category with product","Synchronise category with product"
75
+ "Send product categories in attribute categorycode","Send product categories in attribute categorycode"
76
+ "Stores","For stores"
77
+ "Synchronise Customer groups","Synchronise Customer groups"
78
+ "Synchronise Customer groups","Synchronise Customer groups"
79
+ "Synchronise Shipping Methods","Synchronise Shipping Methods"
80
+ "Synchronise Currency List","Synchronise Currency List"
81
+ "Synchronise Stores","Synchronise Stores"
82
+ "Channel","Channel"
83
+ "Store Group","Store Group"
84
+ "The channel and store group are used in the store hierarchy submited to Promo.","The channel and store group are used in the store hierarchy submited to Promo."
85
+ "Synchronise on Saving","Synchronise on Saving"
86
+ "Customers","Customers"
87
+ "Synchronization Config","Synchronization Config"
88
+ "Only synchronise these methods","Only synchronise these methods"
89
+ "Shipping Methods","Shipping Methods"
90
+ "Only active","Only active"
91
+ "Only synchronise these types","Only synchronise these types"
92
+ "Product Attributes","Product Attributes"
93
+ "Include with synchronised products:","Include with synchronised products:"
94
+ "Synchronise items to Promo","Synchronise items to Promo"
95
+ "Export items to Promo","Export items to Promo"
96
+ "Run import promotions","Run import promotions"
97
+ "Import promotions from qixol.","Import promotions from qixol."
98
+ "Synchronise Products","Synchronise Products"
99
+ "product export run","product export run"
100
+ "Export finished","Export finished"
101
+ "promotion import run","promotion import run"
102
+ "Import finished","Import finished"
103
+ "Stickers Manager","Stickers Manager"
104
+ "Add Sticker","Add Sticker"
105
+ "Store Name","Store Name"
106
+ "Integration Code","Integration Code"
107
+ "Stores","Stores"
108
+ "Integration Codes","Integration Codes"
109
+ "Promotion reference","Promotion reference"
110
+ "Products","Products"
111
+ "Currency","Currency"
112
+ "Promotions","Promotions"
113
+ "Imported","Imported"
114
+ "Store Integration Codes","Store Integration Codes"
115
+ "Banner boxes Manager","Banner boxes Manager"
116
+ "Box Manager","Box Manager"
117
+ "Unable to find item to save","Unable to find item to save"
118
+ "Item was successfully deleted","Item was successfully deleted"
119
+ "Please select item(s)","Please select item(s)"
120
+ "Total of %d record(s) were successfully deleted","Total of %d record(s) were successfully deleted"
121
+ "Total of %d record(s) were successfully updated","Total of %d record(s) were successfully updated"
122
+ "Customer Group Integration Code","Customer Group Integration Code"
123
+ "Customer Group Integration Codes","Customer Group Integration Codes"
124
+ "Shippings Map","Shippings Map"
125
+ "Sticker Manager","Sticker Manager"
126
+ "Item Sticker","Item Sticker"
127
+ "Stores Map","Stores Map"
128
+ "Qixol coupon '%s' was applied to your order.","Qixol coupon '%s' was applied to your order."
129
+ "Qixol coupon '%s' not applicable.","Qixol coupon '%s' not applicable."
130
+ "Stickers","Stickers"
131
+ "General","General"
132
+ "Show promotion stickers on catalogue page","Show promotion stickers on catalogue page"
133
+ "Show promotion stickers on product page","Show promotion stickers on product page"
134
+ "Show available promotions on product page","Show available promotions on product page"
135
+ "Default for promotion type","Default for promotion type"
136
+
137
+ "Show promotion stickers on products on catalogue","Show promotion stickers on products on catalogue"
138
+ "Show promotion sticker on product","Show promotion sticker on product"
139
+ "Show promotion stickers on the product page","Show promotion stickers on the product page"
140
+ "Show promotion boxes","Show promotion boxes"
141
+ "Show promotion box in cart","Show promotion box in cart"
142
+ "Show cart related only promotion box","Show cart related only promotion box"
media/custom/stickers/bogof.png ADDED
Binary file
media/custom/stickers/bogor.png ADDED
Binary file
media/custom/stickers/bundle.png ADDED
Binary file
media/custom/stickers/deal.png ADDED
Binary file
media/custom/stickers/freeproduct.png ADDED
Binary file
media/custom/stickers/issuecoupon.png ADDED
Binary file
media/custom/stickers/issuepoints.png ADDED
Binary file
media/custom/stickers/offers.png ADDED
Binary file
media/custom/stickers/productsreduction.png ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Qixol_Promo</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GNU General Public License (GPL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Qixol Promo extension</summary>
10
+ <description>Qixol Promo extension</description>
11
+ <notes>Version 1.0.0 release</notes>
12
+ <authors><author><name>Qixol</name><user>KenWestgate</user><email>ken.westgate@qixol.com</email></author></authors>
13
+ <date>2016-11-01</date>
14
+ <time>14:53:02</time>
15
+ <contents><target name="magecommunity"><dir name="Qixol"><dir name="Promo"><dir name="Block"><dir name="Adminhtml"><dir name="Banner"><dir name="Edit"><dir name="Bannerimage"><file name="Grid.php" hash="950c1f92fafb10cbbfb9bfc77cacb282"/><dir name="Tab"><file name="Form.php" hash="35fea30d4ae37570ab906fa304cbe409"/></dir></dir><file name="Form.php" hash="711215b1da1fde7750a7761f2d0e9e3f"/><dir name="Tab"><file name="Bannerimage.php" hash="9263281e0508593ac24fe8697ffe5eab"/><file name="Form.php" hash="7366a78cd16b218acadf656f1dd33dd5"/></dir><file name="Tabs.php" hash="06152329fa3c48177140cb2867a82615"/></dir><file name="Edit.php" hash="e4a675b0334319877c36eae7a2bfd6c1"/><file name="Grid.php" hash="e012abedcbff532495804b49d132800f"/></dir><file name="Banner.php" hash="2b5f2a307fa01cebf70c16baf2191c70"/><dir name="Bannerboxes"><dir name="Edit"><file name="Form.php" hash="b4dd90d4ee4bc13a6296c47d5e4fadb1"/><dir name="Tab"><file name="Form.php" hash="f9bcf99b8d0c15d71c33d98bfa229f60"/></dir><file name="Tabs.php" hash="dda66314547a4cd25cae95d5829aa730"/></dir><file name="Edit.php" hash="bbb65e83d57797873c7601531244a92a"/><file name="Grid.php" hash="123b156f7e5f228da28f2be2ad5b831b"/></dir><file name="Bannerboxes.php" hash="4d3c4af92dd25eaf46fd5aeef6b8fece"/><dir name="Bannerimage"><dir name="Edit"><file name="Form.php" hash="26090bd07a4ee40797c4bd7ebef2a732"/><dir name="Tab"><file name="Form.php" hash="916b16a3a99253355b3d4663066be73d"/></dir><file name="Tabs.php" hash="a9731335f9212ea31a200519e24d9cec"/></dir><file name="Edit.php" hash="eb8b3712da4498e952a3249f857a6c01"/></dir><file name="Bannerimage.php" hash="2b7768b68e3b7db741441177510bb616"/><dir name="Customergrouspmap"><dir name="Edit"><file name="Form.php" hash="e3d818cb040fb8bb8bc6b1a6bd33707a"/><dir name="Tab"><file name="Form.php" hash="6386440157626ce84287650a834d6bed"/></dir><file name="Tabs.php" hash="9e1efcbe5f26084b3b182c5e7c48f8a1"/></dir><file name="Edit.php" hash="535fde72a4f198d8e7ec6f1a2d686f54"/><file name="Grid.php" hash="826b956cdf4ad2c4177233617db0fc99"/></dir><file name="Customergrouspmap.php" hash="034a2ac74fe141b410a0a48baf0852b9"/><file name="Qixolbackend.php" hash="1328acfc1339c6916d9cf1f33dd2bc26"/><dir name="Sales"><dir name="Order"><file name="Total.php" hash="bd96abc8013564710a7ddcf9ef2d9b2a"/></dir></dir><dir name="Shippingmap"><dir name="Edit"><file name="Form.php" hash="42a88b7e2b5071ebae74d45132fcb84a"/><dir name="Tab"><file name="Form.php" hash="8502fdb2482cb7d9b1714d41f8a48f3e"/></dir><file name="Tabs.php" hash="92e353a3c99e0f5580c2ba662085bca7"/></dir><file name="Edit.php" hash="bad0f9ebaa7b12e332a6d4f3ae6a4670"/><file name="Grid.php" hash="fb78fc0121047e806f7888dabcde74b6"/></dir><file name="Shippingmap.php" hash="21cd2680eaddd4d11409291272eb4f3c"/><dir name="Sticker"><dir name="Edit"><file name="Form.php" hash="36501c828e075d6215fafed73368b8d3"/><dir name="Tab"><file name="Form.php" hash="8a514d2d9b50d3e36e3ec5721a8f9fb9"/></dir><file name="Tabs.php" hash="10cfd6321ad0bcf69cf3c890c37bc720"/></dir><file name="Edit.php" hash="d0a70890bf5380b65960cab04949c3a6"/><file name="Grid.php" hash="2057f7a322d8d2bc1fa048a946e5c5a6"/></dir><file name="Sticker.php" hash="fb724cd7e11efc8f14d002b19590616f"/><dir name="Storesmap"><dir name="Edit"><file name="Form.php" hash="492cc347900671f15af577476e219cf0"/><dir name="Tab"><file name="Form.php" hash="420efa56f3236e9f46fc0fa766e458bd"/></dir><file name="Tabs.php" hash="ef4ce264c145404ff868b605855f8a8b"/></dir><file name="Edit.php" hash="7d61f59b538cddfa68ad04c31a3f0149"/><file name="Grid.php" hash="c0a37c7378401cebbcb56bbd3b822ece"/></dir><file name="Storesmap.php" hash="726f1f6479d0499a8adb87625ca6091b"/><dir name="System"><dir name="Config"><file name="Attributes.php" hash="0ffb534213f7c6d752a3f12ba6d6a447"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Filter"><file name="Banner.php" hash="12f939b83753a6c849ec70d6c35ae402"/></dir><dir name="Renderer"><file name="Banner.php" hash="94e044d91b97a3dbd572d60f85292b5c"/><file name="Sticker.php" hash="974c2c0dae2ae33deb7bca5e76243b66"/></dir></dir><file name="Column.php" hash="4ebb784e03eb3022879ab40ea855b9b6"/></dir><file name="Grid.php" hash="899e7c76144a54e3b686e233b55268c9"/></dir></dir><file name="Banner.php" hash="1dfefca2a01b75d6631e99ebc70213de"/><file name="Bannerboxes.php" hash="fa3bb349ecf7b972a978dae3daac7f1c"/><file name="Customergrouspmap.php" hash="c2786b3fade58fe74830c17df915b7d1"/><file name="Issuedcoupon.php" hash="299902392c945551cd2ca3b90f6d09eb"/><dir name="Sales"><file name="Creditmemo.php" hash="4753e546d82fa68a5aaba52f4db785fe"/><file name="Invoice.php" hash="ce4f9be4da3950a2f00b3cdaed4899d7"/><dir name="Order"><file name="Total.php" hash="6cee02eb51da0a4782cde2cb717ed8d9"/></dir><file name="Order.php" hash="619b9fc4fc905ed32de287109948c189"/></dir><file name="Shippingmap.php" hash="b6e5cb7f5b7f6ac7448f4721c4cb4bda"/><file name="Startexportbutton.php" hash="55ddb2e0953592f03a54b17fcdbaa673"/><file name="Startimportbutton.php" hash="1cbd2300372666e72df6071d18702676"/><file name="Sticker.php" hash="c4786018d69b673161a5bfbff7b80716"/><file name="Storesmap.php" hash="d63da9a5da183d2ee9460aba102f046b"/></dir><dir name="Helper"><file name="Data.php" hash="17b166861f85e241d52d6967e96d4479"/></dir><dir name="Model"><file name="Advert.php" hash="ea6b36159697020a946622ca392297d4"/><file name="Banner.php" hash="39ff4d3c1d5f3f35f0d9eef965617aca"/><file name="Bannerboxes.php" hash="f2f0aa7b9767cc15542a44c28b706c12"/><file name="Bannerimage.php" hash="65c8f87264d79e9f41fc2a7c2b731311"/><file name="Bannerresize.php" hash="dbdfc9262a7806b607f0401b06323a1d"/><file name="Bonuspoints.php" hash="898c281980306963cd995fa9dd8c818d"/><file name="Creditmemopoints.php" hash="b1e3e3e866d2798d4dc61d7a1adc942a"/><file name="Cron.php" hash="d0aae4043875489b9c3677b536cae65b"/><file name="Customergrouspmap.php" hash="eaf9e054af7bf50344b67b754e44053a"/><file name="Deletedproduct.php" hash="5bf117d3e5eb1aed9ba5711769ef74a9"/><file name="Exportstat.php" hash="1fa6e0afc8e5b61476bcc82787c70e8b"/><file name="Exprpocessstat.php" hash="fc62289907cc0b4558559e2df5b8c29c"/><file name="Invoicepoints.php" hash="36c0a2e555cb3c8a7e0e3f90a3a6ec46"/><file name="Issuedcoupon.php" hash="8ad9903f8287275a490082c48321f92d"/><dir name="Mysql4"><dir name="Banner"><file name="Collection.php" hash="00e1d3c5cc16e076705c872a41f5bcc1"/></dir><file name="Banner.php" hash="bfc422d880a19ee64793a3f2ad097a50"/><dir name="Bannerboxes"><file name="Collection.php" hash="10d8f42df5323010afd22b37d9b71886"/></dir><file name="Bannerboxes.php" hash="c5d393e0bce43a75220f447522043729"/><dir name="Bannerimage"><file name="Collection.php" hash="d90654402291d1450c6e161cc20d2a4e"/></dir><file name="Bannerimage.php" hash="62b6766527966df1963e99b5e10793ad"/><dir name="Bonuspoints"><file name="Collection.php" hash="c1e848065850ad043992e460f79cad69"/></dir><file name="Bonuspoints.php" hash="c9c4c36fd8896f8a2cb730a4753e5171"/><dir name="Customergrouspmap"><file name="Collection.php" hash="224f4f324ec3abf1ba56f4bef84be61f"/></dir><file name="Customergrouspmap.php" hash="fe2288f91e4767adb2af82c79ab89817"/><dir name="Deletedproduct"><file name="Collection.php" hash="3758576897f8dd59439fac2e9cff16a1"/></dir><file name="Deletedproduct.php" hash="e6b2f6c6bf38e795d30dd18e7b84f4fc"/><dir name="Exportstat"><file name="Collection.php" hash="6411a23f4e085f12dc055827e61537de"/></dir><file name="Exportstat.php" hash="4be7b4d3915e0f29b81b9b694e72ed04"/><dir name="Exprpocessstat"><file name="Collection.php" hash="e3773a78e980693cf0a96a38a81e902b"/></dir><file name="Exprpocessstat.php" hash="7bc667a091dcbaaebd6584fb0e17712e"/><dir name="Issuedcoupon"><file name="Collection.php" hash="a01cc58c96a4ddd8c1f0e10730a289d5"/></dir><file name="Issuedcoupon.php" hash="1bc7ee70a64a773000ac0068242f89ef"/><dir name="Promotions"><file name="Collection.php" hash="9211693bd896a5686d118eab157c436a"/></dir><file name="Promotions.php" hash="c4562a82d4669f5f481422b1b60005cb"/><dir name="Shippingmap"><file name="Collection.php" hash="02628fb2428671e22504ce70ba7fac92"/></dir><file name="Shippingmap.php" hash="3eb644a7299ae55c9b139a489e3cb519"/><dir name="Sticker"><file name="Collection.php" hash="24c1407c000dc052418b9e475c5ec46c"/></dir><file name="Sticker.php" hash="9f850a087fad02b401e924d9dac02cd2"/><dir name="Storesmap"><file name="Collection.php" hash="d4b09995598ac45c996ce2a98747cf30"/></dir><file name="Storesmap.php" hash="132ad0e067f750cbca41e238a9f77470"/></dir><file name="Observer.php" hash="eed021b968cd85af5ce16b23d727de8b"/><file name="Ordertotalpoints.php" hash="702a9b700a8c25ac016281557d265b80"/><file name="PromoService.php" hash="ef1bc8d7f805e6fbc463461d8c2932ae"/><file name="Promotions.php" hash="e81ff6ab8ccfa0bfce160d08f94a0b6c"/><file name="RESTPromoService.php" hash="14b8a2561e1d58da684bbbb6a0b0701d"/><file name="SOAPPromoService.php" hash="d2e846f466721f6064d57eb17c31f7b0"/><file name="Shippingmap.php" hash="8480fea9157aecf6ead8c36c24a70b37"/><file name="Sinch.php" hash="6dc09b8d691f07fdc203952d797c885e"/><file name="Status.php" hash="c104661ac87a6ecf93e38a9eff3f7a3a"/><file name="Sticker.php" hash="726cd30635b47599537b63fdb24ffbd8"/><file name="Storesmap.php" hash="6e676b415694c5f36440a85ac0434e00"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Attributes.php" hash="1f613c2e08a49a2b7a322ca4e0a1d30d"/><dir name="Cart"><file name="Settings.php" hash="8f7d06416f944596d2f4f5b2e1672c3d"/></dir><dir name="Customers"><file name="List.php" hash="57530f7759739d5e12596bcf9ddfc80b"/></dir><dir name="IServiceProtocols"><file name="Values.php" hash="6b43f80fbc5e8d4d68d518b117927eb5"/></dir><dir name="Iservices"><file name="Values.php" hash="059eca20fe51f43c3c7b5fb1754def0e"/></dir><dir name="Shippings"><file name="List.php" hash="937880a02fe4f795db77901bd18c3993"/></dir><file name="Stores.php" hash="0860f47c1df8ea87791aca9519edef09"/></dir></dir></dir><dir name="Wysiwyg"><file name="Config.php" hash="2e76f3800934ba750f7442f5a696a398"/></dir><file name="config.php" hash="791d755b14b819157cc5fca81852be40"/><file name="iPromoService.php" hash="64c9025036d03e8113fb53331d0c0634"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="BannerController.php" hash="d41546e4c9d12bda2c8f3542be4144d3"/><file name="BannerboxesController.php" hash="2dc213deefc929f497b655fbbfd5e88f"/><file name="BannerimageController.php" hash="79dffebcaafb28f14cc61e92682615bc"/><file name="CustomergrouspmapController.php" hash="82361bce31b19b92ac4c483719b267c2"/><file name="QixolbackendController.php" hash="0aa155931fd288c63cba0ec25de5aca1"/><file name="ShippingmapController.php" hash="f202e497533d83ca3a5026fb60b449ea"/><file name="StickerController.php" hash="239c636615bba0086aefa8f5b8a22411"/><file name="StoresmapController.php" hash="34178cefbe37ec57a9231fd56041b27b"/></dir><file name="AjaxController.php" hash="0fd503c9d731ddf62cc47c41fda7a4fc"/><file name="CartController.php" hash="7715c645716a826143e16859760078ea"/><file name="IndexController.php" hash="b34ffe1faba05bba056f9f6e5da3426c"/><file name="IssuedcouponController.php" hash="b0427fa860cd65f6959a7b7445c1f0e9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8556d700b717ed3611010105b873c9ef"/><file name="config.xml" hash="cfd4fb5422a93aae801a49ee93d03654"/><file name="system.xml" hash="8413476c59f5c74cb7bc102bf3af8a27"/></dir><dir name="sql"><dir name="qixol_setup"><file name="mysql4-install-1.0.0.php" hash="d72f6950703b1fea56c076de2d44e25d"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="qixol.xml" hash="97f1a0f83a4876434f61772fc66e208a"/></dir><dir name="template"><dir name="qixol"><dir name="cart"><file name="advert.phtml" hash="5ad1721c1cc95115a38cfb12fa3076f7"/><file name="bonuspointbox.phtml" hash="558a50838ea7148dd106850850497231"/><file name="cart.phtml" hash="28331e20eac7164edcf7de1a8ff3f985"/><dir name="item"><file name="default.phtml" hash="0edc7294396a56727164adc7eef51d7b"/></dir><file name="totals.phtml" hash="e748fbc819802ee33ecdabd9c7b64716"/></dir><dir name="issuedcoupon"><file name="list.phtml" hash="cefe204c4b02ab55ef1a291fedd6e09a"/></dir><dir name="issuedpoints"><file name="box.phtml" hash="2d534d83303b774cc4b254d1612771b7"/><file name="dashboard_points.phtml" hash="aafc7550392e7d335b5275317fc8adfb"/></dir><dir name="minicart"><file name="advert.phtml" hash="cf40df0f0df118d9edfcc735ddc7298a"/><file name="default.phtml" hash="ac618419eb0140d7a1bb8e016ac81a92"/><file name="mincart.phtml" hash="7ecc9db101541bab40b060db078ab51b"/></dir><dir name="myaccount"><dir name="order"><dir name="email"><file name="default.phtml" hash="85f8299e6bf0a7d8a2e0760bfe247fe8"/><file name="items.phtml" hash="7a6e8134e3eedd601a8c1f667c79c287"/></dir><dir name="invoice"><file name="default.phtml" hash="8d3f98f1b23f4d336b24b1f2082cfa11"/><file name="invoice.phtml" hash="4d8916b24badcc9ae7179185ba87b91c"/></dir><dir name="items"><file name="default.phtml" hash="273be10efd43ed4fa15d7b0617be54a6"/><file name="items.phtml" hash="40141526c9201e81a52acb62a5954a3c"/></dir><dir name="print"><file name="default.phtml" hash="df6637723ed3614b4ef55716d2ec6b4a"/><file name="messages.phtml" hash="952bccf9afe8e4c04306f70f7bed6610"/><file name="print.phtml" hash="2a1d1a04fa8dc3d93c5b4369031b129b"/></dir></dir></dir><dir name="onepage"><file name="advert.phtml" hash="9d9b0423fbd11be21effb55f6ca5abf3"/><file name="item.phtml" hash="1dc305b4be5abc879be150aac7430152"/><file name="review.phtml" hash="2b21d34ab9855b0dd060a32abdb88153"/></dir><dir name="product"><file name="qixol_adv.phtml" hash="db9cbb04df8703b55bc51533cc05226e"/><file name="qixol_info_details.phtml" hash="84f7d9e45ae8ec2d1f067319a4fa6bfa"/><file name="qixol_product_info.phtml" hash="6c28565c2d4c6414d41fcdd320b41d0a"/></dir><dir name="sidebar"><file name="advert.phtml" hash="be200d00b42ba8fa70e8ef51a8c28b1e"/><file name="default.phtml" hash="317f41c1259a37e576827ead92683945"/><file name="sidebar.phtml" hash="1324c07adc3ceb719e910add0e613e18"/></dir></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="template"><dir name="qixol"><dir name="minicart"><file name="advert.phtml" hash="cf40df0f0df118d9edfcc735ddc7298a"/><file name="default.phtml" hash="f6b0c5eebbdd203e6c0e5c2d6fc81a3b"/><file name="mincart.phtml" hash="88a96f15d1b09679c14fd41a8b174419"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="qixol.xml" hash="f2ec82cc10191090810816122455e80e"/></dir><dir name="template"><dir name="qixol"><file name="bannerboxes.phtml" hash="4cd4485a88b4fc7f8cdc5a9b2a8d394a"/><file name="bannerimage.phtml" hash="cbf6de2f6a5cef7d9ff9f420e3cbf6e1"/><file name="banners.phtml" hash="a94ee54cd68b93ae8a427f034f37a5df"/><file name="customergrouspmap.phtml" hash="4cd4485a88b4fc7f8cdc5a9b2a8d394a"/><dir name="order"><file name="advert.phtml" hash="51e47cf71f2730664b2ad7a5800ef0a9"/></dir><file name="qixolbackend.phtml" hash="3012313aed77e18b6294c7fc4f4bb8ec"/><file name="shippingmap.phtml" hash="4cd4485a88b4fc7f8cdc5a9b2a8d394a"/><file name="stickers.phtml" hash="a94ee54cd68b93ae8a427f034f37a5df"/><file name="storesmap.phtml" hash="4cd4485a88b4fc7f8cdc5a9b2a8d394a"/><dir name="system"><dir name="config"><file name="attributes.phtml" hash="a8aa43dd93f3e775cd9c3b8a236ab318"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Qixol_Promo.csv" hash="0ed1763b5bc1756d8aba48757aff9964"/></dir></target><target name="mageetc"><dir name="modules"><file name="Qixol_Promo.xml" hash="601a5e81c7125178724e3d63976a209b"/></dir></target><target name="magemedia"><dir name="custom"><dir name="stickers"><file name="bogof.png" hash="f2e5e0b523b88d158b5a3cd9536cba2f"/><file name="bogor.png" hash="29c394e676fbf47b0231e53c3e506aa8"/><file name="bundle.png" hash="b4cb00ec06de891ef41b9a35ab0073b8"/><file name="deal.png" hash="ec2917f52f90ab9d88c9c569412cf36e"/><file name="freeproduct.png" hash="b4cb00ec06de891ef41b9a35ab0073b8"/><file name="issuecoupon.png" hash="b4cb00ec06de891ef41b9a35ab0073b8"/><file name="issuepoints.png" hash="b4cb00ec06de891ef41b9a35ab0073b8"/><file name="offers.png" hash="b4cb00ec06de891ef41b9a35ab0073b8"/><file name="productsreduction.png" hash="84ce3d4534d3694d115f0fe8e02db2da"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="_run.gif" hash="e805ea7eca1f34c75ba0f93780d32d38"/><file name="_yes.gif" hash="0afb20898a704a106cb4c598868abf32"/><file name="_error.png" hash="c4130f2ce85a7586eb8d06091656ac99"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="qixol.css" hash="e0d82ed614c8071e5eb2d1d56ad7c2e2"/></dir><dir name="js"><dir name="lib"><file name="jquery.cycle2.min.js" hash="24f809434b3e494cc7b98c6c08404b33"/><file name="jquery.cycle2.swipe.min.js" hash="15747fbd45dd1adcaf8f04a2d8a71d68"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="var"><dir name="logs_qixol"><file name="logs_here.txt" hash="68b329da9893e34099c7d8ad5cb9c940"/></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>7.0.12</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/images/_error.png ADDED
Binary file
skin/adminhtml/default/default/images/_run.gif ADDED
Binary file
skin/adminhtml/default/default/images/_yes.gif ADDED
Binary file
skin/frontend/base/default/css/qixol.css ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .background_promotion_sale{
2
+ position: absolute;
3
+ right: 0;
4
+ top: 0;
5
+ width: 65px;
6
+ height: 66px;
7
+ display: block;
8
+ z-index: 2;
9
+ background:url(../images/qixol/red_sales_sticker_pv.png) 0 0 no-repeat;
10
+ }
11
+ .promotion_cart_inline_box {
12
+ font-weight:bold;
13
+ color:#00A;
14
+ }
15
+ .promotion_cart_inline_box {
16
+ font-weight:bold;
17
+ color:#00A;
18
+ }
19
+ .cart_inline_item_promo {
20
+ font-weight:bold;
21
+ color:#00A;
22
+ }
23
+ .cart_inline_item_new_qty {
24
+ font-weight:bold;
25
+ color:#00A;
26
+ }
27
+ .cart_inline_item_new_price {
28
+ font-weight:bold;
29
+ color:#00A;
30
+ }
31
+
32
+ .qixol_review_discount{
33
+ font-weight:bold;
34
+ color:#00A;
35
+ }
36
+
37
+ .qixol_review_total_price {
38
+ font-weight:bold;
39
+ color:#00A;
40
+ }
41
+
42
+ .qixol_total_price{
43
+ font-weight:bold;
44
+ color:#00A;
45
+ font-family: "Helvetica Neue",Verdana,Arial,sans-serif;
46
+ }
47
+
48
+ .qixol_discount{
49
+ font-weight:bold;
50
+ color:#00A;
51
+ }
52
+
53
+ .qixol_grand_total_price{
54
+ font-weight:bold;
55
+ color:#00A;
56
+ display:block;
57
+ }
58
+
59
+
60
+ .qixol_price_cross{
61
+ font-size: -4pt;
62
+ text-decoration: line-through;
63
+ }
64
+
65
+ .promotion_review_inline_box{
66
+ font-weight:bold;
67
+ color:#00A;
68
+ }
69
+
70
+
71
+
72
+ /*
73
+ * iMedia Inc.
74
+ */
75
+
76
+ #bonuspoints .input-text{
77
+ float:left;
78
+ border-radius: 0;
79
+ height: 30px;
80
+ margin: 4px 10px 0 0;
81
+ width: 100px;
82
+ }
83
+
84
+ #bonuspoints .button-wrapper{
85
+ float: left;
86
+ }
87
+
88
+ #bonuspoints label{
89
+ float:left;
90
+ font-size: 12px;
91
+ font-weight: 400;
92
+ text-align: left;
93
+ text-transform: uppercase;
94
+ min-width: 90px;
95
+ display: inline-block;
96
+ margin-right: 10px;
97
+ line-height:32px;
98
+ }
99
+ .cycle-slideshow{
100
+ /*height:100px;*/
101
+ display: inline-block;
102
+ }
103
+ .product_all_promotions{
104
+ width:100%;
105
+ padding-bottom: 10px;
106
+ }
107
+ .product_all_promotions table{
108
+ border:1px solid;
109
+ }
110
+ .product_all_promotions th{
111
+ background-color:#DDDDEE;
112
+ padding-left: 5px;
113
+ }
114
+ .product_all_promotions td{
115
+ padding-left: 5px;
116
+ }
skin/frontend/base/default/js/lib/jquery.cycle2.min.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery Cycle2; build: v20131022
3
+ * http://jquery.malsup.com/cycle2/
4
+ * Copyright (c) 2013 M. Alsup; Dual licensed: MIT/GPL
5
+ */
6
+ /*! core engine; version: 20131003 */
7
+ (function(e){"use strict";function t(e){return(e||"").toLowerCase()}var i="20131003";e.fn.cycle=function(i){var n;return 0!==this.length||e.isReady?this.each(function(){var n,s,o,c,r=e(this),l=e.fn.cycle.log;if(!r.data("cycle.opts")){(r.data("cycle-log")===!1||i&&i.log===!1||s&&s.log===!1)&&(l=e.noop),l("--c2 init--"),n=r.data();for(var a in n)n.hasOwnProperty(a)&&/^cycle[A-Z]+/.test(a)&&(c=n[a],o=a.match(/^cycle(.*)/)[1].replace(/^[A-Z]/,t),l(o+":",c,"("+typeof c+")"),n[o]=c);s=e.extend({},e.fn.cycle.defaults,n,i||{}),s.timeoutId=0,s.paused=s.paused||!1,s.container=r,s._maxZ=s.maxZ,s.API=e.extend({_container:r},e.fn.cycle.API),s.API.log=l,s.API.trigger=function(e,t){return s.container.trigger(e,t),s.API},r.data("cycle.opts",s),r.data("cycle.API",s.API),s.API.trigger("cycle-bootstrap",[s,s.API]),s.API.addInitialSlides(),s.API.preInitSlideshow(),s.slides.length&&s.API.initSlideshow()}}):(n={s:this.selector,c:this.context},e.fn.cycle.log("requeuing slideshow (dom not ready)"),e(function(){e(n.s,n.c).cycle(i)}),this)},e.fn.cycle.API={opts:function(){return this._container.data("cycle.opts")},addInitialSlides:function(){var t=this.opts(),i=t.slides;t.slideCount=0,t.slides=e(),i=i.jquery?i:t.container.find(i),t.random&&i.sort(function(){return Math.random()-.5}),t.API.add(i)},preInitSlideshow:function(){var t=this.opts();t.API.trigger("cycle-pre-initialize",[t]);var i=e.fn.cycle.transitions[t.fx];i&&e.isFunction(i.preInit)&&i.preInit(t),t._preInitialized=!0},postInitSlideshow:function(){var t=this.opts();t.API.trigger("cycle-post-initialize",[t]);var i=e.fn.cycle.transitions[t.fx];i&&e.isFunction(i.postInit)&&i.postInit(t)},initSlideshow:function(){var t,i=this.opts(),n=i.container;i.API.calcFirstSlide(),"static"==i.container.css("position")&&i.container.css("position","relative"),e(i.slides[i.currSlide]).css("opacity",1).show(),i.API.stackSlides(i.slides[i.currSlide],i.slides[i.nextSlide],!i.reverse),i.pauseOnHover&&(i.pauseOnHover!==!0&&(n=e(i.pauseOnHover)),n.hover(function(){i.API.pause(!0)},function(){i.API.resume(!0)})),i.timeout&&(t=i.API.getSlideOpts(i.currSlide),i.API.queueTransition(t,t.timeout+i.delay)),i._initialized=!0,i.API.updateView(!0),i.API.trigger("cycle-initialized",[i]),i.API.postInitSlideshow()},pause:function(t){var i=this.opts(),n=i.API.getSlideOpts(),s=i.hoverPaused||i.paused;t?i.hoverPaused=!0:i.paused=!0,s||(i.container.addClass("cycle-paused"),i.API.trigger("cycle-paused",[i]).log("cycle-paused"),n.timeout&&(clearTimeout(i.timeoutId),i.timeoutId=0,i._remainingTimeout-=e.now()-i._lastQueue,(0>i._remainingTimeout||isNaN(i._remainingTimeout))&&(i._remainingTimeout=void 0)))},resume:function(e){var t=this.opts(),i=!t.hoverPaused&&!t.paused;e?t.hoverPaused=!1:t.paused=!1,i||(t.container.removeClass("cycle-paused"),0===t.slides.filter(":animated").length&&t.API.queueTransition(t.API.getSlideOpts(),t._remainingTimeout),t.API.trigger("cycle-resumed",[t,t._remainingTimeout]).log("cycle-resumed"))},add:function(t,i){var n,s=this.opts(),o=s.slideCount,c=!1;"string"==e.type(t)&&(t=e.trim(t)),e(t).each(function(){var t,n=e(this);i?s.container.prepend(n):s.container.append(n),s.slideCount++,t=s.API.buildSlideOpts(n),s.slides=i?e(n).add(s.slides):s.slides.add(n),s.API.initSlide(t,n,--s._maxZ),n.data("cycle.opts",t),s.API.trigger("cycle-slide-added",[s,t,n])}),s.API.updateView(!0),c=s._preInitialized&&2>o&&s.slideCount>=1,c&&(s._initialized?s.timeout&&(n=s.slides.length,s.nextSlide=s.reverse?n-1:1,s.timeoutId||s.API.queueTransition(s)):s.API.initSlideshow())},calcFirstSlide:function(){var e,t=this.opts();e=parseInt(t.startingSlide||0,10),(e>=t.slides.length||0>e)&&(e=0),t.currSlide=e,t.reverse?(t.nextSlide=e-1,0>t.nextSlide&&(t.nextSlide=t.slides.length-1)):(t.nextSlide=e+1,t.nextSlide==t.slides.length&&(t.nextSlide=0))},calcNextSlide:function(){var e,t=this.opts();t.reverse?(e=0>t.nextSlide-1,t.nextSlide=e?t.slideCount-1:t.nextSlide-1,t.currSlide=e?0:t.nextSlide+1):(e=t.nextSlide+1==t.slides.length,t.nextSlide=e?0:t.nextSlide+1,t.currSlide=e?t.slides.length-1:t.nextSlide-1)},calcTx:function(t,i){var n,s=t;return i&&s.manualFx&&(n=e.fn.cycle.transitions[s.manualFx]),n||(n=e.fn.cycle.transitions[s.fx]),n||(n=e.fn.cycle.transitions.fade,s.API.log('Transition "'+s.fx+'" not found. Using fade.')),n},prepareTx:function(e,t){var i,n,s,o,c,r=this.opts();return 2>r.slideCount?(r.timeoutId=0,void 0):(!e||r.busy&&!r.manualTrump||(r.API.stopTransition(),r.busy=!1,clearTimeout(r.timeoutId),r.timeoutId=0),r.busy||(0!==r.timeoutId||e)&&(n=r.slides[r.currSlide],s=r.slides[r.nextSlide],o=r.API.getSlideOpts(r.nextSlide),c=r.API.calcTx(o,e),r._tx=c,e&&void 0!==o.manualSpeed&&(o.speed=o.manualSpeed),r.nextSlide!=r.currSlide&&(e||!r.paused&&!r.hoverPaused&&r.timeout)?(r.API.trigger("cycle-before",[o,n,s,t]),c.before&&c.before(o,n,s,t),i=function(){r.busy=!1,r.container.data("cycle.opts")&&(c.after&&c.after(o,n,s,t),r.API.trigger("cycle-after",[o,n,s,t]),r.API.queueTransition(o),r.API.updateView(!0))},r.busy=!0,c.transition?c.transition(o,n,s,t,i):r.API.doTransition(o,n,s,t,i),r.API.calcNextSlide(),r.API.updateView()):r.API.queueTransition(o)),void 0)},doTransition:function(t,i,n,s,o){var c=t,r=e(i),l=e(n),a=function(){l.animate(c.animIn||{opacity:1},c.speed,c.easeIn||c.easing,o)};l.css(c.cssBefore||{}),r.animate(c.animOut||{},c.speed,c.easeOut||c.easing,function(){r.css(c.cssAfter||{}),c.sync||a()}),c.sync&&a()},queueTransition:function(t,i){var n=this.opts(),s=void 0!==i?i:t.timeout;return 0===n.nextSlide&&0===--n.loop?(n.API.log("terminating; loop=0"),n.timeout=0,s?setTimeout(function(){n.API.trigger("cycle-finished",[n])},s):n.API.trigger("cycle-finished",[n]),n.nextSlide=n.currSlide,void 0):(s&&(n._lastQueue=e.now(),void 0===i&&(n._remainingTimeout=t.timeout),n.paused||n.hoverPaused||(n.timeoutId=setTimeout(function(){n.API.prepareTx(!1,!n.reverse)},s))),void 0)},stopTransition:function(){var e=this.opts();e.slides.filter(":animated").length&&(e.slides.stop(!1,!0),e.API.trigger("cycle-transition-stopped",[e])),e._tx&&e._tx.stopTransition&&e._tx.stopTransition(e)},advanceSlide:function(e){var t=this.opts();return clearTimeout(t.timeoutId),t.timeoutId=0,t.nextSlide=t.currSlide+e,0>t.nextSlide?t.nextSlide=t.slides.length-1:t.nextSlide>=t.slides.length&&(t.nextSlide=0),t.API.prepareTx(!0,e>=0),!1},buildSlideOpts:function(i){var n,s,o=this.opts(),c=i.data()||{};for(var r in c)c.hasOwnProperty(r)&&/^cycle[A-Z]+/.test(r)&&(n=c[r],s=r.match(/^cycle(.*)/)[1].replace(/^[A-Z]/,t),o.API.log("["+(o.slideCount-1)+"]",s+":",n,"("+typeof n+")"),c[s]=n);c=e.extend({},e.fn.cycle.defaults,o,c),c.slideNum=o.slideCount;try{delete c.API,delete c.slideCount,delete c.currSlide,delete c.nextSlide,delete c.slides}catch(l){}return c},getSlideOpts:function(t){var i=this.opts();void 0===t&&(t=i.currSlide);var n=i.slides[t],s=e(n).data("cycle.opts");return e.extend({},i,s)},initSlide:function(t,i,n){var s=this.opts();i.css(t.slideCss||{}),n>0&&i.css("zIndex",n),isNaN(t.speed)&&(t.speed=e.fx.speeds[t.speed]||e.fx.speeds._default),t.sync||(t.speed=t.speed/2),i.addClass(s.slideClass)},updateView:function(e,t){var i=this.opts();if(i._initialized){var n=i.API.getSlideOpts(),s=i.slides[i.currSlide];!e&&t!==!0&&(i.API.trigger("cycle-update-view-before",[i,n,s]),0>i.updateView)||(i.slideActiveClass&&i.slides.removeClass(i.slideActiveClass).eq(i.currSlide).addClass(i.slideActiveClass),e&&i.hideNonActive&&i.slides.filter(":not(."+i.slideActiveClass+")").hide(),0===i.updateView&&setTimeout(function(){i.API.trigger("cycle-update-view",[i,n,s,e])},n.speed/(i.sync?2:1)),0!==i.updateView&&i.API.trigger("cycle-update-view",[i,n,s,e]),e&&i.API.trigger("cycle-update-view-after",[i,n,s]))}},getComponent:function(t){var i=this.opts(),n=i[t];return"string"==typeof n?/^\s*[\>|\+|~]/.test(n)?i.container.find(n):e(n):n.jquery?n:e(n)},stackSlides:function(t,i,n){var s=this.opts();t||(t=s.slides[s.currSlide],i=s.slides[s.nextSlide],n=!s.reverse),e(t).css("zIndex",s.maxZ);var o,c=s.maxZ-2,r=s.slideCount;if(n){for(o=s.currSlide+1;r>o;o++)e(s.slides[o]).css("zIndex",c--);for(o=0;s.currSlide>o;o++)e(s.slides[o]).css("zIndex",c--)}else{for(o=s.currSlide-1;o>=0;o--)e(s.slides[o]).css("zIndex",c--);for(o=r-1;o>s.currSlide;o--)e(s.slides[o]).css("zIndex",c--)}e(i).css("zIndex",s.maxZ-1)},getSlideIndex:function(e){return this.opts().slides.index(e)}},e.fn.cycle.log=function(){window.console&&console.log&&console.log("[cycle2] "+Array.prototype.join.call(arguments," "))},e.fn.cycle.version=function(){return"Cycle2: "+i},e.fn.cycle.transitions={custom:{},none:{before:function(e,t,i,n){e.API.stackSlides(i,t,n),e.cssBefore={opacity:1,display:"block"}}},fade:{before:function(t,i,n,s){var o=t.API.getSlideOpts(t.nextSlide).slideCss||{};t.API.stackSlides(i,n,s),t.cssBefore=e.extend(o,{opacity:0,display:"block"}),t.animIn={opacity:1},t.animOut={opacity:0}}},fadeout:{before:function(t,i,n,s){var o=t.API.getSlideOpts(t.nextSlide).slideCss||{};t.API.stackSlides(i,n,s),t.cssBefore=e.extend(o,{opacity:1,display:"block"}),t.animOut={opacity:0}}},scrollHorz:{before:function(e,t,i,n){e.API.stackSlides(t,i,n);var s=e.container.css("overflow","hidden").width();e.cssBefore={left:n?s:-s,top:0,opacity:1,display:"block"},e.cssAfter={zIndex:e._maxZ-2,left:0},e.animIn={left:0},e.animOut={left:n?-s:s}}}},e.fn.cycle.defaults={allowWrap:!0,autoSelector:".cycle-slideshow[data-cycle-auto-init!=false]",delay:0,easing:null,fx:"fade",hideNonActive:!0,loop:0,manualFx:void 0,manualSpeed:void 0,manualTrump:!0,maxZ:100,pauseOnHover:!1,reverse:!1,slideActiveClass:"cycle-slide-active",slideClass:"cycle-slide",slideCss:{position:"absolute",top:0,left:0},slides:"> img",speed:500,startingSlide:0,sync:!0,timeout:4e3,updateView:0},e(document).ready(function(){e(e.fn.cycle.defaults.autoSelector).cycle()})})(jQuery),/*! Cycle2 autoheight plugin; Copyright (c) M.Alsup, 2012; version: 20130304 */
8
+ function(e){"use strict";function t(t,n){var s,o,c,r=n.autoHeight;if("container"==r)o=e(n.slides[n.currSlide]).outerHeight(),n.container.height(o);else if(n._autoHeightRatio)n.container.height(n.container.width()/n._autoHeightRatio);else if("calc"===r||"number"==e.type(r)&&r>=0){if(c="calc"===r?i(t,n):r>=n.slides.length?0:r,c==n._sentinelIndex)return;n._sentinelIndex=c,n._sentinel&&n._sentinel.remove(),s=e(n.slides[c].cloneNode(!0)),s.removeAttr("id name rel").find("[id],[name],[rel]").removeAttr("id name rel"),s.css({position:"static",visibility:"hidden",display:"block"}).prependTo(n.container).addClass("cycle-sentinel cycle-slide").removeClass("cycle-slide-active"),s.find("*").css("visibility","hidden"),n._sentinel=s}}function i(t,i){var n=0,s=-1;return i.slides.each(function(t){var i=e(this).height();i>s&&(s=i,n=t)}),n}function n(t,i,n,s){var o=e(s).outerHeight(),c=i.sync?i.speed/2:i.speed;i.container.animate({height:o},c)}function s(i,o){o._autoHeightOnResize&&(e(window).off("resize orientationchange",o._autoHeightOnResize),o._autoHeightOnResize=null),o.container.off("cycle-slide-added cycle-slide-removed",t),o.container.off("cycle-destroyed",s),o.container.off("cycle-before",n),o._sentinel&&(o._sentinel.remove(),o._sentinel=null)}e.extend(e.fn.cycle.defaults,{autoHeight:0}),e(document).on("cycle-initialized",function(i,o){function c(){t(i,o)}var r,l=o.autoHeight,a=e.type(l),d=null;("string"===a||"number"===a)&&(o.container.on("cycle-slide-added cycle-slide-removed",t),o.container.on("cycle-destroyed",s),"container"==l?o.container.on("cycle-before",n):"string"===a&&/\d+\:\d+/.test(l)&&(r=l.match(/(\d+)\:(\d+)/),r=r[1]/r[2],o._autoHeightRatio=r),"number"!==a&&(o._autoHeightOnResize=function(){clearTimeout(d),d=setTimeout(c,50)},e(window).on("resize orientationchange",o._autoHeightOnResize)),setTimeout(c,30))})}(jQuery),/*! caption plugin for Cycle2; version: 20130306 */
9
+ function(e){"use strict";e.extend(e.fn.cycle.defaults,{caption:"> .cycle-caption",captionTemplate:"{{slideNum}} / {{slideCount}}",overlay:"> .cycle-overlay",overlayTemplate:"<div>{{title}}</div><div>{{desc}}</div>",captionModule:"caption"}),e(document).on("cycle-update-view",function(t,i,n,s){"caption"===i.captionModule&&e.each(["caption","overlay"],function(){var e=this,t=n[e+"Template"],o=i.API.getComponent(e);o.length&&t?(o.html(i.API.tmpl(t,n,i,s)),o.show()):o.hide()})}),e(document).on("cycle-destroyed",function(t,i){var n;e.each(["caption","overlay"],function(){var e=this,t=i[e+"Template"];i[e]&&t&&(n=i.API.getComponent("caption"),n.empty())})})}(jQuery),/*! command plugin for Cycle2; version: 20130707 */
10
+ function(e){"use strict";var t=e.fn.cycle;e.fn.cycle=function(i){var n,s,o,c=e.makeArray(arguments);return"number"==e.type(i)?this.cycle("goto",i):"string"==e.type(i)?this.each(function(){var r;return n=i,o=e(this).data("cycle.opts"),void 0===o?(t.log('slideshow must be initialized before sending commands; "'+n+'" ignored'),void 0):(n="goto"==n?"jump":n,s=o.API[n],e.isFunction(s)?(r=e.makeArray(c),r.shift(),s.apply(o.API,r)):(t.log("unknown command: ",n),void 0))}):t.apply(this,arguments)},e.extend(e.fn.cycle,t),e.extend(t.API,{next:function(){var e=this.opts();if(!e.busy||e.manualTrump){var t=e.reverse?-1:1;e.allowWrap===!1&&e.currSlide+t>=e.slideCount||(e.API.advanceSlide(t),e.API.trigger("cycle-next",[e]).log("cycle-next"))}},prev:function(){var e=this.opts();if(!e.busy||e.manualTrump){var t=e.reverse?1:-1;e.allowWrap===!1&&0>e.currSlide+t||(e.API.advanceSlide(t),e.API.trigger("cycle-prev",[e]).log("cycle-prev"))}},destroy:function(){this.stop();var t=this.opts(),i=e.isFunction(e._data)?e._data:e.noop;clearTimeout(t.timeoutId),t.timeoutId=0,t.API.stop(),t.API.trigger("cycle-destroyed",[t]).log("cycle-destroyed"),t.container.removeData(),i(t.container[0],"parsedAttrs",!1),t.retainStylesOnDestroy||(t.container.removeAttr("style"),t.slides.removeAttr("style"),t.slides.removeClass(t.slideActiveClass)),t.slides.each(function(){e(this).removeData(),i(this,"parsedAttrs",!1)})},jump:function(e){var t,i=this.opts();if(!i.busy||i.manualTrump){var n=parseInt(e,10);if(isNaN(n)||0>n||n>=i.slides.length)return i.API.log("goto: invalid slide index: "+n),void 0;if(n==i.currSlide)return i.API.log("goto: skipping, already on slide",n),void 0;i.nextSlide=n,clearTimeout(i.timeoutId),i.timeoutId=0,i.API.log("goto: ",n," (zero-index)"),t=i.currSlide<i.nextSlide,i.API.prepareTx(!0,t)}},stop:function(){var t=this.opts(),i=t.container;clearTimeout(t.timeoutId),t.timeoutId=0,t.API.stopTransition(),t.pauseOnHover&&(t.pauseOnHover!==!0&&(i=e(t.pauseOnHover)),i.off("mouseenter mouseleave")),t.API.trigger("cycle-stopped",[t]).log("cycle-stopped")},reinit:function(){var e=this.opts();e.API.destroy(),e.container.cycle()},remove:function(t){for(var i,n,s=this.opts(),o=[],c=1,r=0;s.slides.length>r;r++)i=s.slides[r],r==t?n=i:(o.push(i),e(i).data("cycle.opts").slideNum=c,c++);n&&(s.slides=e(o),s.slideCount--,e(n).remove(),t==s.currSlide?s.API.advanceSlide(1):s.currSlide>t?s.currSlide--:s.currSlide++,s.API.trigger("cycle-slide-removed",[s,t,n]).log("cycle-slide-removed"),s.API.updateView())}}),e(document).on("click.cycle","[data-cycle-cmd]",function(t){t.preventDefault();var i=e(this),n=i.data("cycle-cmd"),s=i.data("cycle-context")||".cycle-slideshow";e(s).cycle(n,i.data("cycle-arg"))})}(jQuery),/*! hash plugin for Cycle2; version: 20130905 */
11
+ function(e){"use strict";function t(t,i){var n;return t._hashFence?(t._hashFence=!1,void 0):(n=window.location.hash.substring(1),t.slides.each(function(s){if(e(this).data("cycle-hash")==n){if(i===!0)t.startingSlide=s;else{var o=s>t.currSlide;t.nextSlide=s,t.API.prepareTx(!0,o)}return!1}}),void 0)}e(document).on("cycle-pre-initialize",function(i,n){t(n,!0),n._onHashChange=function(){t(n,!1)},e(window).on("hashchange",n._onHashChange)}),e(document).on("cycle-update-view",function(e,t,i){i.hash&&"#"+i.hash!=window.location.hash&&(t._hashFence=!0,window.location.hash=i.hash)}),e(document).on("cycle-destroyed",function(t,i){i._onHashChange&&e(window).off("hashchange",i._onHashChange)})}(jQuery),/*! loader plugin for Cycle2; version: 20131020 */
12
+ function(e){"use strict";e.extend(e.fn.cycle.defaults,{loader:!1}),e(document).on("cycle-bootstrap",function(t,i){function n(t,n){function o(t){var o;"wait"==i.loader?(r.push(t),0===a&&(r.sort(c),s.apply(i.API,[r,n]),i.container.removeClass("cycle-loading"))):(o=e(i.slides[i.currSlide]),s.apply(i.API,[t,n]),o.show(),i.container.removeClass("cycle-loading"))}function c(e,t){return e.data("index")-t.data("index")}var r=[];if("string"==e.type(t))t=e.trim(t);else if("array"===e.type(t))for(var l=0;t.length>l;l++)t[l]=e(t[l])[0];t=e(t);var a=t.length;a&&(i.eventualSlideCount=i.slideCount+a,t.hide().appendTo("body").each(function(t){function c(){0===--l&&(--a,o(d))}var l=0,d=e(this),u=d.is("img")?d:d.find("img");return d.data("index",t),u=u.filter(":not(.cycle-loader-ignore)").filter(':not([src=""])'),u.length?(l=u.length,u.each(function(){this.complete?c():e(this).load(function(){c()}).error(function(){0===--l&&(i.API.log("slide skipped; img not loaded:",this.src),0===--a&&"wait"==i.loader&&s.apply(i.API,[r,n]))})}),void 0):(--a,r.push(d),void 0)}),a&&i.container.addClass("cycle-loading"))}var s;i.loader&&(s=i.API.add,i.API.add=n)})}(jQuery),/*! pager plugin for Cycle2; version: 20130525 */
13
+ function(e){"use strict";function t(t,i,n){var s,o=t.API.getComponent("pager");o.each(function(){var o=e(this);if(i.pagerTemplate){var c=t.API.tmpl(i.pagerTemplate,i,t,n[0]);s=e(c).appendTo(o)}else s=o.children().eq(t.slideCount-1);s.on(t.pagerEvent,function(e){e.preventDefault(),t.API.page(o,e.currentTarget)})})}function i(e,t){var i=this.opts();if(!i.busy||i.manualTrump){var n=e.children().index(t),s=n,o=s>i.currSlide;i.currSlide!=s&&(i.nextSlide=s,i.API.prepareTx(!0,o),i.API.trigger("cycle-pager-activated",[i,e,t]))}}e.extend(e.fn.cycle.defaults,{pager:"> .cycle-pager",pagerActiveClass:"cycle-pager-active",pagerEvent:"click.cycle",pagerTemplate:"<span>&bull;</span>"}),e(document).on("cycle-bootstrap",function(e,i,n){n.buildPagerLink=t}),e(document).on("cycle-slide-added",function(e,t,n,s){t.pager&&(t.API.buildPagerLink(t,n,s),t.API.page=i)}),e(document).on("cycle-slide-removed",function(t,i,n){if(i.pager){var s=i.API.getComponent("pager");s.each(function(){var t=e(this);e(t.children()[n]).remove()})}}),e(document).on("cycle-update-view",function(t,i){var n;i.pager&&(n=i.API.getComponent("pager"),n.each(function(){e(this).children().removeClass(i.pagerActiveClass).eq(i.currSlide).addClass(i.pagerActiveClass)}))}),e(document).on("cycle-destroyed",function(e,t){var i=t.API.getComponent("pager");i&&(i.children().off(t.pagerEvent),t.pagerTemplate&&i.empty())})}(jQuery),/*! prevnext plugin for Cycle2; version: 20130709 */
14
+ function(e){"use strict";e.extend(e.fn.cycle.defaults,{next:"> .cycle-next",nextEvent:"click.cycle",disabledClass:"disabled",prev:"> .cycle-prev",prevEvent:"click.cycle",swipe:!1}),e(document).on("cycle-initialized",function(e,t){if(t.API.getComponent("next").on(t.nextEvent,function(e){e.preventDefault(),t.API.next()}),t.API.getComponent("prev").on(t.prevEvent,function(e){e.preventDefault(),t.API.prev()}),t.swipe){var i=t.swipeVert?"swipeUp.cycle":"swipeLeft.cycle swipeleft.cycle",n=t.swipeVert?"swipeDown.cycle":"swipeRight.cycle swiperight.cycle";t.container.on(i,function(){t.API.next()}),t.container.on(n,function(){t.API.prev()})}}),e(document).on("cycle-update-view",function(e,t){if(!t.allowWrap){var i=t.disabledClass,n=t.API.getComponent("next"),s=t.API.getComponent("prev"),o=t._prevBoundry||0,c=void 0!==t._nextBoundry?t._nextBoundry:t.slideCount-1;t.currSlide==c?n.addClass(i).prop("disabled",!0):n.removeClass(i).prop("disabled",!1),t.currSlide===o?s.addClass(i).prop("disabled",!0):s.removeClass(i).prop("disabled",!1)}}),e(document).on("cycle-destroyed",function(e,t){t.API.getComponent("prev").off(t.nextEvent),t.API.getComponent("next").off(t.prevEvent),t.container.off("swipeleft.cycle swiperight.cycle swipeLeft.cycle swipeRight.cycle swipeUp.cycle swipeDown.cycle")})}(jQuery),/*! progressive loader plugin for Cycle2; version: 20130315 */
15
+ function(e){"use strict";e.extend(e.fn.cycle.defaults,{progressive:!1}),e(document).on("cycle-pre-initialize",function(t,i){if(i.progressive){var n,s,o=i.API,c=o.next,r=o.prev,l=o.prepareTx,a=e.type(i.progressive);if("array"==a)n=i.progressive;else if(e.isFunction(i.progressive))n=i.progressive(i);else if("string"==a){if(s=e(i.progressive),n=e.trim(s.html()),!n)return;if(/^(\[)/.test(n))try{n=e.parseJSON(n)}catch(d){return o.log("error parsing progressive slides",d),void 0}else n=n.split(RegExp(s.data("cycle-split")||"\n")),n[n.length-1]||n.pop()}l&&(o.prepareTx=function(e,t){var s,o;return e||0===n.length?(l.apply(i.API,[e,t]),void 0):(t&&i.currSlide==i.slideCount-1?(o=n[0],n=n.slice(1),i.container.one("cycle-slide-added",function(e,t){setTimeout(function(){t.API.advanceSlide(1)},50)}),i.API.add(o)):t||0!==i.currSlide?l.apply(i.API,[e,t]):(s=n.length-1,o=n[s],n=n.slice(0,s),i.container.one("cycle-slide-added",function(e,t){setTimeout(function(){t.currSlide=1,t.API.advanceSlide(-1)},50)}),i.API.add(o,!0)),void 0)}),c&&(o.next=function(){var e=this.opts();if(n.length&&e.currSlide==e.slideCount-1){var t=n[0];n=n.slice(1),e.container.one("cycle-slide-added",function(e,t){c.apply(t.API),t.container.removeClass("cycle-loading")}),e.container.addClass("cycle-loading"),e.API.add(t)}else c.apply(e.API)}),r&&(o.prev=function(){var e=this.opts();if(n.length&&0===e.currSlide){var t=n.length-1,i=n[t];n=n.slice(0,t),e.container.one("cycle-slide-added",function(e,t){t.currSlide=1,t.API.advanceSlide(-1),t.container.removeClass("cycle-loading")}),e.container.addClass("cycle-loading"),e.API.add(i,!0)}else r.apply(e.API)})}})}(jQuery),/*! tmpl plugin for Cycle2; version: 20121227 */
16
+ function(e){"use strict";e.extend(e.fn.cycle.defaults,{tmplRegex:"{{((.)?.*?)}}"}),e.extend(e.fn.cycle.API,{tmpl:function(t,i){var n=RegExp(i.tmplRegex||e.fn.cycle.defaults.tmplRegex,"g"),s=e.makeArray(arguments);return s.shift(),t.replace(n,function(t,i){var n,o,c,r,l=i.split(".");for(n=0;s.length>n;n++)if(c=s[n]){if(l.length>1)for(r=c,o=0;l.length>o;o++)c=r,r=r[l[o]]||i;else r=c[i];if(e.isFunction(r))return r.apply(c,s);if(void 0!==r&&null!==r&&r!=i)return r}return i})}})}(jQuery);
skin/frontend/base/default/js/lib/jquery.cycle2.swipe.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! Plugin for Cycle2; Copyright (c) 2012 M. Alsup; ver: 20121120 */
2
+ (function(a){"use strict";var b="ontouchend"in document;a.event.special.swipe=a.event.special.swipe||{scrollSupressionThreshold:10,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:75,setup:function(){var b=a(this);b.bind("touchstart",function(c){function g(b){if(!f)return;var c=b.originalEvent.touches?b.originalEvent.touches[0]:b;e={time:(new Date).getTime(),coords:[c.pageX,c.pageY]},Math.abs(f.coords[0]-e.coords[0])>a.event.special.swipe.scrollSupressionThreshold&&b.preventDefault()}var d=c.originalEvent.touches?c.originalEvent.touches[0]:c,e,f={time:(new Date).getTime(),coords:[d.pageX,d.pageY],origin:a(c.target)};b.bind("touchmove",g).one("touchend",function(c){b.unbind("touchmove",g),f&&e&&e.time-f.time<a.event.special.swipe.durationThreshold&&Math.abs(f.coords[0]-e.coords[0])>a.event.special.swipe.horizontalDistanceThreshold&&Math.abs(f.coords[1]-e.coords[1])<a.event.special.swipe.verticalDistanceThreshold&&f.origin.trigger("swipe").trigger(f.coords[0]>e.coords[0]?"swipeleft":"swiperight"),f=e=undefined})})}},a.event.special.swipeleft=a.event.special.swipeleft||{setup:function(){a(this).bind("swipe",a.noop)}},a.event.special.swiperight=a.event.special.swiperight||a.event.special.swipeleft})(jQuery);
var/logs_qixol/logs_here.txt ADDED
@@ -0,0 +1 @@
 
1
+