$cat_array = $this->call('setup/getEbayCategories/', array(), array(), 'json', true);
if($this->lasterror != true) {
$this->db->query("TRUNCATE TABLE `" . DB_PREFIX . "ebay_category`");
if(!empty($cat_array)) {
foreach($cat_array as $cat) {
if($cat['BestOfferEnabled'] == true) { $cat['BestOfferEnabled'] = 1; }else{ $cat['BestOfferEnabled'] = 0; }
if($cat['AutoPayEnabled'] == true) { $cat['AutoPayEnabled'] = 1; }else{ $cat['AutoPayEnabled'] = 0; }
$this->db->query("
INSERT INTO `" . DB_PREFIX . "ebay_category` SET
`CategoryID` = '".(int)$cat['CategoryID']."',
`CategoryParentID` = '".(int)$cat['CategoryParentID']."',
`CategoryLevel` = '".(int)$cat['CategoryLevel']."',
`BestOfferEnabled` = '".(int)$cat['BestOfferEnabled']."',
`AutoPayEnabled` = '".(int)$cat['AutoPayEnabled']."',
`CategoryName` = '".$this->db->escape((string)$cat['CategoryName'])."'
");
}
}
}
return array('msg' => $this->lastmsg, 'error' => $this->lasterror);