Version Notes
1.4.7
Support for multiple web sites on single Magento instance.
1.4.6
Test actions for multi web site catalog.
1.4.5
Diagnostic: gte - ordered by entity_id
1.4.4
Faster unconvertedcarts.
CustomerTaxClass added to orders and customer Actions
1.4.3
New attrInfoAction and entityTypeInfoAction added to tracked changes in Magento data.
1.4.2
Disconnect API version from module version for sites that cache module XML file
1.4.1
Improved order processing speed.
Multi store URL info.
Shipping address tracked.
gte option for orders,customers, products, carts and subscribers.
Status option for subscribersAction
Update carts action skip non identifed carts.
1.4.0
Split stats action into
stats and logstats
Updated customersAction to return custom attributes.
1.3.9
Added eavinfo_catalogAction
Products action now retuns full url of product images.
testing new testcustomerAction
1.3.8
Changed table exists function
mocoauto_api_error - API errors prefix
1.3.7
Added non sensitive payment info to orderAction
1.3.5
Faster uncovertedcarts
1.3.4
log_all_joined
1.3.3
Added rulesAction - for details on coupon and shopping carts rule.
1.3.2
Exception handles for uncoverted carts.
Changed catalogue tax rate processing.
1.3.1
Added graceful exception handling for installations that have misconfigured product attributes
1.3.0
Check direct SQL methods defined
exproducts
exstats
report version of php
1.2.9
Default tax rate fro products returned with producAction
1.2.8
storesAction now returns store config data
1.2.7
log stats function calculates using direct SQL
1.2.6
StatsAction now returns size of log files
1.2.5
Speed up stocklevelAction, now only returns non zero inventory
WishlistAction now includes wishListItemId
1.2.4
Added wishlistsAction
Added unconvertedcartsAction
Fix - log actions now check if table exists
1.2.3
Fix to Observer.php
1.2.2
Added subscribersAction
Added storesAction
1.2.1
ordersAction - now uses billing address as some products (Virtual) won't have a delivery address and checks that object exists
1.2.0
ordersAction - added shpping address
productsAction - added end of record marker
stocklevelsAction - New
Added log_ actions
1.1.7
Added malformed error
Returns API version number with failed calls
1.1.6
Changed API header name to work with sites that use additional authorisation now:
mocoapi: apikey= THE API KEY
1.1.5
Updated stats API now includes:
Version of magento
System date/time
added success true for succesful requests
changed product category to moco_category
Release Info
Developer | Rob Davies |
Extension | MocoInsight_Mocoauto |
Version | 1.4.7 |
Comparing to | |
See all releases |
Code changes from version 1.4.5 to 1.4.7
@@ -30,7 +30,7 @@
|
|
30 |
// entityTypeInfoAction
|
31 |
|
32 |
|
33 |
-
define("apiversion","1.4.
|
34 |
|
35 |
class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Action
|
36 |
{
|
@@ -80,7 +80,7 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
80 |
return true;
|
81 |
}
|
82 |
|
83 |
-
public function
|
84 |
{
|
85 |
if(!$this->_authorise()) {
|
86 |
return $this;
|
@@ -172,8 +172,7 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
172 |
return $this;
|
173 |
}
|
174 |
|
175 |
-
|
176 |
-
public function logstatsAction() // Return the number size of logs
|
177 |
{
|
178 |
if(!$this->_authorise()) {
|
179 |
return $this;
|
@@ -185,99 +184,9 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
185 |
$sections = explode('/', trim($this->getRequest()->getPathInfo(), '/'));
|
186 |
$since = $this->getRequest()->getParam('since','ALL');
|
187 |
|
|
|
188 |
|
189 |
-
|
190 |
-
|
191 |
-
if (method_exists($_read, 'showTableStatus')){
|
192 |
-
|
193 |
-
$tablename = 'log_url';
|
194 |
-
if(!$_read ->showTableStatus(trim($tablename,"'"))){
|
195 |
-
$logurlcount = "table does not exist";
|
196 |
-
}
|
197 |
-
else{
|
198 |
-
$query = 'select count(*) AS id from ' . $tablename;
|
199 |
-
$log_urlcount = $_read->fetchOne($query);
|
200 |
-
}
|
201 |
-
|
202 |
-
$tablename = 'log_url_info';
|
203 |
-
if(!$_read ->showTableStatus(trim($tablename,"'"))){
|
204 |
-
$log_url_infocount = "table does not exist";
|
205 |
-
}
|
206 |
-
else{
|
207 |
-
$query = 'select count(*) AS id from ' . $tablename;
|
208 |
-
$log_url_infocount = $_read->fetchOne($query);
|
209 |
-
}
|
210 |
-
|
211 |
-
$tablename = 'log_visitor';
|
212 |
-
if(!$_read ->showTableStatus(trim($tablename,"'"))){
|
213 |
-
$log_visitorcount = "table does not exist";
|
214 |
-
}
|
215 |
-
else{
|
216 |
-
$query = 'select count(*) AS id from ' . $tablename;
|
217 |
-
$log_visitorcount = $_read->fetchOne($query);
|
218 |
-
}
|
219 |
-
|
220 |
-
$tablename = 'log_visitor_info';
|
221 |
-
if(!$_read ->showTableStatus(trim($tablename,"'"))){
|
222 |
-
$log_visitor_infocount = "table does not exist";
|
223 |
-
}
|
224 |
-
else{
|
225 |
-
$query = 'select count(*) AS id from ' . $tablename;
|
226 |
-
$log_visitor_infocount = $_read->fetchOne($query);
|
227 |
-
}
|
228 |
-
|
229 |
-
$tablename = 'log_customer';
|
230 |
-
if(!$_read ->showTableStatus(trim($tablename,"'"))){
|
231 |
-
$log_countcount = "table does not exist";
|
232 |
-
}
|
233 |
-
else{
|
234 |
-
$query = 'select count(*) AS id from ' . $tablename;
|
235 |
-
$log_customercount = $_read->fetchOne($query);
|
236 |
-
}
|
237 |
-
}
|
238 |
-
else {
|
239 |
-
$log_urlcount = "showTableStatus is an undefined method";
|
240 |
-
$log_url_infocount = "showTableStatus is an undefined method";
|
241 |
-
$log_visitorcount = "showTableStatus is an undefined method";
|
242 |
-
$log_visitor_infocount = "showTableStatus is an undefined method";
|
243 |
-
$log_customercount = "showTableStatus is an undefined method";
|
244 |
-
|
245 |
-
}
|
246 |
-
|
247 |
-
|
248 |
-
$apiversion = (String)Mage::getConfig()->getNode()->modules->MocoInsight_Mocoauto->version;
|
249 |
-
|
250 |
-
|
251 |
-
$stats = array(
|
252 |
-
'success' => 'true',
|
253 |
-
'Since' => $since,
|
254 |
-
'log_url' => $log_urlcount,
|
255 |
-
'log_url_info' => $log_url_infocount,
|
256 |
-
'log_visitor' => $log_visitorcount,
|
257 |
-
'log_visitor_info' => $log_visitor_infocount,
|
258 |
-
'log_customer' => $log_customercount,
|
259 |
-
'MocoAPI Version' => $apiversion,
|
260 |
-
'API processing time' => (microtime(true) - $time_start)
|
261 |
-
);
|
262 |
-
|
263 |
-
$this->getResponse()
|
264 |
-
->setBody(json_encode($stats))
|
265 |
-
->setHttpResponseCode(200)
|
266 |
-
->setHeader('Content-type', 'application/json', true);
|
267 |
-
return $this;
|
268 |
-
}
|
269 |
-
|
270 |
-
public function exstatsAction() // Return the number of Product, Orders and Customers with optional since filter
|
271 |
-
{
|
272 |
-
if(!$this->_authorise()) {
|
273 |
-
return $this;
|
274 |
-
}
|
275 |
-
|
276 |
-
$time_start = microtime(true);
|
277 |
-
|
278 |
-
$currentSystemTime = date('Y-m-d H:i:s', time());
|
279 |
-
$sections = explode('/', trim($this->getRequest()->getPathInfo(), '/'));
|
280 |
-
$since = $this->getRequest()->getParam('since','ALL');
|
281 |
|
282 |
$_productCol = Mage::getModel('catalog/product')->getCollection();
|
283 |
if($since != 'ALL'){
|
@@ -328,6 +237,51 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
328 |
|
329 |
$rulescount = $_rulesCol->getSize();
|
330 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
$_read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
332 |
|
333 |
if (method_exists($_read, 'showTableStatus')){
|
@@ -368,7 +322,7 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
368 |
$log_visitor_infocount = $_read->fetchOne($query);
|
369 |
}
|
370 |
|
371 |
-
$tablename = 'log_customer';
|
372 |
if(!$_read ->showTableStatus(trim($tablename,"'"))){
|
373 |
$log_countcount = "table does not exist";
|
374 |
}
|
@@ -387,33 +341,18 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
387 |
}
|
388 |
|
389 |
|
390 |
-
$magentoVersion = Mage::getVersion();
|
391 |
$apiversion = (String)Mage::getConfig()->getNode()->modules->MocoInsight_Mocoauto->version;
|
392 |
-
$phpversion = phpversion();
|
393 |
|
394 |
-
$mediaurl = Mage::getBaseUrl('media');
|
395 |
|
396 |
$stats = array(
|
397 |
'success' => 'true',
|
398 |
'Since' => $since,
|
399 |
-
'Products' => $productcount,
|
400 |
-
'Orders' => $ordercount,
|
401 |
-
'Customers' => $customercount,
|
402 |
-
'Categories' => $categorycount,
|
403 |
-
'Wish lists' => $wishlistcount,
|
404 |
-
'Unconverted carts' => $cartscount,
|
405 |
-
'Subscribers' => $subscribercount,
|
406 |
-
'Cart and Coupon rules' => $rulescount,
|
407 |
'log_url' => $log_urlcount,
|
408 |
'log_url_info' => $log_url_infocount,
|
409 |
'log_visitor' => $log_visitorcount,
|
410 |
'log_visitor_info' => $log_visitor_infocount,
|
411 |
'log_customer' => $log_customercount,
|
412 |
-
'System Date Time' => $currentSystemTime,
|
413 |
-
'Magento Version' => $magentoVersion,
|
414 |
'MocoAPI Version' => $apiversion,
|
415 |
-
'PHP Version' => $phpversion,
|
416 |
-
'Media URL' => $mediaurl,
|
417 |
'API processing time' => (microtime(true) - $time_start)
|
418 |
);
|
419 |
|
@@ -424,6 +363,7 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
424 |
return $this;
|
425 |
}
|
426 |
|
|
|
427 |
public function ordersAction()
|
428 |
{
|
429 |
if(!$this->_authorise()) {
|
@@ -752,6 +692,9 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
752 |
$page_size = $this->getRequest()->getParam('page_size', 20);
|
753 |
$since = $this->getRequest()->getParam('since', 'ALL');
|
754 |
|
|
|
|
|
|
|
755 |
$_categoryCol = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('*');
|
756 |
$_categoryCol->getSelect()->limit($page_size, ($offset * $page_size))->order('updated_at');
|
757 |
|
@@ -773,6 +716,140 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
773 |
}
|
774 |
|
775 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
776 |
public function productsAction()
|
777 |
{
|
778 |
if(!$this->_authorise()) {
|
@@ -786,6 +863,9 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
786 |
$since = $this->getRequest()->getParam('since', 'ALL');
|
787 |
$gTE = $this->getRequest()->getParam('gte', 'ALL');
|
788 |
|
|
|
|
|
|
|
789 |
$_productCol = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
|
790 |
|
791 |
if($since != 'ALL'){
|
@@ -907,6 +987,7 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
907 |
return $this;
|
908 |
}
|
909 |
|
|
|
910 |
public function stocklevelsAction()
|
911 |
{
|
912 |
if(!$this->_authorise()) {
|
30 |
// entityTypeInfoAction
|
31 |
|
32 |
|
33 |
+
define("apiversion","1.4.7");
|
34 |
|
35 |
class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Action
|
36 |
{
|
80 |
return true;
|
81 |
}
|
82 |
|
83 |
+
public function exstatsAction() // Return the number of Product, Orders and Customers with optional since filter
|
84 |
{
|
85 |
if(!$this->_authorise()) {
|
86 |
return $this;
|
172 |
return $this;
|
173 |
}
|
174 |
|
175 |
+
public function statsAction() // Return the number of Product, Orders and Customers with optional since filter
|
|
|
176 |
{
|
177 |
if(!$this->_authorise()) {
|
178 |
return $this;
|
184 |
$sections = explode('/', trim($this->getRequest()->getPathInfo(), '/'));
|
185 |
$since = $this->getRequest()->getParam('since','ALL');
|
186 |
|
187 |
+
// set to admin
|
188 |
|
189 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
$_productCol = Mage::getModel('catalog/product')->getCollection();
|
192 |
if($since != 'ALL'){
|
237 |
|
238 |
$rulescount = $_rulesCol->getSize();
|
239 |
|
240 |
+
|
241 |
+
$magentoVersion = Mage::getVersion();
|
242 |
+
$moduleversion = (String)Mage::getConfig()->getNode()->modules->MocoInsight_Mocoauto->version;
|
243 |
+
$phpversion = phpversion();
|
244 |
+
|
245 |
+
$stats = array(
|
246 |
+
'success' => 'true',
|
247 |
+
'Since' => $since,
|
248 |
+
'Products' => $productcount,
|
249 |
+
'Orders' => $ordercount,
|
250 |
+
'Customers' => $customercount,
|
251 |
+
'Categories' => $categorycount,
|
252 |
+
'Wish lists' => $wishlistcount,
|
253 |
+
'Unconverted carts' => $cartscount,
|
254 |
+
'Subscribers' => $subscribercount,
|
255 |
+
'Cart and Coupon rules' => $rulescount,
|
256 |
+
'System Date Time' => $currentSystemTime,
|
257 |
+
'Magento Version' => $magentoVersion,
|
258 |
+
'MocoAPI Version' => apiversion,
|
259 |
+
'Module Version' => $moduleversion,
|
260 |
+
'PHP Version' => $phpversion,
|
261 |
+
'API processing time' => (microtime(true) - $time_start)
|
262 |
+
);
|
263 |
+
|
264 |
+
$this->getResponse()
|
265 |
+
->setBody(json_encode($stats))
|
266 |
+
->setHttpResponseCode(200)
|
267 |
+
->setHeader('Content-type', 'application/json', true);
|
268 |
+
return $this;
|
269 |
+
}
|
270 |
+
|
271 |
+
|
272 |
+
public function logstatsAction() // Return the number size of logs
|
273 |
+
{
|
274 |
+
if(!$this->_authorise()) {
|
275 |
+
return $this;
|
276 |
+
}
|
277 |
+
|
278 |
+
$time_start = microtime(true);
|
279 |
+
|
280 |
+
$currentSystemTime = date('Y-m-d H:i:s', time());
|
281 |
+
$sections = explode('/', trim($this->getRequest()->getPathInfo(), '/'));
|
282 |
+
$since = $this->getRequest()->getParam('since','ALL');
|
283 |
+
|
284 |
+
|
285 |
$_read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
286 |
|
287 |
if (method_exists($_read, 'showTableStatus')){
|
322 |
$log_visitor_infocount = $_read->fetchOne($query);
|
323 |
}
|
324 |
|
325 |
+
$tablename = 'log_customer';
|
326 |
if(!$_read ->showTableStatus(trim($tablename,"'"))){
|
327 |
$log_countcount = "table does not exist";
|
328 |
}
|
341 |
}
|
342 |
|
343 |
|
|
|
344 |
$apiversion = (String)Mage::getConfig()->getNode()->modules->MocoInsight_Mocoauto->version;
|
|
|
345 |
|
|
|
346 |
|
347 |
$stats = array(
|
348 |
'success' => 'true',
|
349 |
'Since' => $since,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
'log_url' => $log_urlcount,
|
351 |
'log_url_info' => $log_url_infocount,
|
352 |
'log_visitor' => $log_visitorcount,
|
353 |
'log_visitor_info' => $log_visitor_infocount,
|
354 |
'log_customer' => $log_customercount,
|
|
|
|
|
355 |
'MocoAPI Version' => $apiversion,
|
|
|
|
|
356 |
'API processing time' => (microtime(true) - $time_start)
|
357 |
);
|
358 |
|
363 |
return $this;
|
364 |
}
|
365 |
|
366 |
+
|
367 |
public function ordersAction()
|
368 |
{
|
369 |
if(!$this->_authorise()) {
|
692 |
$page_size = $this->getRequest()->getParam('page_size', 20);
|
693 |
$since = $this->getRequest()->getParam('since', 'ALL');
|
694 |
|
695 |
+
// Need to set store to admin so as to get all web site products.
|
696 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
697 |
+
|
698 |
$_categoryCol = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('*');
|
699 |
$_categoryCol->getSelect()->limit($page_size, ($offset * $page_size))->order('updated_at');
|
700 |
|
716 |
}
|
717 |
|
718 |
|
719 |
+
public function exproductsAction()
|
720 |
+
{
|
721 |
+
if(!$this->_authorise()) {
|
722 |
+
return $this;
|
723 |
+
}
|
724 |
+
|
725 |
+
$sections = explode('/', trim($this->getRequest()->getPathInfo(), '/'));
|
726 |
+
|
727 |
+
$offset = $this->getRequest()->getParam('offset', 0);
|
728 |
+
$page_size = $this->getRequest()->getParam('page_size', 20);
|
729 |
+
$since = $this->getRequest()->getParam('since', 'ALL');
|
730 |
+
$gTE = $this->getRequest()->getParam('gte', 'ALL');
|
731 |
+
|
732 |
+
$_productCol = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
|
733 |
+
|
734 |
+
if($since != 'ALL'){
|
735 |
+
$_productCol->addAttributeToFilter('updated_at', array('gteq' =>$since));
|
736 |
+
}
|
737 |
+
|
738 |
+
if($gTE != 'ALL'){
|
739 |
+
$_productCol->addFieldToFilter('entity_id', array('gteq' =>$gTE));
|
740 |
+
$_productCol->getSelect()->limit($page_size, ($offset * $page_size))->order('entity_id');
|
741 |
+
}
|
742 |
+
else{
|
743 |
+
$_productCol->getSelect()->limit($page_size, ($offset * $page_size))->order('updated_at');
|
744 |
+
}
|
745 |
+
|
746 |
+
$products[] = array('success' => 'true');
|
747 |
+
|
748 |
+
|
749 |
+
//Mage::log((string) $_productCol->getSelect());
|
750 |
+
|
751 |
+
foreach($_productCol as $_product){
|
752 |
+
|
753 |
+
// get all the custom attributes of the product
|
754 |
+
$attributes = $_product->getAttributes();
|
755 |
+
|
756 |
+
foreach ($attributes as $attribute) {
|
757 |
+
$attributeCode = $attribute->getAttributeCode();
|
758 |
+
|
759 |
+
switch ($attributeCode){
|
760 |
+
case 'in_depth':
|
761 |
+
break;
|
762 |
+
case 'description':
|
763 |
+
break;
|
764 |
+
case 'short_description':
|
765 |
+
break;
|
766 |
+
case 'thumbnail':
|
767 |
+
break;
|
768 |
+
case 'small_image':
|
769 |
+
break;
|
770 |
+
case 'image':
|
771 |
+
break;
|
772 |
+
default:
|
773 |
+
try {
|
774 |
+
$value = $attribute->getFrontend()->getValue($_product);
|
775 |
+
$products[] = array($attributeCode => $value);
|
776 |
+
}
|
777 |
+
catch (Exception $e) {
|
778 |
+
$products[] = array('mocoauto_api_error' => 'product attribute ' . $attributeCode . ' ' . $e->getMessage());
|
779 |
+
}
|
780 |
+
break;
|
781 |
+
}
|
782 |
+
}
|
783 |
+
|
784 |
+
// Get full url to product image
|
785 |
+
|
786 |
+
try{
|
787 |
+
$full_path_url = (string)Mage::helper('catalog/image')->init($_product, 'thumbnail');
|
788 |
+
$products[] = array('thumbnail' => $full_path_url);
|
789 |
+
$full_path_url = (string)Mage::helper('catalog/image')->init($_product, 'small_image');
|
790 |
+
$products[] = array('small_image' => $full_path_url);
|
791 |
+
$full_path_url = (string)Mage::helper('catalog/image')->init($_product, 'image');
|
792 |
+
$products[] = array('image' => $full_path_url);
|
793 |
+
}
|
794 |
+
catch (Exception $e) {
|
795 |
+
$products[] = array('mocoauto_api_error' => 'full path to image error:' . $e->getMessage());
|
796 |
+
}
|
797 |
+
|
798 |
+
// get all the categories of the product
|
799 |
+
|
800 |
+
$categories = $_product->getCategoryCollection()->addAttributeToSelect('name');
|
801 |
+
|
802 |
+
foreach ($categories as $category) {
|
803 |
+
$products[] = array('moco_category' => $category->getID());
|
804 |
+
}
|
805 |
+
|
806 |
+
// get inventory information
|
807 |
+
|
808 |
+
try{
|
809 |
+
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);
|
810 |
+
|
811 |
+
$products[] = array('stock_managed' => $stock->getManageStock());
|
812 |
+
$products[] = array('stock_availability' => $stock->getIsInStock());
|
813 |
+
}
|
814 |
+
catch (Exception $e) {
|
815 |
+
$products[] = array('mocoauto_api_error' => 'moco_product_inventory: ' . $e->getMessage());
|
816 |
+
}
|
817 |
+
|
818 |
+
// if type is configurable get simple product children
|
819 |
+
|
820 |
+
if($_product->getTypeID() == 'configurable'){
|
821 |
+
//$assocProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$_product);
|
822 |
+
$assocProducts = $_product->getTypeInstance()->getUsedProducts();
|
823 |
+
|
824 |
+
foreach($assocProducts as $assocProduct){
|
825 |
+
$products[] = array('childProductID' => $assocProduct->getID());
|
826 |
+
}
|
827 |
+
}
|
828 |
+
|
829 |
+
// if type is grouped get associated product children
|
830 |
+
|
831 |
+
if($_product->getTypeID() == 'grouped'){
|
832 |
+
|
833 |
+
$groupedProducts = $_product->getTypeInstance(true)->getAssociatedProducts($_product);
|
834 |
+
|
835 |
+
foreach($groupedProducts as $groupedProduct){
|
836 |
+
$products[] = array('childProductID' => $groupedProduct->getID());
|
837 |
+
|
838 |
+
}
|
839 |
+
}
|
840 |
+
|
841 |
+
// write end of record mark
|
842 |
+
$products[] = array('moco_end_of_record' => 'True');
|
843 |
+
|
844 |
+
}
|
845 |
+
|
846 |
+
$this->getResponse()
|
847 |
+
->setBody(json_encode(array('products' => $products)))
|
848 |
+
->setHttpResponseCode(200)
|
849 |
+
->setHeader('Content-type', 'application/json', true);
|
850 |
+
return $this;
|
851 |
+
}
|
852 |
+
|
853 |
public function productsAction()
|
854 |
{
|
855 |
if(!$this->_authorise()) {
|
863 |
$since = $this->getRequest()->getParam('since', 'ALL');
|
864 |
$gTE = $this->getRequest()->getParam('gte', 'ALL');
|
865 |
|
866 |
+
// Need to set store to admin so as to get all web site products.
|
867 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
868 |
+
|
869 |
$_productCol = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
|
870 |
|
871 |
if($since != 'ALL'){
|
987 |
return $this;
|
988 |
}
|
989 |
|
990 |
+
|
991 |
public function stocklevelsAction()
|
992 |
{
|
993 |
if(!$this->_authorise()) {
|
@@ -4,7 +4,7 @@
|
|
4 |
<config>
|
5 |
<modules>
|
6 |
<MocoInsight_Mocoauto>
|
7 |
-
<version>1.4.
|
8 |
</MocoInsight_Mocoauto>
|
9 |
</modules>
|
10 |
<global>
|
4 |
<config>
|
5 |
<modules>
|
6 |
<MocoInsight_Mocoauto>
|
7 |
+
<version>1.4.7</version>
|
8 |
</MocoInsight_Mocoauto>
|
9 |
</modules>
|
10 |
<global>
|
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MocoInsight_Mocoauto</name>
|
4 |
-
<version>1.4.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v1.0.0</license>
|
7 |
<channel>community</channel>
|
@@ -11,7 +11,15 @@
|
|
11 |

|
12 |

|
13 |
</description>
|
14 |
-
<notes>1.4.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |

|
16 |
Diagnostic: gte - ordered by entity_id
|
17 |

|
@@ -162,9 +170,9 @@ System date/time
|
|
162 |
added success true for succesful requests
|
163 |
changed product category to moco_category</notes>
|
164 |
<authors><author><name>Rob Davies</name><user>mocoinsight</user><email>rob.davies@mocoinsight.com</email></author></authors>
|
165 |
-
<date>2014-10-
|
166 |
-
<time>
|
167 |
-
<contents><target name="magecommunity"><dir name="MocoInsight"><dir name="Mocoauto"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Buttons"><file name="Generate.php" hash="7690d026d99e31732279e6aa5b6b1def"/></dir></dir><file name="Menu.php" hash="1017af5f89545915f3f28be637e07a0c"/></dir></dir><dir name="Helper"><file name="Data.php" hash="4b53061397fec9446830ef218aba4055"/><file name="JWT.php" hash="6610b92191eccedb8edcf993730c3dc0"/></dir><dir name="Model"><file name="Observer.php" hash="c2cc2f396fedd682268457d17dd045b1"/><dir name="Source"><file name="Views.php" hash="c1ddaf4c7bb51c3907dd72b4e21b1897"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="MocoautoController.php" hash="6665fb22806ef20ee59e88a638ca6359"/></dir><file name="ApiController.php" hash="
|
168 |
<compatible/>
|
169 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
170 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MocoInsight_Mocoauto</name>
|
4 |
+
<version>1.4.7</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v1.0.0</license>
|
7 |
<channel>community</channel>
|
11 |

|
12 |

|
13 |
</description>
|
14 |
+
<notes>1.4.7
|
15 |
+

|
16 |
+
Support for multiple web sites on single Magento instance.
|
17 |
+

|
18 |
+
1.4.6
|
19 |
+

|
20 |
+
Test actions for multi web site catalog.
|
21 |
+

|
22 |
+
1.4.5
|
23 |

|
24 |
Diagnostic: gte - ordered by entity_id
|
25 |

|
170 |
added success true for succesful requests
|
171 |
changed product category to moco_category</notes>
|
172 |
<authors><author><name>Rob Davies</name><user>mocoinsight</user><email>rob.davies@mocoinsight.com</email></author></authors>
|
173 |
+
<date>2014-10-07</date>
|
174 |
+
<time>03:02:42</time>
|
175 |
+
<contents><target name="magecommunity"><dir name="MocoInsight"><dir name="Mocoauto"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Buttons"><file name="Generate.php" hash="7690d026d99e31732279e6aa5b6b1def"/></dir></dir><file name="Menu.php" hash="1017af5f89545915f3f28be637e07a0c"/></dir></dir><dir name="Helper"><file name="Data.php" hash="4b53061397fec9446830ef218aba4055"/><file name="JWT.php" hash="6610b92191eccedb8edcf993730c3dc0"/></dir><dir name="Model"><file name="Observer.php" hash="c2cc2f396fedd682268457d17dd045b1"/><dir name="Source"><file name="Views.php" hash="c1ddaf4c7bb51c3907dd72b4e21b1897"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="MocoautoController.php" hash="6665fb22806ef20ee59e88a638ca6359"/></dir><file name="ApiController.php" hash="c29bc0c5ff883d886c0a21a082f372a5"/></dir><dir name="etc"><file name="config.xml" hash="7a698760f80597e5297dce854489f493"/><file name="rob.config" hash="63828905cc2f104275d380d0e7f9ebb3"/><file name="system.xml" hash="5d86b7d939b85826c7ac4d4496f80900"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mocoauto.xml" hash="7dd142354c78e773490c552bbcc3b408"/></dir><dir name="template"><dir name="mocoauto"><dir name="config"><file name="button-generate.phtml" hash="d2ff89c8f1f78e748ac998bd13e61750"/><file name="link.phtml" hash="75c61cac6bdd33ed914f8618b5698598"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="mocoauto.xml" hash="a12a0e1dc675b9ac675181373299e36a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MocoInsight_Mocoauto.xml" hash="1ec387f21726f6c7ea3ea216c47340d9"/></dir></target><target name="magelocale"><dir name="en_US"><file name="MocoInsight_Mocoauto.csv" hash="9b508561f871f93fa3158014baebf02b"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="mocoauto"><file name="button.png" hash="58e62edb7f4be46e3b29c0bb774c7ad7"/><file name="icon.png" hash="b5bfce535c987d1e9e604823ac4b3943"/><file name="mocoauto.css" hash="3cd28072e5c2f2b656dd04c06288165b"/></dir></dir></dir></dir></target></contents>
|
176 |
<compatible/>
|
177 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
178 |
</package>
|