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
 public static function getReturnsPolicies()
 {
     // already in the DB
     if (EbayReturnsPolicy::getTotal()) {
         return EbayReturnsPolicy::getAll();
     }
     $ebay_request = new EbayRequest();
     $policiesDetails = $ebay_request->getReturnsPolicies();
     foreach ($policiesDetails['ReturnsAccepted'] as $returns_policy) {
         EbayReturnsPolicy::insert(array_map('pSQL', $returns_policy));
     }
     $ReturnsWithin = array();
     foreach ($policiesDetails['ReturnsWithin'] as $returns_within) {
         $ReturnsWithin[] = array_map('pSQL', $returns_within);
     }
     Configuration::updateValue('EBAY_RETURNS_WITHIN_VALUES', serialize($ReturnsWithin), false, 0, 0);
     $returnsWhoPays = array();
     foreach ($policiesDetails['ReturnsWhoPays'] as $returns_within) {
         $returnsWhoPays[] = array_map('pSQL', $returns_within);
     }
     Configuration::updateValue('EBAY_RETURNS_WHO_PAYS_VALUES', serialize($returnsWhoPays), false, 0, 0);
     return $policiesDetails['ReturnsAccepted'];
 }
Ejemplo n.º 3
0
 private function _getReturnsPolicies()
 {
     // already in the DB
     if (EbayReturnsPolicy::getTotal()) {
         return EbayReturnsPolicy::getAll();
     }
     $ebay = new EbayRequest();
     $policiesDetails = $ebay->getReturnsPolicies();
     foreach ($policiesDetails['ReturnsAccepted'] as $returns_policy) {
         EbayReturnsPolicy::insert(array_map('pSQL', $returns_policy));
     }
     $ReturnsWithin = array();
     foreach ($policiesDetails['ReturnsWithin'] as $returns_within) {
         $ReturnsWithin[] = array_map('pSQL', $returns_within);
     }
     $this->setConfiguration('EBAY_RETURNS_WITHIN_VALUES', serialize($ReturnsWithin));
     if (!Configuration::get('EBAY_RETURNS_WITHIN')) {
         $this->setConfiguration('EBAY_RETURNS_WITHIN', 'Days_14');
     }
     $returnsWhoPays = array();
     foreach ($policiesDetails['ReturnsWhoPays'] as $returns_within) {
         $returnsWhoPays[] = array_map('pSQL', $returns_within);
     }
     $this->setConfiguration('EBAY_RETURNS_WHO_PAYS_VALUES', serialize($returnsWhoPays));
     if (!Configuration::get('EBAY_RETURNS_WHO_PAYS')) {
         $this->setConfiguration('EBAY_RETURNS_WHO_PAYS', 'Buyer');
     }
     return $policiesDetails['ReturnsAccepted'];
 }
Ejemplo n.º 4
0
 private function _getReturnsPolicies()
 {
     // already in the DB
     if (EbayReturnsPolicy::getTotal()) {
         return EbayReturnsPolicy::getAll();
     }
     $ebay = new EbayRequest();
     $returns_policies = $ebay->getReturnsPolicies();
     foreach ($returns_policies as $returns_policy) {
         EbayReturnsPolicy::insert(array_map('pSQL', $returns_policy));
     }
     return $returns_policies;
 }