Ejemplo n.º 1
0
 /**
  * Form Config Methods
  *
  **/
 private function _displayFormConfig()
 {
     $form_parameters_tab = new EbayFormParametersTab($this, $this->smarty, $this->context);
     $form_advanced_parameters_tab = new EbayFormAdvancedParametersTab($this, $this->smarty, $this->context);
     $form_category_tab = new EbayFormCategoryTab($this, $this->smarty, $this->context, $this->_path);
     $form_items_specifics_tab = new EbayFormItemsSpecificsTab($this, $this->smarty, $this->context, $this->_path);
     $form_shipping_tab = new EbayFormShippingTab($this, $this->smarty, $this->context);
     $form_template_manager_tab = new EbayFormTemplateManagerTab($this, $this->smarty, $this->context);
     $form_ebay_sync_tab = new EbayFormEbaySyncTab($this, $this->smarty, $this->context);
     $form_ebay_order_history_tab = new EbayOrderHistoryTab($this, $this->smarty, $this->context);
     $help_tab = new EbayHelpTab($this, $this->smarty, $this->context);
     $listings_tab = new EbayListingsTab($this, $this->smarty, $this->context);
     $orders_sync = new EbayOrdersSyncTab($this, $this->smarty, $this->context);
     $ps_products = new EbayPrestashopProductsTab($this, $this->smarty, $this->context);
     $orphan_listings = new EbayOrphanListingsTab($this, $this->smarty, $this->context);
     $form_store_category_tab = new EbayFormStoreCategoryTab($this, $this->smarty, $this->context, $this->_path);
     $api_logs = new EbayApiLogsTab($this, $this->smarty, $this->context, $this->_path);
     $order_logs = new EbayOrderLogsTab($this, $this->smarty, $this->context, $this->_path);
     // test if everything is green
     if ($this->ebay_profile && $this->ebay_profile->isAllSettingsConfigured()) {
         if (!$this->ebay_profile->getConfiguration('EBAY_HAS_SYNCED_PRODUCTS')) {
             $green_message = $this->l('Your profile is ready to go, go to Synchronization to list your products');
         } elseif (!empty($_POST) && Tools::isSubmit('submitSave')) {
             // config has changed
             $green_message = $this->l('To implement these changes on active listings you need to resynchronize your items');
         }
     }
     $cron_task = array();
     if ((int) Configuration::get('EBAY_SYNC_PRODUCTS_BY_CRON') == 1) {
         $cron_task['products']['is_active'] = 1;
         if ($last_sync_datetime = Configuration::get('DATE_LAST_SYNC_PRODUCTS')) {
             $warning_date = strtotime(date('Y-m-d') . ' - 2 days');
             $cron_task['products']['last_sync'] = array('date' => date('Y-m-d', strtotime($last_sync_datetime)), 'time' => date('H:i:s', strtotime($last_sync_datetime)), 'warning_long_since' => (bool) (strtotime($last_sync_datetime) < $warning_date));
             $cron_task['products']['last_sync']['nb_products'] = Configuration::get('NB_PRODUCTS_LAST');
         } else {
             $cron_task['products']['last_sync'] = 'none';
         }
     }
     if ((int) Configuration::get('EBAY_SYNC_ORDERS_BY_CRON') == 1) {
         $cron_task['orders']['is_active'] = 1;
         if ($this->ebay_profile->getConfiguration('EBAY_ORDER_LAST_UPDATE') != null) {
             $datetime = new DateTime($this->ebay_profile->getConfiguration('EBAY_ORDER_LAST_UPDATE'));
             $cron_task['orders']['last_sync'] = array('date' => date('Y-m-d', strtotime($datetime->format('Y-m-d H:i:s'))), 'time' => date('H:i:s', strtotime($datetime->format('Y-m-d H:i:s'))));
             $datetime2 = new DateTime();
             $interval = $datetime->diff($datetime2);
             $cron_task['orders']['alert'] = $interval->format('%a') >= 1 ? 'danger' : 'info';
         } else {
             $cron_task['orders']['last_sync'] = 'none';
         }
     }
     $smarty_vars = array('class_general' => version_compare(_PS_VERSION_, '1.5', '>') ? 'uncinq' : 'unquatre', 'form_parameters' => $form_parameters_tab->getContent(), 'form_advanced_parameters' => $form_advanced_parameters_tab->getContent(), 'form_category' => $form_category_tab->getContent(), 'form_items_specifics' => $form_items_specifics_tab->getContent(), 'form_shipping' => $form_shipping_tab->getContent(), 'form_template_manager' => $form_template_manager_tab->getContent(), 'form_ebay_sync' => $form_ebay_sync_tab->getContent(), 'orders_history' => $form_ebay_order_history_tab->getContent(), 'ebay_listings' => $listings_tab->getContent(), 'form_store_category' => $form_store_category_tab->getContent(), 'orders_sync' => $orders_sync->getContent(), 'ps_products' => $ps_products->getContent(), 'orphan_listings' => $orphan_listings->getContent(), 'green_message' => isset($green_message) ? $green_message : null, 'cron_task' => $cron_task, 'api_logs' => $api_logs->getContent(), 'order_logs' => $order_logs->getContent(), 'id_tab' => Tools::getValue('id_tab'));
     $this->smarty->assign($smarty_vars);
     return $this->display(__FILE__, 'views/templates/hook/formConfig.tpl');
 }
Ejemplo n.º 2
0
 /**
  * Form Config Methods
  *
  **/
 private function _displayFormConfig()
 {
     $form_parameters_tab = new EbayFormParametersTab($this, $this->smarty, $this->context);
     $form_advanced_parameters_tab = new EbayFormAdvancedParametersTab($this, $this->smarty, $this->context);
     $form_category_tab = new EbayFormCategoryTab($this, $this->smarty, $this->context, $this->_path);
     $form_items_specifics_tab = new EbayFormItemsSpecificsTab($this, $this->smarty, $this->context, $this->_path);
     $form_shipping_tab = new EbayFormShippingTab($this, $this->smarty, $this->context);
     $form_template_manager_tab = new EbayFormTemplateManagerTab($this, $this->smarty, $this->context);
     $form_ebay_sync_tab = new EbayFormEbaySyncTab($this, $this->smarty, $this->context);
     $form_ebay_order_history_tab = new EbayOrderHistoryTab($this, $this->smarty, $this->context);
     $help_tab = new EbayHelpTab($this, $this->smarty, $this->context);
     $listings_tab = new EbayListingsTab($this, $this->smarty, $this->context);
     $orders_sync = new EbayOrdersSyncTab($this, $this->smarty, $this->context);
     $form_store_category_tab = new EbayFormStoreCategoryTab($this, $this->smarty, $this->context, $this->_path);
     $api_logs = new EbayApiLogsTab($this, $this->smarty, $this->context, $this->_path);
     $order_logs = new EbayOrderLogsTab($this, $this->smarty, $this->context, $this->_path);
     // test if everything is green
     if ($this->ebay_profile && $this->ebay_profile->isAllSettingsConfigured()) {
         if (!$this->ebay_profile->getConfiguration('EBAY_HAS_SYNCED_PRODUCTS')) {
             $green_message = $this->l('Your profile is ready to go, go to Synchronization to list your products');
         } elseif (!empty($_POST) && Tools::isSubmit('submitSave')) {
             // config has changed
             $green_message = $this->l('To implement these changes on active listings you need to resynchronize your items');
         }
     }
     $smarty_vars = array('class_general' => version_compare(_PS_VERSION_, '1.5', '>') ? 'uncinq' : 'unquatre', 'form_parameters' => $form_parameters_tab->getContent(), 'form_advanced_parameters' => $form_advanced_parameters_tab->getContent(), 'form_category' => $form_category_tab->getContent(), 'form_items_specifics' => $form_items_specifics_tab->getContent(), 'form_shipping' => $form_shipping_tab->getContent(), 'form_template_manager' => $form_template_manager_tab->getContent(), 'form_ebay_sync' => $form_ebay_sync_tab->getContent(), 'orders_history' => $form_ebay_order_history_tab->getContent(), 'ebay_listings' => $listings_tab->getContent(), 'form_store_category' => $form_store_category_tab->getContent(), 'orders_sync' => $orders_sync->getContent(), 'green_message' => isset($green_message) ? $green_message : null, 'api_logs' => $api_logs->getContent(), 'order_logs' => $order_logs->getContent(), 'id_tab' => Tools::getValue('id_tab'));
     $this->smarty->assign($smarty_vars);
     return $this->display(__FILE__, 'views/templates/hook/formConfig.tpl');
 }