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); }
/** * Register Form Config Methods **/ private function _displayFormRegister() { $ebay = new EbayRequest(); $smarty_vars = array(); if (Tools::getValue('relogin')) { $session_id = $ebay->login(); $this->context->cookie->eBaySession = $session_id; Configuration::updateValue('EBAY_API_SESSION', $session_id, false, 0, 0); $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; } $logged = !empty($this->context->cookie->eBaySession) && Tools::getValue('action') == 'logged'; $smarty_vars['logged'] = $logged; $id_shop = version_compare(_PS_VERSION_, '1.5', '>') ? Shop::getContextShopID() : Shop::getCurrentShop(); if ($logged) { if ($ebay_username = Tools::getValue('eBayUsernamesList')) { if ($ebay_username == -1) { $ebay_username = Tools::getValue('eBayUsername'); } $this->context->cookie->eBayUsername = $ebay_username; $this->ebay_profile = EbayProfile::getByLangShopSiteAndUsername((int) Tools::getValue('ebay_language'), $id_shop, Tools::getValue('ebay_country'), $ebay_username, EbayProductTemplate::getContent($this, $this->smarty)); EbayProfile::setProfile($this->ebay_profile->id); } $smarty_vars['check_token_tpl'] = $this->_displayCheckToken(); } else { if (empty($this->context->cookie->eBaySession)) { $session_id = $ebay->login(); $this->context->cookie->eBaySession = $session_id; Configuration::updateValue('EBAY_API_SESSION', $session_id, false, 0, 0); $this->context->cookie->write(); } if (isset($this->ebay_profile->id_shop)) { $ebay_profiles = EbayProfile::getProfilesByIdShop($this->ebay_profile->id_shop); } else { $ebay_profiles = array(); } foreach ($ebay_profiles as &$profile) { $profile['site_extension'] = EbayCountrySpec::getSiteExtensionBySiteId($profile['ebay_site_id']); } $smarty_vars = array_merge($smarty_vars, array('action_url' => $_SERVER['REQUEST_URI'] . '&action=logged', 'ebay_username' => $this->context->cookie->eBayUsername, 'window_open_url' => '?SignIn&runame=' . $ebay->runame . '&SessID=' . $this->context->cookie->eBaySession, 'ebay_countries' => EbayCountrySpec::getCountries($ebay->getDev()), 'default_country' => EbayCountrySpec::getKeyForEbayCountry(), 'ebay_user_identifiers' => EbayProfile::getEbayUserIdentifiers(), 'ebay_profiles' => $ebay_profiles, 'languages' => Language::getLanguages(true, $this->ebay_profile ? $this->ebay_profile->id_shop : $id_shop))); } $this->smarty->assign($smarty_vars); return $this->display(__FILE__, 'views/templates/hook/formRegister.tpl'); }
* NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * 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 dirname(__FILE__) . '/../../../config/config.inc.php'; if (!Tools::getValue('token') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN')) { die('ERROR: Invalid Token'); } include dirname(__FILE__) . '/../ebay.php'; $ebay = new Ebay(); $ebay_request = new EbayRequest(); $session_id = $ebay->login(); Tools::redirect($ebay_request->getLoginUrl() . '?SignIn&runame=' . $ebay_request->runame . '&SessID=' . $session_id); exit;
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'); }
* NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * 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-2013 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 dirname(__FILE__) . '/../../../config/config.inc.php'; if (!Tools::getValue('token') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN')) { die('ERROR: Invalid Token'); } include dirname(__FILE__) . '/../ebay.php'; $ebay = new Ebay(); $ebay_request = new EbayRequest(); $session_id = $ebay->login(); header('Location: ' . $ebay_request->getLoginUrl() . '?SignIn&runame=' . $ebay_request->runame . '&SessID=' . $session_id); exit;