Version Notes
This is a SOAP extension for abandoned reports. This will get all details required for sending mails from TM.
Download this release
Release Info
Developer | Arindam |
Extension | TmReportSOAPAPIExtension |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.3
app/code/local/Tailoredmail/Report/Model/Abandonedcart/Api.php
CHANGED
@@ -3,12 +3,49 @@ class Tailoredmail_Report_Model_Abandonedcart_Api extends Mage_Api_Model_Resourc
|
|
3 |
{
|
4 |
public function getabandonedcarts($arg)
|
5 |
{
|
6 |
-
|
7 |
$collection = Mage::getResourceModel('reports/quote_collection');
|
8 |
$collection->prepareForAbandonedReport();
|
9 |
$output = $collection->load()->toArray();
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
}
|
3 |
{
|
4 |
public function getabandonedcarts($arg)
|
5 |
{
|
|
|
6 |
$collection = Mage::getResourceModel('reports/quote_collection');
|
7 |
$collection->prepareForAbandonedReport();
|
8 |
$output = $collection->load()->toArray();
|
9 |
+
|
10 |
+
$quote= Mage::getModel('sales/quote');
|
11 |
+
$quote_coll = $quote->getCollection();
|
12 |
+
|
13 |
+
$return_data = array();
|
14 |
|
15 |
+
foreach($output['items'] as $obj){
|
16 |
+
$quote_id = $obj['entity_id'];
|
17 |
+
$tmp_quotedata = $quote_coll->getItemById($quote_id)->getItemsCollection()->toArray();
|
18 |
+
|
19 |
+
$count = $count + 1;
|
20 |
+
$return_data[$obj['customer_email']]['email'] = $obj['customer_email'];
|
21 |
+
$return_data[$obj['customer_email']]['cartid'] = $quote_id;
|
22 |
+
$return_data[$obj['customer_email']]['customer_id'] = $obj['customer_id'];
|
23 |
+
$return_data[$obj['customer_email']]['user'] = $obj['customer_prefix'] . " " . $obj['customer_firstname'] . " ". $obj["customer_lastname"];
|
24 |
+
$return_data[$obj['customer_email']]['updated_at'] = $obj['updated_at'];
|
25 |
+
$return_data[$obj['customer_email']]['subtotal'] = $obj['subtotal'];
|
26 |
+
|
27 |
+
foreach ($tmp_quotedata["items"] as $item) {
|
28 |
+
$temp['name'] = $item["name"];
|
29 |
+
$temp['quantity'] = $item["qty"];
|
30 |
+
$temp['price'] = $item["price"];
|
31 |
+
$temp['plu'] = $item["sku"];
|
32 |
+
$temp['product_id'] = $item["product_id"];
|
33 |
+
if(isset($item["product"])){
|
34 |
+
$temp['image'] = $item["product"]["small_image"];
|
35 |
+
$temp['thumbnail'] = $item["product"]["thumbnail"];
|
36 |
+
$temp['created_at'] = $item["product"]["created_at"];
|
37 |
+
$temp['updated_at'] = $item["product"]["updated_at"];
|
38 |
+
}
|
39 |
+
else{
|
40 |
+
$temp['image'] = "";
|
41 |
+
$temp['thumbnail'] = "";
|
42 |
+
}
|
43 |
+
$return_data[$obj['customer_email']]['cart'][] = $temp;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
foreach( $return_data as $value){
|
47 |
+
$new_return[] = $value;
|
48 |
+
}
|
49 |
+
return json_encode($new_return);
|
50 |
}
|
51 |
}
|
includes/src/Tailoredmail_Report_Model_Abandonedcart_Api.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Tailoredmail_Report_Model_Abandonedcart_Api extends Mage_Api_Model_Resource_Abstract
|
3 |
+
{
|
4 |
+
public function getabandonedcarts($arg)
|
5 |
+
{
|
6 |
+
$collection = Mage::getResourceModel('reports/quote_collection');
|
7 |
+
$collection->prepareForAbandonedReport();
|
8 |
+
$output = $collection->load()->toArray();
|
9 |
+
|
10 |
+
$quote= Mage::getModel('sales/quote');
|
11 |
+
$quote_coll = $quote->getCollection();
|
12 |
+
|
13 |
+
$return_data = array();
|
14 |
+
|
15 |
+
foreach($output['items'] as $obj){
|
16 |
+
$quote_id = $obj['entity_id'];
|
17 |
+
$tmp_quotedata = $quote_coll->getItemById($quote_id)->getItemsCollection()->toArray();
|
18 |
+
|
19 |
+
$count = $count + 1;
|
20 |
+
$return_data[$obj['customer_email']]['email'] = $obj['customer_email'];
|
21 |
+
$return_data[$obj['customer_email']]['cartid'] = $quote_id;
|
22 |
+
$return_data[$obj['customer_email']]['customer_id'] = $obj['customer_id'];
|
23 |
+
$return_data[$obj['customer_email']]['user'] = $obj['customer_prefix'] . " " . $obj['customer_firstname'] . " ". $obj["customer_lastname"];
|
24 |
+
$return_data[$obj['customer_email']]['updated_at'] = $obj['updated_at'];
|
25 |
+
$return_data[$obj['customer_email']]['subtotal'] = $obj['subtotal'];
|
26 |
+
|
27 |
+
foreach ($tmp_quotedata["items"] as $item) {
|
28 |
+
$temp['name'] = $item["name"];
|
29 |
+
$temp['quantity'] = $item["qty"];
|
30 |
+
$temp['price'] = $item["price"];
|
31 |
+
$temp['plu'] = $item["sku"];
|
32 |
+
$temp['product_id'] = $item["product_id"];
|
33 |
+
if(isset($item["product"])){
|
34 |
+
$temp['image'] = $item["product"]["small_image"];
|
35 |
+
$temp['thumbnail'] = $item["product"]["thumbnail"];
|
36 |
+
$temp['created_at'] = $item["product"]["created_at"];
|
37 |
+
$temp['updated_at'] = $item["product"]["updated_at"];
|
38 |
+
}
|
39 |
+
else{
|
40 |
+
$temp['image'] = "";
|
41 |
+
$temp['thumbnail'] = "";
|
42 |
+
}
|
43 |
+
$return_data[$obj['customer_email']]['cart'][] = $temp;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
foreach( $return_data as $value){
|
47 |
+
$new_return[] = $value;
|
48 |
+
}
|
49 |
+
return json_encode($new_return);
|
50 |
+
}
|
51 |
+
|
52 |
+
}
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>TmReportSOAPAPIExtension</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>Open Source V3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>This is a SOAP extension for abandoned reports.</summary>
|
10 |
<description>This is a SOAP extension for abandoned reports.</description>
|
11 |
-
<notes>This is a SOAP extension for abandoned reports.</notes>
|
12 |
<authors><author><name>Arindam</name><user>arindamnayak</user><email>arindam@tailoredmail.com</email></author></authors>
|
13 |
-
<date>2014-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir name="Tailoredmail"><dir name="Report"><dir name="Model"><dir name="Abandonedcart"><file name="Api.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>TmReportSOAPAPIExtension</name>
|
4 |
+
<version>1.0.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>Open Source V3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>This is a SOAP extension for abandoned reports.</summary>
|
10 |
<description>This is a SOAP extension for abandoned reports.</description>
|
11 |
+
<notes>This is a SOAP extension for abandoned reports. This will get all details required for sending mails from TM.</notes>
|
12 |
<authors><author><name>Arindam</name><user>arindamnayak</user><email>arindam@tailoredmail.com</email></author></authors>
|
13 |
+
<date>2014-07-15</date>
|
14 |
+
<time>07:19:25</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Tailoredmail"><dir name="Report"><dir name="Model"><dir name="Abandonedcart"><file name="Api.php" hash="a30544fcc33991e581a227366a9f6fbc"/></dir></dir><dir name="etc"><file name="api.xml" hash="3d2a5da34f333e81279e11cb6c5b7693"/><file name="config.xml" hash="8a1bb498d59e401a577e16f8878efa57"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tailoredmail_Report.xml" hash="4843aba2cbaa7d95dfbe2415dd4b4166"/></dir></target><target name="mage"><dir name="includes"><dir name="src"><file name="Tailoredmail_Report_Model_Abandonedcart_Api.php" hash="f91e96821f5e6bb227f6ee3cff0ee826"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|