function postProcess() { // Save specifics if (Tools::getValue('specific')) { foreach (Tools::getValue('specific') as $specific_id => $data) { if ($data) { list($data_type, $value) = explode('-', $data); } else { $data_type = null; } $field_names = EbayCategorySpecific::getPrefixToFieldNames(); $data = array_combine(array_values($field_names), array(null, null, null, null)); if ($data_type) { $data[$field_names[$data_type]] = pSQL($value); } if (version_compare(_PS_VERSION_, '1.5', '>')) { Db::getInstance()->update('ebay_category_specific', $data, 'id_ebay_category_specific = ' . (int) $specific_id); } else { Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_category_specific', $data, 'UPDATE', 'id_ebay_category_specific = ' . (int) $specific_id); } } } // save conditions foreach (Tools::getValue('condition') as $category_id => $condition) { foreach ($condition as $type => $condition_ref) { EbayCategoryConditionConfiguration::replace(array('id_ebay_profile' => $this->ebay_profile->id, 'id_condition_ref' => $condition_ref, 'id_category_ref' => $category_id, 'condition_type' => $type)); } } return $this->ebay->displayConfirmation($this->ebay->l('Settings updated')); }
/** * * Returns an array with the condition_type and corresponding ConditionID on eBay * */ public function getConditionsValues($id_ebay_profile) { if (!isset($this->conditions_values[$id_ebay_profile])) { $sql = 'SELECT e.condition_type, e.id_condition_ref as condition_id FROM ' . _DB_PREFIX_ . 'ebay_category_condition_configuration e WHERE e.`id_ebay_profile` = ' . (int) $id_ebay_profile . ' AND e.id_category_ref = ' . (int) $this->id_category_ref; $res = Db::getInstance()->executeS($sql); $ret = array('new' => null, 'used' => null, 'refurbished' => null); foreach ($res as $row) { $ret[EbayCategoryConditionConfiguration::getPSConditions($row['condition_type'])] = $row['condition_id']; } $this->conditions_values[$id_ebay_profile] = $ret; } return $this->conditions_values[$id_ebay_profile]; }