Version Notes
The release fixed:
- MEKCFM-4 Magento API group_id problem
Download this release
Release Info
Developer | GetReady Team |
Extension | getready_kaas |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- app/code/community/Getready/Kaas/Helper/Activity/Data.php +84 -124
- app/code/community/Getready/Kaas/Helper/Category/Cache/Data.php +20 -27
- app/code/community/Getready/Kaas/Helper/Category/Data.php +43 -51
- app/code/community/Getready/Kaas/Helper/Data.php +5 -9
- app/code/community/Getready/Kaas/Helper/Product/Category/Data.php +56 -69
- app/code/community/Getready/Kaas/Helper/Product/Data.php +136 -143
- app/code/community/Getready/Kaas/Helper/Product/Store/Data.php +55 -65
- app/code/community/Getready/Kaas/Helper/Store/Data.php +60 -62
- app/code/community/Getready/Kaas/Model/Activity.php +7 -13
- app/code/community/Getready/Kaas/Model/Activity/Api.php +11 -14
- app/code/community/Getready/Kaas/Model/Activity/Api/V2.php +5 -11
- app/code/community/Getready/Kaas/Model/Category/Api.php +26 -37
- app/code/community/Getready/Kaas/Model/Category/Api/V2.php +5 -11
- app/code/community/Getready/Kaas/Model/Mysql4/Activity.php +6 -12
- app/code/community/Getready/Kaas/Model/Mysql4/Activity/Collection.php +4 -10
- app/code/community/Getready/Kaas/Model/Observer.php +25 -47
- app/code/community/Getready/Kaas/Model/Product/Api.php +52 -71
- app/code/community/Getready/Kaas/Model/Product/Api/V2.php +5 -11
- app/code/community/Getready/Kaas/Model/Store/Api.php +28 -31
- app/code/community/Getready/Kaas/Model/Store/Api/V2.php +5 -11
- app/code/community/Getready/Kaas/etc/config.xml +2 -2
- app/code/community/Getready/Kaas/etc/wsdl.xml +2 -1
- app/code/community/Getready/Kaas/sql/kaas_setup/mysql4-install-1.0.0.php +2 -1
- app/etc/modules/Getready_Kaas.xml +1 -1
- package.xml +5 -5
app/code/community/Getready/Kaas/Helper/Activity/Data.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,21 +12,17 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Helper_Activity_Data extends Mage_Core_Helper_Abstract
|
27 |
{
|
28 |
protected $_storeIds = null;
|
29 |
-
|
30 |
public function getActivityFeed($store)
|
31 |
{
|
32 |
$activity_feed = array();
|
@@ -34,23 +30,21 @@ class Getready_Kaas_Helper_Activity_Data extends Mage_Core_Helper_Abstract
|
|
34 |
$store_id = $store->getId();
|
35 |
|
36 |
$collection = $this->getActivityCollection($store_id);
|
37 |
-
foreach($collection as $item)
|
38 |
-
{
|
39 |
$activity_feed[] = array(
|
40 |
-
'entity_id' => (int)$item->getProductId(),
|
41 |
-
'action' => $item->getaction()
|
42 |
);
|
43 |
}
|
44 |
|
45 |
return $activity_feed;
|
46 |
}
|
47 |
-
|
48 |
public function getAllStoreIds()
|
49 |
{
|
50 |
-
if($this->_storeIds == null)
|
51 |
-
{
|
52 |
$stores = Mage::app()->getStores();
|
53 |
-
|
54 |
$ids = array();
|
55 |
foreach ($stores as $store) {
|
56 |
$ids[] = $store->getId();
|
@@ -58,234 +52,200 @@ class Getready_Kaas_Helper_Activity_Data extends Mage_Core_Helper_Abstract
|
|
58 |
|
59 |
$this->_storeIds = $ids;
|
60 |
}
|
|
|
61 |
return $this->_storeIds;
|
62 |
}
|
63 |
-
|
64 |
-
public function createUpdateActivity($store_id
|
65 |
{
|
66 |
-
if($product_id)
|
67 |
-
|
68 |
-
try
|
69 |
-
{
|
70 |
$resource = Mage::getSingleton('core/resource');
|
71 |
-
$write_connection = $resource->getConnection('core_write');
|
72 |
$table_name = $resource->getTableName('getready_kaas_activity');
|
73 |
-
|
74 |
$action = 'update';
|
75 |
$created_at = now();
|
76 |
$data = array();
|
77 |
-
|
78 |
-
if($store_id)
|
79 |
-
{
|
80 |
//delete all activity by product id for specific store
|
81 |
$sql = "DELETE FROM `{$table_name}` WHERE store_id = :store_id AND product_id = :product_id ";
|
82 |
$binds = array(
|
83 |
'store_id' => $store_id,
|
84 |
-
'product_id' => $product_id,
|
85 |
);
|
86 |
$write_connection->query($sql, $binds);
|
87 |
-
|
88 |
$data[] = array(
|
89 |
'store_id' => $store_id,
|
90 |
'product_id' => $product_id,
|
91 |
'action' => $action,
|
92 |
-
'created_at' => $created_at
|
93 |
-
);
|
94 |
-
}
|
95 |
-
elseif($store_id == 0)
|
96 |
-
{
|
97 |
//delete all activity by product id for all stores
|
98 |
$sql = "DELETE FROM `{$table_name}` WHERE product_id = :product_id ";
|
99 |
-
$binds = array(
|
100 |
-
'product_id' => $product_id,
|
101 |
);
|
102 |
$write_connection->query($sql, $binds);
|
103 |
-
|
104 |
-
foreach($this->getAllStoreIds() as $_store_id)
|
105 |
-
{
|
106 |
$data[] = array(
|
107 |
'store_id' => $_store_id,
|
108 |
'product_id' => $product_id,
|
109 |
'action' => $action,
|
110 |
-
'created_at' => $created_at
|
111 |
);
|
112 |
}
|
113 |
}
|
114 |
-
|
115 |
-
if(count($data) > 0)
|
116 |
-
{
|
117 |
$write_connection->insertMultiple($table_name, $data);
|
118 |
}
|
119 |
-
}
|
120 |
-
catch (Exception $e)
|
121 |
-
{
|
122 |
Mage::logException($e);
|
123 |
-
}
|
124 |
-
}
|
125 |
}
|
126 |
-
|
127 |
public function createDeleteActivity($product_id)
|
128 |
{
|
129 |
-
if($product_id)
|
130 |
-
|
131 |
-
try
|
132 |
-
{
|
133 |
$resource = Mage::getSingleton('core/resource');
|
134 |
-
$write_connection = $resource->getConnection('core_write');
|
135 |
$table_name = $resource->getTableName('getready_kaas_activity');
|
136 |
|
137 |
//delete all activity by product id
|
138 |
$sql = "DELETE FROM `{$table_name}` WHERE product_id = :product_id ";
|
139 |
$binds = array(
|
140 |
-
'product_id' => $product_id,
|
141 |
);
|
142 |
$write_connection->query($sql, $binds);
|
143 |
|
144 |
-
|
145 |
//add for all stores
|
146 |
$action = 'delete';
|
147 |
-
$created_at = now();
|
148 |
$data = array();
|
149 |
-
foreach($this->getAllStoreIds() as $store_id)
|
150 |
-
{
|
151 |
$data[] = array(
|
152 |
'store_id' => $store_id,
|
153 |
'product_id' => $product_id,
|
154 |
'action' => $action,
|
155 |
-
'created_at' => $created_at
|
156 |
);
|
157 |
}
|
158 |
-
if(count($data) > 0)
|
159 |
-
{
|
160 |
$write_connection->insertMultiple($table_name, $data);
|
161 |
}
|
162 |
-
}
|
163 |
-
catch (Exception $e)
|
164 |
-
{
|
165 |
Mage::logException($e);
|
166 |
-
}
|
167 |
}
|
168 |
}
|
169 |
-
|
170 |
public function createStockActivity($quote_items)
|
171 |
{
|
172 |
-
try
|
173 |
-
{
|
174 |
$resource = Mage::getSingleton('core/resource');
|
175 |
-
$write_connection = $resource->getConnection('core_write');
|
176 |
$table_name = $resource->getTableName('getready_kaas_activity');
|
177 |
-
|
178 |
$store_ids = $this->getAllStoreIds();
|
179 |
-
|
180 |
$products_ids = array();
|
181 |
-
foreach($quote_items as $item)
|
182 |
-
{
|
183 |
$products_ids[] = $item->getProductId();
|
184 |
}
|
185 |
|
186 |
//delete all activity by product ids
|
187 |
-
if(count($products_ids) > 0)
|
188 |
-
|
189 |
-
$product_ids_string = implode(',', $products_ids);
|
190 |
$sql = "DELETE FROM `{$table_name}` WHERE product_id IN (:product_ids)";
|
191 |
$binds = array(
|
192 |
-
'product_ids' => $product_ids_string,
|
193 |
);
|
194 |
$write_connection->query($sql, $binds);
|
195 |
}
|
196 |
-
|
197 |
-
|
198 |
//add new activities
|
199 |
$action = 'update';
|
200 |
-
$created_at = now();
|
201 |
$data = array();
|
202 |
-
foreach($quote_items as $item)
|
203 |
-
{
|
204 |
$_product_id = $item->getProductId();
|
205 |
-
foreach($store_ids as $_store_id)
|
206 |
-
{
|
207 |
$data[] = array(
|
208 |
'store_id' => $_store_id,
|
209 |
'product_id' => $_product_id,
|
210 |
'action' => $action,
|
211 |
-
'created_at' => $created_at
|
212 |
);
|
213 |
}
|
214 |
}
|
215 |
-
if(count($data) > 0)
|
216 |
-
|
217 |
-
$write_connection->insertMultiple($table_name, $data);
|
218 |
}
|
219 |
-
}
|
220 |
-
catch (Exception $e)
|
221 |
-
{
|
222 |
Mage::logException($e);
|
223 |
}
|
224 |
}
|
225 |
-
|
226 |
-
public function deleteProductActivity($store_id
|
227 |
{
|
228 |
-
if($store_id && $product_id)
|
229 |
-
|
230 |
-
try
|
231 |
-
{
|
232 |
$resource = Mage::getSingleton('core/resource');
|
233 |
-
$write_connection = $resource->getConnection('core_write');
|
234 |
$table_name = $resource->getTableName('getready_kaas_activity');
|
235 |
-
|
236 |
$sql = "DELETE FROM `{$table_name}` WHERE store_id = :store_id AND product_id = :product_id ";
|
237 |
$binds = array(
|
238 |
'store_id' => $store_id,
|
239 |
-
'product_id' => $product_id,
|
240 |
);
|
241 |
-
$write_connection->query($sql, $binds);
|
242 |
-
}
|
243 |
-
catch (Exception $e)
|
244 |
-
{
|
245 |
Mage::logException($e);
|
246 |
-
}
|
247 |
}
|
248 |
-
}
|
249 |
|
250 |
public function getActivityCollection($store_id)
|
251 |
{
|
252 |
-
|
253 |
-
|
254 |
|
255 |
//$collection->addFieldToFilter('store_id', array('in' => array(0,$store_id)) );
|
256 |
|
257 |
return $collection;
|
258 |
}
|
259 |
-
|
260 |
public function clearActivityFeed($store)
|
261 |
{
|
262 |
$clered = false;
|
263 |
|
264 |
$store_id = $store->getId();
|
265 |
|
266 |
-
if($store_id)
|
267 |
-
|
268 |
-
try
|
269 |
-
{
|
270 |
$resource = Mage::getSingleton('core/resource');
|
271 |
-
$write_connection = $resource->getConnection('core_write');
|
272 |
$table_name = $resource->getTableName('getready_kaas_activity');
|
273 |
-
|
274 |
$sql = "DELETE FROM `{$table_name}` WHERE store_id = :store_id ";
|
275 |
$binds = array(
|
276 |
-
'store_id' => $store_id,
|
277 |
);
|
278 |
$write_connection->query($sql, $binds);
|
279 |
$clered = true;
|
280 |
-
}
|
281 |
-
catch (Exception $e)
|
282 |
-
{
|
283 |
Mage::logException($e);
|
284 |
-
}
|
285 |
-
|
286 |
}
|
287 |
|
288 |
return $clered;
|
289 |
}
|
290 |
-
|
291 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Helper_Activity_Data extends Mage_Core_Helper_Abstract
|
23 |
{
|
24 |
protected $_storeIds = null;
|
25 |
+
|
26 |
public function getActivityFeed($store)
|
27 |
{
|
28 |
$activity_feed = array();
|
30 |
$store_id = $store->getId();
|
31 |
|
32 |
$collection = $this->getActivityCollection($store_id);
|
33 |
+
foreach ($collection as $item) {
|
|
|
34 |
$activity_feed[] = array(
|
35 |
+
'entity_id' => (int) $item->getProductId(),
|
36 |
+
'action' => $item->getaction(),
|
37 |
);
|
38 |
}
|
39 |
|
40 |
return $activity_feed;
|
41 |
}
|
42 |
+
|
43 |
public function getAllStoreIds()
|
44 |
{
|
45 |
+
if ($this->_storeIds == null) {
|
|
|
46 |
$stores = Mage::app()->getStores();
|
47 |
+
|
48 |
$ids = array();
|
49 |
foreach ($stores as $store) {
|
50 |
$ids[] = $store->getId();
|
52 |
|
53 |
$this->_storeIds = $ids;
|
54 |
}
|
55 |
+
|
56 |
return $this->_storeIds;
|
57 |
}
|
58 |
+
|
59 |
+
public function createUpdateActivity($store_id, $product_id)
|
60 |
{
|
61 |
+
if ($product_id) {
|
62 |
+
try {
|
|
|
|
|
63 |
$resource = Mage::getSingleton('core/resource');
|
64 |
+
$write_connection = $resource->getConnection('core_write');
|
65 |
$table_name = $resource->getTableName('getready_kaas_activity');
|
66 |
+
|
67 |
$action = 'update';
|
68 |
$created_at = now();
|
69 |
$data = array();
|
70 |
+
|
71 |
+
if ($store_id) {
|
|
|
72 |
//delete all activity by product id for specific store
|
73 |
$sql = "DELETE FROM `{$table_name}` WHERE store_id = :store_id AND product_id = :product_id ";
|
74 |
$binds = array(
|
75 |
'store_id' => $store_id,
|
76 |
+
'product_id' => $product_id,
|
77 |
);
|
78 |
$write_connection->query($sql, $binds);
|
79 |
+
|
80 |
$data[] = array(
|
81 |
'store_id' => $store_id,
|
82 |
'product_id' => $product_id,
|
83 |
'action' => $action,
|
84 |
+
'created_at' => $created_at,
|
85 |
+
);
|
86 |
+
} elseif ($store_id == 0) {
|
|
|
|
|
87 |
//delete all activity by product id for all stores
|
88 |
$sql = "DELETE FROM `{$table_name}` WHERE product_id = :product_id ";
|
89 |
+
$binds = array(
|
90 |
+
'product_id' => $product_id,
|
91 |
);
|
92 |
$write_connection->query($sql, $binds);
|
93 |
+
|
94 |
+
foreach ($this->getAllStoreIds() as $_store_id) {
|
|
|
95 |
$data[] = array(
|
96 |
'store_id' => $_store_id,
|
97 |
'product_id' => $product_id,
|
98 |
'action' => $action,
|
99 |
+
'created_at' => $created_at,
|
100 |
);
|
101 |
}
|
102 |
}
|
103 |
+
|
104 |
+
if (count($data) > 0) {
|
|
|
105 |
$write_connection->insertMultiple($table_name, $data);
|
106 |
}
|
107 |
+
} catch (Exception $e) {
|
|
|
|
|
108 |
Mage::logException($e);
|
109 |
+
}
|
110 |
+
}
|
111 |
}
|
112 |
+
|
113 |
public function createDeleteActivity($product_id)
|
114 |
{
|
115 |
+
if ($product_id) {
|
116 |
+
try {
|
|
|
|
|
117 |
$resource = Mage::getSingleton('core/resource');
|
118 |
+
$write_connection = $resource->getConnection('core_write');
|
119 |
$table_name = $resource->getTableName('getready_kaas_activity');
|
120 |
|
121 |
//delete all activity by product id
|
122 |
$sql = "DELETE FROM `{$table_name}` WHERE product_id = :product_id ";
|
123 |
$binds = array(
|
124 |
+
'product_id' => $product_id,
|
125 |
);
|
126 |
$write_connection->query($sql, $binds);
|
127 |
|
|
|
128 |
//add for all stores
|
129 |
$action = 'delete';
|
130 |
+
$created_at = now();
|
131 |
$data = array();
|
132 |
+
foreach ($this->getAllStoreIds() as $store_id) {
|
|
|
133 |
$data[] = array(
|
134 |
'store_id' => $store_id,
|
135 |
'product_id' => $product_id,
|
136 |
'action' => $action,
|
137 |
+
'created_at' => $created_at,
|
138 |
);
|
139 |
}
|
140 |
+
if (count($data) > 0) {
|
|
|
141 |
$write_connection->insertMultiple($table_name, $data);
|
142 |
}
|
143 |
+
} catch (Exception $e) {
|
|
|
|
|
144 |
Mage::logException($e);
|
145 |
+
}
|
146 |
}
|
147 |
}
|
148 |
+
|
149 |
public function createStockActivity($quote_items)
|
150 |
{
|
151 |
+
try {
|
|
|
152 |
$resource = Mage::getSingleton('core/resource');
|
153 |
+
$write_connection = $resource->getConnection('core_write');
|
154 |
$table_name = $resource->getTableName('getready_kaas_activity');
|
155 |
+
|
156 |
$store_ids = $this->getAllStoreIds();
|
157 |
+
|
158 |
$products_ids = array();
|
159 |
+
foreach ($quote_items as $item) {
|
|
|
160 |
$products_ids[] = $item->getProductId();
|
161 |
}
|
162 |
|
163 |
//delete all activity by product ids
|
164 |
+
if (count($products_ids) > 0) {
|
165 |
+
$product_ids_string = implode(',', $products_ids);
|
|
|
166 |
$sql = "DELETE FROM `{$table_name}` WHERE product_id IN (:product_ids)";
|
167 |
$binds = array(
|
168 |
+
'product_ids' => $product_ids_string,
|
169 |
);
|
170 |
$write_connection->query($sql, $binds);
|
171 |
}
|
172 |
+
|
|
|
173 |
//add new activities
|
174 |
$action = 'update';
|
175 |
+
$created_at = now();
|
176 |
$data = array();
|
177 |
+
foreach ($quote_items as $item) {
|
|
|
178 |
$_product_id = $item->getProductId();
|
179 |
+
foreach ($store_ids as $_store_id) {
|
|
|
180 |
$data[] = array(
|
181 |
'store_id' => $_store_id,
|
182 |
'product_id' => $_product_id,
|
183 |
'action' => $action,
|
184 |
+
'created_at' => $created_at,
|
185 |
);
|
186 |
}
|
187 |
}
|
188 |
+
if (count($data) > 0) {
|
189 |
+
$write_connection->insertMultiple($table_name, $data);
|
|
|
190 |
}
|
191 |
+
} catch (Exception $e) {
|
|
|
|
|
192 |
Mage::logException($e);
|
193 |
}
|
194 |
}
|
195 |
+
|
196 |
+
public function deleteProductActivity($store_id, $product_id)
|
197 |
{
|
198 |
+
if ($store_id && $product_id) {
|
199 |
+
try {
|
|
|
|
|
200 |
$resource = Mage::getSingleton('core/resource');
|
201 |
+
$write_connection = $resource->getConnection('core_write');
|
202 |
$table_name = $resource->getTableName('getready_kaas_activity');
|
203 |
+
|
204 |
$sql = "DELETE FROM `{$table_name}` WHERE store_id = :store_id AND product_id = :product_id ";
|
205 |
$binds = array(
|
206 |
'store_id' => $store_id,
|
207 |
+
'product_id' => $product_id,
|
208 |
);
|
209 |
+
$write_connection->query($sql, $binds);
|
210 |
+
} catch (Exception $e) {
|
|
|
|
|
211 |
Mage::logException($e);
|
212 |
+
}
|
213 |
}
|
214 |
+
}
|
215 |
|
216 |
public function getActivityCollection($store_id)
|
217 |
{
|
218 |
+
$collection = Mage::getModel('kaas/activity')->getCollection();
|
219 |
+
$collection->addFieldToFilter('store_id', $store_id);
|
220 |
|
221 |
//$collection->addFieldToFilter('store_id', array('in' => array(0,$store_id)) );
|
222 |
|
223 |
return $collection;
|
224 |
}
|
225 |
+
|
226 |
public function clearActivityFeed($store)
|
227 |
{
|
228 |
$clered = false;
|
229 |
|
230 |
$store_id = $store->getId();
|
231 |
|
232 |
+
if ($store_id) {
|
233 |
+
try {
|
|
|
|
|
234 |
$resource = Mage::getSingleton('core/resource');
|
235 |
+
$write_connection = $resource->getConnection('core_write');
|
236 |
$table_name = $resource->getTableName('getready_kaas_activity');
|
237 |
+
|
238 |
$sql = "DELETE FROM `{$table_name}` WHERE store_id = :store_id ";
|
239 |
$binds = array(
|
240 |
+
'store_id' => $store_id,
|
241 |
);
|
242 |
$write_connection->query($sql, $binds);
|
243 |
$clered = true;
|
244 |
+
} catch (Exception $e) {
|
|
|
|
|
245 |
Mage::logException($e);
|
246 |
+
}
|
|
|
247 |
}
|
248 |
|
249 |
return $clered;
|
250 |
}
|
251 |
+
}
|
|
app/code/community/Getready/Kaas/Helper/Category/Cache/Data.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,46 +12,39 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Helper_Category_Cache_Data extends Mage_Core_Helper_Abstract
|
27 |
{
|
28 |
protected $_categories = array();
|
29 |
-
|
30 |
-
public function loadCategory($category_id
|
31 |
{
|
32 |
$category = Mage::getModel('catalog/category');
|
33 |
-
if($store_id)
|
34 |
-
{
|
35 |
$category->setStoreId($store_id);
|
36 |
}
|
37 |
-
$category->load($category_id);
|
38 |
-
|
|
|
39 |
}
|
40 |
-
|
41 |
-
public function getCategory($category_id
|
42 |
{
|
43 |
$category = null;
|
44 |
-
$category_key = $category_id
|
45 |
-
if(isset($this->_categories[$category_key]))
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
{
|
51 |
-
$category = $this->loadCategory($category_id,$store_id );
|
52 |
-
$this->_categories[$category_key] = $category;
|
53 |
}
|
|
|
54 |
return $category;
|
55 |
-
}
|
56 |
-
|
57 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Helper_Category_Cache_Data extends Mage_Core_Helper_Abstract
|
23 |
{
|
24 |
protected $_categories = array();
|
25 |
+
|
26 |
+
public function loadCategory($category_id, $store_id = 0)
|
27 |
{
|
28 |
$category = Mage::getModel('catalog/category');
|
29 |
+
if ($store_id) {
|
|
|
30 |
$category->setStoreId($store_id);
|
31 |
}
|
32 |
+
$category->load($category_id);
|
33 |
+
|
34 |
+
return $category;
|
35 |
}
|
36 |
+
|
37 |
+
public function getCategory($category_id, $store_id = 0)
|
38 |
{
|
39 |
$category = null;
|
40 |
+
$category_key = $category_id.'_'.$store_id;
|
41 |
+
if (isset($this->_categories[$category_key])) {
|
42 |
+
$category = $this->_categories[$category_key];
|
43 |
+
} else {
|
44 |
+
$category = $this->loadCategory($category_id, $store_id);
|
45 |
+
$this->_categories[$category_key] = $category;
|
|
|
|
|
|
|
46 |
}
|
47 |
+
|
48 |
return $category;
|
49 |
+
}
|
50 |
+
}
|
|
app/code/community/Getready/Kaas/Helper/Category/Data.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,35 +12,32 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Helper_Category_Data extends Mage_Core_Helper_Abstract
|
27 |
-
{
|
28 |
protected $_store_id = 0;
|
29 |
-
|
30 |
public function setStoreId($store_id)
|
31 |
{
|
32 |
$this->_store_id = $store_id;
|
|
|
33 |
return $this;
|
34 |
}
|
35 |
-
|
36 |
public function getStoreId()
|
37 |
{
|
38 |
return $this->_store_id;
|
39 |
}
|
40 |
-
|
41 |
-
public function getCategoryInfo($category
|
42 |
{
|
43 |
-
$category_info =
|
44 |
'category_id' => '',
|
45 |
'url' => '',
|
46 |
'path' => '',
|
@@ -48,40 +45,36 @@ class Getready_Kaas_Helper_Category_Data extends Mage_Core_Helper_Abstract
|
|
48 |
'path_url_key' => '',
|
49 |
'level' => '',
|
50 |
'parent_id' => '',
|
51 |
-
'parent_name' => '',
|
52 |
'root_id' => '',
|
53 |
'root_name' => '',
|
54 |
'description' => '',
|
55 |
-
'name' => '',
|
56 |
);
|
57 |
|
58 |
-
|
59 |
//general
|
60 |
$category_info['category_id'] = $category->getId();
|
61 |
|
62 |
//kaas
|
63 |
$base_url = Mage::app()->getStore($this->getStoreId())->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
|
64 |
$url_path = $category->getUrlPath();
|
65 |
-
$category_info['url'] = $base_url
|
66 |
|
67 |
-
$category_path_ids = $this->formatPathIdsForRootCategory($category->getPath()
|
68 |
|
69 |
$category_info['path'] = $this->getCategoryPath($category_path_ids);
|
70 |
$category_info['path_ids'] = $category_path_ids;
|
71 |
-
$category_info['path_url_key'] = $this->getCategoryUrlKey($category_path_ids);
|
72 |
|
73 |
$original_level = $category->getLevel();
|
74 |
-
$level = $this->formatLevelForRootCategory($original_level
|
75 |
-
$category_info['level'] = $level;
|
76 |
-
if($original_level == $root_level)
|
77 |
-
{
|
78 |
$category_info['parent_id'] = null;
|
79 |
$category_info['parent_name'] = null;
|
80 |
$category_info['root_id'] = $category->getId();
|
81 |
$category_info['root_name'] = $category->getName();
|
82 |
-
}
|
83 |
-
else
|
84 |
-
{
|
85 |
$parent_id = $category->getParentId();
|
86 |
$category_info['parent_id'] = $parent_id;
|
87 |
$category_info['parent_name'] = $this->getCategoryName($parent_id);
|
@@ -94,62 +87,62 @@ class Getready_Kaas_Helper_Category_Data extends Mage_Core_Helper_Abstract
|
|
94 |
$category_info['name'] = $category->getName();
|
95 |
|
96 |
return $category_info;
|
97 |
-
}
|
98 |
-
|
99 |
public function getCategory($category_id)
|
100 |
-
{
|
101 |
$store_id = $this->getStoreId();
|
102 |
-
|
|
|
103 |
}
|
104 |
-
|
105 |
public function formatPathIdsForRootCategory($category_path_ids, $root_level)
|
106 |
{
|
107 |
$formated_path_ids = $category_path_ids;
|
108 |
$path_ids_array = explode('/', $category_path_ids);
|
109 |
-
if(!empty($path_ids_array))
|
110 |
-
|
111 |
-
for($i=0;$i < $root_level;$i++)
|
112 |
-
{
|
113 |
unset($path_ids_array[$i]);
|
114 |
}
|
115 |
$formated_path_ids = implode('/', $path_ids_array);
|
116 |
}
|
|
|
117 |
return $formated_path_ids;
|
118 |
}
|
119 |
-
|
120 |
public function formatLevelForRootCategory($level, $root_level)
|
121 |
{
|
122 |
$formated_level = $level;
|
123 |
-
if($root_level > 1)
|
124 |
-
{
|
125 |
$formated_level = $level - $root_level + 1;
|
126 |
-
}
|
|
|
127 |
return $formated_level;
|
128 |
}
|
129 |
|
130 |
public function getCategoryPath($category_path_ids)
|
131 |
-
{
|
132 |
$category_path_array = array();
|
133 |
$path_ids_array = explode('/', $category_path_ids);
|
134 |
-
foreach($path_ids_array as $_category_id)
|
135 |
-
{
|
136 |
$category = $this->getCategory($_category_id);
|
137 |
$category_path_array[] = $category->getName();
|
138 |
}
|
139 |
$category_path = implode('/', $category_path_array);
|
|
|
140 |
return $category_path;
|
141 |
}
|
142 |
|
143 |
public function getCategoryUrlKey($category_path_ids)
|
144 |
-
{
|
145 |
$category_url_key_array = array();
|
146 |
$path_ids_array = explode('/', $category_path_ids);
|
147 |
-
foreach($path_ids_array as $_category_id)
|
148 |
-
{
|
149 |
$category = $this->getCategory($_category_id);
|
150 |
$category_url_key_array[] = $category->getUrlKey();
|
151 |
}
|
152 |
$category_url_key = implode('/', $category_url_key_array);
|
|
|
153 |
return $category_url_key;
|
154 |
}
|
155 |
|
@@ -157,21 +150,20 @@ class Getready_Kaas_Helper_Category_Data extends Mage_Core_Helper_Abstract
|
|
157 |
{
|
158 |
$parent_name = '';
|
159 |
$category = $this->getCategory($parent_id);
|
160 |
-
if($category->getId())
|
161 |
-
{
|
162 |
$parent_name = $category->getName();
|
163 |
}
|
|
|
164 |
return $parent_name;
|
165 |
}
|
166 |
|
167 |
public function getRootId($category_path_ids)
|
168 |
{
|
169 |
$path_ids_array = explode('/', $category_path_ids);
|
170 |
-
if(!empty($path_ids_array))
|
171 |
-
{
|
172 |
$root_id = $path_ids_array[0];
|
173 |
}
|
|
|
174 |
return $root_id;
|
175 |
}
|
176 |
-
|
177 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Helper_Category_Data extends Mage_Core_Helper_Abstract
|
23 |
+
{
|
24 |
protected $_store_id = 0;
|
25 |
+
|
26 |
public function setStoreId($store_id)
|
27 |
{
|
28 |
$this->_store_id = $store_id;
|
29 |
+
|
30 |
return $this;
|
31 |
}
|
32 |
+
|
33 |
public function getStoreId()
|
34 |
{
|
35 |
return $this->_store_id;
|
36 |
}
|
37 |
+
|
38 |
+
public function getCategoryInfo($category, $root_level = 0)
|
39 |
{
|
40 |
+
$category_info = array(
|
41 |
'category_id' => '',
|
42 |
'url' => '',
|
43 |
'path' => '',
|
45 |
'path_url_key' => '',
|
46 |
'level' => '',
|
47 |
'parent_id' => '',
|
48 |
+
'parent_name' => '',
|
49 |
'root_id' => '',
|
50 |
'root_name' => '',
|
51 |
'description' => '',
|
52 |
+
'name' => '',
|
53 |
);
|
54 |
|
|
|
55 |
//general
|
56 |
$category_info['category_id'] = $category->getId();
|
57 |
|
58 |
//kaas
|
59 |
$base_url = Mage::app()->getStore($this->getStoreId())->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
|
60 |
$url_path = $category->getUrlPath();
|
61 |
+
$category_info['url'] = $base_url.$url_path; //$category->getUrl();
|
62 |
|
63 |
+
$category_path_ids = $this->formatPathIdsForRootCategory($category->getPath(), $root_level);
|
64 |
|
65 |
$category_info['path'] = $this->getCategoryPath($category_path_ids);
|
66 |
$category_info['path_ids'] = $category_path_ids;
|
67 |
+
$category_info['path_url_key'] = $this->getCategoryUrlKey($category_path_ids);
|
68 |
|
69 |
$original_level = $category->getLevel();
|
70 |
+
$level = $this->formatLevelForRootCategory($original_level, $root_level);
|
71 |
+
$category_info['level'] = $level;
|
72 |
+
if ($original_level == $root_level) {
|
|
|
73 |
$category_info['parent_id'] = null;
|
74 |
$category_info['parent_name'] = null;
|
75 |
$category_info['root_id'] = $category->getId();
|
76 |
$category_info['root_name'] = $category->getName();
|
77 |
+
} else {
|
|
|
|
|
78 |
$parent_id = $category->getParentId();
|
79 |
$category_info['parent_id'] = $parent_id;
|
80 |
$category_info['parent_name'] = $this->getCategoryName($parent_id);
|
87 |
$category_info['name'] = $category->getName();
|
88 |
|
89 |
return $category_info;
|
90 |
+
}
|
91 |
+
|
92 |
public function getCategory($category_id)
|
93 |
+
{
|
94 |
$store_id = $this->getStoreId();
|
95 |
+
|
96 |
+
return Mage::Helper('kaas_category_cache')->getCategory($category_id, $store_id);
|
97 |
}
|
98 |
+
|
99 |
public function formatPathIdsForRootCategory($category_path_ids, $root_level)
|
100 |
{
|
101 |
$formated_path_ids = $category_path_ids;
|
102 |
$path_ids_array = explode('/', $category_path_ids);
|
103 |
+
if (!empty($path_ids_array)) {
|
104 |
+
for ($i = 0;$i < $root_level;++$i) {
|
|
|
|
|
105 |
unset($path_ids_array[$i]);
|
106 |
}
|
107 |
$formated_path_ids = implode('/', $path_ids_array);
|
108 |
}
|
109 |
+
|
110 |
return $formated_path_ids;
|
111 |
}
|
112 |
+
|
113 |
public function formatLevelForRootCategory($level, $root_level)
|
114 |
{
|
115 |
$formated_level = $level;
|
116 |
+
if ($root_level > 1) {
|
|
|
117 |
$formated_level = $level - $root_level + 1;
|
118 |
+
}
|
119 |
+
|
120 |
return $formated_level;
|
121 |
}
|
122 |
|
123 |
public function getCategoryPath($category_path_ids)
|
124 |
+
{
|
125 |
$category_path_array = array();
|
126 |
$path_ids_array = explode('/', $category_path_ids);
|
127 |
+
foreach ($path_ids_array as $_category_id) {
|
|
|
128 |
$category = $this->getCategory($_category_id);
|
129 |
$category_path_array[] = $category->getName();
|
130 |
}
|
131 |
$category_path = implode('/', $category_path_array);
|
132 |
+
|
133 |
return $category_path;
|
134 |
}
|
135 |
|
136 |
public function getCategoryUrlKey($category_path_ids)
|
137 |
+
{
|
138 |
$category_url_key_array = array();
|
139 |
$path_ids_array = explode('/', $category_path_ids);
|
140 |
+
foreach ($path_ids_array as $_category_id) {
|
|
|
141 |
$category = $this->getCategory($_category_id);
|
142 |
$category_url_key_array[] = $category->getUrlKey();
|
143 |
}
|
144 |
$category_url_key = implode('/', $category_url_key_array);
|
145 |
+
|
146 |
return $category_url_key;
|
147 |
}
|
148 |
|
150 |
{
|
151 |
$parent_name = '';
|
152 |
$category = $this->getCategory($parent_id);
|
153 |
+
if ($category->getId()) {
|
|
|
154 |
$parent_name = $category->getName();
|
155 |
}
|
156 |
+
|
157 |
return $parent_name;
|
158 |
}
|
159 |
|
160 |
public function getRootId($category_path_ids)
|
161 |
{
|
162 |
$path_ids_array = explode('/', $category_path_ids);
|
163 |
+
if (!empty($path_ids_array)) {
|
|
|
164 |
$root_id = $path_ids_array[0];
|
165 |
}
|
166 |
+
|
167 |
return $root_id;
|
168 |
}
|
169 |
+
}
|
|
app/code/community/Getready/Kaas/Helper/Data.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,23 +12,19 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Helper_Data extends Mage_Core_Helper_Abstract
|
27 |
{
|
28 |
const DEFAULT_ROOT_LEVEL = 2;
|
29 |
-
|
30 |
public function getDefaultRootLevel()
|
31 |
{
|
32 |
return self::DEFAULT_ROOT_LEVEL;
|
33 |
}
|
34 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Helper_Data extends Mage_Core_Helper_Abstract
|
23 |
{
|
24 |
const DEFAULT_ROOT_LEVEL = 2;
|
25 |
+
|
26 |
public function getDefaultRootLevel()
|
27 |
{
|
28 |
return self::DEFAULT_ROOT_LEVEL;
|
29 |
}
|
30 |
+
}
|
app/code/community/Getready/Kaas/Helper/Product/Category/Data.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,30 +12,27 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Helper_Product_Category_Data extends Mage_Core_Helper_Abstract
|
27 |
{
|
28 |
protected $_categories = array();
|
29 |
-
protected $_generated_categories = array();
|
30 |
-
|
31 |
protected $_store_id = 0;
|
32 |
-
|
33 |
public function setStoreId($store_id)
|
34 |
{
|
35 |
$this->_store_id = $store_id;
|
|
|
36 |
return $this;
|
37 |
}
|
38 |
-
|
39 |
public function getStoreId()
|
40 |
{
|
41 |
return $this->_store_id;
|
@@ -45,27 +42,24 @@ class Getready_Kaas_Helper_Product_Category_Data extends Mage_Core_Helper_Abstra
|
|
45 |
{
|
46 |
$category_info = array();
|
47 |
$store_id = $this->getStoreId();
|
48 |
-
$category_key = $category_id
|
49 |
-
if(isset($this->_generated_categories[$category_key]))
|
50 |
-
|
51 |
-
|
52 |
-
}
|
53 |
-
else
|
54 |
-
{
|
55 |
$category_info = $this->_generateCategoryInfo($category_id);
|
56 |
-
$this->_generated_categories[$category_key] = $category_info;
|
57 |
}
|
|
|
58 |
return $category_info;
|
59 |
}
|
60 |
-
|
61 |
public function _generateCategoryInfo($category_id)
|
62 |
{
|
63 |
$root_level = Mage::Helper('kaas')->getDefaultRootLevel(); // 1;
|
64 |
$category_info = null;
|
65 |
|
66 |
$category = $this->_getCategory($category_id);
|
67 |
-
if($category->getId() && $category->getIsActive())
|
68 |
-
{
|
69 |
$category_info = array(
|
70 |
'id' => '',
|
71 |
'name' => '',
|
@@ -79,138 +73,131 @@ class Getready_Kaas_Helper_Product_Category_Data extends Mage_Core_Helper_Abstra
|
|
79 |
'root_id' => '',
|
80 |
'root_name' => '',
|
81 |
);
|
82 |
-
|
83 |
$category_info['id'] = $category->getId();
|
84 |
$category_info['name'] = $category->getName();
|
85 |
-
|
86 |
$base_url = Mage::app()->getStore($this->getStoreId())->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
|
87 |
$url_path = $category->getUrlPath();
|
88 |
-
$category_info['url'] = $base_url
|
89 |
|
90 |
-
$category_path_ids = $this->_formatPathIdsForRootCategory($category->getPath()
|
91 |
|
92 |
$category_info['path_ids'] = $category_path_ids;
|
93 |
$category_info['path_url_key'] = $this->_getCategoryUrlKey($category_path_ids);
|
94 |
$category_info['path'] = $this->_getCategoryPath($category_path_ids);
|
95 |
|
96 |
$original_level = $category->getLevel();
|
97 |
-
$level = $this->_formatLevelForRootCategory($category->getLevel()
|
98 |
$category_info['level'] = $level;
|
99 |
|
100 |
-
if($original_level == $root_level)
|
101 |
-
{
|
102 |
$category_info['parent_id'] = null;
|
103 |
$category_info['parent_name'] = null;
|
104 |
|
105 |
$category_info['root_id'] = $category->getId();
|
106 |
-
$category_info['root_name'] = $category->getName();
|
107 |
-
}
|
108 |
-
else
|
109 |
-
{
|
110 |
$parent_id = $category->getParentId();
|
111 |
$category_info['parent_id'] = $parent_id;
|
112 |
$category_info['parent_name'] = $this->_getParentCategoryName($parent_id);
|
113 |
|
114 |
$root_id = $this->_getRootId($category_path_ids);
|
115 |
$category_info['root_id'] = $root_id;
|
116 |
-
$category_info['root_name'] = $this->_getParentCategoryName($root_id);
|
117 |
}
|
118 |
}
|
119 |
|
120 |
return $category_info;
|
121 |
}
|
122 |
-
|
123 |
public function _getCategory($category_id)
|
124 |
{
|
125 |
$category = null;
|
126 |
$store_id = $this->getStoreId();
|
127 |
-
$category_key = $category_id
|
128 |
-
if(isset($this->_categories[$category_key]))
|
129 |
-
|
130 |
-
|
131 |
-
}
|
132 |
-
else
|
133 |
-
{
|
134 |
$category = Mage::getModel('catalog/category');
|
135 |
-
if($store_id)
|
136 |
-
{
|
137 |
$category->setStoreId($store_id);
|
138 |
}
|
139 |
$category->load($category_id);
|
140 |
-
$this->_categories[$category_key] = $category;
|
141 |
}
|
|
|
142 |
return $category;
|
143 |
}
|
144 |
-
|
145 |
public function _formatPathIdsForRootCategory($category_path_ids, $root_level)
|
146 |
{
|
147 |
$formated_path_ids = $category_path_ids;
|
148 |
$path_ids_array = explode('/', $category_path_ids);
|
149 |
-
if(!empty($path_ids_array))
|
150 |
-
|
151 |
-
for($i=0;$i < $root_level;$i++)
|
152 |
-
{
|
153 |
unset($path_ids_array[$i]);
|
154 |
}
|
155 |
$formated_path_ids = implode('/', $path_ids_array);
|
156 |
}
|
|
|
157 |
return $formated_path_ids;
|
158 |
}
|
159 |
-
|
160 |
public function _formatLevelForRootCategory($level, $root_level)
|
161 |
{
|
162 |
$formated_level = $level;
|
163 |
-
if($root_level > 1)
|
164 |
-
{
|
165 |
$formated_level = $level - $root_level + 1;
|
166 |
-
}
|
|
|
167 |
return $formated_level;
|
168 |
}
|
169 |
-
|
170 |
public function _getCategoryPath($category_path_ids)
|
171 |
-
{
|
172 |
$category_path_array = array();
|
173 |
$path_ids_array = explode('/', $category_path_ids);
|
174 |
-
foreach($path_ids_array as $_category_id)
|
175 |
-
{
|
176 |
$category = $this->_getCategory($_category_id);
|
177 |
$category_path_array[] = $category->getName();
|
178 |
}
|
179 |
$category_path = implode('/', $category_path_array);
|
|
|
180 |
return $category_path;
|
181 |
}
|
182 |
-
|
183 |
public function _getCategoryUrlKey($category_path_ids)
|
184 |
-
{
|
185 |
$category_url_key_array = array();
|
186 |
$path_ids_array = explode('/', $category_path_ids);
|
187 |
-
foreach($path_ids_array as $_category_id)
|
188 |
-
{
|
189 |
$category = $this->_getCategory($_category_id);
|
190 |
$category_url_key_array[] = $category->getUrlKey();
|
191 |
}
|
192 |
$category_url_key = implode('/', $category_url_key_array);
|
|
|
193 |
return $category_url_key;
|
194 |
}
|
195 |
-
|
196 |
public function _getParentCategoryName($parent_id)
|
197 |
{
|
198 |
$parent_name = '';
|
199 |
$category = $this->_getCategory($parent_id);
|
200 |
-
if($category->getId())
|
201 |
-
{
|
202 |
$parent_name = $category->getName();
|
203 |
}
|
|
|
204 |
return $parent_name;
|
205 |
}
|
206 |
-
|
207 |
public function _getRootId($category_path_ids)
|
208 |
{
|
209 |
$path_ids_array = explode('/', $category_path_ids);
|
210 |
-
if(!empty($path_ids_array))
|
211 |
-
{
|
212 |
$root_id = $path_ids_array[0];
|
213 |
}
|
|
|
214 |
return $root_id;
|
215 |
}
|
216 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Helper_Product_Category_Data extends Mage_Core_Helper_Abstract
|
23 |
{
|
24 |
protected $_categories = array();
|
25 |
+
protected $_generated_categories = array();
|
26 |
+
|
27 |
protected $_store_id = 0;
|
28 |
+
|
29 |
public function setStoreId($store_id)
|
30 |
{
|
31 |
$this->_store_id = $store_id;
|
32 |
+
|
33 |
return $this;
|
34 |
}
|
35 |
+
|
36 |
public function getStoreId()
|
37 |
{
|
38 |
return $this->_store_id;
|
42 |
{
|
43 |
$category_info = array();
|
44 |
$store_id = $this->getStoreId();
|
45 |
+
$category_key = $category_id.'_'.$store_id;
|
46 |
+
if (isset($this->_generated_categories[$category_key])) {
|
47 |
+
$category_info = $this->_generated_categories[$category_key];
|
48 |
+
} else {
|
|
|
|
|
|
|
49 |
$category_info = $this->_generateCategoryInfo($category_id);
|
50 |
+
$this->_generated_categories[$category_key] = $category_info;
|
51 |
}
|
52 |
+
|
53 |
return $category_info;
|
54 |
}
|
55 |
+
|
56 |
public function _generateCategoryInfo($category_id)
|
57 |
{
|
58 |
$root_level = Mage::Helper('kaas')->getDefaultRootLevel(); // 1;
|
59 |
$category_info = null;
|
60 |
|
61 |
$category = $this->_getCategory($category_id);
|
62 |
+
if ($category->getId() && $category->getIsActive()) {
|
|
|
63 |
$category_info = array(
|
64 |
'id' => '',
|
65 |
'name' => '',
|
73 |
'root_id' => '',
|
74 |
'root_name' => '',
|
75 |
);
|
76 |
+
|
77 |
$category_info['id'] = $category->getId();
|
78 |
$category_info['name'] = $category->getName();
|
79 |
+
|
80 |
$base_url = Mage::app()->getStore($this->getStoreId())->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
|
81 |
$url_path = $category->getUrlPath();
|
82 |
+
$category_info['url'] = $base_url.$url_path; //$category->getUrl();
|
83 |
|
84 |
+
$category_path_ids = $this->_formatPathIdsForRootCategory($category->getPath(), $root_level);
|
85 |
|
86 |
$category_info['path_ids'] = $category_path_ids;
|
87 |
$category_info['path_url_key'] = $this->_getCategoryUrlKey($category_path_ids);
|
88 |
$category_info['path'] = $this->_getCategoryPath($category_path_ids);
|
89 |
|
90 |
$original_level = $category->getLevel();
|
91 |
+
$level = $this->_formatLevelForRootCategory($category->getLevel(), $root_level);
|
92 |
$category_info['level'] = $level;
|
93 |
|
94 |
+
if ($original_level == $root_level) {
|
|
|
95 |
$category_info['parent_id'] = null;
|
96 |
$category_info['parent_name'] = null;
|
97 |
|
98 |
$category_info['root_id'] = $category->getId();
|
99 |
+
$category_info['root_name'] = $category->getName();
|
100 |
+
} else {
|
|
|
|
|
101 |
$parent_id = $category->getParentId();
|
102 |
$category_info['parent_id'] = $parent_id;
|
103 |
$category_info['parent_name'] = $this->_getParentCategoryName($parent_id);
|
104 |
|
105 |
$root_id = $this->_getRootId($category_path_ids);
|
106 |
$category_info['root_id'] = $root_id;
|
107 |
+
$category_info['root_name'] = $this->_getParentCategoryName($root_id);
|
108 |
}
|
109 |
}
|
110 |
|
111 |
return $category_info;
|
112 |
}
|
113 |
+
|
114 |
public function _getCategory($category_id)
|
115 |
{
|
116 |
$category = null;
|
117 |
$store_id = $this->getStoreId();
|
118 |
+
$category_key = $category_id.'_'.$store_id;
|
119 |
+
if (isset($this->_categories[$category_key])) {
|
120 |
+
$category = $this->_categories[$category_key];
|
121 |
+
} else {
|
|
|
|
|
|
|
122 |
$category = Mage::getModel('catalog/category');
|
123 |
+
if ($store_id) {
|
|
|
124 |
$category->setStoreId($store_id);
|
125 |
}
|
126 |
$category->load($category_id);
|
127 |
+
$this->_categories[$category_key] = $category;
|
128 |
}
|
129 |
+
|
130 |
return $category;
|
131 |
}
|
132 |
+
|
133 |
public function _formatPathIdsForRootCategory($category_path_ids, $root_level)
|
134 |
{
|
135 |
$formated_path_ids = $category_path_ids;
|
136 |
$path_ids_array = explode('/', $category_path_ids);
|
137 |
+
if (!empty($path_ids_array)) {
|
138 |
+
for ($i = 0;$i < $root_level;++$i) {
|
|
|
|
|
139 |
unset($path_ids_array[$i]);
|
140 |
}
|
141 |
$formated_path_ids = implode('/', $path_ids_array);
|
142 |
}
|
143 |
+
|
144 |
return $formated_path_ids;
|
145 |
}
|
146 |
+
|
147 |
public function _formatLevelForRootCategory($level, $root_level)
|
148 |
{
|
149 |
$formated_level = $level;
|
150 |
+
if ($root_level > 1) {
|
|
|
151 |
$formated_level = $level - $root_level + 1;
|
152 |
+
}
|
153 |
+
|
154 |
return $formated_level;
|
155 |
}
|
156 |
+
|
157 |
public function _getCategoryPath($category_path_ids)
|
158 |
+
{
|
159 |
$category_path_array = array();
|
160 |
$path_ids_array = explode('/', $category_path_ids);
|
161 |
+
foreach ($path_ids_array as $_category_id) {
|
|
|
162 |
$category = $this->_getCategory($_category_id);
|
163 |
$category_path_array[] = $category->getName();
|
164 |
}
|
165 |
$category_path = implode('/', $category_path_array);
|
166 |
+
|
167 |
return $category_path;
|
168 |
}
|
169 |
+
|
170 |
public function _getCategoryUrlKey($category_path_ids)
|
171 |
+
{
|
172 |
$category_url_key_array = array();
|
173 |
$path_ids_array = explode('/', $category_path_ids);
|
174 |
+
foreach ($path_ids_array as $_category_id) {
|
|
|
175 |
$category = $this->_getCategory($_category_id);
|
176 |
$category_url_key_array[] = $category->getUrlKey();
|
177 |
}
|
178 |
$category_url_key = implode('/', $category_url_key_array);
|
179 |
+
|
180 |
return $category_url_key;
|
181 |
}
|
182 |
+
|
183 |
public function _getParentCategoryName($parent_id)
|
184 |
{
|
185 |
$parent_name = '';
|
186 |
$category = $this->_getCategory($parent_id);
|
187 |
+
if ($category->getId()) {
|
|
|
188 |
$parent_name = $category->getName();
|
189 |
}
|
190 |
+
|
191 |
return $parent_name;
|
192 |
}
|
193 |
+
|
194 |
public function _getRootId($category_path_ids)
|
195 |
{
|
196 |
$path_ids_array = explode('/', $category_path_ids);
|
197 |
+
if (!empty($path_ids_array)) {
|
|
|
198 |
$root_id = $path_ids_array[0];
|
199 |
}
|
200 |
+
|
201 |
return $root_id;
|
202 |
}
|
203 |
+
}
|
app/code/community/Getready/Kaas/Helper/Product/Data.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,35 +12,32 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Helper_Product_Data extends Mage_Core_Helper_Abstract
|
27 |
{
|
28 |
protected $_store_id = 0;
|
29 |
-
|
30 |
public function setStoreId($store_id)
|
31 |
{
|
32 |
$this->_store_id = $store_id;
|
|
|
33 |
return $this;
|
34 |
}
|
35 |
-
|
36 |
public function getStoreId()
|
37 |
{
|
38 |
return $this->_store_id;
|
39 |
}
|
40 |
-
|
41 |
public function getProductInfo($product)
|
42 |
{
|
43 |
-
$product_info =
|
44 |
//header
|
45 |
'product_id' => '',
|
46 |
'group_id' => '',
|
@@ -49,13 +46,13 @@ class Getready_Kaas_Helper_Product_Data extends Mage_Core_Helper_Abstract
|
|
49 |
'creation_datetime' => '',
|
50 |
'creation_date' => '',
|
51 |
'creation_time' => '',
|
52 |
-
'updated_at' => array('sec' => '', 'usec' => ''),
|
53 |
'updated_datetime' => '',
|
54 |
'updated_date' => '',
|
55 |
'updated_time' => '',
|
56 |
'is_visible' => '',
|
57 |
'is_parent' => '',
|
58 |
-
'is_child' => '',
|
59 |
//flat
|
60 |
'flat' => array(),
|
61 |
//price
|
@@ -70,7 +67,7 @@ class Getready_Kaas_Helper_Product_Data extends Mage_Core_Helper_Abstract
|
|
70 |
'qty' => 0,
|
71 |
'stock_status' => false,
|
72 |
//media
|
73 |
-
'gallery' => array(),
|
74 |
//category
|
75 |
'category' => array(),
|
76 |
'children' => array(),
|
@@ -78,39 +75,38 @@ class Getready_Kaas_Helper_Product_Data extends Mage_Core_Helper_Abstract
|
|
78 |
|
79 |
//header
|
80 |
$product_info['product_id'] = $product->getId();
|
81 |
-
|
82 |
$product_info['url'] = $product->getProductUrl();
|
83 |
$created_at = $product->getCreatedAt();
|
84 |
|
85 |
$product_info['created_at'] = array(
|
86 |
'sec' => strtotime($created_at),
|
87 |
-
'usec' => 0
|
88 |
);
|
89 |
$product_info['creation_datetime'] = date('Y-m-d H:i:s', strtotime($created_at));
|
90 |
$product_info['creation_date'] = date('Y-m-d', strtotime($created_at));
|
91 |
$product_info['creation_time'] = date('H:i:s', strtotime($created_at));
|
92 |
|
93 |
-
$updated_at = $product->getUpdatedAt();
|
94 |
$product_info['updated_at'] = array(
|
95 |
'sec' => strtotime($updated_at),
|
96 |
-
'usec' => 0
|
97 |
);
|
98 |
$product_info['updated_datetime'] = date('Y-m-d H:i:s', strtotime($updated_at));
|
99 |
$product_info['updated_date'] = date('Y-m-d', strtotime($updated_at));
|
100 |
$product_info['updated_time'] = date('H:i:s', strtotime($updated_at));
|
101 |
|
102 |
$visibility = false;
|
103 |
-
if($product->getVisibility() == '2' || $product->getVisibility() == '4')
|
104 |
-
{
|
105 |
$visibility = true;
|
106 |
}
|
107 |
$product_info['is_visible'] = $visibility;
|
108 |
$product_info['is_parent'] = $this->_isParent($product);
|
109 |
-
$product_info['is_child'] = $this->_isChild($product);
|
110 |
|
111 |
//flat
|
112 |
$flat_attributes = $this->_getFlatAttributes($product);
|
113 |
-
$product_info['flat'] = $flat_attributes;
|
114 |
|
115 |
//price
|
116 |
$prices = $this->_getPrices($product);
|
@@ -119,15 +115,15 @@ class Getready_Kaas_Helper_Product_Data extends Mage_Core_Helper_Abstract
|
|
119 |
$product_info['price_original_exclude_tax'] = $prices['price_original_exclude_tax'];
|
120 |
$product_info['price_final_include_tax'] = $prices['price_final_include_tax'];
|
121 |
$product_info['price_final_exclude_tax'] = $prices['price_final_exclude_tax'];
|
122 |
-
$product_info['price_cost'] = $prices['price_cost'];
|
123 |
$product_info['tax_percent'] = $prices['tax_percent'];
|
124 |
$product_info['discount'] = $prices['discount'];
|
125 |
|
126 |
//inventory
|
127 |
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
128 |
//$product_info['qty'] = (int)number_format($stock->getQty(),0);
|
129 |
-
$product_info['qty'] = (int)$stock->getQty();
|
130 |
-
$product_info['stock_status'] = (boolean)$stock->getIsInStock();
|
131 |
|
132 |
//media
|
133 |
$product_info['gallery'] = $this->_getGallery($product);
|
@@ -140,104 +136,108 @@ class Getready_Kaas_Helper_Product_Data extends Mage_Core_Helper_Abstract
|
|
140 |
|
141 |
return $product_info;
|
142 |
}
|
143 |
-
|
144 |
public function _getGroupId($product)
|
145 |
{
|
146 |
-
$group_id =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
return $group_id;
|
148 |
}
|
149 |
-
|
150 |
public function _isParent($product)
|
151 |
{
|
152 |
$is_parent = false;
|
153 |
$product_id = $product->getId();
|
154 |
|
155 |
-
if($product->getTypeId() != 'simple'
|
156 |
-
{
|
157 |
$child_ids = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($product_id);
|
158 |
-
if(!$child_ids)
|
159 |
-
|
160 |
-
$child_ids = Mage::getModel('catalog/product_type_grouped')->getChildrenIds($product_id);
|
161 |
}
|
162 |
|
163 |
-
//
|
164 |
-
//
|
165 |
-
//
|
166 |
-
//
|
167 |
|
168 |
-
if($child_ids)
|
169 |
-
|
170 |
-
$is_parent = true;
|
171 |
}
|
172 |
}
|
173 |
|
174 |
return $is_parent;
|
175 |
}
|
176 |
-
|
177 |
-
public function _isChild($product)
|
178 |
{
|
179 |
$is_child = false;
|
180 |
$product_id = $product->getId();
|
181 |
|
182 |
-
if($product->getTypeId() == 'simple'
|
183 |
-
{
|
184 |
$parent_ids = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product_id);
|
185 |
-
if(!$parent_ids)
|
186 |
-
{
|
187 |
$parent_ids = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product_id);
|
188 |
}
|
189 |
|
190 |
-
//
|
191 |
-
//
|
192 |
-
//
|
193 |
-
//
|
194 |
|
195 |
-
if($parent_ids)
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
|
|
|
|
199 |
}
|
200 |
|
201 |
return $is_child;
|
202 |
}
|
203 |
-
|
204 |
public function _getChildren($product)
|
205 |
{
|
206 |
$children = array();
|
207 |
$product_id = $product->getId();
|
208 |
|
209 |
-
if($product->getTypeId() != 'simple'
|
210 |
-
|
211 |
-
|
212 |
-
if(isset($conf_child_ids[0]))
|
213 |
-
{
|
214 |
$child_ids = $conf_child_ids[0];
|
215 |
-
foreach($child_ids as $child_id)
|
216 |
-
{
|
217 |
$children[] = $child_id;
|
218 |
}
|
219 |
}
|
220 |
|
221 |
$group_child_ids = Mage::getModel('catalog/product_type_grouped')->getChildrenIds($product_id);
|
222 |
-
if(isset($group_child_ids[Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED]))
|
223 |
-
{
|
224 |
$child_ids = $group_child_ids[Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED];
|
225 |
-
foreach($child_ids as $child_id)
|
226 |
-
{
|
227 |
$children[] = $child_id;
|
228 |
}
|
229 |
}
|
230 |
|
231 |
-
//
|
232 |
-
//
|
233 |
-
//
|
234 |
-
//
|
235 |
-
//
|
236 |
}
|
237 |
|
238 |
return $children;
|
239 |
}
|
240 |
-
|
241 |
public function _getFlatAttributes($product)
|
242 |
{
|
243 |
$flat_attributes = array();
|
@@ -264,70 +264,62 @@ class Getready_Kaas_Helper_Product_Data extends Mage_Core_Helper_Abstract
|
|
264 |
'options_container',
|
265 |
'thumbnail_label',
|
266 |
'image_label',
|
267 |
-
'small_image_label'
|
268 |
);
|
269 |
-
foreach ($attributes as $attribute)
|
270 |
-
{
|
271 |
$attributeCode = $attribute->getAttributeCode();
|
272 |
-
if (!in_array($attributeCode, $not_exported_attributes_codes))
|
273 |
-
|
274 |
-
$
|
275 |
-
$value = $attribute->getFrontend()->getValue($product);
|
276 |
|
277 |
$flat_attribute = array(
|
278 |
'code' => $attributeCode,
|
279 |
'label' => $label,
|
280 |
-
'value' => $this->_getProductAttributeValue($product
|
281 |
);
|
282 |
|
283 |
$flat_attributes[] = $flat_attribute;
|
284 |
}
|
285 |
-
}
|
286 |
|
287 |
return $flat_attributes;
|
288 |
}
|
289 |
-
|
290 |
-
public function _getProductAttributeValue($product
|
291 |
{
|
292 |
$formated_value = $attribute->getFrontend()->getValue($product);
|
293 |
|
294 |
$attributeCode = $attribute->getAttributeCode();
|
295 |
-
if($attributeCode == 'image')
|
296 |
-
{
|
297 |
$base_image = $product->getImage();
|
298 |
-
if($base_image)
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
}
|
303 |
-
elseif($attributeCode == 'small_image')
|
304 |
-
{
|
305 |
$small_image = $product->getSmallImage();
|
306 |
-
if($small_image)
|
307 |
-
|
308 |
-
$formated_value = Mage::getModel('catalog/product_media_config')->getMediaUrl( $small_image);
|
309 |
}
|
310 |
-
}
|
311 |
-
elseif($attributeCode == 'thumbnail')
|
312 |
-
{
|
313 |
$thumbnail = $product->getThumbnail();
|
314 |
-
if($thumbnail)
|
315 |
-
|
316 |
-
$formated_value = Mage::getModel('catalog/product_media_config')->getMediaUrl( $thumbnail);
|
317 |
}
|
318 |
}
|
319 |
|
320 |
$backend_type = $attribute->getBackendType();
|
321 |
-
switch ($backend_type)
|
322 |
-
{
|
323 |
case 'decimal':
|
324 |
-
$formated_value = number_format($formated_value,2);
|
|
|
|
|
|
|
325 |
break;
|
326 |
}
|
327 |
|
328 |
return $formated_value;
|
329 |
}
|
330 |
-
|
331 |
public function _getPrices($product)
|
332 |
{
|
333 |
$prices = array(
|
@@ -337,7 +329,7 @@ class Getready_Kaas_Helper_Product_Data extends Mage_Core_Helper_Abstract
|
|
337 |
'price_final_exclude_tax' => 0,
|
338 |
'price_cost' => 0,
|
339 |
'tax_percent' => 0,
|
340 |
-
'discount' => 0,
|
341 |
);
|
342 |
|
343 |
//price
|
@@ -357,96 +349,88 @@ class Getready_Kaas_Helper_Product_Data extends Mage_Core_Helper_Abstract
|
|
357 |
$prices['price_final_exclude_tax'] = (double) $final_price; //number_format($final_price,2);
|
358 |
|
359 |
//cost
|
360 |
-
$prices['price_cost'] = (double)number_format($product->getCost(),2);
|
361 |
|
362 |
//tax
|
363 |
-
$prices['tax_percent'] = (double)$this->_getTax($product);
|
364 |
|
365 |
//discount
|
366 |
-
$discount = abs((double)$price_incl_tax - (double)$final_price_incl_tax);
|
367 |
-
$prices['discount'] = (double)number_format($discount,2);
|
368 |
|
369 |
return $prices;
|
370 |
}
|
371 |
-
|
372 |
public function _getTax($product)
|
373 |
{
|
374 |
$tax = 0;
|
375 |
-
$store_id = $product->getStoreId();
|
376 |
|
377 |
-
if($store_id)
|
378 |
-
|
379 |
-
$store
|
380 |
-
if($store->getId())
|
381 |
-
{
|
382 |
$taxCalculation = Mage::getModel('tax/calculation');
|
383 |
$request = $taxCalculation->getRateRequest(null, null, null, $store);
|
384 |
$taxClassId = $product->getTaxClassId();
|
385 |
-
$tax = $taxCalculation->getRate($request->setProductClassId($taxClassId));
|
386 |
}
|
387 |
}
|
|
|
388 |
return $tax;
|
389 |
}
|
390 |
-
|
391 |
//nepouziva se
|
392 |
public function _getImages($product)
|
393 |
{
|
394 |
$images = array(
|
395 |
'thumbnail' => '',
|
396 |
'small_image' => '',
|
397 |
-
'image' => ''
|
398 |
);
|
399 |
|
400 |
$thumbnail = $product->getThumbnail();
|
401 |
-
if($thumbnail)
|
402 |
-
|
403 |
-
$images['thumbnail'] = Mage::getModel('catalog/product_media_config')->getMediaUrl( $thumbnail); //(string)Mage::Helper('catalog/image')->init($product, 'thumbnail');
|
404 |
}
|
405 |
$small_image = $product->getSmallImage();
|
406 |
-
if($small_image)
|
407 |
-
|
408 |
-
$images['small_image'] = Mage::getModel('catalog/product_media_config')->getMediaUrl( $small_image); //(string)Mage::Helper('catalog/image')->init($product, 'small_image');
|
409 |
}
|
410 |
$base_image = $product->getImage();
|
411 |
-
if($base_image)
|
412 |
-
|
413 |
-
$images['image'] = Mage::getModel('catalog/product_media_config')->getMediaUrl( $base_image); //(string)Mage::Helper('catalog/image')->init($product, 'image');
|
414 |
}
|
415 |
|
416 |
return $images;
|
417 |
}
|
418 |
-
|
419 |
public function _getGallery($product)
|
420 |
{
|
421 |
$gallery = array();
|
422 |
|
423 |
-
foreach ($product->getMediaGalleryImages() as $image)
|
424 |
-
{
|
425 |
$product_image = array(
|
426 |
'label' => $image->getLabel(),
|
427 |
'thumbnail_image' => $image->getUrl(),
|
428 |
'small_image' => $image->getUrl(),
|
429 |
'base_image' => $image->getUrl(),
|
430 |
);
|
431 |
-
$gallery[] = $product_image;
|
432 |
-
}
|
433 |
|
434 |
return $gallery;
|
435 |
}
|
436 |
-
|
437 |
public function _getCategory($product)
|
438 |
{
|
439 |
$category = array();
|
440 |
$product_category_helper = Mage::Helper('kaas_product_category')->setStoreId($this->getStoreId());
|
441 |
|
442 |
$category_ids = $product->getCategoryIds();
|
443 |
-
foreach($category_ids as $category_id)
|
444 |
-
|
445 |
-
if(Mage::Helper('kaas_product_store')->isStoreCategory($category_id,$product->getStoreId()))
|
446 |
-
{
|
447 |
$category_info = $product_category_helper->getCategoryInfo($category_id);
|
448 |
-
if($category_info && isset($category_info['level']) && $category_info['level'] > 0
|
449 |
-
{
|
450 |
$category[] = $category_info;
|
451 |
}
|
452 |
}
|
@@ -454,5 +438,14 @@ class Getready_Kaas_Helper_Product_Data extends Mage_Core_Helper_Abstract
|
|
454 |
|
455 |
return $category;
|
456 |
}
|
457 |
-
|
458 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Helper_Product_Data extends Mage_Core_Helper_Abstract
|
23 |
{
|
24 |
protected $_store_id = 0;
|
25 |
+
|
26 |
public function setStoreId($store_id)
|
27 |
{
|
28 |
$this->_store_id = $store_id;
|
29 |
+
|
30 |
return $this;
|
31 |
}
|
32 |
+
|
33 |
public function getStoreId()
|
34 |
{
|
35 |
return $this->_store_id;
|
36 |
}
|
37 |
+
|
38 |
public function getProductInfo($product)
|
39 |
{
|
40 |
+
$product_info = array(
|
41 |
//header
|
42 |
'product_id' => '',
|
43 |
'group_id' => '',
|
46 |
'creation_datetime' => '',
|
47 |
'creation_date' => '',
|
48 |
'creation_time' => '',
|
49 |
+
'updated_at' => array('sec' => '', 'usec' => ''),
|
50 |
'updated_datetime' => '',
|
51 |
'updated_date' => '',
|
52 |
'updated_time' => '',
|
53 |
'is_visible' => '',
|
54 |
'is_parent' => '',
|
55 |
+
'is_child' => '',
|
56 |
//flat
|
57 |
'flat' => array(),
|
58 |
//price
|
67 |
'qty' => 0,
|
68 |
'stock_status' => false,
|
69 |
//media
|
70 |
+
'gallery' => array(),
|
71 |
//category
|
72 |
'category' => array(),
|
73 |
'children' => array(),
|
75 |
|
76 |
//header
|
77 |
$product_info['product_id'] = $product->getId();
|
78 |
+
$product_info['group_id'] = $this->_getGroupId($product);
|
79 |
$product_info['url'] = $product->getProductUrl();
|
80 |
$created_at = $product->getCreatedAt();
|
81 |
|
82 |
$product_info['created_at'] = array(
|
83 |
'sec' => strtotime($created_at),
|
84 |
+
'usec' => 0,
|
85 |
);
|
86 |
$product_info['creation_datetime'] = date('Y-m-d H:i:s', strtotime($created_at));
|
87 |
$product_info['creation_date'] = date('Y-m-d', strtotime($created_at));
|
88 |
$product_info['creation_time'] = date('H:i:s', strtotime($created_at));
|
89 |
|
90 |
+
$updated_at = $product->getUpdatedAt();
|
91 |
$product_info['updated_at'] = array(
|
92 |
'sec' => strtotime($updated_at),
|
93 |
+
'usec' => 0,
|
94 |
);
|
95 |
$product_info['updated_datetime'] = date('Y-m-d H:i:s', strtotime($updated_at));
|
96 |
$product_info['updated_date'] = date('Y-m-d', strtotime($updated_at));
|
97 |
$product_info['updated_time'] = date('H:i:s', strtotime($updated_at));
|
98 |
|
99 |
$visibility = false;
|
100 |
+
if ($product->getVisibility() == '2' || $product->getVisibility() == '4') {
|
|
|
101 |
$visibility = true;
|
102 |
}
|
103 |
$product_info['is_visible'] = $visibility;
|
104 |
$product_info['is_parent'] = $this->_isParent($product);
|
105 |
+
$product_info['is_child'] = (bool) $this->_isChild($product, false);
|
106 |
|
107 |
//flat
|
108 |
$flat_attributes = $this->_getFlatAttributes($product);
|
109 |
+
$product_info['flat'] = $flat_attributes;
|
110 |
|
111 |
//price
|
112 |
$prices = $this->_getPrices($product);
|
115 |
$product_info['price_original_exclude_tax'] = $prices['price_original_exclude_tax'];
|
116 |
$product_info['price_final_include_tax'] = $prices['price_final_include_tax'];
|
117 |
$product_info['price_final_exclude_tax'] = $prices['price_final_exclude_tax'];
|
118 |
+
$product_info['price_cost'] = $prices['price_cost'];
|
119 |
$product_info['tax_percent'] = $prices['tax_percent'];
|
120 |
$product_info['discount'] = $prices['discount'];
|
121 |
|
122 |
//inventory
|
123 |
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
124 |
//$product_info['qty'] = (int)number_format($stock->getQty(),0);
|
125 |
+
$product_info['qty'] = (int) $stock->getQty();
|
126 |
+
$product_info['stock_status'] = (boolean) $stock->getIsInStock();
|
127 |
|
128 |
//media
|
129 |
$product_info['gallery'] = $this->_getGallery($product);
|
136 |
|
137 |
return $product_info;
|
138 |
}
|
139 |
+
|
140 |
public function _getGroupId($product)
|
141 |
{
|
142 |
+
$group_id = $product->getId();
|
143 |
+
|
144 |
+
$is_parent = $this->_isParent($product);
|
145 |
+
$is_child = false;
|
146 |
+
if (!$is_parent) {
|
147 |
+
$parent_id = $this->_isChild($product, true);
|
148 |
+
if ($parent_id) {
|
149 |
+
$group_id = $parent_id;
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
return $group_id;
|
154 |
}
|
155 |
+
|
156 |
public function _isParent($product)
|
157 |
{
|
158 |
$is_parent = false;
|
159 |
$product_id = $product->getId();
|
160 |
|
161 |
+
if ($product->getTypeId() != 'simple') {
|
|
|
162 |
$child_ids = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($product_id);
|
163 |
+
if (!$child_ids) {
|
164 |
+
$child_ids = Mage::getModel('catalog/product_type_grouped')->getChildrenIds($product_id);
|
|
|
165 |
}
|
166 |
|
167 |
+
// if(!$child_ids)
|
168 |
+
// {
|
169 |
+
// $child_ids = Mage::getModel('bundle/product_type')->getChildrenIds($product_id);
|
170 |
+
// }
|
171 |
|
172 |
+
if ($child_ids) {
|
173 |
+
$is_parent = true;
|
|
|
174 |
}
|
175 |
}
|
176 |
|
177 |
return $is_parent;
|
178 |
}
|
179 |
+
|
180 |
+
public function _isChild($product, $return_parent_id = false)
|
181 |
{
|
182 |
$is_child = false;
|
183 |
$product_id = $product->getId();
|
184 |
|
185 |
+
if ($product->getTypeId() == 'simple') {
|
|
|
186 |
$parent_ids = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product_id);
|
187 |
+
if (!$parent_ids) {
|
|
|
188 |
$parent_ids = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product_id);
|
189 |
}
|
190 |
|
191 |
+
// if(!$parent_ids)
|
192 |
+
// {
|
193 |
+
// $parent_ids = $parent_ids = Mage::getModel('bundle/product_type')->getParentIdsByChild($product_id);
|
194 |
+
// }
|
195 |
|
196 |
+
if ($parent_ids) {
|
197 |
+
if ( $return_parent_id ) {
|
198 |
+
$is_child = reset($parent_ids);
|
199 |
+
} else {
|
200 |
+
$is_child = true;
|
201 |
+
}
|
202 |
+
|
203 |
+
}
|
204 |
}
|
205 |
|
206 |
return $is_child;
|
207 |
}
|
208 |
+
|
209 |
public function _getChildren($product)
|
210 |
{
|
211 |
$children = array();
|
212 |
$product_id = $product->getId();
|
213 |
|
214 |
+
if ($product->getTypeId() != 'simple') {
|
215 |
+
$conf_child_ids = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($product_id);
|
216 |
+
if (isset($conf_child_ids[0])) {
|
|
|
|
|
217 |
$child_ids = $conf_child_ids[0];
|
218 |
+
foreach ($child_ids as $child_id) {
|
|
|
219 |
$children[] = $child_id;
|
220 |
}
|
221 |
}
|
222 |
|
223 |
$group_child_ids = Mage::getModel('catalog/product_type_grouped')->getChildrenIds($product_id);
|
224 |
+
if (isset($group_child_ids[Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED])) {
|
|
|
225 |
$child_ids = $group_child_ids[Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED];
|
226 |
+
foreach ($child_ids as $child_id) {
|
|
|
227 |
$children[] = $child_id;
|
228 |
}
|
229 |
}
|
230 |
|
231 |
+
// $bundle_child_ids = Mage::getModel('bundle/product_type')->getChildrenIds($product_id);
|
232 |
+
// foreach($bundle_child_ids as $child_id)
|
233 |
+
// {
|
234 |
+
// $children[] = $child_id;
|
235 |
+
// }
|
236 |
}
|
237 |
|
238 |
return $children;
|
239 |
}
|
240 |
+
|
241 |
public function _getFlatAttributes($product)
|
242 |
{
|
243 |
$flat_attributes = array();
|
264 |
'options_container',
|
265 |
'thumbnail_label',
|
266 |
'image_label',
|
267 |
+
'small_image_label',
|
268 |
);
|
269 |
+
foreach ($attributes as $attribute) {
|
|
|
270 |
$attributeCode = $attribute->getAttributeCode();
|
271 |
+
if (!in_array($attributeCode, $not_exported_attributes_codes)) {
|
272 |
+
$label = $attribute->getStoreLabel($product->getStoreId());
|
273 |
+
$value = $attribute->getFrontend()->getValue($product);
|
|
|
274 |
|
275 |
$flat_attribute = array(
|
276 |
'code' => $attributeCode,
|
277 |
'label' => $label,
|
278 |
+
'value' => $this->_getProductAttributeValue($product, $attribute),
|
279 |
);
|
280 |
|
281 |
$flat_attributes[] = $flat_attribute;
|
282 |
}
|
283 |
+
}
|
284 |
|
285 |
return $flat_attributes;
|
286 |
}
|
287 |
+
|
288 |
+
public function _getProductAttributeValue($product, $attribute)
|
289 |
{
|
290 |
$formated_value = $attribute->getFrontend()->getValue($product);
|
291 |
|
292 |
$attributeCode = $attribute->getAttributeCode();
|
293 |
+
if ($attributeCode == 'image') {
|
|
|
294 |
$base_image = $product->getImage();
|
295 |
+
if ($base_image) {
|
296 |
+
$formated_value = Mage::getModel('catalog/product_media_config')->getMediaUrl($base_image);
|
297 |
+
}
|
298 |
+
} elseif ($attributeCode == 'small_image') {
|
|
|
|
|
|
|
299 |
$small_image = $product->getSmallImage();
|
300 |
+
if ($small_image) {
|
301 |
+
$formated_value = Mage::getModel('catalog/product_media_config')->getMediaUrl($small_image);
|
|
|
302 |
}
|
303 |
+
} elseif ($attributeCode == 'thumbnail') {
|
|
|
|
|
304 |
$thumbnail = $product->getThumbnail();
|
305 |
+
if ($thumbnail) {
|
306 |
+
$formated_value = Mage::getModel('catalog/product_media_config')->getMediaUrl($thumbnail);
|
|
|
307 |
}
|
308 |
}
|
309 |
|
310 |
$backend_type = $attribute->getBackendType();
|
311 |
+
switch ($backend_type) {
|
|
|
312 |
case 'decimal':
|
313 |
+
$formated_value = number_format($formated_value, 2);
|
314 |
+
break;
|
315 |
+
case 'datetime':
|
316 |
+
$formated_value = $this->_format_datetime($formated_value);
|
317 |
break;
|
318 |
}
|
319 |
|
320 |
return $formated_value;
|
321 |
}
|
322 |
+
|
323 |
public function _getPrices($product)
|
324 |
{
|
325 |
$prices = array(
|
329 |
'price_final_exclude_tax' => 0,
|
330 |
'price_cost' => 0,
|
331 |
'tax_percent' => 0,
|
332 |
+
'discount' => 0,
|
333 |
);
|
334 |
|
335 |
//price
|
349 |
$prices['price_final_exclude_tax'] = (double) $final_price; //number_format($final_price,2);
|
350 |
|
351 |
//cost
|
352 |
+
$prices['price_cost'] = (double) number_format($product->getCost(), 2);
|
353 |
|
354 |
//tax
|
355 |
+
$prices['tax_percent'] = (double) $this->_getTax($product);
|
356 |
|
357 |
//discount
|
358 |
+
$discount = abs((double) $price_incl_tax - (double) $final_price_incl_tax);
|
359 |
+
$prices['discount'] = (double) number_format($discount, 2);
|
360 |
|
361 |
return $prices;
|
362 |
}
|
363 |
+
|
364 |
public function _getTax($product)
|
365 |
{
|
366 |
$tax = 0;
|
367 |
+
$store_id = $product->getStoreId();
|
368 |
|
369 |
+
if ($store_id) {
|
370 |
+
$store = Mage::app()->getStore($store_id);
|
371 |
+
if ($store->getId()) {
|
|
|
|
|
372 |
$taxCalculation = Mage::getModel('tax/calculation');
|
373 |
$request = $taxCalculation->getRateRequest(null, null, null, $store);
|
374 |
$taxClassId = $product->getTaxClassId();
|
375 |
+
$tax = $taxCalculation->getRate($request->setProductClassId($taxClassId));
|
376 |
}
|
377 |
}
|
378 |
+
|
379 |
return $tax;
|
380 |
}
|
381 |
+
|
382 |
//nepouziva se
|
383 |
public function _getImages($product)
|
384 |
{
|
385 |
$images = array(
|
386 |
'thumbnail' => '',
|
387 |
'small_image' => '',
|
388 |
+
'image' => '',
|
389 |
);
|
390 |
|
391 |
$thumbnail = $product->getThumbnail();
|
392 |
+
if ($thumbnail) {
|
393 |
+
$images['thumbnail'] = Mage::getModel('catalog/product_media_config')->getMediaUrl($thumbnail); //(string)Mage::Helper('catalog/image')->init($product, 'thumbnail');
|
|
|
394 |
}
|
395 |
$small_image = $product->getSmallImage();
|
396 |
+
if ($small_image) {
|
397 |
+
$images['small_image'] = Mage::getModel('catalog/product_media_config')->getMediaUrl($small_image); //(string)Mage::Helper('catalog/image')->init($product, 'small_image');
|
|
|
398 |
}
|
399 |
$base_image = $product->getImage();
|
400 |
+
if ($base_image) {
|
401 |
+
$images['image'] = Mage::getModel('catalog/product_media_config')->getMediaUrl($base_image); //(string)Mage::Helper('catalog/image')->init($product, 'image');
|
|
|
402 |
}
|
403 |
|
404 |
return $images;
|
405 |
}
|
406 |
+
|
407 |
public function _getGallery($product)
|
408 |
{
|
409 |
$gallery = array();
|
410 |
|
411 |
+
foreach ($product->getMediaGalleryImages() as $image) {
|
|
|
412 |
$product_image = array(
|
413 |
'label' => $image->getLabel(),
|
414 |
'thumbnail_image' => $image->getUrl(),
|
415 |
'small_image' => $image->getUrl(),
|
416 |
'base_image' => $image->getUrl(),
|
417 |
);
|
418 |
+
$gallery[] = $product_image;
|
419 |
+
}
|
420 |
|
421 |
return $gallery;
|
422 |
}
|
423 |
+
|
424 |
public function _getCategory($product)
|
425 |
{
|
426 |
$category = array();
|
427 |
$product_category_helper = Mage::Helper('kaas_product_category')->setStoreId($this->getStoreId());
|
428 |
|
429 |
$category_ids = $product->getCategoryIds();
|
430 |
+
foreach ($category_ids as $category_id) {
|
431 |
+
if (Mage::Helper('kaas_product_store')->isStoreCategory($category_id, $product->getStoreId())) {
|
|
|
|
|
432 |
$category_info = $product_category_helper->getCategoryInfo($category_id);
|
433 |
+
if ($category_info && isset($category_info['level']) && $category_info['level'] > 0) {
|
|
|
434 |
$category[] = $category_info;
|
435 |
}
|
436 |
}
|
438 |
|
439 |
return $category;
|
440 |
}
|
441 |
+
|
442 |
+
public function _format_datetime($datetime)
|
443 |
+
{
|
444 |
+
$formated_value = $datetime;
|
445 |
+
if ($datetime) {
|
446 |
+
$formated_value = date('Y-m-d H:i:s', strtotime($datetime));
|
447 |
+
}
|
448 |
+
|
449 |
+
return $formated_value;
|
450 |
+
}
|
451 |
+
}
|
app/code/community/Getready/Kaas/Helper/Product/Store/Data.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,81 +12,71 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Helper_Product_Store_Data extends Mage_Core_Helper_Abstract
|
27 |
{
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
{
|
40 |
-
//log load not needed
|
41 |
-
}
|
42 |
-
|
43 |
-
if(in_array($category_id, $this->_store_category_ids))
|
44 |
-
{
|
45 |
-
$is_store_category = true;
|
46 |
-
}
|
47 |
-
|
48 |
-
return $is_store_category;
|
49 |
-
}
|
50 |
-
|
51 |
-
protected function _loadStoreCategoryIds($store_id)
|
52 |
-
{
|
53 |
-
$store_category_ids = array();
|
54 |
-
$store = Mage::app()->getStore($store_id);
|
55 |
-
if($store->getId())
|
56 |
-
{
|
57 |
-
$root_id = $store->getRootCategoryId();
|
58 |
-
|
59 |
-
/* @var $tree Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree */
|
60 |
-
$tree = Mage::getResourceSingleton('catalog/category_tree')->load();
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
->setStoreId($store_id)
|
66 |
-
->addAttributeToSelect('name')
|
67 |
-
->addAttributeToSelect('is_active');
|
68 |
|
69 |
-
|
|
|
70 |
|
71 |
-
|
72 |
-
}
|
73 |
-
|
74 |
-
|
75 |
-
$this->_store_category_ids = $store_category_ids;
|
76 |
-
$this->_store_category_ids_loaded = true;
|
77 |
-
}
|
78 |
-
|
79 |
-
protected function _nodeToArray(Varien_Data_Tree_Node $node)
|
80 |
{
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
return $result;
|
91 |
}
|
92 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Helper_Product_Store_Data extends Mage_Core_Helper_Abstract
|
23 |
{
|
24 |
+
protected $_store_category_ids = array();
|
25 |
+
protected $_store_category_ids_loaded = false;
|
26 |
+
|
27 |
+
public function isStoreCategory($category_id, $store_id)
|
28 |
+
{
|
29 |
+
$is_store_category = false;
|
30 |
+
if (!$this->_store_category_ids_loaded) {
|
31 |
+
$this->_loadStoreCategoryIds($store_id);
|
32 |
+
} else {
|
33 |
+
//log load not needed
|
34 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
if (in_array($category_id, $this->_store_category_ids)) {
|
37 |
+
$is_store_category = true;
|
38 |
+
}
|
|
|
|
|
|
|
39 |
|
40 |
+
return $is_store_category;
|
41 |
+
}
|
42 |
|
43 |
+
protected function _loadStoreCategoryIds($store_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
{
|
45 |
+
$store_category_ids = array();
|
46 |
+
$store = Mage::app()->getStore($store_id);
|
47 |
+
if ($store->getId()) {
|
48 |
+
$root_id = $store->getRootCategoryId();
|
49 |
+
|
50 |
+
/* @var $tree Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree */
|
51 |
+
$tree = Mage::getResourceSingleton('catalog/category_tree')->load();
|
52 |
+
|
53 |
+
$root = $tree->getNodeById($root_id);
|
54 |
+
|
55 |
+
$collection = Mage::getModel('catalog/category')->getCollection()
|
56 |
+
->setStoreId($store_id)
|
57 |
+
->addAttributeToSelect('name')
|
58 |
+
->addAttributeToSelect('is_active');
|
59 |
+
|
60 |
+
$tree->addCollectionData($collection, true);
|
61 |
+
|
62 |
+
$store_category_ids = $this->_nodeToArray($root);
|
63 |
}
|
64 |
+
|
65 |
+
$this->_store_category_ids = $store_category_ids;
|
66 |
+
$this->_store_category_ids_loaded = true;
|
67 |
+
}
|
68 |
+
|
69 |
+
protected function _nodeToArray(Varien_Data_Tree_Node $node)
|
70 |
+
{
|
71 |
+
$result = array();
|
72 |
+
$category_id = $node->getId();
|
73 |
+
|
74 |
+
$result[] = $category_id;
|
75 |
+
|
76 |
+
foreach ($node->getChildren() as $child) {
|
77 |
+
$result = array_merge($result, $this->_nodeToArray($child));
|
78 |
+
}
|
79 |
+
|
80 |
return $result;
|
81 |
}
|
82 |
+
}
|
app/code/community/Getready/Kaas/Helper/Store/Data.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,77 +12,75 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Helper_Store_Data extends Mage_Core_Helper_Abstract
|
27 |
{
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
50 |
$store_info['code'] = $store->getCode();
|
51 |
$store_info['website_id'] = $store->getWebsiteId();
|
52 |
$store_info['group_id'] = $store->getGroupId();
|
53 |
$store_info['name'] = $store->getName();
|
54 |
$store_info['sort_order'] = $store->getSortOrder();
|
55 |
$store_info['is_active'] = $store->getIsActive();
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
}
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Helper_Store_Data extends Mage_Core_Helper_Abstract
|
23 |
{
|
24 |
+
public function getStoreInfo($store)
|
25 |
+
{
|
26 |
+
$store_info = array(
|
27 |
+
'store_id' => '',
|
28 |
+
'code' => '',
|
29 |
+
'website_id' => '',
|
30 |
+
'group_id' => '',
|
31 |
+
'name' => '',
|
32 |
+
'sort_order' => '',
|
33 |
+
'is_active' => '',
|
34 |
+
'country' => '',
|
35 |
+
'language' => '',
|
36 |
+
'locale' => '',
|
37 |
+
'currency' => '',
|
38 |
+
'currency_symbol' => '',
|
39 |
+
'timezone' => '',
|
40 |
+
'store_url' => '',
|
41 |
+
'store_url_secure' => '',
|
42 |
+
'ga_account' => '',
|
43 |
+
);
|
44 |
+
|
45 |
+
//general
|
46 |
+
$store_info['store_id'] = $store->getId();
|
47 |
$store_info['code'] = $store->getCode();
|
48 |
$store_info['website_id'] = $store->getWebsiteId();
|
49 |
$store_info['group_id'] = $store->getGroupId();
|
50 |
$store_info['name'] = $store->getName();
|
51 |
$store_info['sort_order'] = $store->getSortOrder();
|
52 |
$store_info['is_active'] = $store->getIsActive();
|
53 |
+
|
54 |
+
//kaas
|
55 |
+
$store_id = $store->getId();
|
56 |
+
$store_info['country'] = Mage::getStoreConfig('general/country/default', $store_id);
|
57 |
+
$store_info['language'] = strtoupper(substr(Mage::getStoreConfig('general/locale/code', $store_id), 0, 2));
|
58 |
+
$store_info['locale'] = Mage::getStoreConfig('general/locale/code', $store_id);
|
59 |
+
$currency = Mage::getStoreConfig('currency/options/default', $store_id);
|
60 |
+
$store_info['currency'] = $currency;
|
61 |
+
$store_info['currency_symbol'] = Mage::app()->getLocale()->currency($currency)->getSymbol();
|
62 |
+
//$timezone_string = Mage::getStoreConfig('general/locale/timezone', $store_id);
|
63 |
+
$date = Mage::app()->getLocale()->storeDate($store_id);
|
64 |
+
$store_info['timezone'] = $date->get(Zend_Date::GMT_DIFF);
|
65 |
+
$store_info['store_url'] = Mage::getStoreConfig('web/unsecure/base_url', $store_id);
|
66 |
+
$store_info['store_url_secure'] = Mage::getStoreConfig('web/secure/base_url', $store_id);
|
67 |
+
|
68 |
+
$store_info['ga_account'] = trim((string) Mage::getStoreConfig('google/analytics/account', $store_id));
|
69 |
+
|
70 |
+
return $store_info;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getStoreByCode($store_code)
|
74 |
+
{
|
75 |
+
$store_id = null;
|
76 |
+
$stores = array_keys(Mage::app()->getStores());
|
77 |
+
foreach ($stores as $id) {
|
78 |
+
$store = Mage::app()->getStore($id);
|
79 |
+
if ($store->getCode() == $store_code) {
|
80 |
+
$store_id = $id;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
return Mage::app()->getStore($store_id);
|
85 |
+
}
|
86 |
+
}
|
app/code/community/Getready/Kaas/Model/Activity.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,24 +12,18 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Model_Activity extends Mage_Core_Model_Abstract
|
27 |
{
|
28 |
-
|
29 |
public function _construct()
|
30 |
-
{
|
31 |
parent::_construct();
|
32 |
-
$this->_init('kaas/activity');
|
33 |
-
}
|
34 |
-
|
35 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Model_Activity extends Mage_Core_Model_Abstract
|
23 |
{
|
|
|
24 |
public function _construct()
|
25 |
+
{
|
26 |
parent::_construct();
|
27 |
+
$this->_init('kaas/activity');
|
28 |
+
}
|
29 |
+
}
|
|
app/code/community/Getready/Kaas/Model/Activity/Api.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,15 +12,11 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Model_Activity_Api extends Mage_Api_Model_Resource_Abstract
|
@@ -37,11 +33,12 @@ class Getready_Kaas_Model_Activity_Api extends Mage_Api_Model_Resource_Abstract
|
|
37 |
if (!$store->getId()) {
|
38 |
$this->_fault('store_not_exists');
|
39 |
}
|
40 |
-
|
41 |
-
$activity_feed = Mage::Helper('kaas_activity')->getActivityFeed($store);
|
|
|
42 |
return $activity_feed;
|
43 |
}
|
44 |
-
|
45 |
public function clear($storeId)
|
46 |
{
|
47 |
// Retrieve store info
|
@@ -54,9 +51,9 @@ class Getready_Kaas_Model_Activity_Api extends Mage_Api_Model_Resource_Abstract
|
|
54 |
if (!$store->getId()) {
|
55 |
$this->_fault('store_not_exists');
|
56 |
}
|
57 |
-
|
58 |
-
$cleared = Mage::Helper('kaas_activity')->clearActivityFeed($store);
|
|
|
59 |
return $cleared;
|
60 |
}
|
61 |
-
|
62 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Model_Activity_Api extends Mage_Api_Model_Resource_Abstract
|
33 |
if (!$store->getId()) {
|
34 |
$this->_fault('store_not_exists');
|
35 |
}
|
36 |
+
|
37 |
+
$activity_feed = Mage::Helper('kaas_activity')->getActivityFeed($store);
|
38 |
+
|
39 |
return $activity_feed;
|
40 |
}
|
41 |
+
|
42 |
public function clear($storeId)
|
43 |
{
|
44 |
// Retrieve store info
|
51 |
if (!$store->getId()) {
|
52 |
$this->_fault('store_not_exists');
|
53 |
}
|
54 |
+
|
55 |
+
$cleared = Mage::Helper('kaas_activity')->clearActivityFeed($store);
|
56 |
+
|
57 |
return $cleared;
|
58 |
}
|
59 |
+
}
|
|
app/code/community/Getready/Kaas/Model/Activity/Api/V2.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,19 +12,13 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Model_Activity_Api_V2 extends Getready_Kaas_Model_Activity_Api
|
27 |
-
{
|
28 |
-
|
29 |
-
|
30 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Model_Activity_Api_V2 extends Getready_Kaas_Model_Activity_Api
|
23 |
+
{
|
24 |
+
}
|
|
|
|
app/code/community/Getready/Kaas/Model/Category/Api.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,24 +12,19 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Model_Category_Api extends Mage_Api_Model_Resource_Abstract
|
27 |
{
|
28 |
-
public function info($categoryId
|
29 |
-
{
|
30 |
$category = Mage::getModel('catalog/category');
|
31 |
-
if(!is_null($storeId))
|
32 |
-
{
|
33 |
$category->setStoreId($storeId);
|
34 |
}
|
35 |
$category->load($categoryId);
|
@@ -37,17 +32,15 @@ class Getready_Kaas_Model_Category_Api extends Mage_Api_Model_Resource_Abstract
|
|
37 |
if (!$category->getId()) {
|
38 |
$this->_fault('category_not_exists');
|
39 |
}
|
40 |
-
|
41 |
-
$category_helper = Mage::Helper('kaas_category')->setStoreId($storeId);
|
42 |
-
$category_info = $category_helper->getCategoryInfo($category,1);
|
43 |
|
44 |
return $category_info;
|
45 |
}
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
public function items($storeId)
|
50 |
-
{
|
51 |
try {
|
52 |
$store = Mage::app()->getStore($storeId);
|
53 |
} catch (Mage_Core_Model_Store_Exception $e) {
|
@@ -57,15 +50,15 @@ class Getready_Kaas_Model_Category_Api extends Mage_Api_Model_Resource_Abstract
|
|
57 |
if (!$store->getId()) {
|
58 |
$this->_fault('store_not_exists');
|
59 |
}
|
60 |
-
|
61 |
$root_id = $store->getRootCategoryId();
|
62 |
-
|
63 |
/* @var $tree Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree */
|
64 |
$tree = Mage::getResourceSingleton('catalog/category_tree')->load();
|
65 |
|
66 |
$root = $tree->getNodeById($root_id);
|
67 |
-
|
68 |
-
if($root && $root->getId() == 1) {
|
69 |
$root->setName(Mage::helper('catalog')->__('Root'));
|
70 |
}
|
71 |
|
@@ -76,36 +69,32 @@ class Getready_Kaas_Model_Category_Api extends Mage_Api_Model_Resource_Abstract
|
|
76 |
|
77 |
$tree->addCollectionData($collection, true);
|
78 |
|
79 |
-
$category_info = $this->_nodeToArray($root
|
80 |
-
|
81 |
-
|
82 |
return $category_info;
|
83 |
}
|
84 |
-
|
85 |
-
protected function _nodeToArray(Varien_Data_Tree_Node $node
|
86 |
{
|
87 |
$default_root_level = Mage::Helper('kaas')->getDefaultRootLevel();
|
88 |
$result = array();
|
89 |
$category_id = $node->getId();
|
90 |
$category = Mage::Helper('kaas_category_cache')->getCategory($category_id, $store_id);
|
91 |
-
|
92 |
-
if($category && $category->getIsActive())
|
93 |
-
{
|
94 |
$category_helper = Mage::Helper('kaas_category')->setStoreId($store_id);
|
95 |
//$category_helper->setStoreId($storeId);
|
96 |
-
$category_info = $category_helper->getCategoryInfo($category
|
97 |
|
98 |
-
if($category_info && isset($category_info['level']) && $category_info['level'] > 0
|
99 |
-
{
|
100 |
$result[] = $category_info;
|
101 |
}
|
102 |
|
103 |
foreach ($node->getChildren() as $child) {
|
104 |
-
$result = array_merge($result
|
105 |
}
|
106 |
}
|
107 |
-
|
108 |
return $result;
|
109 |
}
|
110 |
-
|
111 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Model_Category_Api extends Mage_Api_Model_Resource_Abstract
|
23 |
{
|
24 |
+
public function info($categoryId, $storeId = null)
|
25 |
+
{
|
26 |
$category = Mage::getModel('catalog/category');
|
27 |
+
if (!is_null($storeId)) {
|
|
|
28 |
$category->setStoreId($storeId);
|
29 |
}
|
30 |
$category->load($categoryId);
|
32 |
if (!$category->getId()) {
|
33 |
$this->_fault('category_not_exists');
|
34 |
}
|
35 |
+
|
36 |
+
$category_helper = Mage::Helper('kaas_category')->setStoreId($storeId);
|
37 |
+
$category_info = $category_helper->getCategoryInfo($category, 1);
|
38 |
|
39 |
return $category_info;
|
40 |
}
|
41 |
+
|
|
|
|
|
42 |
public function items($storeId)
|
43 |
+
{
|
44 |
try {
|
45 |
$store = Mage::app()->getStore($storeId);
|
46 |
} catch (Mage_Core_Model_Store_Exception $e) {
|
50 |
if (!$store->getId()) {
|
51 |
$this->_fault('store_not_exists');
|
52 |
}
|
53 |
+
|
54 |
$root_id = $store->getRootCategoryId();
|
55 |
+
|
56 |
/* @var $tree Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree */
|
57 |
$tree = Mage::getResourceSingleton('catalog/category_tree')->load();
|
58 |
|
59 |
$root = $tree->getNodeById($root_id);
|
60 |
+
|
61 |
+
if ($root && $root->getId() == 1) {
|
62 |
$root->setName(Mage::helper('catalog')->__('Root'));
|
63 |
}
|
64 |
|
69 |
|
70 |
$tree->addCollectionData($collection, true);
|
71 |
|
72 |
+
$category_info = $this->_nodeToArray($root, $storeId);
|
73 |
+
|
|
|
74 |
return $category_info;
|
75 |
}
|
76 |
+
|
77 |
+
protected function _nodeToArray(Varien_Data_Tree_Node $node, $store_id = 0)
|
78 |
{
|
79 |
$default_root_level = Mage::Helper('kaas')->getDefaultRootLevel();
|
80 |
$result = array();
|
81 |
$category_id = $node->getId();
|
82 |
$category = Mage::Helper('kaas_category_cache')->getCategory($category_id, $store_id);
|
83 |
+
|
84 |
+
if ($category && $category->getIsActive()) {
|
|
|
85 |
$category_helper = Mage::Helper('kaas_category')->setStoreId($store_id);
|
86 |
//$category_helper->setStoreId($storeId);
|
87 |
+
$category_info = $category_helper->getCategoryInfo($category, $default_root_level);
|
88 |
|
89 |
+
if ($category_info && isset($category_info['level']) && $category_info['level'] > 0) {
|
|
|
90 |
$result[] = $category_info;
|
91 |
}
|
92 |
|
93 |
foreach ($node->getChildren() as $child) {
|
94 |
+
$result = array_merge($result, $this->_nodeToArray($child, $store_id));
|
95 |
}
|
96 |
}
|
97 |
+
|
98 |
return $result;
|
99 |
}
|
100 |
+
}
|
|
app/code/community/Getready/Kaas/Model/Category/Api/V2.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,19 +12,13 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Model_Category_Api_V2 extends Getready_Kaas_Model_Category_Api
|
27 |
-
{
|
28 |
-
|
29 |
-
|
30 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Model_Category_Api_V2 extends Getready_Kaas_Model_Category_Api
|
23 |
+
{
|
24 |
+
}
|
|
|
|
app/code/community/Getready/Kaas/Model/Mysql4/Activity.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,23 +12,17 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Model_Mysql4_Activity extends Mage_Core_Model_Mysql4_Abstract
|
27 |
{
|
28 |
-
|
29 |
public function _construct()
|
30 |
-
{
|
31 |
-
$this->_init(
|
32 |
}
|
33 |
-
|
34 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Model_Mysql4_Activity extends Mage_Core_Model_Mysql4_Abstract
|
23 |
{
|
|
|
24 |
public function _construct()
|
25 |
+
{
|
26 |
+
$this->_init('kaas/kaas_activity', 'id');
|
27 |
}
|
28 |
+
}
|
|
app/code/community/Getready/Kaas/Model/Mysql4/Activity/Collection.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,24 +12,18 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Model_Mysql4_Activity_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
27 |
{
|
28 |
-
|
29 |
public function _construct()
|
30 |
{
|
31 |
parent::_construct();
|
32 |
$this->_init('kaas/activity');
|
33 |
}
|
34 |
-
|
35 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Model_Mysql4_Activity_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
23 |
{
|
|
|
24 |
public function _construct()
|
25 |
{
|
26 |
parent::_construct();
|
27 |
$this->_init('kaas/activity');
|
28 |
}
|
29 |
+
}
|
|
app/code/community/Getready/Kaas/Model/Observer.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,82 +12,60 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Model_Observer
|
27 |
{
|
28 |
-
|
29 |
public function addUpdateActivity(Varien_Event_Observer $observer)
|
30 |
{
|
31 |
-
try
|
32 |
-
{
|
33 |
$product = $observer->getEvent()->getProduct();
|
34 |
-
$product_id = $product->getId();
|
35 |
$store_id = $product->getStoreId();
|
36 |
-
if($product && $product->getId())
|
37 |
-
|
38 |
-
Mage::Helper('kaas_activity')->createUpdateActivity($store_id,$product_id);
|
39 |
}
|
|
|
|
|
40 |
}
|
41 |
-
|
42 |
-
{
|
43 |
-
Mage::logException($e);
|
44 |
-
}
|
45 |
return $this;
|
46 |
}
|
47 |
-
|
48 |
public function addDeleteActivity(Varien_Event_Observer $observer)
|
49 |
{
|
50 |
-
try
|
51 |
-
{
|
52 |
$product = $observer->getEvent()->getProduct();
|
53 |
-
if($product && $product->getId())
|
54 |
-
|
55 |
-
$product_id
|
56 |
-
|
57 |
-
|
58 |
-
}
|
59 |
-
catch (Exception $e)
|
60 |
-
{
|
61 |
Mage::logException($e);
|
62 |
}
|
|
|
63 |
return $this;
|
64 |
}
|
65 |
-
|
66 |
public function addStockActivity(Varien_Event_Observer $observer)
|
67 |
{
|
68 |
-
try
|
69 |
-
{
|
70 |
$quote = $observer->getEvent()->getQuote();
|
71 |
-
|
72 |
//$store_id = $quote->getStoreId();
|
73 |
-
|
74 |
$items = $quote->getAllItems();
|
75 |
-
|
76 |
Mage::Helper('kaas_activity')->createStockActivity($items);
|
77 |
-
|
78 |
-
}
|
79 |
-
catch (Exception $e)
|
80 |
-
{
|
81 |
Mage::logException($e);
|
82 |
}
|
|
|
83 |
return $this;
|
84 |
}
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Model_Observer
|
23 |
{
|
|
|
24 |
public function addUpdateActivity(Varien_Event_Observer $observer)
|
25 |
{
|
26 |
+
try {
|
|
|
27 |
$product = $observer->getEvent()->getProduct();
|
28 |
+
$product_id = $product->getId();
|
29 |
$store_id = $product->getStoreId();
|
30 |
+
if ($product && $product->getId()) {
|
31 |
+
Mage::Helper('kaas_activity')->createUpdateActivity($store_id, $product_id);
|
|
|
32 |
}
|
33 |
+
} catch (Exception $e) {
|
34 |
+
Mage::logException($e);
|
35 |
}
|
36 |
+
|
|
|
|
|
|
|
37 |
return $this;
|
38 |
}
|
39 |
+
|
40 |
public function addDeleteActivity(Varien_Event_Observer $observer)
|
41 |
{
|
42 |
+
try {
|
|
|
43 |
$product = $observer->getEvent()->getProduct();
|
44 |
+
if ($product && $product->getId()) {
|
45 |
+
$product_id = $product->getId();
|
46 |
+
Mage::Helper('kaas_activity')->createDeleteActivity($product_id);
|
47 |
+
}
|
48 |
+
} catch (Exception $e) {
|
|
|
|
|
|
|
49 |
Mage::logException($e);
|
50 |
}
|
51 |
+
|
52 |
return $this;
|
53 |
}
|
54 |
+
|
55 |
public function addStockActivity(Varien_Event_Observer $observer)
|
56 |
{
|
57 |
+
try {
|
|
|
58 |
$quote = $observer->getEvent()->getQuote();
|
59 |
+
|
60 |
//$store_id = $quote->getStoreId();
|
61 |
+
|
62 |
$items = $quote->getAllItems();
|
63 |
+
|
64 |
Mage::Helper('kaas_activity')->createStockActivity($items);
|
65 |
+
} catch (Exception $e) {
|
|
|
|
|
|
|
66 |
Mage::logException($e);
|
67 |
}
|
68 |
+
|
69 |
return $this;
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
app/code/community/Getready/Kaas/Model/Product/Api.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,21 +12,17 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Model_Product_Api extends Mage_Api_Model_Resource_Abstract
|
27 |
{
|
28 |
-
public function info($productId
|
29 |
-
{
|
30 |
try {
|
31 |
$store = Mage::app()->getStore($storeId);
|
32 |
} catch (Mage_Core_Model_Store_Exception $e) {
|
@@ -41,17 +37,17 @@ class Getready_Kaas_Model_Product_Api extends Mage_Api_Model_Resource_Abstract
|
|
41 |
$product = Mage::helper('catalog/product')->getProduct($productId, $storeId, null);
|
42 |
if (is_null($product->getId())) {
|
43 |
$this->_fault('product_not_exists');
|
44 |
-
}
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
$product_info = $product_helper->getProductInfo($product);
|
47 |
-
|
48 |
-
Mage::Helper('kaas_activity')->deleteProductActivity($storeId,$productId);
|
49 |
-
|
50 |
return $product_info;
|
51 |
}
|
52 |
-
|
53 |
-
public function infoBySku($productSku
|
54 |
-
{
|
55 |
try {
|
56 |
$store = Mage::app()->getStore($storeId);
|
57 |
} catch (Mage_Core_Model_Store_Exception $e) {
|
@@ -61,93 +57,82 @@ class Getready_Kaas_Model_Product_Api extends Mage_Api_Model_Resource_Abstract
|
|
61 |
if (!$store->getId()) {
|
62 |
$this->_fault('store_not_exists');
|
63 |
}
|
64 |
-
|
65 |
$product_helper = Mage::Helper('kaas_product')->setStoreId($storeId);
|
66 |
-
$product_id = Mage::getModel('catalog/product')->getIdBySku($productSku);
|
67 |
-
if($product_id)
|
68 |
-
{
|
69 |
$product = Mage::helper('catalog/product')->getProduct($product_id, $storeId, null);
|
70 |
if (is_null($product->getId())) {
|
71 |
$this->_fault('product_not_exists');
|
72 |
}
|
73 |
-
}
|
74 |
-
else
|
75 |
-
{
|
76 |
$this->_fault('product_not_exists');
|
77 |
}
|
78 |
|
79 |
$product_info = $product_helper->getProductInfo($product);
|
80 |
-
|
81 |
-
if($product_id)
|
82 |
-
|
83 |
-
Mage::Helper('kaas_activity')->deleteProductActivity($storeId,$product_id);
|
84 |
}
|
85 |
-
|
86 |
return $product_info;
|
87 |
}
|
88 |
-
|
89 |
public function items($storeId)
|
90 |
-
{
|
91 |
$product_helper = Mage::Helper('kaas_product')->setStoreId($storeId);
|
92 |
$collection = Mage::getModel('catalog/product')->getCollection()
|
93 |
->addStoreFilter($storeId)
|
94 |
-
->addAttributeToSelect('name');
|
95 |
-
|
96 |
$result = array();
|
97 |
-
|
98 |
-
foreach ($collection as $product)
|
99 |
-
{
|
100 |
$product = Mage::helper('catalog/product')->getProduct($product->getId(), $storeId, null);
|
101 |
if (is_null($product->getId())) {
|
102 |
$this->_fault('product_not_exists');
|
103 |
-
}
|
104 |
-
|
105 |
$product_info = $product_helper->getProductInfo($product);
|
106 |
-
|
107 |
-
Mage::Helper('kaas_activity')->deleteProductActivity($storeId
|
108 |
-
|
109 |
$result[] = $product_info;
|
110 |
}
|
111 |
|
112 |
return $result;
|
113 |
}
|
114 |
-
|
115 |
public function itemsByIds($storeId, $productIds)
|
116 |
{
|
117 |
$product_helper = Mage::Helper('kaas_product')->setStoreId($storeId);
|
118 |
$result = array();
|
119 |
$products_export = array();
|
120 |
-
$errors = array();
|
121 |
-
if(!empty($productIds))
|
122 |
-
|
123 |
-
|
124 |
-
{
|
125 |
-
if($product_id > 0)
|
126 |
-
{
|
127 |
$product = Mage::helper('catalog/product')->getProduct($product_id, $storeId, null);
|
128 |
-
if (is_null($product->getId())) {
|
129 |
$errors[] = array(
|
130 |
'product_id' => $product_id,
|
131 |
-
'message' => 'product with id '
|
132 |
);
|
133 |
continue;
|
134 |
}
|
135 |
|
136 |
-
try
|
137 |
-
{
|
138 |
$product_info = $product_helper->getProductInfo($product);
|
139 |
-
}
|
140 |
-
catch (Exception $e)
|
141 |
-
{
|
142 |
$errors[] = array(
|
143 |
'product_id' => $product_id,
|
144 |
-
'message' => $e->getMessage()
|
145 |
);
|
146 |
continue;
|
147 |
}
|
148 |
$products_export[] = $product_info;
|
149 |
-
|
150 |
-
Mage::Helper('kaas_activity')->deleteProductActivity($storeId
|
151 |
}
|
152 |
}
|
153 |
}
|
@@ -157,22 +142,18 @@ class Getready_Kaas_Model_Product_Api extends Mage_Api_Model_Resource_Abstract
|
|
157 |
|
158 |
return $result;
|
159 |
}
|
160 |
-
|
161 |
public function itemsIds($storeId)
|
162 |
-
{
|
163 |
$collection = Mage::getModel('catalog/product')->getCollection()
|
164 |
-
->addStoreFilter($storeId);
|
|
|
|
|
165 |
|
166 |
-
$
|
167 |
-
|
168 |
-
foreach ($collection as $product)
|
169 |
-
{
|
170 |
-
$result[] = (int)$product->getId();
|
171 |
}
|
172 |
|
173 |
return $result;
|
174 |
}
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Model_Product_Api extends Mage_Api_Model_Resource_Abstract
|
23 |
{
|
24 |
+
public function info($productId, $storeId)
|
25 |
+
{
|
26 |
try {
|
27 |
$store = Mage::app()->getStore($storeId);
|
28 |
} catch (Mage_Core_Model_Store_Exception $e) {
|
37 |
$product = Mage::helper('catalog/product')->getProduct($productId, $storeId, null);
|
38 |
if (is_null($product->getId())) {
|
39 |
$this->_fault('product_not_exists');
|
40 |
+
}
|
41 |
+
|
42 |
+
$product_info = $product_helper->getProductInfo($product);
|
43 |
+
|
44 |
+
Mage::Helper('kaas_activity')->deleteProductActivity($storeId, $productId);
|
45 |
|
|
|
|
|
|
|
|
|
46 |
return $product_info;
|
47 |
}
|
48 |
+
|
49 |
+
public function infoBySku($productSku, $storeId)
|
50 |
+
{
|
51 |
try {
|
52 |
$store = Mage::app()->getStore($storeId);
|
53 |
} catch (Mage_Core_Model_Store_Exception $e) {
|
57 |
if (!$store->getId()) {
|
58 |
$this->_fault('store_not_exists');
|
59 |
}
|
60 |
+
|
61 |
$product_helper = Mage::Helper('kaas_product')->setStoreId($storeId);
|
62 |
+
$product_id = Mage::getModel('catalog/product')->getIdBySku($productSku);
|
63 |
+
if ($product_id) {
|
|
|
64 |
$product = Mage::helper('catalog/product')->getProduct($product_id, $storeId, null);
|
65 |
if (is_null($product->getId())) {
|
66 |
$this->_fault('product_not_exists');
|
67 |
}
|
68 |
+
} else {
|
|
|
|
|
69 |
$this->_fault('product_not_exists');
|
70 |
}
|
71 |
|
72 |
$product_info = $product_helper->getProductInfo($product);
|
73 |
+
|
74 |
+
if ($product_id) {
|
75 |
+
Mage::Helper('kaas_activity')->deleteProductActivity($storeId, $product_id);
|
|
|
76 |
}
|
77 |
+
|
78 |
return $product_info;
|
79 |
}
|
80 |
+
|
81 |
public function items($storeId)
|
82 |
+
{
|
83 |
$product_helper = Mage::Helper('kaas_product')->setStoreId($storeId);
|
84 |
$collection = Mage::getModel('catalog/product')->getCollection()
|
85 |
->addStoreFilter($storeId)
|
86 |
+
->addAttributeToSelect('name');
|
87 |
+
|
88 |
$result = array();
|
89 |
+
|
90 |
+
foreach ($collection as $product) {
|
|
|
91 |
$product = Mage::helper('catalog/product')->getProduct($product->getId(), $storeId, null);
|
92 |
if (is_null($product->getId())) {
|
93 |
$this->_fault('product_not_exists');
|
94 |
+
}
|
95 |
+
|
96 |
$product_info = $product_helper->getProductInfo($product);
|
97 |
+
|
98 |
+
Mage::Helper('kaas_activity')->deleteProductActivity($storeId, $product->getId());
|
99 |
+
|
100 |
$result[] = $product_info;
|
101 |
}
|
102 |
|
103 |
return $result;
|
104 |
}
|
105 |
+
|
106 |
public function itemsByIds($storeId, $productIds)
|
107 |
{
|
108 |
$product_helper = Mage::Helper('kaas_product')->setStoreId($storeId);
|
109 |
$result = array();
|
110 |
$products_export = array();
|
111 |
+
$errors = array();
|
112 |
+
if (!empty($productIds)) {
|
113 |
+
foreach ($productIds as $product_id) {
|
114 |
+
if ($product_id > 0) {
|
|
|
|
|
|
|
115 |
$product = Mage::helper('catalog/product')->getProduct($product_id, $storeId, null);
|
116 |
+
if (is_null($product->getId())) {
|
117 |
$errors[] = array(
|
118 |
'product_id' => $product_id,
|
119 |
+
'message' => 'product with id '.$product_id.' not exists',
|
120 |
);
|
121 |
continue;
|
122 |
}
|
123 |
|
124 |
+
try {
|
|
|
125 |
$product_info = $product_helper->getProductInfo($product);
|
126 |
+
} catch (Exception $e) {
|
|
|
|
|
127 |
$errors[] = array(
|
128 |
'product_id' => $product_id,
|
129 |
+
'message' => $e->getMessage(),
|
130 |
);
|
131 |
continue;
|
132 |
}
|
133 |
$products_export[] = $product_info;
|
134 |
+
|
135 |
+
Mage::Helper('kaas_activity')->deleteProductActivity($storeId, $product->getId());
|
136 |
}
|
137 |
}
|
138 |
}
|
142 |
|
143 |
return $result;
|
144 |
}
|
145 |
+
|
146 |
public function itemsIds($storeId)
|
147 |
+
{
|
148 |
$collection = Mage::getModel('catalog/product')->getCollection()
|
149 |
+
->addStoreFilter($storeId);
|
150 |
+
|
151 |
+
$result = array();
|
152 |
|
153 |
+
foreach ($collection as $product) {
|
154 |
+
$result[] = (int) $product->getId();
|
|
|
|
|
|
|
155 |
}
|
156 |
|
157 |
return $result;
|
158 |
}
|
159 |
+
}
|
|
|
|
|
|
app/code/community/Getready/Kaas/Model/Product/Api/V2.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,19 +12,13 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Model_Product_Api_V2 extends Getready_Kaas_Model_Product_Api
|
27 |
-
{
|
28 |
-
|
29 |
-
|
30 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Model_Product_Api_V2 extends Getready_Kaas_Model_Product_Api
|
23 |
+
{
|
24 |
+
}
|
|
|
|
app/code/community/Getready/Kaas/Model/Store/Api.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,22 +12,18 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Model_Store_Api extends Mage_Api_Model_Resource_Abstract
|
27 |
{
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
try {
|
32 |
$store = Mage::app()->getStore($storeId);
|
33 |
} catch (Mage_Core_Model_Store_Exception $e) {
|
@@ -37,16 +33,17 @@ class Getready_Kaas_Model_Store_Api extends Mage_Api_Model_Resource_Abstract
|
|
37 |
if (!$store->getId()) {
|
38 |
$this->_fault('store_not_exists');
|
39 |
}
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
50 |
} catch (Mage_Core_Model_Store_Exception $e) {
|
51 |
$this->_fault('store_not_exists');
|
52 |
}
|
@@ -54,14 +51,15 @@ class Getready_Kaas_Model_Store_Api extends Mage_Api_Model_Resource_Abstract
|
|
54 |
if (!$store->getId()) {
|
55 |
$this->_fault('store_not_exists');
|
56 |
}
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
65 |
$stores = Mage::app()->getStores();
|
66 |
|
67 |
// Make result array
|
@@ -71,6 +69,5 @@ class Getready_Kaas_Model_Store_Api extends Mage_Api_Model_Resource_Abstract
|
|
71 |
}
|
72 |
|
73 |
return $result;
|
74 |
-
|
75 |
-
|
76 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Model_Store_Api extends Mage_Api_Model_Resource_Abstract
|
23 |
{
|
24 |
+
public function info($storeId)
|
25 |
+
{
|
26 |
+
// Retrieve store info
|
27 |
try {
|
28 |
$store = Mage::app()->getStore($storeId);
|
29 |
} catch (Mage_Core_Model_Store_Exception $e) {
|
33 |
if (!$store->getId()) {
|
34 |
$this->_fault('store_not_exists');
|
35 |
}
|
36 |
+
|
37 |
+
$store_info = Mage::Helper('kaas_store')->getStoreInfo($store);
|
38 |
+
|
39 |
+
return $store_info;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function infoByCode($storeCode)
|
43 |
+
{
|
44 |
+
// Retrieve store info
|
45 |
+
try {
|
46 |
+
$store = Mage::Helper('kaas_store')->getStoreByCode($storeCode);
|
47 |
} catch (Mage_Core_Model_Store_Exception $e) {
|
48 |
$this->_fault('store_not_exists');
|
49 |
}
|
51 |
if (!$store->getId()) {
|
52 |
$this->_fault('store_not_exists');
|
53 |
}
|
54 |
+
|
55 |
+
$store_info = Mage::Helper('kaas_store')->getStoreInfo($store);
|
56 |
+
|
57 |
+
return $store_info;
|
58 |
+
}
|
59 |
+
|
60 |
+
public function items()
|
61 |
+
{
|
62 |
+
// Retrieve stores
|
63 |
$stores = Mage::app()->getStores();
|
64 |
|
65 |
// Make result array
|
69 |
}
|
70 |
|
71 |
return $result;
|
72 |
+
}
|
73 |
+
}
|
|
app/code/community/Getready/Kaas/Model/Store/Api/V2.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento Module developed by Getready s.r.o
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,19 +12,13 @@
|
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
-
* @copyright Copyright (c)
|
16 |
-
*
|
17 |
*/
|
18 |
/**
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
* @category Getready
|
23 |
-
*
|
24 |
* @author Getready Team <info@getready.cz>
|
25 |
*/
|
26 |
class Getready_Kaas_Model_Store_Api_V2 extends Getready_Kaas_Model_Store_Api
|
27 |
-
{
|
28 |
-
|
29 |
-
|
30 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento Module developed by Getready s.r.o.
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
12 |
* obtain it through the world-wide-web, please send an email
|
13 |
* to info@getready.cz so we can send you a copy immediately.
|
14 |
*
|
15 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
|
|
16 |
*/
|
17 |
/**
|
|
|
|
|
|
|
18 |
* @category Getready
|
19 |
+
*
|
20 |
* @author Getready Team <info@getready.cz>
|
21 |
*/
|
22 |
class Getready_Kaas_Model_Store_Api_V2 extends Getready_Kaas_Model_Store_Api
|
23 |
+
{
|
24 |
+
}
|
|
|
|
app/code/community/Getready/Kaas/etc/config.xml
CHANGED
@@ -13,14 +13,14 @@
|
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to info@getready.cz so we can send you a copy immediately.
|
15 |
*
|
16 |
-
* @copyright Copyright (c)
|
17 |
*
|
18 |
*/
|
19 |
-->
|
20 |
<config>
|
21 |
<modules>
|
22 |
<Getready_Kaas>
|
23 |
-
<version>1.0.
|
24 |
</Getready_Kaas>
|
25 |
</modules>
|
26 |
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to info@getready.cz so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
17 |
*
|
18 |
*/
|
19 |
-->
|
20 |
<config>
|
21 |
<modules>
|
22 |
<Getready_Kaas>
|
23 |
+
<version>1.0.5</version>
|
24 |
</Getready_Kaas>
|
25 |
</modules>
|
26 |
|
app/code/community/Getready/Kaas/etc/wsdl.xml
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to info@getready.cz so we can send you a copy immediately.
|
15 |
*
|
16 |
-
* @copyright Copyright (c)
|
17 |
*
|
18 |
*/
|
19 |
-->
|
@@ -41,6 +41,7 @@
|
|
41 |
<element name="timezone" type="xsd:string" />
|
42 |
<element name="store_url" type="xsd:string" />
|
43 |
<element name="store_url_secure" type="xsd:string" />
|
|
|
44 |
</all>
|
45 |
</complexType>
|
46 |
<complexType name="kaasStoreEntityArray">
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to info@getready.cz so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
17 |
*
|
18 |
*/
|
19 |
-->
|
41 |
<element name="timezone" type="xsd:string" />
|
42 |
<element name="store_url" type="xsd:string" />
|
43 |
<element name="store_url_secure" type="xsd:string" />
|
44 |
+
<element name="ga_account" type="xsd:string" />
|
45 |
</all>
|
46 |
</complexType>
|
47 |
<complexType name="kaasStoreEntityArray">
|
app/code/community/Getready/Kaas/sql/kaas_setup/mysql4-install-1.0.0.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
$installer = $this;
|
3 |
$installer->startSetup();
|
4 |
|
@@ -18,4 +19,4 @@ CREATE TABLE {$this->getTable('getready_kaas_activity')} (
|
|
18 |
|
19 |
");
|
20 |
|
21 |
-
$installer->endSetup();
|
1 |
<?php
|
2 |
+
|
3 |
$installer = $this;
|
4 |
$installer->startSetup();
|
5 |
|
19 |
|
20 |
");
|
21 |
|
22 |
+
$installer->endSetup();
|
app/etc/modules/Getready_Kaas.xml
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to info@getready.cz so we can send you a copy immediately.
|
15 |
*
|
16 |
-
* @copyright Copyright (c)
|
17 |
*
|
18 |
*/
|
19 |
-->
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to info@getready.cz so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @copyright Copyright (c) 2016 Getready s.r.o. (http://getready.cz)
|
17 |
*
|
18 |
*/
|
19 |
-->
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>getready_kaas</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL-v3</license>
|
7 |
<channel>community</channel>
|
@@ -9,11 +9,11 @@
|
|
9 |
<summary>Koongo is the ultimate Feed and Affiliate Marketing Tool that allows integration of electronic stores with more 500+ product aggregators, affiliate networks and selling channels worldwide.</summary>
|
10 |
<description>Koongo is the ultimate feed marketing tool that streamlines the process of the product export from e-stores to various product search and price comparison websites, affiliate networks and selling channels. Since Koongo doesn’t require any programming skills it allows online retailers and merchants to reach seamlessly hundreds of new marketing channels from around the world from a single integration point. Hence, Koongo is capable of bringing millions of new prospective customers to online stores of merchants and can increase store revenues by up to 25%! In addition, through the support of 500+ selling channels from more than 40 countries worldwide Koongo simplifies the process of expanding online businesses behind the borders of one country (i.e. cross-border selling).</description>
|
11 |
<notes>The release fixed: 
|
12 |
-
- MEKCFM-
|
13 |
<authors><author><name>GetReady Team</name><user>getreadycz</user><email>info@getready.cz</email></author></authors>
|
14 |
-
<date>
|
15 |
-
<time>
|
16 |
-
<contents><target name="magecommunity"><dir name="Getready"><dir name="Kaas"><dir name="Helper"><dir name="Activity"><file name="Data.php" hash="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>getready_kaas</name>
|
4 |
+
<version>1.0.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL-v3</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>Koongo is the ultimate Feed and Affiliate Marketing Tool that allows integration of electronic stores with more 500+ product aggregators, affiliate networks and selling channels worldwide.</summary>
|
10 |
<description>Koongo is the ultimate feed marketing tool that streamlines the process of the product export from e-stores to various product search and price comparison websites, affiliate networks and selling channels. Since Koongo doesn’t require any programming skills it allows online retailers and merchants to reach seamlessly hundreds of new marketing channels from around the world from a single integration point. Hence, Koongo is capable of bringing millions of new prospective customers to online stores of merchants and can increase store revenues by up to 25%! In addition, through the support of 500+ selling channels from more than 40 countries worldwide Koongo simplifies the process of expanding online businesses behind the borders of one country (i.e. cross-border selling).</description>
|
11 |
<notes>The release fixed: 
|
12 |
+
- MEKCFM-4 Magento API group_id problem</notes>
|
13 |
<authors><author><name>GetReady Team</name><user>getreadycz</user><email>info@getready.cz</email></author></authors>
|
14 |
+
<date>2016-07-08</date>
|
15 |
+
<time>11:29:24</time>
|
16 |
+
<contents><target name="magecommunity"><dir name="Getready"><dir name="Kaas"><dir name="Helper"><dir name="Activity"><file name="Data.php" hash="f740db9b7cf37539c30ce8766120099e"/></dir><dir name="Category"><dir name="Cache"><file name="Data.php" hash="f58b176ea2aafaf6379b3a8032807c9a"/></dir><file name="Data.php" hash="cdfcb801765cfdcb0fc29324e0f83c79"/></dir><file name="Data.php" hash="396a79d8e2d1bc921d16853a8810be6f"/><dir name="Product"><dir name="Category"><file name="Data.php" hash="3b0d25221ea5470e74e18f3d95c65f3e"/></dir><file name="Data.php" hash="c10ab9398b8a241fe5ab1d512d3c9a1b"/><dir name="Store"><file name="Data.php" hash="4f7520c7735e8a74c2f31108af0292d1"/></dir></dir><dir name="Store"><file name="Data.php" hash="dd6761eabe99f38e1bee0b8970d79ad1"/></dir></dir><dir name="Model"><dir name="Activity"><dir name="Api"><file name="V2.php" hash="95991dd5a89815c25b3452b504ddc724"/></dir><file name="Api.php" hash="9d2cc4613c946121339947c3f6d309d1"/></dir><file name="Activity.php" hash="5c66680b60ed77a43b72f7f48fc5a388"/><dir name="Category"><dir name="Api"><file name="V2.php" hash="3b630df6b4db280474c101739e845cf1"/></dir><file name="Api.php" hash="168fb674acfd68ab8783272cc6451b05"/></dir><dir name="Mysql4"><dir name="Activity"><file name="Collection.php" hash="07ca00fd1d671851a2cda075f43d1edf"/></dir><file name="Activity.php" hash="df1ee06c9f0d5b51f351a770056bc6cc"/></dir><file name="Observer.php" hash="86a5f75f45e6fa3a24aa3c0f48167ca3"/><dir name="Product"><dir name="Api"><file name="V2.php" hash="d897bffbb6828432959552242970309c"/></dir><file name="Api.php" hash="2412f1942067b954ddf69b106c6b5e0d"/></dir><dir name="Store"><dir name="Api"><file name="V2.php" hash="80c4a43f1f06448dc4a615ba4faa4380"/></dir><file name="Api.php" hash="77ec017377e44735cba6c3b87b2d40d6"/></dir></dir><dir name="etc"><file name="api.xml" hash="a3837ad74ac6d25f3486d1f8c174bf98"/><file name="config.xml" hash="61788895e8cfca614bf87015c948e860"/><file name="wsdl.xml" hash="49baf43dfcb1e8f5726de0d2ac9cea5a"/></dir><dir name="sql"><dir name="kaas_setup"><file name="mysql4-install-1.0.0.php" hash="74ddd3718f91c81735c47aee48781e13"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Getready_Kaas.xml" hash="0ad572c56eb98c83337dcaf2f1f2053f"/></dir></target></contents>
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|