Version Notes
edrone magento module - initial public release
Download this release
Release Info
| Developer | Michał Blak |
| Extension | edroneCRM |
| Version | 1.1.11 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.10 to 1.1.11
- app/code/local/Edrone/Base/Block/Order.php +399 -0
- app/code/local/Edrone/Base/Helper/Config.php +8 -0
- app/code/local/Edrone/Base/etc/config.xml +2 -1
- app/code/local/Edrone/Base/etc/system.xml +9 -0
- app/design/frontend/base/default/template/edrone/cart_view.phtml +2 -2
- app/design/frontend/base/default/template/edrone/default.phtml +1 -1
- app/design/frontend/base/default/template/edrone/product_view.phtml +2 -2
- app/design/frontend/base/default/template/edrone/success_view.phtml +5 -3
- package.xml +4 -4
app/code/local/Edrone/Base/Block/Order.php
CHANGED
|
@@ -1,7 +1,406 @@
|
|
| 1 |
<?php
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
class Edrone_Base_Block_Order extends Edrone_Base_Block_Base
|
| 4 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
/**
|
| 6 |
* @return array
|
| 7 |
*/
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
define('EDRONE_SDK_VERSION','PHPSDK_1.0.0');
|
| 4 |
+
|
| 5 |
+
abstract class EdroneEvent{
|
| 6 |
+
|
| 7 |
+
protected $field = array();
|
| 8 |
+
|
| 9 |
+
abstract public function init();
|
| 10 |
+
|
| 11 |
+
public function pre_init(){
|
| 12 |
+
//preInitObject
|
| 13 |
+
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
public function userCid($value){
|
| 17 |
+
$this->field['c_id'] = trim('phpsd_'.$value);
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
public function userEmail($value){
|
| 21 |
+
$this->field['email'] = trim($value);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
public function userFirstName($value){
|
| 25 |
+
$this->field['first_name'] = trim($value);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
public function userLastName($value){
|
| 29 |
+
$this->field['last_name'] = trim($value);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
public function userSubscriberStatus($value){
|
| 33 |
+
$this->field['subscriber_status'] = trim($value);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
public function userCountry($value){
|
| 37 |
+
$this->field['country'] = trim($value);
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
public function userCity($value){
|
| 41 |
+
$this->field['city'] = trim($value);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
public function userPhone($value){
|
| 45 |
+
$this->field['phone'] = trim($value);
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
public function userTag($value){
|
| 49 |
+
$this->field['customer_tags'] = trim($value);
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
public function get(){
|
| 54 |
+
return $this->field;
|
| 55 |
+
return $this;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class EdroneEventOrder extends EdroneEvent{
|
| 62 |
+
public function init(){
|
| 63 |
+
$this->field['action_type'] = 'order';
|
| 64 |
+
}
|
| 65 |
+
/**
|
| 66 |
+
*
|
| 67 |
+
* @param type $value
|
| 68 |
+
* @return \EdroneEventOrder
|
| 69 |
+
*/
|
| 70 |
+
public function userCid($value){
|
| 71 |
+
parent::userCid($value);
|
| 72 |
+
return $this;
|
| 73 |
+
}
|
| 74 |
+
/**
|
| 75 |
+
*
|
| 76 |
+
* @param type $value
|
| 77 |
+
* @return \EdroneEventOrder
|
| 78 |
+
*/
|
| 79 |
+
public function userEmail($value){
|
| 80 |
+
parent::userEmail($value);
|
| 81 |
+
return $this;
|
| 82 |
+
}
|
| 83 |
+
/**
|
| 84 |
+
*
|
| 85 |
+
* @param type $value
|
| 86 |
+
* @return \EdroneEventOrder
|
| 87 |
+
*/
|
| 88 |
+
public function userFirstName($value){
|
| 89 |
+
parent::userFirstName($value);
|
| 90 |
+
return $this;
|
| 91 |
+
}
|
| 92 |
+
/**
|
| 93 |
+
*
|
| 94 |
+
* @param type $value
|
| 95 |
+
* @return \EdroneEventOrder
|
| 96 |
+
*/
|
| 97 |
+
public function userLastName($value){
|
| 98 |
+
parent::userLastName($value);
|
| 99 |
+
return $this;
|
| 100 |
+
}
|
| 101 |
+
/**
|
| 102 |
+
*
|
| 103 |
+
* @param type $value
|
| 104 |
+
* @return \EdroneEventOrder
|
| 105 |
+
*/
|
| 106 |
+
public function userSubscriberStatus($value){
|
| 107 |
+
parent::userSubscriberStatus($value);
|
| 108 |
+
return $this;
|
| 109 |
+
}
|
| 110 |
+
/**
|
| 111 |
+
*
|
| 112 |
+
* @param type $value
|
| 113 |
+
* @return \EdroneEventOrder
|
| 114 |
+
*/
|
| 115 |
+
public function userCountry($value){
|
| 116 |
+
parent::userCountry($value);
|
| 117 |
+
return $this;
|
| 118 |
+
}
|
| 119 |
+
/**
|
| 120 |
+
*
|
| 121 |
+
* @param type $value
|
| 122 |
+
* @return \EdroneEventOrder
|
| 123 |
+
*/
|
| 124 |
+
public function userCity($value){
|
| 125 |
+
parent::userCity($value);
|
| 126 |
+
return $this;
|
| 127 |
+
}
|
| 128 |
+
/**
|
| 129 |
+
*
|
| 130 |
+
* @param type $value
|
| 131 |
+
* @return \EdroneEventOrder
|
| 132 |
+
*/
|
| 133 |
+
public function userOrder($value){
|
| 134 |
+
parent::userPhone($value);
|
| 135 |
+
return $this;
|
| 136 |
+
}
|
| 137 |
+
/**
|
| 138 |
+
*
|
| 139 |
+
* @param type $value
|
| 140 |
+
* @return \EdroneEventOther
|
| 141 |
+
*/
|
| 142 |
+
public function userTag($value){
|
| 143 |
+
parent::userTag($value);
|
| 144 |
+
return $this;
|
| 145 |
+
}
|
| 146 |
+
/**
|
| 147 |
+
*
|
| 148 |
+
* @param type $value
|
| 149 |
+
* @return \EdroneEventOrder Description
|
| 150 |
+
*/
|
| 151 |
+
public function productSkus($value){
|
| 152 |
+
if(is_array($value)){ $value= implode('|', $value);}
|
| 153 |
+
$this->field['product_skus'] = $value;
|
| 154 |
+
return $this;
|
| 155 |
+
}
|
| 156 |
+
/**
|
| 157 |
+
*
|
| 158 |
+
* @param type $value
|
| 159 |
+
* @return \EdroneEventOrder
|
| 160 |
+
*/
|
| 161 |
+
public function productIds($value){
|
| 162 |
+
if(is_array($value)){ $value= implode('|', $value);}
|
| 163 |
+
$this->field['product_ids'] = $value;
|
| 164 |
+
return $this;
|
| 165 |
+
}
|
| 166 |
+
/**
|
| 167 |
+
*
|
| 168 |
+
* @param type $value
|
| 169 |
+
* @return \EdroneEventOrder
|
| 170 |
+
*/
|
| 171 |
+
public function productTitles($value){
|
| 172 |
+
if(is_array($value)){ $value= implode('|', $value);}
|
| 173 |
+
$this->field['product_titles'] = $value;
|
| 174 |
+
return $this;
|
| 175 |
+
}
|
| 176 |
+
/**
|
| 177 |
+
*
|
| 178 |
+
* @param type $value
|
| 179 |
+
* @return \EdroneEventOrder
|
| 180 |
+
*/
|
| 181 |
+
public function productImages($value){
|
| 182 |
+
if(is_array($value)){ $value= implode('|', $value);}
|
| 183 |
+
$this->field['product_images'] = $value;
|
| 184 |
+
return $this;
|
| 185 |
+
}
|
| 186 |
+
/**
|
| 187 |
+
*
|
| 188 |
+
* @param type $value
|
| 189 |
+
* @return \EdroneEventOrder
|
| 190 |
+
*/
|
| 191 |
+
public function productUrls($value){
|
| 192 |
+
if(is_array($value)){ $value= implode('|', $value);}
|
| 193 |
+
$this->field['product_urls'] = $value;
|
| 194 |
+
return $this;
|
| 195 |
+
}
|
| 196 |
+
/**
|
| 197 |
+
*
|
| 198 |
+
* @param type $value
|
| 199 |
+
* @return \EdroneEventOrder
|
| 200 |
+
*/
|
| 201 |
+
public function productCounts($value){
|
| 202 |
+
if(is_array($value)){ $value= implode('|', $value);}
|
| 203 |
+
$this->field['product_counts'] = $value;
|
| 204 |
+
return $this;
|
| 205 |
+
}
|
| 206 |
+
/**
|
| 207 |
+
*
|
| 208 |
+
* @param type $value
|
| 209 |
+
* @return \EdroneEventOrder
|
| 210 |
+
*/
|
| 211 |
+
public function productCategoryIds($value){
|
| 212 |
+
if(is_array($value)){ $value= implode('|', $value);}
|
| 213 |
+
$this->field['product_category_ids'] = $value;
|
| 214 |
+
return $this;
|
| 215 |
+
}
|
| 216 |
+
/**
|
| 217 |
+
*
|
| 218 |
+
* @param type $value
|
| 219 |
+
* @return \EdroneEventOrder
|
| 220 |
+
*/
|
| 221 |
+
public function productCategoryNames($value){
|
| 222 |
+
if(is_array($value)){ $value= implode('|', $value);}
|
| 223 |
+
$this->field['product_category_names'] = $value;
|
| 224 |
+
return $this;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
public function orderId($value){
|
| 229 |
+
$this->field['order_id'] = $value;
|
| 230 |
+
return $this;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
public function orderPaymentValue($value){
|
| 234 |
+
$this->field['order_payment_value'] = $value;
|
| 235 |
+
return $this;
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
public function orderBasePaymentValue($value){
|
| 239 |
+
$this->field['base_payment_value'] = $value;
|
| 240 |
+
return $this;
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
public function orderDetails($value){
|
| 244 |
+
$this->field['order_details'] = $value;
|
| 245 |
+
return $this;
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
public function orderCurrency($value){
|
| 249 |
+
$this->field['order_currency'] = $value;
|
| 250 |
+
return $this;
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
public function orderBaseCurrency($value){
|
| 254 |
+
$this->field['base_currency'] = $value;
|
| 255 |
+
return $this;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
/**
|
| 259 |
+
* @return EdroneEventOrder
|
| 260 |
+
*/
|
| 261 |
+
public static function create(){
|
| 262 |
+
return new EdroneEventOrder();
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
class EdroneIns{
|
| 270 |
+
|
| 271 |
+
/** @var string AppId */
|
| 272 |
+
private $appid = '';
|
| 273 |
+
/** @var string $secret Secret */
|
| 274 |
+
private $secret = '';
|
| 275 |
+
/** @var string Trace url. def https://api.edrone.me/trace */
|
| 276 |
+
private $trace_url = '';
|
| 277 |
+
/** @var array Array of request field */
|
| 278 |
+
private $fiels = array();
|
| 279 |
+
/** @var array Prepared request array */
|
| 280 |
+
private $preparedpack = array();
|
| 281 |
+
/** @var Closure Closure method called on error */
|
| 282 |
+
private $errorHandle = null;
|
| 283 |
+
/** @var Closure Closure method called on success */
|
| 284 |
+
private $readyHandle = null;
|
| 285 |
+
/** @var Array Last request information */
|
| 286 |
+
private $lastRequest = null;
|
| 287 |
+
|
| 288 |
+
/**
|
| 289 |
+
* Construct new Edrone Request instace
|
| 290 |
+
* @param string $appid AppId of tracker
|
| 291 |
+
* @param string $secret Secret of tracer
|
| 292 |
+
* @param string $trace_url def https://api.edrone.me/trace
|
| 293 |
+
* @since 1.0.0
|
| 294 |
+
*/
|
| 295 |
+
function __construct($appid,$secret,$trace_url='https://api.edrone.me/trace'){
|
| 296 |
+
$this->appid = $appid;
|
| 297 |
+
$this->secret = $secret;
|
| 298 |
+
$this->trace_url = $trace_url;
|
| 299 |
+
}
|
| 300 |
+
/**
|
| 301 |
+
*
|
| 302 |
+
* Prepare event to send
|
| 303 |
+
*
|
| 304 |
+
* @param EdroneEvent $event Use object of EdroneEventAddToCart,EdroneEventOrder,EdroneEventOrder,EdroneEventOther
|
| 305 |
+
* @return EdroneIns
|
| 306 |
+
* @since 1.0.0
|
| 307 |
+
*/
|
| 308 |
+
public function prepare($event){
|
| 309 |
+
if(!($event instanceof EdroneEvent )){
|
| 310 |
+
throw new Exception('Event must by child EdroneEvent class ');
|
| 311 |
+
$this->preparedpack = array();
|
| 312 |
+
return;
|
| 313 |
+
}
|
| 314 |
+
$event->pre_init();
|
| 315 |
+
$event->init();
|
| 316 |
+
$this->preparedpack = array_merge($event->get(),array(
|
| 317 |
+
"app_id" => $this->appid,
|
| 318 |
+
"version" => EDRONE_SDK_VERSION,
|
| 319 |
+
"platform_version"=> Mage::getVersion(),
|
| 320 |
+
"platform" => "Magento",
|
| 321 |
+
"sender_type" => "server",
|
| 322 |
+
));
|
| 323 |
+
return $this;
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
/**
|
| 327 |
+
*
|
| 328 |
+
* Force send prepared data
|
| 329 |
+
* @since 1.0.0
|
| 330 |
+
*/
|
| 331 |
+
public function send(){
|
| 332 |
+
$ch = curl_init();
|
| 333 |
+
curl_setopt($ch, CURLOPT_URL, $this->trace_url);
|
| 334 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| 335 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
| 336 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($this->preparedpack));
|
| 337 |
+
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,3);
|
| 338 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
|
| 339 |
+
$data = curl_exec($ch);
|
| 340 |
+
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
| 341 |
+
$report=curl_getinfo($ch);
|
| 342 |
+
curl_close($ch);
|
| 343 |
+
$this->lastRequest = array("code"=>$httpcode,"response"=>$data,"info"=>$report,'fields'=>$this->preparedpack);
|
| 344 |
+
if( ($httpcode !== 200) && ($this->errorHandle !== null) ){
|
| 345 |
+
call_user_func_array($this->errorHandle,array($this));
|
| 346 |
+
}elseif ( ($httpcode === 200) && ($this->readyHandle !== null) ){
|
| 347 |
+
call_user_func_array($this->readyHandle,array($this));
|
| 348 |
+
}
|
| 349 |
+
}
|
| 350 |
+
/**
|
| 351 |
+
* Return last request as array (debug)
|
| 352 |
+
* @return array
|
| 353 |
+
* @since 1.0.0
|
| 354 |
+
*/
|
| 355 |
+
public function getLastRequest(){
|
| 356 |
+
return $this->lastRequest;
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
/**
|
| 360 |
+
* Set Callbacks for error action and ready action
|
| 361 |
+
* @param \Closure $errorHandle
|
| 362 |
+
* @param \Closure $readyHandle
|
| 363 |
+
* @since 1.0.0
|
| 364 |
+
*/
|
| 365 |
+
public function setCallbacks($errorHandle=null,$readyHandle=null){
|
| 366 |
+
$this->errorHandle = $errorHandle;
|
| 367 |
+
$this->readyHandle = $readyHandle;
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
|
| 374 |
class Edrone_Base_Block_Order extends Edrone_Base_Block_Base
|
| 375 |
{
|
| 376 |
+
|
| 377 |
+
|
| 378 |
+
|
| 379 |
+
public function sendDataToServer($orderData,$customerData,$helper){
|
| 380 |
+
if($helper->getServersideOrder() == "0") return "false";
|
| 381 |
+
try{
|
| 382 |
+
$configHelper = Mage::helper('edrone/config');
|
| 383 |
+
$edrone = new EdroneIns($configHelper->getAppId(),'',$helper->getCollectorUrl());
|
| 384 |
+
$edrone->prepare(
|
| 385 |
+
EdroneEventOrder::create()->
|
| 386 |
+
userFirstName(($customerData['first_name']))->
|
| 387 |
+
userLastName(($customerData['last_name']))->
|
| 388 |
+
userEmail($customerData['email'])->
|
| 389 |
+
productSkus($orderData['sku'])->
|
| 390 |
+
productTitles($orderData['title'])->
|
| 391 |
+
productImages($orderData['image'])->
|
| 392 |
+
productCategoryIds($orderData['product_category_ids'])->
|
| 393 |
+
productCategoryNames($orderData['product_category_names'])->
|
| 394 |
+
orderId($orderData['order_id'])->
|
| 395 |
+
orderPaymentValue($orderData['order_payment_value'])->
|
| 396 |
+
orderCurrency($orderData['order_currency'])
|
| 397 |
+
)->send();
|
| 398 |
+
} catch (Exception $e){
|
| 399 |
+
error_log("EDRONEPHPSDK ERROR:".$e->getMessage().' more :'.json_encode($e));
|
| 400 |
+
return "Error";
|
| 401 |
+
}
|
| 402 |
+
return "OK:200".json_encode($edrone->getLastRequest());
|
| 403 |
+
}
|
| 404 |
/**
|
| 405 |
* @return array
|
| 406 |
*/
|
app/code/local/Edrone/Base/Helper/Config.php
CHANGED
|
@@ -8,6 +8,14 @@ class Edrone_Base_Helper_Config extends Mage_Core_Helper_Abstract
|
|
| 8 |
const EXTERNAL_SCRIPT_URL_CONFIG_PATH = "edrone/base/external_script_url";
|
| 9 |
const COLLECTOR_URL_CONFIG_PATH = "edrone/base/collector_url";
|
| 10 |
const NEWSLETTER_SYNC_ENABLED_PATH = "edrone/newsletter/subscription_sync_enabled";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
/**
|
| 13 |
* @return string
|
| 8 |
const EXTERNAL_SCRIPT_URL_CONFIG_PATH = "edrone/base/external_script_url";
|
| 9 |
const COLLECTOR_URL_CONFIG_PATH = "edrone/base/collector_url";
|
| 10 |
const NEWSLETTER_SYNC_ENABLED_PATH = "edrone/newsletter/subscription_sync_enabled";
|
| 11 |
+
const SERVER_SIDE_ORDER_PATH = "edrone/base/serverside_order";
|
| 12 |
+
/**
|
| 13 |
+
* @return string
|
| 14 |
+
*/
|
| 15 |
+
public function getServersideOrder()
|
| 16 |
+
{
|
| 17 |
+
return (string)Mage::getStoreConfig(self::SERVER_SIDE_ORDER_PATH);
|
| 18 |
+
}
|
| 19 |
|
| 20 |
/**
|
| 21 |
* @return string
|
app/code/local/Edrone/Base/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Edrone_Base>
|
| 5 |
-
<version>1.
|
| 6 |
</Edrone_Base>
|
| 7 |
</modules>
|
| 8 |
<global>
|
|
@@ -72,6 +72,7 @@
|
|
| 72 |
<app_secret>INSERT_APP_SECRET_HERE</app_secret>
|
| 73 |
<external_script_url>//d3bo67muzbfgtl.cloudfront.net/edrone_2_0.js</external_script_url>
|
| 74 |
<collector_url>https://api.edrone.me/trace</collector_url>
|
|
|
|
| 75 |
</base>
|
| 76 |
</edrone>
|
| 77 |
</default>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Edrone_Base>
|
| 5 |
+
<version>1.1.11</version>
|
| 6 |
</Edrone_Base>
|
| 7 |
</modules>
|
| 8 |
<global>
|
| 72 |
<app_secret>INSERT_APP_SECRET_HERE</app_secret>
|
| 73 |
<external_script_url>//d3bo67muzbfgtl.cloudfront.net/edrone_2_0.js</external_script_url>
|
| 74 |
<collector_url>https://api.edrone.me/trace</collector_url>
|
| 75 |
+
<serverside_order>1</serverside_order>
|
| 76 |
</base>
|
| 77 |
</edrone>
|
| 78 |
</default>
|
app/code/local/Edrone/Base/etc/system.xml
CHANGED
|
@@ -55,6 +55,15 @@
|
|
| 55 |
<show_in_website>1</show_in_website>
|
| 56 |
<show_in_store>1</show_in_store>
|
| 57 |
</collector_url>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
</fields>
|
| 59 |
</base>
|
| 60 |
<newsletter translate="label" module="edrone">
|
| 55 |
<show_in_website>1</show_in_website>
|
| 56 |
<show_in_store>1</show_in_store>
|
| 57 |
</collector_url>
|
| 58 |
+
<serverside_order>
|
| 59 |
+
<label>Send order via curl (serverside method)</label>
|
| 60 |
+
<frontend_type>select</frontend_type>
|
| 61 |
+
<sort_order>35</sort_order>
|
| 62 |
+
<show_in_default>1</show_in_default>
|
| 63 |
+
<show_in_website>1</show_in_website>
|
| 64 |
+
<show_in_store>1</show_in_store>
|
| 65 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 66 |
+
</serverside_order>
|
| 67 |
</fields>
|
| 68 |
</base>
|
| 69 |
<newsletter translate="label" module="edrone">
|
app/design/frontend/base/default/template/edrone/cart_view.phtml
CHANGED
|
@@ -11,7 +11,7 @@ $productData = $this->getProductData();
|
|
| 11 |
(function (srcjs) {
|
| 12 |
window._edrone = window._edrone || {};
|
| 13 |
_edrone.app_id = '<?php echo $helper->getAppId() ?>';
|
| 14 |
-
_edrone.version = '1.
|
| 15 |
_edrone.platform = 'Magento';
|
| 16 |
_edrone.platform_version = '<?php echo Mage::getVersion(); ?>';
|
| 17 |
_edrone.trace_url = '<?php echo $helper->getCollectorUrl() ?>';
|
|
@@ -21,7 +21,7 @@ $productData = $this->getProductData();
|
|
| 21 |
_edrone.first_name = '<?php echo urlencode($customerData['first_name']); ?>';
|
| 22 |
_edrone.last_name = '<?php echo urlencode($customerData['last_name']); ?>';
|
| 23 |
_edrone.product_skus = '<?php echo $productData['sku'] ?>';
|
| 24 |
-
_edrone.product_ids = '
|
| 25 |
_edrone.product_titles = '<?php echo urlencode($productData['title']); ?>';
|
| 26 |
_edrone.product_images = '<?php echo urlencode($productData['image']); ?>';
|
| 27 |
_edrone.product_category_ids = '<?php echo $productData['product_category_ids'] ?>';
|
| 11 |
(function (srcjs) {
|
| 12 |
window._edrone = window._edrone || {};
|
| 13 |
_edrone.app_id = '<?php echo $helper->getAppId() ?>';
|
| 14 |
+
_edrone.version = '1.1.11';
|
| 15 |
_edrone.platform = 'Magento';
|
| 16 |
_edrone.platform_version = '<?php echo Mage::getVersion(); ?>';
|
| 17 |
_edrone.trace_url = '<?php echo $helper->getCollectorUrl() ?>';
|
| 21 |
_edrone.first_name = '<?php echo urlencode($customerData['first_name']); ?>';
|
| 22 |
_edrone.last_name = '<?php echo urlencode($customerData['last_name']); ?>';
|
| 23 |
_edrone.product_skus = '<?php echo $productData['sku'] ?>';
|
| 24 |
+
_edrone.product_ids = '';
|
| 25 |
_edrone.product_titles = '<?php echo urlencode($productData['title']); ?>';
|
| 26 |
_edrone.product_images = '<?php echo urlencode($productData['image']); ?>';
|
| 27 |
_edrone.product_category_ids = '<?php echo $productData['product_category_ids'] ?>';
|
app/design/frontend/base/default/template/edrone/default.phtml
CHANGED
|
@@ -9,7 +9,7 @@ $customerData = $this->getCustomerData();
|
|
| 9 |
(function (srcjs) {
|
| 10 |
window._edrone = window._edrone || {};
|
| 11 |
_edrone.app_id = '<?php echo $helper->getAppId() ?>';
|
| 12 |
-
_edrone.version = '1.
|
| 13 |
_edrone.platform = 'Magento';
|
| 14 |
_edrone.platform_version = '<?php echo Mage::getVersion(); ?>';
|
| 15 |
_edrone.trace_url = '<?php echo $helper->getCollectorUrl() ?>';
|
| 9 |
(function (srcjs) {
|
| 10 |
window._edrone = window._edrone || {};
|
| 11 |
_edrone.app_id = '<?php echo $helper->getAppId() ?>';
|
| 12 |
+
_edrone.version = '1.1.11';
|
| 13 |
_edrone.platform = 'Magento';
|
| 14 |
_edrone.platform_version = '<?php echo Mage::getVersion(); ?>';
|
| 15 |
_edrone.trace_url = '<?php echo $helper->getCollectorUrl() ?>';
|
app/design/frontend/base/default/template/edrone/product_view.phtml
CHANGED
|
@@ -10,7 +10,7 @@ $productData = $this->getProductData();
|
|
| 10 |
(function (srcjs) {
|
| 11 |
window._edrone = window._edrone || {};
|
| 12 |
_edrone.app_id = '<?php echo $helper->getAppId() ?>';
|
| 13 |
-
_edrone.version = '1.
|
| 14 |
_edrone.platform = 'Magento';
|
| 15 |
_edrone.platform_version = '<?php echo Mage::getVersion(); ?>';
|
| 16 |
_edrone.trace_url = '<?php echo $helper->getCollectorUrl() ?>';
|
|
@@ -20,7 +20,7 @@ $productData = $this->getProductData();
|
|
| 20 |
_edrone.first_name = '<?php echo urlencode($customerData['first_name']); ?>';
|
| 21 |
_edrone.last_name = '<?php echo urlencode($customerData['last_name']); ?>';
|
| 22 |
_edrone.product_skus = '<?php echo $productData['sku'] ?>';
|
| 23 |
-
_edrone.product_ids = '
|
| 24 |
_edrone.product_titles = '<?php echo urlencode($productData['title']); ?>';
|
| 25 |
_edrone.product_images = '<?php echo urlencode($productData['image']); ?>';
|
| 26 |
_edrone.product_urls = window.location.href;
|
| 10 |
(function (srcjs) {
|
| 11 |
window._edrone = window._edrone || {};
|
| 12 |
_edrone.app_id = '<?php echo $helper->getAppId() ?>';
|
| 13 |
+
_edrone.version = '1.1.11';
|
| 14 |
_edrone.platform = 'Magento';
|
| 15 |
_edrone.platform_version = '<?php echo Mage::getVersion(); ?>';
|
| 16 |
_edrone.trace_url = '<?php echo $helper->getCollectorUrl() ?>';
|
| 20 |
_edrone.first_name = '<?php echo urlencode($customerData['first_name']); ?>';
|
| 21 |
_edrone.last_name = '<?php echo urlencode($customerData['last_name']); ?>';
|
| 22 |
_edrone.product_skus = '<?php echo $productData['sku'] ?>';
|
| 23 |
+
_edrone.product_ids = '';
|
| 24 |
_edrone.product_titles = '<?php echo urlencode($productData['title']); ?>';
|
| 25 |
_edrone.product_images = '<?php echo urlencode($productData['image']); ?>';
|
| 26 |
_edrone.product_urls = window.location.href;
|
app/design/frontend/base/default/template/edrone/success_view.phtml
CHANGED
|
@@ -4,6 +4,7 @@ $helper = $this->getConfigHelper();
|
|
| 4 |
$helper2 = Mage::helper('edrone');
|
| 5 |
$customerData = $this->getCustomerData();
|
| 6 |
$orderData = $this->getOrderData();
|
|
|
|
| 7 |
?>
|
| 8 |
|
| 9 |
<?php if(!empty($orderData)): ?>
|
|
@@ -11,7 +12,7 @@ $orderData = $this->getOrderData();
|
|
| 11 |
(function (srcjs) {
|
| 12 |
window._edrone = window._edrone || {};
|
| 13 |
_edrone.app_id = '<?php echo $helper->getAppId() ?>';
|
| 14 |
-
_edrone.version = '1.
|
| 15 |
_edrone.platform = 'Magento';
|
| 16 |
_edrone.platform_version = '<?php echo Mage::getVersion(); ?>';
|
| 17 |
_edrone.trace_url = '<?php echo $helper->getCollectorUrl() ?>';
|
|
@@ -21,7 +22,7 @@ $orderData = $this->getOrderData();
|
|
| 21 |
_edrone.first_name = '<?php echo urlencode($customerData['first_name']); ?>';
|
| 22 |
_edrone.last_name = '<?php echo urlencode($customerData['last_name']); ?>';
|
| 23 |
_edrone.product_skus = '<?php echo $orderData['sku'] ?>';
|
| 24 |
-
_edrone.product_ids = '
|
| 25 |
_edrone.product_titles = '<?php echo urlencode($orderData['title']); ?>';
|
| 26 |
_edrone.product_images = '<?php echo urlencode($orderData['image']); ?>';
|
| 27 |
_edrone.product_category_ids = '<?php echo $orderData['product_category_ids'] ?>';
|
|
@@ -45,7 +46,8 @@ $orderData = $this->getOrderData();
|
|
| 45 |
doc.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + srcjs;
|
| 46 |
var s = document.getElementsByTagName('script')[0];
|
| 47 |
s.parentNode.insertBefore(doc, s);
|
| 48 |
-
|
|
|
|
| 49 |
})("<?php echo $helper->getExternalScriptUrl() ?>");
|
| 50 |
</script>
|
| 51 |
<?php endif; ?>
|
| 4 |
$helper2 = Mage::helper('edrone');
|
| 5 |
$customerData = $this->getCustomerData();
|
| 6 |
$orderData = $this->getOrderData();
|
| 7 |
+
$serverSideStatus = $this->sendDataToServer($orderData, $customerData,$helper);
|
| 8 |
?>
|
| 9 |
|
| 10 |
<?php if(!empty($orderData)): ?>
|
| 12 |
(function (srcjs) {
|
| 13 |
window._edrone = window._edrone || {};
|
| 14 |
_edrone.app_id = '<?php echo $helper->getAppId() ?>';
|
| 15 |
+
_edrone.version = '1.1.11';
|
| 16 |
_edrone.platform = 'Magento';
|
| 17 |
_edrone.platform_version = '<?php echo Mage::getVersion(); ?>';
|
| 18 |
_edrone.trace_url = '<?php echo $helper->getCollectorUrl() ?>';
|
| 22 |
_edrone.first_name = '<?php echo urlencode($customerData['first_name']); ?>';
|
| 23 |
_edrone.last_name = '<?php echo urlencode($customerData['last_name']); ?>';
|
| 24 |
_edrone.product_skus = '<?php echo $orderData['sku'] ?>';
|
| 25 |
+
_edrone.product_ids = '';
|
| 26 |
_edrone.product_titles = '<?php echo urlencode($orderData['title']); ?>';
|
| 27 |
_edrone.product_images = '<?php echo urlencode($orderData['image']); ?>';
|
| 28 |
_edrone.product_category_ids = '<?php echo $orderData['product_category_ids'] ?>';
|
| 46 |
doc.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + srcjs;
|
| 47 |
var s = document.getElementsByTagName('script')[0];
|
| 48 |
s.parentNode.insertBefore(doc, s);
|
| 49 |
+
|
| 50 |
+
/*ServerSideStatus : <?php echo $serverSideStatus ?>*/
|
| 51 |
})("<?php echo $helper->getExternalScriptUrl() ?>");
|
| 52 |
</script>
|
| 53 |
<?php endif; ?>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>edroneCRM</name>
|
| 4 |
-
<version>1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GPL</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,9 +10,9 @@
|
|
| 10 |
<description>edrone is collecting and analyzing Magento visitors and customers data. The plugin allows processing personal data in the real-time in order to communicate with them through dynamic and personalized e-mail.</description>
|
| 11 |
<notes>edrone magento module - initial public release</notes>
|
| 12 |
<authors><author><name>Michał Blak</name><user>MAG002993376</user><email>admin@edrone.me</email></author></authors>
|
| 13 |
-
<date>2016-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magelocal"><dir name="Edrone"><dir name="Base"><dir name="Block"><file name="Base.php" hash="d0e605725b25d2bf1bc2d27af954ab69"/><file name="Cart.php" hash="7f80fb34c728bea3df6639a7666682b0"/><file name="Order.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>edroneCRM</name>
|
| 4 |
+
<version>1.1.11</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GPL</license>
|
| 7 |
<channel>community</channel>
|
| 10 |
<description>edrone is collecting and analyzing Magento visitors and customers data. The plugin allows processing personal data in the real-time in order to communicate with them through dynamic and personalized e-mail.</description>
|
| 11 |
<notes>edrone magento module - initial public release</notes>
|
| 12 |
<authors><author><name>Michał Blak</name><user>MAG002993376</user><email>admin@edrone.me</email></author></authors>
|
| 13 |
+
<date>2016-10-19</date>
|
| 14 |
+
<time>09:43:48</time>
|
| 15 |
+
<contents><target name="magelocal"><dir name="Edrone"><dir name="Base"><dir name="Block"><file name="Base.php" hash="d0e605725b25d2bf1bc2d27af954ab69"/><file name="Cart.php" hash="7f80fb34c728bea3df6639a7666682b0"/><file name="Order.php" hash="a2d0063e2ad76c0032fb15758c27609d"/><file name="Product.php" hash="74a35efb464c16b11ec7e89767829420"/></dir><dir name="Helper"><file name="Config.php" hash="8d9c74433df2314efff629fcb86fd0df"/><file name="Data.php" hash="a9040014b1b54a1d3cc7ebf401f489c0"/></dir><dir name="Model"><file name="Observer.php" hash="f35c3bf591865d6db22e2477580df76c"/></dir><dir name="controllers"><file name="NewsletterController.php" hash="fa9e82363c785ce94e005a7aad141162"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0e715e76c00295dc4e555411455fedfb"/><file name="config.xml" hash="6b2a486de78c721e5591351294cfe472"/><file name="system.xml" hash="5afd646f26bffc07a66471807ab4c157"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="edrone"><file name="cart_view.phtml" hash="cfb9efcc639cf1c006ce1fb750ca8c65"/><file name="default.phtml" hash="8812d5e946d83c19702acb6891416d25"/><file name="product_view.phtml" hash="6885a0fa97ce918699b44e0507c763bc"/><file name="success_view.phtml" hash="bd0ba548082e33daed336997517d35a3"/></dir></dir><dir name="layout"><file name="edrone.xml" hash="48e37d1c01507337f8dc33eb9e03af34"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Edrone_Base.xml" hash="29d3699c3a83fa4fea848a6cb7800872"/></dir></dir></target><target name="magelocale"><dir name="pl_PL"><file name="Edrone.csv" hash="b8aa59d39815f4d92738129cc9fbdf34"/></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
