function getContent()
 {
     $configs = Configuration::getMultiple(array('EBAY_CATEGORY_LOADED_' . $this->ebay_profile->ebay_site_id, 'EBAY_SECURITY_TOKEN'));
     $ebay_request = new EbayRequest();
     $user_profile = $ebay_request->getUserProfile($this->ebay_profile->ebay_user_identifier);
     $store_categories = EbayStoreCategory::getStoreCategories($this->ebay_profile->id);
     $not_compatible_names = array();
     if ($store_categories['not_compatible']) {
         foreach ($store_categories['not_compatible'] as $cat) {
             $not_compatible_names[] = $cat['name'];
         }
     }
     $template_vars = array('configs' => $configs, '_path' => $this->path, 'controller' => Tools::getValue('controller'), 'configure' => Tools::getValue('configure'), 'token' => Tools::getValue('token'), 'tab_module' => Tools::getValue('tab_module'), 'module_name' => Tools::getValue('module_name'), 'tab' => Tools::getValue('tab'), 'nb_categorie' => count(Category::getCategories($this->context->cookie->id_lang, true, false)), 'has_store_categories' => count($store_categories['compatible']) > 1, 'not_compatible_store_categories' => implode(', ', $not_compatible_names), 'has_ebay_shop' => (bool) ($user_profile && $user_profile['StoreUrl']), 'ebay_store_url' => EbayCountrySpec::getProUrlBySiteId($this->ebay_profile->ebay_site_id));
     return $this->display('form_store_categories.tpl', $template_vars);
 }
 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.º 3
0
 private function _getAlerts()
 {
     $alerts = array();
     if ($this->ebay_profile && !$this->ebay_profile->getToken()) {
         $alerts[] = 'registration';
     }
     if (!ini_get('allow_url_fopen')) {
         $alerts[] = 'allowurlfopen';
     }
     if (!extension_loaded('curl')) {
         $alerts[] = 'curl';
     }
     if (!$this->ebay_profile) {
         return $alerts;
     }
     $ebay = new EbayRequest();
     //$user_profile = $ebay->getUserProfile(Configuration::get('EBAY_API_USERNAME', null, 0, 0));
     $user_profile = $ebay->getUserProfile($this->ebay_profile->ebay_user_identifier);
     $this->StoreName = $user_profile['StoreName'];
     if ($user_profile['SellerBusinessType'][0] != 'Commercial') {
         $alerts[] = 'SellerBusinessType';
     }
     return $alerts;
 }
Ejemplo n.º 4
0
 private function _getAlerts()
 {
     $alerts = array();
     if (!Configuration::get('EBAY_API_TOKEN')) {
         $alerts[] = 'registration';
     }
     if (!ini_get('allow_url_fopen')) {
         $alerts[] = 'allowurlfopen';
     }
     if (!extension_loaded('curl')) {
         $alerts[] = 'curl';
     }
     $ebay = new EbayRequest();
     $user_profile = $ebay->getUserProfile(Configuration::get('EBAY_API_USERNAME'));
     if ($user_profile['SellerBusinessType'][0] != 'Commercial') {
         $alerts[] = 'SellerBusinessType';
     }
     return $alerts;
 }