protected function getDatas($offset, $nb_results)
 {
     $logs = EbayOrderLog::get($offset, $nb_results);
     foreach ($logs as &$log) {
         $log['data'] = nl2br(TotFormat::prettyPrint($log['data']));
     }
     return $logs;
 }
 function postProcess()
 {
     $ebay_product_template = Tools::getValue('ebay_product_template');
     $ebay_product_template_title = Tools::getValue('ebay_product_template_title');
     if (empty($ebay_product_template_title)) {
         $ebay_product_template_title = '{TITLE}';
     }
     // work around for the tinyMCE bug deleting the css line
     $css_line = '<link rel="stylesheet" type="text/css" href="' . $this->_getModuleUrl() . 'views/css/ebay.css" />';
     $ebay_product_template = $css_line . TotFormat::formatDescription($ebay_product_template);
     // Saving new configurations
     if ($this->ebay_profile->setConfiguration('EBAY_PRODUCT_TEMPLATE', $ebay_product_template, true) && $this->ebay_profile->setConfiguration('EBAY_PRODUCT_TEMPLATE_TITLE', $ebay_product_template_title)) {
         return $this->ebay->displayConfirmation($this->ebay->l('Settings updated'));
     } else {
         return $this->ebay->displayError($this->ebay->l('Settings failed'));
     }
 }
Beispiel #3
0
    public function updateOrAddAddress($ebay_profile)
    {
        // Search if address exists
        $id_address = (int) Db::getInstance()->getValue('SELECT `id_address`
			FROM `' . _DB_PREFIX_ . 'address`
			WHERE `id_customer` = ' . (int) $this->id_customers[$ebay_profile->id_shop] . '
			AND `alias` = \'eBay\'');
        if ($id_address) {
            $address = new Address((int) $id_address);
        } else {
            $address = new Address();
            $address->id_customer = (int) $this->id_customers[$ebay_profile->id_shop];
        }
        $format = new TotFormat();
        $address->id_country = (int) Country::getByIso($this->country_iso_code);
        $address->alias = 'eBay';
        $address->lastname = $format->formatName(EbayOrder::_formatFamilyName($this->familyname));
        $address->firstname = $format->formatName($this->firstname);
        $address->address1 = $format->formatAddress($this->address1);
        $address->address2 = $format->formatAddress($this->address2);
        $address->postcode = $format->formatPostCode(str_replace('.', '', $this->postalcode));
        $address->city = $format->formatCityName($this->city);
        $address->phone = $format->formatPhoneNumber($this->phone);
        $address->active = 1;
        if ($id_address > 0 && Validate::isLoadedObject($address)) {
            $res = $address->update();
            $is_update = true;
        } else {
            $res = $address->add();
            $id_address = $address->id;
            $is_update = false;
        }
        $this->_writeLog($ebay_profile->id, 'add_address', $res, null, $is_update);
        $this->id_address = $id_address;
        return $id_address;
    }