Version Notes
1.5.2.7
Gift card info for EE customers.
Additional stock info for products.
Slight speed improvement for all customers.
1.5.2.4
Non critical update to anytables added created query option.
1.5.2.4
Non critical update to anytables support.
1.5.2.2
Update to ordersAction - don't return shipping_label info as very large and not needed.
Also new Actions to support custom tables
1.5.2.0
Fix warning notice of Undefined variable: TEMANDO_FLAG. No change to functionality
1.5.1.9
Removed shipping label (data) from test_orders shippments.
1.5.1.8
test_orders promoted to live.
shipment and temando support now available
1.5.1.7
uncoverted_carts upgrade
test_orders shipment and temando support
1.5.1.6
Testing direct SQL test_unconvertedcarts for BNKR
1.5.1.5
Skipping carts with customer_id = 0 for BNKR
1.5.1.4
Fixed problem with empty unconvertedcarts
1.5.1.3
test_unconvertedcartsAction.
1.5.1.2
Avoid exception if unconvertedcarts product type
fails.
1.5.1.1
Check if Mage::getEdition(); exists before calling.
1.5.1.0
Updates to visits API
1.5.0.6
Updates to visits API
1.5.0.5
New
creditsAction
credit_idsAction
1.5.0.4
Added item id to wishlist items
1.5.0.3
Diagnostic routine for unconverted carts
1.5.0.2
Maintenance release.
1.5.0.0
OrdersNoPaymentAction for sites with non standard payment methods.
1.4.9
Exception handle for payment method.
Updated wishlistsAction
New product_IdsAction
New customer_IdsAction
New order_IdsAction
unconvertedcarts fix for Magento < 1.7
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.5.2.7 |
Comparing to | |
See all releases |
Code changes from version 1.5.2.2 to 1.5.2.7
@@ -36,8 +36,9 @@
|
|
36 |
// sql_describeAction
|
37 |
// sql_showtablesAction
|
38 |
// list_modulesAction
|
|
|
39 |
|
40 |
-
define("apiversion","1.5.2.
|
41 |
|
42 |
class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Action
|
43 |
{
|
@@ -208,6 +209,50 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
208 |
->setHeader('Content-type', 'application/json', true);
|
209 |
return $this;
|
210 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
public function logstatsAction() // Return the number size of logs
|
212 |
{
|
213 |
if(!$this->_authorise()) {
|
@@ -616,6 +661,7 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
616 |
//
|
617 |
public function test_ordersAction()
|
618 |
{
|
|
|
619 |
if(!$this->_authorise()) {
|
620 |
return $this;
|
621 |
}
|
@@ -651,8 +697,12 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
651 |
if($_read ->isTableExists($tablename)){ //Table does exist
|
652 |
$TEMANDO_FLAG='TRUE';
|
653 |
}
|
|
|
|
|
|
|
654 |
|
655 |
$orders = array();
|
|
|
656 |
|
657 |
foreach($_orderCol as $_order) {
|
658 |
|
@@ -696,7 +746,7 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
696 |
$ordershipment = array();
|
697 |
foreach($shipmentdetails as $key => $value){ // iterate values array
|
698 |
//Mage::log('$key = ' . $key . ' $value = '. $value);
|
699 |
-
if($
|
700 |
$ordershipment[$key] = $value;
|
701 |
}
|
702 |
}
|
@@ -1238,6 +1288,145 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
1238 |
return $this;
|
1239 |
}
|
1240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1241 |
|
1242 |
public function stocklevelsAction()
|
1243 |
{
|
@@ -1470,6 +1659,10 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
1470 |
$offset = $this->getRequest()->getParam('offset', 0);
|
1471 |
$page_size = $this->getRequest()->getParam('page_size', 100);
|
1472 |
$tablename1 = $this->getRequest()->getParam('tablename', 'no table name set');
|
|
|
|
|
|
|
|
|
1473 |
|
1474 |
try{
|
1475 |
$_read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
@@ -1480,6 +1673,59 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
1480 |
$query = 'select ';
|
1481 |
$query = $query . '*';
|
1482 |
$query = $query . ' from ' . $tablename1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1483 |
|
1484 |
$query = $query .' limit ' . $offset . ',' . $page_size;
|
1485 |
|
@@ -2266,4 +2512,60 @@ class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Acti
|
|
2266 |
return $this;
|
2267 |
}
|
2268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2269 |
}
|
36 |
// sql_describeAction
|
37 |
// sql_showtablesAction
|
38 |
// list_modulesAction
|
39 |
+
// giftcardsAction
|
40 |
|
41 |
+
define("apiversion","1.5.2.7");
|
42 |
|
43 |
class MocoInsight_Mocoauto_ApiController extends Mage_Core_Controller_Front_Action
|
44 |
{
|
209 |
->setHeader('Content-type', 'application/json', true);
|
210 |
return $this;
|
211 |
}
|
212 |
+
|
213 |
+
public function statsliteAction()
|
214 |
+
{
|
215 |
+
if(!$this->_authorise()) {
|
216 |
+
return $this;
|
217 |
+
}
|
218 |
+
|
219 |
+
$time_start = microtime(true);
|
220 |
+
|
221 |
+
$MocoApiEpVer = '1.0.0'; // First version with version returned.
|
222 |
+
|
223 |
+
$currentSystemTime = date('Y-m-d H:i:s', time());
|
224 |
+
$sections = explode('/', trim($this->getRequest()->getPathInfo(), '/'));
|
225 |
+
$since = $this->getRequest()->getParam('since','ALL');
|
226 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); // set to admin view all sites and stores
|
227 |
+
$magentoVersion = Mage::getVersion();
|
228 |
+
$moduleversion = (String)Mage::getConfig()->getNode()->modules->MocoInsight_Mocoauto->version;
|
229 |
+
$phpversion = phpversion();
|
230 |
+
|
231 |
+
if(method_exists('Mage', 'getEdition')){
|
232 |
+
$magentoedition = (String)Mage::getEdition();
|
233 |
+
}
|
234 |
+
else{
|
235 |
+
$magentoedition = 'method Mage::getEdition() unavailable';
|
236 |
+
}
|
237 |
+
|
238 |
+
$statslite = array(
|
239 |
+
'mocoauto_api_end_point_version' => $MocoApiEpVer,
|
240 |
+
'System Date Time' => $currentSystemTime,
|
241 |
+
'Magento Version' => $magentoVersion,
|
242 |
+
'Magento Edition' => $magentoedition,
|
243 |
+
'MocoAPI Version' => apiversion,
|
244 |
+
'Module Version' => $moduleversion,
|
245 |
+
'PHP Version' => $phpversion,
|
246 |
+
'API processing time' => (microtime(true) - $time_start)
|
247 |
+
);
|
248 |
+
|
249 |
+
$this->getResponse()
|
250 |
+
->setBody(json_encode($statslite))
|
251 |
+
->setHttpResponseCode(200)
|
252 |
+
->setHeader('Content-type', 'application/json', true);
|
253 |
+
return $this;
|
254 |
+
}
|
255 |
+
|
256 |
public function logstatsAction() // Return the number size of logs
|
257 |
{
|
258 |
if(!$this->_authorise()) {
|
661 |
//
|
662 |
public function test_ordersAction()
|
663 |
{
|
664 |
+
$MocoApiEpVer = '1.0.0'; // First version with version returned.
|
665 |
if(!$this->_authorise()) {
|
666 |
return $this;
|
667 |
}
|
697 |
if($_read ->isTableExists($tablename)){ //Table does exist
|
698 |
$TEMANDO_FLAG='TRUE';
|
699 |
}
|
700 |
+
else{
|
701 |
+
$TEMANDO_FLAG='FALSE';
|
702 |
+
}
|
703 |
|
704 |
$orders = array();
|
705 |
+
$orders[] = array('mocoauto_api_end_point_version' => $MocoApiEpVer);
|
706 |
|
707 |
foreach($_orderCol as $_order) {
|
708 |
|
746 |
$ordershipment = array();
|
747 |
foreach($shipmentdetails as $key => $value){ // iterate values array
|
748 |
//Mage::log('$key = ' . $key . ' $value = '. $value);
|
749 |
+
if(strlen($value) < 512){ // if the value is less than 512 it is OK write to output array
|
750 |
$ordershipment[$key] = $value;
|
751 |
}
|
752 |
}
|
1288 |
return $this;
|
1289 |
}
|
1290 |
|
1291 |
+
public function test_productsAction()
|
1292 |
+
{
|
1293 |
+
$MocoApiEpVer = '1.0.0'; // First version with version returned.
|
1294 |
+
if(!$this->_authorise()) {
|
1295 |
+
return $this;
|
1296 |
+
}
|
1297 |
+
|
1298 |
+
$sections = explode('/', trim($this->getRequest()->getPathInfo(), '/'));
|
1299 |
+
|
1300 |
+
$offset = $this->getRequest()->getParam('offset', 0);
|
1301 |
+
$page_size = $this->getRequest()->getParam('page_size', 20);
|
1302 |
+
$since = $this->getRequest()->getParam('since', 'ALL');
|
1303 |
+
$gTE = $this->getRequest()->getParam('gte', 'ALL');
|
1304 |
+
|
1305 |
+
// Need to set store to admin so as to get all web site products.
|
1306 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
1307 |
+
|
1308 |
+
$_productCol = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*');
|
1309 |
+
|
1310 |
+
if($since != 'ALL'){
|
1311 |
+
$_productCol->addAttributeToFilter('updated_at', array('gteq' =>$since));
|
1312 |
+
}
|
1313 |
+
|
1314 |
+
if($gTE != 'ALL'){
|
1315 |
+
$_productCol->addFieldToFilter('entity_id', array('gteq' =>$gTE));
|
1316 |
+
$_productCol->getSelect()->limit($page_size, ($offset * $page_size))->order('entity_id');
|
1317 |
+
}
|
1318 |
+
else{
|
1319 |
+
$_productCol->getSelect()->limit($page_size, ($offset * $page_size))->order('updated_at');
|
1320 |
+
}
|
1321 |
+
|
1322 |
+
$products[] = array('mocoauto_api_end_point_version' => $MocoApiEpVer);
|
1323 |
+
|
1324 |
+
|
1325 |
+
//Mage::log((string) $_productCol->getSelect());
|
1326 |
+
|
1327 |
+
foreach($_productCol as $_product){
|
1328 |
+
|
1329 |
+
// get all the custom attributes of the product
|
1330 |
+
$attributes = $_product->getAttributes();
|
1331 |
+
|
1332 |
+
foreach ($attributes as $attribute) {
|
1333 |
+
$attributeCode = $attribute->getAttributeCode();
|
1334 |
+
|
1335 |
+
switch ($attributeCode){
|
1336 |
+
case 'in_depth':
|
1337 |
+
break;
|
1338 |
+
case 'description':
|
1339 |
+
break;
|
1340 |
+
case 'short_description':
|
1341 |
+
break;
|
1342 |
+
case 'thumbnail':
|
1343 |
+
break;
|
1344 |
+
case 'small_image':
|
1345 |
+
break;
|
1346 |
+
case 'image':
|
1347 |
+
break;
|
1348 |
+
default:
|
1349 |
+
try {
|
1350 |
+
$value = $attribute->getFrontend()->getValue($_product);
|
1351 |
+
$products[] = array($attributeCode => $value);
|
1352 |
+
}
|
1353 |
+
catch (Exception $e) {
|
1354 |
+
$products[] = array('mocoauto_api_error' => 'product attribute ' . $attributeCode . ' ' . $e->getMessage());
|
1355 |
+
}
|
1356 |
+
break;
|
1357 |
+
}
|
1358 |
+
}
|
1359 |
+
|
1360 |
+
// Get full url to product image
|
1361 |
+
|
1362 |
+
try{
|
1363 |
+
$full_path_url = (string)Mage::helper('catalog/image')->init($_product, 'thumbnail');
|
1364 |
+
$products[] = array('thumbnail' => $full_path_url);
|
1365 |
+
$full_path_url = (string)Mage::helper('catalog/image')->init($_product, 'small_image');
|
1366 |
+
$products[] = array('small_image' => $full_path_url);
|
1367 |
+
$full_path_url = (string)Mage::helper('catalog/image')->init($_product, 'image');
|
1368 |
+
$products[] = array('image' => $full_path_url);
|
1369 |
+
}
|
1370 |
+
catch (Exception $e) {
|
1371 |
+
$products[] = array('mocoauto_api_error' => 'full path to image error:' . $e->getMessage());
|
1372 |
+
}
|
1373 |
+
|
1374 |
+
// get all the categories of the product
|
1375 |
+
|
1376 |
+
$categories = $_product->getCategoryCollection()->addAttributeToSelect('name');
|
1377 |
+
|
1378 |
+
foreach ($categories as $category) {
|
1379 |
+
$products[] = array('moco_category' => $category->getID());
|
1380 |
+
}
|
1381 |
+
|
1382 |
+
// get inventory information
|
1383 |
+
try{
|
1384 |
+
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);
|
1385 |
+
|
1386 |
+
$products[] = array('stock_managed' => $stock->getManageStock());
|
1387 |
+
$products[] = array('stock_availability' => $stock->getIsInStock());
|
1388 |
+
$products[] = array('backorders' => $stock->getBackorders());
|
1389 |
+
}
|
1390 |
+
catch (Exception $e) {
|
1391 |
+
$products[] = array('mocoauto_api_error' => 'moco_product_inventory: ' . $e->getMessage());
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
// if type is configurable get simple product children
|
1395 |
+
|
1396 |
+
if($_product->getTypeID() == 'configurable'){
|
1397 |
+
//$assocProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$_product);
|
1398 |
+
$assocProducts = $_product->getTypeInstance()->getUsedProducts();
|
1399 |
+
|
1400 |
+
foreach($assocProducts as $assocProduct){
|
1401 |
+
$products[] = array('childProductID' => $assocProduct->getID());
|
1402 |
+
}
|
1403 |
+
}
|
1404 |
+
|
1405 |
+
// if type is grouped get associated product children
|
1406 |
+
|
1407 |
+
if($_product->getTypeID() == 'grouped'){
|
1408 |
+
|
1409 |
+
$groupedProducts = $_product->getTypeInstance(true)->getAssociatedProducts($_product);
|
1410 |
+
|
1411 |
+
foreach($groupedProducts as $groupedProduct){
|
1412 |
+
$products[] = array('childProductID' => $groupedProduct->getID());
|
1413 |
+
|
1414 |
+
}
|
1415 |
+
}
|
1416 |
+
|
1417 |
+
// write end of record mark
|
1418 |
+
$products[] = array('moco_end_of_record' => 'True');
|
1419 |
+
|
1420 |
+
}
|
1421 |
+
|
1422 |
+
$this->getResponse()
|
1423 |
+
->setBody(json_encode(array('products' => $products)))
|
1424 |
+
->setHttpResponseCode(200)
|
1425 |
+
->setHeader('Content-type', 'application/json', true);
|
1426 |
+
return $this;
|
1427 |
+
}
|
1428 |
+
|
1429 |
+
|
1430 |
|
1431 |
public function stocklevelsAction()
|
1432 |
{
|
1659 |
$offset = $this->getRequest()->getParam('offset', 0);
|
1660 |
$page_size = $this->getRequest()->getParam('page_size', 100);
|
1661 |
$tablename1 = $this->getRequest()->getParam('tablename', 'no table name set');
|
1662 |
+
$since = $this->getRequest()->getParam('since', 'ALL');
|
1663 |
+
$created = $this->getRequest()->getParam('created', 'ALL');
|
1664 |
+
|
1665 |
+
|
1666 |
|
1667 |
try{
|
1668 |
$_read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
1673 |
$query = 'select ';
|
1674 |
$query = $query . '*';
|
1675 |
$query = $query . ' from ' . $tablename1;
|
1676 |
+
if($since != 'ALL'){
|
1677 |
+
$query = $query . ' where updated_at >= ' . "'" . $since . "'" . ' order by updated_at';
|
1678 |
+
}
|
1679 |
+
// Added a created_at select and order as some tables dont't have updated_at
|
1680 |
+
if($created != 'ALL'){
|
1681 |
+
$query = $query . ' where created_at >= ' . "'" . $created . "'" . ' order by created_at';
|
1682 |
+
}
|
1683 |
+
|
1684 |
+
$query = $query .' limit ' . $offset . ',' . $page_size;
|
1685 |
+
|
1686 |
+
//Mage::log('DBG SQL: '. $query);
|
1687 |
+
|
1688 |
+
if(($since != 'ALL') && ($created != 'ALL')){ // don't want to select and order on both
|
1689 |
+
$readresults[] = array('mocoauto_api_error' => 'since and created parameters are mutually exclusive');
|
1690 |
+
}
|
1691 |
+
else{
|
1692 |
+
$readresults = $_read->fetchAll($query);
|
1693 |
+
}
|
1694 |
+
}
|
1695 |
+
}
|
1696 |
+
catch(Exception $e) {
|
1697 |
+
$readresults[] = array('mocoauto_api_error' => 'error reading ' . $tablename1 . ' : ' . $e->getMessage());
|
1698 |
+
}
|
1699 |
+
|
1700 |
+
$this->getResponse()
|
1701 |
+
->setBody(json_encode($readresults))
|
1702 |
+
->setHttpResponseCode(200)
|
1703 |
+
->setHeader('Content-type', 'application/json', true);
|
1704 |
+
return $this;
|
1705 |
+
}
|
1706 |
+
|
1707 |
+
public function ex_sql_anytableAction()
|
1708 |
+
{
|
1709 |
+
|
1710 |
+
if(!$this->_authorise()) {
|
1711 |
+
return $this;
|
1712 |
+
}
|
1713 |
+
|
1714 |
+
$sections = explode('/', trim($this->getRequest()->getPathInfo(), '/'));
|
1715 |
+
|
1716 |
+
$offset = $this->getRequest()->getParam('offset', 0);
|
1717 |
+
$page_size = $this->getRequest()->getParam('page_size', 100);
|
1718 |
+
$tablename1 = $this->getRequest()->getParam('tablename', 'no table name set');
|
1719 |
+
|
1720 |
+
try{
|
1721 |
+
$_read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
1722 |
+
if(!$_read ->showTableStatus(trim($tablename1,"'"))){
|
1723 |
+
$readresults=array($tablename1 ." table does not exist");
|
1724 |
+
}
|
1725 |
+
else{
|
1726 |
+
$query = 'select ';
|
1727 |
+
$query = $query . '*';
|
1728 |
+
$query = $query . ' from ' . $tablename1;
|
1729 |
|
1730 |
$query = $query .' limit ' . $offset . ',' . $page_size;
|
1731 |
|
2512 |
return $this;
|
2513 |
}
|
2514 |
|
2515 |
+
public function giftcardsAction()
|
2516 |
+
{
|
2517 |
+
$MocoApiEpVer = '1.0.0'; // First version with version returned.
|
2518 |
+
$tablename1 = 'enterprise_giftcardaccount_history';
|
2519 |
+
$tablename2 = 'enterprise_giftcardaccount';
|
2520 |
+
|
2521 |
+
if(!$this->_authorise()) {
|
2522 |
+
return $this;
|
2523 |
+
}
|
2524 |
+
|
2525 |
+
$sections = explode('/', trim($this->getRequest()->getPathInfo(), '/'));
|
2526 |
+
|
2527 |
+
$offset = $this->getRequest()->getParam('offset', 0);
|
2528 |
+
$page_size = $this->getRequest()->getParam('page_size', 20);
|
2529 |
+
$since = $this->getRequest()->getParam('since', 'ALL');
|
2530 |
+
|
2531 |
+
$readresults[] = array('mocoauto_api_end_point_version' => $MocoApiEpVer);
|
2532 |
+
|
2533 |
+
try{
|
2534 |
+
$_read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
2535 |
+
if(!$_read ->showTableStatus(trim($tablename1,"'"))){
|
2536 |
+
$readresults[]=array($tablename1 ." table does not exist");
|
2537 |
+
}
|
2538 |
+
elseif(!$_read ->showTableStatus(trim($tablename2,"'"))){
|
2539 |
+
$readresults[]=array($tablename2 ." table does not exist");
|
2540 |
+
}
|
2541 |
+
else{
|
2542 |
+
$query = 'select ';
|
2543 |
+
$query = $query . $tablename1 . '.*, ';
|
2544 |
+
$query = $query . $tablename2 . '.* ';
|
2545 |
+
$query = $query . ' from ' . $tablename1;
|
2546 |
+
$query = $query . ' Left join ' . $tablename2 . ' on ' . $tablename1 . '.giftcardaccount_id = ' . $tablename2 . '.giftcardaccount_id';
|
2547 |
+
|
2548 |
+
|
2549 |
+
if($since != 'ALL'){
|
2550 |
+
$query = $query . ' where updated_at > "' . $since . '"';
|
2551 |
+
}
|
2552 |
+
|
2553 |
+
$query = $query .' order by updated_at limit ' . $offset . ',' . $page_size;
|
2554 |
+
|
2555 |
+
//Mage::log('DBG SQL: '. $query);
|
2556 |
+
|
2557 |
+
$readresults[] = $_read->fetchAll($query);
|
2558 |
+
}
|
2559 |
+
}
|
2560 |
+
catch(Exception $e) {
|
2561 |
+
$readresults[] = array('mocoauto_api_error' => 'giftcard sql error: ' . $e->getMessage());
|
2562 |
+
}
|
2563 |
+
|
2564 |
+
$this->getResponse()
|
2565 |
+
->setBody(json_encode($readresults))
|
2566 |
+
->setHttpResponseCode(200)
|
2567 |
+
->setHeader('Content-type', 'application/json', true);
|
2568 |
+
return $this;
|
2569 |
+
}
|
2570 |
+
|
2571 |
}
|
@@ -4,7 +4,7 @@
|
|
4 |
<config>
|
5 |
<modules>
|
6 |
<MocoInsight_Mocoauto>
|
7 |
-
<version>1.5.2.
|
8 |
</MocoInsight_Mocoauto>
|
9 |
</modules>
|
10 |
<global>
|
4 |
<config>
|
5 |
<modules>
|
6 |
<MocoInsight_Mocoauto>
|
7 |
+
<version>1.5.2.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.5.2.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v1.0.0</license>
|
7 |
<channel>community</channel>
|
@@ -11,7 +11,21 @@
|
|
11 |

|
12 |

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

|
16 |
Update to ordersAction - don't return shipping_label info as very large and not needed.
|
17 |

|
@@ -261,9 +275,9 @@ System date/time
|
|
261 |
added success true for succesful requests
|
262 |
changed product category to moco_category</notes>
|
263 |
<authors><author><name>Rob Davies</name><user>mocoinsight</user><email>rob.davies@mocoinsight.com</email></author></authors>
|
264 |
-
<date>2015-
|
265 |
-
<time>
|
266 |
-
<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="Api2OrdersController.php" hash="b9fa4922f70212b8b0fbf5ccc12a3e5b"/><file name="ApiController.php" hash="
|
267 |
<compatible/>
|
268 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
269 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MocoInsight_Mocoauto</name>
|
4 |
+
<version>1.5.2.7</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL v1.0.0</license>
|
7 |
<channel>community</channel>
|
11 |

|
12 |

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

|
16 |
+
Gift card info for EE customers.
|
17 |
+
Additional stock info for products.
|
18 |
+
Slight speed improvement for all customers.
|
19 |
+

|
20 |
+
1.5.2.4
|
21 |
+

|
22 |
+
Non critical update to anytables added created query option.
|
23 |
+

|
24 |
+
1.5.2.4
|
25 |
+

|
26 |
+
Non critical update to anytables support.
|
27 |
+

|
28 |
+
1.5.2.2
|
29 |

|
30 |
Update to ordersAction - don't return shipping_label info as very large and not needed.
|
31 |

|
275 |
added success true for succesful requests
|
276 |
changed product category to moco_category</notes>
|
277 |
<authors><author><name>Rob Davies</name><user>mocoinsight</user><email>rob.davies@mocoinsight.com</email></author></authors>
|
278 |
+
<date>2015-09-24</date>
|
279 |
+
<time>07:07:09</time>
|
280 |
+
<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="Api2OrdersController.php" hash="b9fa4922f70212b8b0fbf5ccc12a3e5b"/><file name="ApiController.php" hash="6ae53751dbf518c52e5dcf7535fd83e8"/></dir><dir name="etc"><file name="config.xml" hash="4e62301045843da898e1e98d035a8a39"/><file name="orig.config.xml" hash="863bd2bdfefde5ef9f6c9b30691f4bb4"/><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>
|
281 |
<compatible/>
|
282 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
283 |
</package>
|