Linc_Care - Version 1.2.1

Version Notes

Welcome to the Linc Care extension for Magento.



Here is one possible process for installing our extension.



For those of you installing manually:

1. Go to System / Magento Connect / Magento Connect Manager

2. Follow the normal procedure for installing an extension

3. Go to System / Configuration / Linc Care / General

4. Enter the store's url and admin email along with a password, then click register.

5. When the Linc Care Merchant portal is launched, fill in the requested information.

6. Go to System / Transactional Email

7. If you have a have custom New Order template already, edit it and insert {{block type='care/widget' order=$order}} where you want the Linc Care widget to appear. Then save the template and skip to step 10

8. If not Click the Add New Template button.

9. On the next page select New Order from the Template dropdown and click the Load Template button

10. Name the new template and insert {{block type='care/widget' order=$order}} where you want the Linc Care widget to appear. Then save the template.

11. Repeat for any other order-based emails you want connected to Linc Care. We suggest the New Order Guest template as well.

12. Go to System / Sales / Sales Email / Order and select the new templates for New Order Confirmation Email

13. Save the configuration


If you have any comments or questions, please email us at support-magento@letslinc.com

Download this release

Release Info

Developer Linc Care
Extension Linc_Care
Version 1.2.1
Comparing to
See all releases


Code changes from version 1.2.0 to 1.2.1

app/code/community/Linc/Care/Block/Widget.php CHANGED
@@ -63,22 +63,25 @@ class Linc_Care_Block_Widget extends Mage_Core_Block_Abstract
63
  $baseurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product';
64
  foreach ($items as $item)
65
  {
66
- $product = Mage::getModel('catalog/product')->load($item->getProduct()->getId());
67
- if ($product->isVisibleInSiteVisibility())
68
  {
69
- $imgurl = $baseurl.$product->getImage();
70
-
71
- if ($query != "")
72
  {
73
- $query .= "&";
74
- }
75
 
76
- $query .= "q=".$item->getQtyOrdered();
77
- $query .= "&p=".$product->getId();
78
- $query .= "&pp=".$item->getPrice();
79
- $query .= "&w=".$item->getWeight();
80
- $query .= "&i=".urlencode($imgurl);
81
- $query .= "&n=".urlencode($item->getName());
 
 
 
 
 
 
82
  }
83
  }
84
 
63
  $baseurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product';
64
  foreach ($items as $item)
65
  {
66
+ if ($item && $item->getProduct())
 
67
  {
68
+ $product = Mage::getModel('catalog/product')->load($item->getProduct()->getId());
69
+ if ($product->isVisibleInSiteVisibility())
 
70
  {
71
+ $imgurl = $baseurl.$product->getImage();
 
72
 
73
+ if ($query != "")
74
+ {
75
+ $query .= "&";
76
+ }
77
+
78
+ $query .= "q=".$item->getQtyOrdered();
79
+ $query .= "&p=".$product->getId();
80
+ $query .= "&pp=".$item->getPrice();
81
+ $query .= "&w=".$item->getWeight();
82
+ $query .= "&i=".urlencode($imgurl);
83
+ $query .= "&n=".urlencode($item->getName());
84
+ }
85
  }
86
  }
87
 
app/code/community/Linc/Care/Model/Fulfillmentobserver.php CHANGED
@@ -6,63 +6,56 @@ class Linc_Care_Model_Fulfillmentobserver
6
  public $client = null;
7
  public $queue = null;
8
 
9
- public $store_id = null;
10
- public $accessToken = null;
11
-
12
- public $track = null;
13
- public $store = null;
14
- public $shipment = null;
15
- public $order = null;
16
- public $carrier = null;
17
-
18
  public function exportFulfillment(Varien_Event_Observer $observer)
19
  {
20
- if (DBGLOG) Mage::log("Fulfillmentobserver::exportFulfillment started", null, 'fullfillment.log', true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
- $this->initializeObjects($observer);
23
- if ($this->accessToken != null)
24
  {
25
- if (DBGLOG) Mage::log("Fulfillmentobserver::exportFulfillment building the JSON", null, 'fullfillment.log', true);
26
  $post_data_json = $this->buildJson($observer);
27
 
28
- if (DBGLOG) Mage::log("Fulfillmentobserver::exportFulfillment making the API call", null, 'fullfillment.log', true);
29
- $this->sendFulfillment($post_data_json);
30
 
31
- if (DBGLOG) Mage::log("Fulfillmentobserver::exportFulfillment ending", null, 'fullfillment.log', true);
32
  }
33
  }
34
 
35
- public function initializeObjects($observer)
36
- {
37
- if (DBGLOG) Mage::log("Fulfillmentobserver::initializeObjects getting the track", null, 'fullfillment.log', true);
38
- $this->track = $observer->getTrack();
39
-
40
- if (DBGLOG) Mage::log("Fulfillmentobserver::initializeObjects getting the store", null, 'fullfillment.log', true);
41
- $this->store = $this->track->getStore();
42
-
43
- if (DBGLOG) Mage::log("Fulfillmentobserver::initializeObjects getting shipment", null, 'fullfillment.log', true);
44
- $this->shipment = $this->track->getShipment();
45
-
46
- if (DBGLOG) Mage::log("Fulfillmentobserver::initializeObjects getting order", null, 'fullfillment.log', true);
47
- $this->order = $this->shipment->getOrder();
48
-
49
- if (DBGLOG) Mage::log("Fulfillmentobserver::initializeObjects getting carrier", null, 'fullfillment.log', true);
50
- $this->carrier = $this->order->getShippingCarrier();
51
-
52
- if (DBGLOG) Mage::log("Fulfillmentobserver::initializeObjects getting the store id", null, 'fullfillment.log', true);
53
- $this->store_id = $this->store->getConfig('general/store_information/enter_store_id');
54
-
55
- if (DBGLOG) Mage::log("Fulfillmentobserver::exportFulfillment getting the token", null, 'fullfillment.log', true);
56
- $this->accessToken = Mage::getStoreConfig('linc_access_key', $store_id);
57
- }
58
-
59
- public function sendFulfillment($postData)
60
  {
61
- if (DBGLOG) Mage::log("Fulfillmentobserver::sendFulfillment started", null, 'fullfillment.log', true);
62
 
63
  if ($this->client == null)
64
  {
65
- $this->connectToLincCare();
66
  if ($this->client != null && $this->queue != null)
67
  {
68
  foreach ($this->queue as $data)
@@ -88,11 +81,11 @@ class Linc_Care_Model_Fulfillmentobserver
88
  $response = $this->client->request();
89
 
90
  $temp = $response->getStatus();
91
- //Mage::log("Linc_Care HTTP Status $temp", null, 'fullfillment.log', true);
92
  if ($response->getStatus() == 201)
93
  {
94
  $temp = $response->getBody();
95
- //Mage::log("Linc_Care $temp", null, 'fullfillment.log', true);
96
  }
97
  else
98
  {
@@ -102,9 +95,9 @@ class Linc_Care_Model_Fulfillmentobserver
102
  }
103
  }
104
 
105
- public function connectToLincCare()
106
  {
107
- if (DBGLOG) Mage::log("Fulfillmentobserver::connectToLincCare started", null, 'fullfillment.log', true);
108
 
109
  $this->client = new Zend_Http_Client();
110
  $protocol = SERVER_PROTOCOL;
@@ -119,33 +112,46 @@ class Linc_Care_Model_Fulfillmentobserver
119
 
120
  $this->client->setMethod(Zend_Http_Client::POST);
121
  $this->client->setHeaders(array(
122
- 'Authorization' => 'Bearer '.$this->accessToken,
123
  'Content-Type' => 'application/json'));
124
  }
125
 
126
  public function buildJson(Varien_Event_Observer $observer)
127
  {
128
- if (DBGLOG) Mage::log("Fulfillmentobserver::buildJson started", null, 'fullfillment.log', true);
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  $postdata = "";
131
  $CarrierCode = "";
132
 
133
- if ($this->carrier instanceof Mage_Usa_Model_Shipping_Carrier_Abstract)
134
  {
135
- $CarrierCode = $this->carrier->getCarrierCode();
136
  }
137
 
138
  $dataorder = array(
139
- 'order_code' => $this->order->getIncrementId(),
140
  'carrier' => $CarrierCode,
141
- 'tracking_number' => $this->track->getNumber(),
142
- 'fulfill_date' => $this->shipment->getCreatedAt()
143
  );
144
 
145
  $postdata = json_encode($dataorder);
146
- if (DBGLOG) Mage::log($postdata, null, 'fullfillment.log', true);
147
 
148
- if (DBGLOG) Mage::log("buildJson ended", null, 'fullfillment.log', true);
149
 
150
  return $postdata;
151
  }
6
  public $client = null;
7
  public $queue = null;
8
 
 
 
 
 
 
 
 
 
 
9
  public function exportFulfillment(Varien_Event_Observer $observer)
10
  {
11
+ if (DBGLOG) Mage::log("exportFulfillment started", null, 'fulfillment.log', true);
12
+
13
+ # get store_id
14
+ $track = $observer->getEvent()->getTrack();
15
+ $shipment = $track->getShipment();
16
+ $order = $shipment->getOrder();
17
+ $store_id = $order->getStoreId();
18
+ if (DBGLOG) Mage::log("exportFulfillment got the store id ($store_id)", null, 'fulfillment.log', true);
19
+
20
+ #$accessToken = Mage::getStoreConfig('linc_access_key', $store_id);
21
+ # get access_key
22
+ $resource = Mage::getSingleton('core/resource');
23
+ $read = $resource->getConnection('core_read');
24
+ $configDataTable = $read->getTableName('core_config_data');
25
+
26
+ $accessToken = '';
27
+ $select = $read->select()
28
+ ->from(array('cd'=>$configDataTable))
29
+ ->where('cd.scope=?', 'store')
30
+ ->where("cd.scope_id=?", $store_id)
31
+ ->where("cd.path=?", 'linc_access_key');
32
+ $rows = $read->fetchAll($select);
33
+
34
+ if (count($rows) > 0)
35
+ {
36
+ $accessToken = $rows[0]['value'];
37
+ }
38
+ if (DBGLOG) Mage::log("exportFulfillment got the accessKey ($accessToken)", null, 'fulfillment.log', true);
39
 
40
+ if ($accessToken != null)
 
41
  {
42
+ if (DBGLOG) Mage::log("exportFulfillment building the JSON", null, 'fulfillment.log', true);
43
  $post_data_json = $this->buildJson($observer);
44
 
45
+ if (DBGLOG) Mage::log("exportFulfillment making the API call", null, 'fulfillment.log', true);
46
+ $this->sendFulfillment($accessToken, $post_data_json);
47
 
48
+ if (DBGLOG) Mage::log("exportFulfillment ending", null, 'fulfillment.log', true);
49
  }
50
  }
51
 
52
+ public function sendFulfillment($accessToken, $postData)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  {
54
+ if (DBGLOG) Mage::log("sendFulfillment started", null, 'fulfillment.log', true);
55
 
56
  if ($this->client == null)
57
  {
58
+ $this->connectToLincCare($accessToken);
59
  if ($this->client != null && $this->queue != null)
60
  {
61
  foreach ($this->queue as $data)
81
  $response = $this->client->request();
82
 
83
  $temp = $response->getStatus();
84
+ Mage::log("Linc_Care HTTP Status $temp", null, 'fulfillment.log', true);
85
  if ($response->getStatus() == 201)
86
  {
87
  $temp = $response->getBody();
88
+ Mage::log("Linc_Care $temp", null, 'fulfillment.log', true);
89
  }
90
  else
91
  {
95
  }
96
  }
97
 
98
+ public function connectToLincCare($accessToken)
99
  {
100
+ if (DBGLOG) Mage::log("connectToLincCare started", null, 'fulfillment.log', true);
101
 
102
  $this->client = new Zend_Http_Client();
103
  $protocol = SERVER_PROTOCOL;
112
 
113
  $this->client->setMethod(Zend_Http_Client::POST);
114
  $this->client->setHeaders(array(
115
+ 'Authorization' => 'Bearer '.$accessToken,
116
  'Content-Type' => 'application/json'));
117
  }
118
 
119
  public function buildJson(Varien_Event_Observer $observer)
120
  {
121
+ if (DBGLOG) Mage::log("buildJson started", null, 'fulfillment.log', true);
122
 
123
+ $track = $observer->getEvent()->getTrack();
124
+ if (DBGLOG) Mage::log("buildJson Got order", null, 'fulfillment.log', true);
125
+ $store = $track->getStore();
126
+ if (DBGLOG) Mage::log("buildJson Got order", null, 'fulfillment.log', true);
127
+ $shipment = $track->getShipment();
128
+ if (DBGLOG) Mage::log("buildJson Got order", null, 'fulfillment.log', true);
129
+ $order = $shipment->getOrder();
130
+ if (DBGLOG) Mage::log("buildJson Got order", null, 'fulfillment.log', true);
131
+ $carrier = $order->getShippingCarrier();
132
+ if (DBGLOG) Mage::log("buildJson Got order", null, 'fulfillment.log', true);
133
+ $store_id = $observer->getStoreId();
134
+ if (DBGLOG) Mage::log("buildJson Got order", null, 'fulfillment.log', true);
135
+
136
  $postdata = "";
137
  $CarrierCode = "";
138
 
139
+ if ($carrier instanceof Mage_Usa_Model_Shipping_Carrier_Abstract)
140
  {
141
+ $CarrierCode = $carrier->getCarrierCode();
142
  }
143
 
144
  $dataorder = array(
145
+ 'order_code' => $order->getIncrementId(),
146
  'carrier' => $CarrierCode,
147
+ 'tracking_number' => $track->getNumber(),
148
+ 'fulfill_date' => $shipment->getCreatedAt()
149
  );
150
 
151
  $postdata = json_encode($dataorder);
152
+ if (DBGLOG) Mage::log($postdata, null, 'fulfillment.log', true);
153
 
154
+ if (DBGLOG) Mage::log("buildJson ended", null, 'fulfillment.log', true);
155
 
156
  return $postdata;
157
  }
app/code/community/Linc/Care/common.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- define('DBGLOG', false);
3
- define('SERVER_PROTOCOL', 'https');
4
- define('SERVER_PATH', 'letslinc.com');
5
  ?>
1
  <?php
2
+ define('DBGLOG', true);
3
+ define('SERVER_PROTOCOL', 'http');
4
+ define('SERVER_PATH', 'localhost:8000');
5
  ?>
app/code/community/Linc/Care/etc/config.xml CHANGED
@@ -10,7 +10,7 @@
10
  <config>
11
  <modules>
12
  <Linc_Care>
13
- <version>1.2.0</version>
14
  </Linc_Care>
15
  </modules>
16
  <admin>
10
  <config>
11
  <modules>
12
  <Linc_Care>
13
+ <version>1.2.1</version>
14
  </Linc_Care>
15
  </modules>
16
  <admin>
app/code/community/Linc/Care/sql/linc_setup/{mysql4-install-1.2.0.php → mysql4-install-1.2.1.php} RENAMED
@@ -22,37 +22,10 @@ $resource = Mage::getSingleton('core/resource');
22
  $read = $resource->getConnection('core_read');
23
  $configDataTable = $read->getTableName('core_config_data');
24
 
25
- # get store_id
26
- $store_id = '1';
27
- $select = $read->select()
28
- ->from(array('cd'=>$configDataTable))
29
- ->where("cd.path=?", 'linc_current_store');
30
- $rows = $read->fetchAll($select);
31
-
32
- if (count($rows) > 0)
33
- {
34
- $store_id = $rows[0]['value'];
35
- }
36
-
37
- # get shop_id
38
- $shop_id = '';
39
- $select = $read->select()
40
- ->from(array('cd'=>$configDataTable))
41
- ->where('cd.scope=?', 'store')
42
- ->where("cd.scope_id=?", $store_id)
43
- ->where("cd.path=?", 'linc_shop_id');
44
- $rows = $read->fetchAll($select);
45
-
46
- if (count($rows) > 0)
47
- {
48
- $shop_id = $rows[0]['value'];
49
- }
50
-
51
  $dataorder = array(
52
  'ecommerce' => 'magento',
53
  'product' => 'Linc Care Extension',
54
  'version' => (string) Mage::getConfig()->getNode()->modules->Linc_Care->version,
55
- 'public_id' => shop_id,
56
  'store_name' => Mage::app()->getStore()->getName(),
57
  'general_name' => Mage::getStoreConfig('trans_email/ident_general/name'),
58
  'general_email' => Mage::getStoreConfig('trans_email/ident_general/email'),
22
  $read = $resource->getConnection('core_read');
23
  $configDataTable = $read->getTableName('core_config_data');
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  $dataorder = array(
26
  'ecommerce' => 'magento',
27
  'product' => 'Linc Care Extension',
28
  'version' => (string) Mage::getConfig()->getNode()->modules->Linc_Care->version,
 
29
  'store_name' => Mage::app()->getStore()->getName(),
30
  'general_name' => Mage::getStoreConfig('trans_email/ident_general/name'),
31
  'general_email' => Mage::getStoreConfig('trans_email/ident_general/email'),
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Linc_Care</name>
4
- <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.letslinc.com/legal/linccarelicenseagreement/">Linc Global Commercial License</license>
7
  <channel>community</channel>
@@ -80,9 +80,9 @@
80
  If you have any comments or questions, please email us at support-magento@letslinc.com&#xD;
81
  </notes>
82
  <authors><author><name>Linc Care</name><user>letslincapp</user><email>apps@letslinc.com</email></author></authors>
83
- <date>2015-01-28</date>
84
- <time>07:57:25</time>
85
- <contents><target name="mageetc"><dir name="modules"><file name="Linc_Care.xml" hash="8dd7784200f8ff440a0c970d89db190d"/></dir></target><target name="magecommunity"><dir name="Linc"><dir name="Care"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Register.php" hash="aaae24f105064ce11e9da2e5c3d778e2"/></dir></dir></dir></dir><file name="Confirm.php" hash="c5802e17ab99fe29759d4f0c3b61c16d"/><file name="Email.php" hash="8f6eb60dd06f7258c842377cb92bec07"/><file name="Faqbutton.php" hash="e9804ff3824aaaa5383af0f97fc75c1b"/><file name="Note.php" hash="637733c4a7ad19ef66b9db1d75c28b8d"/><file name="Pwd.php" hash="7dbe6f455456f06cb47ebdd072bdbd7f"/><file name="Url.php" hash="98d81a2b8c1fbbccc3928cdc4c8d9a5b"/><file name="Widget.php" hash="5ece46a209769fc75e64b3d64737c698"/></dir><dir name="Helper"><file name="Data.php" hash="34aec0a0ed4d5a1652b46fb7fe54707d"/></dir><dir name="Model"><file name="Fulfillmentobserver.php" hash="9873507cc5ddb9370f4ce5033cd43345"/><file name="Orderobserver.php" hash="7a80b9c07e1bd32e65e373e0a31db429"/><dir name="Resource"><file name="Setup.php" hash="7169ea333f6a42a0edc86effa4a11195"/></dir></dir><file name="common.php" hash="82b09b911018f12ce42efd9a32bbddf1"/><dir name="controllers"><file name="CareController.php" hash="5c65bf047fcddc87ad7f3a2ebff0e924"/></dir><dir name="etc"><file name="config.xml" hash="d4b02551a43ccc560c9edd67e73943f3"/><file name="system.xml" hash="95036d9df5911e0c0d2e6db996a4bbff"/></dir><file name="readme" hash="01f2eed106a3cf9d67bb200665b22c48"/><dir name="sql"><dir name="linc_setup"><file name="mysql4-install-1.2.0.php" hash="e587c6226dcc19a14c8fb699ba70c5e3"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="care"><dir name="system"><dir name="config"><file name="register.phtml" hash="0efab1b7ae4c930961a396ebc9c48d2b"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
86
  <compatible/>
87
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
88
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Linc_Care</name>
4
+ <version>1.2.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.letslinc.com/legal/linccarelicenseagreement/">Linc Global Commercial License</license>
7
  <channel>community</channel>
80
  If you have any comments or questions, please email us at support-magento@letslinc.com&#xD;
81
  </notes>
82
  <authors><author><name>Linc Care</name><user>letslincapp</user><email>apps@letslinc.com</email></author></authors>
83
+ <date>2015-01-30</date>
84
+ <time>06:43:31</time>
85
+ <contents><target name="mageetc"><dir name="modules"><file name="Linc_Care.xml" hash="8dd7784200f8ff440a0c970d89db190d"/></dir></target><target name="magecommunity"><dir name="Linc"><dir name="Care"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Register.php" hash="aaae24f105064ce11e9da2e5c3d778e2"/></dir></dir></dir></dir><file name="Confirm.php" hash="c5802e17ab99fe29759d4f0c3b61c16d"/><file name="Email.php" hash="8f6eb60dd06f7258c842377cb92bec07"/><file name="Faqbutton.php" hash="e9804ff3824aaaa5383af0f97fc75c1b"/><file name="Note.php" hash="637733c4a7ad19ef66b9db1d75c28b8d"/><file name="Pwd.php" hash="7dbe6f455456f06cb47ebdd072bdbd7f"/><file name="Url.php" hash="98d81a2b8c1fbbccc3928cdc4c8d9a5b"/><file name="Widget.php" hash="9f14b52eac49e43a6bb172a502554ba2"/></dir><dir name="Helper"><file name="Data.php" hash="34aec0a0ed4d5a1652b46fb7fe54707d"/></dir><dir name="Model"><file name="Fulfillmentobserver.php" hash="09cd26ecf5c128eba3267392904c1ed4"/><file name="Orderobserver.php" hash="7a80b9c07e1bd32e65e373e0a31db429"/><dir name="Resource"><file name="Setup.php" hash="7169ea333f6a42a0edc86effa4a11195"/></dir></dir><file name="common.php" hash="e8aff39650836495a8c3664b2276b497"/><dir name="controllers"><file name="CareController.php" hash="5c65bf047fcddc87ad7f3a2ebff0e924"/></dir><dir name="etc"><file name="config.xml" hash="a35bf27a57690d9dd34d3f62b18d3bcb"/><file name="system.xml" hash="95036d9df5911e0c0d2e6db996a4bbff"/></dir><file name="readme" hash="01f2eed106a3cf9d67bb200665b22c48"/><dir name="sql"><dir name="linc_setup"><file name="mysql4-install-1.2.1.php" hash="f94f63b057b5e0d911140805f2a80687"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="care"><dir name="system"><dir name="config"><file name="register.phtml" hash="0efab1b7ae4c930961a396ebc9c48d2b"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
86
  <compatible/>
87
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
88
  </package>