Skip to content

Commit

Permalink
removeRestApiSaveOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexEAX committed Apr 8, 2022
1 parent d5038c6 commit 89de010
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions app/code/community/Retargeting/Tracker/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,33 +74,37 @@ public function sendSubCustomer($customer, $info = null) {
}

private function Subscriber($isSubscribed, $info) {
$apiURL = "https://api.retargeting.app/v1/" . ( $isSubscribed ? "subscriber-register" : "subscriber-unsubscribe" );
try {
$apiURL = "https://api.retargeting.app/v1/" . ( $isSubscribed ? "subscriber-register" : "subscriber-unsubscribe" );

$key = Mage::getStoreConfig('retargetingtracker_options/token/token');
$key = Mage::getStoreConfig('retargetingtracker_options/token/token');

if (empty($key)) {
return false;
}
if (empty($key)) {
return false;
}

$info['k'] = $key;
$info['k'] = $key;

if (empty($info['phone'])){
unset($info['phone']);
}
if (empty($info['phone'])){
unset($info['phone']);
}

$apiURL = $apiURL .'?'. http_build_query($info);
$apiURL = $apiURL .'?'. http_build_query($info);

$curl_request = curl_init();
curl_setopt($curl_request, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($curl_request, CURLOPT_TIMEOUT, 1);
curl_setopt($curl_request, CURLOPT_URL, $apiURL);
curl_setopt($curl_request, CURLOPT_POST, false);
// curl_setopt($curl_request, CURLOPT_POSTFIELDS, $api_parameters);
curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false);
$out = curl_exec($curl_request);
$curl_request = curl_init();
curl_setopt($curl_request, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($curl_request, CURLOPT_TIMEOUT, 1);
curl_setopt($curl_request, CURLOPT_URL, $apiURL);
curl_setopt($curl_request, CURLOPT_POST, false);
// curl_setopt($curl_request, CURLOPT_POSTFIELDS, $api_parameters);
curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false);
$out = curl_exec($curl_request);

return true;
return true;
} catch (\Exception $e) {
return false;
}
}

public function TrackSetEmail($observer)
Expand Down Expand Up @@ -365,13 +369,14 @@ public function TrackSaveOrder($observer)
"total" => $order->getGrandTotal(),
"products" => json_encode($products)
);

/*
if ($token && $token != "") {
$retargetingClient = new Retargeting_REST_API_Client($token);
$retargetingClient->setResponseFormat("json");
$retargetingClient->setDecoding(false);
$response = $retargetingClient->order->save($info, $products);
}
*/

Mage::getSingleton('core/session')->setTriggerSaveOrder($info);
}
Expand Down

0 comments on commit 89de010

Please sign in to comment.