function getContent() { $configKeys = array('EBAY_SECURITY_TOKEN', 'PS_LANG_DEFAULT'); // Load prestashop ebay's configuration $configs = Configuration::getMultiple($configKeys); $profile_configs = $this->ebay_profile->getMultiple(array('EBAY_DELIVERY_TIME', 'EBAY_ZONE_NATIONAL', 'EBAY_ZONE_INTERNATIONAL')); // Check if the module is configured if (!$this->ebay_profile->getConfiguration('EBAY_PAYPAL_EMAIL')) { $template_vars = array('error_form_shipping' => 'true'); return $this->display('error_paypal_email.tpl', $template_vars); } $nb_shipping_zones_excluded = DB::getInstance()->getValue('SELECT COUNT(*) FROM ' . _DB_PREFIX_ . 'ebay_shipping_zone_excluded WHERE `id_ebay_profile` = ' . (int) $this->ebay_profile->id); if (!$nb_shipping_zones_excluded) { EbayShippingZoneExcluded::loadEbayExcludedLocations($this->ebay_profile->id); } $module_filters = version_compare(_PS_VERSION_, '1.4.5', '>=') ? Carrier::CARRIERS_MODULE : 2; //INITIALIZE CACHE $psCarrierModule = $this->ebay_profile->getCarriers($configs['PS_LANG_DEFAULT'], false, false, false, null, $module_filters); $url_vars = array('id_tab' => '3', 'section' => 'shipping'); if (version_compare(_PS_VERSION_, '1.5', '>')) { $url_vars['controller'] = Tools::getValue('controller'); } else { $url_vars['tab'] = Tools::getValue('tab'); } $zones = Zone::getZones(true); foreach ($zones as &$zone) { $zone['carriers'] = Carrier::getCarriers($this->context->language->id, false, false, $zone['id_zone']); } $template_vars = array('eBayCarrier' => EbayShippingService::getCarriers($this->ebay_profile->ebay_site_id), 'psCarrier' => $this->ebay_profile->getCarriers($configs['PS_LANG_DEFAULT']), 'psCarrierModule' => $psCarrierModule, 'existingNationalCarrier' => EbayShipping::getNationalShippings($this->ebay_profile->id), 'existingInternationalCarrier' => EbayShippingInternationalZone::getExistingInternationalCarrier($this->ebay_profile->id), 'deliveryTime' => $profile_configs['EBAY_DELIVERY_TIME'], 'prestashopZone' => Zone::getZones(), 'excludeShippingLocation' => EbayShippingZoneExcluded::cacheEbayExcludedLocation($this->ebay_profile->id), 'internationalShippingLocations' => EbayShippingLocation::getInternationalShippingLocations(), 'deliveryTimeOptions' => EbayDeliveryTimeOptions::getDeliveryTimeOptions(), 'formUrl' => $this->_getUrl($url_vars), 'ebayZoneNational' => isset($profile_configs['EBAY_ZONE_NATIONAL']) ? $profile_configs['EBAY_ZONE_NATIONAL'] : false, 'ebayZoneInternational' => isset($profile_configs['EBAY_ZONE_INTERNATIONAL']) ? $profile_configs['EBAY_ZONE_INTERNATIONAL'] : false, 'ebay_token' => $configs['EBAY_SECURITY_TOKEN'], 'id_ebay_profile' => $this->ebay_profile->id, 'newPrestashopZone' => $zones); return $this->display('shipping.tpl', $template_vars); }
public static function getDeliveryTimeOptions() { if (EbayDeliveryTimeOptions::getTotal()) { return EbayDeliveryTimeOptions::getAll(); } $ebay = new EbayRequest(); $delivery_time_options = $ebay->getDeliveryTimeOptions(); foreach ($delivery_time_options as $delivery_time_option) { EbayDeliveryTimeOptions::insert(array_map('pSQL', $delivery_time_option)); } return $delivery_time_options; }