Version Notes
Initial Code
Download this release
Release Info
Developer | MineWhat Inc. |
Extension | choiceai |
Version | 1.0.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.4 to 1.0.5
app/code/community/ChoiceAI/Personalisation/controllers/ApiController.php
CHANGED
@@ -334,6 +334,85 @@ class ChoiceAI_Personalisation_ApiController extends Mage_Core_Controller_Front_
|
|
334 |
|
335 |
}
|
336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
|
338 |
public function stockAction() {
|
339 |
|
@@ -411,9 +490,9 @@ class ChoiceAI_Personalisation_ApiController extends Mage_Core_Controller_Front_
|
|
411 |
'url' => $product->getProductUrl(),
|
412 |
'info' => $product->getShortDescription(),
|
413 |
'status' => $product->getStatus(),
|
414 |
-
'type'
|
415 |
-
'created_at'
|
416 |
-
'updated_at'
|
417 |
);
|
418 |
if(!$formattedProduct['manufacturer'] || strlen($formattedProduct['manufacturer']) === 0) {
|
419 |
$product = Mage::getModel('catalog/product')->load($product->getId());
|
@@ -474,8 +553,8 @@ class ChoiceAI_Personalisation_ApiController extends Mage_Core_Controller_Front_
|
|
474 |
'url' => $category->getUrl(),
|
475 |
'level' => $category->getLevel(),
|
476 |
'is_active' => $category->getIsActive(),
|
477 |
-
'created_at'
|
478 |
-
'updated_at'
|
479 |
);
|
480 |
|
481 |
} catch(Exception $e) {}
|
@@ -485,4 +564,3 @@ class ChoiceAI_Personalisation_ApiController extends Mage_Core_Controller_Front_
|
|
485 |
}
|
486 |
|
487 |
}
|
488 |
-
|
334 |
|
335 |
}
|
336 |
|
337 |
+
public function usersAction() {
|
338 |
+
|
339 |
+
try {
|
340 |
+
|
341 |
+
if(!$this->_authorise()) {
|
342 |
+
return $this;
|
343 |
+
}
|
344 |
+
|
345 |
+
$email = $this->getRequest()->getParam('email');
|
346 |
+
|
347 |
+
$limit = $this->getRequest()->getParam('limit', 100);
|
348 |
+
$offset = $this->getRequest()->getParam('offset', 0);
|
349 |
+
|
350 |
+
$attributes = array(
|
351 |
+
'id',
|
352 |
+
'email',
|
353 |
+
'firstname',
|
354 |
+
'lastname',
|
355 |
+
'created_at',
|
356 |
+
'updated_at'
|
357 |
+
);
|
358 |
+
|
359 |
+
$usersCollection = Mage::getModel('customer/customer')->getCollection();
|
360 |
+
|
361 |
+
if($email != null && strlen($email) > 0) {
|
362 |
+
|
363 |
+
$usersCollection
|
364 |
+
->addAttributeToFilter('email', $email);
|
365 |
+
|
366 |
+
} else {
|
367 |
+
|
368 |
+
$created_at_min = $this->getRequest()->getParam('created_at_min');
|
369 |
+
$created_at_max = $this->getRequest()->getParam('created_at_max');
|
370 |
+
|
371 |
+
$usersCollection->addAttributeToSelect($attributes);
|
372 |
+
|
373 |
+
if($created_at_min != null && strlen($created_at_min) > 0) {
|
374 |
+
$usersCollection->addAttributeToFilter('created_at', array('from' => $created_at_min));
|
375 |
+
}
|
376 |
+
|
377 |
+
if($created_at_max != null && strlen($created_at_max) > 0) {
|
378 |
+
$usersCollection->addAttributeToFilter('created_at', array('to' => $created_at_max));
|
379 |
+
}
|
380 |
+
|
381 |
+
$usersCollection->getSelect()
|
382 |
+
->limit($limit, $offset);
|
383 |
+
|
384 |
+
}
|
385 |
+
|
386 |
+
$users = array();
|
387 |
+
|
388 |
+
foreach ($usersCollection as $user) {
|
389 |
+
$formattedUser = array();
|
390 |
+
$formattedUser["id"] = $user->getId();
|
391 |
+
$formattedUser["email"] = $user->getEmail();
|
392 |
+
$formattedUser["firstname"] = $user->getFirstname();
|
393 |
+
$formattedUser["lastname"] = $user->getLastname();
|
394 |
+
$formattedUser["created_at"] = $user->getCreatedAt();
|
395 |
+
$formattedUser["updated_at"] = $user->getUpdatedAt();
|
396 |
+
$users[] = $formattedUser;
|
397 |
+
}
|
398 |
+
|
399 |
+
|
400 |
+
$this->getResponse()
|
401 |
+
->setBody(json_encode(array('users' => $users, 'version' => 2)))
|
402 |
+
->setHttpResponseCode(200)
|
403 |
+
->setHeader('Content-type', 'application/json', true);
|
404 |
+
|
405 |
+
} catch(Exception $e) {
|
406 |
+
$this->getResponse()
|
407 |
+
->setBody(json_encode(array('status' => 'error', 'message' => 'Internal server error', 'version' => 2)))
|
408 |
+
->setHttpResponseCode(500)
|
409 |
+
->setHeader('Content-type', 'application/json', true);
|
410 |
+
}
|
411 |
+
|
412 |
+
return $this;
|
413 |
+
|
414 |
+
}
|
415 |
+
|
416 |
|
417 |
public function stockAction() {
|
418 |
|
490 |
'url' => $product->getProductUrl(),
|
491 |
'info' => $product->getShortDescription(),
|
492 |
'status' => $product->getStatus(),
|
493 |
+
'type' => $product->getTypeId(),
|
494 |
+
'created_at' => $product->getCreatedAt(),
|
495 |
+
'updated_at' => $product->getUpdatedAt()
|
496 |
);
|
497 |
if(!$formattedProduct['manufacturer'] || strlen($formattedProduct['manufacturer']) === 0) {
|
498 |
$product = Mage::getModel('catalog/product')->load($product->getId());
|
553 |
'url' => $category->getUrl(),
|
554 |
'level' => $category->getLevel(),
|
555 |
'is_active' => $category->getIsActive(),
|
556 |
+
'created_at' => $category->getCreatedAt(),
|
557 |
+
'updated_at' => $category->getUpdatedAt()
|
558 |
);
|
559 |
|
560 |
} catch(Exception $e) {}
|
564 |
}
|
565 |
|
566 |
}
|
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>choiceai</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">osl</license>
|
7 |
<channel>community</channel>
|
@@ -10,8 +10,8 @@
|
|
10 |
<description>Choice AI</description>
|
11 |
<notes>Initial Code</notes>
|
12 |
<authors><author><name>MineWhat Inc.</name><user>MineWhat</user><email>plugins@minewhat.com</email></author></authors>
|
13 |
-
<date>2016-
|
14 |
-
<time>
|
15 |
<contents><target name="mageetc"><dir name="modules"><file name="ChoiceAI_Personalisation.xml" hash="28fd1d1b9b298b14b83fdcadf586efc5"/></dir></target><target name="magecommunity"><dir name="ChoiceAI"><dir name="Personalisation"><dir><dir name="Block"><dir name="Base"><file name="Script.php" hash="af614113dea10a0a6d88281f615f1929"/></dir><dir name="Event"><dir name="Catalog"><dir name="Product"><file name="View.php" hash="233ac45484c22ecdf7063071406f71e2"/></dir></dir><dir name="Checkout"><dir name="Cart"><file name="Index.php" hash="e3bc31a08a994d72223d78ebde8a74f0"/></dir><dir name="Onepage"><file name="Success.php" hash="cc242d118e6b06bb3817d95b2322167c"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7da393b7cf4def36383198029a90c907"/></dir><dir name="Model"><file name="Observer.php" hash="b62729ff6f0d7666c1461b3259aa2755"/></dir><dir name="controllers"><file name="ApiController.php" hash="035c1f5e7c1cefbec8ae59b2f1946897"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2fc12bb0874c8f39963f1593b3954d2e"/><file name="config.xml" hash="f743d8ead3776891503ff368ad7e7330"/><file name="system.xml" hash="6f4674088b4c392cc06f5a70f383fd54"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="choiceai"><dir name="personalisation"><dir><dir name="base"><file name="script.phtml" hash="5e9386a2c0af502d406ba0c8f29b7345"/></dir><dir name="event"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="21de45429a80fd7a025092cd17629e6d"/></dir></dir><dir name="checkout"><dir name="cart"><file name="index.phtml" hash="37a7ec61318af0e52aae869de631aaf6"/></dir></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="choiceai_personalisation.xml" hash="95d72912f3b13c5a399e3b2e5b89dba9"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="choiceai"><dir name="personalisation"><dir><dir name="base"><file name="script.phtml" hash="3e5799dc6ccf5b4f120400d48f5f95d2"/></dir></dir></dir></dir></dir><dir name="layout"><file name="choiceai_personalisation.xml" hash="95d72912f3b13c5a399e3b2e5b89dba9"/></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.5</min><max>6.0.0</max></php></required></dependencies>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>choiceai</name>
|
4 |
+
<version>1.0.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">osl</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Choice AI</description>
|
11 |
<notes>Initial Code</notes>
|
12 |
<authors><author><name>MineWhat Inc.</name><user>MineWhat</user><email>plugins@minewhat.com</email></author></authors>
|
13 |
+
<date>2016-05-11</date>
|
14 |
+
<time>12:05:00</time>
|
15 |
<contents><target name="mageetc"><dir name="modules"><file name="ChoiceAI_Personalisation.xml" hash="28fd1d1b9b298b14b83fdcadf586efc5"/></dir></target><target name="magecommunity"><dir name="ChoiceAI"><dir name="Personalisation"><dir><dir name="Block"><dir name="Base"><file name="Script.php" hash="af614113dea10a0a6d88281f615f1929"/></dir><dir name="Event"><dir name="Catalog"><dir name="Product"><file name="View.php" hash="233ac45484c22ecdf7063071406f71e2"/></dir></dir><dir name="Checkout"><dir name="Cart"><file name="Index.php" hash="e3bc31a08a994d72223d78ebde8a74f0"/></dir><dir name="Onepage"><file name="Success.php" hash="cc242d118e6b06bb3817d95b2322167c"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7da393b7cf4def36383198029a90c907"/></dir><dir name="Model"><file name="Observer.php" hash="b62729ff6f0d7666c1461b3259aa2755"/></dir><dir name="controllers"><file name="ApiController.php" hash="035c1f5e7c1cefbec8ae59b2f1946897"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2fc12bb0874c8f39963f1593b3954d2e"/><file name="config.xml" hash="f743d8ead3776891503ff368ad7e7330"/><file name="system.xml" hash="6f4674088b4c392cc06f5a70f383fd54"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="choiceai"><dir name="personalisation"><dir><dir name="base"><file name="script.phtml" hash="5e9386a2c0af502d406ba0c8f29b7345"/></dir><dir name="event"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="21de45429a80fd7a025092cd17629e6d"/></dir></dir><dir name="checkout"><dir name="cart"><file name="index.phtml" hash="37a7ec61318af0e52aae869de631aaf6"/></dir></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="choiceai_personalisation.xml" hash="95d72912f3b13c5a399e3b2e5b89dba9"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="choiceai"><dir name="personalisation"><dir><dir name="base"><file name="script.phtml" hash="3e5799dc6ccf5b4f120400d48f5f95d2"/></dir></dir></dir></dir></dir><dir name="layout"><file name="choiceai_personalisation.xml" hash="95d72912f3b13c5a399e3b2e5b89dba9"/></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.5</min><max>6.0.0</max></php></required></dependencies>
|