예제 #1
0
 /**
  * Main Form Method
  *
  */
 public function getContent()
 {
     if ($this->ebay_profile && !Configuration::get('EBAY_CATEGORY_MULTI_SKU_UPDATE')) {
         $ebay = new EbayRequest();
         EbayCategory::updateCategoryTable($ebay->getCategoriesSkuCompliancy());
     }
     if (Tools::getValue('refresh_store_cat')) {
         $ebay = new EbayRequest();
         EbayStoreCategory::updateStoreCategoryTable($ebay->getStoreCategories(), $this->ebay_profile);
     }
     if ($this->ebay_profile) {
         $this->ebay_profile->loadStoreCategories();
     }
     // Checking Extension
     if (!extension_loaded('curl') || !ini_get('allow_url_fopen')) {
         if (!extension_loaded('curl') && !ini_get('allow_url_fopen')) {
             return $this->html . $this->displayError($this->l('You must enable cURL extension and allow_url_fopen option on your server if you want to use this module.'));
         } elseif (!extension_loaded('curl')) {
             return $this->html . $this->displayError($this->l('You must enable cURL extension on your server if you want to use this module.'));
         } elseif (!ini_get('allow_url_fopen')) {
             return $this->html . $this->displayError($this->l('You must enable allow_url_fopen option on your server if you want to use this module.'));
         }
     }
     // If isset Post Var, post process else display form
     if (!empty($_POST) && (Tools::isSubmit('submitSave') || Tools::isSubmit('btnSubmitSyncAndPublish') || Tools::isSubmit('btnSubmitSync'))) {
         $errors = $this->_postValidation();
         if (!count($errors)) {
             $this->_postProcess();
         } else {
             foreach ($errors as $error) {
                 $this->html .= '<div class="alert error"><img src="../modules/ebay/views/img/forbbiden.gif" alt="nok" />&nbsp;' . $error . '</div>';
             }
         }
         if (Configuration::get('EBAY_SEND_STATS')) {
             $ebay_stat = new EbayStat($this->stats_version, $this->ebay_profile);
             $ebay_stat->save();
         }
     }
     $this->html .= $this->_displayForm();
     // Set old Context Shop
     /* RAPH
     		if (version_compare(_PS_VERSION_, '1.5', '>') && Shop::isFeatureActive())
     			$this->_setContextShop($old_context_shop);
     		*/
     return $this->html;
 }
예제 #2
0
 /**
  * Main Form Method
  *
  */
 public function getContent()
 {
     // if multishop, change context Shop to be default
     if (version_compare(_PS_VERSION_, '1.5', '>') && Shop::isFeatureActive()) {
         $old_context_shop = $this->_getContextShop();
         $this->_setContextShop();
     }
     if (!Configuration::get('EBAY_CATEGORY_MULTI_SKU_UPDATE')) {
         $ebay = new EbayRequest();
         EbayCategory::updateCategoryTable($ebay->getCategoriesSkuCompliancy());
     }
     // Checking Country
     if (Tools::getValue('ebay_country_default_fr') == 'ok') {
         $this->setConfiguration('EBAY_COUNTRY_DEFAULT', 8);
     }
     // Check the country
     if (!$this->ebay_country->checkCountry()) {
         return $this->html . '<center>' . $this->displayError($this->l('The eBay module currently works for eBay.fr, eBay.it, eBay.co.uk and eBay.es') . '.<br /><a href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&ebay_country_default_fr=ok">' . $this->l('Continue anyway ?') . '</a>') . '</center>';
     }
     // Checking Extension
     if (!extension_loaded('curl') || !ini_get('allow_url_fopen')) {
         if (!extension_loaded('curl') && !ini_get('allow_url_fopen')) {
             return $this->html . $this->displayError($this->l('You must enable cURL extension and allow_url_fopen option on your server if you want to use this module.'));
         } elseif (!extension_loaded('curl')) {
             return $this->html . $this->displayError($this->l('You must enable cURL extension on your server if you want to use this module.'));
         } elseif (!ini_get('allow_url_fopen')) {
             return $this->html . $this->displayError($this->l('You must enable allow_url_fopen option on your server if you want to use this module.'));
         }
     }
     // If isset Post Var, post process else display form
     if (!empty($_POST) && (Tools::isSubmit('submitSave') || Tools::isSubmit('submitSave1') || Tools::isSubmit('submitSave2'))) {
         $errors = $this->_postValidation();
         if (!count($errors)) {
             $this->_postProcess();
         } else {
             foreach ($errors as $error) {
                 $this->html .= '<div class="alert error"><img src="../modules/ebay/views/img/forbbiden.gif" alt="nok" />&nbsp;' . $error . '</div>';
             }
         }
     }
     $this->html .= $this->_displayForm();
     // Set old Context Shop
     if (version_compare(_PS_VERSION_, '1.5', '>') && Shop::isFeatureActive()) {
         $this->_setContextShop($old_context_shop);
     }
     return $this->html;
 }