Ejemplo n.º 1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEbayOrder()
 {
     return $this->hasOne(EbayOrder::className(), ['id' => 'ebay_order_id']);
 }
Ejemplo n.º 2
0
 public function add()
 {
     EbayOrder::insert(array('id_order_ref' => pSQL($this->id_order_ref), 'id_order' => (int) $this->id_order));
 }
Ejemplo n.º 3
0
 public function hookBackOfficeTop($params)
 {
     if (Configuration::get('EBAY_SEND_STATS') && Configuration::get('EBAY_STATS_LAST_UPDATE') < date('Y-m-d\\TH:i:s', strtotime('-1 day')) . '.000Z') {
         EbayStat::send();
         Configuration::updateValue('EBAY_STATS_LAST_UPDATE', date('Y-m-d\\TH:i:s.000\\Z'), false, 0, 0);
     }
     // update tracking number of eBay if required
     if (($id_order = (int) Tools::getValue('id_order')) && ($tracking_number = Tools::getValue('tracking_number')) && ($id_order_ref = EbayOrder::getIdOrderRefByIdOrder($id_order))) {
         $id_ebay_profiles = Db::getInstance()->ExecuteS('SELECT DISTINCT(`id_ebay_profile`) FROM `' . _DB_PREFIX_ . 'ebay_profile`');
         if (count($id_ebay_profiles) == 1) {
             $order = new Order($id_order);
             foreach ($id_ebay_profiles as $data) {
                 $id_ebay_profile = (int) $data['id_ebay_profile'];
                 $ebay_profile = new EbayProfile($id_ebay_profile);
                 if (!$ebay_profile->getConfiguration('EBAY_SEND_TRACKING_CODE')) {
                     continue;
                 }
                 $carrier = new Carrier($order->id_carrier, $ebay_profile->id_lang);
                 $ebay_request = new EbayRequest($id_ebay_profile);
                 if ($ebay_request->updateOrderTracking($id_order_ref, $tracking_number, $carrier->name)) {
                     break;
                 }
             }
         }
     }
     if (!(version_compare(_PS_VERSION_, '1.5.1', '>=') && version_compare(_PS_VERSION_, '1.5.2', '<') && !Shop::isFeatureActive())) {
         $this->hookHeader($params);
     }
 }
Ejemplo n.º 4
0
 public function add($id_ebay_profile = null)
 {
     $this->id_ebay_order = EbayOrder::insert(array('id_order_ref' => pSQL($this->id_order_ref)));
     if (is_array($this->id_orders)) {
         foreach ($this->id_orders as $id_shop => $id_order) {
             if (version_compare(_PS_VERSION_, '1.5', '>')) {
                 $res = Db::getInstance()->insert('ebay_order_order', array('id_ebay_order' => (int) $this->id_ebay_order, 'id_order' => (int) $id_order, 'id_shop' => (int) $id_shop));
             } else {
                 $res = Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_order_order', array('id_ebay_order' => (int) $this->id_ebay_order, 'id_order' => (int) $id_order, 'id_shop' => (int) $id_shop), 'INSERT');
             }
         }
         if ($res) {
             $this->_writeLog($id_ebay_profile, 'add_orders', $res);
         }
     }
 }