Ewave_Quicksales - Version 1.3.3

Version Notes

Quicksales Integration

Download this release

Release Info

Developer Fatima Said
Extension Ewave_Quicksales
Version 1.3.3
Comparing to
See all releases


Version 1.3.3

Files changed (174) hide show
  1. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing.php +21 -0
  2. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit.php +213 -0
  3. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/.Attributes.php.swp +0 -0
  4. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/.Step1.php.swo +0 -0
  5. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/.Step1.php.swp +0 -0
  6. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step1.php +72 -0
  7. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step1/Grid.php +304 -0
  8. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step1/Grid/Renderer/Checkbox.php +27 -0
  9. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step1/Renderer/Status.php +41 -0
  10. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step2.php +30 -0
  11. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step2/Depended.php +431 -0
  12. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step2/Renderer/Category.php +67 -0
  13. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step2/Renderer/Depended.php +48 -0
  14. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step2/Renderer/Vshopcategory.php +42 -0
  15. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step3.php +38 -0
  16. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step3/Attributes.php +97 -0
  17. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Attributes.php +150 -0
  18. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tabs.php +273 -0
  19. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Grid.php +166 -0
  20. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Log.php +21 -0
  21. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Log/.Grid.php.swp +0 -0
  22. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Log/Grid.php +111 -0
  23. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Product/Log.php +21 -0
  24. app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Product/Log/Grid.php +109 -0
  25. app/code/community/Ewave/Quicksales/Block/Adminhtml/Log.php +27 -0
  26. app/code/community/Ewave/Quicksales/Block/Adminhtml/Log/Grid.php +124 -0
  27. app/code/community/Ewave/Quicksales/Block/Adminhtml/Log/Grid/Column/Renderer/Action.php +21 -0
  28. app/code/community/Ewave/Quicksales/Block/Adminhtml/Sales/Order/Payment/Info.php +17 -0
  29. app/code/community/Ewave/Quicksales/Block/Adminhtml/Sales/Order/View/Tab/Quicksales.php +61 -0
  30. app/code/community/Ewave/Quicksales/Block/Adminhtml/System/Config/Form/Field/Datetime.php +24 -0
  31. app/code/community/Ewave/Quicksales/Block/Adminhtml/System/Config/Form/Field/Description.php +14 -0
  32. app/code/community/Ewave/Quicksales/Block/Adminhtml/System/Config/Form/Field/Gst.php +30 -0
  33. app/code/community/Ewave/Quicksales/Block/RW/Adminhtml/Sales/Order/Grid.php +37 -0
  34. app/code/community/Ewave/Quicksales/Block/RW/Adminhtml/Sales/Order/Payment.php +28 -0
  35. app/code/community/Ewave/Quicksales/Block/RW/Adminhtml/Sales/Order/View.php +32 -0
  36. app/code/community/Ewave/Quicksales/Block/RW/Adminhtml/Sales/Order/View/Tab/Info.php +22 -0
  37. app/code/community/Ewave/Quicksales/CatalogInventory/Model/Resource/Stock.php +73 -0
  38. app/code/community/Ewave/Quicksales/CatalogInventory/Model/Stock/Item.php +54 -0
  39. app/code/community/Ewave/Quicksales/Helper/Data.php +141 -0
  40. app/code/community/Ewave/Quicksales/Helper/Listing.php +49 -0
  41. app/code/community/Ewave/Quicksales/Model/Api.php +172 -0
  42. app/code/community/Ewave/Quicksales/Model/Api/Abstract.php +28 -0
  43. app/code/community/Ewave/Quicksales/Model/Api/Action.php +161 -0
  44. app/code/community/Ewave/Quicksales/Model/Api/Client.php +139 -0
  45. app/code/community/Ewave/Quicksales/Model/Api/Createitem.php +570 -0
  46. app/code/community/Ewave/Quicksales/Model/Api/Getcategories.php +111 -0
  47. app/code/community/Ewave/Quicksales/Model/Api/Getitem.php +140 -0
  48. app/code/community/Ewave/Quicksales/Model/Api/Getorders.php +585 -0
  49. app/code/community/Ewave/Quicksales/Model/Api/Gettags.php +119 -0
  50. app/code/community/Ewave/Quicksales/Model/Api/Getvshopcategory.php +58 -0
  51. app/code/community/Ewave/Quicksales/Model/Api/Sendinvoice.php +204 -0
  52. app/code/community/Ewave/Quicksales/Model/Api/Updateorder.php +126 -0
  53. app/code/community/Ewave/Quicksales/Model/Attribute/Backend/Multiselect.php +37 -0
  54. app/code/community/Ewave/Quicksales/Model/Catalog/Resource/Product/Type/Configurable/Attribute/Collection.php +56 -0
  55. app/code/community/Ewave/Quicksales/Model/Entity/Setup.php +118 -0
  56. app/code/community/Ewave/Quicksales/Model/Listing.php +119 -0
  57. app/code/community/Ewave/Quicksales/Model/Listing/Action.php +38 -0
  58. app/code/community/Ewave/Quicksales/Model/Listing/Associated/Attribute.php +11 -0
  59. app/code/community/Ewave/Quicksales/Model/Listing/Associated/Attribute/Value.php +11 -0
  60. app/code/community/Ewave/Quicksales/Model/Listing/Attribute/Backend/Listing.php +31 -0
  61. app/code/community/Ewave/Quicksales/Model/Listing/Attribute/Backend/Listingupgrade.php +31 -0
  62. app/code/community/Ewave/Quicksales/Model/Listing/Attribute/Backend/Payment.php +31 -0
  63. app/code/community/Ewave/Quicksales/Model/Listing/Attribute/Backend/Pricing.php +31 -0
  64. app/code/community/Ewave/Quicksales/Model/Listing/Attribute/Backend/Shipping.php +31 -0
  65. app/code/community/Ewave/Quicksales/Model/Listing/Log.php +17 -0
  66. app/code/community/Ewave/Quicksales/Model/Listing/Product.php +18 -0
  67. app/code/community/Ewave/Quicksales/Model/Listing/Product/Log.php +18 -0
  68. app/code/community/Ewave/Quicksales/Model/Mysql4/Listing.php +16 -0
  69. app/code/community/Ewave/Quicksales/Model/Mysql4/Listing/Collection.php +19 -0
  70. app/code/community/Ewave/Quicksales/Model/Observer.php +206 -0
  71. app/code/community/Ewave/Quicksales/Model/Payment/Method/Quicksales.php +10 -0
  72. app/code/community/Ewave/Quicksales/Model/RW/Sales/Order/Shipment.php +31 -0
  73. app/code/community/Ewave/Quicksales/Model/Resource/Listing.php +21 -0
  74. app/code/community/Ewave/Quicksales/Model/Resource/Listing/Associated/Attribute.php +11 -0
  75. app/code/community/Ewave/Quicksales/Model/Resource/Listing/Associated/Attribute/Collection.php +12 -0
  76. app/code/community/Ewave/Quicksales/Model/Resource/Listing/Associated/Attribute/Value.php +16 -0
  77. app/code/community/Ewave/Quicksales/Model/Resource/Listing/Associated/Attribute/Value/Collection.php +19 -0
  78. app/code/community/Ewave/Quicksales/Model/Resource/Listing/Collection.php +22 -0
  79. app/code/community/Ewave/Quicksales/Model/Resource/Listing/Log.php +16 -0
  80. app/code/community/Ewave/Quicksales/Model/Resource/Listing/Log/Collection.php +19 -0
  81. app/code/community/Ewave/Quicksales/Model/Resource/Listing/Product.php +16 -0
  82. app/code/community/Ewave/Quicksales/Model/Resource/Listing/Product/Collection.php +19 -0
  83. app/code/community/Ewave/Quicksales/Model/Resource/Listing/Product/Log.php +16 -0
  84. app/code/community/Ewave/Quicksales/Model/Resource/Listing/Product/Log/Collection.php +19 -0
  85. app/code/community/Ewave/Quicksales/Model/Source/Getcategories.php +25 -0
  86. app/code/community/Ewave/Quicksales/Model/Source/Payments.php +50 -0
  87. app/code/community/Ewave/Quicksales/Model/Source/Posttolocation.php +38 -0
  88. app/code/community/Ewave/Quicksales/Model/Source/Shipping.php +45 -0
  89. app/code/community/Ewave/Quicksales/Model/Source/Vshopcategory.php +62 -0
  90. app/code/community/Ewave/Quicksales/Model/System/Autorelist.php +26 -0
  91. app/code/community/Ewave/Quicksales/Model/System/Custom.php +26 -0
  92. app/code/community/Ewave/Quicksales/Model/System/Customer/Import.php +25 -0
  93. app/code/community/Ewave/Quicksales/Model/System/Description.php +27 -0
  94. app/code/community/Ewave/Quicksales/Model/System/Duration.php +30 -0
  95. app/code/community/Ewave/Quicksales/Model/System/Payment/Method.php +35 -0
  96. app/code/community/Ewave/Quicksales/Model/System/Price.php +33 -0
  97. app/code/community/Ewave/Quicksales/Model/System/Price/Custom.php +26 -0
  98. app/code/community/Ewave/Quicksales/Model/System/Qty.php +26 -0
  99. app/code/community/Ewave/Quicksales/Model/System/Shipping/Method.php +31 -0
  100. app/code/community/Ewave/Quicksales/Model/System/Shipping/Package.php +26 -0
  101. app/code/community/Ewave/Quicksales/Model/System/Shipping/Posttolocation.php +29 -0
  102. app/code/community/Ewave/Quicksales/controllers/Adminhtml/ListingController.php +531 -0
  103. app/code/community/Ewave/Quicksales/controllers/Adminhtml/LogController.php +31 -0
  104. app/code/community/Ewave/Quicksales/controllers/Adminhtml/OrderController.php +39 -0
  105. app/code/community/Ewave/Quicksales/controllers/IndexController.php +18 -0
  106. app/code/community/Ewave/Quicksales/etc/adminhtml.xml +46 -0
  107. app/code/community/Ewave/Quicksales/etc/config.xml +281 -0
  108. app/code/community/Ewave/Quicksales/etc/system.xml +785 -0
  109. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-install-1.0.0.php +46 -0
  110. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.0.0-1.1.0.php +28 -0
  111. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.1.0-1.2.0.php +28 -0
  112. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.0-1.2.1.php +28 -0
  113. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.1-1.2.2.php +32 -0
  114. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.10-1.2.11.php +34 -0
  115. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.11-1.2.12.php +34 -0
  116. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.12-1.2.13.php +15 -0
  117. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.13-1.2.14.php +38 -0
  118. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.14-1.2.15.php +30 -0
  119. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.15-1.2.16.php +15 -0
  120. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.17-1.2.18.php +24 -0
  121. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.18-1.2.19.php +15 -0
  122. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.19-1.2.20.php +15 -0
  123. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.2-1.2.3.php +54 -0
  124. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.22-1.2.23.php +16 -0
  125. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.23-1.2.24.php +54 -0
  126. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.24-1.2.25.php +16 -0
  127. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.25-1.2.26.php +29 -0
  128. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.26-1.2.27.php +15 -0
  129. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.27-1.2.28.php +41 -0
  130. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.28-1.2.29.php +21 -0
  131. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.29-1.2.30.php +11 -0
  132. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.3-1.2.4.php +182 -0
  133. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.30-1.2.31.php +14 -0
  134. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.31-1.2.32.php +14 -0
  135. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.32-1.2.33.php +14 -0
  136. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.33-1.3.1.php +21 -0
  137. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.4-1.2.5.php +30 -0
  138. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.5-1.2.6.php +17 -0
  139. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.6-1.2.7.php +33 -0
  140. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.7-1.2.8.php +36 -0
  141. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.8-1.2.9.php +34 -0
  142. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.9-1.2.10.php +31 -0
  143. app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.3.1-1.3.2.php +15 -0
  144. app/code/community/Ewave/Quicksales/xml/CreateItem_Request.xml +43 -0
  145. app/code/community/Ewave/Quicksales/xml/GetCategoriesWithTags_Request.xml +2 -0
  146. app/code/community/Ewave/Quicksales/xml/GetCategories_Request.xml +2 -0
  147. app/code/community/Ewave/Quicksales/xml/GetCategoryChanges_Request.xml +2 -0
  148. app/code/community/Ewave/Quicksales/xml/GetCategoryVersion_Request.xml +2 -0
  149. app/code/community/Ewave/Quicksales/xml/GetFeeList_Request.xml +2 -0
  150. app/code/community/Ewave/Quicksales/xml/GetItemIDByRefID_Request.xml +4 -0
  151. app/code/community/Ewave/Quicksales/xml/GetItem_Request.xml +9 -0
  152. app/code/community/Ewave/Quicksales/xml/GetListingAndItemIDs_Request.xml +7 -0
  153. app/code/community/Ewave/Quicksales/xml/GetOrders_Request.xml +8 -0
  154. app/code/community/Ewave/Quicksales/xml/GetTagsVersion_Request.xml +2 -0
  155. app/code/community/Ewave/Quicksales/xml/GetTags_Request.xml +4 -0
  156. app/code/community/Ewave/Quicksales/xml/GetvShopCategories_Request.xml +4 -0
  157. app/code/community/Ewave/Quicksales/xml/LeaveRating_Request.xml +11 -0
  158. app/code/community/Ewave/Quicksales/xml/ReviseItem_Request.xml +32 -0
  159. app/code/community/Ewave/Quicksales/xml/SendInvoice_Request.xml +37 -0
  160. app/code/community/Ewave/Quicksales/xml/UpdateMakeAnOffer_Request.xml +8 -0
  161. app/code/community/Ewave/Quicksales/xml/UpdateOrder_Request.xml +8 -0
  162. app/design/adminhtml/default/default/layout/quicksales.xml +90 -0
  163. app/design/adminhtml/default/default/template/quicksales/listing/edit.phtml +196 -0
  164. app/design/adminhtml/default/default/template/quicksales/listing/edit/tab/additional/step1.phtml +66 -0
  165. app/design/adminhtml/default/default/template/quicksales/listing/edit/tab/additional/step2.phtml +5 -0
  166. app/design/adminhtml/default/default/template/quicksales/listing/edit/tab/additional/step3.phtml +7 -0
  167. app/design/adminhtml/default/default/template/quicksales/listing/edit/tab/additional/step3/attributes.phtml +65 -0
  168. app/design/adminhtml/default/default/template/quicksales/sales/order/payment/info.phtml +1 -0
  169. app/design/adminhtml/default/default/template/quicksales/sales/order/view/tab/quicksales.phtml +59 -0
  170. app/etc/modules/Ewave_Quicksales.xml +15 -0
  171. js/quicksales/adminhtml/categories.js +74 -0
  172. js/quicksales/adminhtml/listing.js +206 -0
  173. package.xml +35 -0
  174. skin/adminhtml/default/default/quicksales/css/quicksales.css +3 -0
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 15:06
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing extends Mage_Adminhtml_Block_Widget_Grid_Container {
11
+
12
+ public function __construct()
13
+ {
14
+ $this->_controller = 'adminhtml_listing';
15
+ $this->_blockGroup = 'quicksales';
16
+ $this->_headerText = Mage::helper('quicksales')->__('Listings');
17
+ $this->_addButtonLabel = Mage::helper('quicksales')->__('Add new Listing');
18
+ parent::__construct();
19
+ }
20
+
21
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 14:15
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit extends Mage_Adminhtml_Block_Widget
11
+ {
12
+ public function __construct()
13
+ {
14
+ parent::__construct();
15
+ $this->setTemplate('quicksales/listing/edit.phtml');
16
+ $this->setId('listing_edit');
17
+ }
18
+
19
+ /**
20
+ * Retrieve currently edited product object
21
+ *
22
+ * @return Mage_Catalog_Model_Product
23
+ */
24
+ public function getListing()
25
+ {
26
+ return Mage::registry('current_listing');
27
+ }
28
+
29
+ protected function _prepareLayout()
30
+ {
31
+
32
+ $this->setChild('back_button',
33
+ $this->getLayout()
34
+ ->createBlock('adminhtml/widget_button')
35
+ ->setData(array(
36
+ 'label' => Mage::helper('quicksales')->__('Back'),
37
+ 'onclick' => 'setLocation(\'' . $this->getUrl('*/*/') . '\')',
38
+ 'class' => 'back'
39
+ ))
40
+ );
41
+
42
+
43
+ $this->setChild('save_button',
44
+ $this->getLayout()
45
+ ->createBlock('adminhtml/widget_button')
46
+ ->setData(array(
47
+ 'label' => Mage::helper('quicksales')->__('Save'),
48
+ 'onclick' => 'listingForm.submit()',
49
+ 'class' => 'save'
50
+ ))
51
+ );
52
+
53
+
54
+ $this->setChild('save_and_edit_button',
55
+ $this->getLayout()
56
+ ->createBlock('adminhtml/widget_button')
57
+ ->setData(array(
58
+ 'label' => Mage::helper('quicksales')->__('Save and Upload'),
59
+ 'onclick' => 'saveAndContinueEdit(\'' . $this->getSaveAndContinueUrl() . '\')',
60
+ 'class' => 'save'
61
+ ))
62
+ );
63
+
64
+
65
+ $this->setChild('delete_button',
66
+ $this->getLayout()
67
+ ->createBlock('adminhtml/widget_button')
68
+ ->setData(array(
69
+ 'label' => Mage::helper('quicksales')->__('Delete'),
70
+ 'onclick' => 'confirmSetLocation(\'' . Mage::helper('catalog')->__('Are you sure?') . '\', \'' . $this->getDeleteUrl() . '\')',
71
+ 'class' => 'delete'
72
+ ))
73
+ );
74
+
75
+
76
+ $this->setChild('previous_button',
77
+ $this->getLayout()
78
+ ->createBlock('adminhtml/widget_button')
79
+ ->setData(array(
80
+ 'label' => Mage::helper('quicksales')->__('Previous Step'),
81
+ 'onclick' => 'previousTab()',
82
+ 'id' => 'previousTab',
83
+ ))
84
+ );
85
+
86
+ $this->setChild('next_button',
87
+ $this->getLayout()
88
+ ->createBlock('adminhtml/widget_button')
89
+ ->setData(array(
90
+ 'label' => Mage::helper('quicksales')->__('Next Step'),
91
+ 'onclick' => 'nextTab()',
92
+ 'id' => 'nextTab',
93
+ ))
94
+ );
95
+
96
+ return parent::_prepareLayout();
97
+ }
98
+
99
+ public function getBackButtonHtml()
100
+ {
101
+ return $this->getChildHtml('back_button');
102
+ }
103
+
104
+ public function getCancelButtonHtml()
105
+ {
106
+ return $this->getChildHtml('reset_button');
107
+ }
108
+
109
+ public function getSaveButtonHtml()
110
+ {
111
+ return $this->getChildHtml('save_button');
112
+ }
113
+
114
+ public function getSaveAndEditButtonHtml()
115
+ {
116
+ return $this->getChildHtml('save_and_edit_button');
117
+ }
118
+
119
+ public function getDeleteButtonHtml()
120
+ {
121
+ return $this->getChildHtml('delete_button');
122
+ }
123
+
124
+ public function getDuplicateButtonHtml()
125
+ {
126
+ return $this->getChildHtml('duplicate_button');
127
+ }
128
+
129
+ public function getPreviousButtonHtml()
130
+ {
131
+ return $this->getChildHtml('previous_button');
132
+ }
133
+
134
+ public function getNextButtonHtml()
135
+ {
136
+ return $this->getChildHtml('next_button');
137
+ }
138
+
139
+ public function getValidationUrl()
140
+ {
141
+ return $this->getUrl('*/*/validate', array('_current' => true));
142
+ }
143
+
144
+ public function getSaveUrl()
145
+ {
146
+ return $this->getUrl('*/*/save', array('_current' => true, 'back' => null));
147
+ }
148
+
149
+ public function getSaveAndContinueUrl()
150
+ {
151
+ return $this->getUrl('*/*/save', array(
152
+ '_current' => true,
153
+ 'back' => 'edit',
154
+ 'tab' => '{{tab_id}}',
155
+ 'active_tab' => null
156
+ ));
157
+ }
158
+
159
+ public function getProductId()
160
+ {
161
+ return $this->getListing()->getId();
162
+ }
163
+
164
+ public function getListingSetId()
165
+ {
166
+ $setId = false;
167
+ if (!($setId = $this->getListing()->getAttributeSetId()) && $this->getRequest()) {
168
+ $setId = $this->getRequest()->getParam('set', null);
169
+ }
170
+ return $setId;
171
+ }
172
+
173
+ public function getDeleteUrl()
174
+ {
175
+ return $this->getUrl('*/*/delete', array('_current' => true));
176
+ }
177
+
178
+ public function getDuplicateUrl()
179
+ {
180
+ return $this->getUrl('*/*/duplicate', array('_current' => true));
181
+ }
182
+
183
+ public function getHeader()
184
+ {
185
+ $header = '';
186
+ if ($this->getListing()->getId()) {
187
+ $header = $this->htmlEscape($this->getListing()->getName());
188
+ }
189
+ else {
190
+ $header = Mage::helper('quicksales')->__('New Listing');
191
+ }
192
+ if ($setName = $this->getAttributeSetName()) {
193
+ $header .= ' (' . $setName . ')';
194
+ }
195
+ return $header;
196
+ }
197
+
198
+ public function getAttributeSetName()
199
+ {
200
+ if ($setId = $this->getListing()->getAttributeSetId()) {
201
+ $set = Mage::getModel('eav/entity_attribute_set')
202
+ ->load($setId);
203
+ return $set->getAttributeSetName();
204
+ }
205
+ return '';
206
+ }
207
+
208
+ public function getSelectedTabId()
209
+ {
210
+ return addslashes(htmlspecialchars($this->getRequest()->getParam('tab')));
211
+ }
212
+
213
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/.Attributes.php.swp ADDED
Binary file
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/.Step1.php.swo ADDED
Binary file
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/.Step1.php.swp ADDED
Binary file
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step1.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: Admin
5
+ * Date: 25.09.11
6
+ * Time: 19:00
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tab_Additional_Step1 extends Mage_Adminhtml_Block_Widget {
11
+
12
+ protected $_assignedProducts = null;
13
+
14
+ public function __construct()
15
+ {
16
+ parent::__construct();
17
+ $this->setTemplate('quicksales/listing/edit/tab/additional/step1.phtml');
18
+ $this->setId('listing_edit');
19
+ }
20
+
21
+ protected function _prepareLayout()
22
+ {
23
+ $this->setChild('quicksales_product_grid',
24
+ $this->getLayout()->createBlock('quicksales/adminhtml_listing_edit_tab_additional_step1_grid',
25
+ 'quicksales_product_grid')
26
+ );
27
+ }
28
+
29
+
30
+ public function getGridJsObject()
31
+ {
32
+ return $this->getChild('quicksales_product_grid')->getJsObjectName();
33
+ }
34
+
35
+ public function getAssignedProductsJson() {
36
+
37
+ $jsonProducts = array();
38
+ foreach ($this->getAssignedProducts() as $product) {
39
+ $jsonProducts[$product->getId()] = array(
40
+ 'id' => $product->getId(),
41
+ 'name' => $product->getName()
42
+ );
43
+ }
44
+
45
+ if (empty($jsonProducts)) {
46
+ return '{}';
47
+ }
48
+
49
+ return Mage::helper('core')->jsonEncode($jsonProducts);
50
+ }
51
+
52
+ public function getListing()
53
+ {
54
+ return Mage::registry('current_listing');
55
+ }
56
+
57
+ public function getAssignedProducts() {
58
+
59
+ if ($this->_assignedProducts == null) {
60
+ $listing = $this->getListing();
61
+ $this->_assignedProducts = $listing->getAssignedProducts();
62
+
63
+ $this->_assignedProducts->joinField('qlisting_id',
64
+ 'quicksales/listing_product',
65
+ 'quicksale_listing_id',
66
+ 'product_id=entity_id',
67
+ '{{table}}.listing_id="' . $listing->getId() . '"',
68
+ 'inner');
69
+ }
70
+ return $this->_assignedProducts;
71
+ }
72
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step1/Grid.php ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml super product links grid
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tab_Additional_Step1_Grid extends Mage_Adminhtml_Block_Widget_Grid
35
+ {
36
+
37
+ public function __construct()
38
+ {
39
+ parent::__construct();
40
+ $this->setUseAjax(true);
41
+ $this->setId('products_grid');
42
+
43
+ if ($this->_getListing()->getId()) {
44
+ $this->setDefaultFilter(array('in_listing'=>1));
45
+ }
46
+ }
47
+
48
+ protected function _getListing()
49
+ {
50
+ return Mage::registry('current_listing');
51
+ }
52
+
53
+ protected function _addColumnFilterToCollection($column)
54
+ {
55
+ // Set custom filter for in product flag
56
+ if ($column->getId() == 'in_listing') {
57
+ $productIds = $this->_getSelectedProducts();
58
+
59
+ if (empty($productIds)) {
60
+ $productIds = 0;
61
+ }
62
+
63
+ // $createdProducts = $this->_getCreatedProducts();
64
+
65
+ $existsProducts = $productIds; // Only for "Yes" Filter we will add created products
66
+
67
+ if(count($createdProducts)>0) {
68
+ if(!is_array($existsProducts)) {
69
+ $existsProducts = $createdProducts;
70
+ } else {
71
+ $existsProducts = array_merge($createdProducts);
72
+ }
73
+ }
74
+
75
+ if ($column->getFilter()->getValue()) {
76
+ $this->getCollection()->addFieldToFilter('entity_id', array('in'=>$existsProducts));
77
+ }
78
+ else {
79
+ if($productIds) {
80
+ $this->getCollection()->addFieldToFilter('entity_id', array('nin'=>$productIds));
81
+ }
82
+ }
83
+ }
84
+ else {
85
+ parent::_addColumnFilterToCollection($column);
86
+ }
87
+ return $this;
88
+ }
89
+
90
+ public function getRowClass($row) {
91
+ $listing = $this->_getListing();
92
+ $class = 'invalid pointer';
93
+
94
+ $assignedProducts = Mage::getResourceModel('quicksales/listing_product_collection');
95
+ $assignedProducts->addFieldToFilter('listing_id', $listing->getId());
96
+ $assignedProducts->addFieldToFilter('product_id', $row->getEntityId());
97
+
98
+ if (!empty($assignedProducts)) {
99
+ return $class;
100
+ } else {
101
+ return parent::getRowClass($row);
102
+ }
103
+ }
104
+ /*
105
+ protected function _getCreatedProducts()
106
+ {
107
+ $products = $this->getRequest()->getPost('new_products', null);
108
+ if (!is_array($products)) {
109
+ $products = array();
110
+ }
111
+
112
+ return $products;
113
+ }
114
+ */
115
+ /**
116
+ * Prepare collection
117
+ *
118
+ * @return Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config_Grid
119
+ */
120
+ protected function _prepareCollection()
121
+ {
122
+ $listing = $this->_getListing();
123
+ $collection = Mage::getModel('catalog/product')->getCollection()
124
+ ->addAttributeToSelect('name')
125
+ ->addAttributeToSelect('sku')
126
+ ->addAttributeToSelect('attribute_set_id')
127
+ ->addAttributeToSelect('type_id')
128
+ ->addAttributeToSelect('price')
129
+ // ->addFieldToFilter('attribute_set_id',$listing->getAttributeSetId())
130
+ //->addFilterByRequiredOptions()
131
+ ->joinAttribute('name', 'catalog_product/name', 'entity_id', null, 'inner');
132
+
133
+ if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
134
+ Mage::getModel('cataloginventory/stock_item')->addCatalogInventoryToProductCollection($collection);
135
+ }
136
+
137
+ /*
138
+ foreach ($listing->getTypeInstance(true)->getUsedProductAttributes($product) as $attribute) {
139
+ $collection->addAttributeToSelect($attribute->getAttributeCode());
140
+ $collection->addAttributeToFilter($attribute->getAttributeCode(), array('notnull'=>1));
141
+ }
142
+ */
143
+
144
+ $this->setCollection($collection);
145
+
146
+ if ($this->isReadonly()) {
147
+ //$collection->addFieldToFilter('entity_id', array('in' => $this->_getSelectedProducts()));
148
+ }
149
+
150
+ parent::_prepareCollection();
151
+ return $this;
152
+ }
153
+
154
+ protected function _getSelectedProducts()
155
+ {
156
+ $products = $this->getRequest()->getPost('products', null);
157
+
158
+ if (!is_array($products)) {
159
+ $listing = $this->_getListing();
160
+ $productsList = Mage::getResourceModel('quicksales/listing_product_collection');
161
+ $productsList->addFieldToFilter('listing_id', $listing->getId());
162
+ $products = array();
163
+ if (!empty($productsList)) {
164
+ foreach ($productsList as $product) {
165
+ $products[] = $product->getProductId();
166
+ }
167
+ }
168
+
169
+ }
170
+
171
+ return $products;
172
+ }
173
+
174
+ /**
175
+ * Check block is readonly
176
+ *
177
+ * @return boolean
178
+ */
179
+ public function isReadonly()
180
+ {
181
+ if ($this->hasData('is_readonly')) {
182
+ return $this->getData('is_readonly');
183
+ }
184
+ return $this->_getListing()->getCompositeReadonly();
185
+ }
186
+
187
+ protected function _prepareColumns()
188
+ {
189
+ $listing = $this->_getListing();
190
+ // $attributes = $listing->getTypeInstance(true)->getConfigurableAttributes($listing);
191
+
192
+ if (!$this->isReadonly()) {
193
+ $this->addColumn('in_products', array(
194
+ 'header_css_class' => 'a-center',
195
+ 'type' => 'checkbox',
196
+ 'name' => 'in_products',
197
+ 'align' => 'center',
198
+ 'index' => 'entity_id',
199
+ 'renderer' => 'quicksales/adminhtml_listing_edit_tab_additional_step1_grid_renderer_checkbox',
200
+ 'values' => $this->_getSelectedProducts(),
201
+ ));
202
+ }
203
+
204
+ $this->addColumn('entity_id', array(
205
+ 'header' => Mage::helper('catalog')->__('ID'),
206
+ 'sortable' => true,
207
+ 'width' => '60px',
208
+ 'index' => 'entity_id'
209
+ ));
210
+ $this->addColumn('name', array(
211
+ 'header' => Mage::helper('catalog')->__('Name'),
212
+ 'index' => 'name'
213
+ ));
214
+
215
+
216
+ $this->addColumn('sku', array(
217
+ 'header' => Mage::helper('catalog')->__('SKU'),
218
+ 'width' => '80px',
219
+ 'index' => 'sku'
220
+ ));
221
+
222
+ $this->addColumn('price', array(
223
+ 'header' => Mage::helper('catalog')->__('Price'),
224
+ 'type' => 'currency',
225
+ 'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
226
+ 'index' => 'price'
227
+ ));
228
+
229
+ $this->addColumn('is_saleable', array(
230
+ 'header' => Mage::helper('catalog')->__('Inventory'),
231
+ 'renderer' => 'adminhtml/catalog_product_edit_tab_super_config_grid_renderer_inventory',
232
+ 'filter' => 'adminhtml/catalog_product_edit_tab_super_config_grid_filter_inventory',
233
+ 'index' => 'is_saleable'
234
+ ));
235
+
236
+ $this->addColumn('action',
237
+ array(
238
+ 'header' => Mage::helper('catalog')->__('Action'),
239
+ 'type' => 'action',
240
+ 'getter' => 'getId',
241
+ 'actions' => array(
242
+ array(
243
+ 'caption' => Mage::helper('catalog')->__('Edit'),
244
+ 'url' => $this->getEditParamsForAssociated(),
245
+ 'field' => 'id',
246
+ 'onclick' => 'superProduct.createPopup(this.href);return false;'
247
+ )
248
+ ),
249
+ 'filter' => false,
250
+ 'sortable' => false
251
+ ));
252
+
253
+ return parent::_prepareColumns();
254
+ }
255
+
256
+ public function getEditParamsForAssociated()
257
+ {
258
+ return array(
259
+ 'base' => 'adminhtml/catalog_product/edit',
260
+ 'params' => array(
261
+ 'required' => $this->_getRequiredAttributesIds(),
262
+ 'popup' => 1,
263
+ 'product' => $this->_getListing()->getId()
264
+ )
265
+ );
266
+ }
267
+
268
+ /**
269
+ * Retrieve Required attributes Ids (comma separated)
270
+ *
271
+ * @return string
272
+ */
273
+ protected function _getRequiredAttributesIds()
274
+ {
275
+ $attributesIds = array();
276
+ /*
277
+ foreach (
278
+ $this->_getListing()
279
+ ->getTypeInstance(true)
280
+ ->getConfigurableAttributes($this->_getListing()) as $attribute
281
+ ) {
282
+ $attributesIds[] = $attribute->getProductAttribute()->getId();
283
+ }
284
+ */
285
+ return implode(',', $attributesIds);
286
+ }
287
+
288
+ public function getOptions($attribute) {
289
+ $result = array();
290
+ foreach ($attribute->getProductAttribute()->getSource()->getAllOptions() as $option) {
291
+ if($option['value']!='') {
292
+ $result[$option['value']] = $option['label'];
293
+ }
294
+ }
295
+
296
+ return $result;
297
+ }
298
+
299
+ public function getGridUrl()
300
+ {
301
+ return $this->getUrl('*/*/products', array('_current'=>true));
302
+ }
303
+
304
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step1/Grid/Renderer/Checkbox.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 26.09.11
6
+ * Time: 14:26
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tab_Additional_Step1_Grid_Renderer_Checkbox extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Checkbox
11
+ {
12
+ public function render(Varien_Object $row)
13
+ {
14
+ $result = parent::render($row);
15
+ return $result.'<input type="hidden" class="value-json" value="'.htmlspecialchars($this->getAttributesJson($row)).'" />';
16
+ }
17
+
18
+ public function getAttributesJson(Varien_Object $row)
19
+ {
20
+ $result = array(
21
+ 'id' => $row->getEntityId(),
22
+ 'name' => $row->getName()
23
+ );
24
+
25
+ return Mage::helper('core')->jsonEncode($result);
26
+ }
27
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step1/Renderer/Status.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tab_Additional_Step1_Renderer_Status extends Varien_Data_Form_Element_Select
3
+ {
4
+ public function getElementHtml()
5
+ {
6
+
7
+ $this->setReadonly(true, true);
8
+ $html = parent::getElementHtml();
9
+
10
+ if ($this->_renderer->getRequest()->getParam('id')) {
11
+ $stop = $this->_renderer->getLayout()
12
+ ->createBlock('adminhtml/widget_button')
13
+ ->setData(array(
14
+ 'label' => Mage::helper('quicksales')->__('Stop'),
15
+ 'onclick' => 'setLocation(\'' . $this->_renderer->getUrl('*/*/stop', array('id' => $this->_renderer->getRequest()->getParam('id'))) . '\')',
16
+ ));
17
+
18
+ $html .= '<br />' . $stop->toHtml();
19
+
20
+
21
+ // $start = $this->_renderer->getLayout()
22
+ // ->createBlock('adminhtml/widget_button')
23
+ // ->setData(array(
24
+ // 'label' => Mage::helper('quicksales')->__('Start'),
25
+ // 'onclick' => 'setLocation(\'' . $this->_renderer->getUrl('*/*/start', array('id' => $this->_renderer->getRequest()->getParam('id'))) . '\')',
26
+ // ));
27
+ //
28
+ // $html .= '&nbsp;&nbsp;&nbsp;' . $start->toHtml();
29
+
30
+ $relist = $this->_renderer->getLayout()
31
+ ->createBlock('adminhtml/widget_button')
32
+ ->setData(array(
33
+ 'label' => Mage::helper('quicksales')->__('Relist'),
34
+ 'onclick' => 'setLocation(\'' . $this->_renderer->getUrl('*/*/relist', array('id' => $this->_renderer->getRequest()->getParam('id'))) . '\')',
35
+ ));
36
+ $html .= '&nbsp;&nbsp;&nbsp;' . $relist->toHtml();
37
+ }
38
+ return $html;
39
+ }
40
+
41
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step2.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: Admin
5
+ * Date: 25.09.11
6
+ * Time: 19:00
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tab_Additional_Step2 extends Mage_Adminhtml_Block_Widget {
11
+
12
+ protected $_assignedProducts = null;
13
+ protected $mAttributes = array();
14
+
15
+ protected $qAttributes = array();
16
+ protected $qValues = array();
17
+
18
+ public function __construct()
19
+ {
20
+ parent::__construct();
21
+ $this->setTemplate('quicksales/listing/edit/tab/additional/step2.phtml');
22
+ $this->setId('listing_edit');
23
+ }
24
+
25
+ public function getListing()
26
+ {
27
+ return Mage::registry('current_listing');
28
+ }
29
+
30
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step2/Depended.php ADDED
@@ -0,0 +1,431 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tab_Additional_Step2_Depended extends Mage_Adminhtml_Block_Abstract
4
+ {
5
+ protected $_sectionName = 'quicksales_default';
6
+
7
+ protected $_group = null;
8
+
9
+ /**
10
+ * Reference to the parent element (optional)
11
+ *
12
+ * @var Varien_Data_Form_Element_Abstract
13
+ */
14
+ protected $_parentElement = null;
15
+
16
+ /**
17
+ * Whether the form contents can be editable
18
+ *
19
+ * @var bool
20
+ */
21
+ protected $_isReadOnly = false;
22
+
23
+ /**
24
+ *
25
+ * @var Ewave_Quicksales_Model_Listing
26
+ */
27
+ protected $_listing = null;
28
+
29
+ protected $_configRoot = null;
30
+
31
+ protected $_configDataObject = null;
32
+
33
+ protected $_configData = null;
34
+
35
+ protected $_configFields = null;
36
+
37
+ protected $_defaultFieldsetRenderer = null;
38
+
39
+ protected $_defaultFieldRenderer = null;
40
+
41
+ public function setGroup($group) {
42
+ $this->_group = $group;
43
+ return $this;
44
+ }
45
+
46
+
47
+ /**
48
+ * Enter description here...
49
+ *
50
+ * @return Mage_Adminhtml_Block_System_Config_Form
51
+ */
52
+ protected function _initObjects()
53
+ {
54
+ $this->_configRoot = Mage::getConfig()->getNode(null, $this->getScope(), $this->getScopeCode());
55
+
56
+ $this->_configDataObject = Mage::getModel('adminhtml/config_data');
57
+
58
+ $this->_configData = $this->_configDataObject->load();
59
+
60
+ $this->_configFields = Mage::getSingleton('adminhtml/config');
61
+
62
+ $this->_defaultFieldsetRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_fieldset');
63
+ $this->_defaultFieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
64
+ return $this;
65
+ }
66
+
67
+ /**
68
+ * Setter for parent element
69
+ *
70
+ * @param Varien_Data_Form_Element_Abstract $element
71
+ */
72
+ public function setParentElement(Varien_Data_Form_Element_Abstract $element)
73
+ {
74
+ $this->_parentElement = $element;
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * Setter for current product
80
+ *
81
+ * @param Ewave_Quicksales_Model_Listing $product
82
+ */
83
+ public function setListingEntity(Ewave_Quicksales_Model_Listing $listing)
84
+ {
85
+ $this->_listing = $listing;
86
+ return $this;
87
+ }
88
+
89
+ /**
90
+ * Prepare and render the form
91
+ *
92
+ * @return string
93
+ */
94
+ protected function _toHtml()
95
+ {
96
+
97
+ $form = $this->_prepareForm();
98
+
99
+ return $form->toHtml() . $this->_getDependence()->toHtml();
100
+ }
101
+
102
+ public function prepareElements($elements, $group, $fieldset)
103
+ {
104
+
105
+ foreach ($elements as $e) {
106
+
107
+ /**
108
+ * Look for custom defined field path
109
+ */
110
+ $path = (string)$e->config_path;
111
+ if (empty($path)) {
112
+ $path = $this->_section . '/' . $group->getName() . '/' . $e->getName();
113
+ } elseif (strrpos($path, '/') > 0) {
114
+ // Extend config data with new section group
115
+ $groupPath = substr($path, 0, strrpos($path, '/'));
116
+ if (!isset($configDataAdditionalGroups[$groupPath])) {
117
+ $this->_configData = $this->_configDataObject->extendConfig(
118
+ $groupPath,
119
+ false,
120
+ $this->_configData
121
+ );
122
+ $configDataAdditionalGroups[$groupPath] = true;
123
+ }
124
+ }
125
+
126
+ $id = $this->_section->getName() . '_' . $group->getName() . '_' . $e->getName();
127
+
128
+ if (isset($this->_configData[$path])) {
129
+ $data = $this->_configData[$path];
130
+ $inherit = false;
131
+ } else {
132
+ // $data = $this->_configRoot->descend($path);
133
+ $inherit = true;
134
+ }
135
+ if ($e->frontend_model) {
136
+ $fieldRenderer = Mage::getBlockSingleton((string)$e->frontend_model);
137
+ } else {
138
+ $fieldRenderer = $this->_defaultFieldRenderer;
139
+ }
140
+
141
+ $fieldRenderer->setForm($this);
142
+ $fieldRenderer->setConfigData($this->_configData);
143
+
144
+ //'quicksales' = $this->_configFields->getAttributeModule($this->_section, $group, $e);
145
+ $fieldType = (string)$e->frontend_type ? (string)$e->frontend_type : 'text';
146
+ $name = $e->getName();
147
+ $label = Mage::helper('quicksales')->__((string)$e->label);
148
+ $hint = (string)$e->hint ? Mage::helper('quicksales')->__((string)$e->hint) : '';
149
+
150
+ if ($e->backend_model) {
151
+ $model = Mage::getModel((string)$e->backend_model);
152
+ if (!$model instanceof Mage_Core_Model_Config_Data) {
153
+ Mage::throwException('Invalid config field backend model: ' . (string)$e->backend_model);
154
+ }
155
+ $model->setPath($path)
156
+ ->setValue($data)
157
+ ->setWebsite($this->getWebsiteCode())
158
+ ->setStore($this->getStoreCode())
159
+ ->afterLoad();
160
+ $data = $model->getValue();
161
+ }
162
+
163
+ $comment = $this->_prepareFieldComment($e, 'quicksales', $data);
164
+ $tooltip = $this->_prepareFieldTooltip($e, 'quicksales');
165
+
166
+ if ($e->depends) {
167
+ foreach ($e->depends->children() as $dependent) {
168
+ $dependentId = $this->_section->getName()
169
+ . '_' . $group->getName()
170
+ . '_'
171
+ . $dependent->getName();
172
+ $shouldBeAddedDependence = true;
173
+ $dependentValue = (string)$dependent;
174
+ $dependentFieldName = $dependent->getName();
175
+ $dependentField = $group->fields->$dependentFieldName;
176
+ /*
177
+ * If dependent field can't be shown in current scope and real dependent config value
178
+ * is not equal to preferred one, then hide dependence fields by adding dependence
179
+ * based on not shown field (not rendered field)
180
+ */
181
+ // if (!$this->_canShowField($dependentField)) {
182
+ $dependentFullPath = $this->_section
183
+ . '/' . $group->getName()
184
+ . '/'
185
+ . $dependent->getName();
186
+ $shouldBeAddedDependence = $dependentValue != Mage::getStoreConfig(
187
+ $dependentFullPath
188
+ );
189
+
190
+ $idTmp = $this->_group . '_information' . $id;
191
+ $dependentIdTmp = $this->_group . '_information' . $dependentId;
192
+
193
+ $nameTmp = 'listing[' . $this->_group . '_information][' . $name . ']';
194
+ $dependentNameTmp = 'listing[' . $this->_group . '_information][' . $dependentFieldName . ']';
195
+ // }
196
+ // if ($shouldBeAddedDependence) {
197
+ $this->_getDependence()
198
+ ->addFieldMap($idTmp, $nameTmp)
199
+ ->addFieldMap($dependentIdTmp, $dependentNameTmp)
200
+ ->addFieldDependence($nameTmp, $dependentNameTmp, $dependentValue);
201
+ // }
202
+ }
203
+ }
204
+
205
+ $field = $fieldset->addField($id, $fieldType, array(
206
+ 'name' => $name,
207
+ 'label' => $label,
208
+ 'comment' => $comment,
209
+ 'tooltip' => $tooltip,
210
+ 'hint' => $hint,
211
+ 'value' => $data,
212
+ 'inherit' => $inherit,
213
+ 'class' => $e->frontend_class,
214
+ 'field_config' => $e,
215
+ 'scope' => $this->getScope(),
216
+ 'scope_id' => $this->getScopeId(),
217
+ 'scope_label' => $this->getScopeLabel($e),
218
+ // 'can_use_default_value' => $this->canUseDefaultValue((int)$e->show_in_default),
219
+ // 'can_use_website_value' => $this->canUseWebsiteValue((int)$e->show_in_website),
220
+ ));
221
+ // $this->_prepareFieldOriginalData($field, $e);
222
+ /*
223
+ if (isset($e->validate)) {
224
+ $field->addClass($e->validate);
225
+ }
226
+ */
227
+
228
+ if (isset($e->frontend_type)
229
+ && 'multiselect' === (string)$e->frontend_type
230
+ && isset($e->can_be_empty)
231
+ ) {
232
+ $field->setCanBeEmpty(true);
233
+ }
234
+
235
+ $field->setRenderer($fieldRenderer);
236
+
237
+ if ($e->source_model) {
238
+ // determine callback for the source model
239
+ $factoryName = (string)$e->source_model;
240
+ $method = false;
241
+ if (preg_match('/^([^:]+?)::([^:]+?)$/', $factoryName, $matches)) {
242
+ array_shift($matches);
243
+ list($factoryName, $method) = array_values($matches);
244
+ }
245
+
246
+ $sourceModel = Mage::getSingleton($factoryName);
247
+ if ($sourceModel instanceof Varien_Object) {
248
+ $sourceModel->setPath($path);
249
+ }
250
+ if ($method) {
251
+ if ($fieldType == 'multiselect') {
252
+ $optionArray = $sourceModel->$method();
253
+ } else {
254
+ $optionArray = array();
255
+ foreach ($sourceModel->$method() as $value => $label) {
256
+ $optionArray[] = array('label' => $label, 'value' => $value);
257
+ }
258
+ }
259
+ } else {
260
+ $optionArray = $sourceModel->toOptionArray($fieldType == 'multiselect');
261
+ }
262
+ $field->setValues($optionArray);
263
+
264
+ }
265
+
266
+
267
+ if ($this->_listing->getData('default_' . $this->_group . '_conf') != 1 && $this->_listing->getData($this->_group . '_information')) {
268
+
269
+ $values = $this->_listing->getData($this->_group . '_information');
270
+
271
+ if (isset($values[$name])) {
272
+ $field->setValue($values[$name]);
273
+ }
274
+
275
+ } elseif ($this->_listing->getData('default_' . $this->_group . '_conf') == 1) {
276
+ $field->setValue(Mage::getStoreConfig($this->_sectionName . '/' . $this->_group . '/' . $name));
277
+ }
278
+
279
+ }
280
+ }
281
+
282
+ /**
283
+ * Instantiate form and fields
284
+ *
285
+ * @return Varien_Data_Form
286
+ */
287
+ protected function _prepareForm()
288
+ {
289
+
290
+ if (!$this->_configDataObject) {
291
+ $this->_initObjects();
292
+ }
293
+
294
+ $form = new Varien_Data_Form();
295
+ $form->setFieldsetRenderer($this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset'));
296
+ $form->setFieldsetElementRenderer($this->getLayout()
297
+ ->createBlock('adminhtml/widget_form_renderer_fieldset_element'));
298
+
299
+ /**
300
+ * if there is a parent element defined, it will be replaced by a hidden element with the same name
301
+ * and overriden by the form elements
302
+ * It is needed to maintain HTML consistency of the parent element's form
303
+ */
304
+ if ($this->_parentElement) {
305
+ $form->setHtmlIdPrefix($this->_parentElement->getHtmlId())
306
+ ->setFieldNameSuffix($this->_parentElement->getName());
307
+ $form->addField('', 'hidden', array('name' => ''));
308
+ }
309
+
310
+ $this->_section = Mage::getSingleton('adminhtml/config')->getSection($this->_sectionName);
311
+ //$sectionName = $this->_sectionName;
312
+ $groups = $this->_section->groups;
313
+
314
+ $groups = (array)$groups;
315
+ if ($group = $groups[$this->_group]) {
316
+ $fieldset = $form->addFieldset(
317
+ $this->_group,
318
+ array(
319
+ 'legend' => (string)$group->label,
320
+ ));
321
+
322
+
323
+ foreach ($group->fields as $elements) {
324
+ $elements = (array)$elements;
325
+ $this->prepareElements($elements, $group, $fieldset);
326
+
327
+ }
328
+ }
329
+
330
+ //$form->setValues(Mage::getStoreConfig($this->_sectionName . '/' . $this->_group));
331
+
332
+
333
+ return $form;
334
+ }
335
+
336
+ /**
337
+ * Return dependency block object
338
+ *
339
+ * @return Mage_Adminhtml_Block_Widget_Form_Element_Dependence
340
+ */
341
+ protected function _getDependence()
342
+ {
343
+ if (!$this->getChild('element_dependense')) {
344
+ $this->setChild('element_dependense',
345
+ $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence'));
346
+ }
347
+ return $this->getChild('element_dependense');
348
+ }
349
+
350
+ /**
351
+ * Add a field to the form or fieldset
352
+ * Form and fieldset have same abstract
353
+ *
354
+ * @param Varien_Data_Form|Varien_Data_Form_Element_Fieldset $formOrFieldset
355
+ * @param string $elementName
356
+ * @param array $options
357
+ * @param string $type
358
+ * @return Varien_Data_Form_Element_Abstract
359
+ */
360
+ protected function _addField($formOrFieldset, $elementName, $options = array(), $type = 'text')
361
+ {
362
+ $options = array_merge($options, array(
363
+ 'name' => $elementName,
364
+ //'label' => $this->_profile->getFieldLabel($elementName),
365
+ //'note' => $this->_profile->getFieldComment($elementName),
366
+ 'disabled' => $this->_isReadOnly,
367
+ ));
368
+ if (in_array($elementName, array('period_unit', 'period_frequency'))) {
369
+ $options['required'] = true;
370
+ }
371
+ return $formOrFieldset->addField($elementName, $type, $options);
372
+ }
373
+
374
+ /**
375
+ * Set readonly flag
376
+ *
377
+ * @param boolean $isReadonly
378
+ * @return Mage_Sales_Block_Adminhtml_Recurring_Profile_Edit_Form
379
+ */
380
+ public function setIsReadonly($isReadonly)
381
+ {
382
+ $this->_isReadOnly = $isReadonly;
383
+ return $this;
384
+ }
385
+
386
+ /**
387
+ * Get readonly flag
388
+ *
389
+ * @return boolean
390
+ */
391
+ public function getIsReadonly()
392
+ {
393
+ return $this->_isReadOnly;
394
+ }
395
+
396
+ /**
397
+ * Support models "getCommentText" method for field note generation
398
+ *
399
+ * @param Mage_Core_Model_Config_Element $element
400
+ * @param string $helper
401
+ * @return string
402
+ */
403
+ protected function _prepareFieldComment($element, $helper, $currentValue)
404
+ {
405
+ $comment = '';
406
+ if ($element->comment) {
407
+ $commentInfo = $element->comment->asArray();
408
+ if (is_array($commentInfo)) {
409
+ if (isset($commentInfo['model'])) {
410
+ $model = Mage::getModel($commentInfo['model']);
411
+ if (method_exists($model, 'getCommentText')) {
412
+ $comment = $model->getCommentText($element, $currentValue);
413
+ }
414
+ }
415
+ } else {
416
+ $comment = Mage::helper($helper)->__($commentInfo);
417
+ }
418
+ }
419
+ return $comment;
420
+ }
421
+
422
+ protected function _prepareFieldTooltip($element, $helper)
423
+ {
424
+ if ($element->tooltip) {
425
+ return Mage::helper($helper)->__((string)$element->tooltip);
426
+ } elseif ($element->tooltip_block) {
427
+ return $this->getLayout()->createBlock((string)$element->tooltip_block)->toHtml();
428
+ }
429
+ return '';
430
+ }
431
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step2/Renderer/Category.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tab_Additional_Step2_Renderer_Category extends Varien_Data_Form_Element_Select
3
+ {
4
+ public function getElementHtml()
5
+ {
6
+ $data = array(
7
+ 'name' => 'category',
8
+ );
9
+ $hidden = new Varien_Data_Form_Element_Hidden($data);
10
+ $hidden->setForm($this->getForm());
11
+
12
+ $hidden->setId('category');
13
+ $hidden->setValue($this->getValue());
14
+ $hidden->addClass('required-entry');
15
+
16
+ $this->setName('category_selector');
17
+ $this->setId('category_selector');
18
+ $this->removeClass('required-entry');
19
+
20
+ $html = parent::getElementHtml();
21
+
22
+ $changeButton = $this->_renderer->getLayout()
23
+ ->createBlock('adminhtml/widget_button')
24
+ ->setData(array(
25
+ 'label' => Mage::helper('quicksales')->__('Change'),
26
+ 'onclick' => '$(\'category_selector\').show();',
27
+ ));
28
+
29
+ $applyButton = $this->_renderer->getLayout()
30
+ ->createBlock('adminhtml/widget_button')
31
+ ->setData(array(
32
+ 'label' => Mage::helper('quicksales')->__('Apply'),
33
+ 'style' => 'display: none',
34
+ 'id' => 'apply_category',
35
+ 'onclick' => 'listingSettingsObj.changeCategory();',
36
+ ));
37
+
38
+ $allCategories = Mage::getModel('quicksales/api_getcategories')->getAllCategories();
39
+
40
+ $allCategoriesCache = Mage::getModel('quicksales/api_getcategories')->getCategoryCache();
41
+
42
+ $currentCategoryLabel = $allCategoriesCache[$this->getValue()];
43
+
44
+
45
+ $currentCategory = array();
46
+ foreach ($allCategories as $category) {
47
+ if ($category['value'] == $this->getValue()) {
48
+ $currentCategory = $category;
49
+ break;
50
+ }
51
+ }
52
+
53
+ while(!empty($allCategoriesCache[$currentCategory['parent']])) {
54
+ $currentCategoryLabel = $allCategoriesCache[$currentCategory['parent']] . ' / ' . $currentCategoryLabel;
55
+ foreach ($allCategories as $category) {
56
+ if ($category['value'] == $currentCategory['parent']) {
57
+ $currentCategory = $category;
58
+ break;
59
+ }
60
+ }
61
+ }
62
+
63
+
64
+ return '<span id="category_label">' . $currentCategoryLabel . '</span>' . $hidden->toHtml() . $changeButton->toHtml() . $html . $applyButton->toHtml();
65
+ }
66
+
67
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step2/Renderer/Depended.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tab_Additional_Step2_Renderer_Depended
3
+ extends Mage_Adminhtml_Block_Catalog_Form_Renderer_Fieldset_Element
4
+ {
5
+ protected $_group = null;
6
+
7
+ public function setGroup($group) {
8
+ $this->_group = $group;
9
+ return $this;
10
+ }
11
+ /**
12
+ * Element output getter
13
+ *
14
+ * @return string
15
+ */
16
+ public function getElementHtml()
17
+ {
18
+ $result = new StdClass;
19
+ $result->output = '';
20
+
21
+ // replace the element field with a form
22
+ $element = $this->_element;
23
+ $content = Mage::app()->getLayout()->createBlock('quicksales/adminhtml_listing_edit_tab_additional_step2_depended',
24
+ 'adminhtml_listing_edit_tab_additional_step2_' . $this->_group);
25
+ $block = $content
26
+ ->setParentElement($element)
27
+ ->setGroup($this->_group)
28
+ ->setListingEntity(Mage::registry('current_listing')
29
+
30
+ );
31
+ $result->output = $block->toHtml();
32
+
33
+ // make the profile element dependent on is_recurring
34
+
35
+
36
+ $dependencies = Mage::app()->getLayout()->createBlock(
37
+ 'adminhtml/widget_form_element_dependence',
38
+ 'adminhtml_listing_pricing_dependence')
39
+ ->addFieldMap('default_'.$this->_group.'_conf', 'listing[default_'.$this->_group.'_conf]')
40
+ ->addFieldMap($element->getHtmlId(), $element->getName())
41
+ ->addFieldDependence($element->getName(), 'listing[default_'.$this->_group.'_conf]', '0')
42
+ ->addConfigOptions(array('levels_up' => 2));
43
+ $result->output .= $dependencies->toHtml();
44
+
45
+ return $result->output;
46
+ }
47
+ }
48
+
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step2/Renderer/Vshopcategory.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tab_Additional_Step2_Renderer_Vshopcategory extends Varien_Data_Form_Element_Select
3
+ {
4
+ public function getElementHtml()
5
+ {
6
+ $this->addClass('select');
7
+ $html = '<select id="'.$this->getHtmlId().'" name="'.$this->getName().'" '.$this->serialize($this->getHtmlAttributes()).'>'."\n";
8
+
9
+ $value = $this->getValue();
10
+ if (!is_array($value)) {
11
+ $value = array($value);
12
+ }
13
+
14
+ if ($values = $this->getValues()) {
15
+ foreach ($values as $key => $option) {
16
+ if (!is_array($option)) {
17
+ $html.= $this->_optionToHtml(array(
18
+ 'value' => $key,
19
+ 'label' => $option),
20
+ $value
21
+ );
22
+ }
23
+ elseif (is_array($option['value'])) {
24
+ $html.='<optgroup label="'.$option['label'].'">'."\n";
25
+ foreach ($option['value'] as $groupItem) {
26
+ $html.= $this->_optionToHtml($groupItem, $value);
27
+ }
28
+ $html.='</optgroup>'."\n";
29
+ }
30
+ else {
31
+ $html.= $this->_optionToHtml($option, $value);
32
+ }
33
+ }
34
+ }
35
+
36
+ $html.= '</select>'."\n";
37
+ $html.= $this->getAfterElementHtml();
38
+
39
+ return $html;
40
+ }
41
+
42
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step3.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: Admin
5
+ * Date: 25.09.11
6
+ * Time: 19:00
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tab_Additional_Step3 extends Mage_Adminhtml_Block_Widget {
11
+
12
+ protected $_assignedProducts = null;
13
+ protected $mAttributes = array();
14
+
15
+ protected $qAttributes = array();
16
+ protected $qValues = array();
17
+
18
+ public function __construct()
19
+ {
20
+ parent::__construct();
21
+ $this->setTemplate('quicksales/listing/edit/tab/additional/step3.phtml');
22
+ $this->setId('listing_edit');
23
+ }
24
+
25
+ protected function _prepareLayout()
26
+ {
27
+ $this->setChild('attributes_association',
28
+ $this->getLayout()->createBlock('quicksales/adminhtml_listing_edit_tab_additional_step3_attributes',
29
+ 'attributes_association')
30
+ );
31
+ }
32
+
33
+ public function getListing()
34
+ {
35
+ return Mage::registry('current_listing');
36
+ }
37
+
38
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Additional/Step3/Attributes.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tab_Additional_Step3_Attributes extends Mage_Adminhtml_Block_Widget {
4
+
5
+ protected $_assignedProducts = null;
6
+ protected $mAttributes = array();
7
+
8
+ protected $qAttributes = array();
9
+ protected $qValues = array();
10
+
11
+ public function __construct()
12
+ {
13
+ parent::__construct();
14
+ $this->setTemplate('quicksales/listing/edit/tab/additional/step3/attributes.phtml');
15
+ $this->setId('listing_edit_step3_attributes');
16
+ }
17
+
18
+ public function getListing()
19
+ {
20
+ return Mage::registry('current_listing');
21
+ }
22
+
23
+ public function getQAttributes() {
24
+ list($this->qAttributes, $this->qValues) = Mage::getModel('quicksales/api_gettags')->getAttributes($this->getListing()->getCategory());
25
+ return $this->qAttributes;
26
+ }
27
+
28
+ public function getMAttributes() {
29
+ if ($this->mAttributes) {
30
+ return $this->mAttributes;
31
+ }
32
+
33
+ $mAttributesCollection = Mage::getResourceModel('catalog/eav_mysql4_product_attribute_collection');
34
+ $mAttributesCollection->getSelect()->order('frontend_label');
35
+
36
+ $productIds = Mage::helper('quicksales')->getProductIds();
37
+
38
+ $products = Mage::getModel('catalog/product')->getCollection();
39
+ $products->addAttributeToSelect('*');
40
+ $products->addIdFilter($productIds);
41
+
42
+ if (!$productIds) {
43
+ return '';
44
+ }
45
+
46
+ /*
47
+ foreach ($products as $product) {
48
+ if ($product->getTypeId() != 'configurable') {
49
+ continue;
50
+ }
51
+ $configurableAttributes = $product->getTypeInstance(true)->getConfigurableAttributes($product)->getItems();
52
+
53
+ $product->setData('configurable_attributes', $configurableAttributes);
54
+ }
55
+ */
56
+
57
+ foreach ($mAttributesCollection as $attribute) {
58
+ if ($attribute->getFrontendInput() != 'select' && $attribute->getFrontendInput() != 'multiselect') {
59
+ //continue;
60
+ }
61
+ if (!$attribute->getFrontendLabel()) {
62
+ continue;
63
+ }
64
+
65
+ $attributeCode = $attribute->getAttributeCode();
66
+
67
+ $skip = false;
68
+ foreach ($products as $product) {
69
+ $configurableAttributes = $product->getConfigurableAttributes();
70
+ if (!$product->hasData($attributeCode) /*&& (!empty($configurableAttributes) && !$configurableAttributes[$attribute->getEntityTypeId()])*/) {
71
+ $skip = true;
72
+ }
73
+ }
74
+
75
+ if ($skip) {
76
+ continue;
77
+ }
78
+
79
+ $this->mAttributes[$attribute->getId()] = $attribute->getFrontendLabel();
80
+ }
81
+ return $this->mAttributes;
82
+ }
83
+
84
+ public function getQAttributeValues($attributeId) {
85
+ return $this->qValues[$attributeId];
86
+ }
87
+
88
+ public function getMAssignedAttributeValues($qAttributeId) {
89
+
90
+ }
91
+
92
+ public function getAssociatedGridHtml($qc_id)
93
+ {
94
+ return Mage::helper('quicksales')->getAssociatedGridHtml($qc_id);
95
+ }
96
+
97
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tab/Attributes.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 17:58
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tab_Attributes extends Mage_Adminhtml_Block_Catalog_Form
11
+ {
12
+
13
+
14
+ protected function _prepareForm()
15
+ {
16
+
17
+ if ($group = $this->getGroup()) {
18
+ $form = new Varien_Data_Form();
19
+
20
+ $form->setDataObject(Mage::registry('listing'));
21
+
22
+ $fieldset = $form->addFieldset('group_fields' . $group->getId(),
23
+ array(
24
+ 'legend' => Mage::helper('catalog')->__($group->getAttributeGroupName()),
25
+ 'class' => 'fieldset-wide',
26
+ ));
27
+
28
+ $attributes = $this->getGroupAttributes();
29
+ $new_attributes = array();
30
+
31
+ foreach ($attributes as $attribute) {
32
+
33
+
34
+ if (!Mage::getStoreConfig('quicksales/settings/have_vshop') && $attribute->getAttributeCode() == 'vshop_category') {
35
+ continue;
36
+ }
37
+
38
+ if (!in_array($attribute->getAttributeCode(), array(
39
+ 'fixedpostage',
40
+ 'fixedpostagebylocation_act',
41
+ 'fixedpostagebylocation_nsw',
42
+ 'fixedpostagebylocation_nt',
43
+ 'fixedpostagebylocation_qld',
44
+ 'fixedpostagebylocation_sa',
45
+ 'fixedpostagebylocation_tas',
46
+ 'fixedpostagebylocation_vic',
47
+ 'fixedpostagebylocation_wa',
48
+ 'offerapexpress',
49
+ 'offerapregular',
50
+ 'postinst',
51
+ 'posttolocation',
52
+ 'providereturnrefundpolicy',
53
+ ))
54
+ ) {
55
+
56
+
57
+ if ($attribute->getAttributeCode() == 'category') {
58
+ $attribute->getFrontend()->getAttribute()
59
+ ->setFrontendInputRenderer('quicksales/adminhtml_listing_edit_tab_additional_step2_renderer_category');
60
+
61
+ } elseif ($attribute->getAttributeCode() == 'status') {
62
+ $attribute->getFrontend()->getAttribute()
63
+ ->setFrontendInputRenderer('quicksales/adminhtml_listing_edit_tab_additional_step1_renderer_status');
64
+ } elseif ($attribute->getAttributeCode() == 'vshop_category') {
65
+ /*
66
+ $attribute->getFrontend()->getAttribute()
67
+ ->setFrontendInputRenderer('quicksales/adminhtml_listing_edit_tab_additional_step2_renderer_vshopcategory');
68
+ */
69
+ }
70
+ $new_attributes[] = $attribute;
71
+ }
72
+ }
73
+
74
+ $this->_setFieldset($new_attributes, $fieldset);
75
+
76
+ if ($pricing_information = $form->getElement('pricing_information')) {
77
+
78
+ $pricing_information->setRenderer(
79
+ $this
80
+ ->getLayout()
81
+ ->createBlock('quicksales/adminhtml_listing_edit_tab_additional_step2_renderer_depended')
82
+ ->setGroup('pricing')
83
+ );
84
+ }
85
+
86
+ if ($listing_information = $form->getElement('listing_information')) {
87
+
88
+ $listing_information->setRenderer(
89
+ $this
90
+ ->getLayout()
91
+ ->createBlock('quicksales/adminhtml_listing_edit_tab_additional_step2_renderer_depended')
92
+ ->setGroup('listing')
93
+ );
94
+ }
95
+
96
+ if ($listing_upgrade_information = $form->getElement('listing_upgrade_information')) {
97
+
98
+ $listing_upgrade_information->setRenderer(
99
+ $this
100
+ ->getLayout()
101
+ ->createBlock('quicksales/adminhtml_listing_edit_tab_additional_step2_renderer_depended')
102
+ ->setGroup('listing_upgrade')
103
+ );
104
+ }
105
+
106
+ if ($payment_information = $form->getElement('payment_information')) {
107
+
108
+ $payment_information->setRenderer(
109
+ $this
110
+ ->getLayout()
111
+ ->createBlock('quicksales/adminhtml_listing_edit_tab_additional_step2_renderer_depended')
112
+ ->setGroup('payment')
113
+ );
114
+ }
115
+
116
+ if ($shipping_information = $form->getElement('shipping_information')) {
117
+
118
+ $shipping_information->setRenderer(
119
+ $this
120
+ ->getLayout()
121
+ ->createBlock('quicksales/adminhtml_listing_edit_tab_additional_step2_renderer_depended')
122
+ ->setGroup('shipping')
123
+ );
124
+ }
125
+
126
+ $values = Mage::registry('listing')->getData();
127
+ if (!Mage::registry('listing')->getId()) {
128
+ foreach ($attributes as $attribute) {
129
+ if (!isset($values[$attribute->getAttributeCode()])) {
130
+ $values[$attribute->getAttributeCode()] = $attribute->getDefaultValue();
131
+ }
132
+ }
133
+ }
134
+
135
+ if (Mage::registry('listing')->hasLockedAttributes()) {
136
+ foreach (Mage::registry('listing')->getLockedAttributes() as $attribute) {
137
+ if ($element = $form->getElement($attribute)) {
138
+ $element->setReadonly(true, true);
139
+ }
140
+ }
141
+ }
142
+ $form->addValues($values);
143
+ $form->setFieldNameSuffix('listing');
144
+
145
+ Mage::dispatchEvent('adminhtml_catalog_product_edit_prepare_form', array('form' => $form));
146
+
147
+ $this->setForm($form);
148
+ }
149
+ }
150
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Edit/Tabs.php ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 10:21
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
11
+ {
12
+
13
+ protected $_attributeTabBlock = 'quicksales/adminhtml_listing_edit_tab_attributes';
14
+
15
+ /*
16
+ * array (groupName => array(updates))
17
+ */
18
+ protected $_groupData = array(
19
+ 'Step 1' => array(
20
+ 'sort_order' => 10,
21
+ 'label' => 'Assign products to listing',
22
+ ),
23
+ 'Step 2' => array(
24
+ 'sort_order' => 20,
25
+ 'label' => 'Listing details',
26
+ ),
27
+ 'Step 3' => array(
28
+ 'sort_order' => 30,
29
+ 'label' => 'Listing attributes (Tags)',
30
+ )
31
+ );
32
+
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+ $this->setId('listing_info_tabs');
37
+ $this->setDestElementId('listing_edit_form');
38
+ $this->setTitle(Mage::helper('catalog')->__('Listing Information'));
39
+ }
40
+
41
+ /**
42
+ * Enter description here...
43
+ *
44
+ * @param Varien_Simplexml_Element $a
45
+ * @param Varien_Simplexml_Element $b
46
+ * @return boolean
47
+ */
48
+ protected function _sortForm($a, $b)
49
+ {
50
+ return (int)$a->sort_order < (int)$b->sort_order ? -1 : ((int)$a->sort_order > (int)$b->sort_order ? 1 : 0);
51
+
52
+ }
53
+
54
+ public function applyAdditionalGroupData($groups)
55
+ {
56
+ foreach ($groups as $group) {
57
+
58
+ }
59
+ }
60
+
61
+ protected function prepareDefaultConfigFields()
62
+ {
63
+
64
+ $config = Mage::getSingleton('adminhtml/config');
65
+ $sections = $config->getSection(
66
+ 'quicksales_default'
67
+
68
+ );
69
+ if (empty($sections)) {
70
+ $sections = array();
71
+ }
72
+ foreach ($sections as $section) {
73
+
74
+ /*
75
+ if (!$this->_canShowField($section)) {
76
+ continue;
77
+ }
78
+ */
79
+ foreach ($section->groups as $groups) {
80
+
81
+ $groups = (array)$groups;
82
+
83
+ $groups = $this->applyAdditionalGroupData($groups);
84
+ usort($groups, array($this, '_sortForm'));
85
+
86
+ /* @var $group Mage_Eav_Model_Entity_Attribute_Group */
87
+ foreach ($groups as $group) {
88
+
89
+ if ($group->frontend_model) {
90
+ $fieldsetRenderer = Mage::getBlockSingleton((string)$group->frontend_model);
91
+ } else {
92
+ $fieldsetRenderer = $this->_defaultFieldsetRenderer;
93
+ }
94
+
95
+ $fieldsetRenderer->setForm($this);
96
+ $fieldsetRenderer->setConfigData($this->_configData);
97
+ $fieldsetRenderer->setGroup($group);
98
+
99
+ if ($this->_configFields->hasChildren($group, $this->getWebsiteCode(), $this->getStoreCode())) {
100
+
101
+ $helperName = $this->_configFields->getAttributeModule($section, $group);
102
+
103
+ $fieldsetConfig = array('legend' => Mage::helper($helperName)->__((string)$group->label));
104
+ if (!empty($group->comment)) {
105
+ $fieldsetConfig['comment'] = Mage::helper($helperName)->__((string)$group->comment);
106
+ }
107
+ if (!empty($group->expanded)) {
108
+ $fieldsetConfig['expanded'] = (bool)$group->expanded;
109
+ }
110
+
111
+ $fieldset = $this->addFieldset(
112
+ $section->getName() . '_' . $group->getName(), $fieldsetConfig)
113
+ ->setRenderer($fieldsetRenderer);
114
+ $this->_prepareFieldOriginalData($fieldset, $group);
115
+ $this->_addElementTypes($fieldset);
116
+
117
+ if ($group->clone_fields) {
118
+ if ($group->clone_model) {
119
+ $cloneModel = Mage::getModel((string)$group->clone_model);
120
+ } else {
121
+ Mage::throwException(
122
+ 'Config form fieldset clone model required to be able to clone fields'
123
+ );
124
+ }
125
+ foreach ($cloneModel->getPrefixes() as $prefix) {
126
+ $this->initFields($fieldset, $group, $section, $prefix['field'], $prefix['label']);
127
+ }
128
+ } else {
129
+ $this->initFields($fieldset, $group, $section);
130
+ }
131
+
132
+ $this->_fieldsets[$group->getName()] = $fieldset;
133
+
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
139
+
140
+ protected function _prepareLayout()
141
+ {
142
+ $listing = $this->getListing();
143
+ //quicksales_listing
144
+ $listingAttributes = $listing->getAttributes();
145
+ if (!$listing->getId()) {
146
+ foreach ($listingAttributes as $attribute) {
147
+ $default = $attribute->getDefaultValue();
148
+ if ($default != '') {
149
+ $this->getListing()->setData($attribute->getAttributeCode(), $default);
150
+ }
151
+ }
152
+ }
153
+
154
+ $attributeSetId = $this->getListing()->getDefaultAttributeSetId();
155
+ /** @var $groupCollection Mage_Eav_Model_Resource_Entity_Attribute_Group_Collection */
156
+ $groupCollection = Mage::getResourceModel('eav/entity_attribute_group_collection')
157
+ ->setAttributeSetFilter($attributeSetId)
158
+ ->setOrder('sort_order', 'ASC')
159
+ ->load();
160
+
161
+
162
+ $defaultGroupId = 0;
163
+ foreach ($groupCollection as $group) {
164
+ /* @var $group Mage_Eav_Model_Entity_Attribute_Group */
165
+ if ($defaultGroupId == 0 or $group->getIsDefault()) {
166
+ $defaultGroupId = $group->getId();
167
+ }
168
+ }
169
+
170
+ //if (!$listing->getId()) {
171
+ $listing->setAttributeSetId($attributeSetId);
172
+ //}
173
+
174
+ $i = 0;
175
+ foreach ($groupCollection as $group) {
176
+
177
+ $attributes = $listing->getAttributes($group->getId(), true);
178
+
179
+ // do not add grops without attributes
180
+ if (!$attributes) {
181
+ continue;
182
+ }
183
+ $i++;
184
+
185
+ $active = $defaultGroupId == $group->getId();
186
+ $groupName = strtolower(str_replace(' ', '', $group->getAttributeGroupName()));
187
+ $block = $this->getLayout()->createBlock($this->getAttributeTabBlock())
188
+ ->setGroup($group)
189
+ ->setAttributes($attributes)
190
+ ->setGroupAttributes($attributes)
191
+ ->setAddHiddenFields($active)
192
+ ->setChild('form_after', $this->getLayout()->createBlock('quicksales/adminhtml_listing_edit_tab_additional_' . $groupName));
193
+
194
+ $group->addData($this->_groupData[$group->getAttributeGroupName()]);
195
+ if (!$group->getLabel()) {
196
+ $group->setLabel($group->getAttributeGroupName());
197
+ }
198
+
199
+ $this->addTab(
200
+ 'group_' . $group->getId(),
201
+ array(
202
+ 'label' => Mage::helper('quicksales')->__($group->getLabel()),
203
+ 'content' => $block->toHtml() . $this->getAdditionalScript($group),
204
+ 'active' => $active
205
+ )
206
+ );
207
+
208
+
209
+ }
210
+
211
+ return parent::_prepareLayout();
212
+ }
213
+
214
+
215
+ /*
216
+ * @comment add event for tab changing
217
+ * */
218
+ protected function getAdditionalScript($group)
219
+ {
220
+ $tab = clone $group;
221
+ $tab->setId('group_' . $group->getId());
222
+
223
+ $currentGroup =
224
+ $html = '
225
+ <script type="text/javascript">
226
+ Event.observe("'.$this->getTabId($tab).'", "click", function() {
227
+ showHideButtons(this.id)
228
+ })
229
+ </script>
230
+ ';
231
+
232
+ return $html;
233
+ }
234
+
235
+ protected function _toHtml()
236
+ {
237
+ $html = parent::_toHtml();
238
+
239
+ $tab = $this->getRequest()->getParam('tab');
240
+
241
+ $html .= '
242
+ <script type="text/javascript">
243
+
244
+ document.observe("dom:loaded", function() {
245
+ showHideButtons("'.($tab ? $tab : $this->getActiveTabId()).'")
246
+ });
247
+
248
+ </script>
249
+ ';
250
+ return $html;
251
+ }
252
+
253
+
254
+ public function getListing()
255
+ {
256
+
257
+ return Mage::registry('current_listing');
258
+ }
259
+
260
+ public function getAttributeTabBlock()
261
+ {
262
+ if (is_null(Mage::helper('quicksales/listing')->getAttributeTabBlock())) {
263
+ return $this->_attributeTabBlock;
264
+ }
265
+ return Mage::helper('quicksales/listing')->getAttributeTabBlock();
266
+ }
267
+
268
+ public function setAttributeTabBlock($attributeTabBlock)
269
+ {
270
+ $this->_attributeTabBlock = $attributeTabBlock;
271
+ return $this;
272
+ }
273
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Grid.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 15:09
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Grid extends Mage_Adminhtml_Block_Widget_Grid
11
+ {
12
+
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+ $this->setId('listingGrid');
17
+ $this->setDefaultSort('listing_id');
18
+ $this->setDefaultDir('DESC');
19
+ $this->setSaveParametersInSession(true);
20
+ }
21
+
22
+ protected function _prepareCollection()
23
+ {
24
+ $collection = Mage::getModel('quicksales/listing')->getCollection()->addAttributeToSelect('*');
25
+
26
+ $this->setCollection($collection);
27
+ //Mage::getModel('quicksales/listing')->load(1);
28
+ return parent::_prepareCollection();
29
+ }
30
+
31
+ protected function _prepareColumns()
32
+ {
33
+ $this->addColumn(
34
+ 'listing_id',
35
+ array(
36
+ 'header' => Mage::helper('quicksales')->__('ID'),
37
+ 'align' => 'right',
38
+ 'width' => '50px',
39
+ 'index' => 'entity_id',
40
+ )
41
+ );
42
+
43
+ $this->addColumn(
44
+ 'created_date',
45
+ array(
46
+ 'header' => Mage::helper('quicksales')->__('Created date'),
47
+ 'align' => 'right',
48
+ 'width' => '160px',
49
+ 'index' => 'created_at',
50
+ 'type' => 'datetime'
51
+ )
52
+ );
53
+
54
+ $this->addColumn(
55
+ 'name',
56
+ array(
57
+ 'header' => Mage::helper('quicksales')->__('Name'),
58
+ 'index' => 'name',
59
+ 'align' => 'right',
60
+ )
61
+ );
62
+
63
+ $this->addColumn(
64
+ 'products_count',
65
+ array(
66
+ 'header' => Mage::helper('quicksales')->__('Number of products'),
67
+ //'format' => '$products_count',
68
+ 'getter' => 'getProductsCount',
69
+ 'align' => 'right',
70
+ 'width' => '160px',
71
+ )
72
+ );
73
+ /* @var $quicksaleCategories Ewave_Quicksales_Model_Api_Getcategories */
74
+ $quicksaleCategories = Mage::getSingleton('quicksales/api_getcategories')->setQuiet(true);
75
+
76
+
77
+
78
+ $this->addColumn(
79
+ 'category',
80
+ array(
81
+ 'header' => Mage::helper('quicksales')->__('Category'),
82
+ 'index' => 'category',
83
+ 'type' => 'options',
84
+ 'sortable' => false,
85
+ 'options' => $quicksaleCategories->getCategoryCache(),
86
+ )
87
+ );
88
+
89
+ $this->addColumn(
90
+ 'update_date',
91
+ array(
92
+ 'header' => Mage::helper('quicksales')->__('Update date'),
93
+ 'align' => 'right',
94
+ 'width' => '160px',
95
+ 'index' => 'updated_at',
96
+ 'type' => 'datetime'
97
+ )
98
+ );
99
+
100
+
101
+ $this->addColumn('status',
102
+ array(
103
+ 'header' => Mage::helper('catalog')->__('Active'),
104
+ 'width' => '70px',
105
+ 'index' => 'status',
106
+ 'type' => 'options',
107
+ 'options' => Mage::getSingleton('eav/entity_attribute_source_boolean')->getOptionArray(),
108
+ ));
109
+
110
+ $this->addColumn(
111
+ 'action',
112
+ array(
113
+ 'header' => Mage::helper('catalog')->__('Action'),
114
+ 'width' => '50px',
115
+ 'type' => 'action',
116
+ 'getter' => 'getId',
117
+ 'actions' => array(
118
+ array(
119
+ 'caption' => Mage::helper('catalog')->__('Log'),
120
+ 'url' => array(
121
+ 'base' => '*/*/log',
122
+ 'params' => array('store' => $this->getRequest()->getParam('store'))
123
+ ),
124
+ 'field' => 'id'
125
+ )
126
+ ),
127
+ 'filter' => false,
128
+ 'sortable' => false,
129
+ 'index' => 'stores',
130
+ ));
131
+
132
+
133
+ return $this;
134
+ }
135
+
136
+ public function getRowUrl($item)
137
+ {
138
+ return $this->getUrl('*/*/edit', array('id' => $item->getId()));
139
+ }
140
+
141
+ protected function _prepareMassaction()
142
+ {
143
+ $this->setMassactionIdField('entity_id');
144
+ $this->getMassactionBlock()->setFormFieldName('listingMass');
145
+
146
+
147
+ $this->getMassactionBlock()->addItem('stop', array(
148
+ 'label' => Mage::helper('quicksales')->__('Stop'),
149
+ 'url' => $this->getUrl('*/*/massStop', array('_current' => true))
150
+ ));
151
+
152
+ $this->getMassactionBlock()->addItem('relist', array(
153
+ 'label' => Mage::helper('quicksales')->__('Relist'),
154
+ 'url' => $this->getUrl('*/*/massRelist', array('_current' => true))
155
+ ));
156
+
157
+ $this->getMassactionBlock()->addItem('delete', array(
158
+ 'label' => Mage::helper('quicksales')->__('Delete'),
159
+ 'url' => $this->getUrl('*/*/massDelete'),
160
+ 'confirm' => Mage::helper('quicksales')->__('Are you sure?')
161
+ ));
162
+
163
+ return $this;
164
+ }
165
+
166
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Log.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 15:06
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Log extends Mage_Adminhtml_Block_Widget_Grid_Container {
11
+
12
+ public function __construct()
13
+ {
14
+ $this->_controller = 'adminhtml_listing_log';
15
+ $this->_blockGroup = 'quicksales';
16
+ $this->_headerText = Mage::helper('quicksales')->__('Listing Log');
17
+ parent::__construct();
18
+ $this->removeButton('add');
19
+ }
20
+
21
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Log/.Grid.php.swp ADDED
Binary file
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Log/Grid.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 15:09
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
11
+ {
12
+
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+ $this->setId('listingLogGrid');
17
+ $this->setDefaultSort('transaction_id');
18
+ $this->setDefaultDir('DESC');
19
+ $this->setSaveParametersInSession(true);
20
+
21
+ if ($this->getRequest()->getParam('id')) {
22
+ $this->setDefaultFilter(array('listing_id' => $this->getRequest()->getParam('id')));
23
+ }
24
+ }
25
+
26
+ protected function _prepareCollection()
27
+ {
28
+ $collection = Mage::getModel('quicksales/listing_log')->getCollection();
29
+
30
+ $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('quicksales_listing','name');
31
+
32
+ $collection->getSelect()->join( array('name_table' => $attribute->getBackendTable()),
33
+ 'listing_id=name_table.entity_id AND name_table.attribute_id = "'.$attribute->getId().'"',
34
+ 'value');
35
+
36
+ if ($this->getRequest()->getParam('id')) {
37
+ $collection->addFieldToFilter('listing_id', $this->getRequest()->getParam('id'));
38
+ }
39
+ $this->setCollection($collection);
40
+ return parent::_prepareCollection();
41
+ }
42
+
43
+ protected function _prepareColumns()
44
+ {
45
+ $this->addColumn(
46
+ 'transaction_id',
47
+ array(
48
+ 'header' => Mage::helper('quicksales')->__('Transaction internal ID'),
49
+ 'align' => 'right',
50
+ 'width' => '100px',
51
+ 'index' => 'id',
52
+ )
53
+ );
54
+
55
+ $this->addColumn(
56
+ 'listing',
57
+ array(
58
+ 'header' => Mage::helper('quicksales')->__('Listing name'),
59
+ 'align' => 'right',
60
+ 'width' => '200px',
61
+ 'index' => 'value',
62
+ )
63
+ );
64
+
65
+ $this->addColumn(
66
+ 'date',
67
+ array(
68
+ 'header' => Mage::helper('quicksales')->__('Date'),
69
+ 'align' => 'right',
70
+ 'index' => 'date',
71
+ 'width' => '200px',
72
+ 'type' => 'datetime'
73
+ )
74
+ );
75
+
76
+ $this->addColumn(
77
+ 'message',
78
+ array(
79
+ 'header' => Mage::helper('quicksales')->__('Message'),
80
+ 'index' => 'message',
81
+ 'format' => '$message',
82
+ 'align' => 'right'
83
+ )
84
+ );
85
+
86
+ $this->addColumn(
87
+ 'details',
88
+ array(
89
+ 'header' => Mage::helper('catalog')->__('Details'),
90
+ 'align' => 'right',
91
+ 'type' => 'action',
92
+ 'getter' => 'getId',
93
+ 'actions' => array(
94
+ array(
95
+ 'caption' => Mage::helper('catalog')->__('Show detailed log'),
96
+ 'url' => array(
97
+ 'base' => '*/*/productlog',
98
+ ),
99
+ 'field' => 'id'
100
+ )
101
+ ),
102
+ 'filter' => false,
103
+ 'sortable' => false,
104
+ 'index' => 'id',
105
+ )
106
+ );
107
+
108
+ return $this;
109
+ }
110
+
111
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Product/Log.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 15:06
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Product_Log extends Mage_Adminhtml_Block_Widget_Grid_Container {
11
+
12
+ public function __construct()
13
+ {
14
+ $this->_controller = 'adminhtml_listing_product_log';
15
+ $this->_blockGroup = 'quicksales';
16
+ $this->_headerText = Mage::helper('quicksales')->__('Listing Detailed Log');
17
+ parent::__construct();
18
+ $this->removeButton('add');
19
+ }
20
+
21
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Listing/Product/Log/Grid.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 15:09
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Listing_Product_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
11
+ {
12
+
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+ $this->setId('listingProductLogGrid');
17
+ $this->setDefaultSort('id');
18
+ $this->setDefaultDir('DESC');
19
+ $this->setSaveParametersInSession(true);
20
+
21
+
22
+ }
23
+
24
+ protected function _prepareCollection()
25
+ {
26
+ $collection = Mage::getModel('quicksales/listing_product_log')->getCollection();
27
+
28
+ $collection->getSelect()->join(array('listing_log' => 'listing_log'),
29
+ 'listing_log.id=listing_log_id',
30
+ null);
31
+
32
+ $collection->getSelect()->join(array('listing' => 'listing'),
33
+ 'listing_log.listing_id=listing.entity_id',
34
+ null);
35
+ $collection->getSelect()->join(array('listing_product' => 'listing_product'),
36
+ 'listing_product.id=main_table.association_id',
37
+ 'quicksale_listing_id');
38
+
39
+ $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('quicksales_listing', 'name');
40
+
41
+
42
+ $collection->getSelect()->join(array('name_table' => $attribute->getBackendTable()),
43
+ 'listing.entity_id=name_table.entity_id AND name_table.attribute_id = "'.$attribute->getId().'"',
44
+ 'value');
45
+ if ($this->getRequest()->getParam('id')) {
46
+ $collection->addFieldToFilter('listing_log_id', $this->getRequest()->getParam('id'));
47
+ }
48
+
49
+ $this->setCollection($collection);
50
+ return parent::_prepareCollection();
51
+ }
52
+
53
+ protected function _prepareColumns()
54
+ {
55
+ $this->addColumn(
56
+ 'id',
57
+ array(
58
+ 'header' => Mage::helper('quicksales')->__('Num'),
59
+ 'align' => 'right',
60
+ 'width' => '100px',
61
+ 'index' => 'id',
62
+ )
63
+ );
64
+ $this->addColumn(
65
+ 'listing_id',
66
+ array(
67
+ 'header' => Mage::helper('quicksales')->__('Listing id'),
68
+ 'align' => 'right',
69
+ 'width' => '200px',
70
+ 'index' => 'quicksale_listing_id',
71
+ )
72
+ );
73
+
74
+ $this->addColumn(
75
+ 'listing',
76
+ array(
77
+ 'header' => Mage::helper('quicksales')->__('Magento Listing Name'),
78
+ 'align' => 'right',
79
+ 'width' => '200px',
80
+ 'index' => 'value',
81
+ )
82
+ );
83
+
84
+ $this->addColumn(
85
+ 'date',
86
+ array(
87
+ 'header' => Mage::helper('quicksales')->__('Date'),
88
+ 'align' => 'right',
89
+ 'index' => 'date',
90
+ 'width' => '200px',
91
+ 'type' => 'datetime'
92
+ )
93
+ );
94
+
95
+ $this->addColumn(
96
+ 'message',
97
+ array(
98
+ 'header' => Mage::helper('quicksales')->__('Message'),
99
+ 'index' => 'message',
100
+ 'format' => '$message',
101
+ 'align' => 'right',
102
+ 'width' => '100px'
103
+ )
104
+ );
105
+
106
+ return $this;
107
+ }
108
+
109
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Log.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 15:06
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Log extends Mage_Adminhtml_Block_Widget_Grid_Container {
11
+
12
+ public function __construct()
13
+ {
14
+ $this->_controller = 'adminhtml_log';
15
+ $this->_blockGroup = 'quicksales';
16
+ $this->_headerText = Mage::helper('quicksales')->__('Log');
17
+ parent::__construct();
18
+ $this->removeButton('add');
19
+
20
+ $this->_addButton('import', array(
21
+ 'label' => Mage::helper('quicksales')->__('Import orders manually'),
22
+ 'onclick' => 'setLocation(\'' . $this->getUrl('quicksales/adminhtml_log/importorders') .'\')',
23
+ ));
24
+
25
+ }
26
+
27
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Log/Grid.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 15:09
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Block_Adminhtml_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
11
+ {
12
+
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+ $this->setId('listingLogGrid');
17
+ $this->setDefaultSort('transaction_id');
18
+ $this->setDefaultDir('DESC');
19
+ $this->setSaveParametersInSession(true);
20
+
21
+ if ($this->getRequest()->getParam('id')) {
22
+ $this->setDefaultFilter(array('listing_id' => $this->getRequest()->getParam('id')));
23
+ }
24
+ }
25
+
26
+ protected function _prepareCollection()
27
+ {
28
+ $collection = Mage::getModel('quicksales/listing_log')->getCollection();
29
+ $this->setCollection($collection);
30
+ return parent::_prepareCollection();
31
+ }
32
+
33
+ protected function _prepareColumns()
34
+ {
35
+ $this->addColumn(
36
+ 'transaction_id',
37
+ array(
38
+ 'header' => Mage::helper('quicksales')->__('Transaction internal ID'),
39
+ 'align' => 'right',
40
+ 'width' => '100px',
41
+ 'index' => 'id',
42
+ )
43
+ );
44
+
45
+ $this->addColumn(
46
+ 'type',
47
+ array(
48
+ 'header' => Mage::helper('quicksales')->__('Type'),
49
+ 'align' => 'right',
50
+ 'width' => '200px',
51
+ 'index' => 'type',
52
+ 'type' => 'options',
53
+ 'options' => array(
54
+ '1' => 'Listing',
55
+ '2' => 'Orders',
56
+ '3' => 'Orders import'
57
+ )
58
+ )
59
+ );
60
+
61
+ $this->addColumn(
62
+ 'result',
63
+ array(
64
+ 'header' => Mage::helper('quicksales')->__('Result'),
65
+ 'align' => 'right',
66
+ 'width' => '200px',
67
+ 'index' => 'result',
68
+ 'type' => 'options',
69
+ 'options' => array(
70
+ '0' => 'Error',
71
+ '1' => 'Success'
72
+
73
+ )
74
+ )
75
+ );
76
+
77
+ $this->addColumn(
78
+ 'date',
79
+ array(
80
+ 'header' => Mage::helper('quicksales')->__('Date'),
81
+ 'align' => 'right',
82
+ 'index' => 'date',
83
+ 'width' => '200px',
84
+ 'type' => 'datetime'
85
+ )
86
+ );
87
+
88
+ $this->addColumn(
89
+ 'message',
90
+ array(
91
+ 'header' => Mage::helper('quicksales')->__('Message'),
92
+ 'index' => 'message',
93
+ 'format' => '$message',
94
+ 'align' => 'right'
95
+ )
96
+ );
97
+
98
+ $this->addColumn(
99
+ 'details',
100
+ array(
101
+ 'header' => Mage::helper('catalog')->__('Details'),
102
+ 'align' => 'right',
103
+ 'type' => 'action',
104
+ 'getter' => 'getId',
105
+ 'actions' => array(
106
+ array(
107
+ 'caption' => Mage::helper('catalog')->__('Show detailed log'),
108
+ 'url' => array(
109
+ 'base' => 'quicksales/adminhtml_listing/productlog',
110
+ ),
111
+ 'field' => 'id'
112
+ )
113
+ ),
114
+ 'filter' => false,
115
+ 'sortable' => false,
116
+ 'index' => 'id',
117
+ 'renderer' => 'quicksales/adminhtml_log_grid_column_renderer_action'
118
+ )
119
+ );
120
+
121
+ return $this;
122
+ }
123
+
124
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Log/Grid/Column/Renderer/Action.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Block_Adminhtml_Log_Grid_Column_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
4
+ {
5
+
6
+ /**
7
+ * Renders column
8
+ *
9
+ * @param Varien_Object $row
10
+ * @return string
11
+ */
12
+ public function render(Varien_Object $row)
13
+ {
14
+ if (!$row->getListingId()) {
15
+ return '&nbsp;';
16
+ } else {
17
+ return parent::render($row);
18
+ }
19
+
20
+ }
21
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Sales/Order/Payment/Info.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ */
4
+
5
+ class Ewave_Quicksales_Block_Adminhtml_Sales_Order_Payment_Info extends Mage_Core_Block_Template
6
+ {
7
+ public function __construct()
8
+ {
9
+ $this->setTemplate('quicksales/sales/order/payment/info.phtml');
10
+ parent::__construct();
11
+ }
12
+
13
+ public function getOrder(){
14
+ return $this->getParentBlock()->getOrder();
15
+ }
16
+
17
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/Sales/Order/View/Tab/Quicksales.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Block_Adminhtml_Sales_Order_View_Tab_Quicksales
4
+ extends Mage_Adminhtml_Block_Sales_Order_Abstract
5
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
6
+ {
7
+ protected function _construct()
8
+ {
9
+ $this->setTemplate('quicksales/sales/order/view/tab/quicksales.phtml');
10
+ parent::_construct();
11
+ }
12
+
13
+
14
+ /**
15
+ * Retrieve order model instance
16
+ *
17
+ * @return Mage_Sales_Model_Order
18
+ */
19
+ public function getOrder()
20
+ {
21
+ return Mage::registry('current_order');
22
+ }
23
+
24
+ /**
25
+ * Retrieve source model instance
26
+ *
27
+ * @return Mage_Sales_Model_Order
28
+ */
29
+ public function getSource()
30
+ {
31
+ return $this->getOrder();
32
+ }
33
+
34
+ public function getViewUrl($orderId)
35
+ {
36
+ return $this->getUrl('*/*/*', array('order_id'=>$orderId));
37
+ }
38
+
39
+ /**
40
+ * ######################## TAB settings #################################
41
+ */
42
+ public function getTabLabel()
43
+ {
44
+ return Mage::helper('sales')->__('quicksales info');
45
+ }
46
+
47
+ public function getTabTitle()
48
+ {
49
+ return Mage::helper('sales')->__('quicksales info');
50
+ }
51
+
52
+ public function canShowTab()
53
+ {
54
+ return true;
55
+ }
56
+
57
+ public function isHidden()
58
+ {
59
+ return false;
60
+ }
61
+ }
app/code/community/Ewave/Quicksales/Block/Adminhtml/System/Config/Form/Field/Datetime.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Block_Adminhtml_System_Config_Form_Field_Datetime extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ public function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+
9
+
10
+ $calendar = $this->getLayout()
11
+ ->createBlock('core/html_date')
12
+ ->setId('options_' . $element->getId())
13
+ ->setName($element->getName())
14
+ ->setClass('product-custom-option datetime-picker input-text')
15
+ ->setImage($this->getSkinUrl('images/grid-cal.gif'))
16
+ ->setFormat('%d/%m/%Y %H:%M:%S')
17
+ ->setValue($element->getValue())
18
+ ;
19
+
20
+ return $calendar->getHtml();
21
+ }
22
+
23
+ }
24
+
app/code/community/Ewave/Quicksales/Block/Adminhtml/System/Config/Form/Field/Description.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Block_Adminhtml_System_Config_Form_Field_Description extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ public function render(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ // $element->setConfig(new Varien_Object(array('enabled' => true)));
9
+ $element->setWysiwyg(true);
10
+ return "<script type='text/javascript' src='" . Mage::getBaseUrl('js') . "mage/adminhtml/wysiwyg/tiny_mce/setup.js'></script><script type='text/javascript' src='" . Mage::getBaseUrl('js') . "tiny_mce/tiny_mce.js'></script>" . parent::render($element);
11
+ }
12
+
13
+ }
14
+
app/code/community/Ewave/Quicksales/Block/Adminhtml/System/Config/Form/Field/Gst.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Block_Adminhtml_System_Config_Form_Field_Gst extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+
6
+ public function render(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+ // $element->setConfig(new Varien_Object(array('enabled' => true)));
9
+ $element->setText('
10
+ <p>
11
+ <a target="_blank" href="http://www.quicksales.com.au/content/0012005/help/Sell/listingpolicies.aspx">
12
+ http://www.quicksales.com.au/content/0012005/help/Sell/listingpolicies.aspx
13
+ </a>
14
+ </p>
15
+
16
+ <p>
17
+ GST: All prices are to be shown in Australian dollars and unless otherwise clearly stated, all prices are GST inclusive. GST can only be added to the final price if the payment instructions CLEARLY state that GST will be added to the final price. Note: Only sellers that are GST registered can charge GST.
18
+ </p>
19
+
20
+ <p>
21
+ <a target="_blank" href="http://www.quicksales.com.au/content/0012005/help/MyAccount/gst.aspx">
22
+ GST info
23
+ </a>
24
+ </p>
25
+ ');
26
+ return parent::render($element);
27
+ }
28
+
29
+ }
30
+
app/code/community/Ewave/Quicksales/Block/RW/Adminhtml/Sales/Order/Grid.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Block_RW_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
4
+ {
5
+
6
+ protected function _prepareCollection()
7
+ {
8
+ parent::_prepareCollection();
9
+ $collection = $this->getCollection();
10
+ $collection->addAttributeToSelect('qsource');
11
+ $this->setCollection($collection);
12
+
13
+ return $this;
14
+ }
15
+
16
+ protected function _prepareColumns()
17
+ {
18
+
19
+ $this->addColumn(
20
+ 'qsource',
21
+ array(
22
+ 'header' => Mage::helper('quicksales')->__('Source'),
23
+ 'align' => 'right',
24
+ 'width' => '100px',
25
+ 'index' => 'qsource',
26
+ 'type' => 'options',
27
+ 'options' => array(
28
+ '0' => 'magento',
29
+ '1' => 'quicksales'
30
+ )
31
+ )
32
+ );
33
+
34
+ return parent::_prepareColumns();
35
+ }
36
+
37
+ }
app/code/community/Ewave/Quicksales/Block/RW/Adminhtml/Sales/Order/Payment.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ */
4
+
5
+ class Ewave_Quicksales_Block_RW_Adminhtml_Sales_Order_Payment extends Mage_Adminhtml_Block_Sales_Order_Payment {
6
+
7
+
8
+ public function setPayment($payment)
9
+ {
10
+ $order = $this->getParentBlock()->getOrder();
11
+
12
+ if ($order->getQhash()) {
13
+ $this->setOrder($order);
14
+ $paymentInfoBlock = $this->getLayout()->createBlock('quicksales/adminhtml_sales_order_payment_info');
15
+ } else {
16
+ $paymentInfoBlock = Mage::helper('payment')->getInfoBlock($payment);
17
+ }
18
+ $this->setChild('info', $paymentInfoBlock);
19
+ $this->setData('payment', $payment);
20
+ return $this;
21
+ }
22
+
23
+ protected function _toHtml()
24
+ {
25
+ return $this->getChildHtml('info', false);
26
+ }
27
+
28
+ }
app/code/community/Ewave/Quicksales/Block/RW/Adminhtml/Sales/Order/View.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 11.01.12
6
+ * Time: 10:39
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+ class Ewave_Quicksales_Block_RW_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View
10
+ {
11
+
12
+ public function __construct()
13
+ {
14
+ parent::__construct();
15
+
16
+ $order = $this->getOrder();
17
+
18
+ if ($order->getQhash() && $order->getStatus() == 'processing') {
19
+ $this->_addButton('order_qpaid', array(
20
+ 'label' => Mage::helper('quicksales')->__('Mark as Paid'),
21
+ 'onclick' => 'setLocation(\'' . $this->getQpaidUrl($order) . '\')',
22
+ 'class' => 'go'
23
+ ));
24
+ }
25
+ }
26
+
27
+ public function getQpaidUrl($order)
28
+ {
29
+ return $this->getUrl('quicksales/adminhtml_order/qpaid', array('id' => $order->getId()));
30
+ }
31
+
32
+ }
app/code/community/Ewave/Quicksales/Block/RW/Adminhtml/Sales/Order/View/Tab/Info.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 11.01.12
6
+ * Time: 10:39
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+ class Ewave_Quicksales_Block_RW_Adminhtml_Sales_Order_View_Tab_Info extends Mage_Adminhtml_Block_Sales_Order_View_Tab_Info
10
+ {
11
+ public function getPaymentHtml()
12
+ {
13
+ if ($this->getOrder()->getQhash()) {
14
+ echo 1;die;
15
+ //$this->setChild(,)
16
+ } else {
17
+ return parent::getPaymentHtml();
18
+ }
19
+ }
20
+
21
+
22
+ }
app/code/community/Ewave/Quicksales/CatalogInventory/Model/Resource/Stock.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 01.12.11
6
+ * Time: 17:13
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_CatalogInventory_Model_Resource_Stock extends Mage_CatalogInventory_Model_Resource_Stock
11
+ {
12
+
13
+ private function synchronizeQty($productId)
14
+ {
15
+ if (Mage::registry('quicksales_data')) {
16
+ return false;
17
+ }
18
+ $collection = Mage::getResourceModel('quicksales/listing_product_collection');
19
+ $collection->addFieldToFilter('product_id', $productId);
20
+
21
+ $product = Mage::getModel('catalog/product')->load($productId);
22
+
23
+ foreach ($collection as $assigned_data) {
24
+ $listing = Mage::getModel('quicksales/listing')->load($assigned_data->getListingId());
25
+ $listing->setData('assigned_products', array($productId));
26
+
27
+
28
+ if (Mage::getStoreConfig('quicksales/stock/update_quicksale_qty_magento_change')) {
29
+
30
+ $quicksalesApi = Mage::getModel('quicksales/api_createitem');
31
+ $quicksalesApi->setQuiet(true);
32
+
33
+ $quicksalesApi->send($listing, $productId);
34
+ }
35
+
36
+ if ($product->getStockItem()->getQty() == 0 && Mage::getStoreConfig('quicksales/stock/stop_quicksale_magento_qty_less') && $assigned_data->getStatus() == 1) {
37
+
38
+ $quicksalesApi = Mage::getModel('quicksales/api_action');
39
+ $quicksalesApi->setQuiet(true);
40
+
41
+ $quicksalesApi->send($listing, 1, $productId);
42
+
43
+ }
44
+
45
+ if ($product->getStockItem()->getQty() > 0 && Mage::getStoreConfig('quicksales/stock/start_quicksale_magento_qty_great') && $product->getIsInStock() == 1 && $assigned_data->getStatus() != 1) {
46
+
47
+ $quicksalesApi = Mage::getModel('quicksales/api_action');
48
+ $quicksalesApi->setQuiet(true);
49
+
50
+ $quicksalesApi->send($listing, 0, $productId);
51
+
52
+ }
53
+
54
+ }
55
+ }
56
+
57
+ public function correctItemsQty($stock, $productQtys, $operator = '-')
58
+ {
59
+ parent::correctItemsQty($stock, $productQtys, $operator);
60
+
61
+ if (empty($productQtys)) {
62
+ return $this;
63
+ }
64
+
65
+ foreach (array_keys($productQtys) as $productId) {
66
+ $this->synchronizeQty($productId);
67
+ }
68
+
69
+ return $this;
70
+ }
71
+
72
+
73
+ }
app/code/community/Ewave/Quicksales/CatalogInventory/Model/Stock/Item.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_CatalogInventory_Model_Stock_Item extends Mage_CatalogInventory_Model_Stock_Item
4
+ {
5
+ protected function _beforeSave()
6
+ {
7
+
8
+ if (!Mage::registry('quicksales_data')) {
9
+
10
+
11
+ $item = $this;
12
+
13
+ $collection = Mage::getResourceModel('quicksales/listing_product_collection');
14
+ $collection->addFieldToFilter('product_id', $item->getProductId());
15
+
16
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
17
+
18
+ foreach ($collection as $assigned_data) {
19
+ $listing = Mage::getModel('quicksales/listing')->load($assigned_data->getListingId());
20
+ $listing->setData('assigned_products', array($item->getProductId()));
21
+
22
+
23
+ if (Mage::getStoreConfig('quicksales/stock/update_quicksale_qty_magento_change')) {
24
+
25
+ $quicksalesApi = Mage::getModel('quicksales/api_createitem');
26
+ $quicksalesApi->setQuiet(true);
27
+
28
+ $quicksalesApi->send($listing, $item->getProductId());
29
+ }
30
+
31
+ if ($item->getQty() == 0 && Mage::getStoreConfig('quicksales/stock/stop_quicksale_magento_qty_less') && $assigned_data->getStatus() == 1) {
32
+
33
+ $quicksalesApi = Mage::getModel('quicksales/api_action');
34
+ $quicksalesApi->setQuiet(true);
35
+
36
+ $quicksalesApi->send($listing, 1, $item->getProductId());
37
+
38
+ }
39
+
40
+ if ($item->getQty() > 0 && Mage::getStoreConfig('quicksales/stock/start_quicksale_magento_qty_great') && $product->getIsInStock() == 1 && $assigned_data->getStatus() != 1) {
41
+
42
+ $quicksalesApi = Mage::getModel('quicksales/api_action');
43
+ $quicksalesApi->setQuiet(true);
44
+
45
+ $quicksalesApi->send($listing, 0, $item->getProductId());
46
+
47
+ }
48
+ }
49
+
50
+ }
51
+ return parent::afterCommitCallback();
52
+ }
53
+
54
+ }
app/code/community/Ewave/Quicksales/Helper/Data.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Helper_Data extends Mage_Core_Helper_Abstract {
4
+ protected $_products = null;
5
+
6
+ public function getListing() {
7
+
8
+ return Mage::registry('current_listing');
9
+ }
10
+ /**
11
+ * @return Mage_Catalog_Model_Resource_Product_Collection
12
+ */
13
+ public function getProductsCollection()
14
+ {
15
+ if (is_null($this->_products)) {
16
+ /* @var $collection Mage_Catalog_Model_Resource_Product_Collection */
17
+ $this->_products = Mage::getModel('catalog/product')->getCollection();
18
+ $this->_products->addIdFilter($this->getProductIds());
19
+ }
20
+
21
+ return $this->_products;
22
+ }
23
+
24
+ public function getProductIds()
25
+ {
26
+ $session = Mage::getSingleton('admin/session');
27
+ $product_ids = $session->getQuicksalesProductIds();
28
+
29
+ $post = Mage::helper('core/http')->_getRequest()->getPost();
30
+
31
+ if (!is_array($product_ids) && !empty($post) && $session->hasQuicksalesProductIds()) {
32
+ return array();
33
+ } elseif (!is_array($product_ids) || (count($product_ids) == 1 && $product_ids[0] == "")) {
34
+ $listing = $this->getListing();
35
+
36
+ $products = $listing->getAssignedProducts();
37
+
38
+ $product_ids = array();
39
+ foreach ($products as $product) {
40
+ $product_ids[] = $product->getId();
41
+ }
42
+
43
+ }
44
+
45
+ return $product_ids;
46
+ }
47
+
48
+ public function getUsedMagentoAttributeId($qs_attribute_id)
49
+ {
50
+ $session = Mage::getSingleton('admin/session');
51
+ $attributes = $session->getQuicksalesAttrubutesAssign();
52
+ if (!is_array($attributes) || !isset($attributes[$qs_attribute_id])) {
53
+
54
+ $listing = $this->getListing();
55
+ $associatedAttributes = $listing->getAttributesAssociation();
56
+ if (isset($associatedAttributes[$qs_attribute_id])) {
57
+ return $associatedAttributes[$qs_attribute_id];
58
+ } else {
59
+ return '';
60
+ }
61
+ }
62
+
63
+ return $attributes[$qs_attribute_id];
64
+ }
65
+
66
+ public function getAssociatedGridHtml($qc_id, $code = null)
67
+ {
68
+ if (!$code) {
69
+ $code = $this->getUsedMagentoAttributeId($qc_id);
70
+ }
71
+
72
+ if (!$code) {
73
+ return '';
74
+ }
75
+
76
+ $attribute = Mage::getModel('eav/entity_attribute')->load($code);
77
+
78
+ $collection = $this->getProductsCollection();
79
+ // $collection->addAttributeToSelect($attribute->getAttributeCode());
80
+ $collection->addAttributeToSelect('*');
81
+
82
+ $str = '';
83
+ list($qAttributes, $qValues) = Mage::getModel('quicksales/api_gettags')->getTagsValues();
84
+ $used = array();
85
+
86
+ $listing = $this->getListing();
87
+ $associatedValues = $listing->getAttributeValuesAssociation();
88
+
89
+ foreach ($collection->getItems() as $i) {
90
+ /* @var $i Mage_Catalog_Model_Product */
91
+ $label = $value = $i->getData($attribute->getAttributeCode());
92
+ /*
93
+ if (!$value && $i->getTypeId() == 'configurable') {
94
+ $configurableAttributes = $i->getTypeInstance(true)->getConfigurableAttributesAsArray($i);
95
+ foreach($configurableAttributes as $configurableAttribute) {
96
+ if ($configurableAttribute['attribute_id'] == $attribute->getId()) {
97
+ $label = $value = $configurableAttribute['values'];
98
+ }
99
+ }
100
+ }
101
+ */
102
+
103
+ if (!is_array($value)) {
104
+ $value = array($value);
105
+ }
106
+
107
+ foreach ($value as $v) {
108
+ if (isset($used[$v]) || empty($v)) {
109
+ continue;
110
+ }
111
+ if (is_array($v)) {
112
+ $label = $v['label'];
113
+ $v = $v['value_index'];
114
+ }
115
+
116
+ $used[$v] = true;
117
+ if ($label && $i->getAttributeText($attribute->getAttributeCode())) {
118
+ $label = $i->getAttributeText($attribute->getAttributeCode());
119
+ }
120
+
121
+
122
+ $selected = "\n";
123
+ if (!empty($associatedValues[$qc_id])) {
124
+ $selected = $associatedValues[$qc_id][$v];
125
+ }
126
+ $str .= '<tr><td class="half">' . htmlspecialchars($label) . '</td><td class="half"><select name="listing[attribute_values_association][' . $qc_id . '][' . $v . ']">';
127
+ foreach ($qValues[$qc_id] as $valueInfo) {
128
+ $str .= "<option value='" . $valueInfo['id'] . "' " . (($selected == $valueInfo['id'])
129
+ ? " selected='selected' " : "") . ">" . htmlspecialchars($valueInfo['name']) . "</option>";
130
+ }
131
+
132
+ $str .= '</select></td></tr>';
133
+
134
+ $str .= "\n";
135
+ }
136
+ }
137
+
138
+ return $str;
139
+ }
140
+
141
+ }
app/code/community/Ewave/Quicksales/Helper/Listing.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Helper_Listing extends Mage_Core_Helper_Abstract
4
+ {
5
+ const XML_PATH_SITEMAP_VALID_PATHS = 'general/file/sitemap_generate_valid_paths';
6
+
7
+ /**
8
+ * Attribute Tab block name for product edit
9
+ *
10
+ * @var string
11
+ */
12
+ protected $_attributeTabBlock = null;
13
+
14
+ /**
15
+ * Retrieve Attribute Tab Block Name for Product Edit
16
+ *
17
+ * @return string
18
+ */
19
+ public function getAttributeTabBlock()
20
+ {
21
+ return $this->_attributeTabBlock;
22
+ }
23
+
24
+ /**
25
+ * Set Custom Attribute Tab Block Name for Product Edit
26
+ *
27
+ * @param string $attributeTabBlock
28
+ * @return Mage_Adminhtml_Helper_Catalog
29
+ */
30
+ public function setAttributeTabBlock($attributeTabBlock)
31
+ {
32
+ $this->_attributeTabBlock = $attributeTabBlock;
33
+ return $this;
34
+ }
35
+
36
+ /**
37
+ * Get list valid paths for generate a sitemap XML file
38
+ *
39
+ * @return array
40
+ */
41
+ public function getSitemapValidPaths()
42
+ {
43
+ $path = Mage::getStoreConfig(self::XML_PATH_SITEMAP_VALID_PATHS);
44
+ /** @var $helper Mage_Core_Helper_Data */
45
+ $helper = Mage::helper('core');
46
+ $path = array_merge($path, $helper->getPublicFilesValidPath());
47
+ return $path;
48
+ }
49
+ }
app/code/community/Ewave/Quicksales/Model/Api.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ class DebugSoapClient extends SoapClient
4
+ {
5
+
6
+
7
+ public function __doRequest($request, $location, $action, $version, $one_way = 0)
8
+ {
9
+ $return = parent::__doRequest($request, $location, $action, $version, $one_way);
10
+ // echo print_r($request); exit;
11
+ // $fd = fopen('res.zip', 'wb');
12
+ // fwrite($fd, $return);
13
+ // fclose($fd);
14
+ // exit;
15
+ echo $request . "\n\n" . $return; exit;
16
+ return $return;
17
+ }
18
+
19
+
20
+ }
21
+ */
22
+ class Ewave_Quicksales_Model_Api extends Mage_Core_Model_Abstract
23
+ {
24
+
25
+ protected $_client = null;
26
+
27
+ protected $_is_sand = null;
28
+
29
+ protected $_quiet = false;
30
+
31
+ protected function _construct()
32
+ {
33
+ parent::_construct();
34
+ $this->_is_sand = Mage::getStoreConfig('quicksales/settings/sandbox');
35
+ }
36
+
37
+ public function isSand() {
38
+ return $this->_is_sand;
39
+ }
40
+
41
+ public function setQuiet($flag) {
42
+ $this->_quiet = $flag;
43
+ }
44
+
45
+ public function createClient()
46
+ {
47
+ try {
48
+ // $this->_is_sand = Mage::getStoreConfig('quicksales/settings/sandbox');
49
+
50
+ if ($this->isSand()) {
51
+ $url = "http://sandboxapi.quicksales.com.au/ws/wsapi.asmx?WSDL";
52
+ } else {
53
+ $url = "http://developer.quicksales.com.au/ws/wsapi.asmx?WSDL";
54
+ }
55
+
56
+ // The WSDL cache should be set to on to prevent the WSDL being loaded everytime.
57
+ ini_set("soap.wsdl_cache_enabled", "1");
58
+
59
+ // Create a new SoapClient referencing the Quicksales WSDL file.
60
+ $this->_client = new SoapClient($url, array('soap_version' => SOAP_1_2, 'trace' => TRUE));
61
+
62
+ return $this;
63
+
64
+ } catch (SoapFault $e) {
65
+
66
+ Mage::logException($e);
67
+ return null;
68
+
69
+ } catch (Exception $e) {
70
+
71
+ Mage::logException($e);
72
+ return null;
73
+ }
74
+ }
75
+
76
+ public function __call($method, $params)
77
+ {
78
+ $this->_onDate = date('d/m/Y h:m:s t');
79
+ try {
80
+
81
+ $xmlOblect = null;
82
+ if ($this->_client == null) {
83
+ $this->createClient();
84
+ }
85
+
86
+ if (!empty($params)) {
87
+ $xmlOblect = $params[0];
88
+ }
89
+
90
+ /*
91
+ $headerSecurityStr = "<AuthHeader>
92
+ <cre>
93
+ <APIName>" . $method . "</APIName>
94
+ <APIVersion>" . Mage::getStoreConfig('quicksales/settings/api_version') . "</APIVersion>
95
+ <DevID>" . Mage::getStoreConfig('quicksales/settings/dev_id') . "</DevID>
96
+ <DevToken>" . Mage::getStoreConfig('quicksales/settings/dev_token') . "</DevToken>
97
+ </cre>
98
+ </AuthHeader>";
99
+
100
+ // Create a new SoapVar using the header security string.
101
+ $headerSecurityVar = new SoapVar($headerSecurityStr, XSD_ANYXML);
102
+
103
+ // Create a new SoapHeader containing all your login details.
104
+ $soapHeader = new SoapHeader('wsse:http://schemas.xmlsoap.org/ws/2002/04/secext', 'soapenv:Header', $headerSecurityVar);
105
+
106
+ // Add the SoapHeader to your SoapClient.
107
+ $this->_client->__setSoapHeaders(array($soapHeader));
108
+ */
109
+
110
+ $request['cre'] = array(
111
+ 'APIName' => $method,
112
+ 'APIVersion' => Mage::getStoreConfig('quicksales/settings/api_version'),
113
+ 'DevID' => Mage::getStoreConfig('quicksales/settings/dev_id'),
114
+ 'DevToken' => Mage::getStoreConfig('quicksales/settings/dev_token')
115
+ );
116
+
117
+
118
+ if (!($xmlOblect instanceof Varien_Simplexml_Config)) {
119
+ $xmlOblect = new Varien_Simplexml_Config(Mage::getModuleDir('', 'Ewave_Quicksales') . DS . 'xml' . DS . $method . '_Request.xml');
120
+ }
121
+ // $request['xmlDocReq'] = new SoapVar('<ns1:xmlDocReq>' . $xmlOblect->getXmlString() .'</ns1:xmlDocReq>', XSD_ANYXML);
122
+ $request['sXMLDocReq'] = $xmlOblect->getXmlString(); //new SoapVar('<ns1:sXMLDocReq>' . $xmlOblect->getXmlString() .'</ns1:sXMLDocReq>', XSD_ANYXML);
123
+
124
+ file_put_contents($method . '.xml', $xmlOblect->getXmlString());
125
+
126
+ $result = $this->_client->__soapCall($method, array($request));
127
+
128
+ if ($method == 'GetVshopCategories') {
129
+ $method = 'GetvShopCategories';
130
+ }
131
+
132
+ $responce = $method . 'Result';
133
+
134
+ if ($result->$responce) {
135
+ $xmlStr = $result->$responce;
136
+ } else {
137
+ $xmlStr = $result->ErrorResponse;
138
+ }
139
+
140
+ $xmlResult = new Varien_Simplexml_Config();
141
+ $xmlResult->loadString($xmlStr);
142
+ $this->_onDate = $xmlResult->getNode('OnDate');
143
+
144
+ file_put_contents($method . '_Result.xml', $xmlResult->getXmlString());
145
+ if ($xmlResult->getNode('ErrorCode')) {
146
+ throw new Exception($xmlResult->getNode('ErrorCode') . ': ' . $xmlResult->getNode('ErrorMsg'));
147
+ }
148
+
149
+ return $xmlResult;
150
+
151
+ } catch (Exception $e) {
152
+
153
+ if (!$this->_quiet) {
154
+ $this->_getSession()->addError($method . ': ' .$e->getMessage());
155
+ }
156
+
157
+ Mage::logException($e);
158
+ return $e->getMessage();
159
+ }
160
+ }
161
+
162
+ public function getOnDate() {
163
+
164
+ return $this->_onDate;
165
+ }
166
+
167
+ protected function _getSession()
168
+ {
169
+ return Mage::getSingleton('adminhtml/session');
170
+ }
171
+
172
+ }
app/code/community/Ewave/Quicksales/Model/Api/Abstract.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ */
4
+ class Ewave_Quicksales_Model_Api_Action extends Mage_Core_Model_Abstract
5
+ {
6
+
7
+ protected $_quiet = false;
8
+ protected $_is_sand = false;
9
+
10
+ /* @var $_api Ewave_Quicksales_Model_Api */
11
+ protected $_api = null;
12
+
13
+
14
+ protected function _construct()
15
+ {
16
+ parent::_construct();
17
+ $this->_is_sand = Mage::getStoreConfig('quicksales/settings/sandbox');
18
+ $this->_api = Mage::getModel('quicksales/api');
19
+ }
20
+
21
+ public function setQuiet($flag)
22
+ {
23
+ $this->_quiet = $flag;
24
+ $this->_api->setQuiet($flag);
25
+ return $this;
26
+ }
27
+
28
+ }
app/code/community/Ewave/Quicksales/Model/Api/Action.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_Api_Action extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ protected $_is_sand = false;
7
+
8
+ protected $_test_mode = false;
9
+
10
+ protected $_added = 0;
11
+ protected $_updated = 0;
12
+ protected $_errors = 0;
13
+
14
+
15
+ protected $_quiet = false;
16
+
17
+ protected $_api = null;
18
+
19
+ protected function _construct() {
20
+ parent::_construct();
21
+ $this->_is_sand = Mage::getStoreConfig('quicksales/settings/sandbox');
22
+ $this->_api = Mage::getModel('quicksales/api');
23
+ }
24
+
25
+ protected function _getSession()
26
+ {
27
+ return Mage::getSingleton('adminhtml/session');
28
+ }
29
+
30
+ public function setQuiet($flag) {
31
+ $this->_quiet = $flag;
32
+ $this->_api->setQuiet($flag);
33
+ return $this;
34
+ }
35
+
36
+ public function send($listing, $end_item = null, $productId = null, $relist = null)
37
+ {
38
+
39
+ $api = $this->_api;
40
+
41
+ $message = '';
42
+
43
+ $listing_log = Mage::getModel('quicksales/listing_log');
44
+
45
+ $date = time();
46
+ $listing_log
47
+ ->setListingId($listing->getId())
48
+ ->setDate($date);
49
+ $listing_log->save();
50
+
51
+ $message .= '<b>Magento ListingID: ' . $listing->getId() . '</b><br />';
52
+ $result = 1;
53
+
54
+ $listing->getData('assigned_products');
55
+
56
+ $collection = $listing->getAssignedProducts();
57
+ $collection->joinField('qlisting_id',
58
+ 'quicksales/listing_product',
59
+ 'quicksale_listing_id',
60
+ 'product_id=entity_id',
61
+ '{{table}}.listing_id="' . $listing->getId() . '"',
62
+ 'inner');
63
+ $collection->joinField('listing_product_assign_id',
64
+ 'quicksales/listing_product',
65
+ 'id',
66
+ 'product_id=entity_id',
67
+ '{{table}}.listing_id="' . $listing->getId() . '"',
68
+ 'inner');
69
+
70
+ $sellerId = Mage::getStoreConfig('quicksales/settings/vshop_seller');
71
+ $sellerPwd = Mage::getStoreConfig('quicksales/settings/seller_password');
72
+
73
+ foreach ($collection as $product) {
74
+
75
+ if ($productId != null && $productId != $product->getProductId() && $productId != $product->getId()) {
76
+ continue;
77
+ }
78
+
79
+ $Item = new Varien_Simplexml_Element('<ReviseItemRequest></ReviseItemRequest>');
80
+ $xmlItem = new Varien_Simplexml_Config($Item);
81
+ $xmlItem->setNode('Item/ListingID', $product->getQlistingId());
82
+
83
+
84
+ if ($sellerId && $sellerPwd) {
85
+ $xmlItem->setNode('Item/SellerID', $sellerId);
86
+ $xmlItem->setNode('Item/SellerPwd', $sellerPwd);
87
+ }
88
+
89
+ if ($end_item !== null) {
90
+ $xmlItem->setNode('EndItem', $end_item);
91
+ } elseif ($relist) {
92
+
93
+ if (!$listing->getDefaultListingConf()) {
94
+ $listingConfiguration = $listing->getListingInformation();
95
+ } else {
96
+ $listingConfiguration = Mage::getStoreConfig('quicksales_default/listing');
97
+ }
98
+
99
+ $listingInformation['auto_relist'] = $listingConfiguration['auto_relist'];
100
+
101
+ if ($listingInformation['auto_relist'] == 2) {
102
+ $xmlItem->setNode('RelistItem', 1);
103
+ } else {
104
+ $xmlItem->setNode('RelistItem', 2);
105
+ }
106
+
107
+ } else {
108
+ return false;
109
+ }
110
+
111
+ $result = $api->ReviseItem($xmlItem);
112
+
113
+ if ($result instanceof Varien_Simplexml_Config) {
114
+ $resultInformation = $result->getNode()->asArray();
115
+ if (!$resultInformation['ListingID']) {
116
+ $this->_errors++;
117
+ $result = 0;
118
+ } else {
119
+ $this->_updated++;
120
+ }
121
+
122
+ $message .= $resultInformation['Message'];
123
+ } else {
124
+ $this->_errors++;
125
+ $result = 0;
126
+ }
127
+
128
+ $date = strtotime($api->getOnDate());
129
+
130
+ $listing_product_log = Mage::getModel('quicksales/listing_product_log');
131
+ $listing_product_log
132
+ ->setAssociationId($product->getListingProductAssignId())
133
+ ->setDate($date)
134
+ ->setMessage($message)
135
+ ->setListingLogId($listing_log->getId());
136
+
137
+ $listing_product_log->save();
138
+ }
139
+
140
+
141
+ $message .= '
142
+ <br />
143
+ Updated: ' . $this->_updated . '<br />
144
+ Errors: ' . $this->_errors . '<br />
145
+ ';
146
+
147
+ $listing_log
148
+ ->setResult($result)
149
+ ->setMessage($message);
150
+
151
+ $listing_log->save();
152
+
153
+ if (!$this->_quiet) {
154
+ $this->_getSession()->addNotice($message . 'Show detailed log: <a href="' . Mage::helper('adminhtml')->getUrl('*/*/productlog', array('id' => $listing_log->getId())) . '">Details</a>');
155
+ }
156
+
157
+ }
158
+
159
+ }
160
+
161
+ ?>
app/code/community/Ewave/Quicksales/Model/Api/Client.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_Api_Client extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ protected $_client = null;
7
+
8
+ protected $_is_sand = null;
9
+
10
+ public function connect($username = null, $password = null)
11
+ {
12
+ $this->_is_sand = Mage::getStoreConfig('quicksales/settings/quicksales_sandbox');
13
+
14
+
15
+ if ($this->_is_sand) {
16
+ $url = "https://sandboxapi.quicksales.com.au/ws/wsapi.asmx?WSDL";
17
+ } else {
18
+ $url = "https://developer.quicksales.com.au/ws/wsapi.asmx?WSDL";
19
+ }
20
+
21
+ // The WSDL cache should be set to on to prevent the WSDL being loaded everytime.
22
+ ini_set("soap.wsdl_cache_enabled", "1");
23
+
24
+ // Create a new SoapClient referencing the Quicksales WSDL file.
25
+ $this->_client = new SoapClient($url, array('soap_version' => SOAP_1_2, 'trace' => TRUE));
26
+ // Define the security string that wraps your login details. Due to limitations
27
+ // with the PHP language this header information can only be provided via a string.
28
+ $headerSecurityStr =
29
+
30
+ "<API_Name", "Category_GetCategories")
31
+ "<API_Version", "1")
32
+ "<DevID", "Insert your devid here")
33
+ "<DevToken", "insert your devtoken here")
34
+
35
+ "<Security><UsernameToken><Username>" . $username . "</Username>".
36
+ "<Password>" . $password . "</Password></UsernameToken></Security>";
37
+
38
+ // Create a new SoapVar using the header security string.
39
+ $headerSecurityVar = new SoapVar($headerSecurityStr, XSD_ANYXML);
40
+
41
+ // Create a new SoapHeader containing all your login details.
42
+ $soapHeader = new SoapHeader('wsse:http://schemas.xmlsoap.org/ws/2002/04/secext', 'soapenv:Header', $headerSecurityVar);
43
+
44
+ // Add the SoapHeader to your SoapClient.
45
+ $this->_client->__setSoapHeaders(array($soapHeader));
46
+ //print_r(get_class_methods($this->_client));die;
47
+ $result = $this->_client->__doRequest(array());
48
+ return $this;
49
+
50
+ }
51
+
52
+ /**
53
+ * Gets quotes for a delivery.
54
+ *
55
+ * @param array $request the request parameters, in an array format.
56
+ *
57
+ * @return array
58
+ */
59
+ public function getQuotesByRequest($request)
60
+ {
61
+ if(!$this->_client) {
62
+ return false;
63
+ }
64
+
65
+ if (!$this->_is_sand) {
66
+ $request['clientId'] = Mage::helper('temando')->getClientId();
67
+ }
68
+ $response = $this->_client->getQuotesByRequest($request);
69
+
70
+ $quotes = array();
71
+ foreach ($response->quote as $quote_details) {
72
+ $quotes[] = Mage::getModel('temando/quote')
73
+ ->loadResponse($quote_details);
74
+ }
75
+
76
+ return $quotes;
77
+ }
78
+
79
+ public function makeBookingByRequest($request)
80
+ {
81
+ if (!$this->_is_sand) {
82
+ $request['clientId'] = Mage::helper('temando')->getClientId();
83
+ $request['promotionCode'] = Ewave_Quicksales_Model_Signup_Form::AFFILATE_PROMO;
84
+ }
85
+ if(!$this->_client) {
86
+ return false;
87
+ }
88
+
89
+ return $this->_client->makeBookingByRequest($request);
90
+ }
91
+
92
+ public function getRequest($request)
93
+ {
94
+ if (!$this->_client) {
95
+ return false;
96
+ }
97
+
98
+ return $this->_client->getRequest($request);
99
+ }
100
+
101
+ /**
102
+ * Gets the multiplier for insurance (currently 1%).
103
+ *
104
+ * To add insurance to a quote, the total price should be multiplied by
105
+ * this value.
106
+ */
107
+ public function getInsuranceMultiplier()
108
+ {
109
+ return 1.01; // 1%
110
+ }
111
+
112
+ public function createClient($request)
113
+ {
114
+ if (!$this->_client) {
115
+ return false;
116
+ }
117
+
118
+ return $this->_client->createClient($request);
119
+ }
120
+
121
+ public function getClient($request)
122
+ {
123
+ if (!$this->_client) {
124
+ return false;
125
+ }
126
+
127
+ return $this->_client->getClient($request);
128
+ }
129
+
130
+ public function updateClient($request)
131
+ {
132
+ if (!$this->_client) {
133
+ return false;
134
+ }
135
+
136
+ return $this->_client->updateClient($request);
137
+ }
138
+
139
+ }
app/code/community/Ewave/Quicksales/Model/Api/Createitem.php ADDED
@@ -0,0 +1,570 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_Api_Createitem extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ protected $_is_sand = false;
7
+
8
+ protected $_test_mode = false;
9
+
10
+ protected $_quiet = false;
11
+
12
+ protected $_api = null;
13
+
14
+ protected $_added = 0;
15
+ protected $_updated = 0;
16
+ protected $_errors = 0;
17
+
18
+
19
+ protected function _construct()
20
+ {
21
+ parent::_construct();
22
+ $this->_is_sand = Mage::getStoreConfig('quicksales/settings/sandbox');
23
+ $this->_api = Mage::getModel('quicksales/api');
24
+ }
25
+
26
+ protected function _getSession()
27
+ {
28
+ return Mage::getSingleton('adminhtml/session');
29
+ }
30
+
31
+ public function setQuiet($flag)
32
+ {
33
+ $this->_quiet = $flag;
34
+ $this->_api->setQuiet($flag);
35
+ return $this;
36
+ }
37
+
38
+ public function send($listing, $productId = null)
39
+ {
40
+ $message = '';
41
+ $result = 1;
42
+
43
+ $api = $this->_api;
44
+
45
+ if ($this->_test_mode) {
46
+
47
+ $result = $api->CreateItem();
48
+ if ($result instanceof Varien_Simplexml_Config) {
49
+ print_r($result->getNode()->asArray());
50
+ } else {
51
+ echo $result;
52
+ }
53
+ echo $api->getOnDate() . '<br />';
54
+ echo date('Y-m-d h:i:s', strtotime($api->getOnDate()));
55
+ die();
56
+ }
57
+
58
+ $listing_log = Mage::getModel('quicksales/listing_log');
59
+
60
+ $date = time();
61
+ $listing_log
62
+ ->setListingId($listing->getId())
63
+ ->setDate($date);
64
+ $listing_log->save();
65
+
66
+ $listing->getData('assigned_products');
67
+
68
+ $collection = Mage::getModel('catalog/product')->getCollection();
69
+ $collection->addIdFilter($listing->getData('assigned_products'));
70
+
71
+ $collection->addAttributeToSelect('*');
72
+
73
+ $collection->joinField('qty',
74
+ 'cataloginventory/stock_item',
75
+ 'qty',
76
+ 'product_id=entity_id',
77
+ '{{table}}.stock_id=1',
78
+ 'inner');
79
+
80
+ $collection->joinField('qlisting_id',
81
+ 'quicksales/listing_product',
82
+ 'quicksale_listing_id',
83
+ 'product_id=entity_id',
84
+ '{{table}}.listing_id="' . $listing->getId() . '"',
85
+ 'inner');
86
+ $collection->joinField('listing_product_assign_id',
87
+ 'quicksales/listing_product',
88
+ 'id',
89
+ 'product_id=entity_id',
90
+ '{{table}}.listing_id="' . $listing->getId() . '"',
91
+ 'inner');
92
+
93
+ $availableAttributes = $listing->getAttributesAssociation();
94
+ $assignedAttributes = array();
95
+ if (!empty($availableAttributes)) {
96
+ $attribute = Mage::getModel('eav/entity_attribute');
97
+ foreach ($availableAttributes as $qAttributeId => $mAttributeId) {
98
+ $attribute->load($mAttributeId);
99
+ // $collection->addAttributeToSelect($attribute->getAttributeCode());
100
+
101
+ $assignedAttributes[$qAttributeId] = $attribute->getAttributeCode();
102
+ }
103
+ }
104
+
105
+ $availableValues = $listing->getAttributeValuesAssociation();
106
+
107
+ $sellerId = Mage::getStoreConfig('quicksales/settings/vshop_seller');
108
+ $sellerPwd = Mage::getStoreConfig('quicksales/settings/seller_password');
109
+
110
+ $attrSet = Mage::getModel('quicksales/api_gettags')->getAttrSet($listing->getCategory());
111
+
112
+ $message .= '<b>Magento ListingID: ' . $listing->getId() . '</b><br />';
113
+
114
+ if (count($collection) == 0 && !$this->_quiet) {
115
+ throw new Exception('Please select a product');
116
+ }
117
+
118
+ foreach ($collection as $product) {
119
+
120
+ try {
121
+
122
+ if ($productId != null && $product->getId() != $productId) {
123
+ continue;
124
+ }
125
+
126
+ if ($product->getQlistingId()) {
127
+ $Item = new Varien_Simplexml_Element('<ReviseItemRequest></ReviseItemRequest>');
128
+ $xmlItem = new Varien_Simplexml_Config($Item);
129
+ $xmlItem->setNode('Item/ListingID', $product->getQlistingId());
130
+
131
+ } else {
132
+ $Item = new Varien_Simplexml_Element('<CreateItemRequest></CreateItemRequest>');
133
+ $xmlItem = new Varien_Simplexml_Config($Item);
134
+ }
135
+
136
+ $stopListing = false;
137
+
138
+ if (!$listing->getDefaultListingConf()) {
139
+ $listingConfiguration = $listing->getListingInformation();
140
+ } else {
141
+ $listingConfiguration = Mage::getStoreConfig('quicksales_default/listing');
142
+ }
143
+
144
+ $listingInformation = array();
145
+
146
+
147
+ if ($listingConfiguration['qty'] == 'custom') {
148
+ $listingInformation['qty'] = $listingConfiguration['qty_custom'];
149
+ } else {
150
+ $listingInformation['qty'] = $listingConfiguration['qty'];
151
+ }
152
+
153
+ $quantity = (int)$product->getData($listingInformation['qty']);
154
+
155
+ if ($quantity == 0) {
156
+ if ($product->getQlistingId()) {
157
+ $stopListing = true;
158
+ } else {
159
+ throw(new Exception('Invalid Quantity. Quantity must be between 1 to 999 , product: ' . $product->getName() . ', selected quantity: ' . $quantity));
160
+ }
161
+ }
162
+
163
+
164
+ if (!$stopListing) {
165
+
166
+ $xmlItem->setNode('Item/Title', $product->getName());
167
+
168
+ $xmlItem->setNode('Item/Category', $listing->getCategory());
169
+
170
+ if ($sellerId && $sellerPwd) {
171
+ $xmlItem->setNode('Item/SellerID', $sellerId);
172
+ $xmlItem->setNode('Item/SellerPwd', $sellerPwd);
173
+ }
174
+
175
+ if ($listing->getVshopCategory() && $listing->getVshopCategory() != 1) {
176
+ $xmlItem->setNode('Item/vShopCategory', $listing->getVshopCategory());
177
+ }
178
+
179
+ if (!empty($assignedAttributes) && !empty($availableValues)) {
180
+ $attributeCounter = 0;
181
+ foreach ($attrSet as $k => $setInfo) {
182
+ if ($k == '@' && !empty($setInfo)) {
183
+ } else {
184
+
185
+ if (
186
+ !($product->hasData($assignedAttributes[$setInfo['@']['AttrID']]))
187
+ || !$availableValues[$setInfo['@']['AttrID']][$product->getData($assignedAttributes[$setInfo['@']['AttrID']])]
188
+ ) {
189
+ continue;
190
+ }
191
+ $attributeCounter++;
192
+ }
193
+ }
194
+ if ($attributeCounter > 0) {
195
+
196
+ $xmlItem->setNode('Item/Tags/AttrSet', "");
197
+
198
+ $AttrSetTag = $xmlItem->getNode('Item/Tags/AttrSet');
199
+ $attributeCounter = 0;
200
+ foreach ($attrSet as $k => $setInfo) {
201
+ if ($k == '@' && !empty($setInfo)) {
202
+
203
+ foreach ($setInfo as $code => $value) {
204
+ $AttrSetTag->addAttribute($code, $value);
205
+ }
206
+ } else {
207
+
208
+ if (
209
+ !($product->hasData($assignedAttributes[$setInfo['@']['AttrID']]))
210
+ || !$availableValues[$setInfo['@']['AttrID']][$product->getData($assignedAttributes[$setInfo['@']['AttrID']])]
211
+ ) {
212
+ continue;
213
+ }
214
+ $attributeCounter++;
215
+ $xmlItem->setNode('Item/Tags/AttrSet/Attr' . $attributeCounter, "");
216
+ $AttrTag = $xmlItem->getNode('Item/Tags/AttrSet/Attr' . $attributeCounter);
217
+
218
+ $xmlItem->setNode('Item/Tags/AttrSet/Attr' . $attributeCounter . '/SelectedValue', "");
219
+ $ValueTag = $xmlItem->getNode('Item/Tags/AttrSet/Attr' . $attributeCounter . '/SelectedValue');
220
+
221
+ foreach ($setInfo['@'] as $kk => $attributeInfo) {
222
+ $AttrTag->addAttribute($kk, $attributeInfo);
223
+ if ($kk == 'AttrID') {
224
+
225
+ if (!empty($assignedAttributes) && $assignedAttributes[$attributeInfo]) {
226
+
227
+ $mValueId = $product->getData($assignedAttributes[$attributeInfo]);
228
+ $ValueTag
229
+ ->addAttribute('ValueID', $availableValues[$setInfo['@']['AttrID']][$mValueId]);
230
+
231
+ }
232
+ }
233
+ }
234
+ }
235
+ }
236
+ }
237
+
238
+ }
239
+
240
+ // Pricing
241
+ if (!$listing->getDefaultPricingConf()) {
242
+ $pricingConfiguration = $listing->getPricingInformation();
243
+ } else {
244
+ $pricingConfiguration = Mage::getStoreConfig('quicksales_default/pricing');
245
+ }
246
+
247
+ $pricingInformation = array();
248
+
249
+ if ($pricingConfiguration['auction_start_price'] == 'custom_price') {
250
+ $pricingInformation['auction_start_price'] = $pricingConfiguration['auction_start_price_custom'];
251
+ } else {
252
+ $pricingInformation['auction_start_price'] = $pricingConfiguration['auction_start_price'];
253
+ }
254
+
255
+ if ($pricingConfiguration['buy_now_price'] == 'custom_price') {
256
+ $pricingInformation['buy_now_price'] = $pricingConfiguration['auction_start_price_custom'];
257
+ } else {
258
+ $pricingInformation['buy_now_price'] = $pricingConfiguration['buy_now_price'];
259
+ }
260
+
261
+ $pricingInformation['bid_increment'] = $pricingConfiguration['bid_increment'];
262
+
263
+ $buy_now_price = 0;
264
+ $buyNowOnly = false;
265
+
266
+ if ($product->getData($pricingInformation['buy_now_price'])) {
267
+ $buy_now_price = $product->getData($pricingInformation['buy_now_price']);
268
+ $buy_now_price = number_format($buy_now_price, 2, '.', '');
269
+
270
+ $xmlItem->setNode('Item/BuyNowPrice', $buy_now_price);
271
+
272
+ if ($product->getData($pricingInformation['auction_start_price']) && $product->getData($pricingInformation['auction_start_price']) < $product->getData($pricingInformation['buy_now_price']) && $pricingInformation['bid_increment']) {
273
+ $xmlItem->setNode('Item/StartPrice', (float)$product->getData($pricingInformation['auction_start_price']));
274
+ $xmlItem->setNode('Item/BidIncrement', (float)$pricingInformation['bid_increment']);
275
+ } else {
276
+ $buyNowOnly = true;
277
+ }
278
+
279
+ } else {
280
+ if ($product->getData($pricingInformation['auction_start_price']) && $pricingInformation['bid_increment']) {
281
+ $xmlItem->setNode('Item/StartPrice', (float)$product->getData($pricingInformation['auction_start_price']));
282
+ $xmlItem->setNode('Item/BidIncrement', (float)$pricingInformation['bid_increment']);
283
+ }
284
+ }
285
+ // End Pricing
286
+
287
+
288
+ //Listing
289
+ if (!$listing->getDefaultListingConf()) {
290
+ $listingConfiguration = $listing->getListingInformation();
291
+ } else {
292
+ $listingConfiguration = Mage::getStoreConfig('quicksales_default/listing');
293
+ }
294
+
295
+ $listingInformation = array();
296
+
297
+
298
+ if ($listingConfiguration['description'] == 'custom') {
299
+ $listingInformation['custom_description'] = $listingConfiguration['description_custom'];
300
+ } else {
301
+ $listingInformation['description'] = $listingConfiguration['description'];
302
+ }
303
+
304
+ $listingInformation['duration'] = $listingConfiguration['duration'];
305
+
306
+
307
+ $listingInformation['start_date'] = $listingConfiguration['start_date'];
308
+
309
+ $listingInformation['brand_new'] = $listingConfiguration['brand_new'];
310
+ $listingInformation['auto_relist'] = $listingConfiguration['auto_relist'];
311
+
312
+
313
+ if ($listingConfiguration['qty'] == 'custom') {
314
+ $listingInformation['qty'] = $listingConfiguration['qty_custom'];
315
+ } else {
316
+ $listingInformation['qty'] = $listingConfiguration['qty'];
317
+ }
318
+
319
+ if (!$buyNowOnly) {
320
+ $listingInformation['bid_now'] = $listingConfiguration['bid_now'];
321
+ }
322
+
323
+ $listingInformation['auto_1min'] = $listingConfiguration['auto_1min'];
324
+
325
+ $xmlItem->setNode('Item/Description', ($listingInformation['description']
326
+ ? $product->getData($listingInformation['description'])
327
+ : $listingInformation['custom_description']));
328
+
329
+ if (!$buyNowOnly) {
330
+ $xmlItem->setNode('Item/Duration', $listingInformation['duration']);
331
+ }
332
+
333
+ if ($listingInformation['start_date']) {
334
+ $xmlItem->setNode('Item/StartTime', $listingInformation['start_date']);
335
+ }
336
+
337
+ $xmlItem->setNode('Item/BrandNew', $listingInformation['brand_new']);
338
+ $xmlItem->setNode('Item/Quantity', (int)$product->getData($listingInformation['qty']));
339
+
340
+ $xmlItem->setNode('Item/PromotionalFeatures/BidNow', $listingInformation['bid_now']);
341
+ $xmlItem->setNode('Item/PromotionalFeatures/Auto1Minute', $listingInformation['auto_1min']);
342
+
343
+ if (!empty($listingInformation['auto_relist'])) {
344
+ $xmlItem->setNode('Item/AutoRelistFeatures/AutoRelistType', $listingInformation['auto_relist']);
345
+ }
346
+
347
+ // End Listing
348
+
349
+ // Listing Upgrade
350
+ if (!$listing->getDefaultListingUpgradeConf()) {
351
+ $listingUpgradeConfiguration = $listing->getListingUpgradeInformation();
352
+ } else {
353
+ $listingUpgradeConfiguration = Mage::getStoreConfig('quicksales_default/listing_upgrade');
354
+ }
355
+
356
+ $listingUpgradeInformation = array();
357
+
358
+ $listingUpgradeInformation = $listingUpgradeConfiguration;
359
+
360
+
361
+ $xmlItem->setNode('Item/PromotionalFeatures/Frontpage', $listingUpgradeInformation['front_page_featured']);
362
+ $xmlItem->setNode('Item/PromotionalFeatures/CategorySpecial', $listingUpgradeInformation['category_special']);
363
+
364
+ $xmlItem->setNode('Item/PromotionalFeatures/HighlightListing', $listingUpgradeInformation['highlight_listing']);
365
+
366
+ $xmlItem->setNode('Item/PromotionalFeatures/Bold', $listingUpgradeInformation['bold_title']);
367
+
368
+ // End Listing Upgrade
369
+
370
+ // Payment
371
+ if (!$listing->getDefaultPaymentConf()) {
372
+ $PaymentConfiguration = $listing->getPaymentInformation();
373
+ } else {
374
+ $PaymentConfiguration = Mage::getStoreConfig('quicksales_default/payment');
375
+ }
376
+
377
+ $PaymentInformation = array();
378
+
379
+ $PaymentInformation = $PaymentConfiguration;
380
+
381
+ if (!is_array($PaymentInformation['method'])) {
382
+ $PaymentInformation['method'] = explode(',', $PaymentInformation['method']);
383
+ }
384
+
385
+ $payments = Mage::getModel('quicksales/source_payments')->getPayments();
386
+
387
+ foreach ($payments as $payment) {
388
+ $enable = (int)in_array($payment, $PaymentInformation['method']);
389
+ $xmlItem->setNode('Item/PaymentMethods/' . $payment, $enable);
390
+ }
391
+ /*
392
+ if (!empty($PaymentInformation['method'])) {
393
+ foreach ($PaymentInformation['method'] as $method) {
394
+ $xmlItem->setNode('Item/PaymentMethods/' . $method, '1');
395
+ }
396
+ }
397
+ */
398
+
399
+ $xmlItem->setNode('Item/ProvideReturnRefundPolicy', $PaymentInformation['show_policy']);
400
+
401
+
402
+ if (!empty($PaymentInformation['instruction'])) {
403
+ $xmlItem->setNode('Item/PaymentInst', $PaymentInformation['instruction']);
404
+ }
405
+
406
+ // End Payment
407
+
408
+ // Shipping
409
+ if (!$listing->getDefaultShippingConf()) {
410
+ $ShippingConfiguration = $listing->getShippingInformation();
411
+ } else {
412
+ $ShippingConfiguration = Mage::getStoreConfig('quicksales_default/shipping');
413
+ }
414
+
415
+ $ShippingInformation = array();
416
+
417
+ $ShippingInformation['Postage/Type'] = $ShippingConfiguration['method'];
418
+
419
+ if ($ShippingConfiguration['method'] == '2') {
420
+
421
+ if ($ShippingConfiguration['flat_rate'])
422
+ $ShippingInformation['Postage/FixedPostage'] = (float)$ShippingConfiguration['flat_rate'];
423
+ } elseif ($ShippingConfiguration['method'] == '3') {
424
+
425
+ $ShippingInformation['Postage/FixedPostageByLocation/NSW'] = (float)$ShippingConfiguration['flat_table_rate_nsw'];
426
+ $ShippingInformation['Postage/FixedPostageByLocation/VIC'] = (float)$ShippingConfiguration['flat_table_rate_vic'];
427
+ $ShippingInformation['Postage/FixedPostageByLocation/QLD'] = (float)$ShippingConfiguration['flat_table_rate_qld'];
428
+ $ShippingInformation['Postage/FixedPostageByLocation/ACT'] = (float)$ShippingConfiguration['flat_table_rate_act'];
429
+ $ShippingInformation['Postage/FixedPostageByLocation/NT'] = (float)$ShippingConfiguration['flat_table_rate_nt'];
430
+ $ShippingInformation['Postage/FixedPostageByLocation/TAS'] = (float)$ShippingConfiguration['flat_table_rate_tas'];
431
+ $ShippingInformation['Postage/FixedPostageByLocation/SA'] = (float)$ShippingConfiguration['flat_table_rate_sa'];
432
+ $ShippingInformation['Postage/FixedPostageByLocation/WA'] = (float)$ShippingConfiguration['flat_table_rate_wa'];
433
+
434
+ } elseif ($ShippingConfiguration['method'] == '4') {
435
+
436
+ $ShippingInformation['Postage/CalculatedPostage/OfferAPRegular'] = $ShippingConfiguration['au_post_regular'];
437
+
438
+ $ShippingInformation['Postage/CalculatedPostage/OfferAPExpress'] = $ShippingConfiguration['calc_au_post_express'];
439
+
440
+ $ShippingInformation['Postage/CalculatedPostage/Dimensions/Length'] = $product->getData($ShippingConfiguration['calc_length']);
441
+ $ShippingInformation['Postage/CalculatedPostage/Dimensions/Width'] = $product->getData($ShippingConfiguration['calc_width']);
442
+ $ShippingInformation['Postage/CalculatedPostage/Dimensions/Height'] = $product->getData($ShippingConfiguration['calc_height']);
443
+ $ShippingInformation['Postage/CalculatedPostage/Dimensions/Weight'] = $product->getData($ShippingConfiguration['calc_weight']);
444
+
445
+ } elseif ($ShippingConfiguration['method'] == '7') {
446
+
447
+ $ShippingInformation['Postage/Temando/PkgType'] = $ShippingConfiguration['temando_package'];
448
+
449
+ $ShippingInformation['Postage/Temando/Length'] = (int)$product->getData($ShippingConfiguration['temando_length']);
450
+ $ShippingInformation['Postage/Temando/Width'] = (int)$product->getData($ShippingConfiguration['temando_width']);
451
+ $ShippingInformation['Postage/Temando/Height'] = (int)$product->getData($ShippingConfiguration['temando_height']);
452
+ $ShippingInformation['Postage/Temando/Weight'] = (int)$product->getData($ShippingConfiguration['temando_weight']);
453
+
454
+ }
455
+
456
+ if (!is_array($ShippingConfiguration['posttolocation'])) {
457
+ $ShippingConfiguration['posttolocation'] = explode(',', $ShippingConfiguration['posttolocation']);
458
+ }
459
+
460
+ if (!empty($ShippingConfiguration['posttolocation'])) {
461
+ foreach ($ShippingConfiguration['posttolocation'] as $location) {
462
+ $ShippingInformation['PostToLocation/' . $location] = 1;
463
+ }
464
+ }
465
+
466
+ if (!empty($ShippingConfiguration['postinst'])) {
467
+ $ShippingInformation['PostInst'] = $ShippingConfiguration['postinst'];
468
+ }
469
+
470
+ foreach ($ShippingInformation as $node => $value) {
471
+ $xmlItem->setNode('Item/' . $node, $value);
472
+ }
473
+
474
+ // End Shipping
475
+
476
+ $images = Mage::getModel('catalog/product')->load($product->getId())->getMediaGalleryImages();
477
+
478
+ $counter = 0;
479
+ foreach ($images as $image) {
480
+ $counter++;
481
+ $xmlItem->setNode('Item/Pic' . $counter, $image->getUrl());
482
+ if ($counter == 3) {
483
+ break;
484
+ }
485
+ }
486
+
487
+ if ($buyNowOnly) {
488
+ //$xmlItem->setNode('DeleteField', 'ITEM.AUCTION_START_PRICE');
489
+ //$xmlItem->setNode('DeleteField', 'ITEM.BID_INCREMENT');
490
+ $root = $xmlItem->getNode();
491
+ $root->addChild('DeleteField', 'ITEM.AUCTION_START_PRICE');
492
+ $root->addChild('DeleteField', 'ITEM.BID_INCREMENT');
493
+
494
+ }
495
+
496
+ } else {
497
+ $xmlItem->setNode('Item/EndItem', 1);
498
+ }
499
+
500
+ if ($product->getQlistingId()) {
501
+ $result = $api->ReviseItem($xmlItem);
502
+ } else {
503
+ $result = $api->CreateItem($xmlItem);
504
+ }
505
+
506
+ if ($result instanceof Varien_Simplexml_Config) {
507
+ $resultInformation = $result->getNode()->asArray();
508
+ if ($resultInformation['ListingID']) {
509
+ $listing_product = Mage::getModel('quicksales/listing_product')->load($product->getListingProductAssignId());
510
+ if (!$product->getQlistingId()) {
511
+ $this->_added++;
512
+ } else {
513
+ $this->_updated++;
514
+ }
515
+
516
+ $listing_product->setQuicksaleListingId($resultInformation['ListingID']);
517
+ $listing_product->save();
518
+ } else {
519
+ $this->_errors++;
520
+ $result = 0;
521
+ }
522
+
523
+ $message .= $resultInformation['Message'];
524
+ } else {
525
+ $this->_errors++;
526
+ $message .= $result;
527
+ $result = 0;
528
+ }
529
+
530
+ } catch (Exception $e) {
531
+ $this->_errors++;
532
+ if (!$this->_quiet) {
533
+ $this->_getSession()->addError($e->getMessage());
534
+ }
535
+ $result = 0;
536
+ }
537
+
538
+ $date = strtotime($api->getOnDate());
539
+
540
+ $listing_product_log = Mage::getModel('quicksales/listing_product_log');
541
+ $listing_product_log
542
+ ->setAssociationId($product->getListingProductAssignId())
543
+ ->setDate($date)
544
+ ->setMessage($message)
545
+ ->setListingLogId($listing_log->getId());
546
+
547
+ $listing_product_log->save();
548
+ }
549
+
550
+ $message = '<b>Magento ListingID: '
551
+ . $listing->getId()
552
+ . '</b><br />'
553
+ .'
554
+ Added: ' . $this->_added . '<br />
555
+ Updated: ' . $this->_updated . '<br />
556
+ Errors: ' . $this->_errors . '<br />
557
+ ';
558
+
559
+ $listing_log
560
+ ->setResult($result)
561
+ ->setMessage($message);
562
+ $listing_log->save();
563
+
564
+ if (!$this->_quiet) {
565
+ $this->_getSession()->addNotice($message . 'Show detailed log: <a href="' . Mage::helper('adminhtml')->getUrl('quicksales/adminhtml_listing/productlog', array('id' => $listing_log->getId())) . '">Details</a>');
566
+ }
567
+ }
568
+ }
569
+
570
+ ?>
app/code/community/Ewave/Quicksales/Model/Api/Getcategories.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_Api_Getcategories extends Ewave_Quicksales_Model_Api_Action
4
+ {
5
+
6
+ protected $_options = null;
7
+
8
+ protected function prepareCategories($category1, $category2) {
9
+
10
+ return strcmp($category1['label'], $category2['label']);
11
+
12
+ }
13
+
14
+
15
+ public function getAllCategories()
16
+ {
17
+ if (!$this->_options) {
18
+
19
+ try {
20
+ $session = Mage::getSingleton('admin/session');
21
+
22
+ $this->_options = $session->getQuicksalesCategories();
23
+
24
+ if (!$this->_options) {
25
+ $xmlOblect = $this->_api->GetCategories();
26
+ //$xmlOblect = Mage::getModel('quicksales/api')->GetCategories();
27
+
28
+ if (!($xmlOblect instanceof Varien_Simplexml_Config)) {
29
+ return null;
30
+ }
31
+ $categories = $xmlOblect->getNode('CategoryArray');
32
+
33
+ $categoriesArray = array(
34
+
35
+ array(
36
+ 'value' => '',
37
+ 'label' => '',
38
+ 'parent' => ''
39
+ )
40
+
41
+ );
42
+
43
+
44
+ foreach ($categories->Category as $category) {
45
+ if ($category->CategoryNum == 0) {
46
+ continue;
47
+ }
48
+
49
+ $cat = $category->asArray();
50
+ $categoriesArray[] = array(
51
+ 'value' => $cat['CategoryNum'],
52
+ 'label' => $cat['CategoryName'],
53
+ 'parent' => (int)$cat['CategoryParentNum']
54
+ );
55
+ }
56
+ $this->_options = $categoriesArray;
57
+ $session->setQuicksalesCategories($categoriesArray);
58
+ }
59
+ } catch (Exception $e) {
60
+
61
+ Mage::logException($e);
62
+ return null;
63
+ }
64
+ }
65
+
66
+ return $this->_options;
67
+ }
68
+
69
+ public function getAllOptions($withEmpty = true, $defaultValues = false, $parentId = 0) {
70
+ $session = Mage::getSingleton('admin/session');
71
+ $categories = $session->getQuicksalesCategories();
72
+ $return = array();
73
+ foreach ($categories as $v) {
74
+ if ($v['parent'] == $parentId) {
75
+ $return[] = $v;
76
+ }
77
+ }
78
+
79
+ usort($return, array($this, 'prepareCategories'));
80
+
81
+ return $return;
82
+ }
83
+
84
+ public function getCategoryCache()
85
+ {
86
+
87
+ $categories = array();
88
+
89
+ if (!$this->_options) {
90
+ $this->getAllCategories();
91
+ }
92
+
93
+ if (count($this->_options) == 0) {
94
+ return null;
95
+ }
96
+
97
+ foreach ($this->_options as $cat) {
98
+ if (empty($cat['value'])) {
99
+ continue;
100
+ }
101
+ if ($categories[$cat['parent']]) {
102
+ $categories[$cat['value']] = $categories[$cat['parent']] . '/';
103
+ }
104
+ $categories[$cat['value']] .= $cat['label'];
105
+
106
+ }
107
+
108
+ return $categories;
109
+ }
110
+ }
111
+
app/code/community/Ewave/Quicksales/Model/Api/Getitem.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_Api_Getitem extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ protected $_is_sand = false;
7
+
8
+ protected $_test_mode = false;
9
+
10
+ protected $_quiet = false;
11
+
12
+ protected $_api = null;
13
+
14
+ protected $_added = 0;
15
+ protected $_updated = 0;
16
+ protected $_errors = 0;
17
+
18
+
19
+ protected function _construct()
20
+ {
21
+ parent::_construct();
22
+ $this->_is_sand = Mage::getStoreConfig('quicksales/settings/sandbox');
23
+ $this->_api = Mage::getModel('quicksales/api');
24
+ }
25
+
26
+ protected function _getSession()
27
+ {
28
+ return Mage::getSingleton('adminhtml/session');
29
+ }
30
+
31
+ public function setQuiet($flag)
32
+ {
33
+ $this->_quiet = $flag;
34
+ $this->_api->setQuiet($flag);
35
+ return $this;
36
+ }
37
+
38
+ public function getItem($data)
39
+ {
40
+ $api = $this->_api;
41
+
42
+ $listing_log = Mage::getModel('quicksales/listing_log');
43
+
44
+ $date = time();
45
+ $listing_log
46
+ ->setListingId($data->getListingId())
47
+ ->setDate($date);
48
+ $listing_log->save();
49
+
50
+
51
+ $sellerId = Mage::getStoreConfig('quicksales/settings/vshop_seller');
52
+ $sellerPwd = Mage::getStoreConfig('quicksales/settings/seller_password');
53
+
54
+ $Item = new Varien_Simplexml_Element('<GetItemRequest></GetItemRequest>');
55
+ $xmlItem = new Varien_Simplexml_Config($Item);
56
+ $xmlItem->setNode('ListingID', $data->getQuicksaleListingId());
57
+
58
+
59
+ $xmlItem->setNode('SellerID', $sellerId);
60
+ $xmlItem->setNode('SellerPwd', $sellerPwd);
61
+
62
+ $xmlItem->setNode('Status', 'SELLING');
63
+
64
+ $xmlItem->setNode('ReturnField', 'ITEM.QUANTITY');
65
+
66
+
67
+ $result = $api->GetItem($xmlItem);
68
+
69
+ if ($result instanceof Varien_Simplexml_Config) {
70
+ $resultInformation = $result->getNode()->asArray();
71
+ if ($resultInformation['ListingID'] || $resultInformation['Item']) {
72
+
73
+ $this->_updated++;
74
+
75
+ } else {
76
+ $this->_errors++;
77
+ }
78
+
79
+ $message = $resultInformation['Message'];
80
+ } else {
81
+ $this->_errors++;
82
+ $message = $result;
83
+ }
84
+
85
+ $date = strtotime($api->getOnDate());
86
+
87
+ $listing_product_log = Mage::getModel('quicksales/listing_product_log');
88
+ $listing_product_log
89
+ ->setAssociationId($data->getId())
90
+ ->setDate($date)
91
+ ->setMessage($message)
92
+ ->setListingLogId($listing_log->getId());
93
+
94
+ $listing_product_log->save();
95
+
96
+ $message = '
97
+ Updated: ' . $this->_updated . '<br />
98
+ Errors: ' . $this->_errors . '<br />
99
+ ';
100
+
101
+ $listing_log
102
+ ->setMessage($message);
103
+ $listing_log->save();
104
+
105
+ if (!$this->_quiet) {
106
+ $this->_getSession()->addNotice($message . 'Show detailed log: <a href="' . Mage::helper('adminhtml')->getUrl('quicksales/adminhtml_listing/productlog', array('id' => $listing_log->getId())) . '">Details</a>');
107
+ }
108
+
109
+ return $result;
110
+
111
+ }
112
+
113
+ public function synchronize($item)
114
+ {
115
+ $xmlResponce = $this->getItem($item);
116
+
117
+ if (!($xmlResponce instanceof Varien_Simplexml_Config)) {
118
+ return false;
119
+ }
120
+
121
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
122
+ $stockData = $product->getStockData();
123
+
124
+ $qty = (string)$xmlResponce->getNode('Item/Quantity');
125
+
126
+ if ($qty == $stockData['qty']) {
127
+ return false;
128
+ }
129
+
130
+ $stockData['qty'] = $qty;
131
+
132
+ $product->setStockData($stockData);
133
+
134
+ $product->save();
135
+ echo '.';
136
+ }
137
+
138
+ }
139
+
140
+ ?>
app/code/community/Ewave/Quicksales/Model/Api/Getorders.php ADDED
@@ -0,0 +1,585 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ <GetOrdersRequest>
5
+ <UserID>string</UserID>
6
+ <UserPwd>string</UserPwd>
7
+ <NumberOfDays>integer</NumberOfDays>
8
+ <RequestingRole>string</RequestingRole>
9
+ <InvoiceID>integer</InvoiceID>
10
+ </GetOrdersRequest>
11
+ */
12
+
13
+ class Ewave_Quicksales_Model_Api_Getorders extends Mage_Core_Model_Abstract
14
+ {
15
+
16
+ protected $_is_sand = false;
17
+
18
+ protected $_test_mode = false;
19
+
20
+ protected $_quiet = false;
21
+
22
+ protected $_api = null;
23
+
24
+ protected $_added = 0;
25
+ protected $_updated = 0;
26
+ protected $_errors = 0;
27
+
28
+ protected $_listing_log = null;
29
+
30
+
31
+ protected function _construct()
32
+ {
33
+ parent::_construct();
34
+ $this->_is_sand = Mage::getStoreConfig('quicksales/settings/sandbox');
35
+ $this->_api = Mage::getModel('quicksales/api');
36
+ }
37
+
38
+ protected function _getSession()
39
+ {
40
+ return Mage::getSingleton('adminhtml/session');
41
+ }
42
+
43
+ public function setQuiet($flag)
44
+ {
45
+ $this->_quiet = $flag;
46
+ $this->_api->setQuiet($flag);
47
+ return $this;
48
+ }
49
+
50
+ public function getOrders($data = null)
51
+ {
52
+ $api = $this->_api;
53
+ $rez = 1;
54
+
55
+ $this->_listing_log = Mage::getModel('quicksales/listing_log');
56
+
57
+ $date = time();
58
+
59
+ $this->_listing_log
60
+ ->setType(3)
61
+ ->setDate($date);
62
+ $this->_listing_log->save();
63
+
64
+ $sellerId = Mage::getStoreConfig('quicksales/settings/vshop_seller');
65
+ $sellerPwd = Mage::getStoreConfig('quicksales/settings/seller_password');
66
+
67
+ $Item = new Varien_Simplexml_Element('<GetOrdersRequest></GetOrdersRequest>');
68
+ $xmlItem = new Varien_Simplexml_Config($Item);
69
+
70
+ $xmlItem->setNode('UserID', $sellerId);
71
+ $xmlItem->setNode('UserPwd', $sellerPwd);
72
+
73
+ if (!empty($data)) {
74
+ foreach ($data as $field => $value) {
75
+ $xmlItem->setNode($field, $value);
76
+ }
77
+ }
78
+
79
+ $result = $api->GetOrders($xmlItem);
80
+
81
+ if ($result instanceof Varien_Simplexml_Config) {
82
+
83
+ $this->_updated++;
84
+ $message = '';
85
+ } else {
86
+ $this->_errors++;
87
+ $rez = 0;
88
+ $message = $result;
89
+ }
90
+
91
+ $this->_listing_log
92
+ ->setMessage($message)
93
+ ->setResult($rez)
94
+ ;
95
+ $this->_listing_log->save();
96
+
97
+
98
+ if (!$this->_quiet) {
99
+ //$this->_getSession()->addNotice($message . 'Show detailed log: <a href="' . Mage::helper('adminhtml')->getUrl('quicksales/adminhtml_listing/productlog', array('id' => $this->_listing_log->getId())) . '">Details</a>');
100
+ $this->_getSession()->addNotice($message);
101
+ }
102
+
103
+ return $result;
104
+
105
+ }
106
+
107
+ public function import($data = null)
108
+ {
109
+ $message = '';
110
+
111
+ if (empty($this->_listing_log)) {
112
+ $message = "Orders Import<br />\n";
113
+ }
114
+
115
+ if (!Mage::registry('quicksales_data')) {
116
+ Mage::register('quicksales_data', 1);
117
+ }
118
+
119
+ if (!Mage::getStoreConfig('quicksales/order_customer/import_orders')) {
120
+ return false;
121
+ }
122
+ $xmlResponce = $this->getOrders($data);
123
+
124
+ if (!($xmlResponce instanceof Varien_Simplexml_Config)) {
125
+ return false;
126
+ }
127
+
128
+ $importedOrders = array();
129
+ $pendingOrders = array();
130
+
131
+ $InvoiceArray = $xmlResponce->getNode('InvoiceArray');
132
+ foreach ($InvoiceArray->Invoice as $Invoice) {
133
+
134
+ $Transactions = $Invoice->TransactionArray;
135
+ foreach ($Transactions->Transaction as $Transaction) {
136
+ if ((string)$Transaction->ItemID == '') {
137
+ continue;
138
+ }
139
+
140
+ $ordersCount = 0;
141
+
142
+ foreach ($Transactions->Transaction as $t) {
143
+ if ((string)$Transaction->CheckoutDetails->CheckoutID == (string)$t->CheckoutDetails->CheckoutID) {
144
+ $ordersCount++;
145
+ }
146
+ }
147
+
148
+ $qhash = (string)$Transaction->ItemID;
149
+ $oldStatus = '';
150
+ $skeepOrder = false;
151
+
152
+ if ($qhash) {
153
+ $orders = Mage::getModel('sales/order')
154
+ ->getCollection()
155
+ ->addFieldToFilter('status', array('neq' => 'canceled'))
156
+ ->addAttributeToFilter('qhash', $qhash);
157
+
158
+ if ($orders->count() > 0) {
159
+ foreach ($orders as $order) {
160
+ // echo 'Order #' . $order->getId() . ' already imported <br />' . "\n";
161
+ $pendingOrders[$qhash] = $order->getId();
162
+ $oldStatus = $order->getStatus();
163
+ if ($oldStatus == 'qnot_checked_out' && ((string)$Transaction->CheckoutDetails->CheckoutID == '')) {
164
+ $skeepOrder = true;
165
+ break;
166
+ } elseif ($oldStatus == 'pending' && ((string)$Transaction->CheckoutDetails->CheckoutID != '')) {
167
+ $skeepOrder = true;
168
+ break;
169
+ }
170
+ }
171
+ }
172
+ }
173
+
174
+ if ($skeepOrder /*&& $qhash != 1314*/) {
175
+ continue;
176
+ }
177
+
178
+ try {
179
+ $customer = $this->prepareCustomer($Invoice->BuyerDetails);
180
+ $customer->setData('qhash', $qhash);
181
+
182
+ $order = $this->placeOrder($customer, array($Transaction), $ordersCount);
183
+ if ((string)$Invoice->InvoiceID != '') {
184
+ $order->setQuicksalesOrderId((string)$Invoice->InvoiceID);
185
+ $order->save();
186
+ }
187
+
188
+ if ((string)$Transaction->CheckoutDetails->PaypalTransaction->TransactionID != '' ) {
189
+ if ($order->canInvoice()) {
190
+ /**
191
+ * Create invoice
192
+ * The invoice will be in 'Pending' state
193
+ */
194
+ $invoiceId = Mage::getModel('sales/order_invoice_api')
195
+ ->create($order->getIncrementId(), array());
196
+
197
+ $invoice = Mage::getModel('sales/order_invoice')
198
+ ->loadByIncrementId($invoiceId);
199
+
200
+ $order->load($order->getId());
201
+
202
+ /**
203
+ * Pay invoice
204
+ * i.e. the invoice state is now changed to 'Paid'
205
+ */
206
+ $invoice->capture()->save();
207
+
208
+ Mage::getModel('quicksales/observer')->paidOrder($order);
209
+ $order->setState('qpaid', true);
210
+ $order->save();
211
+ }
212
+ }
213
+
214
+ $message .= $this->_listing_log->getMessage();
215
+
216
+ $message .= "<br />\n New order: #<a href='" . Mage::getModel('core/url')->getUrl('adminhtml/sales_order/view', array('order_id' => $order->getId())) . "'>" . $order->getIncrementId() . "</a><br />\n";
217
+
218
+ $pendingOrders[$qhash] = $order->getId();
219
+ $importedOrders[$order->getId()] = $order->getIncrementId();
220
+
221
+ } catch (Exception $e) {
222
+ $message .= "<br />\n" . $e->getMessage();
223
+ $this->_listing_log->setResult(0);
224
+ }
225
+ }
226
+
227
+ $this->_listing_log->setMessage($message);
228
+ }
229
+
230
+ $this->_listing_log->save();
231
+
232
+ $orders = Mage::getModel('sales/order')
233
+ ->getCollection()
234
+ ->addFieldToFilter('entity_id', array('nin' => $pendingOrders))
235
+ ->addFieldToFilter('status', array('pending', 'qnot_checked_out'))
236
+ ->addFieldToFilter('qhash', array('neq' => ''));
237
+
238
+ foreach ($orders as $order) {
239
+ /* @var $order Mage_Sales_Model_Order */
240
+
241
+ if ($order->canCancel()) {
242
+ $order->getPayment()->cancel();
243
+ $order_str = '';
244
+ if ($pendingOrders[$order->getQhash()]) {
245
+ $order_str = "New order is #" . $importedOrders[$pendingOrders[$order->getQhash()]];
246
+ }
247
+ $order->registerCancellation('Order canceled due to customer checkout. ' . $order_str);
248
+
249
+
250
+ Mage::dispatchEvent('order_cancel_after', array('order' => $order));
251
+ }
252
+ $order->save();
253
+ }
254
+
255
+ //echo 'Done';
256
+ file_put_contents('GetOrders_Responce.xml', $xmlResponce->getXmlString());
257
+
258
+ }
259
+
260
+ public function prepareCustomer($xmlInfo)
261
+ {
262
+
263
+ $customerImportConfig = Mage::getStoreConfig('quicksales/order_customer/customer_import');
264
+
265
+ $customerObject = null;
266
+
267
+ switch ($customerImportConfig) {
268
+ case 'guest':
269
+ $customerObject = Mage::getModel('customer/customer');
270
+ $username = explode(' ', $xmlInfo->Name);
271
+ $customerObject->setFirstname($username[0]);
272
+ $customerObject->setLastname($username[1]);
273
+ $customerObject->setEmail((string)$xmlInfo->Email);
274
+ $customerObject->setMode('guest');
275
+ break;
276
+ case 'import':
277
+ $customerObject = Mage::getModel('customer/customer')
278
+ ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
279
+ ->loadByEmail($xmlInfo->Email);
280
+ $customerId = $customerObject->getId();
281
+
282
+ // if (!$customerObject->getId()) {
283
+ $customerObject->setEmail($xmlInfo->Email);
284
+ $username = explode(' ', $xmlInfo->Name);
285
+ $customerObject->setFirstname($username[0]);
286
+ $customerObject->setLastname($username[1]);
287
+ $customerObject->setConfirmation(Mage::getStoreConfig('quicksales/order_customer/customer_notify'));
288
+ $customerObject->setPassword($customerObject->generatePassword());
289
+
290
+ $customerObject->save();
291
+
292
+ if (!$customerId && Mage::getStoreConfig('quicksales/order_customer/customer_notify') == 1) {
293
+ $customerObject->sendNewAccountEmail('registered');
294
+ }
295
+ // }
296
+
297
+ $username = explode(' ', $xmlInfo->Name);
298
+
299
+ $_custom_address = array(
300
+ 'firstname' => $username[0],
301
+ 'lastname' => $username[1],
302
+ 'street' => array(
303
+ '0' => (string)$xmlInfo->Address,
304
+ '1' => '',
305
+ ),
306
+
307
+ 'city' => (string)$xmlInfo->Suburb,
308
+ 'region_id' => '',
309
+ 'region' => (string)$xmlInfo->State,
310
+ 'postcode' => (string)$xmlInfo->Postcode,
311
+ 'country_id' => 'AU',
312
+ );
313
+
314
+ //$customAddress = Mage::getModel('customer/address');
315
+ $customAddress = $customerObject->getDefaultShippingAddress();
316
+ if (!$customAddress) {
317
+ $customAddress = Mage::getModel('customer/address')
318
+ ->setCustomer($customerObject)
319
+ ->setIsDefaultBilling('1')
320
+ ->setIsDefaultShipping('1');
321
+ }
322
+ $customAddress->addData($_custom_address);
323
+
324
+ $customAddress->save();
325
+
326
+ if (!$customerObject->getFirstname() || !$customerObject->getLastname()) {
327
+ $username = explode(' ', $xmlInfo->Name);
328
+ $customerObject->setFirstname($username[0]);
329
+ $customerObject->setLastname($username[1]);
330
+ $customerObject->save();
331
+ }
332
+
333
+ break;
334
+ case 'predefined':
335
+ $customerObject = Mage::getModel('customer/customer')
336
+ ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
337
+ ->loadByEmail(Mage::getStoreConfig('quicksales/order_customer/customer_email'));
338
+
339
+ if (!$customerObject->getId()) {
340
+ $customerObject->setEmail(Mage::getStoreConfig('quicksales/order_customer/customer_email'));
341
+ $username = explode(' ', $xmlInfo->Name);
342
+ $customerObject->setFirstname($username[0]);
343
+ $customerObject->setLastname($username[1]);
344
+ $customerObject->setConfirmation(Mage::getStoreConfig('quicksales/order_customer/customer_notify'));
345
+ $customerObject->save();
346
+ }
347
+
348
+ break;
349
+ }
350
+
351
+ $username = explode(' ', $xmlInfo->Name);
352
+
353
+ $_custom_address = array(
354
+ 'firstname' => $username[0],
355
+ 'lastname' => $username[1],
356
+ 'street' => array(
357
+ '0' => (string)$xmlInfo->Address,
358
+ '1' => '',
359
+ ),
360
+
361
+ 'city' => (string)$xmlInfo->Suburb,
362
+ 'region_id' => '',
363
+ 'region' => (string)$xmlInfo->State,
364
+ 'postcode' => (string)$xmlInfo->Postcode,
365
+ 'country_id' => 'AU',
366
+ );
367
+
368
+ $customAddress = $customerObject->getDefaultShippingAddress();
369
+ if (!$customAddress) {
370
+ $customAddress = Mage::getModel('customer/address')
371
+ ->setCustomer($customerObject)
372
+ ->setIsDefaultBilling('1')
373
+ ->setIsDefaultShipping('1');
374
+ }
375
+ $customAddress->addData($_custom_address);
376
+ $customerObject->setAddress($customAddress);
377
+
378
+ return $customerObject;
379
+ }
380
+
381
+ public function placeOrder($customerObj, $items, $ordersCount = 1)
382
+ {
383
+ if (!Mage::registry('isSecureArea')) {
384
+ Mage::register('isSecureArea', true);
385
+ }
386
+ $customerMessage = '';
387
+
388
+ $quoteObj = Mage::getModel('sales/quote')->assignCustomer($customerObj);
389
+
390
+ $quoteObj->getBillingAddress()->addData($customerObj->getAddress()->getData());
391
+ $quoteObj->getShippingAddress()->addData($customerObj->getAddress()->getData());
392
+
393
+ $quoteObj->reserveOrderId();
394
+
395
+ $checkoutIds = array();
396
+
397
+ $total = $shippingCost = $discount = 0;
398
+ $shippingMethod = '';
399
+ $checkoutId = '';
400
+ $qpaymentInfo = '';
401
+ foreach ($items as $item) {
402
+
403
+ /**
404
+ * @var $productListing Ewave_Quicksales_Model_Listing_Product
405
+ */
406
+ $productListing = Mage::getModel('quicksales/listing_product')->load((string)$item->ListingID, 'quicksale_listing_id');
407
+
408
+ /**
409
+ * @var $listing Ewave_Quicksales_Model_Listing
410
+ */
411
+ $listing = Mage::getModel('quicksales/listing')->load($productListing->getListingId());
412
+
413
+ $shippingMethod = Mage::getModel('quicksales/source_shipping')->getLabelById((string)$item->Postage->Type);
414
+
415
+ $productObj = Mage::getModel('catalog/product')->load($productListing->getProductId());
416
+
417
+ $productObj->setQty((string)$item->QuantitySold);
418
+ $productObj->setPrice((string)$item->UnitPrice);
419
+
420
+ //$productObj->setDiscountAmount((string)$item->UnitPrice);
421
+
422
+ $productObj->setCost((string)$item->UnitPrice);
423
+ $productObj->setSpecialPrice((string)$item->UnitPrice);
424
+ $productObj->setStatus(1);
425
+ $productObj->setName((string)$item->Title);
426
+
427
+ $productObj->setQitemId((string)$item->ItemID);
428
+
429
+
430
+ $quoteItem = Mage::getModel('sales/quote_item')->setProduct($productObj);
431
+
432
+ $quoteItem->setQty((string)$item->QuantitySold);
433
+
434
+
435
+ $customerName = explode(' ', (string)$item->CheckoutDetails->ShippingDetails->Name);
436
+
437
+ if ((string)$item->CheckoutDetails->ShippingDetails->Postcode != '') {
438
+ $_custom_address = array(
439
+ 'firstname' => $customerName[0],
440
+ 'lastname' => $customerName[1],
441
+ 'street' => array(
442
+ 0 => (string)$item->CheckoutDetails->ShippingDetails->Address
443
+ ),
444
+ 'city' => (string)$item->CheckoutDetails->ShippingDetails->Suburb,
445
+ 'region' => (string)$item->CheckoutDetails->ShippingDetails->State,
446
+ 'postcode' => (string)$item->CheckoutDetails->ShippingDetails->Postcode,
447
+ );
448
+ } else {
449
+
450
+ $_custom_address = $customerObj->getDefaultShippingAddress();
451
+
452
+ }
453
+
454
+ $quoteObj->getShippingAddress()->addData($_custom_address );
455
+
456
+ $checkoutId = (string)$item->CheckoutDetails->CheckoutID;
457
+
458
+ //if (!$checkoutIds[(string)$item->CheckoutDetails->CheckoutID]) {
459
+ $customerMessage .= "\n" . (string)$item->Title . ': ' . (string)$item->CheckoutDetails->BuyerMessage;
460
+
461
+ //$shippingCost = (float)$item->Postage->SingleItemPostageAmount;
462
+ $shippingCost = (float)$item->CheckoutDetails->PostageAndHandling;
463
+
464
+
465
+ $chargeOrDiscount = (float)$item->CheckoutDetails->SellerDiscountORCharges;
466
+
467
+ //if ($chargeOrDiscount < 0) {
468
+ $discount += $chargeOrDiscount;
469
+ //}
470
+
471
+
472
+ $discount = ($discount/$ordersCount);
473
+ $shippingCost = ($shippingCost/$ordersCount);
474
+
475
+ if ((string)$item->CheckoutDetails->CheckoutID == '' || !$shippingCost) {
476
+ $shippingCost = (float)$item->Postage->SingleItemPostageAmount;
477
+ }
478
+
479
+ $qpaymentInfo = (string)$item->CheckoutDetails->BuyerPaymentOption;
480
+ // $checkoutIds[(string)$item->CheckoutDetails->CheckoutID] = 1;
481
+ $total = (float)$item->UnitPrice * (float)$item->QuantitySold + $shippingCost + $discount;
482
+ //}
483
+
484
+ $quoteItem->setDiscountAmount($discount/$productObj->getQty());
485
+ $quoteItem->setBaseDiscountAmount($discount/$productObj->getQty());
486
+
487
+ $quoteObj->addItem($quoteItem);
488
+
489
+ }
490
+
491
+ //---start-update-address-------------------
492
+ $customAddress = $customerObj->getDefaultShippingAddress();
493
+ if (!$customAddress) {
494
+ $customAddress = Mage::getModel('customer/address')
495
+ ->setCustomer($customerObj)
496
+ ->setIsDefaultBilling('1')
497
+ ->setIsDefaultShipping('1');
498
+ }
499
+ $customAddress->addData($_custom_address);
500
+ if ($customerObj->getId()) {
501
+ $customAddress->save();
502
+ }
503
+
504
+ //---end-update-address-------------------
505
+
506
+ $quoteObj->collectTotals();
507
+
508
+ $quoteObj->save();
509
+
510
+ $quotePaymentObj = $quoteObj->getPayment();
511
+ //methods: authorizenet, paypal_express, googlecheckout, purchaseorder
512
+ $quotePaymentObj->setMethod('quicksales');
513
+ //$quotePaymentObj->canRefund();
514
+ $quoteObj->setPayment($quotePaymentObj);
515
+
516
+ $convertQuoteObj = Mage::getSingleton('sales/convert_quote');
517
+ /* @var $orderObj Mage_Sales_Model_Order */
518
+ $orderObj = $convertQuoteObj->addressToOrder($quoteObj->getShippingAddress());
519
+ $convertQuoteObj->paymentToOrderPayment($quotePaymentObj);
520
+
521
+ $orderObj->setBillingAddress($convertQuoteObj->addressToOrderAddress($quoteObj->getBillingAddress()));
522
+ $orderObj->setPayment($convertQuoteObj->paymentToOrderPayment($quoteObj->getPayment()));
523
+ $orderObj->setShippingAddress($convertQuoteObj->addressToOrderAddress($quoteObj->getShippingAddress()));
524
+
525
+ foreach ($quoteObj->getAllItems() as $item) {
526
+ /*
527
+ @var $item Mage_Sales_Model_Quote_Item
528
+ */
529
+ $orderItem = $convertQuoteObj->itemToOrderItem($item);
530
+ $orderItem->setQitemId($orderItem->getProduct()->getQitemId());
531
+ if ($item->getParentItem()) {
532
+ $orderItem->setParentItem($orderObj->getItemByQuoteItemId($item->getParentItem()->getId()));
533
+ }
534
+ $orderItem->setDiscountAmount(-$discount);
535
+ $orderItem->setBaseDiscountAmount(-$discount);
536
+ $orderObj->addItem($orderItem);
537
+ }
538
+
539
+
540
+ $orderObj->setQpaymentInfo($qpaymentInfo);
541
+
542
+ $orderObj->setCanShipPartiallyItem(false);
543
+ $orderObj->setQhash($customerObj->getQhash());
544
+
545
+ $orderObj->setGrandTotal($total);
546
+
547
+ $orderObj->setShippingMethod('flatrate_flatrate');
548
+ $orderObj->setShippingDescription($shippingMethod);
549
+
550
+
551
+ $orderObj->setBaseShippingAmount($shippingCost);
552
+ $orderObj->setShippingAmount($shippingCost);
553
+
554
+ $orderObj->setBaseDiscountAmount($discount);
555
+ $orderObj->setDiscountAmount($discount);
556
+
557
+
558
+ $orderObj->setCustomerEmail($customerObj->getEmail());
559
+
560
+ /*
561
+ $orderObj->setShippingInclTax($shippingCost);
562
+ $orderObj->setBaseShippingInclTax($shippingCost);
563
+ */
564
+
565
+ $totalDue = $orderObj->getTotalDue();
566
+
567
+ $orderObj->setQsource(1);
568
+ $orderObj->place(); //calls _placePayment
569
+
570
+ Mage::app()->getStore(null)->setConfig('cataloginventory/options/can_subtract', Mage::getStoreConfig('quicksales/stock/update_magento_qty_quicksale_sold'));
571
+ Mage::dispatchEvent('sales_model_service_quote_submit_before', array('order' => $orderObj, 'quote' => $quoteObj));
572
+
573
+ if (!$checkoutId) {
574
+ $orderObj->setState('qnot_checked_out', true);
575
+ }
576
+ $orderObj->save();
577
+ //$order = Mage::getModel('sales/order')->load($orderObj->getId());
578
+
579
+ //$orderId = $orderObj->getId();
580
+ // echo "<p>orderId: $orderId </p>";
581
+
582
+ return $orderObj;
583
+
584
+ }
585
+ }
app/code/community/Ewave/Quicksales/Model/Api/Gettags.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_Api_Gettags extends Mage_Eav_Model_Entity_Attribute_Source_Table
4
+ {
5
+ private $_attributeTags = array(
6
+ 'Attr1',
7
+ 'Attr2',
8
+ 'Attr3',
9
+ 'Attr4',
10
+ 'Attr5',
11
+ 'Attr6',
12
+ 'Attr7',
13
+ 'Attr8',
14
+ 'Attr9',
15
+ 'Attr10',
16
+
17
+ );
18
+
19
+ private $qAttributes = array();
20
+ private $qAttributesValues = array();
21
+
22
+ public function getAttributes($categoryId)
23
+ {
24
+
25
+ if (!$categoryId) {
26
+ return false;
27
+ }
28
+
29
+ if ($this->qAttributes[$categoryId]) {
30
+ return array($this->qAttributes[$categoryId], $this->qAttributesValues[$categoryId]);
31
+ }
32
+
33
+ $xmlOblect = new Varien_Simplexml_Config($path = Mage::getModuleDir('', 'Ewave_Quicksales') . DS . 'xml' . DS . 'GetTags_Request.xml');
34
+ $param = $xmlOblect->getNode('CategoryNum');
35
+ $param[0] = $categoryId;
36
+ $xmlResponce = Mage::getModel('quicksales/api')->GetTags($xmlOblect);
37
+
38
+ if (!($xmlResponce instanceof Varien_Simplexml_Config)) {
39
+ return false;
40
+ }
41
+
42
+ $attributes = $xmlResponce->getNode('Tags/AttrSet');
43
+
44
+ $attrSet = $attributes->asArray();
45
+
46
+ $session = $this->_getSession();
47
+
48
+ $session->unsAttrSets();
49
+ $attrSets = $session->getAttrSets();
50
+ $attrSets[$categoryId] = $attrSet;
51
+
52
+ $this->_getSession()->setAttrSets($attrSets);
53
+
54
+ $this->qAttributes[$categoryId] = array();
55
+ $this->qAttributesValues[$categoryId] = array();
56
+
57
+
58
+ foreach ($this->_attributeTags as $attributeTag) {
59
+ $attributeObj = $attributes->$attributeTag;
60
+ $attributeId = $attributeObj->getAttribute('AttrID');
61
+ $attributeName = $attributeObj->getAttribute('AttrName');
62
+ if (!$attributeId) {
63
+ continue;
64
+ }
65
+ $this->qAttributes[$categoryId][] = array(
66
+ 'id' => $attributeId,
67
+ 'name' => $attributeName
68
+ );
69
+
70
+ $this->qAttributesValues[$categoryId][$attributeId] = array();
71
+
72
+ foreach ($attributeObj->Value as $valueTag) {
73
+ $this->qAttributesValues[$categoryId][$attributeId][] = array(
74
+ 'id' => $valueTag->getAttribute('ValueID'),
75
+ 'name' => $valueTag->getAttribute('ValueName'),
76
+ );
77
+ }
78
+
79
+ }
80
+
81
+ $return = array($this->qAttributes[$categoryId], $this->qAttributesValues[$categoryId]);
82
+ $this->_getSession()->setQuicksalesCategoriesTags($return);
83
+
84
+ return $return;
85
+ }
86
+
87
+
88
+ public function getTagsValues()
89
+ {
90
+ $ses_data = $this->_getSession()->getQuicksalesCategoriesTags();
91
+ if ($ses_data) {
92
+ return $ses_data;
93
+ }
94
+
95
+ return array();
96
+ }
97
+
98
+ public function _getSession()
99
+ {
100
+ return Mage::getSingleton('admin/session');
101
+ }
102
+
103
+ public function getSavedAttrSet($categoryId)
104
+ {
105
+ $attrSets = $this->_getSession()->getAttrSets();
106
+
107
+ if (!$attrSets[$categoryId]) {
108
+ $this->getAttributes($categoryId);
109
+ $attrSets = $this->_getSession()->getAttrSets();
110
+ }
111
+ return $attrSets[$categoryId];
112
+ }
113
+
114
+ public function getAttrSet($categoryId)
115
+ {
116
+ $savedSets = $this->getSavedAttrSet($categoryId);
117
+ return $savedSets;
118
+ }
119
+ }
app/code/community/Ewave/Quicksales/Model/Api/Getvshopcategory.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ewave_Quicksales_Model_Api_Getvshopcategory extends Mage_Core_Model_Abstract
3
+ {
4
+
5
+ /**
6
+ * Retrieve adminhtml session model object
7
+ *
8
+ * @return Mage_Adminhtml_Model_Session
9
+ */
10
+ protected function _getSession()
11
+ {
12
+ return Mage::getSingleton('adminhtml/session');
13
+ }
14
+
15
+ public function getVshopCategories()
16
+ {
17
+ /*
18
+ $xmlOblect = new Varien_Simplexml_Config($path = Mage::getModuleDir('', 'Ewave_Quicksales') . DS . 'xml' . DS . 'GetvShopCategories_Request.xml');
19
+ $param = $xmlOblect->getNode('SellerID');
20
+ */
21
+
22
+ $xml = new Varien_Simplexml_Element('<GetVshopCategoryRequest></GetVshopCategoryRequest>');
23
+ $xmlOblect = new Varien_Simplexml_Config($xml);
24
+
25
+
26
+ $this->_is_sand = Mage::getStoreConfig('quicksales/settings/sandbox');
27
+
28
+ $seller = Mage::getStoreConfig('quicksales/settings/vshop_seller');
29
+ $xmlOblect->setNode('SellerID', $seller);
30
+
31
+ $xmlResponce = Mage::getModel('quicksales/api')->GetVshopCategories($xmlOblect);
32
+
33
+ if (!($xmlResponce instanceof Varien_Simplexml_Config)) {
34
+
35
+ return false;
36
+ }
37
+
38
+ $vCategories = $xmlResponce->getNode('CategoryArray');
39
+
40
+ $result = array();
41
+ foreach ($vCategories->Category as $vCategory) {
42
+ $data = $vCategory->asArray();
43
+ $result[] = array(
44
+ 'id' => $data['CategoryNum'],
45
+ 'level' => $data['CategoryLevel'],
46
+ 'parent' => $data['CategoryParentNum'],
47
+ 'leaf' => $data['LeafCategory'],
48
+ 'name' => $data['CategoryName']
49
+ );
50
+ }
51
+
52
+ return $result;
53
+ }
54
+
55
+ }
56
+
57
+ ?>
58
+
app/code/community/Ewave/Quicksales/Model/Api/Sendinvoice.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ <SendInvoiceRequest>
4
+ <SellerID>string</SellerID>
5
+ <SellerPwd>string</SellerPwd>
6
+ <BuyerID>string</BuyerID>
7
+ <InvoiceID>integer</InvoiceID>
8
+ <CheckoutID>integer</CheckoutID>
9
+ <ItemArray>
10
+ <Item>
11
+ <ItemID>integer</ItemID>
12
+ <Quantity>integer</Quantity>
13
+ </Item>
14
+ </ItemArray>
15
+ <Postage>decimal</Postage>
16
+ <Insurance>decimal</Insurance>
17
+ <SellerDiscountORCharges>decimal</SellerDiscountORCharges>
18
+ <GSTType>integer</GSTType>
19
+ <PaymentMethods>
20
+ <BankCheque>integer</BankCheque>
21
+ <BankDeposit>integer</BankDeposit>
22
+ <Cash>integer</Cash>
23
+ <COD>integer</COD>
24
+ <CreditCard>integer</CreditCard>
25
+ <Escrow>integer</Escrow>
26
+ <MoneyOrder>integer</MoneyOrder>
27
+ <Paymate>integer</Paymate>
28
+ <PayPal>integer</PayPal>
29
+ <PersonalCheque>integer</PersonalCheque>
30
+ <Other>integer</Other>
31
+ </PaymentMethods>
32
+ <PayPalEmailAddress>string</PayPalEmailAddress>
33
+ <PaymentInstructions>string</PaymentInstructions>
34
+ <PostageInstructions>string</PostageInstructions>
35
+ <MessageToBuyer>string</MessageToBuyer>
36
+ <SendCopyToSeller>integer</SendCopyToSeller>
37
+ <ResendInvoice>integer</ResendInvoice>
38
+ </SendInvoiceRequest>
39
+ */
40
+
41
+ class Ewave_Quicksales_Model_Api_Sendinvoice extends Mage_Core_Model_Abstract
42
+ {
43
+
44
+ protected $_is_sand = false;
45
+
46
+ protected $_test_mode = false;
47
+
48
+ protected $_quiet = false;
49
+
50
+ protected $_api = null;
51
+
52
+ protected $_added = 0;
53
+ protected $_updated = 0;
54
+ protected $_errors = 0;
55
+
56
+
57
+ protected function _construct()
58
+ {
59
+ parent::_construct();
60
+ $this->_is_sand = Mage::getStoreConfig('quicksales/settings/sandbox');
61
+ $this->_api = Mage::getModel('quicksales/api');
62
+ }
63
+
64
+ protected function _getSession()
65
+ {
66
+ return Mage::getSingleton('adminhtml/session');
67
+ }
68
+
69
+ public function setQuiet($flag)
70
+ {
71
+ $this->_quiet = $flag;
72
+ $this->_api->setQuiet($flag);
73
+ return $this;
74
+ }
75
+
76
+ public function sendInvoice($order, $invoice, $data = null)
77
+ {
78
+ $api = $this->_api;
79
+
80
+ $listing_log = Mage::getModel('quicksales/listing_log');
81
+
82
+ $date = time();
83
+ $rez = 1;
84
+
85
+ $listing_log
86
+ ->setOrderId($order->getId())
87
+ ->setType(2)
88
+ ->setDate($date);
89
+ $listing_log->save();
90
+
91
+ $sellerId = Mage::getStoreConfig('quicksales/settings/vshop_seller');
92
+ $sellerPwd = Mage::getStoreConfig('quicksales/settings/seller_password');
93
+
94
+ $Item = new Varien_Simplexml_Element('<SendInvoiceRequest></SendInvoiceRequest>');
95
+ $xmlItem = new Varien_Simplexml_Config($Item);
96
+
97
+ $xmlItem->setNode('SellerID', $sellerId);
98
+ $xmlItem->setNode('SellerPwd', $sellerPwd);
99
+
100
+ if (!empty($data)) {
101
+ foreach ($data as $field => $value) {
102
+ $xmlItem->setNode($field, $value);
103
+ }
104
+ }
105
+
106
+ $qhash = $order->getQhash();
107
+ $qItems = explode('-', $qhash);
108
+ $xmlItem->setNode('ItemArray', null);
109
+
110
+
111
+ $ItemArray = $xmlItem->getNode('ItemArray');
112
+ foreach ($invoice->getAllItems() as $qItem) {
113
+ if ($qItem->getQty() <= 0 || !$qItem->getOrderItem()->getQitemId()) {
114
+ continue;
115
+ }
116
+ $item = $ItemArray->addChild('Item', null);
117
+ $item->addChild('ItemID', $qItem->getOrderItem()->getQitemId());
118
+ $item->addChild('Quantity', (int)$qItem->getQty());
119
+
120
+ }
121
+ /*
122
+ foreach ($qItems as $qItem) {
123
+ $item = $ItemArray->addChild('Item', null);
124
+ $item->addChild('ItemID', $qItem);
125
+ }
126
+ */
127
+
128
+ $result = $api->SendInvoice($xmlItem);
129
+
130
+ if ($result instanceof Varien_Simplexml_Config) {
131
+ $resultInformation = $result->getNode()->asArray();
132
+ if ($resultInformation['InvoiceID']) {
133
+
134
+ $this->_updated++;
135
+
136
+ } else {
137
+ $this->_errors++;
138
+ $rez = 0;
139
+ }
140
+
141
+ $message = $resultInformation['Message'];
142
+ } else {
143
+ $this->_errors++;
144
+ $rez = 0;
145
+ $message = $result;
146
+ }
147
+
148
+ $listing_log
149
+ ->setMessage($message)
150
+ ->setResult($rez)
151
+ ;
152
+ $listing_log->save();
153
+
154
+
155
+ if (!$this->_quiet) {
156
+ //$this->_getSession()->addNotice($message . 'Show detailed log: <a href="' . Mage::helper('adminhtml')->getUrl('quicksales/adminhtml_listing/productlog', array('id' => $listing_log->getId())) . '">Details</a>');
157
+ $this->_getSession()->addNotice($message);
158
+ }
159
+
160
+ return $result;
161
+
162
+ }
163
+
164
+ public function send($order = null, $invoice = null)
165
+ {
166
+ $data = array();
167
+
168
+ if ($order->getInsurance()) {
169
+ $data['Insurance'] = $order->getInsurance();
170
+ }
171
+
172
+ if ($order->getShippingAmount()) {
173
+ $data['Postage'] = $order->getShippingAmount();
174
+ }
175
+
176
+ if ($order->getDiscountAmount()) {
177
+ $data['SellerDiscountORCharges'] = $order->getDiscountAmount();
178
+ }
179
+
180
+ $xmlResponce = $this->sendInvoice($order, $invoice, $data);
181
+
182
+ if (!($xmlResponce instanceof Varien_Simplexml_Config)) {
183
+ return false;
184
+ }
185
+
186
+ $quicksaleOrderId = $order->getQuicksalesOrderId();
187
+
188
+ if ($quicksaleOrderId) {
189
+ $quicksaleOrderId .= '-';
190
+ }
191
+
192
+ $quicksaleOrderId .= (string)$xmlResponce->getNode('InvoiceID');
193
+
194
+ $invoice->setQuicksalesOrderId((string)$xmlResponce->getNode('InvoiceID'));
195
+ $invoice->save();
196
+
197
+ $order->setQuicksalesOrderId($quicksaleOrderId);
198
+ $order->save();
199
+
200
+ file_put_contents('SendInvoice_Response.xml', $xmlResponce->getXmlString());
201
+ //die('@');
202
+ }
203
+
204
+ }
app/code/community/Ewave/Quicksales/Model/Api/Updateorder.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ <UpdateOrderRequest>
4
+ <UserID>string</UserID>
5
+ <UserPwd>string</UserPwd>
6
+ <InvoiceID>integer</InvoiceID>
7
+ <Action>integer</Action>
8
+ <NotifyBuyer>integer</NotifyBuyer>
9
+ </UpdateOrderRequest>
10
+ */
11
+
12
+ class Ewave_Quicksales_Model_Api_Updateorder extends Mage_Core_Model_Abstract
13
+ {
14
+
15
+ protected $_is_sand = false;
16
+
17
+ protected $_test_mode = false;
18
+
19
+ protected $_quiet = false;
20
+
21
+ protected $_api = null;
22
+
23
+ protected $_added = 0;
24
+ protected $_updated = 0;
25
+ protected $_errors = 0;
26
+
27
+
28
+ protected function _construct()
29
+ {
30
+ parent::_construct();
31
+ $this->_is_sand = Mage::getStoreConfig('quicksales/settings/sandbox');
32
+ $this->_api = Mage::getModel('quicksales/api');
33
+ }
34
+
35
+ protected function _getSession()
36
+ {
37
+ return Mage::getSingleton('adminhtml/session');
38
+ }
39
+
40
+ public function setQuiet($flag)
41
+ {
42
+ $this->_quiet = $flag;
43
+ $this->_api->setQuiet($flag);
44
+ return $this;
45
+ }
46
+
47
+ public function updateOrder($data = null, $orderId)
48
+ {
49
+ $api = $this->_api;
50
+
51
+
52
+ $listing_log = Mage::getModel('quicksales/listing_log');
53
+
54
+ $date = time();
55
+ $rez = 1;
56
+
57
+ $listing_log
58
+ ->setOrderId($orderId)
59
+ ->setType(2)
60
+ ->setDate($date);
61
+ $listing_log->save();
62
+
63
+ $sellerId = Mage::getStoreConfig('quicksales/settings/vshop_seller');
64
+ $sellerPwd = Mage::getStoreConfig('quicksales/settings/seller_password');
65
+
66
+ $Item = new Varien_Simplexml_Element('<UpdateOrderRequest></UpdateOrderRequest>');
67
+ $xmlItem = new Varien_Simplexml_Config($Item);
68
+
69
+ $xmlItem->setNode('UserID', $sellerId);
70
+ $xmlItem->setNode('UserPwd', $sellerPwd);
71
+
72
+ if (!empty($data)) {
73
+ foreach ($data as $field => $value) {
74
+ $xmlItem->setNode($field, $value);
75
+ }
76
+ }
77
+
78
+
79
+ $result = $api->UpdateOrder($xmlItem);
80
+
81
+ if ($result instanceof Varien_Simplexml_Config) {
82
+ $resultInformation = $result->getNode()->asArray();
83
+ if ($resultInformation['InvoiceID']) {
84
+
85
+ $this->_updated++;
86
+
87
+ } else {
88
+ $this->_errors++;
89
+ $rez = 0;
90
+ }
91
+
92
+ $message = $resultInformation['Message'];
93
+ } else {
94
+ $this->_errors++;
95
+ $rez = 0;
96
+ $message = $result;
97
+ }
98
+
99
+ $listing_log
100
+ ->setMessage($message)
101
+ ->setResult($rez)
102
+ ;
103
+ $listing_log->save();
104
+
105
+
106
+ if (!$this->_quiet) {
107
+ $this->_getSession()->addNotice($message );
108
+ }
109
+
110
+ return $result;
111
+
112
+ }
113
+
114
+ public function update($data = null, $orderId = null)
115
+ {
116
+ $xmlResponce = $this->updateOrder($data, $orderId);
117
+
118
+ if (!($xmlResponce instanceof Varien_Simplexml_Config)) {
119
+ return false;
120
+ }
121
+
122
+ file_put_contents('UpdateOrderResponse.xml', $xmlResponce->getXmlString());
123
+
124
+ }
125
+
126
+ }
app/code/community/Ewave/Quicksales/Model/Attribute/Backend/Multiselect.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ewave_Quicksales_Model_Attribute_Backend_Multiselect extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract {
3
+
4
+ /**
5
+ * Before Attribute Save Process
6
+ *
7
+ * @param Varien_Object $object
8
+ * @return Mage_Catalog_Model_Category_Attribute_Backend_Sortby
9
+ */
10
+ public function beforeSave($object)
11
+ {
12
+ $attributeCode = $this->getAttribute()->getName();
13
+
14
+ $data = $object->getData($attributeCode);
15
+ if (!is_array($data)) {
16
+ $data = array();
17
+ }
18
+ $object->setData($attributeCode, join(',', $data));
19
+
20
+ if (is_null($object->getData($attributeCode))) {
21
+ $object->setData($attributeCode, false);
22
+ }
23
+ return $this;
24
+ }
25
+
26
+ public function afterLoad($object)
27
+ {
28
+ $attributeCode = $this->getAttribute()->getName();
29
+ $data = $object->getData($attributeCode);
30
+ if ($data) {
31
+ $object->setData($attributeCode, explode(',', $data));
32
+ }
33
+
34
+ return $this;
35
+ }
36
+
37
+ }
app/code/community/Ewave/Quicksales/Model/Catalog/Resource/Product/Type/Configurable/Attribute/Collection.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 03.10.11
6
+ * Time: 11:07
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Catalog_Resource_Product_Type_Configurable_Attribute_Collection
11
+ extends Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
12
+ {
13
+
14
+ public function getStoreId()
15
+ {
16
+ if (!$this->getProduct()) {
17
+ return 0;
18
+ }
19
+ return (int)$this->_product->getStoreId();
20
+ }
21
+ /**
22
+ * Add product attributes to collection items
23
+ *
24
+ * @return Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
25
+ */
26
+ protected function _addProductAttributes()
27
+ {
28
+
29
+ if (!$this->getProduct()) {
30
+ return $this;
31
+ }
32
+
33
+ foreach ($this->_items as $item) {
34
+ $productAttribute = $this->getProduct()->getTypeInstance(true)
35
+ ->getAttributeById($item->getAttributeId(), $this->getProduct());
36
+ $item->setProductAttribute($productAttribute);
37
+ }
38
+ return $this;
39
+ }
40
+
41
+ /**
42
+ * Add Associated Product Filters (From Product Type Instance)
43
+ *
44
+ * @return Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection
45
+ */
46
+ public function _addAssociatedProductFilters()
47
+ {
48
+ if (!$this->getProduct()) {
49
+ return $this;
50
+ }
51
+
52
+ $this->getProduct()->getTypeInstance(true)
53
+ ->getUsedProducts($this->getColumnValues('attribute_id'), $this->getProduct()); // Filter associated products
54
+ return $this;
55
+ }
56
+ }
app/code/community/Ewave/Quicksales/Model/Entity/Setup.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 11:30
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Entity_Setup extends Mage_Eav_Model_Entity_Setup
11
+ {
12
+
13
+ /**
14
+ * Enter description here...
15
+ *
16
+ * @param unknown_type $baseName
17
+ * @param array $options
18
+ * - no-main
19
+ * - no-default-types
20
+ * - types
21
+ * @return unknown
22
+ */
23
+ public function createEntityTables($baseName, array $options = array())
24
+ {
25
+ $sql = '';
26
+
27
+ if (empty($options['no-main'])) {
28
+ $sql = "
29
+ DROP TABLE IF EXISTS `{$baseName}`;
30
+ CREATE TABLE `{$baseName}` (
31
+ `entity_id` int(10) unsigned NOT NULL auto_increment,
32
+ `entity_type_id` smallint(8) unsigned NOT NULL default '0',
33
+ `attribute_set_id` smallint(5) unsigned NOT NULL default '0',
34
+ `increment_id` varchar(50) NOT NULL default '',
35
+ `parent_id` int(10) unsigned NULL default '0',
36
+ `store_id` smallint(5) unsigned NOT NULL default '0',
37
+ `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
38
+ `updated_at` datetime NOT NULL default '0000-00-00 00:00:00',
39
+ `is_active` tinyint(1) unsigned NOT NULL default '1',
40
+ PRIMARY KEY (`entity_id`),
41
+ CONSTRAINT `FK_{$baseName}_type` FOREIGN KEY (`entity_type_id`) REFERENCES `eav_entity_type` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE,
42
+ CONSTRAINT `FK_{$baseName}_store` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
43
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
44
+ }
45
+
46
+ $types = array(
47
+ 'datetime' => 'datetime',
48
+ 'decimal' => 'decimal(12,4)',
49
+ 'int' => 'int',
50
+ 'text' => 'text',
51
+ 'varchar' => 'varchar(255)',
52
+ );
53
+ if (!empty($options['types']) && is_array($options['types'])) {
54
+ if ($options['no-default-types']) {
55
+ $types = array();
56
+ }
57
+ $types = array_merge($types, $options['types']);
58
+ }
59
+
60
+ foreach ($types as $type => $fieldType) {
61
+ $sql .= "
62
+ DROP TABLE IF EXISTS `{$baseName}_{$type}`;
63
+ CREATE TABLE `{$baseName}_{$type}` (
64
+ `value_id` int(11) NOT NULL auto_increment,
65
+ `entity_type_id` smallint(8) unsigned NOT NULL default '0',
66
+ `attribute_id` smallint(5) unsigned NOT NULL default '0',
67
+ `store_id` smallint(5) unsigned NOT NULL default '0',
68
+ `entity_id` int(10) unsigned NOT NULL default '0',
69
+ `value` {$fieldType} NOT NULL,
70
+ PRIMARY KEY (`value_id`),
71
+ UNIQUE KEY `IDX_BASE` (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`),
72
+ " . ($type !== 'text' ? "
73
+ KEY `value_by_attribute` (`attribute_id`,`value`),
74
+ KEY `value_by_entity_type` (`entity_type_id`,`value`),
75
+ " : "") . "
76
+ CONSTRAINT `FK_{$baseName}_{$type}` FOREIGN KEY (`entity_id`) REFERENCES `{$baseName}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
77
+ CONSTRAINT `FK_{$baseName}_{$type}_attribute` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
78
+ CONSTRAINT `FK_{$baseName}_{$type}_entity_type` FOREIGN KEY (`entity_type_id`) REFERENCES `eav_entity_type` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE,
79
+ CONSTRAINT `FK_{$baseName}_{$type}_store` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
80
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
81
+ }
82
+
83
+ try {
84
+ $this->_conn->multi_query($sql);
85
+ } catch (Exception $e) {
86
+ throw $e;
87
+ }
88
+
89
+ return $this;
90
+ }
91
+
92
+
93
+ public function getDefaultEntities()
94
+ {
95
+ return array(
96
+ 'quicksales_listing' =>
97
+ array(
98
+ 'entity_model' => 'quicksales/listing',
99
+ 'attribute_model' => 'catalog/resource_eav_attribute',
100
+ 'table' => 'quicksales/listing',
101
+ 'default_group' => 'General Information',
102
+ 'default_group' => 'Step 1',
103
+ 'attributes' => array(
104
+ 'hot_deals' => array(
105
+ 'group' => 'Assigned Tabs',
106
+ 'label' => 'Hot deals',
107
+ 'required' => false,
108
+ 'position' => 1,
109
+ 'sort_order' => 40,
110
+ 'visible' => 1,
111
+ )
112
+ )
113
+
114
+ )
115
+ );
116
+ }
117
+
118
+ }
app/code/community/Ewave/Quicksales/Model/Listing.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 16:02
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Listing extends Mage_Catalog_Model_Abstract //Mage_Core_Model_Abstract
11
+ {
12
+ const ENTITY = 'quicksales_listing';
13
+ protected $_assignedProducts = null;
14
+
15
+ protected $_attributeValuesAssociation = null;
16
+ protected $_attributesAssociation = null;
17
+
18
+ public function _construct()
19
+ {
20
+ parent::_construct();
21
+ $this->_init('quicksales/listing');
22
+ }
23
+
24
+ protected function getAssociations() {
25
+ $attributes = Mage::getResourceModel('quicksales/listing_associated_attribute_collection');
26
+ $attributes->addFieldToFilter('listing_id', $this->getId());
27
+
28
+ $assignedAttributes = null;
29
+ $assignedAttributeValues = null;
30
+
31
+ foreach ($attributes as $attribute) {
32
+
33
+ $assignedAttributes[$attribute->getQattributeId()] = $attribute->getMattributeId();
34
+
35
+ $attributeValues = Mage::getResourceModel('quicksales/listing_associated_attribute_value_collection');
36
+ $attributeValues->addFieldToFilter('attribute_map_id', $attribute->getId());
37
+ foreach ($attributeValues as $value) {
38
+ $assignedAttributeValues[$attribute->getQattributeId()][$value->getQattributeValueId()] = $value->getMattributeValueId();
39
+ }
40
+ }
41
+
42
+ $this->_attributesAssociation = $assignedAttributes;
43
+ $this->_attributeValuesAssociation = $assignedAttributeValues;
44
+
45
+ return $this;
46
+ }
47
+
48
+
49
+ public function getAttributesAssociation() {
50
+ if (!$this->_attributesAssociation) {
51
+ $this->getAssociations();
52
+ }
53
+
54
+ return $this->_attributesAssociation;
55
+ }
56
+
57
+ public function getAttributeValuesAssociation() {
58
+
59
+ if (!$this->_attributeValuesAssociation) {
60
+ $this->getAssociations();
61
+ }
62
+
63
+ return $this->_attributeValuesAssociation;
64
+
65
+ }
66
+
67
+ public function getDefaultAttributeSetId()
68
+ {
69
+ return $this->getResource()->getEntityType()->getDefaultAttributeSetId();
70
+ }
71
+
72
+ public function getAssignedProducts()
73
+ {
74
+
75
+ if ($this->_assignedProducts == null) {
76
+ $products = Mage::getResourceModel('quicksales/listing_product_collection');
77
+ $products->addFieldToFilter('listing_id', $this->getId());
78
+ $productIds = array();
79
+ if (!empty($products)) {
80
+ foreach ($products as $product) {
81
+ $productIds[] = $product->getProductId();
82
+ }
83
+ }
84
+
85
+ $collection = Mage::getModel('catalog/product')->getCollection();
86
+ $collection->addAttributeToSelect('name');
87
+
88
+ $collection->addFIeldToFilter('entity_id', array('in' => $productIds));
89
+
90
+ $this->_assignedProducts = $collection;
91
+ }
92
+ return $this->_assignedProducts;
93
+ }
94
+
95
+
96
+ public function getAttributes($groupId = null, $skipSuper = false)
97
+ {
98
+ $listingAttributes = $this->getResource()
99
+ ->loadAllAttributes($this)
100
+ ->getSortedAttributes();
101
+ if ($groupId) {
102
+ $attributes = array();
103
+ foreach ($listingAttributes as $attribute) {
104
+ if ($attribute->isInGroup($this->getAttributeSetId(), $groupId)) {
105
+ $attributes[] = $attribute;
106
+ }
107
+ }
108
+ } else {
109
+ $attributes = $listingAttributes;
110
+ }
111
+
112
+ return $attributes;
113
+ }
114
+
115
+ public function getProductsCount() {
116
+
117
+ return $this->getAssignedProducts()->count();
118
+ }
119
+ }
app/code/community/Ewave/Quicksales/Model/Listing/Action.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 27.09.11
6
+ * Time: 17:42
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Listing_Action extends Mage_Core_Model_Abstract {
11
+
12
+
13
+ public function stop($listingId)
14
+ {
15
+ $listing = Mage::getModel('quicksales/listing')->load($listingId);
16
+
17
+ Mage::getModel('quicksales/api_action')->send($listing, 1);
18
+
19
+ $listing->setStatus(0)->save();
20
+ }
21
+
22
+ public function start($listingId)
23
+ {
24
+ $listing = Mage::getModel('quicksales/listing')->load($listingId);
25
+
26
+ Mage::getModel('quicksales/api_action')->send($listing, 0);
27
+
28
+ $listing->setStatus(1)->save();
29
+ }
30
+
31
+ public function relist($listingId)
32
+ {
33
+ $listing = Mage::getModel('quicksales/listing')->load($listingId);
34
+ Mage::getModel('quicksales/api_action')->send($listing, null, null, true);
35
+ $listing->setStatus(1)->save();
36
+
37
+ }
38
+ }
app/code/community/Ewave/Quicksales/Model/Listing/Associated/Attribute.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_Listing_Associated_Attribute extends Mage_Core_Model_Abstract {
4
+
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('quicksales/listing_associated_attribute');
9
+ }
10
+
11
+ }
app/code/community/Ewave/Quicksales/Model/Listing/Associated/Attribute/Value.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_Listing_Associated_Attribute_Value extends Mage_Core_Model_Abstract {
4
+
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('quicksales/listing_associated_attribute_value');
9
+ }
10
+
11
+ }
app/code/community/Ewave/Quicksales/Model/Listing/Attribute/Backend/Listing.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ewave_Quicksales_Model_Listing_Attribute_Backend_Listing
3
+ extends Mage_Eav_Model_Entity_Attribute_Backend_Serialized
4
+ {
5
+ /**
6
+ * Serialize or remove before saving
7
+ * @param Ewave_Quicksales_Model_Listing $listing
8
+ */
9
+ public function beforeSave($listing)
10
+ {
11
+ if (!$listing->hasDefaultListingConfiguration() || !$listing->getDefaultListingConfiguration()) {
12
+ parent::beforeSave($listing);
13
+ } else {
14
+ $listing->unsetListingInformation();
15
+ }
16
+ }
17
+
18
+ /**
19
+ * Unserialize or remove on failure
20
+ * @param Ewave_Quicksales_Model_Listing $listing
21
+ */
22
+ protected function _unserialize(Varien_Object $listing)
23
+ {
24
+ if (!$listing->hasDefaultListingConfiguration() || !$listing->getDefaultListingConfiguration()) {
25
+ parent::_unserialize($listing);
26
+ } else {
27
+ $listing->unsetListingInformation();
28
+ }
29
+
30
+ }
31
+ }
app/code/community/Ewave/Quicksales/Model/Listing/Attribute/Backend/Listingupgrade.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ewave_Quicksales_Model_Listing_Attribute_Backend_Listingupgrade
3
+ extends Mage_Eav_Model_Entity_Attribute_Backend_Serialized
4
+ {
5
+ /**
6
+ * Serialize or remove before saving
7
+ * @param Ewave_Quicksales_Model_Listing $listing
8
+ */
9
+ public function beforeSave($listing)
10
+ {
11
+ if (!$listing->hasDefaultListingUpgConfiguration() || !$listing->getDefaultListingUpgConfiguration()) {
12
+ parent::beforeSave($listing);
13
+ } else {
14
+ $listing->unsetListingUpgradeInformation();
15
+ }
16
+ }
17
+
18
+ /**
19
+ * Unserialize or remove on failure
20
+ * @param Ewave_Quicksales_Model_Listing $listing
21
+ */
22
+ protected function _unserialize(Varien_Object $listing)
23
+ {
24
+ if (!$listing->hasDefaultListingUpgConfiguration() || !$listing->getDefaultListingUpgConfiguration()) {
25
+ parent::_unserialize($listing);
26
+ } else {
27
+ $listing->unsetListingUpgradeProfile();
28
+ }
29
+
30
+ }
31
+ }
app/code/community/Ewave/Quicksales/Model/Listing/Attribute/Backend/Payment.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ewave_Quicksales_Model_Listing_Attribute_Backend_Payment
3
+ extends Mage_Eav_Model_Entity_Attribute_Backend_Serialized
4
+ {
5
+ /**
6
+ * Serialize or remove before saving
7
+ * @param Ewave_Quicksales_Model_Listing $listing
8
+ */
9
+ public function beforeSave($listing)
10
+ {
11
+ if (!$listing->hasDefaultPaymentConfiguration() || !$listing->getDefaultPaymentConfiguration()) {
12
+ parent::beforeSave($listing);
13
+ } else {
14
+ $listing->unsetPaymentInformation();
15
+ }
16
+ }
17
+
18
+ /**
19
+ * Unserialize or remove on failure
20
+ * @param Ewave_Quicksales_Model_Listing $listing
21
+ */
22
+ protected function _unserialize(Varien_Object $listing)
23
+ {
24
+ if (!$listing->hasDefaultPaymentConfiguration() || !$listing->getDefaultPaymentConfiguration()) {
25
+ parent::_unserialize($listing);
26
+ } else {
27
+ $listing->unsetPaymentInformation();
28
+ }
29
+
30
+ }
31
+ }
app/code/community/Ewave/Quicksales/Model/Listing/Attribute/Backend/Pricing.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ewave_Quicksales_Model_Listing_Attribute_Backend_Pricing
3
+ extends Mage_Eav_Model_Entity_Attribute_Backend_Serialized
4
+ {
5
+ /**
6
+ * Serialize or remove before saving
7
+ * @param Ewave_Quicksales_Model_Listing $listing
8
+ */
9
+ public function beforeSave($listing)
10
+ {
11
+ if (!$listing->hasDefaultPricingConfiguration() || !$listing->getDefaultPricingConfiguration()) {
12
+ parent::beforeSave($listing);
13
+ } else {
14
+ $listing->unsetPricingInformation();
15
+ }
16
+ }
17
+
18
+ /**
19
+ * Unserialize or remove on failure
20
+ * @param Ewave_Quicksales_Model_Listing $listing
21
+ */
22
+ protected function _unserialize(Varien_Object $listing)
23
+ {
24
+ if (!$listing->hasDefaultPricingConfiguration() || !$listing->getDefaultPricingConfiguration()) {
25
+ parent::_unserialize($listing);
26
+ } else {
27
+ $listing->unsetPricingInformation();
28
+ }
29
+
30
+ }
31
+ }
app/code/community/Ewave/Quicksales/Model/Listing/Attribute/Backend/Shipping.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ewave_Quicksales_Model_Listing_Attribute_Backend_Shipping
3
+ extends Mage_Eav_Model_Entity_Attribute_Backend_Serialized
4
+ {
5
+ /**
6
+ * Serialize or remove before saving
7
+ * @param Ewave_Quicksales_Model_Listing $listing
8
+ */
9
+ public function beforeSave($listing)
10
+ {
11
+ if (!$listing->hasDefaultShippingConfiguration() || !$listing->getDefaultShippingConfiguration()) {
12
+ parent::beforeSave($listing);
13
+ } else {
14
+ $listing->unsetShippingInformation();
15
+ }
16
+ }
17
+
18
+ /**
19
+ * Unserialize or remove on failure
20
+ * @param Ewave_Quicksales_Model_Listing $listing
21
+ */
22
+ protected function _unserialize(Varien_Object $listing)
23
+ {
24
+ if (!$listing->hasDefaultShippingConfiguration() || !$listing->getDefaultShippingConfiguration()) {
25
+ parent::_unserialize($listing);
26
+ } else {
27
+ $listing->unsetShippingInformation();
28
+ }
29
+
30
+ }
31
+ }
app/code/community/Ewave/Quicksales/Model/Listing/Log.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 27.09.11
6
+ * Time: 17:42
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Listing_Log extends Mage_Core_Model_Abstract {
11
+
12
+ public function _construct()
13
+ {
14
+ parent::_construct();
15
+ $this->_init('quicksales/listing_log');
16
+ }
17
+ }
app/code/community/Ewave/Quicksales/Model/Listing/Product.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 27.09.11
6
+ * Time: 17:42
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Listing_Product extends Mage_Core_Model_Abstract {
11
+
12
+ public function _construct()
13
+ {
14
+ parent::_construct();
15
+ $this->_init('quicksales/listing_product');
16
+ }
17
+
18
+ }
app/code/community/Ewave/Quicksales/Model/Listing/Product/Log.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 27.09.11
6
+ * Time: 17:42
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Listing_Product_Log extends Mage_Core_Model_Abstract {
11
+
12
+ public function _construct()
13
+ {
14
+ parent::_construct();
15
+ $this->_init('quicksales/listing_product_log');
16
+ }
17
+
18
+ }
app/code/community/Ewave/Quicksales/Model/Mysql4/Listing.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 16:02
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Mysql4_Listing extends Mage_Core_Model_Mysql4_Abstract
11
+ {
12
+ public function _construct()
13
+ {
14
+ $this->_init('quicksales/listing', 'listing_id');
15
+ }
16
+ }
app/code/community/Ewave/Quicksales/Model/Mysql4/Listing/Collection.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 16:05
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Mysql4_Listing_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
11
+ {
12
+
13
+ public function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->_init('quicksales/listing');
17
+ }
18
+
19
+ }
app/code/community/Ewave/Quicksales/Model/Observer.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Ewave_Quicksales_Model_Observer
5
+ {
6
+
7
+ public function updateQty($observer)
8
+ {
9
+ if (Mage::registry('quicksales_data')) {
10
+ return false;
11
+ }
12
+
13
+ $item = $observer->getItem();
14
+
15
+ $collection = Mage::getResourceModel('quicksales/listing_product_collection');
16
+ $collection->addFieldToFilter('product_id', $item->getProductId());
17
+
18
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
19
+
20
+ foreach ($collection as $assigned_data) {
21
+ $listing = Mage::getModel('quicksales/listing')->load($assigned_data->getListingId());
22
+ $listing->setData('assigned_products', array($item->getProductId()));
23
+
24
+ if (($item->getQty() <= 0 || !$item->getIsInStock()) && Mage::getStoreConfig('quicksales/stock/stop_quicksale_magento_qty_less') && $assigned_data->getStatus() !== 0) {
25
+
26
+ $quicksalesApi = Mage::getModel('quicksales/api_action');
27
+ $quicksalesApi->setQuiet(true);
28
+
29
+ $quicksalesApi->send($listing, 1, $item->getProductId());
30
+
31
+ }
32
+
33
+ if ($item->getQty() > 0 && Mage::getStoreConfig('quicksales/stock/start_quicksale_magento_qty_great') && $product->getIsInStock() == 1 && $assigned_data->getStatus() != 1) {
34
+
35
+ $quicksalesApi = Mage::getModel('quicksales/api_action');
36
+ $quicksalesApi->setQuiet(true);
37
+
38
+ $quicksalesApi->send($listing, null, $item->getProductId(), 1);
39
+
40
+ }
41
+
42
+
43
+ if (Mage::getStoreConfig('quicksales/stock/update_quicksale_qty_magento_change')) {
44
+
45
+ $quicksalesApi = Mage::getModel('quicksales/api_createitem');
46
+ $quicksalesApi->setQuiet(true);
47
+
48
+ $quicksalesApi->send($listing, $item->getProductId());
49
+ }
50
+
51
+ }
52
+
53
+ return $this;
54
+ }
55
+
56
+ public function updateProduct($observer)
57
+ {
58
+
59
+ if (Mage::registry('quicksales_data')) {
60
+ return false;
61
+ }
62
+
63
+ $product = $observer->getProduct();
64
+
65
+ if ($product->getStockData('is_in_stock') && $product->getIsInStock() == 1 && Mage::getStoreConfig('quicksales/stock/stop_quicksale_magento_out_stock')) {
66
+
67
+ $collection = Mage::getResourceModel('quicksales/listing_product_collection');
68
+ $collection->addFieldToFilter('product_id', $product->getProductId());
69
+
70
+ foreach ($collection as $assigned_data) {
71
+ $listing = Mage::getModel('quicksales/listing')->load($assigned_data->getListingId());
72
+ $listing->setData('assigned_products', array($product->getProductId()));
73
+ $quicksalesApi = Mage::getModel('quicksales/api_action');
74
+ $quicksalesApi->setQuiet(true);
75
+
76
+ $quicksalesApi->send($listing, 0, $product->getProductId());
77
+ }
78
+ }
79
+ return $this;
80
+ }
81
+
82
+ public function getQuicksalesItems()
83
+ {
84
+ if (!Mage::getStoreConfig('quicksales/stock/stop_quicksale_magento_out_stock')) {
85
+ return false;
86
+ }
87
+
88
+ Mage::register('quicksales_data', true);
89
+
90
+ $collection = Mage::getResourceModel('quicksales/listing_product_collection');
91
+
92
+ foreach ($collection as $item) {
93
+ $quicksalesApi = Mage::getModel('quicksales/api_getitem');
94
+ $quicksalesApi->setQuiet(true);
95
+ $quicksalesApi->synchronize($item);
96
+
97
+ }
98
+
99
+ }
100
+
101
+ public function getQuicksalesOrders()
102
+ {
103
+
104
+ /* @var $quicksalesApi Ewave_Quicksales_Model_Api_Getorders*/
105
+ $quicksalesApi = Mage::getModel('quicksales/api_getorders');
106
+
107
+ $data = array(
108
+ 'RequestingRole' => 'SELLER',
109
+ 'IncludeAwaitingPayment' => 1,
110
+ // 'FromDate' => null,
111
+ // 'FromDate' => null,
112
+ // 'ToDate' => null,
113
+ //'NumberOfHours' => 5000
114
+ );
115
+ $quicksalesApi->import($data);
116
+
117
+ }
118
+
119
+ public function paidOrder($order)
120
+ {
121
+
122
+ $quicksalesApi = Mage::getModel('quicksales/api_updateorder');
123
+
124
+ $data = array(
125
+ 'InvoiceID' => $order->getQuicksalesOrderId(),
126
+ 'Action' => 1,
127
+ 'NotifyBuyer' => 1 ,
128
+ );
129
+ $quicksalesApi->update($data, $order->getId());
130
+
131
+
132
+ return $order;
133
+
134
+ }
135
+
136
+ public function sendQuicksaleOrder($observer)
137
+ {
138
+
139
+ $order = $observer->getOrder();
140
+ /*@var $invoice Mage_Sales_Model_Order_Invoice */
141
+ $invoice = $observer->getInvoice();
142
+
143
+ if (empty($order) || $order->getQuicksalesOrderId()) {
144
+ return false;
145
+ }
146
+
147
+
148
+ /*@var $invoice Mage_Sales_Model_Order_Invoice */
149
+ if ($order->getQhash()) {
150
+ Mage::getModel('quicksales/api_sendinvoice')->send($order, $invoice);
151
+ } else {
152
+ return null;
153
+ }
154
+
155
+ return $this;
156
+ }
157
+
158
+ public function checkShippedOrder($observer){
159
+ $shipment = $observer->getShipment();
160
+ $order = $shipment->getOrder();
161
+
162
+ if (!$order->getQuicksalesOrderId()) {
163
+ if ($order->getQhash()) {
164
+ Mage::throwException(Mage::helper('quicksales')->__('Please, create invoice first'));
165
+ }
166
+ }
167
+ }
168
+
169
+
170
+ public function shippedOrder($observer)
171
+ {
172
+ $shipment = $observer->getShipment();
173
+ $order = $shipment->getOrder();
174
+
175
+ if (!$order->getQuicksalesOrderId()) {
176
+ if ($order->getQhash()) {
177
+ Mage::throwException(Mage::helper('quicksales')->__('Please, create invoice first'));
178
+ } else {
179
+ return false;
180
+ }
181
+ }
182
+
183
+ $message = "Shipping information: <br />\n";
184
+
185
+ foreach ($shipment->getAllTracks() as $track) {
186
+ $message .= $track->getTitle();
187
+ $message .= '(' . $track->getCarrierCode() . ')';
188
+ $message .= ': ';
189
+ $message .= $track->getTrackNumber();
190
+ $message .= "\n";
191
+ }
192
+
193
+ $quicksalesApi = Mage::getModel('quicksales/api_updateorder');
194
+
195
+ $data = array(
196
+ 'InvoiceID' => $order->getQuicksalesOrderId(),
197
+ 'Action' => 2,
198
+ 'Message' => $message,
199
+ 'NotifyBuyer' => 1 ,
200
+ );
201
+ $quicksalesApi->update($data, $order->getId());
202
+
203
+ return $this;
204
+
205
+ }
206
+ }
app/code/community/Ewave/Quicksales/Model/Payment/Method/Quicksales.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_Payment_Method_Quicksales extends Mage_Payment_Model_Method_Abstract
4
+ {
5
+ protected $_code = 'quicksales';
6
+ protected $_canCapture = true;
7
+ //protected $_formBlockType = 'payment/form_purchaseorder';
8
+ //protected $_infoBlockType = 'payment/info_purchaseorder';
9
+
10
+ }
app/code/community/Ewave/Quicksales/Model/RW/Sales/Order/Shipment.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 16.12.11
6
+ * Time: 10:09
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+ class Ewave_Quicksales_Model_RW_Sales_Order_Shipment extends Mage_Sales_Model_Order_Shipment
10
+ {
11
+ /*
12
+ public function register()
13
+ {
14
+
15
+ $order = $this->getOrder();
16
+
17
+ if (!$order->getQuicksalesOrderId()) {
18
+ if ($order->getQhash()) {
19
+ Mage::throwException(Mage::helper('quicksales')->__('Please, create invoice first'));
20
+ } else {
21
+ return parent::register();
22
+ }
23
+ }
24
+
25
+ return parent::register();
26
+
27
+ }
28
+ */
29
+
30
+ }
31
+
app/code/community/Ewave/Quicksales/Model/Resource/Listing.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 11:22
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Resource_Listing extends Mage_Eav_Model_Entity_Abstract {
11
+
12
+ public function __construct()
13
+ {
14
+ $resource = Mage::getSingleton('core/resource');
15
+ $this->setType(Ewave_Quicksales_Model_Listing::ENTITY)
16
+ ->setConnection(
17
+ $resource->getConnection('quicksales_read'),
18
+ $resource->getConnection('quicksales_write')
19
+ );
20
+ }
21
+ }
app/code/community/Ewave/Quicksales/Model/Resource/Listing/Associated/Attribute.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Ewave_Quicksales_Model_Resource_Listing_Associated_Attribute extends Mage_Core_Model_Mysql4_Abstract
5
+ {
6
+ public function _construct()
7
+ {
8
+ $this->_init('quicksales/listing_attribute', 'attribute_map_id');
9
+ }
10
+ }
11
+
app/code/community/Ewave/Quicksales/Model/Resource/Listing/Associated/Attribute/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_Resource_Listing_Associated_Attribute_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->_init('quicksales/listing_associated_attribute');
10
+ }
11
+
12
+ }
app/code/community/Ewave/Quicksales/Model/Resource/Listing/Associated/Attribute/Value.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 27.09.11
6
+ * Time: 17:44
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Resource_Listing_Associated_Attribute_Value extends Mage_Core_Model_Mysql4_Abstract
11
+ {
12
+ public function _construct()
13
+ {
14
+ $this->_init('quicksales/listing_attribute_value', 'attribute_value_map_id');
15
+ }
16
+ }
app/code/community/Ewave/Quicksales/Model/Resource/Listing/Associated/Attribute/Value/Collection.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 14:01
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Resource_Listing_Associated_Attribute_Value_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract //Ewave_Quicksales_Model_Mysql4_Listing_Collection
11
+ {
12
+
13
+ protected function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->_init('quicksales/listing_associated_attribute_value');
17
+ }
18
+
19
+ }
app/code/community/Ewave/Quicksales/Model/Resource/Listing/Collection.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 14:01
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Resource_Listing_Collection extends Mage_Eav_Model_Entity_Collection_Abstract //Ewave_Quicksales_Model_Mysql4_Listing_Collection
11
+ {
12
+
13
+ protected function _construct()
14
+ {
15
+ $this->_init('quicksales/listing');
16
+ }
17
+
18
+ public function setStoreId() {
19
+ return $this;
20
+ }
21
+
22
+ }
app/code/community/Ewave/Quicksales/Model/Resource/Listing/Log.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 27.09.11
6
+ * Time: 17:44
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Resource_Listing_Log extends Mage_Core_Model_Mysql4_Abstract
11
+ {
12
+ public function _construct()
13
+ {
14
+ $this->_init('quicksales/listing_log', 'id');
15
+ }
16
+ }
app/code/community/Ewave/Quicksales/Model/Resource/Listing/Log/Collection.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 16:05
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Resource_Listing_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
11
+ {
12
+
13
+ public function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->_init('quicksales/listing_log');
17
+ }
18
+
19
+ }
app/code/community/Ewave/Quicksales/Model/Resource/Listing/Product.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 27.09.11
6
+ * Time: 17:44
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Resource_Listing_Product extends Mage_Core_Model_Mysql4_Abstract
11
+ {
12
+ public function _construct()
13
+ {
14
+ $this->_init('quicksales/listing_product', 'id');
15
+ }
16
+ }
app/code/community/Ewave/Quicksales/Model/Resource/Listing/Product/Collection.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 16:05
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Resource_Listing_Product_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
11
+ {
12
+
13
+ public function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->_init('quicksales/listing_product');
17
+ }
18
+
19
+ }
app/code/community/Ewave/Quicksales/Model/Resource/Listing/Product/Log.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 27.09.11
6
+ * Time: 17:44
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Resource_Listing_Product_Log extends Mage_Core_Model_Mysql4_Abstract
11
+ {
12
+ public function _construct()
13
+ {
14
+ $this->_init('quicksales/listing_product_log', 'id');
15
+ }
16
+ }
app/code/community/Ewave/Quicksales/Model/Resource/Listing/Product/Log/Collection.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 16:05
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Resource_Listing_Product_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
11
+ {
12
+
13
+ public function _construct()
14
+ {
15
+ parent::_construct();
16
+ $this->_init('quicksales/listing_product_log');
17
+ }
18
+
19
+ }
app/code/community/Ewave/Quicksales/Model/Source/Getcategories.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_Source_Getcategories extends Mage_Eav_Model_Entity_Attribute_Source_Table {
4
+
5
+ public function getAllOptions($withEmpty = true, $defaultValues = false, $parentId = 0)
6
+ {
7
+
8
+ /*
9
+ $categories = Mage::getModel('quicksales/api_getcategories')->getAllCategories();
10
+ $result = array();
11
+
12
+ foreach ($categories as $category) {
13
+
14
+ if ($category['parent'] == $parentId) {
15
+ $result[] = $category;
16
+ }
17
+ }
18
+ */
19
+
20
+ $result = Mage::getModel('quicksales/api_getcategories')->getAllOptions($withEmpty, $defaultValues, $parentId);
21
+ return $result;
22
+ }
23
+
24
+ }
25
+
app/code/community/Ewave/Quicksales/Model/Source/Payments.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 27.09.11
6
+ * Time: 12:18
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Source_Payments extends Mage_Eav_Model_Entity_Attribute_Source_Table
11
+ {
12
+
13
+ protected $payments = array(
14
+ 'BankCheque',
15
+ 'BankDeposit',
16
+ 'Cash',
17
+ 'COD',
18
+ 'CreditCard',
19
+ 'Escrow',
20
+ 'MoneyOrder',
21
+ 'Paymate',
22
+ 'PayPal',
23
+ 'PersonalCheque',
24
+ 'Other',
25
+ 'ProvideBankDetailsToBuyer',
26
+ );
27
+
28
+ public function getAllOptions()
29
+ {
30
+ if (!$this->_options) {
31
+
32
+ $options = array();
33
+
34
+ foreach ($this->payments as $payment) {
35
+
36
+ $options[] = array(
37
+ 'value' => $payment,
38
+ 'label' => $payment
39
+ );
40
+ }
41
+ $this->_options = $options;
42
+ }
43
+ return $this->_options;
44
+ }
45
+
46
+ public function getPayments() {
47
+ return $this->payments;
48
+ }
49
+
50
+ }
app/code/community/Ewave/Quicksales/Model/Source/Posttolocation.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 27.09.11
6
+ * Time: 12:18
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Source_Posttolocation extends Mage_Eav_Model_Entity_Attribute_Source_Table
11
+ {
12
+
13
+ protected $locations = array(
14
+ 'Worldwide',
15
+ 'National',
16
+ 'Statewide',
17
+ 'LocalPickup'
18
+ );
19
+
20
+ public function getAllOptions()
21
+ {
22
+ if (!$this->_options) {
23
+
24
+ $options = array();
25
+
26
+ foreach ($this->locations as $location) {
27
+
28
+ $options[] = array(
29
+ 'value' => $location,
30
+ 'label' => $location
31
+ );
32
+ }
33
+ $this->_options = $options;
34
+ }
35
+ return $this->_options;
36
+ }
37
+
38
+ }
app/code/community/Ewave/Quicksales/Model/Source/Shipping.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 27.09.11
6
+ * Time: 12:43
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Model_Source_Shipping extends Mage_Eav_Model_Entity_Attribute_Source_Table
11
+ {
12
+
13
+ protected $shippings = array(
14
+ '1' => 'Free postage',
15
+ '2' => 'Flat postage',
16
+ '3' => 'Flat postage by location',
17
+ '4' => 'Calculated postage',
18
+ '5' => 'See item description',
19
+ '6' => 'No postage - local pickup only',
20
+ '7' => 'Temando',
21
+ );
22
+
23
+ public function getAllOptions()
24
+ {
25
+ if (!$this->_options) {
26
+
27
+ $options = array();
28
+
29
+ foreach ($this->shippings as $id => $shipping) {
30
+
31
+ $options[] = array(
32
+ 'value' => $id,
33
+ 'label' => $shipping
34
+ );
35
+ }
36
+ $this->_options = $options;
37
+ }
38
+ return $this->_options;
39
+ }
40
+
41
+ public function getLabelById($id) {
42
+ return $this->shippings[$id];
43
+ }
44
+
45
+ }
app/code/community/Ewave/Quicksales/Model/Source/Vshopcategory.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_Source_Vshopcategory extends Mage_Eav_Model_Entity_Attribute_Source_Table
4
+ {
5
+
6
+ public function getAllOptions()
7
+ {
8
+ if (!$this->_options) {
9
+
10
+ $options = array(
11
+ array('value'=> '', 'label' => '')
12
+ );
13
+ $suboptions = array();
14
+
15
+ $vshopCategories = Mage::getModel('quicksales/api_getvshopcategory')->getVshopCategories();
16
+
17
+ if (!$vshopCategories) {
18
+ return false;
19
+ }
20
+ foreach ($vshopCategories as $vshopCategory) {
21
+
22
+ if ($vshopCategory['leaf'] == "True") {
23
+
24
+ $option = &$suboptions[$vshopCategory['parent']];
25
+
26
+ $option[$vshopCategory['id']] = array(
27
+ 'value' => $vshopCategory['id'],
28
+ 'label' => $vshopCategory['name']
29
+ );
30
+
31
+ } else {
32
+
33
+ if ($vshopCategory['parent'] == -1) {
34
+ $options[$vshopCategory['id']] = array(
35
+ 'value' => array(),
36
+ 'label' => ''//$vshopCategory['name']
37
+ );
38
+
39
+ $suboptions[$vshopCategory['id']] = &$options[$vshopCategory['id']]['value'];
40
+ } else {
41
+ $option = &$suboptions[$vshopCategory['parent']];
42
+
43
+ $option[$vshopCategory['id']] = array(
44
+ 'value' => array(),
45
+ 'label' => $vshopCategory['name']
46
+ );
47
+
48
+ $suboptions[$vshopCategory['id']] = &$option[$vshopCategory['id']]['value'];
49
+ }
50
+
51
+
52
+ }
53
+ }
54
+
55
+ $this->_options = $options;
56
+ }
57
+
58
+ return $this->_options;
59
+ }
60
+
61
+ }
62
+
app/code/community/Ewave/Quicksales/Model/System/Autorelist.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_System_Autorelist extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+
7
+ public function toOptionArray()
8
+ {
9
+ $input = array(
10
+ 2 => 'Auto-Relist'
11
+ , 3 => 'Do not Auto-Relist'
12
+ );
13
+
14
+ $array = array();
15
+ foreach ($input as $key => $value) {
16
+ $array[] = array(
17
+ 'value' => $key,
18
+ 'label' => $value,
19
+ );
20
+ }
21
+
22
+ return $array;
23
+ }
24
+
25
+
26
+ }
app/code/community/Ewave/Quicksales/Model/System/Custom.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_System_Custom extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+
7
+ public function toOptionArray()
8
+ {
9
+ $collection = Mage::getResourceModel('catalog/product_attribute_collection')
10
+ ->addVisibleFilter()
11
+ // ->addFieldToFilter('is_visible_on_front', 1)
12
+ ;
13
+
14
+ $array = array();
15
+ foreach ($collection->getItems() as $item) {
16
+ $array[] = array(
17
+ 'value' => $item->getAttributeCode(),
18
+ 'label' => $item->getFrontendLabel(),
19
+ );
20
+ }
21
+
22
+ return $array;
23
+ }
24
+
25
+
26
+ }
app/code/community/Ewave/Quicksales/Model/System/Customer/Import.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_System_Customer_Import extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+
7
+ public function toOptionArray()
8
+ {
9
+ $input = array(
10
+ 'guest' => 'Guest Customer'
11
+ , 'import' => 'Imported Customer'
12
+ , 'predefined' => 'Predefined Customer'
13
+ );
14
+
15
+ $array = array();
16
+ foreach ($input as $key => $value) {
17
+ $array[] = array(
18
+ 'value' => $key,
19
+ 'label' => $value,
20
+ );
21
+ }
22
+
23
+ return $array;
24
+ }
25
+ }
app/code/community/Ewave/Quicksales/Model/System/Description.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_System_Description extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+
7
+ public function toOptionArray()
8
+ {
9
+ $input = array(
10
+ 'description' => 'Description'
11
+ , 'short_description' => 'Short Description'
12
+ , 'custom' => 'Custom Description'
13
+ );
14
+
15
+ $array = array();
16
+ foreach ($input as $key => $value) {
17
+ $array[] = array(
18
+ 'value' => $key,
19
+ 'label' => $value,
20
+ );
21
+ }
22
+
23
+ return $array;
24
+ }
25
+
26
+
27
+ }
app/code/community/Ewave/Quicksales/Model/System/Duration.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_System_Duration extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+
7
+ public function toOptionArray()
8
+ {
9
+ $input = array(
10
+ '3' => '3'
11
+ , '5' => '5'
12
+ , '7' => '7'
13
+ , '10' => '10'
14
+ , '14' => '14'
15
+ , '45' => '45'
16
+ );
17
+
18
+ $array = array();
19
+ foreach ($input as $key => $value) {
20
+ $array[] = array(
21
+ 'value' => $key,
22
+ 'label' => $value,
23
+ );
24
+ }
25
+
26
+ return $array;
27
+ }
28
+
29
+
30
+ }
app/code/community/Ewave/Quicksales/Model/System/Payment/Method.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_System_Payment_Method extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+
7
+ public function toOptionArray()
8
+ {
9
+ $input = array(
10
+ 'BankCheque' => 'Bank Cheque'
11
+ , 'BankDeposit' => 'Bank Deposit'
12
+ , 'Cash' => 'Cash'
13
+ , 'COD' => 'C.O.D'
14
+ , 'CreditCard' => 'Credit Card'
15
+ , 'Escrow' => 'Escrow'
16
+ , 'MoneyOrder' => 'Money Order'
17
+ , 'Paymate' => 'Paymate'
18
+ , 'PayPal' => 'PayPal'
19
+ , 'PersonalCheque' => 'Personal Cheque'
20
+ , 'Other' => 'Other'
21
+ );
22
+
23
+ $array = array();
24
+ foreach ($input as $key => $value) {
25
+ $array[] = array(
26
+ 'value' => $key,
27
+ 'label' => $value,
28
+ );
29
+ }
30
+
31
+ return $array;
32
+ }
33
+
34
+
35
+ }
app/code/community/Ewave/Quicksales/Model/System/Price.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_System_Price extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ protected $_input = array(
7
+ '' => '',
8
+ 'price' => 'Product Price',
9
+ 'special_price' => 'Special Price',
10
+ 'custom_price' => 'Custom Price',
11
+ );
12
+
13
+ public function toOptionArray()
14
+ {
15
+
16
+
17
+ $array = array();
18
+ foreach ($this->_input as $key => $value) {
19
+ $array[] = array(
20
+ 'value' => $key,
21
+ 'label' => $value,
22
+ );
23
+ }
24
+
25
+ return $array;
26
+ }
27
+
28
+ public function getOptionsHash() {
29
+ return $this->_input;
30
+ }
31
+
32
+
33
+ }
app/code/community/Ewave/Quicksales/Model/System/Price/Custom.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_System_Price_Custom extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+
7
+ public function toOptionArray()
8
+ {
9
+ $collection = Mage::getResourceModel('catalog/product_attribute_collection')
10
+ ->addVisibleFilter()
11
+ // ->addFieldToFilter('is_visible_on_front', 1)
12
+ ;
13
+
14
+ $array = array();
15
+ foreach ($collection->getItems() as $item) {
16
+ $array[] = array(
17
+ 'value' => $item->getAttributeCode(),
18
+ 'label' => $item->getFrontendLabel(),
19
+ );
20
+ }
21
+
22
+ return $array;
23
+ }
24
+
25
+
26
+ }
app/code/community/Ewave/Quicksales/Model/System/Qty.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_System_Qty extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+
7
+ public function toOptionArray()
8
+ {
9
+ $input = array(
10
+ 'qty' => 'Quantity'
11
+ , 'custom' => 'Custom Quantity Attribute'
12
+ );
13
+
14
+ $array = array();
15
+ foreach ($input as $key => $value) {
16
+ $array[] = array(
17
+ 'value' => $key,
18
+ 'label' => $value,
19
+ );
20
+ }
21
+
22
+ return $array;
23
+ }
24
+
25
+
26
+ }
app/code/community/Ewave/Quicksales/Model/System/Shipping/Method.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_System_Shipping_Method extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+
7
+ public function toOptionArray()
8
+ {
9
+ $input = array(
10
+ '7' => 'Temando'
11
+ , '1' => 'Free postage'
12
+ , '2' => 'Flat postage'
13
+ , '3' => 'Flat postage by location'
14
+ , '4' => 'Calculated postage'
15
+ , '5' => 'See item description'
16
+ , '6' => 'No postage - local pickup only'
17
+ );
18
+
19
+ $array = array();
20
+ foreach ($input as $key => $value) {
21
+ $array[] = array(
22
+ 'value' => $key,
23
+ 'label' => $value,
24
+ );
25
+ }
26
+
27
+ return $array;
28
+ }
29
+
30
+
31
+ }
app/code/community/Ewave/Quicksales/Model/System/Shipping/Package.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_System_Shipping_Package extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+
7
+ public function toOptionArray()
8
+ {
9
+ $input = array(
10
+ 'Parcel' => 'Parcel'
11
+ , 'Satchel' => 'Satchel'
12
+ );
13
+
14
+ $array = array();
15
+ foreach ($input as $key => $value) {
16
+ $array[] = array(
17
+ 'value' => $key,
18
+ 'label' => $value,
19
+ );
20
+ }
21
+
22
+ return $array;
23
+ }
24
+
25
+
26
+ }
app/code/community/Ewave/Quicksales/Model/System/Shipping/Posttolocation.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ewave_Quicksales_Model_System_Shipping_Posttolocation extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+ $input = array(
9
+ 'Worldwide' => 'Worldwide',
10
+ 'National' => 'National',
11
+ 'Statewide' => 'Statewide',
12
+ 'LocalPickup' => 'LocalPickup'
13
+
14
+
15
+ );
16
+
17
+ $array = array();
18
+ foreach ($input as $key => $value) {
19
+ $array[] = array(
20
+ 'value' => $key,
21
+ 'label' => $value,
22
+ );
23
+ }
24
+
25
+ return $array;
26
+ }
27
+
28
+
29
+ }
app/code/community/Ewave/Quicksales/controllers/Adminhtml/ListingController.php ADDED
@@ -0,0 +1,531 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 14:53
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Adminhtml_ListingController extends Mage_Adminhtml_Controller_Action
11
+ {
12
+
13
+ protected function _initListing()
14
+ {
15
+
16
+ $this->_title($this->__('Listing'));
17
+
18
+ $listingId = (int)$this->getRequest()->getParam('id', false);
19
+ $storeId = (int)$this->getRequest()->getParam('store');
20
+ $listing = Mage::getModel('quicksales/listing');
21
+
22
+ if ($listingId) {
23
+ $listing->load($listingId);
24
+ }
25
+
26
+ if ($activeTabId = (string)$this->getRequest()->getParam('active_tab_id')) {
27
+ Mage::getSingleton('admin/session')->setActiveTabId($activeTabId);
28
+ }
29
+
30
+ Mage::register('listing', $listing);
31
+ Mage::register('current_listing', $listing);
32
+ return $listing;
33
+ }
34
+
35
+ protected function _initAction()
36
+ {
37
+ $this->loadLayout()
38
+ ->_setActiveMenu('quicksales/listing')
39
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Listing'), Mage::helper('adminhtml')->__('Listing'));
40
+ return $this;
41
+ }
42
+
43
+ public function indexAction()
44
+ {
45
+ $this->_initAction()
46
+ ->renderLayout();
47
+ }
48
+
49
+ public function newAction()
50
+ {
51
+ $this->_initListing();
52
+ $this->loadLayout()
53
+ ->_setActiveMenu('quicksales/listing')
54
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Listing'), Mage::helper('adminhtml')->__('Listing'));
55
+ $this->renderLayout();
56
+ $session = Mage::getSingleton('admin/session');
57
+ $session->unsQuicksalesProductIds();
58
+ $session->unsQuicksalesAttrubutesAssign();
59
+ return $this;
60
+ }
61
+
62
+ public function editAction()
63
+ {
64
+ $listingId = (int)$this->getRequest()->getParam('id');
65
+ $listing = $this->_initListing();
66
+
67
+ $session = Mage::getSingleton('admin/session');
68
+ $session->unsQuicksalesAttrubutesAssign();
69
+
70
+ if ($listingId && !$listing->getId()) {
71
+ $this->_getSession()->addError(Mage::helper('catalog')->__('This product no longer exists.'));
72
+ $this->_redirect('*/*/');
73
+ return;
74
+ }
75
+
76
+ $this->_title($listing->getName());
77
+
78
+ Mage::dispatchEvent('quicksales_listing_edit_action', array('listing' => $listing));
79
+
80
+ $this->loadLayout()
81
+ ->_setActiveMenu('quicksales/listing')
82
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Listing'), Mage::helper('adminhtml')->__('Listing'));
83
+
84
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
85
+
86
+ $this->renderLayout();
87
+ }
88
+
89
+ public function listingsAction()
90
+ {
91
+
92
+ $this->_initListing();
93
+ $this->loadLayout(false);
94
+ $this->renderLayout();
95
+
96
+ }
97
+
98
+ protected function _initListingSave()
99
+ {
100
+ $listing = $this->_initListing();
101
+ $listingData = $this->getRequest()->getPost('listing');
102
+
103
+ $listing
104
+ ->unsAttributesAssociations()
105
+ ->unsAttributeValuesAssociations();
106
+ $listing->addData($listingData);
107
+
108
+ Mage::dispatchEvent(
109
+ 'quicksales_listing_prepare_save',
110
+ array('listing' => $listing, 'request' => $this->getRequest())
111
+ );
112
+
113
+ return $listing;
114
+ }
115
+
116
+ public function saveAction()
117
+ {
118
+
119
+ $storeId = $this->getRequest()->getParam('store');
120
+ $redirectBack = $this->getRequest()->getParam('back', false);
121
+ $isEdit = (int)($this->getRequest()->getParam('id') != null);
122
+
123
+ $data = $this->getRequest()->getPost();
124
+
125
+ if ($data) {
126
+
127
+ $listing = $this->_initListingSave()->save();
128
+
129
+ try {
130
+ $products = Mage::getResourceModel('quicksales/listing_product_collection');
131
+ $products->addFieldToFilter('listing_id', $listing->getId());
132
+ $pids = array();
133
+ foreach ($products as $product) {
134
+ if (!in_array($product->getProductId(), $listing->getData('assigned_products'))) {
135
+ $product->delete();
136
+ } else {
137
+ $pids[] = $product->getProductId();
138
+ }
139
+ }
140
+
141
+ if ($listing->getData('assigned_products')) {
142
+ foreach ($listing->getData('assigned_products') as $productId) {
143
+ if (in_array($productId, $pids)) {
144
+ continue;
145
+ }
146
+ $product = Mage::getModel('quicksales/listing_product'); //->load($productId . '_' . $listing->getId());
147
+ $product
148
+ ->setListingId($listing->getId())
149
+ ->setProductId($productId)
150
+ ->save();
151
+ }
152
+ }
153
+
154
+ $oldAttributes = Mage::getResourceModel('quicksales/listing_associated_attribute_collection');
155
+ $oldAttributes->addFieldToFilter('listing_id', $listing->getId());
156
+ $attributeIds = array();
157
+
158
+ $attributeAssociation = $listing->getData('attributes_association');
159
+
160
+ foreach ($oldAttributes as $oldAttribute) {
161
+ if ($attributeAssociation[$oldAttribute->getQattributeId()] != $oldAttribute->getMattributeId()) {
162
+ $oldAttribute->delete();
163
+ } else {
164
+ $attributeIds[$oldAttribute->getAttributeMapId()] = array($oldAttribute->getQattributeId(), $oldAttribute->getMattributeId());
165
+ }
166
+ }
167
+
168
+ $oldAttributesValues = Mage::getResourceModel('quicksales/listing_associated_attribute_value_collection');
169
+ $oldAttributesValues->join('listing_attribute', 'main_table.attribute_map_id = listing_attribute.attribute_map_id', array('mattribute_id', 'qattribute_id'));
170
+ $oldAttributesValues->addFieldToFilter('listing_attribute.listing_id', $listing->getId());
171
+
172
+ $valuesAssociations = $listing->getData('attribute_values_association');
173
+
174
+ $attributeValueIds = array();
175
+ foreach ($oldAttributesValues as $valueInfo) {
176
+ if ($valuesAssociations[$valueInfo->getQattributeId()][$valueInfo->getQattributeValueId()] != $valueInfo->getMattributeValueId()) {
177
+ $valueInfo->delete();
178
+ } else {
179
+ $attributeValueIds[] = array($valueInfo->getMattributeValueId(), $valueInfo->getQattributeValueId());
180
+ }
181
+ }
182
+
183
+ $associatedValues = $listing->getData('attribute_values_association');
184
+
185
+ foreach ($listing->getData('attributes_association') as $qAttributeId => $mAttributeId) {
186
+ if (!$mAttributeId) {
187
+ continue;
188
+ }
189
+
190
+ if (!in_array(array($qAttributeId, $mAttributeId), $attributeIds)) {
191
+ $attributeAssociation = Mage::getModel('quicksales/listing_associated_attribute');
192
+ $attributeAssociation
193
+ ->setListingId($listing->getId())
194
+ ->setQattributeId($qAttributeId)
195
+ ->setMattributeId($mAttributeId)
196
+ ->save();
197
+ $attributeAssociationId = $attributeAssociation->getId();
198
+ } else {
199
+ $attributeAssociationId = array_search(array($qAttributeId, $mAttributeId), $attributeIds);
200
+ }
201
+
202
+ if (!empty($associatedValues[$qAttributeId])) {
203
+ foreach ($associatedValues[$qAttributeId] as $qAttributeValue => $mAttributeValue) {
204
+
205
+ if (in_array(array($mAttributeValue, $qAttributeValue), $attributeValueIds)) {
206
+ continue;
207
+ }
208
+
209
+ $attributeValueAssociation = Mage::getModel('quicksales/listing_associated_attribute_value');
210
+ $attributeValueAssociation
211
+ ->setAttributeMapId($attributeAssociationId)
212
+ ->setQattributeValueId($qAttributeValue)
213
+ ->setMattributeValueId($mAttributeValue)
214
+ ->save();
215
+ }
216
+ }
217
+ }
218
+
219
+ Mage::getModel('quicksales/api_createitem')->send($listing);
220
+
221
+ } catch (Exception $e) {
222
+ $this->_getSession()->addError($e->getMessage())
223
+ ->setListingData($data);
224
+ $redirectBack = true;
225
+ }
226
+
227
+ }
228
+
229
+
230
+ if ($redirectBack) {
231
+ $this->_redirect('*/*/edit',
232
+ array(
233
+ 'id' => $listing->getId(),
234
+ '_current' => true
235
+ )
236
+ );
237
+ } else {
238
+ $this->_redirect('*/*/',
239
+ array('store' => $storeId)
240
+ );
241
+ }
242
+
243
+ }
244
+
245
+ /**
246
+ * Delete listing action
247
+ */
248
+ public function deleteAction()
249
+ {
250
+ if ($id = $this->getRequest()->getParam('id')) {
251
+ $listing = Mage::getModel('quicksales/listing')
252
+ ->load($id);
253
+ try {
254
+ Mage::getModel('quicksales/listing_action')->stop($this->getRequest()->getParam('id'));
255
+ $listing->delete();
256
+ $this->_getSession()->addSuccess($this->__('The listing has been deleted.'));
257
+ } catch (Exception $e) {
258
+ $this->_getSession()->addError($e->getMessage());
259
+ }
260
+ }
261
+ $this->getResponse()
262
+ ->setRedirect($this->getUrl('*/*/'));
263
+ }
264
+
265
+ public function validateAction()
266
+ {
267
+ $response = new Varien_Object();
268
+ $response->setError(false);
269
+
270
+ try {
271
+ $listingData = $this->getRequest()->getPost('listing');
272
+
273
+ /* @var $listing Mage_Catalog_Model_Product */
274
+ $listing = Mage::getModel('quicksales/listing');
275
+ $listing->setData('_edit_mode', true);
276
+
277
+ if ($listingId = $this->getRequest()->getParam('id')) {
278
+ $listing->load($listingId);
279
+ }
280
+
281
+ $dateFields = array();
282
+ $attributes = $listing->getAttributes();
283
+ foreach ($attributes as $attrKey => $attribute) {
284
+ if ($attribute->getBackend()->getType() == 'datetime') {
285
+ if (array_key_exists($attrKey, $listingData) && $listingData[$attrKey] != '') {
286
+ $dateFields[] = $attrKey;
287
+ }
288
+ }
289
+ }
290
+ $listingData = $this->_filterDates($listingData, $dateFields);
291
+
292
+ $listing->addData($listingData);
293
+ //$listing->validate();
294
+ }
295
+ catch (Mage_Eav_Model_Entity_Attribute_Exception $e) {
296
+ $response->setError(true);
297
+ $response->setAttribute($e->getAttributeCode());
298
+ $response->setMessage($e->getMessage());
299
+ } catch (Mage_Core_Exception $e) {
300
+ $response->setError(true);
301
+ $response->setMessage($e->getMessage());
302
+ } catch (Exception $e) {
303
+ $this->_getSession()->addError($e->getMessage());
304
+ $this->_initLayoutMessages('adminhtml/session');
305
+ $response->setError(true);
306
+ $response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
307
+ }
308
+
309
+ $this->getResponse()->setBody($response->toJson());
310
+ }
311
+
312
+ public function getListing()
313
+ {
314
+ $listing = Mage::registry('current_listing');
315
+ if (!$listing) {
316
+ $listing = $this->_initListing();
317
+ }
318
+ return $listing;
319
+ }
320
+
321
+ public function attributesAction()
322
+ {
323
+
324
+ //Mage::register('listingCategoryId', (int)$this->getRequest()->getParam('categoryId'));
325
+
326
+ $this->getListing()->setCategory((int)$this->getRequest()->getParam('categoryId'));
327
+ $product_ids = explode(',', trim($this->getRequest()->getParam('productIds'), ','));
328
+ $session = Mage::getSingleton('admin/session');
329
+ $session->setQuicksalesProductIds($product_ids);
330
+ $session->unsQuicksalesAttrubutesAssign();
331
+
332
+ //Mage::getModel('quicksales/api_gettags')->getAttributes((int)$this->getRequest()->getParam('categoryId'));
333
+ $this->loadLayout(false)->renderLayout();
334
+
335
+ return $this;
336
+
337
+ }
338
+
339
+ public function attributeValuesAction()
340
+ {
341
+
342
+ $this->_initListing();
343
+
344
+ $mAttributeCode = $this->getRequest()->getParam('mAttributeId');
345
+ $elementName = $this->getRequest()->getParam('elementName');
346
+ $qAttributeId = preg_replace('/listing\[attributes_association\]\[(.*)\]/', '$1', $elementName); //listing[attributes_association][1]
347
+
348
+ $session = Mage::getSingleton('admin/session');
349
+
350
+ $savedAttributes = $session->setLastAttributes();
351
+
352
+ //Mage::helper('quicksales')->getAssociatedGridHtml($qc_id);
353
+
354
+ $attributes = $session->getQuicksalesAttrubutesAssign();
355
+ $post = $this->getRequest()->getPost();
356
+ if (!is_array($attributes) || (!empty($post) && empty($mAttributeCode))) {
357
+ $attributes[$qAttributeId] = $mAttributeCode;
358
+ }
359
+
360
+ $attributes = $session->setQuicksalesAttrubutesAssign($attributes);
361
+ echo Mage::helper('quicksales')->getAssociatedGridHtml($qAttributeId, $mAttributeCode);
362
+ }
363
+
364
+ public function subcategoriesAction()
365
+ {
366
+
367
+ $parentId = (int)$this->getRequest()->getParam('parentId');
368
+
369
+ $subcategories = Mage::getModel('quicksales/api_getcategories')->getAllOptions(false, false, $parentId);
370
+ if (empty($subcategories)) {
371
+ echo '{}';
372
+ } else {
373
+ echo Mage::helper('core')->jsonEncode($subcategories);
374
+ }
375
+
376
+ }
377
+
378
+ /**
379
+ * Get super config grid
380
+ *
381
+ */
382
+ public function productsAction()
383
+ {
384
+ $this->_initListing();
385
+ $this->loadLayout(false);
386
+ $this->renderLayout();
387
+ }
388
+
389
+ public function logAction()
390
+ {
391
+ $this->loadLayout()
392
+ ->_setActiveMenu('quicksales/listing')
393
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Listing'), Mage::helper('adminhtml')->__('Listing'));
394
+
395
+ $this->getLayout();
396
+ $this->renderLayout();
397
+ }
398
+
399
+ public function productlogAction()
400
+ {
401
+ $this->loadLayout()
402
+ ->_setActiveMenu('quicksales/listing')
403
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Listing'), Mage::helper('adminhtml')->__('Listing'));
404
+
405
+ $this->getLayout();
406
+ $this->renderLayout();
407
+ }
408
+
409
+ public function stopAction()
410
+ {
411
+ Mage::getModel('quicksales/listing_action')->stop($this->getRequest()->getParam('id'));
412
+ $this->_redirect('*/*/edit',
413
+ array(
414
+ 'id' => $this->getRequest()->getParam('id'),
415
+ '_current' => true
416
+ )
417
+ );
418
+ }
419
+
420
+ public function startAction()
421
+ {
422
+ Mage::getModel('quicksales/listing_action')->start($this->getRequest()->getParam('id'));
423
+ $this->_redirect('*/*/edit',
424
+ array(
425
+ 'id' => $this->getRequest()->getParam('id'),
426
+ '_current' => true
427
+ )
428
+ );
429
+ }
430
+
431
+ public function relistAction()
432
+ {
433
+ Mage::getModel('quicksales/listing_action')->relist($this->getRequest()->getParam('id'));
434
+ $this->_redirect('*/*/edit',
435
+ array(
436
+ 'id' => $this->getRequest()->getParam('id'),
437
+ '_current' => true
438
+ )
439
+ );
440
+ }
441
+
442
+ public function massStopAction()
443
+ {
444
+ $listingIds = (array)$this->getRequest()->getParam('listingMass');
445
+
446
+ try {
447
+
448
+ foreach ($listingIds as $listingID) {
449
+ Mage::getModel('quicksales/listing_action')->stop($listingID);
450
+ }
451
+
452
+ $this->_getSession()->addSuccess(
453
+ $this->__('Total of %d record(s) have been updated.', count($listingID))
454
+ );
455
+ }
456
+ catch (Mage_Core_Model_Exception $e) {
457
+ $this->_getSession()->addError($e->getMessage());
458
+ } catch (Mage_Core_Exception $e) {
459
+ $this->_getSession()->addError($e->getMessage());
460
+ } catch (Exception $e) {
461
+ $this->_getSession()
462
+ ->addException($e, $this->__('An error occurred while updating the listing(s).'));
463
+ }
464
+
465
+ $this->_redirect('*/*/index');
466
+ }
467
+
468
+ public function massRelistAction()
469
+ {
470
+ $listingIds = (array)$this->getRequest()->getParam('listingMass');
471
+
472
+ try {
473
+
474
+ foreach ($listingIds as $listingID) {
475
+ Mage::getModel('quicksales/listing_action')->relist($listingID);
476
+ }
477
+
478
+ $this->_getSession()->addSuccess(
479
+ $this->__('Total of %d record(s) have been updated.', count($listingIds))
480
+ );
481
+ }
482
+ catch (Mage_Core_Model_Exception $e) {
483
+ $this->_getSession()->addError($e->getMessage());
484
+ } catch (Mage_Core_Exception $e) {
485
+ $this->_getSession()->addError($e->getMessage());
486
+ } catch (Exception $e) {
487
+ $this->_getSession()
488
+ ->addException($e, $this->__('An error occurred while updating the listing(s).'));
489
+ }
490
+
491
+ $this->_redirect('*/*/index');
492
+ }
493
+
494
+ public function massDeleteAction()
495
+ {
496
+ $listingIds = (array)$this->getRequest()->getParam('listingMass');
497
+
498
+ $counter = 0;
499
+
500
+ try {
501
+
502
+ foreach ($listingIds as $listingID) {
503
+ $listing = Mage::getModel('quicksales/listing')
504
+ ->load($listingID);
505
+ try {
506
+ Mage::getModel('quicksales/listing_action')->stop($listingID);
507
+ $listing->delete();
508
+ $counter++;
509
+ } catch (Exception $e) {
510
+
511
+ $this->_getSession()
512
+ ->addException($e, $this->__('An error occurred while deleting the listing(s).'));
513
+ }
514
+ }
515
+
516
+ $this->_getSession()->addSuccess(
517
+ $this->__('Total of %d record(s) have been deleted.', $counter)
518
+ );
519
+ }
520
+ catch (Mage_Core_Model_Exception $e) {
521
+ $this->_getSession()->addError($e->getMessage());
522
+ } catch (Mage_Core_Exception $e) {
523
+ $this->_getSession()->addError($e->getMessage());
524
+ } catch (Exception $e) {
525
+ $this->_getSession()
526
+ ->addException($e, $this->__('An error occurred while deleting the listing(s).'));
527
+ }
528
+
529
+ $this->_redirect('*/*/index');
530
+ }
531
+ }
app/code/community/Ewave/Quicksales/controllers/Adminhtml/LogController.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 14:53
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Adminhtml_LogController extends Mage_Adminhtml_Controller_Action
11
+ {
12
+ protected function _initAction()
13
+ {
14
+ $this->loadLayout()
15
+ ->_setActiveMenu('quicksales/listing')
16
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Listing'), Mage::helper('adminhtml')->__('Log'));
17
+ return $this;
18
+ }
19
+
20
+ public function indexAction()
21
+ {
22
+ $this->_initAction()
23
+ ->renderLayout();
24
+ }
25
+
26
+ public function importordersAction() {
27
+
28
+ Mage::getModel('quicksales/observer')->getQuicksalesOrders();
29
+ $this->_redirect('quicksales/adminhtml_log/index');
30
+ }
31
+ }
app/code/community/Ewave/Quicksales/controllers/Adminhtml/OrderController.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 14:53
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_Adminhtml_OrderController extends Mage_Adminhtml_Controller_Action
11
+ {
12
+ public function qpaidAction()
13
+ {
14
+ try {
15
+ $orderId = $this->getRequest()->getParam('id');
16
+ $order = Mage::getModel('sales/order')->load($orderId);
17
+ if ($order && $order->getQhash()) {
18
+ Mage::getModel('quicksales/observer')->paidOrder($order);
19
+ $order->setState('qpaid', true);
20
+ $order->save();
21
+
22
+ $this->_getSession()->addSuccess(
23
+ $this->__('The order status has been changed to "QS Paid" successfully.')
24
+ );
25
+ } else {
26
+ throw new Exception($this->__('This order is now available for QS synchronization'));
27
+ }
28
+ } catch (Exception $e) {
29
+ $this->_getSession()->addError($e->getMessage());
30
+ }
31
+
32
+ $this->_redirect('adminhtml/sales_order/view',
33
+ array(
34
+ 'order_id' => $orderId
35
+ )
36
+ );
37
+ }
38
+
39
+ }
app/code/community/Ewave/Quicksales/controllers/IndexController.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 19.09.11
6
+ * Time: 15:41
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Ewave_Quicksales_IndexController extends Mage_Core_Controller_Front_Action {
11
+
12
+ public function indexAction() {
13
+
14
+ //Ewave_Quicksales_Model_Observer::getQuicksalesItems();
15
+ Ewave_Quicksales_Model_Observer::getQuicksalesOrders();
16
+ }
17
+
18
+ }
app/code/community/Ewave/Quicksales/etc/adminhtml.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <acl>
5
+ <resources>
6
+ <admin>
7
+ <children>
8
+ <system>
9
+ <children>
10
+ <config>
11
+ <children>
12
+ <quicksales module="quicksales" translate="title">
13
+ <title>Main Settings</title>
14
+ </quicksales>
15
+ <quicksales_default module="quicksales" translate="title">
16
+ <title>Default Configuration</title>
17
+ </quicksales_default>
18
+ </children>
19
+ </config>
20
+ </children>
21
+ </system>
22
+ </children>
23
+ </admin>
24
+ </resources>
25
+ </acl>
26
+
27
+ <menu>
28
+ <quicksales>
29
+ <title>Quicksales</title>
30
+ <sort_order>71</sort_order>
31
+ <children>
32
+ <listing>
33
+ <title>Listings</title>
34
+ <sort_order>0</sort_order>
35
+ <action>quicksales/adminhtml_listing</action>
36
+ </listing>
37
+ <log>
38
+ <title>Logs</title>
39
+ <sort_order>0</sort_order>
40
+ <action>quicksales/adminhtml_log</action>
41
+ </log>
42
+ </children>
43
+ </quicksales>
44
+ </menu>
45
+
46
+ </config>
app/code/community/Ewave/Quicksales/etc/config.xml ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+
4
+ <modules>
5
+ <Ewave_Quicksales>
6
+ <version>1.3.2</version>
7
+ </Ewave_Quicksales>
8
+ </modules>
9
+
10
+ <frontend>
11
+ <routers>
12
+ <quicksales>
13
+ <use>standard</use>
14
+ <args>
15
+ <module>Ewave_Quicksales</module>
16
+ <frontName>quicksales</frontName>
17
+ </args>
18
+ </quicksales>
19
+ </routers>
20
+ <layout>
21
+ <updates>
22
+ <quicksales>
23
+ <file>quicksales.xml</file>
24
+ </quicksales>
25
+ </updates>
26
+ </layout>
27
+ </frontend>
28
+
29
+ <admin>
30
+ <routers>
31
+ <quicksales>
32
+ <use>admin</use>
33
+ <args>
34
+ <module>Ewave_Quicksales</module>
35
+ <frontName>quicksales</frontName>
36
+ </args>
37
+ </quicksales>
38
+ </routers>
39
+ </admin>
40
+
41
+ <adminhtml>
42
+ <layout>
43
+ <updates>
44
+ <quicksales>
45
+ <file>quicksales.xml</file>
46
+ </quicksales>
47
+ </updates>
48
+ </layout>
49
+ </adminhtml>
50
+
51
+ <global>
52
+ <models>
53
+ <quicksales>
54
+ <class>Ewave_Quicksales_Model</class>
55
+ <resourceModel>quicksales_mysql4</resourceModel>
56
+ </quicksales>
57
+
58
+ <quicksales_mysql4>
59
+ <class>Ewave_Quicksales_Model_Resource</class>
60
+
61
+ <entities>
62
+
63
+ <listing>
64
+ <table>listing</table>
65
+ </listing>
66
+
67
+ <listing_log>
68
+ <table>listing_log</table>
69
+ </listing_log>
70
+
71
+ <listing_product_log>
72
+ <table>listing_product_log</table>
73
+ </listing_product_log>
74
+
75
+ <listing_product>
76
+ <table>listing_product</table>
77
+ </listing_product>
78
+
79
+ <listing_attribute>
80
+ <table>listing_attribute</table>
81
+ </listing_attribute>
82
+
83
+ <listing_attribute_value>
84
+ <table>listing_attribute_value</table>
85
+ </listing_attribute_value>
86
+
87
+ </entities>
88
+ </quicksales_mysql4>
89
+
90
+ <cataloginventory_resource>
91
+ <rewrite>
92
+ <stock>Ewave_Quicksales_CatalogInventory_Model_Resource_Stock</stock>
93
+ </rewrite>
94
+ </cataloginventory_resource>
95
+
96
+ <!--sales>
97
+ <rewrite>
98
+ <order_shipment>Ewave_Quicksales_Model_RW_Sales_Order_Shipment</order_shipment>
99
+ </rewrite>
100
+ </sales-->
101
+ </models>
102
+
103
+ <resources>
104
+
105
+ <quicksales_setup>
106
+ <setup>
107
+ <module>Ewave_Quicksales</module>
108
+ <class>Ewave_Quicksales_Model_Entity_Setup</class>
109
+
110
+ </setup>
111
+ <connection>
112
+ <use>core_setup</use>
113
+ </connection>
114
+ </quicksales_setup>
115
+
116
+ <quicksales_write>
117
+ <connection>
118
+ <use>core_write</use>
119
+ </connection>
120
+ </quicksales_write>
121
+
122
+ <quicksales_read>
123
+ <connection>
124
+ <use>core_read</use>
125
+ </connection>
126
+ </quicksales_read>
127
+
128
+ </resources>
129
+
130
+ <blocks>
131
+ <quicksales>
132
+ <class>Ewave_Quicksales_Block</class>
133
+ </quicksales>
134
+
135
+ <adminhtml>
136
+ <rewrite>
137
+ <sales_order_grid>Ewave_Quicksales_Block_RW_Adminhtml_Sales_Order_Grid</sales_order_grid>
138
+ <sales_order_view>Ewave_Quicksales_Block_RW_Adminhtml_Sales_Order_View</sales_order_view>
139
+ <sales_order_payment>Ewave_Quicksales_Block_RW_Adminhtml_Sales_Order_Payment</sales_order_payment>
140
+ </rewrite>
141
+ </adminhtml>
142
+ </blocks>
143
+
144
+ <helpers>
145
+ <quicksales>
146
+ <class>Ewave_Quicksales_Helper</class>
147
+ </quicksales>
148
+ </helpers>
149
+
150
+ <events>
151
+ <cataloginventory_stock_item_save_commit_after>
152
+ <observers>
153
+ <module>
154
+ <type>singleton</type>
155
+ <class>quicksales/observer</class>
156
+ <method>updateQty</method>
157
+ </module>
158
+ </observers>
159
+ </cataloginventory_stock_item_save_commit_after>
160
+
161
+ <catalog_product_save_after>
162
+ <observers>
163
+ <module>
164
+ <type>singleton</type>
165
+ <class>quicksales/observer</class>
166
+ <method>updateProduct</method>
167
+ </module>
168
+ </observers>
169
+ </catalog_product_save_after>
170
+
171
+ <sales_order_invoice_register>
172
+ <observers>
173
+ <module>
174
+ <type>singleton</type>
175
+ <class>quicksales/observer</class>
176
+ <method>sendQuicksaleOrder</method>
177
+ </module>
178
+ </observers>
179
+ </sales_order_invoice_register>
180
+
181
+ <sales_order_shipment_save_commit_after>
182
+ <observers>
183
+ <module>
184
+ <type>singleton</type>
185
+ <class>quicksales/observer</class>
186
+ <method>shippedOrder</method>
187
+ </module>
188
+ </observers>
189
+ </sales_order_shipment_save_commit_after>
190
+
191
+ <sales_order_shipment_save_before>
192
+ <observers>
193
+ <module>
194
+ <type>singleton</type>
195
+ <class>quicksales/observer</class>
196
+ <method>checkShippedOrder</method>
197
+ </module>
198
+ </observers>
199
+ </sales_order_shipment_save_before>
200
+
201
+ </events>
202
+
203
+ <sales>
204
+ <order>
205
+ <statuses>
206
+
207
+ <qnot_checked_out translate="label">
208
+ <label>Not Checked Out</label>
209
+ </qnot_checked_out>
210
+
211
+ <qpaid translate="label">
212
+ <label>QS Paid</label>
213
+ </qpaid>
214
+
215
+ </statuses>
216
+
217
+ <states>
218
+ <qpaid translate="label">
219
+ <label>QS Paid</label>
220
+ <statuses>
221
+ <qpaid default="1"/>
222
+ </statuses>
223
+ </qpaid>
224
+ <qnot_checked_out translate="label">
225
+ <label>Not Checked Out</label>
226
+ <statuses>
227
+ <qnot_checked_out default="1"/>
228
+ </statuses>
229
+ </qnot_checked_out>
230
+ </states>
231
+ </order>
232
+ </sales>
233
+
234
+ </global>
235
+
236
+ <default>
237
+ <quicksales>
238
+ <settings>
239
+ <api_version>1</api_version>
240
+ </settings>
241
+ </quicksales>
242
+
243
+ <payment>
244
+ <quicksales>
245
+ <active>1</active>
246
+ <model>quicksales/payment_method_quicksales</model>
247
+ <order_status>pending</order_status>
248
+ <title>Quicksales Order</title>
249
+ <allowspecific>0</allowspecific>
250
+ <group>offline</group>
251
+ </quicksales>
252
+ </payment>
253
+
254
+ </default>
255
+
256
+ <crontab>
257
+ <jobs>
258
+ <quicksales_synch>
259
+ <schedule>
260
+ <cron_expr>0 1 * * *</cron_expr>
261
+ </schedule>
262
+ <run>
263
+ <model>quicksales/observer::getQuicksalesItems</model>
264
+ </run>
265
+ </quicksales_synch>
266
+
267
+ <quicksales_order>
268
+ <schedule>
269
+ <cron_expr>*/15 * * * *</cron_expr>
270
+ </schedule>
271
+ <run>
272
+ <model>quicksales/observer::getQuicksalesOrders</model>
273
+ </run>
274
+ </quicksales_order>
275
+ </jobs>
276
+
277
+ </crontab>
278
+
279
+ </config>
280
+
281
+
app/code/community/Ewave/Quicksales/etc/system.xml ADDED
@@ -0,0 +1,785 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+
4
+ <tabs>
5
+ <ewave translate="label">
6
+ <label>Quicksales</label>
7
+ <sort_order>300</sort_order>
8
+ </ewave>
9
+ </tabs>
10
+
11
+ <sections>
12
+ <quicksales translate="label" module="quicksales">
13
+ <class>separator-top</class>
14
+ <label>Main Settings</label>
15
+ <tab>ewave</tab>
16
+ <frontend_type>text</frontend_type>
17
+ <sort_order>45</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <groups>
21
+ <settings translate="label">
22
+ <label>Connection Settings</label>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>100</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <fields>
28
+
29
+ <dev_id translate="label comment">
30
+ <label>Dev ID</label>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>10</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ </dev_id>
36
+
37
+ <dev_token translate="label comment">
38
+ <label>Dev Token</label>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>20</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ </dev_token>
44
+
45
+ <api_version translate="label comment">
46
+ <label>API Version</label>
47
+ <frontend_type>text</frontend_type>
48
+ <default>1</default>
49
+ <sort_order>30</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ </api_version>
53
+
54
+ <vshop_seller translate="label comment">
55
+ <label>Seller login</label>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>35</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ </vshop_seller>
61
+
62
+ <seller_password translate="label comment">
63
+ <label>Seller password</label>
64
+ <frontend_type>text</frontend_type>
65
+ <sort_order>37</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ </seller_password>
69
+
70
+ <have_vshop translate="label comment">
71
+ <label>Do you have a vShop</label>
72
+ <frontend_type>select</frontend_type>
73
+ <source_model>adminhtml/system_config_source_yesno</source_model>
74
+ <sort_order>40</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ </have_vshop>
78
+
79
+ <sandbox translate="label comment">
80
+ <label>Sandbox</label>
81
+ <frontend_type>select</frontend_type>
82
+ <source_model>adminhtml/system_config_source_yesno</source_model>
83
+ <sort_order>40</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ </sandbox>
87
+
88
+ </fields>
89
+ </settings>
90
+ <stock translate="label">
91
+ <label>Stock &amp; Product Configuration Options</label>
92
+ <frontend_type>text</frontend_type>
93
+ <sort_order>200</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <fields>
97
+
98
+ <update_magento_qty_quicksale_sold translate="label comment">
99
+ <label>Update Magento Store product QTY when listed item SOLD on quicksales</label>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>adminhtml/system_config_source_yesno</source_model>
102
+ <default>1</default>
103
+ <sort_order>10</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ </update_magento_qty_quicksale_sold>
107
+
108
+ <update_quicksale_qty_magento_change translate="label comment">
109
+ <label>Update quicksales QTY when listed item QTY CHANGED on Magento Store</label>
110
+ <frontend_type>select</frontend_type>
111
+ <source_model>adminhtml/system_config_source_yesno</source_model>
112
+ <default>1</default>
113
+ <sort_order>20</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <show_in_website>1</show_in_website>
116
+ </update_quicksale_qty_magento_change>
117
+
118
+ <stop_quicksale_magento_qty_less translate="label comment">
119
+ <label>Stop quicksales item listing when listed item QTY is 0 or less on Magento Store</label>
120
+ <frontend_type>select</frontend_type>
121
+ <source_model>adminhtml/system_config_source_yesno</source_model>
122
+ <default>1</default>
123
+ <sort_order>30</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ </stop_quicksale_magento_qty_less>
127
+
128
+ <stop_quicksale_magento_out_stock translate="label comment">
129
+ <label>Stop quicksales item listing when Magento Store product is OUT of stock</label>
130
+ <frontend_type>select</frontend_type>
131
+ <source_model>adminhtml/system_config_source_yesno</source_model>
132
+ <default>1</default>
133
+ <sort_order>40</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ </stop_quicksale_magento_out_stock>
137
+
138
+ <start_quicksale_magento_qty_great translate="label comment">
139
+ <label>Relist quicksales item listing when Magento Store product is IN stock and QTY is greater than 0</label>
140
+ <frontend_type>select</frontend_type>
141
+ <source_model>adminhtml/system_config_source_yesno</source_model>
142
+ <default>1</default>
143
+ <sort_order>50</sort_order>
144
+ <show_in_default>1</show_in_default>
145
+ <show_in_website>1</show_in_website>
146
+ </start_quicksale_magento_qty_great>
147
+
148
+ </fields>
149
+ </stock>
150
+ <order_customer translate="label">
151
+ <label>Order &amp; Customer Synchronization Options</label>
152
+ <frontend_type>text</frontend_type>
153
+ <sort_order>300</sort_order>
154
+ <show_in_default>1</show_in_default>
155
+ <show_in_website>1</show_in_website>
156
+ <fields>
157
+
158
+ <import_orders translate="label comment">
159
+ <label>Import Orders</label>
160
+ <frontend_type>select</frontend_type>
161
+ <source_model>adminhtml/system_config_source_yesno</source_model>
162
+ <sort_order>10</sort_order>
163
+ <show_in_default>1</show_in_default>
164
+ <show_in_website>1</show_in_website>
165
+ </import_orders>
166
+
167
+ <customer_import translate="label comment">
168
+ <label>Customer Import Options</label>
169
+ <frontend_type>select</frontend_type>
170
+ <source_model>quicksales/system_customer_import</source_model>
171
+ <sort_order>20</sort_order>
172
+ <show_in_default>1</show_in_default>
173
+ <show_in_website>1</show_in_website>
174
+ </customer_import>
175
+
176
+ <customer_notify translate="label comment">
177
+ <label>Second Notification</label>
178
+ <frontend_type>select</frontend_type>
179
+ <source_model>adminhtml/system_config_source_yesno</source_model>
180
+ <sort_order>30</sort_order>
181
+ <show_in_default>1</show_in_default>
182
+ <show_in_website>1</show_in_website>
183
+ <depends><customer_import>import</customer_import></depends>
184
+ </customer_notify>
185
+
186
+ <customer_email translate="label comment">
187
+ <label>Customer Email</label>
188
+ <frontend_type>text</frontend_type>
189
+ <sort_order>30</sort_order>
190
+ <show_in_default>1</show_in_default>
191
+ <show_in_website>1</show_in_website>
192
+ <depends><customer_import>predefined</customer_import></depends>
193
+ </customer_email>
194
+
195
+ <gts_info>
196
+ <label>Please see our GST info</label>
197
+ <frontend_type>note</frontend_type>
198
+ <frontend_model>quicksales/adminhtml_system_config_form_field_gst</frontend_model>
199
+ <sort_order>70</sort_order>
200
+ <show_in_default>1</show_in_default>
201
+ <show_in_website>1</show_in_website>
202
+ </gts_info>
203
+
204
+ </fields>
205
+ </order_customer>
206
+ </groups>
207
+ </quicksales>
208
+ <quicksales_default translate="label" module="quicksales">
209
+ <class>separator-top</class>
210
+ <label>Default Configuration</label>
211
+ <tab>ewave</tab>
212
+ <frontend_type>text</frontend_type>
213
+ <sort_order>55</sort_order>
214
+ <show_in_default>1</show_in_default>
215
+ <show_in_website>1</show_in_website>
216
+ <groups>
217
+ <pricing translate="label">
218
+ <label>Pricing Information</label>
219
+ <frontend_type>text</frontend_type>
220
+ <sort_order>100</sort_order>
221
+ <show_in_default>1</show_in_default>
222
+ <show_in_website>1</show_in_website>
223
+ <fields>
224
+
225
+ <auction_start_price translate="label comment">
226
+ <label>Auction Start Price</label>
227
+ <frontend_type>select</frontend_type>
228
+ <source_model>quicksales/system_price</source_model>
229
+ <comment>Only used when listing as an Auction style listing, the start price should be your reserve price. When specifying this value, a BidIncrement is required.</comment>
230
+ <sort_order>10</sort_order>
231
+ <show_in_default>1</show_in_default>
232
+ <show_in_website>1</show_in_website>
233
+ </auction_start_price>
234
+
235
+ <auction_start_price_custom translate="label comment">
236
+ <label>Auction Start Custom Price</label>
237
+ <frontend_type>select</frontend_type>
238
+ <source_model>quicksales/system_price_custom</source_model>
239
+ <sort_order>20</sort_order>
240
+ <show_in_default>1</show_in_default>
241
+ <show_in_website>1</show_in_website>
242
+ <depends><auction_start_price>custom_price</auction_start_price></depends>
243
+ </auction_start_price_custom>
244
+
245
+ <bid_increment translate="label comment">
246
+ <label>Bid Increment</label>
247
+ <frontend_type>text</frontend_type>
248
+ <comment>The minimum bid amount for each subsequent bid, for example if the start price was $50.00 and the bid increment was $0.20 the first bid would be $50.00, the second minimum bid would be $50.20.</comment>
249
+ <sort_order>30</sort_order>
250
+ <show_in_default>1</show_in_default>
251
+ <show_in_website>1</show_in_website>
252
+ </bid_increment>
253
+
254
+ <buy_now_price translate="label comment">
255
+ <label>Buy Now Price</label>
256
+ <frontend_type>select</frontend_type>
257
+ <source_model>quicksales/system_price</source_model>
258
+ <comment>The instant purchase price. The instant purchase price. Must be greater than Auction Start Price if defined.</comment>
259
+ <sort_order>40</sort_order>
260
+ <show_in_default>1</show_in_default>
261
+ <show_in_website>1</show_in_website>
262
+ </buy_now_price>
263
+
264
+ <buy_now_price_custom translate="label comment">
265
+ <label>Buy Now Custom Price</label>
266
+ <frontend_type>select</frontend_type>
267
+ <source_model>quicksales/system_price_custom</source_model>
268
+ <sort_order>50</sort_order>
269
+ <show_in_default>1</show_in_default>
270
+ <show_in_website>1</show_in_website>
271
+ <depends><buy_now_price>custom_price</buy_now_price></depends>
272
+ </buy_now_price_custom>
273
+
274
+ </fields>
275
+ </pricing>
276
+ <listing translate="label">
277
+ <label>Listing Information</label>
278
+ <frontend_type>text</frontend_type>
279
+ <sort_order>200</sort_order>
280
+ <show_in_default>1</show_in_default>
281
+ <show_in_website>1</show_in_website>
282
+ <fields>
283
+
284
+ <start_date translate="label comment">
285
+ <label>Start Date</label>
286
+ <frontend_type>hidden</frontend_type>
287
+ <frontend_model>quicksales/adminhtml_system_config_form_field_datetime</frontend_model>
288
+ <sort_order>10</sort_order>
289
+ <comment>The start time of the listing. If the StartTime is greater than the current time, it will be scheduled, otherwise activated immediately. {StartTime must be in 'dd/mm/yyyy hh:mm:ss tt' or 'dd/mm/yyyy HH:mm:ss' string format} </comment>
290
+ <show_in_default>1</show_in_default>
291
+ <show_in_website>1</show_in_website>
292
+ </start_date>
293
+
294
+ <description translate="label comment">
295
+ <label>Description</label>
296
+ <frontend_type>select</frontend_type>
297
+ <source_model>quicksales/system_description</source_model>
298
+ <sort_order>10</sort_order>
299
+ <comment>Description of the item, HTML allowed, 600,000 chars.</comment>
300
+ <show_in_default>1</show_in_default>
301
+ <show_in_website>1</show_in_website>
302
+ </description>
303
+
304
+ <description_custom translate="label comment">
305
+ <label>Description Custom</label>
306
+ <frontend_type>editor</frontend_type>
307
+ <frontend_model>quicksales/adminhtml_system_config_form_field_description</frontend_model>
308
+ <sort_order>20</sort_order>
309
+ <show_in_default>1</show_in_default>
310
+ <show_in_website>1</show_in_website>
311
+ <depends><description>custom</description></depends>
312
+ </description_custom>
313
+
314
+ <duration translate="label comment">
315
+ <label>Duration</label>
316
+ <frontend_type>select</frontend_type>
317
+ <source_model>quicksales/system_duration</source_model>
318
+ <sort_order>30</sort_order>
319
+ <comment>The duration of the listing in days. Can be relisted until sold if Auto-Relist is selected, recommended.</comment>
320
+ <show_in_default>1</show_in_default>
321
+ <show_in_website>1</show_in_website>
322
+ </duration>
323
+
324
+ <brand_new translate="label comment">
325
+ <label>Brand New</label>
326
+ <frontend_type>select</frontend_type>
327
+ <source_model>adminhtml/system_config_source_yesno</source_model>
328
+ <sort_order>40</sort_order>
329
+ <show_in_default>1</show_in_default>
330
+ <show_in_website>1</show_in_website>
331
+ </brand_new>
332
+
333
+ <qty translate="label comment">
334
+ <label>Quantity</label>
335
+ <frontend_type>select</frontend_type>
336
+ <source_model>quicksales/system_qty</source_model>
337
+ <sort_order>50</sort_order>
338
+ <show_in_default>1</show_in_default>
339
+ <show_in_website>1</show_in_website>
340
+ </qty>
341
+
342
+ <qty_custom translate="label comment">
343
+ <label>Custom Quantity Attribute</label>
344
+ <frontend_type>select</frontend_type>
345
+ <source_model>quicksales/system_custom</source_model>
346
+ <sort_order>60</sort_order>
347
+ <show_in_default>1</show_in_default>
348
+ <show_in_website>1</show_in_website>
349
+ <depends><qty>custom</qty></depends>
350
+ </qty_custom>
351
+
352
+ <bid_now translate="label comment">
353
+ <label>BidNow </label>
354
+ <frontend_type>select</frontend_type>
355
+ <source_model>adminhtml/system_config_source_yesno</source_model>
356
+ <sort_order>70</sort_order>
357
+ <comment>The remaining time of the auction is hidden from buyers. Only applicable for auction style listings.</comment>
358
+ <show_in_default>1</show_in_default>
359
+ <show_in_website>1</show_in_website>
360
+ </bid_now>
361
+
362
+ <auto_1min translate="label comment">
363
+ <label>Auto-1-Min</label>
364
+ <frontend_type>select</frontend_type>
365
+ <source_model>adminhtml/system_config_source_yesno</source_model>
366
+ <sort_order>80</sort_order>
367
+ <comment>Auto-1-Min extends the auction time for one minute if a bid is placed within the last 60 seconds. Only applicable for auction style listings.</comment>
368
+ <show_in_default>1</show_in_default>
369
+ <show_in_website>1</show_in_website>
370
+ </auto_1min>
371
+
372
+
373
+ <auto_relist translate="label comment">
374
+ <label>Auto-Relist Options</label>
375
+ <frontend_type>select</frontend_type>
376
+ <source_model>quicksales/system_autorelist</source_model>
377
+ <sort_order>90</sort_order>
378
+ <show_in_default>1</show_in_default>
379
+ <show_in_website>1</show_in_website>
380
+ </auto_relist>
381
+
382
+ </fields>
383
+ </listing>
384
+ <listing_upgrade translate="label">
385
+ <label>Listing Upgrades (fees apply)</label>
386
+ <frontend_type>text</frontend_type>
387
+ <sort_order>300</sort_order>
388
+ <show_in_default>1</show_in_default>
389
+ <show_in_website>1</show_in_website>
390
+ <fields>
391
+
392
+ <front_page_featured translate="label comment">
393
+ <label>Front Page Featured</label>
394
+ <frontend_type>select</frontend_type>
395
+ <source_model>adminhtml/system_config_source_yesno</source_model>
396
+ <sort_order>10</sort_order>
397
+ <comment>$14.95 - listing will be randomly displayed on quicksales’ home page and in the Featured Items list.</comment>
398
+ <show_in_default>1</show_in_default>
399
+ <show_in_website>1</show_in_website>
400
+ </front_page_featured>
401
+
402
+ <category_special translate="label comment">
403
+ <label>Category Special</label>
404
+ <frontend_type>select</frontend_type>
405
+ <source_model>adminhtml/system_config_source_yesno</source_model>
406
+ <sort_order>20</sort_order>
407
+ <comment>$9.95 - listing will be shown above standard listings in category lists and search results.</comment>
408
+ <show_in_default>1</show_in_default>
409
+ <show_in_website>1</show_in_website>
410
+ </category_special>
411
+
412
+ <highlight_listing translate="label comment">
413
+ <label>Highlight Listing</label>
414
+ <frontend_type>select</frontend_type>
415
+ <source_model>adminhtml/system_config_source_yesno</source_model>
416
+ <sort_order>30</sort_order>
417
+ <comment>$1.95 - listing will be highlighted in category lists and search results.</comment>
418
+ <show_in_default>1</show_in_default>
419
+ <show_in_website>1</show_in_website>
420
+ </highlight_listing>
421
+
422
+ <bold_title translate="label comment">
423
+ <label>Bold Title</label>
424
+ <frontend_type>select</frontend_type>
425
+ <source_model>adminhtml/system_config_source_yesno</source_model>
426
+ <sort_order>40</sort_order>
427
+ <comment>$0.95 - listing will be in BOLD in category lists and search results.</comment>
428
+ <show_in_default>1</show_in_default>
429
+ <show_in_website>1</show_in_website>
430
+ </bold_title>
431
+
432
+ </fields>
433
+ </listing_upgrade>
434
+ <payment translate="label">
435
+ <label>Payment Information</label>
436
+ <frontend_type>text</frontend_type>
437
+ <sort_order>400</sort_order>
438
+ <show_in_default>1</show_in_default>
439
+ <show_in_website>1</show_in_website>
440
+ <fields>
441
+
442
+ <method translate="label comment">
443
+ <label>Payment Methods Accepted</label>
444
+ <frontend_type>multiselect</frontend_type>
445
+ <source_model>quicksales/system_payment_method</source_model>
446
+ <sort_order>10</sort_order>
447
+ <comment><![CDATA[Enter Credit Card, PayPal, Paymate and Bank Deposit settings under <a target="_blank" href="http://www.quicksales.com.au/secure/User/user_mypref.aspx">‘Selling Preferences’</a> in the quicksales website.]]></comment>
448
+ <show_in_default>1</show_in_default>
449
+ <show_in_website>1</show_in_website>
450
+ </method>
451
+
452
+ <instruction translate="label comment">
453
+ <label>Payment Instructions</label>
454
+ <frontend_type>textarea</frontend_type>
455
+ <sort_order>20</sort_order>
456
+ <comment>Optional payment instructions, 1,000 chars.</comment>
457
+ <show_in_default>1</show_in_default>
458
+ <show_in_website>1</show_in_website>
459
+ </instruction>
460
+
461
+ <show_policy translate="label comment">
462
+ <label>Show Refund &amp; Return Policy</label>
463
+ <frontend_type>select</frontend_type>
464
+ <source_model>adminhtml/system_config_source_yesno</source_model>
465
+ <sort_order>30</sort_order>
466
+ <comment><![CDATA[Shows your Refund & Return Policies as entered under <a target="_blank" href="http://www.quicksales.com.au/secure/User/user_mypref.aspx">‘Selling Preferences’</a> in the quicksales website.]]></comment>
467
+ <show_in_default>1</show_in_default>
468
+ <show_in_website>1</show_in_website>
469
+ </show_policy>
470
+
471
+ </fields>
472
+ </payment>
473
+ <shipping translate="label">
474
+ <label>Shipping Information</label>
475
+ <frontend_type>text</frontend_type>
476
+ <sort_order>500</sort_order>
477
+ <show_in_default>1</show_in_default>
478
+ <show_in_website>1</show_in_website>
479
+ <fields>
480
+
481
+ <method translate="label comment">
482
+ <label>Shipping Method</label>
483
+ <frontend_type>select</frontend_type>
484
+ <source_model>quicksales/system_shipping_method</source_model>
485
+ <sort_order>10</sort_order>
486
+ <comment><![CDATA[Choose one of the shipping methods supported on quicksales. Notes:<br />
487
+ * Temando (create a free <a target="_blank" href="http://www.quicksales.com.au/secure/User/user_freightaccount.aspx">Temando account</a>) = your rates shown to buyers<br />
488
+ * Flat Postage = Fixed price to anywhere<br />
489
+ * Flat Postage by Location = A different Fixed price to each state<br />
490
+ * Calculated postage, Australia Post rates shown to buyers<br />
491
+ * See Item Description = Include a shipping info within the listing description<br />
492
+ ]]></comment>
493
+ <show_in_default>1</show_in_default>
494
+ <show_in_website>1</show_in_website>
495
+ </method>
496
+
497
+ <flat_rate translate="label comment">
498
+ <label>Postage Flat Rate</label>
499
+ <frontend_type>text</frontend_type>
500
+ <sort_order>20</sort_order>
501
+ <show_in_default>1</show_in_default>
502
+ <show_in_website>1</show_in_website>
503
+ <depends><method>2</method></depends>
504
+ </flat_rate>
505
+
506
+ <flat_table_rate_nsw translate="label comment">
507
+ <label>Fixed Rate to NSW</label>
508
+ <frontend_type>text</frontend_type>
509
+ <sort_order>20</sort_order>
510
+ <show_in_default>1</show_in_default>
511
+ <show_in_website>1</show_in_website>
512
+ <depends><method>3</method></depends>
513
+ </flat_table_rate_nsw>
514
+
515
+ <flat_table_rate_vic translate="label comment">
516
+ <label>Fixed Rate to VIC</label>
517
+ <frontend_type>text</frontend_type>
518
+ <sort_order>30</sort_order>
519
+ <show_in_default>1</show_in_default>
520
+ <show_in_website>1</show_in_website>
521
+ <depends><method>3</method></depends>
522
+ </flat_table_rate_vic>
523
+
524
+ <flat_table_rate_qld translate="label comment">
525
+ <label>Fixed Rate to QLD</label>
526
+ <frontend_type>text</frontend_type>
527
+ <sort_order>40</sort_order>
528
+ <show_in_default>1</show_in_default>
529
+ <show_in_website>1</show_in_website>
530
+ <depends><method>3</method></depends>
531
+ </flat_table_rate_qld>
532
+
533
+ <flat_table_rate_act translate="label comment">
534
+ <label>Fixed Rate to ACT</label>
535
+ <frontend_type>text</frontend_type>
536
+ <sort_order>50</sort_order>
537
+ <show_in_default>1</show_in_default>
538
+ <show_in_website>1</show_in_website>
539
+ <depends><method>3</method></depends>
540
+ </flat_table_rate_act>
541
+
542
+ <flat_table_rate_nt translate="label comment">
543
+ <label>Fixed Rate to NT</label>
544
+ <frontend_type>text</frontend_type>
545
+ <sort_order>60</sort_order>
546
+ <show_in_default>1</show_in_default>
547
+ <show_in_website>1</show_in_website>
548
+ <depends><method>3</method></depends>
549
+ </flat_table_rate_nt>
550
+
551
+ <flat_table_rate_tas translate="label comment">
552
+ <label>Fixed Rate to TAS</label>
553
+ <frontend_type>text</frontend_type>
554
+ <sort_order>70</sort_order>
555
+ <show_in_default>1</show_in_default>
556
+ <show_in_website>1</show_in_website>
557
+ <depends><method>3</method></depends>
558
+ </flat_table_rate_tas>
559
+
560
+ <flat_table_rate_sa translate="label comment">
561
+ <label>Fixed Rate to SA</label>
562
+ <frontend_type>text</frontend_type>
563
+ <sort_order>80</sort_order>
564
+ <show_in_default>1</show_in_default>
565
+ <show_in_website>1</show_in_website>
566
+ <depends><method>3</method></depends>
567
+ </flat_table_rate_sa>
568
+
569
+ <flat_table_rate_wa translate="label comment">
570
+ <label>Fixed Rate to WA</label>
571
+ <frontend_type>text</frontend_type>
572
+ <sort_order>90</sort_order>
573
+ <show_in_default>1</show_in_default>
574
+ <show_in_website>1</show_in_website>
575
+ <depends><method>3</method></depends>
576
+ </flat_table_rate_wa>
577
+
578
+ <au_post_regular>
579
+ <label>Australia Post service "Regular" offered</label>
580
+ <frontend_type>select</frontend_type>
581
+ <source_model>adminhtml/system_config_source_yesno</source_model>
582
+ <sort_order>20</sort_order>
583
+ <show_in_default>1</show_in_default>
584
+ <show_in_website>1</show_in_website>
585
+ <depends><method>4</method></depends>
586
+ </au_post_regular>
587
+
588
+ <calc_au_post_express>
589
+ <label>Australia Post service "Express" offered</label>
590
+ <frontend_type>select</frontend_type>
591
+ <source_model>adminhtml/system_config_source_yesno</source_model>
592
+ <sort_order>30</sort_order>
593
+ <show_in_default>1</show_in_default>
594
+ <show_in_website>1</show_in_website>
595
+ <depends><method>4</method></depends>
596
+ </calc_au_post_express>
597
+
598
+ <calc_length>
599
+ <label>Length Attribute</label>
600
+ <frontend_type>select</frontend_type>
601
+ <source_model>quicksales/system_custom</source_model>
602
+ <sort_order>40</sort_order>
603
+ <show_in_default>1</show_in_default>
604
+ <show_in_website>1</show_in_website>
605
+ <depends><method>4</method></depends>
606
+ </calc_length>
607
+
608
+ <calc_width>
609
+ <label>Width Attribute</label>
610
+ <frontend_type>select</frontend_type>
611
+ <source_model>quicksales/system_custom</source_model>
612
+ <sort_order>50</sort_order>
613
+ <show_in_default>1</show_in_default>
614
+ <show_in_website>1</show_in_website>
615
+ <depends><method>4</method></depends>
616
+ </calc_width>
617
+
618
+ <calc_height>
619
+ <label>Height Attribute</label>
620
+ <frontend_type>select</frontend_type>
621
+ <source_model>quicksales/system_custom</source_model>
622
+ <sort_order>60</sort_order>
623
+ <show_in_default>1</show_in_default>
624
+ <show_in_website>1</show_in_website>
625
+ <depends><method>4</method></depends>
626
+ </calc_height>
627
+
628
+ <calc_weight>
629
+ <label>Weight Attribute</label>
630
+ <frontend_type>select</frontend_type>
631
+ <source_model>quicksales/system_custom</source_model>
632
+ <sort_order>70</sort_order>
633
+ <show_in_default>1</show_in_default>
634
+ <show_in_website>1</show_in_website>
635
+ <depends><method>4</method></depends>
636
+ </calc_weight>
637
+
638
+ <temando_package>
639
+ <label>Temando Package</label>
640
+ <frontend_type>select</frontend_type>
641
+ <source_model>quicksales/system_shipping_package</source_model>
642
+ <sort_order>30</sort_order>
643
+ <show_in_default>1</show_in_default>
644
+ <show_in_website>1</show_in_website>
645
+ <depends><method>7</method></depends>
646
+ </temando_package>
647
+
648
+ <temando_length>
649
+ <label>Length Attribute</label>
650
+ <frontend_type>select</frontend_type>
651
+ <source_model>quicksales/system_custom</source_model>
652
+ <sort_order>40</sort_order>
653
+ <show_in_default>1</show_in_default>
654
+ <show_in_website>1</show_in_website>
655
+ <depends><method>7</method></depends>
656
+ </temando_length>
657
+
658
+ <temando_width>
659
+ <label>Width Attribute</label>
660
+ <frontend_type>select</frontend_type>
661
+ <source_model>quicksales/system_custom</source_model>
662
+ <sort_order>50</sort_order>
663
+ <show_in_default>1</show_in_default>
664
+ <show_in_website>1</show_in_website>
665
+ <depends><method>7</method></depends>
666
+ </temando_width>
667
+
668
+ <temando_height>
669
+ <label>Height Attribute</label>
670
+ <frontend_type>select</frontend_type>
671
+ <source_model>quicksales/system_custom</source_model>
672
+ <sort_order>60</sort_order>
673
+ <show_in_default>1</show_in_default>
674
+ <show_in_website>1</show_in_website>
675
+ <depends><method>7</method></depends>
676
+ </temando_height>
677
+
678
+ <temando_weight>
679
+ <label>Weight Attribute</label>
680
+ <frontend_type>select</frontend_type>
681
+ <source_model>quicksales/system_custom</source_model>
682
+ <sort_order>70</sort_order>
683
+ <show_in_default>1</show_in_default>
684
+ <show_in_website>1</show_in_website>
685
+ <depends><method>7</method></depends>
686
+ </temando_weight>
687
+
688
+ <posttolocation translate="label comment">
689
+ <label>Post to location</label>
690
+ <frontend_type>multiselect</frontend_type>
691
+ <source_model>quicksales/system_shipping_posttolocation
692
+ </source_model>
693
+ <sort_order>110</sort_order>
694
+ <show_in_default>1</show_in_default>
695
+ <show_in_website>1</show_in_website>
696
+ </posttolocation>
697
+
698
+ <postinst translate="label comment">
699
+ <label>Post Instructions</label>
700
+ <frontend_type>textarea</frontend_type>
701
+ <sort_order>120</sort_order>
702
+ <show_in_default>1</show_in_default>
703
+ <show_in_website>1</show_in_website>
704
+ </postinst>
705
+
706
+ </fields>
707
+ </shipping>
708
+
709
+ </groups>
710
+ </quicksales_default>
711
+
712
+ <payment>
713
+ <groups>
714
+ <!-- newmodule fieldset -->
715
+ <quicksales translate="label" module="quicksales">
716
+ <!-- will have title 'New Module' -->
717
+ <label>Quicksales Order</label>
718
+ <!-- position between other payment methods -->
719
+ <sort_order>670</sort_order>
720
+ <!-- do not show this configuration options in store scope -->
721
+ <show_in_default>1</show_in_default>
722
+ <show_in_website>1</show_in_website>
723
+ <show_in_store>0</show_in_store>
724
+ <fields>
725
+ <!-- is this payment method active for the website? -->
726
+ <active translate="label">
727
+ <!-- label for the field -->
728
+ <label>Enabled</label>
729
+ <!-- input type for configuration value -->
730
+ <frontend_type>select</frontend_type>
731
+ <!-- model to take the option values from -->
732
+ <source_model>adminhtml/system_config_source_yesno</source_model>
733
+ <!-- field position -->
734
+ <sort_order>1</sort_order>
735
+ <!-- do not show this field in store scope -->
736
+ <show_in_default>1</show_in_default>
737
+ <show_in_website>1</show_in_website>
738
+ <show_in_store>0</show_in_store>
739
+ </active>
740
+
741
+ <order_status translate="label">
742
+ <label>New order status</label>
743
+ <frontend_type>select</frontend_type>
744
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
745
+ <sort_order>4</sort_order>
746
+ <show_in_default>1</show_in_default>
747
+ <show_in_website>1</show_in_website>
748
+ <show_in_store>0</show_in_store>
749
+ </order_status>
750
+
751
+ <title translate="label">
752
+ <label>Title</label>
753
+ <frontend_type>text</frontend_type>
754
+ <sort_order>2</sort_order>
755
+ <show_in_default>1</show_in_default>
756
+ <show_in_website>1</show_in_website>
757
+ <show_in_store>0</show_in_store>
758
+ </title>
759
+ </fields>
760
+ </quicksales>
761
+ </groups>
762
+ </payment>
763
+
764
+ </sections>
765
+ <default>
766
+
767
+ <quicksales>
768
+ <stock>
769
+ <update_quicksale_qty_magento_change>1</update_quicksale_qty_magento_change>
770
+ <stop_quicksale_magento_qty_less>1</stop_quicksale_magento_qty_less>
771
+ <stop_quicksale_magento_out_stock>1</stop_quicksale_magento_out_stock>
772
+ <start_quicksale_magento_qty_great>1</start_quicksale_magento_qty_great>
773
+ </stock>
774
+ </quicksales>
775
+
776
+ <quicksales_default>
777
+ <pricing>
778
+ <bid_increment>0.05</bid_increment>
779
+ </pricing>
780
+ </quicksales_default>
781
+
782
+ </default>
783
+
784
+ </config>
785
+
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 22.09.11
6
+ * Time: 15:27
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ $installer = $this;
11
+
12
+ $installer->startSetup();
13
+ /*
14
+ $installer->run("
15
+ DROP TABLE IF EXISTS {$this->getTable('listing')};
16
+ CREATE TABLE
17
+ {$this->getTable('listing')} (
18
+ `listing_id` int(10) unsigned NOT NULL auto_increment,
19
+ `name` varchar(255) NOT NULL DEFAULT '',
20
+ `category` varchar(255) NOT NULL DEFAULT '',
21
+ `category_id` int(10) not null default 0,
22
+ `extra_info_step1` text default '',
23
+ `extra_info_step2` text default '',
24
+ `extra_info_step3` text default '',
25
+ `created_time` datetime DEFAULT NULL,
26
+ `update_time` datetime DEFAULT NULL,
27
+ `order_by` int(10) not null default 0,
28
+ PRIMARY KEY USING BTREE (`listing_id`)
29
+ );
30
+ ");
31
+ */
32
+ $installer->run("
33
+ DROP TABLE IF EXISTS {$this->getTable('listing_product')};
34
+ CREATE TABLE
35
+ {$this->getTable('listing_product')} (
36
+ `id` int(10) unsigned NOT NULL auto_increment,
37
+ `listing_id` int(10) unsigned NOT NULL,
38
+ `quicksale_listing_id` int(10) unsigned NOT NULL,
39
+ `product_id` int(10) unsigned NOT NULL,
40
+ KEY (`listing_id`),
41
+ KEY (`product_id`),
42
+ PRIMARY KEY USING BTREE (`id`)
43
+ );
44
+ ");
45
+
46
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.0.0-1.1.0.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* @var $this Ewave_Quicksales_Model_Entity_Setup */
4
+ $installer = $this;
5
+ $installer->startSetup();
6
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
7
+
8
+
9
+ $setup
10
+ ->createEntityTables(
11
+ $this->getTable('quicksales/listing')
12
+ )
13
+ ->removeEntityType('quicksales_listing')
14
+ ->addEntityType(
15
+ 'quicksales_listing',
16
+ array(
17
+ 'entity_model' => 'quicksales/listing',
18
+ 'attribute_model' => 'catalog/resource_eav_attribute',
19
+ 'table' => 'quicksales/listing',
20
+ 'increment_model' => '',
21
+ 'increment_per_store' => 0
22
+ )
23
+ )
24
+ ->installEntities()
25
+ ;
26
+ //update eav_entity_type set attribute_model='catalog/resource_eav_attribute' where entity_type_id = 33;
27
+
28
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.1.0-1.2.0.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 11:34
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ $installer = $this;
11
+ $installer->startSetup();
12
+
13
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
14
+
15
+ $setup->removeAttribute('quicksales_listing', 'hot_deals');
16
+
17
+ $setup->addAttribute('quicksales_listing', 'name', array(
18
+ 'group' => 'Step 1',
19
+ 'label' => 'Name',
20
+ 'required' => false,
21
+ 'position' => 1,
22
+ 'sort_order' => 40,
23
+ 'visible' => 1,
24
+ )
25
+ )
26
+ ;
27
+
28
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.0-1.2.1.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 11:34
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ $installer = $this;
11
+ $installer->startSetup();
12
+
13
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
14
+
15
+ $setup
16
+ ->removeAttribute('quicksales_listing', 'products', array(
17
+ 'group' => 'Step 1',
18
+ 'input' => 'multiselect',
19
+ 'label' => 'Products',
20
+ 'required' => true,
21
+ 'position' => 1,
22
+ 'sort_order' => 40,
23
+ 'visible' => 1,
24
+ )
25
+ )
26
+ ;
27
+
28
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.1-1.2.2.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 11:34
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ $installer = $this;
11
+ $installer->startSetup();
12
+
13
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
14
+
15
+ $setup
16
+ ->removeAttribute('quicksales_listing', 'name2')
17
+ ->removeAttribute('quicksales_listing', 'categories')
18
+
19
+ ->addAttribute('quicksales_listing', 'category', array(
20
+ 'group' => 'Step 2',
21
+ 'input' => 'select',
22
+ 'label' => 'Category',
23
+ 'source' => 'quicksales/source_getcategories',
24
+ 'required' => true,
25
+ 'position' => 1,
26
+ 'sort_order' => 40,
27
+ 'visible' => 1,
28
+ )
29
+ )
30
+ ;
31
+
32
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.10-1.2.11.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
7
+
8
+ $setup->removeAttribute('quicksales_listing', 'default_payment_conf');
9
+ $setup->removeAttribute('quicksales_listing', 'payment_information');
10
+
11
+ $setup->removeAttribute('quicksales_listing', 'payments');
12
+ $setup->removeAttribute('quicksales_listing', 'payments_instruction');
13
+
14
+ $setup->addAttribute('quicksales_listing', 'default_payment_conf', array(
15
+ 'group' => 'Step 2',
16
+ 'type' => 'int',
17
+ 'label' => 'Use default Payment information',
18
+ 'input' => 'select',
19
+ 'source' => 'eav/entity_attribute_source_boolean',
20
+ 'required' => false,
21
+ ));
22
+
23
+
24
+ // recurring payment profile
25
+ $setup->addAttribute('quicksales_listing', 'payment_information', array(
26
+ 'group' => 'Step 2',
27
+ 'type' => 'text',
28
+ 'backend' => 'quicksales/listing_attribute_backend_payment',
29
+ 'label' => 'Payment information',
30
+ 'input' => 'text', // doesn't matter
31
+ 'required' => false,
32
+ ));
33
+
34
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.11-1.2.12.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
7
+
8
+ $setup->removeAttribute('quicksales_listing', 'default_shipping_conf');
9
+ $setup->removeAttribute('quicksales_listing', 'shipping_information');
10
+
11
+ $setup->removeAttribute('quicksales_listing', 'shipping');
12
+
13
+
14
+ $setup->addAttribute('quicksales_listing', 'default_shipping_conf', array(
15
+ 'group' => 'Step 2',
16
+ 'type' => 'int',
17
+ 'label' => 'Use default shipping information',
18
+ 'input' => 'select',
19
+ 'source' => 'eav/entity_attribute_source_boolean',
20
+ 'required' => false,
21
+ ));
22
+
23
+
24
+ // recurring shipping profile
25
+ $setup->addAttribute('quicksales_listing', 'shipping_information', array(
26
+ 'group' => 'Step 2',
27
+ 'type' => 'text',
28
+ 'backend' => 'quicksales/listing_attribute_backend_shipping',
29
+ 'label' => 'shipping information',
30
+ 'input' => 'text', // doesn't matter
31
+ 'required' => false,
32
+ ));
33
+
34
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.12-1.2.13.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
7
+
8
+ $setup->updateAttribute('quicksales_listing', 'default_shipping_conf', 'default_value', 1);
9
+ $setup->updateAttribute('quicksales_listing', 'default_listing_conf', 'default_value', 1);
10
+ $setup->updateAttribute('quicksales_listing', 'default_listing_upgrade_conf', 'default_value', 1);
11
+ $setup->updateAttribute('quicksales_listing', 'default_payment_conf', 'default_value', 1);
12
+ $setup->updateAttribute('quicksales_listing', 'default_pricing_conf', 'default_value', 1);
13
+
14
+
15
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.13-1.2.14.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+ DROP TABLE IF EXISTS {$this->getTable('listing_attribute')};
8
+ CREATE TABLE
9
+ {$this->getTable('listing_attribute')} (
10
+ `attribute_map_id` int(10) unsigned NOT NULL auto_increment,
11
+ `listing_id` int(10) NOT NULL,
12
+ `qattribute_id` int(10) NOT NULL,
13
+ `mattribute_id` int(10) NOT NULL,
14
+ KEY (`listing_id`),
15
+ KEY (`qattribute_id`),
16
+ KEY (`mattribute_id`),
17
+ CONSTRAINT `FK_LISTING_ATTRIBUTE_ENTITY_LISTING_ID` FOREIGN KEY (`listing_id`) REFERENCES `listing` (`listing_id`) ON DELETE CASCADE ON UPDATE CASCADE,
18
+ PRIMARY KEY USING BTREE (`attribute_map_id`)
19
+ );
20
+ ");
21
+
22
+ $installer->run("
23
+ DROP TABLE IF EXISTS {$this->getTable('listing_attribute_value')};
24
+ CREATE TABLE
25
+ {$this->getTable('listing_attribute_value')} (
26
+ `attribute_value_map_id` int(10) unsigned NOT NULL auto_increment,
27
+ `attribute_map_id` int(10) unsigned NOT NULL,
28
+ `qattribute_value_id` int(10) unsigned NOT NULL,
29
+ `mattribute_value_id` int(10) unsigned NOT NULL,
30
+ KEY (`attribute_map_id`),
31
+ KEY (`qattribute_value_id`),
32
+ KEY (`mattribute_value_id`),
33
+ CONSTRAINT `FK_LISTING_ATTRIBUTE_VALUE_ENTITY_ATTRIBUTE_MAP_ID` FOREIGN KEY (`attribute_map_id`) REFERENCES `listing_attribute` (`attribute_map_id`) ON DELETE CASCADE ON UPDATE CASCADE,
34
+ PRIMARY KEY USING BTREE (`attribute_value_map_id`)
35
+ );
36
+ ");
37
+
38
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.14-1.2.15.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+ DROP TABLE IF EXISTS {$this->getTable('listing_log')};
8
+ CREATE TABLE
9
+ {$this->getTable('listing_log')} (
10
+ `id` int(10) unsigned NOT NULL auto_increment,
11
+ `listing_id` int(10) unsigned NOT NULL,
12
+ `message` TEXT,
13
+ `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
14
+ PRIMARY KEY USING BTREE (`id`)
15
+ );
16
+ ");
17
+
18
+ $installer->run("
19
+ DROP TABLE IF EXISTS {$this->getTable('listing_product_log')};
20
+ CREATE TABLE
21
+ {$this->getTable('listing_product_log')} (
22
+ `id` int(10) unsigned NOT NULL auto_increment,
23
+ `association_id` int(10) unsigned NOT NULL,
24
+ `message` TEXT,
25
+ `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
26
+ PRIMARY KEY USING BTREE (`id`)
27
+ );
28
+ ");
29
+
30
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.15-1.2.16.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+
7
+ $installer->run("
8
+
9
+ ALTER TABLE listing_product ADD UNIQUE (listing_id, product_id);
10
+ ALTER TABLE listing_attribute ADD UNIQUE (listing_id, qattribute_id, mattribute_id);
11
+ ALTER TABLE listing_attribute_value ADD UNIQUE (attribute_map_id, qattribute_value_id, mattribute_value_id);
12
+ ALTER TABLE listing_product_log ADD listing_log_id int(10) unsigned NOT NULL;
13
+ ");
14
+
15
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.17-1.2.18.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
7
+
8
+ $setup->removeAttribute('quicksales_listing', 'status');
9
+
10
+ $setup->addAttribute('quicksales_listing', 'status', array(
11
+ 'group' => 'Step 1',
12
+ 'type' => 'int',
13
+ 'label' => 'Active',
14
+ 'input' => 'select',
15
+ 'source' => 'eav/entity_attribute_source_boolean',
16
+ 'required' => false,
17
+ 'default' => 1
18
+ ));
19
+ /*
20
+ $installer->run("
21
+ ALTER TABLE listing_product ADD status int(10) not null default 1
22
+ ");
23
+ */
24
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.18-1.2.19.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+
7
+ $installer->run("
8
+ Alter Table listing_attribute_value drop key mattribute_value_id;
9
+ Alter Table listing_attribute_value drop key attribute_map_id_2;
10
+ ALTER TABLE listing_attribute_value change mattribute_value_id mattribute_value_id text not null;
11
+ ALTER TABLE listing_attribute_value ADD UNIQUE (attribute_map_id, qattribute_value_id, mattribute_value_id(10));
12
+ ALTER TABLE listing_attribute_value ADD KEY `mattribute_value_id` (mattribute_value_id(10));
13
+ ");
14
+
15
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.19-1.2.20.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+
7
+ $installer->run("
8
+ Alter Table listing_attribute_value drop key qattribute_value_id;
9
+ Alter Table listing_attribute_value drop key attribute_map_id_2;
10
+ ALTER TABLE listing_attribute_value change qattribute_value_id qattribute_value_id text not null;
11
+ ALTER TABLE listing_attribute_value ADD UNIQUE (attribute_map_id, qattribute_value_id(10), mattribute_value_id(10));
12
+ ALTER TABLE listing_attribute_value ADD KEY `qattribute_value_id` (qattribute_value_id(10));
13
+ ");
14
+
15
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.2-1.2.3.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 11:34
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ $installer = $this;
11
+ $installer->startSetup();
12
+
13
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
14
+
15
+ $setup
16
+ ->addAttribute('quicksales_listing', 'payments', array(
17
+ 'group' => 'Step 2',
18
+ 'input' => 'multiselect',
19
+ 'label' => 'Payments',
20
+ 'source' => 'quicksales/source_payments',
21
+ 'required' => true,
22
+ 'position' => 1,
23
+ 'sort_order' => 50,
24
+ 'visible' => 1,
25
+ )
26
+ )
27
+ ->addAttribute('quicksales_listing', 'payments_instruction', array(
28
+ 'group' => 'Step 2',
29
+ 'input' => 'textarea',
30
+ 'label' => 'Payments Instruction',
31
+ 'note' => '1,000 chars maximum',
32
+ 'class' => 'validate-length maximum-length-1000',
33
+ 'frontend_class' => 'validate-length maximum-length-1000',
34
+ 'required' => false,
35
+ 'position' => 1,
36
+ 'sort_order' => 60,
37
+ 'visible' => 1,
38
+ )
39
+ )
40
+ ->addAttribute('quicksales_listing', 'shipping', array(
41
+ 'group' => 'Step 2',
42
+ 'input' => 'select',
43
+ 'label' => 'Shipping',
44
+ 'required' => true,
45
+ 'position' => 1,
46
+ 'sort_order' => 70,
47
+ 'visible' => 1,
48
+ 'source' => 'quicksales/source_shipping',
49
+ )
50
+ )
51
+
52
+ ;
53
+
54
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.22-1.2.23.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
7
+
8
+
9
+ $setup->addAttribute('order', 'quicksales_order_id', array(
10
+ 'type' => 'int',
11
+ 'input' => 'hidden',
12
+ 'required' => false,
13
+ 'default' => 0
14
+ ));
15
+
16
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.23-1.2.24.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
7
+
8
+ $types = array(
9
+ 'datetime',
10
+ 'decimal',
11
+ 'int',
12
+ 'text',
13
+ 'varchar'
14
+ );
15
+ $baseTableName = 'listing';
16
+
17
+ foreach ($types as $type) {
18
+ $eavTableName = $baseTableName . '_' . $type;
19
+
20
+ $readConnection = $setup->getConnection();
21
+
22
+ $query = 'SELECT `table`.`entity_id`, `table`.`attribute_id`, COUNT(*) AS cnt
23
+ FROM `' . $setup->getTable($eavTableName) .'` AS `table`
24
+ GROUP BY `table`.`entity_id`, `table`.`attribute_id` HAVING cnt > 1;';
25
+
26
+ $results = $readConnection->fetchAll($query);
27
+
28
+ if (!empty($results)) {
29
+ foreach ($results as $data) {
30
+ $query = 'DELETE FROM
31
+ FROM `' . $setup->getTable($eavTableName) . '` AS `table`
32
+ WHERE `table`.`entity_id` = '.$data['entity_id'].' AND `table`.`attribute_id` = ' . $data['attribute_id'] . '
33
+ LIMIT '.($data['cnt'] - 1).';';
34
+
35
+ }
36
+ }
37
+ /**
38
+ * Add missed indexes (unique attribute value for each listing)
39
+ */
40
+
41
+ /*
42
+ $setup->getConnection()->addIndex(
43
+ $setup->getTable($eavTableName),
44
+ $setup->getIdxName(
45
+ $eavTableName,
46
+ array('entity_id', 'attribute_id'),
47
+ Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
48
+ ),
49
+ array('entity_id', 'attribute_id'),
50
+ Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
51
+ );
52
+ */
53
+ }
54
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.24-1.2.25.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $installer->run("
6
+ ALTER TABLE
7
+ {$this->getTable('listing_log')}
8
+ ADD `order_id` int(10) unsigned NOT NULL
9
+ ");
10
+ $installer->run("
11
+ ALTER TABLE
12
+ {$this->getTable('listing_log')}
13
+ ADD `result` int(1) unsigned NOT NULL default 1
14
+ ");
15
+
16
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.25-1.2.26.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $installer->run("
6
+ ALTER TABLE
7
+ {$this->getTable('listing_log')}
8
+ ADD `type` int(1) unsigned NOT NULL default 1
9
+ ")
10
+ /*
11
+ ->run("
12
+ UPDATE
13
+ {$this->getTable('listing_log')}
14
+ SET
15
+ result = 0
16
+ WHERE
17
+ message LIKE '%Errors: 1%'
18
+ OR
19
+ message LIKE '%Item not found%'
20
+ OR
21
+ message LIKE '%o payment methods detec%'
22
+ OR
23
+ message LIKE '%uto1Min cannot be selected for BuyNow Only item%'
24
+ ;
25
+ ")
26
+ */
27
+ ;
28
+
29
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.26-1.2.27.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
7
+
8
+
9
+ $setup->addAttribute('order', 'qhash', array(
10
+ 'type' => 'text',
11
+ 'input' => 'hidden',
12
+ 'required' => false,
13
+ ));
14
+
15
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.27-1.2.28.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
7
+
8
+ $setup->addAttribute('order', 'qsource', array(
9
+ 'type' => 'int',
10
+ 'required' => false,
11
+ 'type' => 'int',
12
+ 'grid' => true,
13
+ 'unsigned' => true,
14
+ 'required' => 1,
15
+ ));
16
+
17
+ $installer->run("
18
+ UPDATE
19
+ {$this->getTable('sales_flat_order')}
20
+ SET
21
+ qsource = '1'
22
+ WHERE
23
+ quicksales_order_id != 0
24
+ OR
25
+ qhash != '';
26
+
27
+
28
+ UPDATE
29
+ {$this->getTable('sales_flat_order_grid')}
30
+ SET
31
+ qsource = '1'
32
+ WHERE
33
+ entity_id IN (
34
+ SELECT entity_id FROM {$this->getTable('sales_flat_order')} WHERE
35
+ quicksales_order_id != 0
36
+ OR
37
+ qhash != ''
38
+ );
39
+ ");
40
+
41
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.28-1.2.29.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $status = Mage::getModel('sales/order_status')->load('qpaid');
7
+
8
+ $status->setData(
9
+ array(
10
+ 'status' => 'qpaid',
11
+ 'label' => 'QS Paid',
12
+ 'state' => 'qpaid',
13
+ 'state_label' => 'QS Paid',
14
+ )
15
+ );
16
+
17
+ $status->assignState('qpaid');
18
+
19
+ $status->save();
20
+
21
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.29-1.2.30.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
7
+
8
+
9
+ $setup->updateAttribute('order', 'quicksales_order_id', 'type', 'text');
10
+
11
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.3-1.2.4.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 11:34
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ $installer = $this;
11
+ $installer->startSetup();
12
+
13
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core _setup');
14
+
15
+ $setup
16
+ ->removeAttribute('quicksales_listing', 'fixedpostage')
17
+ ->removeAttribute('quicksales_listing', 'fixedpostagebylocation_nsw')
18
+ ->removeAttribute('quicksales_listing', 'fixedpostagebylocation_vic')
19
+ ->removeAttribute('quicksales_listing', 'fixedpostagebylocation_qld')
20
+ ->removeAttribute('quicksales_listing', 'fixedpostagebylocation_act')
21
+ ->removeAttribute('quicksales_listing', 'fixedpostagebylocation_nt')
22
+ ->removeAttribute('quicksales_listing', 'fixedpostagebylocation_tas')
23
+ ->removeAttribute('quicksales_listing', 'fixedpostagebylocation_sa')
24
+ ->removeAttribute('quicksales_listing', 'fixedpostagebylocation_wa')
25
+ ->removeAttribute('quicksales_listing', 'offerapregular')
26
+ ->removeAttribute('quicksales_listing', 'offerapexpress')
27
+ ->removeAttribute('quicksales_listing', 'providereturnrefundpolicy')
28
+ ->removeAttribute('quicksales_listing', 'posttolocation')
29
+ ->removeAttribute('quicksales_listing', 'postinst')
30
+ ->removeAttribute('quicksales_listing', 'description')
31
+
32
+ ->addAttribute('quicksales_listing', 'fixedpostage', array(
33
+ 'group' => 'Step 2',
34
+ 'input' => 'text',
35
+ 'label' => 'Fixed Postage',
36
+ 'position' => 1,
37
+ 'sort_order' => 80,
38
+ 'visible' => 1,
39
+ )
40
+ )
41
+ ->addAttribute('quicksales_listing', 'fixedpostagebylocation_nsw', array(
42
+ 'group' => 'Step 2',
43
+ 'input' => 'text',
44
+ 'label' => 'NSW',
45
+ 'position' => 1,
46
+ 'sort_order' => 90,
47
+ 'visible' => 1,
48
+ )
49
+ )
50
+ ->addAttribute('quicksales_listing', 'fixedpostagebylocation_vic', array(
51
+ 'group' => 'Step 2',
52
+ 'input' => 'text',
53
+ 'label' => 'VIC',
54
+ 'position' => 1,
55
+ 'sort_order' => 100,
56
+ 'visible' => 1,
57
+ )
58
+ )
59
+ ->addAttribute('quicksales_listing', 'fixedpostagebylocation_qld', array(
60
+ 'group' => 'Step 2',
61
+ 'input' => 'text',
62
+ 'label' => 'GLD',
63
+ 'position' => 1,
64
+ 'sort_order' => 110,
65
+ 'visible' => 1,
66
+ )
67
+ )
68
+ ->addAttribute('quicksales_listing', 'fixedpostagebylocation_act', array(
69
+ 'group' => 'Step 2',
70
+ 'input' => 'text',
71
+ 'label' => 'ACT',
72
+ 'position' => 1,
73
+ 'sort_order' => 120,
74
+ 'visible' => 1,
75
+ )
76
+ )
77
+ ->addAttribute('quicksales_listing', 'fixedpostagebylocation_nt', array(
78
+ 'group' => 'Step 2',
79
+ 'input' => 'text',
80
+ 'label' => 'NT',
81
+ 'position' => 1,
82
+ 'sort_order' => 130,
83
+ 'visible' => 1,
84
+ )
85
+ )
86
+ ->addAttribute('quicksales_listing', 'fixedpostagebylocation_tas', array(
87
+ 'group' => 'Step 2',
88
+ 'input' => 'text',
89
+ 'label' => 'TAS',
90
+ 'position' => 1,
91
+ 'sort_order' => 140,
92
+ 'visible' => 1,
93
+ )
94
+ )
95
+ ->addAttribute('quicksales_listing', 'fixedpostagebylocation_sa', array(
96
+ 'group' => 'Step 2',
97
+ 'input' => 'text',
98
+ 'label' => 'SA',
99
+ 'position' => 1,
100
+ 'sort_order' => 150,
101
+ 'visible' => 1,
102
+ )
103
+ )
104
+ ->addAttribute('quicksales_listing', 'fixedpostagebylocation_wa', array(
105
+ 'group' => 'Step 2',
106
+ 'input' => 'text',
107
+ 'label' => 'WA',
108
+ 'position' => 1,
109
+ 'sort_order' => 160,
110
+ 'visible' => 1,
111
+ )
112
+ )
113
+ ->addAttribute('quicksales_listing', 'offerapregular', array(
114
+ 'group' => 'Step 2',
115
+ 'input' => 'text',
116
+ 'label' => 'OfferAPRegular',
117
+ 'position' => 1,
118
+ 'sort_order' => 170,
119
+ 'visible' => 1,
120
+ 'source' => 'eav/entity_attribute_source_boolean',
121
+ )
122
+ )
123
+ ->addAttribute('quicksales_listing', 'offerapexpress', array(
124
+ 'group' => 'Step 2',
125
+ 'input' => 'text',
126
+ 'label' => 'OfferAPExpress',
127
+ 'position' => 1,
128
+ 'sort_order' => 180,
129
+ 'visible' => 1,
130
+ 'source' => 'eav/entity_attribute_source_boolean',
131
+ )
132
+ )
133
+ ->addAttribute('quicksales_listing', 'providereturnrefundpolicy', array(
134
+ 'group' => 'Step 2',
135
+ 'input' => 'text',
136
+ 'label' => 'ProvideReturnRefundPolicy',
137
+ 'position' => 1,
138
+ 'sort_order' => 190,
139
+ 'visible' => 1,
140
+ 'source' => 'eav/entity_attribute_source_boolean',
141
+ )
142
+ )
143
+ ->addAttribute('quicksales_listing', 'posttolocation', array(
144
+ 'group' => 'Step 2',
145
+ 'input' => 'multiselect',
146
+ 'label' => 'PostToLocation',
147
+ 'source' => 'quicksales/source_posttolocation',
148
+ 'position' => 1,
149
+ 'sort_order' => 200,
150
+ 'visible' => 1,
151
+ )
152
+ )
153
+ ->addAttribute('quicksales_listing', 'postinst', array(
154
+ 'group' => 'Step 2',
155
+ 'input' => 'textarea',
156
+ 'label' => 'Postage instructions',
157
+ 'note' => '1,000 chars maximum',
158
+ 'class' => 'validate-length maximum-length-1000',
159
+ 'frontend_class' => 'validate-length maximum-length-1000',
160
+ 'required' => false,
161
+ 'position' => 1,
162
+ 'sort_order' => 210,
163
+ 'visible' => 1,
164
+ )
165
+ )
166
+ ->addAttribute('quicksales_listing', 'description', array(
167
+ 'group' => 'Step 2',
168
+ 'input' => 'textarea',
169
+ 'label' => 'Listing description',
170
+ 'note' => '600,000 chars maximum',
171
+ 'class' => 'validate-length maximum-length-600000',
172
+ 'frontend_class' => 'validate-length maximum-length-600000',
173
+ 'required' => false,
174
+ 'position' => 1,
175
+ 'sort_order' => 220,
176
+ 'visible' => 1,
177
+ )
178
+ )
179
+
180
+ ;
181
+
182
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.30-1.2.31.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
7
+
8
+
9
+ $setup->addAttribute('order_item', 'qitem_id', array(
10
+ 'type' => 'varchar',
11
+ 'required' => false,
12
+ ));
13
+
14
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.31-1.2.32.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
7
+
8
+
9
+ $setup->addAttribute('invoice_item', 'qitem_id', array(
10
+ 'type' => 'varchar',
11
+ 'required' => false,
12
+ ));
13
+
14
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.32-1.2.33.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
7
+
8
+
9
+ $setup->addAttribute('invoice', 'qinvoice_id', array(
10
+ 'type' => 'varchar',
11
+ 'required' => false,
12
+ ));
13
+
14
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.33-1.3.1.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $status = Mage::getModel('sales/order_status')->load('qnot_checked_out');
7
+
8
+ $status->setData(
9
+ array(
10
+ 'status' => 'qnot_checked_out',
11
+ 'label' => 'Not Checked Out',
12
+ 'state' => 'qnot_checked_out',
13
+ 'state_label' => 'Not Checked Out',
14
+ )
15
+ );
16
+
17
+ $status->assignState('qnot_checked_out');
18
+
19
+ $status->save();
20
+
21
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.4-1.2.5.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: User
5
+ * Date: 23.09.11
6
+ * Time: 11:34
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ $installer = $this;
11
+ $installer->startSetup();
12
+
13
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core _setup');
14
+
15
+ $setup
16
+ ->addAttribute('quicksales_listing', 'associate_attributes_label', array(
17
+ 'group' => 'Step 3',
18
+ 'input' => 'multiline',
19
+ 'label' => 'Associate attributes',
20
+ 'count' => 1,
21
+ 'multiline_count' => 1,
22
+ 'required' => false,
23
+ 'position' => 1,
24
+ 'sort_order' => 80,
25
+ 'visible' => 1,
26
+ )
27
+ )
28
+ ;
29
+
30
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.5-1.2.6.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
7
+
8
+ $setup->updateEntityType('quicksales_listing', 'additional_attribute_table', '');
9
+
10
+ $setup->updateAttribute('quicksales_listing',
11
+ 'category',
12
+ array(
13
+ 'frontend_input_renderer' => '',
14
+ )
15
+ );
16
+
17
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.6-1.2.7.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
7
+
8
+ $setup->updateAttribute('quicksales_listing',
9
+ 'payments',
10
+ 'backend_model',
11
+ 'quicksales/attribute_backend_multiselect'
12
+ );
13
+
14
+ $setup->updateAttribute('quicksales_listing',
15
+ 'posttolocation',
16
+ 'backend_model',
17
+ 'quicksales/attribute_backend_multiselect'
18
+ );
19
+
20
+ $setup
21
+ ->addAttribute('quicksales_listing', 'vshop_category', array(
22
+ 'group' => 'Step 2',
23
+ 'input' => 'select',
24
+ 'label' => 'Vshop Category',
25
+ 'source' => 'quicksales/source_vshopcategory',
26
+ 'required' => false,
27
+ 'position' => 1,
28
+ 'sort_order' => 45,
29
+ 'visible' => 1,
30
+ )
31
+ );
32
+
33
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.7-1.2.8.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
7
+ /*
8
+ $setup->updateAttribute('quicksales_listing',
9
+ 'payments',
10
+ 'backend_model',
11
+ 'quicksales/attribute_backend_multiselect'
12
+ );
13
+ */
14
+ $setup->removeAttribute('quicksales_listing', 'default_pricing_conf');
15
+ $setup->removeAttribute('quicksales_listing', 'pricing_information');
16
+
17
+ $setup->addAttribute('quicksales_listing', 'default_pricing_conf', array(
18
+ 'group' => 'Step 2',
19
+ 'type' => 'int',
20
+ 'label' => 'Use default Pricing Configuration',
21
+ 'input' => 'select',
22
+ 'source' => 'eav/entity_attribute_source_boolean',
23
+ 'required' => false,
24
+ ));
25
+
26
+ // recurring payment profile
27
+ $setup->addAttribute('quicksales_listing', 'pricing_information', array(
28
+ 'group' => 'Step 2',
29
+ 'type' => 'text',
30
+ 'backend' => 'quicksales/listing_attribute_backend_pricing',
31
+ 'label' => 'Pricing information',
32
+ 'input' => 'text', // doesn't matter
33
+ 'required' => false,
34
+ ));
35
+
36
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.8-1.2.9.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
7
+
8
+ $setup->removeAttribute('quicksales_listing', 'default_listing_conf');
9
+ $setup->removeAttribute('quicksales_listing', 'listing_information');
10
+
11
+ $setup->removeAttribute('quicksales_listing', 'default_pricing_configuration');
12
+ $setup->removeAttribute('quicksales_listing', 'default_listing_configuration');
13
+
14
+ $setup->addAttribute('quicksales_listing', 'default_listing_conf', array(
15
+ 'group' => 'Step 2',
16
+ 'type' => 'int',
17
+ 'label' => 'Use default Listing Configuration',
18
+ 'input' => 'select',
19
+ 'source' => 'eav/entity_attribute_source_boolean',
20
+ 'required' => false,
21
+ ));
22
+
23
+ $setup->removeAttribute('quicksales_listing', 'description');
24
+ // recurring payment profile
25
+ $setup->addAttribute('quicksales_listing', 'listing_information', array(
26
+ 'group' => 'Step 2',
27
+ 'type' => 'text',
28
+ 'backend' => 'quicksales/listing_attribute_backend_listing',
29
+ 'label' => 'Listing information',
30
+ 'input' => 'text', // doesn't matter
31
+ 'required' => false,
32
+ ));
33
+
34
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.2.9-1.2.10.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Ewave_Quicksales_Model_Entity_Setup('core_setup');
7
+
8
+ $setup->removeAttribute('quicksales_listing', 'default_listing_upgrade_conf');
9
+ $setup->removeAttribute('quicksales_listing', 'listing_upgrade_information');
10
+
11
+ $setup->addAttribute('quicksales_listing', 'default_listing_upgrade_conf', array(
12
+ 'group' => 'Step 2',
13
+ 'type' => 'int',
14
+ 'label' => 'Use default Listing Upgrades',
15
+ 'input' => 'select',
16
+ 'source' => 'eav/entity_attribute_source_boolean',
17
+ 'required' => false,
18
+ ));
19
+
20
+ $setup->removeAttribute('quicksales_listing', 'description');
21
+ // recurring payment profile
22
+ $setup->addAttribute('quicksales_listing', 'listing_upgrade_information', array(
23
+ 'group' => 'Step 2',
24
+ 'type' => 'text',
25
+ 'backend' => 'quicksales/listing_attribute_backend_listingupgrade',
26
+ 'label' => 'Listing Upgrades & Additional Features',
27
+ 'input' => 'text', // doesn't matter
28
+ 'required' => false,
29
+ ));
30
+
31
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/sql/quicksales_setup/mysql4-upgrade-1.3.1-1.3.2.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
7
+
8
+
9
+ $setup->addAttribute('order', 'qpayment_info', array(
10
+ 'type' => 'text',
11
+ 'input' => 'hidden',
12
+ 'required' => false,
13
+ ));
14
+
15
+ $installer->endSetup();
app/code/community/Ewave/Quicksales/xml/CreateItem_Request.xml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <CreateItemRequest>
3
+ <Item>
4
+ <SellerID>ewavedesigns</SellerID>
5
+ <SellerPwd>welcome</SellerPwd>
6
+ <Title>Red Evening Dress Size 12</Title>
7
+ <Category>2780</Category>
8
+ <Duration>3</Duration>
9
+ <BuyNowPrice>50.00</BuyNowPrice>
10
+ <Quantity>1</Quantity>
11
+ <BrandNew>1</BrandNew>
12
+
13
+ <AutoRelistFeatures>
14
+ <AutoRelistType>2</AutoRelistType>
15
+ </AutoRelistFeatures>
16
+
17
+ <PaymentMethods>
18
+ <BankDeposit>1</BankDeposit>
19
+ <MoneyOrder>1</MoneyOrder>
20
+ <ProvideBankDetailsToBuyer>1</ProvideBankDetailsToBuyer>
21
+ </PaymentMethods>
22
+
23
+ <PaymentInst>If paying by bank deposit, please enter the ItemID as the reference.</PaymentInst>
24
+
25
+ <Postage>
26
+ <Type>2</Type>
27
+ <FixedPostage>3.50</FixedPostage>
28
+ </Postage>
29
+ <ProvideReturnRefundPolicy>1</ProvideReturnRefundPolicy>
30
+
31
+ <PostToLocation>
32
+ <National>1</National>
33
+ <Statewide>1</Statewide>
34
+ <LocalPickup>1</LocalPickup>
35
+ </PostToLocation>
36
+
37
+ <PostInst>I'll send the item within 3 days of receiving payment</PostInst>
38
+
39
+ <Description>This is a sleevless red evening dress that has never been worn. Size 12. Original cost was $299</Description>
40
+
41
+
42
+ </Item>
43
+ </CreateItemRequest>
app/code/community/Ewave/Quicksales/xml/GetCategoriesWithTags_Request.xml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <GetCategoriesWithTagsRequest></GetCategoriesWithTagsRequest>
app/code/community/Ewave/Quicksales/xml/GetCategories_Request.xml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <GetCategoriesRequest></GetCategoriesRequest>
app/code/community/Ewave/Quicksales/xml/GetCategoryChanges_Request.xml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <GetCategoryChangesRequest></GetCategoryChangesRequest>
app/code/community/Ewave/Quicksales/xml/GetCategoryVersion_Request.xml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <GetCategoryVersion></GetCategoryVersion>
app/code/community/Ewave/Quicksales/xml/GetFeeList_Request.xml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <GetFeeListRequest></GetFeeListRequest>
app/code/community/Ewave/Quicksales/xml/GetItemIDByRefID_Request.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <GetItemIDByRefIDRequest>
3
+ <ReferenceID>integer</ReferenceID>
4
+ </GetItemIDByRefIDRequest>
app/code/community/Ewave/Quicksales/xml/GetItem_Request.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <GetItemRequest>
3
+ <ListingID>integer</ListingID>
4
+ <UserID>string</UserID>
5
+ <UserPwd>string</UserPwd>
6
+ <Status>string</Status>
7
+ <ReturnField>string</ReturnField>
8
+ <!--more ReturnField nodes-->
9
+ </GetItemRequest>
app/code/community/Ewave/Quicksales/xml/GetListingAndItemIDs_Request.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <GetListingAndItemIDsRequest>
3
+ <SellerID>string</SellerID>
4
+ <SellerPwd>string</SellerPwd>
5
+ <ListingID>integer</ListingID>
6
+ <Status>integer</Status>
7
+ </GetListingAndItemIDsRequest>
app/code/community/Ewave/Quicksales/xml/GetOrders_Request.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <GetOrdersRequest>
3
+ <UserID>string</UserID>
4
+ <UserPwd>string</UserPwd>
5
+ <NumberOfDays>integer</NumberOfDays>
6
+ <RequestingRole>string</RequestingRole>
7
+ <InvoiceID>integer</InvoiceID>
8
+ </GetOrdersRequest>
app/code/community/Ewave/Quicksales/xml/GetTagsVersion_Request.xml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <GetTagsVersionRequest></GetTagsVersionRequest>
app/code/community/Ewave/Quicksales/xml/GetTags_Request.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <GetTagsRequest>
3
+ <CategoryNum>integer</CategoryNum>
4
+ </GetTagsRequest>
app/code/community/Ewave/Quicksales/xml/GetvShopCategories_Request.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <GetVshopCategoryRequest>
3
+ <SellerID></SellerID>
4
+ </GetVshopCategoryRequest>
app/code/community/Ewave/Quicksales/xml/LeaveRating_Request.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <LeaveRatingRequest>
3
+ <UserID>string</UserID>
4
+ <UserPwd>string</UserPwd>
5
+ <ItemID>integer</ItemID>
6
+ <CommentText>string</CommentText>
7
+ <CommentType>integer</CommentType>
8
+ <TargetUser>string</TargetUser>
9
+ <NotifyTargetUser>integer</NotifyTargetUser>
10
+ <OverwriteExistingCommentText>integer</OverwriteExistingCommentText>
11
+ </LeaveRatingRequest>
app/code/community/Ewave/Quicksales/xml/ReviseItem_Request.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ReviseItemRequest>
2
+ <Item>
3
+ <ListingID>1605</ListingID>
4
+ <Title>test4</Title>
5
+ <Category>556</Category>
6
+ <PromotionalFeatures>
7
+ <Frontpage>1</Frontpage>
8
+ <CategorySpecial>1</CategorySpecial>
9
+ <HighlightListing>0</HighlightListing>
10
+ <BoldTitle>0</BoldTitle>
11
+ </PromotionalFeatures>
12
+ <AutoRelistFeatures>
13
+ <AutoRelistType>0</AutoRelistType>
14
+ </AutoRelistFeatures>
15
+ <PaymentMethods>
16
+ <BankCheque>1</BankCheque>
17
+ <BankDeposit>1</BankDeposit>
18
+ <Cash>1</Cash>
19
+ </PaymentMethods>
20
+ <ProvideReturnRefundPolicy>0</ProvideReturnRefundPolicy>
21
+ <PaymentInst/>
22
+ <Postage>
23
+ <Type>1</Type>
24
+ <PostInst/>
25
+ </Postage>
26
+ <PostToLocation>
27
+ <Worldwide>1</Worldwide>
28
+ <National>1</National>
29
+ </PostToLocation>
30
+ <StartTime>14/11/2011</StartTime>
31
+ </Item>
32
+ </ReviseItemRequest>
app/code/community/Ewave/Quicksales/xml/SendInvoice_Request.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <SendInvoiceRequest>
3
+ <SellerID>string</SellerID>
4
+ <SellerPwd>string</SellerPwd>
5
+ <BuyerID>string</BuyerID>
6
+ <InvoiceID>integer</InvoiceID>
7
+ <CheckoutID>integer</CheckoutID>
8
+ <ItemArray>
9
+ <Item>
10
+ <ItemID>integer</ItemID>
11
+ <Quantity>integer</Quantity>
12
+ </Item>
13
+ </ItemArray>
14
+ <Postage>decimal</Postage>
15
+ <Insurance>decimal</Insurance>
16
+ <SellerDiscountORCharges>decimal</SellerDiscountORCharges>
17
+ <GSTType>integer</GSTType>
18
+ <PaymentMethods>
19
+ <BankCheque>integer</BankCheque>
20
+ <BankDeposit>integer</BankDeposit>
21
+ <Cash>integer</Cash>
22
+ <COD>integer</COD>
23
+ <CreditCard>integer</CreditCard>
24
+ <Escrow>integer</Escrow>
25
+ <MoneyOrder>integer</MoneyOrder>
26
+ <Paymate>integer</Paymate>
27
+ <PayPal>integer</PayPal>
28
+ <PersonalCheque>integer</PersonalCheque>
29
+ <Other>integer</Other>
30
+ </PaymentMethods>
31
+ <PayPalEmailAddress>string</PayPalEmailAddress>
32
+ <PaymentInstructions>string</PaymentInstructions>
33
+ <PostageInstructions>string</PostageInstructions>
34
+ <MessageToBuyer>string</MessageToBuyer>
35
+ <SendCopyToSeller>integer</SendCopyToSeller>
36
+ <ResendInvoice>integer</ResendInvoice>
37
+ </SendInvoiceRequest>
app/code/community/Ewave/Quicksales/xml/UpdateMakeAnOffer_Request.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <UpdateMakeAnOfferRequest>
3
+ <SellerID>string</SellerID>
4
+ <SellerPwd>string</SellerPwd>
5
+ <MakeAnOfferID>integer</MakeAnOfferID>
6
+ <Action>integer</Action>
7
+ <ProposedOfferPrice>decimal</ProposedOfferPrice>
8
+ </UpdateMakeAnOfferRequest>
app/code/community/Ewave/Quicksales/xml/UpdateOrder_Request.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <UpdateOrderRequest>
3
+ <UserID>string</UserID>
4
+ <UserPwd>string</UserPwd>
5
+ <InvoiceID>integer</InvoiceID>
6
+ <Action>integer</Action>
7
+ <NotifyBuyer>integer</NotifyBuyer>
8
+ </UpdateOrderRequest>
app/design/adminhtml/default/default/layout/quicksales.xml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout>
4
+
5
+ <quicksales_adminhtml_log_index>
6
+ <reference name="content">
7
+ <block type="quicksales/adminhtml_log" name="log" />
8
+ </reference>
9
+ </quicksales_adminhtml_log_index>
10
+
11
+ <quicksales_adminhtml_listing_index>
12
+ <reference name="content">
13
+ <block type="quicksales/adminhtml_listing" name="listing" />
14
+ </reference>
15
+ </quicksales_adminhtml_listing_index>
16
+
17
+ <quicksales_adminhtml_listing_new>
18
+
19
+ <reference name="head">
20
+ <action method="addJs"><script>quicksales/adminhtml/categories.js</script></action>
21
+ <action method="addJs"><script>quicksales/adminhtml/listing.js</script></action>
22
+ <action method="addCss"><name>quicksales/css/quicksales.css</name></action>
23
+ </reference>
24
+
25
+ <reference name='content'>
26
+ <block type="quicksales/adminhtml_listing_edit" name="listing_edit" />
27
+ </reference>
28
+
29
+ <reference name="left">
30
+ <block type="quicksales/adminhtml_listing_edit_tabs" name="product_tabs"></block>
31
+ </reference>
32
+
33
+ </quicksales_adminhtml_listing_new>
34
+
35
+
36
+ <quicksales_adminhtml_listing_edit>
37
+
38
+ <reference name="head">
39
+ <action method="addJs"><script>quicksales/adminhtml/categories.js</script></action>
40
+ <action method="addJs"><script>quicksales/adminhtml/listing.js</script></action>
41
+ <action method="addCss"><name>quicksales/css/quicksales.css</name></action>
42
+ </reference>
43
+
44
+ <reference name='content'>
45
+ <block type="quicksales/adminhtml_listing_edit" name="listing_edit" />
46
+ </reference>
47
+
48
+ <reference name="left">
49
+ <block type="quicksales/adminhtml_listing_edit_tabs" name="product_tabs"></block>
50
+ </reference>
51
+
52
+ </quicksales_adminhtml_listing_edit>
53
+
54
+ <quicksales_adminhtml_listing_log>
55
+ <reference name="content">
56
+ <block type="quicksales/adminhtml_listing_log" name="listing_log" />
57
+ </reference>
58
+ </quicksales_adminhtml_listing_log>
59
+
60
+ <quicksales_adminhtml_listing_productlog>
61
+ <reference name="content">
62
+ <block type="quicksales/adminhtml_listing_product_log" name="listing_product_log" />
63
+ </reference>
64
+ </quicksales_adminhtml_listing_productlog>
65
+
66
+ <quicksales_adminhtml_listing_products>
67
+ <block type="quicksales/adminhtml_listing_edit_tab_additional_step1_grid"
68
+ name="quicksales.admin.listing.edit.tab.additional.step1.grid" output="toHtml"/>
69
+ </quicksales_adminhtml_listing_products>
70
+
71
+ <quicksales_adminhtml_listing_attributes>
72
+
73
+ <block type="quicksales/adminhtml_listing_edit_tab_additional_step3_attributes"
74
+ name="quicksales.admin.listing.edit.tab.additional.step3" output="toHtml"/>
75
+
76
+ </quicksales_adminhtml_listing_attributes>
77
+
78
+ <adminhtml_sales_order_view>
79
+ <reference name='sales_order_tabs'>
80
+ <action method="addTab">
81
+ <name>quicksales</name>
82
+ <block>quicksales/adminhtml_sales_order_view_tab_quicksales</block>
83
+ <template>quicksales/sales/order/view/tab/quicksales.phtml</template>
84
+ </action>
85
+ </reference>
86
+ </adminhtml_sales_order_view>
87
+
88
+
89
+
90
+ </layout>
app/design/adminhtml/default/default/template/quicksales/listing/edit.phtml ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Template for Mage_Adminhtml_Block_Catalog_Product_Edit
30
+ */
31
+ ?>
32
+
33
+ <div class="content-header">
34
+ <h3 class="icon-head head-products"><?php echo $this->getHeader() ?></h3>
35
+ <p class="content-buttons form-buttons"><?php echo $this->getBackButtonHtml() ?>
36
+ <?php echo $this->getCancelButtonHtml() ?>
37
+ <?php if($this->getListingId()): ?>
38
+ <?php echo $this->getDeleteButtonHtml() ?>
39
+ <?php endif; ?>
40
+
41
+ <?php echo $this->getSaveButtonHtml() ?>
42
+ <?php echo $this->getSaveAndEditButtonHtml() ?>
43
+
44
+ <?php echo $this->getDeleteButtonHtml() ?>
45
+
46
+ <br />
47
+ <br />
48
+ <?php echo $this->getPreviousButtonHtml() ?>
49
+ <?php echo $this->getNextButtonHtml() ?>
50
+
51
+ </p>
52
+ </div>
53
+ <form action="<?php echo $this->getSaveUrl() ?>" method="post" id="listing_edit_form" enctype="multipart/form-data">
54
+ <?php echo $this->getBlockHtml('formkey')?>
55
+ <div style="display:none"></div>
56
+ </form>
57
+
58
+ <script type="text/javascript">
59
+ //<![CDATA[
60
+
61
+ function nextTab() {
62
+ var last = false;
63
+ var counter = 0;
64
+ size = 0;
65
+ element = null;
66
+ $$('#listing_info_tabs li a.tab-item-link').each(function(el, index) {
67
+
68
+ if ($(el).hasClassName('active')) {
69
+ last = true;
70
+ } else if (last == true) {
71
+ listing_info_tabsJsTabs.showTabContent(el);
72
+ last = false;
73
+ counter = index;
74
+ element = el;
75
+ }
76
+ size = index;
77
+ })
78
+
79
+ showHideButtons(element.id)
80
+
81
+ }
82
+
83
+ function previousTab() {
84
+ var prev = null;
85
+ $$('#listing_info_tabs li a.tab-item-link').each(function(el, index) {
86
+
87
+ if ($(el).hasClassName('active')) {
88
+ if (prev != null) {
89
+ listing_info_tabsJsTabs.showTabContent(prev);
90
+ showHideButtons(prev.id)
91
+ }
92
+ } else {
93
+ prev = $(el);
94
+ }
95
+ })
96
+ }
97
+
98
+ function showHideButtons(id) {
99
+ var position = 0;
100
+ size = 0;
101
+
102
+ $$('#listing_info_tabs li a.tab-item-link').each(function (el, index) {
103
+
104
+ size = index;
105
+
106
+ if ($(el).id == id) {
107
+ if (index == 0) {
108
+ $('previousTab').hide();
109
+ $('nextTab').show();
110
+ } else {
111
+ $('previousTab').show();
112
+ $('nextTab').show();
113
+ }
114
+ position = index;
115
+ }
116
+ })
117
+
118
+ if (position == size) {
119
+ $('nextTab').hide();
120
+ }
121
+ }
122
+
123
+
124
+ var listingTemplateSyntax = /(^|.|\r|\n)({{(\w+)}})/;
125
+ var listingForm = new varienForm('listing_edit_form', '<?php echo $this->getValidationUrl() ?>');
126
+ listingForm._processValidationResult = function(transport) {
127
+ var response = transport.responseText.evalJSON();
128
+ if (response.error){
129
+ if (response.attribute && $(response.attribute)) {
130
+ $(response.attribute).setHasError(true, listingForm);
131
+ Validation.ajaxError($(response.attribute), response.message);
132
+ if (!Prototype.Browser.IE){
133
+ $(response.attribute).focus();
134
+ }
135
+ }
136
+ else if ($('messages')) {
137
+ $('messages').innerHTML = '<ul class="messages"><li class="error-msg"><ul><li>' + response.message + '</li></ul></li></ul>';
138
+ }
139
+ }
140
+ else{
141
+ listingForm._submit();
142
+ }
143
+ };
144
+ function saveAndContinueEdit(urlTemplate) {
145
+ var template = new Template(urlTemplate, listingTemplateSyntax);
146
+ var url = template.evaluate({tab_id:listing_info_tabsJsTabs.activeTab.id});
147
+ listingForm.submit(url);
148
+ }
149
+ function setSettings(urlTemplate, setElement, typeElement) {
150
+ var template = new Template(urlTemplate, listingTemplateSyntax);
151
+ setLocation(template.evaluate({attribute_set:$F(setElement),type:$F(typeElement)}));
152
+ }
153
+
154
+ function setSuperSettings(urlTemplate, attributesClass, validateField) {
155
+ var attributesFields = $$('.' + attributesClass);
156
+ var attributes = Form.serializeElements(attributesFields, true).attribute;
157
+ if(typeof attributes == 'string') {
158
+ attributes = [attributes];
159
+ }
160
+
161
+ if(!attributes) {
162
+ $(validateField).value = 'no-attributes';
163
+ } else {
164
+ $(validateField).value = 'has-attributes';
165
+ }
166
+
167
+ if (listingForm.validator.validate()) {
168
+ var template = new Template(urlTemplate, listingTemplateSyntax);
169
+ var url = template.evaluate({
170
+ attributes: encode_base64(attributes.join(',')).replace(new RegExp('/','g'),'%2F').replace(new RegExp('=','g'),'%3D')
171
+ });
172
+ setLocation(url);
173
+ }
174
+ }
175
+
176
+ function checkMaxLength(Object, MaxLen)
177
+ {
178
+ if (Object.value.length > MaxLen-1) {
179
+ Object.value = Object.value.substr(0, MaxLen);
180
+ }
181
+ return 1;
182
+ }
183
+
184
+ Event.observe(window, 'load', function() {
185
+ var objName = '<?php echo $this->getSelectedTabId() ?>';
186
+ if (objName) {
187
+ obj = $(objName);
188
+ //IE fix (bubbling event model)
189
+ listing_info_tabsJsTabs.setSkipDisplayFirstTab();
190
+ listing_info_tabsJsTabs.showTabContent(obj);
191
+ }
192
+ // Product.AttributesBridge.setTabsObject(listing_info_tabsJsTabs);
193
+ });
194
+
195
+ </script>
196
+
app/design/adminhtml/default/default/template/quicksales/listing/edit/tab/additional/step1.phtml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class='entry-edit'>
2
+ <div class='fieldset fieldset-wide'>
3
+ <table class='form-list'>
4
+ <tr>
5
+ <td class='label'>
6
+ <label for='assigned_products_grid'><?php echo $this->__('Assigned products');?></label>
7
+ </td>
8
+ <td class='value'>
9
+ <table>
10
+ <tbody>
11
+ <?php if ($this->getAssignedProducts()): ?>
12
+ <?php foreach ($this->getAssignedProducts() as $product): ?>
13
+ <tr <?php if ($product->getQlistingId()): ?> class='saved'<?php endif;?>>
14
+ <td>
15
+
16
+
17
+ <b>
18
+ <input id="assigned_products_<?php echo $product->getId(); ?>" type="hidden"
19
+ name="listing[assigned_products][]"
20
+ value="<?php echo $product->getId(); ?>"/>
21
+ <?php echo $product->getQlistingId(); ?>
22
+ </b>
23
+ </td>
24
+ <td>&nbsp;</td>
25
+ <td>
26
+ <?php echo $product->getName();?>
27
+ </td>
28
+ <td>&nbsp;</td>
29
+ <td>
30
+ <?php
31
+ $api = Mage::getModel('quicksales/api');
32
+ if ($api->isSand()) {
33
+ $url = "http://sandbox.quicksales.com.au/buy/auction.aspx?lid=";
34
+ } else {
35
+ $url = "http://developer.quicksales.com.au/buy/auction.aspx?lid=";
36
+ }
37
+ ?>
38
+ <a href='<?php echo $url . $product->getQlistingId(); ?>'>
39
+ quicksales page
40
+ </a>
41
+ </td>
42
+ </tr>
43
+ <?php endforeach ?>
44
+ <?php endif ?>
45
+ </tbody>
46
+ </table>
47
+
48
+ <table id='assigned_products_grid'>
49
+ <tbody></tbody>
50
+ </table>
51
+
52
+ </td>
53
+ <td class='scope-label'>
54
+ </td>
55
+ </tr>
56
+ </table>
57
+ </div>
58
+ </div>
59
+
60
+ <?php echo $this->getChildHtml('quicksales_product_grid');?>
61
+
62
+ <script type='text/javascript'>
63
+
64
+ var listingProducts = new listingProducts(<?php echo $this->getGridJsObject() ?>, <?php echo $this->getAssignedProductsJson(); ?>, 'assigned_products_grid');
65
+
66
+ </script>
app/design/adminhtml/default/default/template/quicksales/listing/edit/tab/additional/step2.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <script type='text/javascript'>
2
+
3
+ CategoryActionsObj = new CategoryActions('category_selector', '<?php echo $this->getUrl("quicksales/adminhtml_listing/subcategories")?>');
4
+
5
+ </script>
app/design/adminhtml/default/default/template/quicksales/listing/edit/tab/additional/step3.phtml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <div id='assign_attributes' class='grid'>
2
+ <?php echo $this->getChildHtml('attributes_association'); ?>
3
+ </div>
4
+
5
+ <script type='text/javascript'>
6
+ var listingSettingsObj = new listingSettings('<?php echo $this->getUrl("quicksales/adminhtml_listing/attributes")?>', '<?php echo $this->getUrl("quicksales/adminhtml_listing/attributeValues", array('id' => $this->getRequest()->getParam('id')))?>');
7
+ </script>
app/design/adminhtml/default/default/template/quicksales/listing/edit/tab/additional/step3/attributes.phtml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getQAttributes()) : ?>
2
+ <?php $listing = Mage::registry('current_listing'); ?>
3
+ <?php $associatedAttributes = $listing->getAttributesAssociation(); ?>
4
+ <table id='assign_attributes_table' class='data'>
5
+
6
+ <thead>
7
+ <tr class='headings'>
8
+ <th><?php echo $this->__('Quicksales');?></th>
9
+ <th><?php echo $this->__('Magento');?></th>
10
+ </tr>
11
+ </thead>
12
+
13
+ <tbody>
14
+ <?php foreach ($this->getQAttributes() as $qAttribute): ?>
15
+ <tr>
16
+ <td><?php echo $qAttribute['name'] ?></td>
17
+ <td>
18
+ <?php if ($this->getMAttributes()): ?>
19
+ <select id='k_body_values_<?php echo $qAttribute['id'];?>' class='quicksales_values_association' name='listing[attributes_association][<?php echo $qAttribute['id'];?>]'>
20
+ <option value=""></option>
21
+
22
+ <?php foreach($this->getMAttributes() as $id => $name) :?>
23
+ <option value="<?php echo $id;?>" <?php if ($associatedAttributes[$qAttribute['id']] == $id): ?> selected='selected'<?php endif; ?> >
24
+ <?php echo $name;?>
25
+ </option>
26
+ <?php endforeach;?>
27
+ </select>
28
+ <?php endif;?>
29
+ </td>
30
+ </tr>
31
+ <?php endforeach ?>
32
+ </tbody>
33
+
34
+ </table>
35
+
36
+ <br />
37
+ <h3><?php echo $this->__('Assign Values');?></h3>
38
+ <br />
39
+
40
+ <?php foreach ($this->getQAttributes() as $qAttribute): ?>
41
+ <table class='data' id='values_<?php echo $qAttribute['id']; ?>'>
42
+
43
+ <thead>
44
+ <tr class='headings'>
45
+ <th colspan='2'><?php echo $qAttribute['name'] ?></th>
46
+ </tr>
47
+
48
+ <tr class='filter'>
49
+ <th class='half'><?php echo $this->__('Magento'); ?></th>
50
+ <th class='half'><?php echo $this->__('Quicksales'); ?></th>
51
+ </tr>
52
+
53
+ </thead>
54
+
55
+
56
+ <tbody id="body_values_<?php echo $qAttribute['id']; ?>">
57
+ <?php echo $this->getAssociatedGridHtml($qAttribute['id']) ?>
58
+ </tbody>
59
+ </table>
60
+ <br />
61
+ <?php endforeach;?>
62
+ <?php else: ?>
63
+ <?php echo $this->__('There are no quicksales Tags to map for the selected category')?>
64
+ <?php endif;?>
65
+
app/design/adminhtml/default/default/template/quicksales/sales/order/payment/info.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <p><?php echo $this->getOrder()->getQpaymentInfo() ?></p>
app/design/adminhtml/default/default/template/quicksales/sales/order/view/tab/quicksales.phtml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="entry-edit">
2
+
3
+
4
+ <div class="entry-edit-head">
5
+ <h4 class="icon-head head-account">
6
+ &nbsp;
7
+ </h4>
8
+ </div>
9
+
10
+
11
+ <div class="fieldset">
12
+
13
+
14
+ <table cellspacing="0" class="form-list">
15
+ <tr>
16
+
17
+ <td class="label">
18
+ <?php echo $this->__('Order source');?>
19
+ </td>
20
+
21
+ <td>
22
+ <?php if ($this->getOrder()->getQsource() == 1): ?>
23
+ <?php echo $this->__('quicksales'); ?>
24
+ <?php else: ?>
25
+ <?php echo $this->__('magento'); ?>
26
+ <?endif;?>
27
+ </td>
28
+
29
+ </tr>
30
+
31
+ <?php if ($this->getOrder()->getQsource() == 1): ?>
32
+ <tr>
33
+
34
+ <td class="label">
35
+ <?php echo $this->__('quicksales order#');?>
36
+ </td>
37
+
38
+ <td>
39
+ <?php echo $this->getOrder()->getData('quicksales_order_id'); ?>
40
+ </td>
41
+ </tr>
42
+
43
+ <tr>
44
+
45
+ <td class="label">
46
+ <?php echo $this->__('quicksales hash#');?>
47
+ </td>
48
+
49
+ <td>
50
+ <?php echo $this->getOrder()->getData('qhash'); ?>
51
+ </td>
52
+ </tr>
53
+
54
+ <?php endif;?>
55
+
56
+ </table>
57
+
58
+ </div>
59
+ </div>
app/etc/modules/Ewave_Quicksales.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Ewave
5
+ * @package Ewave_Quicksales
6
+ */
7
+ -->
8
+ <config>
9
+ <modules>
10
+ <Ewave_Quicksales>
11
+ <active>true</active>
12
+ <codePool>community</codePool>
13
+ </Ewave_Quicksales>
14
+ </modules>
15
+ </config>
js/quicksales/adminhtml/categories.js ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CategoryActions = Class.create();
2
+ CategoryActions.prototype = {
3
+ initialize: function(categoryObjectId, url) {
4
+
5
+ this.categoryObjectId = categoryObjectId;
6
+ this.url = url;
7
+
8
+ if (categoryObjectId == 'category_selector') {
9
+ $(categoryObjectId).hide();
10
+ }
11
+
12
+ Event.observe(this.categoryObjectId, 'change', this.changeCategory.bind(this));
13
+ },
14
+
15
+ changeCategory : function(event) {
16
+
17
+ var element = Event.findElement(event, 'select');
18
+
19
+ new Ajax.Request(this.url, {
20
+ 'method': 'post',
21
+ 'parameters': {parentId: element.value},
22
+ 'onSuccess': function(transport) {
23
+ var subcategories = transport.responseText.evalJSON();
24
+ if (subcategories.length > 0) {
25
+
26
+ var select = new Element("select");
27
+
28
+ select.name = element.name;
29
+
30
+ level = element.id.replace('category_selector', '');
31
+ if (level == '') {
32
+ level = 0;
33
+ }
34
+
35
+ level++;
36
+
37
+ $$('[name="' + element.name + '"]').each(function(item) {
38
+ sublevel = item.id.replace('category_selector', '');
39
+ if (sublevel != '' && parseInt(sublevel) >= parseInt(level)) {
40
+ $(item).replace('');
41
+ }
42
+ })
43
+
44
+ select.id = 'category_selector' + level;
45
+
46
+ var option = document.createElement("option");
47
+ option.text = '';
48
+ option.value = '';
49
+ select.options.add(option, 0);
50
+
51
+ for (i = 0; i < subcategories.length; i++) {
52
+ var option = document.createElement("option");
53
+ option.text = subcategories[i]['label'];
54
+ option.value = subcategories[i]['value'];
55
+
56
+ select.options.add(option, select.options.length);
57
+ }
58
+
59
+ Element.insert(element, {after : select});
60
+
61
+ new CategoryActions(select, transport.request.url);
62
+
63
+ } else {
64
+ $('apply_category').show();
65
+
66
+ }
67
+ }
68
+ }
69
+ );
70
+
71
+ }
72
+
73
+ };
74
+
js/quicksales/adminhtml/listing.js ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ listingProducts = Class.create();
2
+
3
+ listingProducts.prototype = {
4
+ initialize : function(grid, links, container) {
5
+
6
+ this.container = $(container);
7
+
8
+ this.containerDiv = $(container + '_div');
9
+
10
+ this.links = $H(links);
11
+
12
+ this.grid = grid;
13
+ this.grid.rowClickCallback = this.rowClick.bind(this);
14
+ this.grid.initRowCallback = this.rowInit.bind(this);
15
+ this.grid.checkboxCheckCallback = this.registerProduct.bind(this); // Associate/Unassociate
16
+
17
+ this.grid.rows.each( function(row) {
18
+ this.rowInit(this.grid, row);
19
+ }.bind(this));
20
+
21
+ },
22
+ addNewProduct : function(productId, attributes) {
23
+ this.links.set(productId, this.cloneAttributes(attributes));
24
+
25
+
26
+ this.updateGrid();
27
+ this.updateValues();
28
+ this.grid.reload(null);
29
+ },
30
+ registerProduct : function(grid, element, checked) {
31
+ if (checked) {
32
+ if (element.linkAttributes) {
33
+ this.links.set(element.value, element.linkAttributes);
34
+ }
35
+ } else {
36
+ this.links.unset(element.value);
37
+ }
38
+ this.updateGrid();
39
+ this.updateValues();
40
+ },
41
+ rowClick : function(grid, event) {
42
+ var trElement = Event.findElement(event, 'tr');
43
+ var isInput = Event.element(event).tagName.toUpperCase() == 'INPUT';
44
+
45
+ if ($(trElement).hasClassName('invalid')) {
46
+ return ;
47
+ }
48
+
49
+ if ($(Event.findElement(event, 'td')).down('a')) {
50
+ return;
51
+ }
52
+
53
+ if (trElement) {
54
+ var checkbox = $(trElement).down('input');
55
+ if (checkbox && !checkbox.disabled) {
56
+ var checked = isInput ? checkbox.checked : !checkbox.checked;
57
+ grid.setCheckboxChecked(checkbox, checked);
58
+ }
59
+ }
60
+ },
61
+ rowInit : function(grid, row) {
62
+ var checkbox = $(row).down('.checkbox');
63
+ var input = $(row).down('.value-json');
64
+ if (checkbox && input) {
65
+ checkbox.linkAttributes = input.value.evalJSON();
66
+
67
+ if (!checkbox.checked) {
68
+
69
+ $(row).removeClassName('invalid');
70
+ checkbox.enable();
71
+ } else if ($(row).hasClassName('invalid')) {
72
+ checkbox.disable();
73
+ return;
74
+ }
75
+ }
76
+ },
77
+ updateGrid : function() {
78
+ this.grid.reloadParams = {
79
+ 'products[]' :this.links.keys().size() ? this.links.keys() : [ 0 ],
80
+ 'new_products[]' :this.newProducts
81
+ };
82
+ },
83
+ updateValues : function() {
84
+
85
+ var container = this.container;
86
+
87
+ while (tr = container.down('tbody tr')) {
88
+ tr.remove();
89
+ }
90
+
91
+ var pids = '';
92
+
93
+ this.links._each(function(pair) {
94
+
95
+ if (!$('assigned_products_' + pair.key)) {
96
+ container.down('tbody').insert(new Template('<tr><td><input type="checkbox" class="no-display" name="listing[assigned_products][]" value="#{id}" checked="checked" /></td><td>#{name}</td></tr>')
97
+ .evaluate({
98
+ id: pair.key,
99
+ name: pair.value.name
100
+ }));
101
+ pids += pair.key + ',';
102
+
103
+ }
104
+ });
105
+
106
+ categoryId = $('category').value;
107
+
108
+ var url = listingSettingsObj.attributesUrl + (listingSettingsObj.attributesUrl.match(new RegExp('\\?')) ? '&ajax=true' : '?ajax=true' )
109
+ var ajax = new Ajax.Updater(
110
+ {success: "assign_attributes"},
111
+ url,
112
+ {
113
+ method: 'post',
114
+ parameters: {categoryId : categoryId, productIds: pids},
115
+ onComplete: listingSettingsObj.assignEventsToAttributes.bind(this),
116
+ evalScripts: true
117
+ }
118
+ );
119
+ },
120
+ showNoticeMessage : function() {
121
+ $('assign_product_warrning').show();
122
+ }
123
+ }
124
+
125
+ listingSettings = Class.create();
126
+
127
+ listingSettings.prototype = {
128
+ initialize : function(attributesUrl, attributeValuesUrl) {
129
+
130
+ this.attributesUrl = attributesUrl;
131
+ this.attributeValuesUrl = attributeValuesUrl;
132
+ // Event.observe('category','change',this.changeCategory.bind(this));
133
+ this.assignedAttributeChange = this.assignedAttributeChange.bindAsEventListener(this);
134
+ this.assignEventsToAttributes();
135
+
136
+ },
137
+
138
+ changeCategory : function() {
139
+
140
+ var categoryId = 0;
141
+ var categoryLabel = '';
142
+ var level = 0;
143
+
144
+ $$('[name="listing\[category_selector\]"]').each(function (item) {
145
+ sublevel = item.id.replace('category_selector', '');
146
+ if (sublevel == '') {
147
+ sublevel = 0;
148
+ }
149
+ sublevel = parseInt(sublevel)
150
+ if (sublevel >= level) {
151
+ level = sublevel;
152
+ categoryId = item.value;
153
+ categoryLabel += item.selectedIndex >= 0 ? (item.options[item.selectedIndex].innerHTML + ' / ') : '';
154
+ }
155
+ if (sublevel > 0) {
156
+ item.replace('');
157
+ } else {
158
+ item.value = '';
159
+ item.hide();
160
+ }
161
+ });
162
+
163
+ var pids = '';
164
+ for (var i in listingProducts.links.toJSON()) {
165
+ pids += i + ',';
166
+ }
167
+
168
+ $('apply_category').hide();
169
+
170
+ $('category').value = categoryId;
171
+ $('category_label').update(categoryLabel);
172
+
173
+ var url = this.attributesUrl + (this.attributesUrl.match(new RegExp('\\?')) ? '&ajax=true' : '?ajax=true' )
174
+ var ajax = new Ajax.Updater(
175
+ {success: "assign_attributes"},
176
+ url,
177
+ {
178
+ method: 'post',
179
+ parameters: {categoryId : categoryId, productIds: pids},
180
+ onComplete: this.assignEventsToAttributes.bind(this),
181
+ evalScripts: true
182
+ }
183
+ );
184
+
185
+ },
186
+ assignEventsToAttributes : function() {
187
+
188
+ elements = $$('select.quicksales_values_association')
189
+ for (var i = 0; i < elements.length; i++) {
190
+ Event.observe(elements[i],'change',this.assignedAttributeChange);
191
+ }
192
+
193
+ },
194
+ assignedAttributeChange : function(event) {
195
+
196
+ var url = this.attributeValuesUrl + (this.attributeValuesUrl.match(new RegExp('\\?')) ? '&ajax=true' : '?ajax=true' )
197
+
198
+ var element = Event.findElement(event, 'select');
199
+ var ajax = new Ajax.Updater(
200
+ {success: element.id.substr(2)},
201
+ url, {
202
+ 'method': 'post',
203
+ 'parameters': {mAttributeId: element.value, elementName: element.name, category: $F('category')}
204
+ });
205
+ }
206
+ }
package.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Ewave_Quicksales</name>
4
+ <version>1.3.3</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Integrate your Magento backend into the quicksales platform. Push&#xD;
10
+ products to quicksales and pull orders seamlessly</summary>
11
+ <description>&lt;p&gt;This Magento plug in will allow you to push all or selected&#xD;
12
+ products to the quicksales platform. It also automatically retrieves orders from&#xD;
13
+ quicksales and creates these orders in your Magento backend. Just process them like&#xD;
14
+ you would a normal order.&lt;/p&gt;&#xD;
15
+ &#xD;
16
+ &lt;p&gt;&#xD;
17
+ &lt;b&gt;Main Features&lt;/b&gt;&lt;/p&gt;&#xD;
18
+ &lt;ul&gt;&#xD;
19
+ &lt;br /&gt;&#xD;
20
+ Create Listings from Magento using Product Catalogue&lt;br /&gt; &#xD;
21
+ Upgrade quicksales listings through Magento&lt;br /&gt;&#xD;
22
+ Manage quicksales listings in Magento (Relist, Stop)&lt;br /&gt; &#xD;
23
+ Import quicksales customer details into Magento's database&lt;br /&gt;&#xD;
24
+ Process quicksales orders from Magento's backend&lt;br /&gt;&#xD;
25
+ Default Configuration Options&lt;br /&gt; &#xD;
26
+ Listing Specific Configuration Options&lt;br /&gt; &#xD;
27
+ Listings are FREE&lt;br /&gt; </description>
28
+ <notes>Quicksales Integration</notes>
29
+ <authors><author><name>Fatima Said</name><user>fatimamade</user><email>info@madebyewave.com</email></author></authors>
30
+ <date>2012-04-30</date>
31
+ <time>09:32:50</time>
32
+ <contents><target name="magecommunity"><dir name="Ewave"><dir name="Quicksales"><dir name="Block"><dir name="Adminhtml"><dir name="Listing"><dir name="Edit"><dir name="Tab"><dir name="Additional"><dir name="Step1"><dir name="Grid"><dir name="Renderer"><file name="Checkbox.php" hash="612e77cc461db7cb50a3141d06fc9435"/></dir></dir><file name="Grid.php" hash="12e9570da559712a59bf4f6ff2ff6150"/><dir name="Renderer"><file name="Status.php" hash="e5645949538a2402e49c60c00efc040f"/></dir></dir><file name="Step1.php" hash="60b50b2c8c81e423a38bdda161c73665"/><dir name="Step2"><file name="Depended.php" hash="4985977e2bcfecc477e7df9c5a59e216"/><dir name="Renderer"><file name="Category.php" hash="53ecb8b2e482dd5e2dcca5bc550be760"/><file name="Depended.php" hash="4814a2169b96d77acadcb474e766abd4"/><file name="Vshopcategory.php" hash="12b2bcbcce7d48890ecec9e720f509b8"/></dir></dir><file name="Step2.php" hash="127e4fe60a83efee38e109087e2a204f"/><dir name="Step3"><file name="Attributes.php" hash="28f5d623b1c592cb95bad176dd6a05a8"/></dir><file name="Step3.php" hash="6a76689aaa190f5c8e0a5abd61fb96b1"/><file name=".Step1.php.swo" hash="699279bc79b42b81daecc13614859ee4"/><file name=".Step1.php.swp" hash="8ce6d81caadfeed322a91172985bdb53"/></dir><file name="Attributes.php" hash="159f6790020e1ec4b7b77ccafc74429d"/><file name=".Attributes.php.swp" hash="b4f2e65ddc834ae7500eaedd18130ad9"/></dir><file name="Tabs.php" hash="69543da7a4afa619d951b312e3d286b1"/></dir><file name="Edit.php" hash="2bdf67b7be35772ab14715bd2da1f257"/><file name="Grid.php" hash="8b13e2245ff863b3e5cb4f3dfbbe988f"/><dir name="Log"><file name="Grid.php" hash="eb6c5ba41af25c4535809466d14a7cbd"/><file name=".Grid.php.swp" hash="dc64a97f0ac6bc304e1c10a90009d3b5"/></dir><file name="Log.php" hash="b12a8a5b0119ee535d2d4245fb8aed48"/><dir name="Product"><dir name="Log"><file name="Grid.php" hash="bd275ef1fa0d19257ff0f81b6baded9c"/></dir><file name="Log.php" hash="5e69ba73c54e1181b9fd8d015bf15410"/></dir></dir><file name="Listing.php" hash="87592bd2da3bd09ca18b473e101853a1"/><dir name="Log"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Action.php" hash="18e5897df977ea3156905423dda69fad"/></dir></dir></dir><file name="Grid.php" hash="84fad5108af4229ba2fcadb63b567217"/></dir><file name="Log.php" hash="e8955b492972b3c8f79c8d2b282051ae"/><dir name="Sales"><dir name="Order"><dir name="Payment"><file name="Info.php" hash="d4ee788410f336cba2bcb62e5e339178"/></dir><dir name="View"><dir name="Tab"><file name="Quicksales.php" hash="40f958e04c63cf77a324813bcc2d5c98"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Datetime.php" hash="3934885964f9f1f8de0f2cd1c027599e"/><file name="Description.php" hash="8a50abd7433d1e3c55ba04a12da347d3"/><file name="Gst.php" hash="7ae3faa5096159fb32a57d0c1a3f6637"/></dir></dir></dir></dir></dir><dir name="RW"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="cff441acf7f06ca8db160dc4cd394774"/><file name="Payment.php" hash="cb6ec950bdceafbacb578fea3a4dc10c"/><dir name="View"><dir name="Tab"><file name="Info.php" hash="295ae5cdd5c7fce133a8852126cc9688"/></dir></dir><file name="View.php" hash="a3e25d112227b72a5b810e90202be5a4"/></dir></dir></dir></dir></dir><dir name="CatalogInventory"><dir name="Model"><dir name="Resource"><file name="Stock.php" hash="dd232a80670b248f982f090215f16e70"/></dir><dir name="Stock"><file name="Item.php" hash="1a624d81536e993c4a7d8e164939ff80"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="45d8edf82bc22a0c1eceac2518dfc9c0"/><file name="Listing.php" hash="02b9eb1bc0367e579f8517069897b6d5"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="0118cc97f59c72914804b474b93810dd"/><file name="Action.php" hash="85f98d0772e0bab7c1bc5799322fb976"/><file name="Client.php" hash="06f809265cde2d93fde082d06f4cb66a"/><file name="Createitem.php" hash="837e03ee1d37a9dd0de3f332df1bcf0d"/><file name="Getcategories.php" hash="249393ef0ce256daead6e9ffa5d0e323"/><file name="Getitem.php" hash="c832918872fd552da4714f434eb26da2"/><file name="Getorders.php" hash="2b5a54a9266ae00353aa140ee92a9a75"/><file name="Gettags.php" hash="09a3e057e4bbb0a090576295ddf72dd5"/><file name="Getvshopcategory.php" hash="c8887d3bcd2a4aea52e5695bde05ac0d"/><file name="Sendinvoice.php" hash="e01099da302a0b042779fadf47e4090b"/><file name="Updateorder.php" hash="8f0122e1512cc7806571a4e8df73adb7"/></dir><file name="Api.php" hash="d14a6fa9f3c48d8afd1ba1e648f0b1b8"/><dir name="Attribute"><dir name="Backend"><file name="Multiselect.php" hash="4c9778a8a40de5a0d6dad0c94fd1be7a"/></dir></dir><dir name="Catalog"><dir name="Resource"><dir name="Product"><dir name="Type"><dir name="Configurable"><dir name="Attribute"><file name="Collection.php" hash="995afa617df6f915b6642d1120ccceae"/></dir></dir></dir></dir></dir></dir><dir name="Entity"><file name="Setup.php" hash="e3757d878215c95b61d4f3ad2790f06f"/></dir><dir name="Listing"><file name="Action.php" hash="6e57b090c9575a672ceb414d7b40940d"/><dir name="Associated"><dir name="Attribute"><file name="Value.php" hash="dfc31705041aa63542ab2bfb57c3fa6e"/></dir><file name="Attribute.php" hash="934710ab465c4ca478448ea1f019f328"/></dir><dir name="Attribute"><dir name="Backend"><file name="Listing.php" hash="8021d2d56d98c295153a433a243b2cf2"/><file name="Listingupgrade.php" hash="82ea77f38d8ea7972f2b60e7c85006c4"/><file name="Payment.php" hash="7197e6b2c1a179164e2df822a204de27"/><file name="Pricing.php" hash="ac81f5980d223e5ec79f17484f1a7db1"/><file name="Shipping.php" hash="03c586856b3fb756c4ce302a810101f4"/></dir></dir><file name="Log.php" hash="db820db18e8c04d086fa51f2183641ef"/><dir name="Product"><file name="Log.php" hash="fd1f26a1d6f207c52a6deba80ec132f4"/></dir><file name="Product.php" hash="9d1e6d7069831515bc8af8cbe1bc5454"/></dir><file name="Listing.php" hash="9f9e81d3a798b1f8ca10eec38b18590e"/><dir name="Mysql4"><dir name="Listing"><file name="Collection.php" hash="747f3cf02018278d7a5d719a6272025c"/></dir><file name="Listing.php" hash="3ee54318778664a71bf5d59c02f17a03"/></dir><file name="Observer.php" hash="b5d015879d45c0fbcefd2cad88cf807e"/><dir name="Payment"><dir name="Method"><file name="Quicksales.php" hash="872bf3d3c6c6d4c860b339b58a276e19"/></dir></dir><dir name="RW"><dir name="Sales"><dir name="Order"><file name="Shipment.php" hash="b4a0e5553a81ebf3c93a7e5e3a0ad17a"/></dir></dir></dir><dir name="Resource"><dir name="Listing"><dir name="Associated"><dir name="Attribute"><file name="Collection.php" hash="74159fff033230cc555970e0894e3dbd"/><dir name="Value"><file name="Collection.php" hash="df60430323f4ce8bdb8dd9724a8b5341"/></dir><file name="Value.php" hash="72854c83b0b0fde7c8c2cd18641bff90"/></dir><file name="Attribute.php" hash="33f225b6af7b2c19cf5ce5a05add0e4f"/></dir><file name="Collection.php" hash="34e455937a645ed8afbe6796742e4629"/><dir name="Log"><file name="Collection.php" hash="b3704c39dc29ab533ac265700c286444"/></dir><file name="Log.php" hash="36493f3b15e7935427b018977aa29c55"/><dir name="Product"><file name="Collection.php" hash="a9ccc5cc0705a30eade34267dfb30d6a"/><dir name="Log"><file name="Collection.php" hash="9d5b006b35062b0c63b77027a2bd0efc"/></dir><file name="Log.php" hash="2363d496d0bd1bff8a5378d47b146024"/></dir><file name="Product.php" hash="254f4f9e1104c619c7e349c479076568"/></dir><file name="Listing.php" hash="7005031b92e3a6f02e2af6a004156541"/></dir><dir name="Source"><file name="Getcategories.php" hash="44e1ad9156704b2b8dcbaa117c6c0a94"/><file name="Payments.php" hash="8ce9a6818da188308d1e52d14a5a7606"/><file name="Posttolocation.php" hash="6ac9508d1d587124069314ab7eb45920"/><file name="Shipping.php" hash="8aeec89891d2608cfc6ecf3e499a8218"/><file name="Vshopcategory.php" hash="e94a8548091fca00defc828dad2870db"/></dir><dir name="System"><file name="Autorelist.php" hash="55ecf8211df3340298d9f764ac5b2bdd"/><file name="Custom.php" hash="9ea46c68111ac558aadb01d15efa16e7"/><dir name="Customer"><file name="Import.php" hash="316802214006985ec3733a8966116a26"/></dir><file name="Description.php" hash="c1ec9931fd34929461088b60796b3a1b"/><file name="Duration.php" hash="f3916058828e9d036daf8fce673a7c10"/><dir name="Payment"><file name="Method.php" hash="a89ca6af6e29847d726b8e6f1522f159"/></dir><dir name="Price"><file name="Custom.php" hash="b69b7703d7fc71da54d34da75619d703"/></dir><file name="Price.php" hash="83c64351f8dd9a5b0973535f71a0e145"/><file name="Qty.php" hash="b50d5cb12f828736a11b785a87124c9f"/><dir name="Shipping"><file name="Method.php" hash="70354616f1d62de658ca8e5cb0febc61"/><file name="Package.php" hash="e8f3c75db3446134abf6cb20a4b04c72"/><file name="Posttolocation.php" hash="7976db08b7f232038fbe1eb3a16b97d7"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ListingController.php" hash="2059467c75f5f21e31c19bd4e7d5e04c"/><file name="LogController.php" hash="cdfe5a2a44160cfcc43dbb8f02789d12"/><file name="OrderController.php" hash="58c99df32639c1c3279e9e825d8f89ce"/></dir><file name="IndexController.php" hash="43e24f364a2405594c03fee4256e20ee"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5656fa1098cc51a6b1489441b815fe27"/><file name="config.xml" hash="f0e4e827e09124ee07166da2e7ec9393"/><file name="system.xml" hash="0b4689d43ac99508956fad21f6eaf66a"/></dir><dir name="sql"><dir name="quicksales_setup"><file name="mysql4-install-1.0.0.php" hash="ae886143d2da0214321ae4cbd92027d0"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="522a13ee3806982b8e4bb90e320f00ca"/><file name="mysql4-upgrade-1.1.0-1.2.0.php" hash="bed0ad53c0d65b320f07caba3199eba7"/><file name="mysql4-upgrade-1.2.0-1.2.1.php" hash="5b07273d133b25d8d5c4291178b44270"/><file name="mysql4-upgrade-1.2.1-1.2.2.php" hash="44351c292dd0fbaf81ec9ea5bb208506"/><file name="mysql4-upgrade-1.2.10-1.2.11.php" hash="31fccb02b1db0fde8a2a1e1478be39d7"/><file name="mysql4-upgrade-1.2.11-1.2.12.php" hash="414293f3d6b7f24a86bca36be361aecf"/><file name="mysql4-upgrade-1.2.12-1.2.13.php" hash="df993aed13e25303a7180c3e806ca397"/><file name="mysql4-upgrade-1.2.13-1.2.14.php" hash="5f722437b3e7a4af0af17ead6304228a"/><file name="mysql4-upgrade-1.2.14-1.2.15.php" hash="dfc249d36c655ac1173dd17058a7be59"/><file name="mysql4-upgrade-1.2.15-1.2.16.php" hash="2e1d319752280ae818201a06f894c4e1"/><file name="mysql4-upgrade-1.2.17-1.2.18.php" hash="289dc9d98c36c911088921eb71cd4fa0"/><file name="mysql4-upgrade-1.2.18-1.2.19.php" hash="873bb58b9ec5c2da4d8da6a300fa509c"/><file name="mysql4-upgrade-1.2.19-1.2.20.php" hash="1a305665d4cb0cca63df768b63e9470e"/><file name="mysql4-upgrade-1.2.2-1.2.3.php" hash="2be0aa84f69f5b7d44fc7b7eb1ae3c3e"/><file name="mysql4-upgrade-1.2.22-1.2.23.php" hash="9f611eac715c83c1305c8f3c98eff54e"/><file name="mysql4-upgrade-1.2.23-1.2.24.php" hash="adf3e0aec6fe54a929409ad2d8f4aa9c"/><file name="mysql4-upgrade-1.2.24-1.2.25.php" hash="423f672b3beedd6e2c59c6c484150188"/><file name="mysql4-upgrade-1.2.25-1.2.26.php" hash="2807523f5310438f090b4f492758b21a"/><file name="mysql4-upgrade-1.2.26-1.2.27.php" hash="e7c32ec1f342b21b88f0e76a39795d2e"/><file name="mysql4-upgrade-1.2.27-1.2.28.php" hash="72e4e27c93d52680158f5386e7a6b63a"/><file name="mysql4-upgrade-1.2.28-1.2.29.php" hash="1381a1689b0b9e5495be72cfa487f5c0"/><file name="mysql4-upgrade-1.2.29-1.2.30.php" hash="8ea6ea37aac25b057221871ec99dbb26"/><file name="mysql4-upgrade-1.2.3-1.2.4.php" hash="4bda2413bc7a92dd0ee1363fd42dcd37"/><file name="mysql4-upgrade-1.2.30-1.2.31.php" hash="fee84457a0bd4a87fb55354d375dff5d"/><file name="mysql4-upgrade-1.2.31-1.2.32.php" hash="63a92e0ad3540d7c80d4fa78109f5c93"/><file name="mysql4-upgrade-1.2.32-1.2.33.php" hash="e660753bcf2a112454ffda451c4299ee"/><file name="mysql4-upgrade-1.2.33-1.3.1.php" hash="7c6a7b913319f7d12b911001265e8a69"/><file name="mysql4-upgrade-1.2.4-1.2.5.php" hash="d49c4c95fd5a3db349cdbe95a790ab9a"/><file name="mysql4-upgrade-1.2.5-1.2.6.php" hash="e877d91700d909632cb9d3dcb42ea7b9"/><file name="mysql4-upgrade-1.2.6-1.2.7.php" hash="2b5788963be1be407c183731cd1faa37"/><file name="mysql4-upgrade-1.2.7-1.2.8.php" hash="fdc0aaaa8e97442e5736752571ca682d"/><file name="mysql4-upgrade-1.2.8-1.2.9.php" hash="4926fd7fedf7a7be3eceb1a057d94b4a"/><file name="mysql4-upgrade-1.2.9-1.2.10.php" hash="a65c94a2be422899d23a1c8977595985"/><file name="mysql4-upgrade-1.3.1-1.3.2.php" hash="1074cad3c503e115e5392829d80abfba"/></dir></dir><dir name="xml"><file name="CreateItem_Request.xml" hash="3434ff3056e34a3e3a1c9d9e8d4ca4bb"/><file name="GetCategoriesWithTags_Request.xml" hash="f1c4558580f4a0c7103ab9318a895eaf"/><file name="GetCategories_Request.xml" hash="345535fbe533ffee4fbc0e750a9d34d0"/><file name="GetCategoryChanges_Request.xml" hash="f106996bc9650db30d4a9f1aa72cf61f"/><file name="GetCategoryVersion_Request.xml" hash="817d8ec4cb476613a1376667b9e70f79"/><file name="GetFeeList_Request.xml" hash="5c9383b8fd56cc8cea443563d1a4a684"/><file name="GetItemIDByRefID_Request.xml" hash="a554bab32ac9af2429521fb55c318f43"/><file name="GetItem_Request.xml" hash="8f072b708501d61b5b536fbb206ae221"/><file name="GetListingAndItemIDs_Request.xml" hash="bcdc9c5870f72530f0cdac42a976051f"/><file name="GetOrders_Request.xml" hash="6c662e867a3cecadcd30aa4846cc9016"/><file name="GetTagsVersion_Request.xml" hash="fc710967591911dd4f68a93f14354337"/><file name="GetTags_Request.xml" hash="dc4f0c2673dd9b7c17b7030bafc3da7c"/><file name="GetvShopCategories_Request.xml" hash="afdb4e215afe828dc515366d680aaa52"/><file name="LeaveRating_Request.xml" hash="13b82cb6e6530f2a178dd7be252ffb2c"/><file name="ReviseItem_Request.xml" hash="67955fce1342e571d42dbf8177e6db92"/><file name="SendInvoice_Request.xml" hash="88b690b77704b8db0d14c58380f41e84"/><file name="UpdateMakeAnOffer_Request.xml" hash="1346733740e45e49ed9738cdd34329d9"/><file name="UpdateOrder_Request.xml" hash="d6e4d3668c3628c35e9778e90bbebb05"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ewave_Quicksales.xml" hash="04098906a343811aa2d0e2ce93bd33dd"/></dir></target><target name="mageweb"><dir name="js"><dir name="quicksales"><dir name="adminhtml"><file name="categories.js" hash="c44d2af4f614b10b927617fc9ec18d4e"/><file name="listing.js" hash="59bf31dccd6f694170421878bda2531f"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="quicksales"><dir name="css"><file name="quicksales.css" hash="e3bbf915589825e3123d0fd4133ed992"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="quicksales.xml" hash="c58dd6c400d813e260c9bf8f5754b82f"/></dir><dir name="template"><dir name="quicksales"><dir name="listing"><dir name="edit"><dir name="tab"><dir name="additional"><file name="step1.phtml" hash="dbc1d766799eebddaad777a624b7cc48"/><file name="step2.phtml" hash="dfe166cca93e697bdbeea749b9c2dd1c"/><dir name="step3"><file name="attributes.phtml" hash="228f5edd6704ad5f29f29f6b82d39413"/></dir><file name="step3.phtml" hash="ba061b5739d5cf1463354c0afeacf3ca"/></dir></dir></dir><file name="edit.phtml" hash="53fafe27aebbaadd6ba7c25678c01d99"/></dir><dir name="sales"><dir name="order"><dir name="payment"><file name="info.phtml" hash="41652cd66163ca04c4223474bdc52b5d"/></dir><dir name="view"><dir name="tab"><file name="quicksales.phtml" hash="ee8a87bd24421874a6a36516a872599a"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
33
+ <compatible/>
34
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
35
+ </package>
skin/adminhtml/default/default/quicksales/css/quicksales.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .half {
2
+ width: 50%;
3
+ }