Example #1
0
 private function getDeliveryTimeOptions()
 {
     $exists = Db::getInstance()->getValue('SELECT COUNT(*) AS nb FROM ' . _DB_PREFIX_ . 'ebay_delivery_time_options');
     if ($exists > 0) {
         return Db::getInstance()->ExecuteS('SELECT * FROM ' . _DB_PREFIX_ . 'ebay_delivery_time_options');
     } else {
         $eBay = new eBayRequest();
         $location = $eBay->getDeliveryTimeOptions();
         $exists = Db::getInstance()->getValue('SELECT COUNT(*) AS nb FROM ' . _DB_PREFIX_ . 'ebay_delivery_time_options');
         if ($exists > 0) {
             return Db::getInstance()->ExecuteS('SELECT * FROM ' . _DB_PREFIX_ . 'ebay_delivery_time_options');
         } else {
             foreach ($location as $key => $value) {
                 foreach ($value as $keyfield => $fieldValue) {
                     $value[$keyfield] = pSQL($fieldValue);
                 }
                 Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_delivery_time_options', $value, 'INSERT');
             }
         }
         return $location;
     }
 }