public function __construct() { /** Backward compatibility */ require dirname(__FILE__) . '/../backward_compatibility/backward.php'; $this->ebay_country = EbayCountrySpec::getInstanceByKey(Configuration::get('EBAY_COUNTRY_DEFAULT'), $this->dev); $this->itemConditionError = false; /** * Sandbox params **/ $this->devID = '1db92af1-2824-4c45-8343-dfe68faa0280'; if ($this->dev) { $this->appID = 'Prestash-2629-4880-ba43-368352aecc86'; $this->certID = '6bd3f4bd-3e21-41e8-8164-7ac733218122'; $this->apiUrl = 'https://api.sandbox.ebay.com/ws/api.dll'; $this->compatibility_level = 719; $this->runame = 'Prestashop-Prestash-2629-4-hpehxegu'; $this->loginURL = $this->ebay_country->getSiteSignin(); } else { $this->appID = 'Prestash-70a5-419b-ae96-f03295c4581d'; $this->certID = '71d26dc9-b36b-4568-9bdb-7cb8af16ac9b'; $this->apiUrl = 'https://api.ebay.com/ws/api.dll'; $this->compatibility_level = 741; $this->runame = 'Prestashop-Prestash-70a5-4-pepwa'; $this->loginURL = $this->ebay_country->getSiteSignin(); } }
function getContent() { $ebay_country = EbayCountrySpec::getInstanceByKey($this->ebay_profile->getConfiguration('EBAY_COUNTRY_DEFAULT')); $help_file = dirname(__FILE__) . '/../../help/help-' . Tools::strtolower($ebay_country->getDocumentationLang()) . '.html'; if (!file_exists($help_file)) { $help_file = dirname(__FILE__) . '/../../help/help-en.html'; } return Tools::file_get_contents($help_file); }
function getContent() { // Loading config currency $config_currency = new Currency((int) $this->ebay_profile->getConfiguration('EBAY_CURRENCY')); $url_vars = array('id_tab' => '1', 'section' => 'parameters'); if (version_compare(_PS_VERSION_, '1.5', '>')) { $url_vars['controller'] = Tools::getValue('controller'); } else { $url_vars['tab'] = Tools::getValue('tab'); } $url = $this->_getUrl($url_vars); $ebayShop = $this->ebay_profile->getConfiguration('EBAY_SHOP') ? $this->ebay_profile->getConfiguration('EBAY_SHOP') : $this->ebay->StoreName; $ebayShopValue = Tools::getValue('ebay_shop', $ebayShop); $ebay_country = EbayCountrySpec::getInstanceByKey($this->ebay_profile->getConfiguration('EBAY_COUNTRY_DEFAULT')); $createShopUrl = 'http://cgi3.ebay.' . $ebay_country->getSiteExtension() . '/ws/eBayISAPI.dll?CreateProductSubscription&&productId=3&guest=1'; $ebay_request = new EbayRequest(); $ebay_sign_in_url = $ebay_request->getLoginUrl() . '?SignIn&runame=' . $ebay_request->runame . '&SessID=' . $this->context->cookie->eBaySession; $returns_policy_configuration = $this->ebay_profile->getReturnsPolicyConfiguration(); $returnsConditionAccepted = Tools::getValue('ebay_returns_accepted_option', Configuration::get('EBAY_RETURNS_ACCEPTED_OPTION')); $ebay_paypal_email = Tools::getValue('ebay_paypal_email', $this->ebay_profile->getConfiguration('EBAY_PAYPAL_EMAIL')); $shopPostalCode = Tools::getValue('ebay_shop_postalcode', $this->ebay_profile->getConfiguration('EBAY_SHOP_POSTALCODE')); $shopCountry = Tools::getValue('ebay_shop_country', $this->ebay_profile->getConfiguration('EBAY_SHOP_COUNTRY')); $ebayListingDuration = $this->ebay_profile->getConfiguration('EBAY_LISTING_DURATION') ? $this->ebay_profile->getConfiguration('EBAY_LISTING_DURATION') : 'GTC'; $user_profile = $ebay_request->getUserProfile($this->ebay_profile->ebay_user_identifier); $is_multishop = version_compare(_PS_VERSION_, '1.5', '>') && Shop::isFeatureActive(); $order_states = OrderState::getOrderStates($this->ebay_profile->id_lang); $current_order_state = $this->ebay_profile->getConfiguration('EBAY_SHIPPED_ORDER_STATE'); if ($current_order_state === null) { foreach ($order_states as $order_state) { if ($order_state['template'] === 'shipped') { // NDRArbuz: is this the best way to find it with no doubt? $current_order_state = $order_state['id_order_state']; break; } } } $smarty_vars = array('url' => $url, 'ebay_sign_in_url' => $ebay_sign_in_url, 'ebay_token' => Configuration::get('EBAY_SECURITY_TOKEN'), 'configCurrencysign' => $config_currency->sign, 'policies' => EbayReturnsPolicy::getReturnsPolicies(), 'catLoaded' => !Configuration::get('EBAY_CATEGORY_LOADED_' . $this->ebay_profile->ebay_site_id), 'createShopUrl' => $createShopUrl, 'ebayCountry' => EbayCountrySpec::getInstanceByKey($this->ebay_profile->getConfiguration('EBAY_COUNTRY_DEFAULT')), 'ebayReturns' => preg_replace('#<br\\s*?/?>#i', "\n", $this->ebay_profile->getReturnsPolicyConfiguration()->ebay_returns_description), 'ebayShopValue' => $ebayShopValue, 'shopPostalCode' => Tools::getValue('ebay_shop_postalcode', $this->ebay_profile->getConfiguration('EBAY_SHOP_POSTALCODE')), 'listingDurations' => $this->_getListingDurations(), 'ebayShop' => $this->ebay_profile->getConfiguration('EBAY_SHOP'), 'ebay_paypal_email' => Tools::getValue('ebay_paypal_email', $this->ebay_profile->getConfiguration('EBAY_PAYPAL_EMAIL')), 'returnsConditionAccepted' => Tools::getValue('ebay_returns_accepted_option', $returns_policy_configuration->ebay_returns_accepted_option), 'automaticallyRelist' => $this->ebay_profile->getConfiguration('EBAY_AUTOMATICALLY_RELIST'), 'ebay_paypal_email' => $ebay_paypal_email, 'returnsConditionAccepted' => $returnsConditionAccepted, 'ebayListingDuration' => $ebayListingDuration, 'automaticallyRelist' => Configuration::get('EBAY_AUTOMATICALLY_RELIST'), 'is_multishop' => $is_multishop, 'within_values' => unserialize(Configuration::get('EBAY_RETURNS_WITHIN_VALUES')), 'within' => $returns_policy_configuration->ebay_returns_within, 'whopays_values' => unserialize(Configuration::get('EBAY_RETURNS_WHO_PAYS_VALUES')), 'whopays' => $returns_policy_configuration->ebay_returns_who_pays, 'activate_mails' => Configuration::get('EBAY_ACTIVATE_MAILS'), 'hasEbayBoutique' => isset($user_profile['StoreUrl']) && !empty($user_profile['StoreUrl']) ? true : false, 'currencies' => TotCompatibility::getCurrenciesByIdShop($this->ebay_profile->id_shop), 'current_currency' => (int) $this->ebay_profile->getConfiguration('EBAY_CURRENCY'), 'ebay_shop_countries' => EbayCountrySpec::getCountries(false), 'current_ebay_shop_country' => $shopCountry, 'send_tracking_code' => (bool) $this->ebay_profile->getConfiguration('EBAY_SEND_TRACKING_CODE'), 'order_states' => $order_states, 'current_order_state' => $current_order_state, 'immediate_payment' => (bool) $this->ebay_profile->getConfiguration('EBAY_IMMEDIATE_PAYMENT')); if (Tools::getValue('relogin')) { $this->ebay->login(); $smarty_vars = array_merge($smarty_vars, array('relogin' => true, 'redirect_url' => $ebay_request->getLoginUrl() . '?SignIn&runame=' . $ebay_request->runame . '&SessID=' . $this->context->cookie->eBaySession)); } else { $smarty_vars['relogin'] = false; } if (Tools::getValue('action') == 'regenerate_token') { $smarty_vars['check_token_tpl'] = $this->ebay->_displayCheckToken(); } return $this->display('formParameters.tpl', $smarty_vars); }
public static function getByLangShopSiteAndUsername($id_lang, $id_shop, $ebay_country, $ebay_user_identifier, $template_content) { $ebay_country_spec = EbayCountrySpec::getInstanceByKey($ebay_country); $ebay_site_id = $ebay_country_spec->getSiteID(); $sql = 'SELECT `id_ebay_profile` FROM `' . _DB_PREFIX_ . 'ebay_profile` ep WHERE ep.`id_lang` = ' . (int) $id_lang . ' AND ep.`id_shop` = ' . (int) $id_shop . ' AND ep.`ebay_site_id` = ' . (int) $ebay_site_id . ' AND ep.`ebay_user_identifier` = \'' . pSQL($ebay_user_identifier) . '\''; if ($id_profile = Db::getInstance()->getValue($sql)) { return new EbayProfile($id_profile); } // otherwise create the eBay profile $ebay_profile = new EbayProfile(); $ebay_profile->id_lang = $id_lang; $ebay_profile->id_shop = $id_shop; $ebay_profile->ebay_site_id = $ebay_site_id; $ebay_profile->ebay_user_identifier = $ebay_user_identifier; $returns_policy_configuration = new EbayReturnsPolicyConfiguration(); $returns_policy_configuration->save(); $ebay_profile->id_ebay_returns_policy_configuration = $returns_policy_configuration->id; $ebay_profile->save(); $ebay_profile->setConfiguration('EBAY_COUNTRY_DEFAULT', $ebay_country); $ebay_profile->setPicturesSettings(); $ebay_profile->setDefaultConfig($template_content); return $ebay_profile; }
* versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <*****@*****.**> * @copyright 2007-2015 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ include_once dirname(__FILE__) . '/../../../config/config.inc.php'; include_once dirname(__FILE__) . '/../classes/EbayCountrySpec.php'; include_once dirname(__FILE__) . '/../classes/EbayProductConfiguration.php'; if (!Tools::getValue('token') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN')) { die('ERROR : INVALID TOKEN'); } $ebay = new Ebay(); $ebay_country = EbayCountrySpec::getInstanceByKey(Configuration::get('EBAY_COUNTRY_DEFAULT')); $ebay_request = new EbayRequest(); $id_lang = $ebay_country->getIdLang(); $id_ebay_profile = (int) Tools::getValue('id_ebay_profile'); $id_product = (int) Tools::getValue('product'); $is_one_five = version_compare(_PS_VERSION_, '1.5', '>'); $sql = 'SELECT pa.`id_product_attribute`, sa.`quantity` AS stock, al.`name` AS name, ep.`id_product_ref` AS id_product_ref FROM `' . _DB_PREFIX_ . 'product_attribute` pa INNER JOIN `' . _DB_PREFIX_ . 'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute` INNER JOIN `' . _DB_PREFIX_ . 'attribute` a
/** * Construct Method * **/ public function __construct($id_ebay_profile = null) { $this->name = 'ebay'; $this->tab = 'market_place'; $this->version = '1.11.0'; $this->stats_version = '1.0'; $this->author = 'PrestaShop'; parent::__construct(); /** Backward compatibility */ require _PS_MODULE_DIR_ . $this->name . '/backward_compatibility/backward.php'; $this->displayName = $this->l('eBay'); $this->description = $this->l('Easily export your products from PrestaShop to eBay, the biggest market place, to acquire new customers and realize more sales.'); $this->module_key = '7a6b007a219bab59c1611254347f21d5'; // Checking Extension $this->_checkExtensionsLoading(); // Checking compatibility with older PrestaShop and fixing it if (!Configuration::get('PS_SHOP_DOMAIN')) { $this->setConfiguration('PS_SHOP_DOMAIN', $_SERVER['HTTP_HOST']); } // Generate eBay Security Token if not exists if (!Configuration::get('EBAY_SECURITY_TOKEN')) { $this->setConfiguration('EBAY_SECURITY_TOKEN', Tools::passwdGen(30)); } // For 1.4.3 and less compatibility $update_config = array('PS_OS_CHEQUE' => 1, 'PS_OS_PAYMENT' => 2, 'PS_OS_PREPARATION' => 3, 'PS_OS_SHIPPING' => 4, 'PS_OS_DELIVERED' => 5, 'PS_OS_CANCELED' => 6, 'PS_OS_REFUND' => 7, 'PS_OS_ERROR' => 8, 'PS_OS_OUTOFSTOCK' => 9, 'PS_OS_BANKWIRE' => 10, 'PS_OS_PAYPAL' => 11, 'PS_OS_WS_PAYMENT' => 12); foreach ($update_config as $key => $value) { if (!Configuration::get($key)) { $const_name = '_' . $key . '_'; if ((int) constant($const_name)) { $this->setConfiguration($key, constant($const_name)); } else { $this->setConfiguration($key, $value); } } } $this->is_multishop = version_compare(_PS_VERSION_, '1.5', '>') && Shop::isFeatureActive(); // Check if installed if (self::isInstalled($this->name)) { // Upgrade eBay module if (Configuration::get('EBAY_VERSION') != $this->version) { $this->_upgrade(); } //if (!empty($_POST) && Tools::getValue('ebay_profile')) if (!empty($_POST)) { // called after adding a profile if (Tools::getValue('action') == 'logged' && Tools::isSubmit('ebayRegisterButton')) { $this->_postProcessAddProfile(); } elseif (Tools::getValue('ebay_profile')) { $this->_postProcessConfig(); } } if (class_exists('EbayCountrySpec')) { if (!$this->ebay_profile) { if ($id_ebay_profile) { $this->ebay_profile = new EbayProfile($id_ebay_profile); } else { $this->ebay_profile = EbayProfile::getCurrent(); } } if ($this->ebay_profile) { // Check the country $this->ebay_country = EbayCountrySpec::getInstanceByKey($this->ebay_profile->getConfiguration('EBAY_COUNTRY_DEFAULT')); if (!$this->ebay_country->checkCountry()) { $this->warning = $this->l('The eBay module currently works for eBay.fr, eBay.it, eBay.co.uk, eBay.pl, eBay.nl and eBay.es'); return false; } } else { $iso_country = Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))); $iso_lang = Tools::strtolower(Language::getIsoById(Configuration::get('PS_LANG_DEFAULT'))); $this->ebay_country = EbayCountrySpec::getInstanceByCountryAndLang($iso_country, $iso_lang); return false; } } // Warning uninstall $this->confirmUninstall = $this->l('Are you sure you want to uninistall this module? All configuration settings will be lost'); } }
public static function getMultiVarToNonMultiSku($ebay_profile, $context) { $cat_with_problem = array(); $sql_get_cat_non_multi_sku = 'SELECT * FROM ' . _DB_PREFIX_ . 'ebay_category_configuration AS ecc INNER JOIN ' . _DB_PREFIX_ . 'ebay_category AS ec ON ecc.id_ebay_category = ec.id_ebay_category WHERE ecc.id_ebay_profile = ' . (int) $ebay_profile->id . ' GROUP BY name'; foreach (Db::getInstance()->ExecuteS($sql_get_cat_non_multi_sku) as $cat) { if ($cat['is_multi_sku'] != 1 && EbayCategory::getInheritedIsMultiSku($cat['id_category_ref'], $ebay_profile->ebay_site_id) != 1) { $catProblem = 0; $category = new Category($cat['id_category']); $ebay_country = EbayCountrySpec::getInstanceByKey($ebay_profile->getConfiguration('EBAY_COUNTRY_DEFAULT')); $products = $category->getProductsWs($ebay_country->getIdLang(), 0, 300); foreach ($products as $product_ar) { $product = new Product($product_ar['id']); $combinations = version_compare(_PS_VERSION_, '1.5', '>') ? $product->getAttributeCombinations($context->cookie->id_lang) : $product->getAttributeCombinaisons($context->cookie->id_lang); if (count($combinations) > 0 && !$catProblem) { $cat_with_problem[] = $cat['name']; $catProblem = 1; } } } } return $cat_with_problem; }
private function _displayFormParameters() { // Loading config currency $config_currency = new Currency((int) Configuration::get('PS_CURRENCY_DEFAULT')); $url_vars = array('id_tab' => '1', 'section' => 'parameters'); if (version_compare(_PS_VERSION_, '1.5', '>')) { $url_vars['controller'] = Tools::safeOutput(Tools::getValue('controller')); } else { $url_vars['tab'] = Tools::safeOutput(Tools::getValue('tab')); } $url = $this->_getUrl($url_vars); $ebay_identifier = Tools::safeOutput(Tools::getValue('ebay_identifier', Configuration::get('EBAY_IDENTIFIER'))) . '" ' . (Tools::getValue('ebay_identifier', Configuration::get('EBAY_IDENTIFIER')) != '' ? ' readonly="readonly"' : ''); $ebayShop = Configuration::get('EBAY_SHOP') ? Configuration::get('EBAY_SHOP') : $this->StoreName; $ebayShopValue = Tools::safeOutput(Tools::getValue('ebay_shop', $ebayShop)); $createShopUrl = 'http://cgi3.ebay.' . $this->ebay_country->getSiteExtension() . '/ws/eBayISAPI.dll?CreateProductSubscription&&productId=3&guest=1'; $ebay = new EbayRequest(); $ebay_sign_in_url = $ebay->getLoginUrl() . '?SignIn&runame=' . $ebay->runame . '&SessID=' . $this->context->cookie->eBaySession; $smarty_vars = array('url' => $url, 'ebay_sign_in_url' => $ebay_sign_in_url, 'ebay_token' => Configuration::get('EBAY_SECURITY_TOKEN'), 'ebayIdentifier' => $ebay_identifier, 'configCurrencysign' => $config_currency->sign, 'policies' => $this->_getReturnsPolicies(), 'catLoaded' => !Configuration::get('EBAY_CATEGORY_LOADED'), 'createShopUrl' => $createShopUrl, 'ebayCountry' => EbayCountrySpec::getInstanceByKey(Configuration::get('EBAY_COUNTRY_DEFAULT')), 'ebayReturns' => preg_replace('#<br\\s*?/?>#i', "\n", Configuration::get('EBAY_RETURNS_DESCRIPTION')), 'ebayShopValue' => $ebayShopValue, 'shopPostalCode' => Tools::safeOutput(Tools::getValue('ebay_shop_postalcode', Configuration::get('EBAY_SHOP_POSTALCODE'))), 'listingDurations' => $this->_getListingDurations(), 'ebayShop' => Configuration::get('EBAY_SHOP'), 'ebay_paypal_email' => Tools::safeOutput(Tools::getValue('ebay_paypal_email', Configuration::get('EBAY_PAYPAL_EMAIL'))), 'returnsConditionAccepted' => Tools::getValue('ebay_returns_accepted_option', Configuration::get('EBAY_RETURNS_ACCEPTED_OPTION')), 'ebayListingDuration' => Configuration::get('EBAY_LISTING_DURATION'), 'automaticallyRelist' => Configuration::get('EBAY_AUTOMATICALLY_RELIST'), 'sizes' => ImageType::getImagesTypes('products'), 'sizedefault' => (int) Configuration::get('EBAY_PICTURE_SIZE_DEFAULT'), 'sizebig' => (int) Configuration::get('EBAY_PICTURE_SIZE_BIG'), 'sizesmall' => (int) Configuration::get('EBAY_PICTURE_SIZE_SMALL'), 'within_values' => unserialize(Configuration::get('EBAY_RETURNS_WITHIN_VALUES')), 'within' => Configuration::get('EBAY_RETURNS_WITHIN'), 'whopays_values' => unserialize(Configuration::get('EBAY_RETURNS_WHO_PAYS_VALUES')), 'whopays' => Configuration::get('EBAY_RETURNS_WHO_PAYS')); if (Tools::getValue('relogin')) { $this->login(); $smarty_vars = array_merge($smarty_vars, array('relogin' => true, 'redirect_url' => $ebay->getLoginUrl() . '?SignIn&runame=' . $ebay->runame . '&SessID=' . $this->context->cookie->eBaySession)); } else { $smarty_vars['relogin'] = false; } if (Tools::getValue('action') == 'regenerate_token') { $smarty_vars['check_token_tpl'] = $this->_displayCheckToken(); } $this->smarty->assign($smarty_vars); return $this->display(dirname(__FILE__), '/views/templates/hook/formParameters.tpl'); }
/** * Updates the template image links since the image files have moved * */ function upgrade_module_1_7($module) { include dirname(__FILE__) . '/sql/sql-upgrade-1-7.php'; if (!empty($sql) && is_array($sql)) { foreach ($sql as $request) { if (!Db::getInstance()->execute($request)) { return false; } } } Db::getInstance()->Execute('UPDATE ' . _DB_PREFIX_ . 'ebay_shipping SET id_zone = ' . (int) Configuration::get('EBAY_ZONE_NATIONAL') . ' WHERE international = 0'); Db::getInstance()->Execute('UPDATE ' . _DB_PREFIX_ . 'ebay_shipping SET id_zone = ' . (int) Configuration::get('EBAY_ZONE_INTERNATIONAL') . ' WHERE international = 1'); // create default profile(s) $is_multishop = version_compare(_PS_VERSION_, '1.5', '>') && Shop::isFeatureActive(); $id_shop_default = (int) Configuration::get('PS_SHOP_DEFAULT') ? (int) Configuration::get('PS_SHOP_DEFAULT') : 1; // handle default returns policy if (!($id_returns_policy_configuration = EbayReturnsPolicyConfiguration::getDefaultObjectId())) { $id_returns_policy_configuration = EbayReturnsPolicyConfiguration::createPreviousDefaultConfiguration(); } // handle default profile if (version_compare(_PS_VERSION_, '1.5', '<')) { $id_shops = array('1' => '1'); } else { $id_shops = Shop::getShops(false, null, false); } foreach (array_keys($id_shops) as $id_shop) { if (!($profile = EbayProfile::getOneByIdShop($id_shop))) { $profile = new EbayProfile(); $profile->id_shop = $id_shop; } $profile->ebay_user_identifier = Configuration::get('EBAY_IDENTIFIER'); $ebay_country = EbayCountrySpec::getInstanceByKey(Configuration::get('EBAY_COUNTRY_DEFAULT')); $profile->ebay_site = $ebay_country->getSiteExtension(); if ($id_shop_default == $id_shop) { $profile->id_ebay_returns_policy_configuration = $id_returns_policy_configuration; } else { $profile->id_ebay_returns_policy_configuration = EbayReturnsPolicyConfiguration::createPreviousDefaultConfiguration(); } $profile->save(); if ($id_shop_default == $id_shop) { $id_default_ebay_profile = $profile->id; } $configurations_to_update = array('EBAY_COUNTRY_DEFAULT', 'EBAY_ORDER_LAST_UPDATE', 'EBAY_DELIVERY_TIME', 'EBAY_PICTURE_SIZE_DEFAULT', 'EBAY_PICTURE_SIZE_SMALL', 'EBAY_PICTURE_SIZE_BIG', 'EBAY_LISTING_DURATION', 'EBAY_AUTOMATICALLY_RELIST', 'EBAY_LAST_RELIST', 'EBAY_SYNC_PRODUCTS_MODE', 'EBAY_ZONE_NATIONAL', 'EBAY_ZONE_INTERNATIONAL', 'EBAY_SHOP', 'EBAY_SHOP_POSTALCODE', 'EBAY_SYNC_OPTION_RESYNC', 'EBAY_SYNC_MODE', 'EBAY_SYNC_LAST_PRODUCT', 'EBAY_SPECIFICS_LAST_UPDATE', 'EBAY_PAYPAL_EMAIL'); $configuration_to_update_html = array('EBAY_PRODUCT_TEMPLATE'); EbayConfiguration::PSConfigurationsToEbayConfigurations($profile->id, $configurations_to_update, $configuration_to_update_html); $profile->setConfiguration('EBAY_PRODUCT_TEMPLATE_TITLE', '{TITLE}'); } $configurations_to_delete = array_merge($configurations_to_update, array('EBAY_RETURNS_DESCRIPTION', 'EBAY_RETURNS_ACCEPTED_OPTION', 'EBAY_RETURNS_WITHIN', 'EBAY_RETURNS_WHO_PAYS')); foreach ($configurations_to_delete as $name) { Configuration::deleteByName($name); } // ebay_category_configuration table $tables = array('ebay_category_configuration', 'ebay_shipping_zone_excluded', 'ebay_shipping_international_zone', 'ebay_category_condition', 'ebay_category_condition_configuration', 'ebay_shipping', 'ebay_product'); if (version_compare(_PS_VERSION_, '1.5', '<')) { foreach ($tables as $table) { Db::getInstance()->autoExecute(_DB_PREFIX_ . $table, array('id_ebay_profile' => $id_default_ebay_profile), 'UPDATE'); } } else { foreach ($tables as $table) { Db::getInstance()->update($table, array('id_ebay_profile' => $id_default_ebay_profile)); } } $sql = 'SELECT `id_ebay_order`, `id_order` FROM `' . _DB_PREFIX_ . 'ebay_order`'; $res = Db::getInstance()->executeS($sql); foreach ($res as $row) { $data = array('id_ebay_order' => $row['id_ebay_order'], 'id_order' => $row['id_order']); if (version_compare(_PS_VERSION_, '1.5', '<')) { Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_order_order', $data, 'INSERT'); } else { Db::getInstance()->insert('ebay_order_order', $data, false, true, Db::REPLACE); } } $module->setConfiguration('EBAY_VERSION', $module->version); // TODO: at some point we need to remove the id_order column of ebay_order which becomes useless // but we cannot do it before the data have moved return true; }