public function hookUpdateOrderStatus($params) { if ($this->_allowToWork == false) { return; } if ((int) $params['newOrderStatus']->unremovable === 1 && (int) $params['newOrderStatus']->logable === 1 && (int) $params['newOrderStatus']->delivery === 0) { $obj_order = new Order($params['id_order']); $customer = new Customer($obj_order->id_customer); $params_to_twenga = array(); // @todo delete or not ?? // $params_to_twenga['order_id'] = (int)$params['id_order']; // $params_to_twenga['user_id'] = (int)$customer->id; // $params_to_twenga['cli_email'] = (string)$customer->email; $params_to_twenga['basket_id'] = (int) $obj_order->id_cart; $bool = false; try { if ($params_to_twenga) { $cart = new Cart($params_to_twenga['basket_id']); $bool = self::$obj_twenga->orderValidate($params_to_twenga); self::$obj_ps_stats->validateOrder($obj_order->total_products_wt, $obj_order->total_paid); } } catch (Exception $e) { // die($e->getMessage()); } } }
private function submitTwengaLogin() { if (!self::$obj_twenga->setHashkey($_POST['twenga_hashkey'])) { $this->_errors[] = $this->l('Your hashkey is invalid. Please check the e-mail already sent by Twenga.'); } if (!self::$obj_twenga->setUserName($_POST['twenga_user_name'])) { $this->_errors[] = $this->l('Your user name is invalid. Please check the e-mail already sent by Twenga.'); } if (!self::$obj_twenga->setPassword($_POST['twenga_password'])) { $this->_errors[] = $this->l('Your password is invalid. Please check the e-mail already sent by Twenga.'); } if (empty($this->_errors)) { $bool_save = false; try { $bool_save = self::$obj_twenga->saveMerchantLogin(); self::$obj_ps_stats->validateSubscription(); if (!$bool_save) { $this->_errors[] = $this->l('Authentication failed.') . "<br />\n" . $this->l('Please review the e-mail sent by Twenga after subscription. If error still occurred, contact Twenga service.'); } else { self::$obj_twenga->addFeed(array('feed_url' => $this->feed_url)); $this->_html = ' <div class="conf feed_url"> ' . $this->l('Your product export URL has successfully been created and shared with the Twenga team:') . '<br /> <a href="' . $this->feed_url . '" target="_blank">' . $this->feed_url . '</a> </div> '; Configuration::updateValue('TWENGA_CONFIGURATION_OK', true); } } catch (Exception $e) { $this->_errors[] = nl2br($e->getMessage()); } } }
/** * Constructor save all necessaries infos to make transaction with tracker page. * @param string $site_url to identify the shop */ public function __construct($site_url) { if (self::$arr_ps_stats_url === NULL) { self::$arr_ps_stats_url = array(); self::$arr_ps_stats_url['actSubscription'] = 'http://www.prestashop.com/modules/tracker_twenga.php?act_subscription=1'; self::$arr_ps_stats_url['validateSubscription'] = 'http://www.prestashop.com/modules/tracker_twenga.php?validate_subscription=1'; self::$arr_ps_stats_url['cancelOrder'] = 'http://www.prestashop.com/modules/tracker_twenga.php?cancel_order=1'; self::$arr_ps_stats_url['validateOrder'] = 'http://www.prestashop.com/modules/tracker_twenga.php?validate_order=1'; self::$site_url = $site_url; } }
public function hookUpdateOrderStatus($params) { if ($this->_allowToWork == false) { return; } if ((int) $params['newOrderStatus']->unremovable === 1 && (int) $params['newOrderStatus']->logable === 1 && (int) $params['newOrderStatus']->delivery === 0) { $obj_order = new Order($params['id_order']); $customer = new Customer($obj_order->id_customer); $params_to_twenga = array(); $params_to_twenga['basket_id'] = (int) $obj_order->id_cart; $bool = false; if ($params_to_twenga) { $cart = new Cart($params_to_twenga['basket_id']); $bool = self::$obj_twenga->orderValidate($params_to_twenga); self::$obj_ps_stats->validateOrder($obj_order->total_products_wt, $obj_order->total_paid); } } }