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);
 }
Ejemplo n.º 2
0
 /**
  * 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');
 }
Ejemplo n.º 3
0
 /**
  * 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;
         $this->setConfiguration('EBAY_API_SESSION', $session_id);
         $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;
     if ($logged) {
         if ($ebay_username = Tools::getValue('eBayUsername')) {
             $this->context->cookie->eBayUsername = $ebay_username;
             $this->setConfiguration('EBAY_API_USERNAME', $ebay_username);
             $this->setConfiguration('EBAY_IDENTIFIER', $ebay_username);
             $this->setConfiguration('EBAY_COUNTRY_DEFAULT', Tools::getValue('ebay_country'));
         }
         $smarty_vars['check_token_tpl'] = $this->_displayCheckToken();
     } else {
         if (empty($this->context->cookie->eBaySession)) {
             $session_id = $ebay->login();
             $this->context->cookie->eBaySession = $session_id;
             $this->setConfiguration('EBAY_API_SESSION', $session_id);
             $this->context->cookie->write();
         }
         $smarty_vars = array_merge($smarty_vars, array('action_url' => Tools::safeOutput($_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()));
     }
     $this->smarty->assign($smarty_vars);
     return $this->display(__FILE__, 'views/templates/hook/formRegister.tpl');
 }