public function getSuggest()
        {
            if (Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN')) {
                return $this->l('You are not logged in');
            }
            // Loading categories
            $ebay = new eBayRequest();
            $categoryConfigList = array();
            $categoryConfigListTmp = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'ebay_category_configuration`');
            foreach ($categoryConfigListTmp as $c) {
                $categoryConfigList[$c['id_category']] = $c;
            }
            // Get categories
            $categoryList = Db::getInstance()->executeS('SELECT `id_category`, `name` FROM `' . _DB_PREFIX_ . 'category_lang` WHERE `id_lang` = ' . (int) Tools::getValue('id_lang') . ' ' . (_PS_VERSION_ >= '1.5' ? $this->context->shop->addSqlRestrictionOnLang() : ''));
            // GET One Product by category
            $SQL = '
					SELECT pl.`name`, pl.`description`, p.`id_category_default`
					FROM `' . _DB_PREFIX_ . 'product` p 
						LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl 
							ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = ' . (int) Tools::getValue('id_lang') . ' 
						' . (_PS_VERSION_ >= '1.5' ? $this->context->shop->addSqlRestrictionOnLang('pl') : '') . ')
					GROUP BY p.`id_category_default`
					';
            $products = Db::getInstance()->executeS($SQL);
            // Create array
            $productTest = array();
            foreach ($products as $product) {
                $productTest[$product['id_category_default']] = array('description' => $product['description'], 'name' => $product['name']);
            }
            // cats ref
            $refCats = Db::getInstance()->executeS('SELECT `id_ebay_category`, `id_category_ref` FROM `' . _DB_PREFIX_ . 'ebay_category` ');
            if (is_array($refCats) && sizeof($refCats) && $refCats) {
                foreach ($refCats as $cat) {
                    $refCategories[$cat['id_category_ref']] = $cat['id_ebay_category'];
                }
            } else {
                return;
            }
            $i = 0;
            $SQL = "REPLACE INTO `" . _DB_PREFIX_ . "ebay_category_configuration` (`id_country`, `id_ebay_category`, `id_category`, `percent`, `date_add`, `date_upd`) VALUES ";
            if (is_array($categoryList) && sizeof($categoryList) && $categoryList) {
                // while categoryList
                foreach ($categoryList as $k => $c) {
                    if (!isset($categoryConfigList[$c['id_category']])) {
                        if (isset($productTest[$c['id_category']]) && !empty($productTest[$c['id_category']])) {
                            $id_category_ref_suggested = $ebay->getSuggestedCategories($c['name'] . ' ' . $productTest[$c['id_category']]['name']);
                            $id_ebay_category_suggested = isset($refCategories[$id_category_ref_suggested]) ? $refCategories[$id_category_ref_suggested] : 1;
                            if ((int) $id_ebay_category_suggested > 0) {
                                if ($i > 0) {
                                    $SQL .= ', ';
                                }
                                $SQL .= '(8, ' . (int) $id_ebay_category_suggested . ', ' . (int) $c['id_category'] . ', 0, NOW(), NOW()) ';
                                $i++;
                            }
                        }
                    }
                }
                if ($i > 0) {
                    Db::getInstance()->execute($SQL);
                }
                return $this->l('Settings updated');
            }
        }
Beispiel #2
0
 private function getAlert()
 {
     // Test alert
     $alert = array();
     if (!Configuration::get('EBAY_API_TOKEN')) {
         $alert['registration'] = 1;
     }
     if (!ini_get('allow_url_fopen')) {
         $alert['allowurlfopen'] = 1;
     }
     if (!extension_loaded('curl')) {
         $alert['curl'] = 1;
     }
     //Search if user is a store owner
     $ebay = new eBayRequest();
     $ebay->username = Configuration::get('EBAY_API_USERNAME');
     //$this->context->cookie->eBayUsername;
     $userProfile = $ebay->getUserProfile();
     if ($userProfile[0]['SellerBusinessType'][0] != 'Commercial') {
         $alert['SellerBusinessType'] = 1;
     }
     if ($userProfile[0]['StoreName'][0] == '' && $userProfile[0]['StoreUrl'][0] == '') {
         $alert['StoreOwner'] = 1;
     }
     return $alert;
 }
Beispiel #3
0
<?php

$configPath = '../../../config/config.inc.php';
if (file_exists($configPath)) {
    include '../../../config/config.inc.php';
    if (!Tools::getValue('token') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN')) {
        die('ERROR :X');
    }
    if (file_exists(dirname(__FILE__) . '/../eBayRequest.php')) {
        include dirname(__FILE__) . '/../eBayRequest.php';
        $ebay = new eBayRequest();
        $ebay->session = Configuration::get('EBAY_API_SESSION');
        $ebay->username = Configuration::get('EBAY_API_USERNAME');
        $ebay->fetchToken();
        if (!empty($ebay->token)) {
            Configuration::updateValue('EBAY_API_TOKEN', $ebay->token);
            echo 'OK';
        } else {
            echo 'KO';
        }
    } else {
        echo 'ERROR02';
    }
} else {
    echo 'ERROR01';
}
Beispiel #4
0
 private function _syncProducts($productsList)
 {
     global $link;
     $fees = 0;
     $count = 0;
     $count_success = 0;
     $count_error = 0;
     $tab_error = array();
     $date = date('Y-m-d H:i:s');
     $ebay = new eBayRequest();
     $categoryDefaultCache = array();
     // Get errors back
     if (file_exists(dirname(__FILE__) . '/log/syncError.php')) {
         global $tab_error;
         include dirname(__FILE__) . '/log/syncError.php';
     }
     // Up the time limit
     @set_time_limit(3600);
     // Run the products list
     foreach ($productsList as $p) {
         // Product instanciation
         $product = new Product((int) $p['id_product'], true, $this->id_lang);
         if (Validate::isLoadedObject($product) && $product->id_category_default > 0) {
             // Load default category matched in cache
             if (!isset($categoryDefaultCache[$product->id_category_default])) {
                 $categoryDefaultCache[$product->id_category_default] = Db::getInstance()->getRow('SELECT ec.`id_category_ref`, ec.`is_multi_sku`, ecc.`percent` FROM `' . _DB_PREFIX_ . 'ebay_category` ec LEFT JOIN `' . _DB_PREFIX_ . 'ebay_category_configuration` ecc ON (ecc.`id_ebay_category` = ec.`id_ebay_category`) WHERE ecc.`id_category` = ' . (int) $product->id_category_default);
             }
             if ($categoryDefaultCache[$product->id_category_default]['is_multi_sku'] != 1) {
                 $categoryDefaultCache[$product->id_category_default]['is_multi_sku'] = $this->findIfCategoryParentIsMultiSku($categoryDefaultCache[$product->id_category_default]['id_category_ref']);
             }
             // Load Pictures
             $pictures = array();
             $picturesMedium = array();
             $picturesLarge = array();
             $prefix = substr(_PS_VERSION_, 0, 3) == '1.3' ? 'http://' . Configuration::get('PS_SHOP_DOMAIN') . '/' : '';
             $images = $product->getImages($this->id_lang);
             foreach ($images as $image) {
                 $pictures[] = str_replace('https://', 'http://', $prefix . $link->getImageLink('ebay', $product->id . '-' . $image['id_image'], 'large'));
                 $picturesMedium[] = str_replace('https://', 'http://', $prefix . $link->getImageLink('ebay', $product->id . '-' . $image['id_image'], 'medium'));
                 $picturesLarge[] = str_replace('https://', 'http://', $prefix . $link->getImageLink('ebay', $product->id . '-' . $image['id_image'], 'large'));
             }
             // Load Variations
             $variations = array();
             $variationsList = array();
             $combinations = $product->getAttributeCombinaisons($this->id_lang);
             if (isset($combinations)) {
                 foreach ($combinations as $c) {
                     $variationsList[$c['group_name']][$c['attribute_name']] = 1;
                     $variations[$c['id_product'] . '-' . $c['id_product_attribute']]['id_attribute'] = $c['id_product_attribute'];
                     $variations[$c['id_product'] . '-' . $c['id_product_attribute']]['reference'] = $c['reference'];
                     $variations[$c['id_product'] . '-' . $c['id_product_attribute']]['quantity'] = $c['quantity'];
                     $variations[$c['id_product'] . '-' . $c['id_product_attribute']]['variations'][] = array('name' => $c['group_name'], 'value' => $c['attribute_name']);
                     $variations[$c['id_product'] . '-' . $c['id_product_attribute']]['price_static'] = Product::getPriceStatic((int) $c['id_product'], true, (int) $c['id_product_attribute']);
                     $price = $variations[$c['id_product'] . '-' . $c['id_product_attribute']]['price_static'];
                     $price_original = $price;
                     if ($categoryDefaultCache[$product->id_category_default]['percent'] > 0) {
                         $price *= 1 + $categoryDefaultCache[$product->id_category_default]['percent'] / 100;
                     } elseif ($categoryDefaultCache[$product->id_category_default]['percent'] < 0) {
                         $price *= 1 - $categoryDefaultCache[$product->id_category_default]['percent'] / -100;
                     }
                     $variations[$c['id_product'] . '-' . $c['id_product_attribute']]['price'] = round($price, 2);
                     if ($categoryDefaultCache[$product->id_category_default]['percent'] < 0) {
                         $variations[$c['id_product'] . '-' . $c['id_product_attribute']]['price_original'] = round($price_original, 2);
                         $variations[$c['id_product'] . '-' . $c['id_product_attribute']]['price_percent'] = round($categoryDefaultCache[$product->id_category_default]['percent']);
                     }
                 }
             }
             // Load Variations Pictures
             $combinationsImages = $product->getCombinationImages(2);
             if (isset($combinationsImages) && !empty($combinationsImages) && count($combinationsImages) > 0) {
                 foreach ($combinationsImages as $ci) {
                     foreach ($ci as $i) {
                         $variations[$product->id . '-' . $i['id_product_attribute']]['pictures'][] = $prefix . $link->getImageLink('', $product->id . '-' . $i['id_image'], NULL);
                     }
                 }
             }
             // Load basic price
             $price = Product::getPriceStatic((int) $product->id, true);
             $price_original = $price;
             if ($categoryDefaultCache[$product->id_category_default]['percent'] > 0) {
                 $price *= 1 + $categoryDefaultCache[$product->id_category_default]['percent'] / 100;
             } elseif ($categoryDefaultCache[$product->id_category_default]['percent'] < 0) {
                 $price *= 1 - $categoryDefaultCache[$product->id_category_default]['percent'] / -100;
             }
             $price = round($price, 2);
             // Loading Shipping Method
             if (!isset($this->_shippingMethod[Configuration::get('EBAY_SHIPPING_CARRIER_ID')]['shippingService'])) {
                 $this->loadShippingMethod();
             }
             // Generate array and try insert in database
             $datas = array('id_product' => $product->id, 'reference' => $product->reference, 'name' => str_replace('&', '&amp;', $product->name), 'brand' => $product->manufacturer_name, 'description' => $product->description, 'description_short' => $product->description_short, 'price' => $price, 'quantity' => $product->quantity, 'categoryId' => $categoryDefaultCache[$product->id_category_default]['id_category_ref'], 'shippingService' => $this->_shippingMethod[Configuration::get('EBAY_SHIPPING_CARRIER_ID')]['shippingService'], 'shippingCost' => Configuration::get('EBAY_SHIPPING_COST'), 'variationsList' => $variationsList, 'variations' => $variations, 'pictures' => $pictures, 'picturesMedium' => $picturesMedium, 'picturesLarge' => $picturesLarge);
             // Price Update
             if (isset($p['noPriceUpdate'])) {
                 $datas['noPriceUpdate'] = $p['noPriceUpdate'];
             }
             // Save percent and price discount
             if ($categoryDefaultCache[$product->id_category_default]['percent'] < 0) {
                 $datas['price_original'] = round($price_original, 2);
                 $datas['price_percent'] = round($categoryDefaultCache[$product->id_category_default]['percent']);
             }
             // Load eBay Description
             $datas['description'] = str_replace(array('{DESCRIPTION_SHORT}', '{DESCRIPTION}', '{EBAY_IDENTIFIER}', '{EBAY_SHOP}', '{SLOGAN}', '{PRODUCT_NAME}'), array($datas['description_short'], $datas['description'], Configuration::get('EBAY_IDENTIFIER'), Configuration::get('EBAY_SHOP'), '', $product->name), Configuration::get('EBAY_PRODUCT_TEMPLATE'));
             // Export on eBay
             if (count($datas['variations']) > 0) {
                 // Variations Case
                 if ($categoryDefaultCache[$product->id_category_default]['is_multi_sku'] == 1) {
                     // Load eBay Description
                     $datas['description'] = str_replace(array('{MAIN_IMAGE}', '{MEDIUM_IMAGE_1}', '{MEDIUM_IMAGE_2}', '{MEDIUM_IMAGE_3}', '{PRODUCT_PRICE}', '{PRODUCT_PRICE_DISCOUNT}'), array(isset($datas['picturesLarge'][0]) ? '<img src="' . $datas['picturesLarge'][0] . '" class="bodyMainImageProductPrestashop" />' : '', isset($datas['picturesMedium'][1]) ? '<img src="' . $datas['picturesMedium'][1] . '" class="bodyFirstMediumImageProductPrestashop" />' : '', isset($datas['picturesMedium'][2]) ? '<img src="' . $datas['picturesMedium'][2] . '" class="bodyMediumImageProductPrestashop" />' : '', isset($datas['picturesMedium'][3]) ? '<img src="' . $datas['picturesMedium'][3] . '" class="bodyMediumImageProductPrestashop" />' : '', '', ''), $datas['description']);
                     // Multi Sku case
                     // Check if product exists on eBay
                     $itemID = Db::getInstance()->getValue('SELECT `id_product_ref` FROM `' . _DB_PREFIX_ . 'ebay_product` WHERE `id_product` = ' . (int) $product->id);
                     if ($itemID) {
                         // Update
                         $datas['itemID'] = $itemID;
                         if ($ebay->reviseFixedPriceItemMultiSku($datas)) {
                             Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_product', array('date_upd' => pSQL($date)), 'UPDATE', '`id_product_ref` = ' . (int) $itemID);
                         }
                         // if product not on eBay we add it
                         if ($ebay->errorCode == 291) {
                             // We delete from DB and Add it on eBay
                             Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'ebay_product` WHERE `id_product_ref` = \'' . pSQL($datas['itemID']) . '\'');
                             $ebay->addFixedPriceItemMultiSku($datas);
                             if ($ebay->itemID > 0) {
                                 Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_product', array('id_country' => 8, 'id_product' => (int) $product->id, 'id_attribute' => 0, 'id_product_ref' => pSQL($ebay->itemID), 'date_add' => pSQL($date), 'date_upd' => pSQL($date)), 'INSERT');
                             }
                         }
                     } else {
                         // Add
                         $ebay->addFixedPriceItemMultiSku($datas);
                         if ($ebay->itemID > 0) {
                             Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_product', array('id_country' => 8, 'id_product' => (int) $product->id, 'id_attribute' => 0, 'id_product_ref' => pSQL($ebay->itemID), 'date_add' => pSQL($date), 'date_upd' => pSQL($date)), 'INSERT');
                         }
                     }
                 } else {
                     // No Multi Sku case
                     foreach ($datas['variations'] as $v) {
                         $datasTmp = $datas;
                         if (isset($v['pictures']) && count($v['pictures']) > 0) {
                             $datasTmp['pictures'] = $v['pictures'];
                         }
                         if (isset($v['picturesMedium']) && count($v['picturesMedium']) > 0) {
                             $datasTmp['picturesMedium'] = $v['picturesMedium'];
                         }
                         if (isset($v['picturesLarge']) && count($v['picturesLarge']) > 0) {
                             $datasTmp['picturesLarge'] = $v['picturesLarge'];
                         }
                         foreach ($v['variations'] as $vLabel) {
                             $datasTmp['name'] .= ' ' . $vLabel['value'];
                             $datasTmp['attributes'][$vLabel['name']] = $vLabel['value'];
                         }
                         $datasTmp['price'] = $v['price'];
                         if (isset($v['price_original'])) {
                             $datasTmp['price_original'] = $v['price_original'];
                             $datasTmp['price_percent'] = $v['price_percent'];
                         }
                         $datasTmp['quantity'] = $v['quantity'];
                         $datasTmp['id_attribute'] = $v['id_attribute'];
                         unset($datasTmp['variations']);
                         unset($datasTmp['variationsList']);
                         // Load eBay Description
                         $datasTmp['description'] = str_replace(array('{MAIN_IMAGE}', '{MEDIUM_IMAGE_1}', '{MEDIUM_IMAGE_2}', '{MEDIUM_IMAGE_3}', '{PRODUCT_PRICE}', '{PRODUCT_PRICE_DISCOUNT}'), array(isset($datasTmp['picturesLarge'][0]) ? '<img src="' . $datasTmp['picturesLarge'][0] . '" class="bodyMainImageProductPrestashop" />' : '', isset($datasTmp['picturesMedium'][1]) ? '<img src="' . $datasTmp['picturesMedium'][1] . '" class="bodyFirstMediumImageProductPrestashop" />' : '', isset($datasTmp['picturesMedium'][2]) ? '<img src="' . $datasTmp['picturesMedium'][2] . '" class="bodyMediumImageProductPrestashop" />' : '', isset($datasTmp['picturesMedium'][3]) ? '<img src="' . $datasTmp['picturesMedium'][3] . '" class="bodyMediumImageProductPrestashop" />' : '', Tools::displayPrice($datasTmp['price']), isset($datasTmp['price_original']) ? 'au lieu de <del>' . Tools::displayPrice($datasTmp['price_original']) . '</del> (remise de ' . round($datasTmp['price_percent']) . '%)' : ''), $datas['description']);
                         $datasTmp['id_product'] = (int) $product->id . '-' . (int) $datasTmp['id_attribute'];
                         // Check if product exists on eBay
                         $itemID = Db::getInstance()->getValue('SELECT `id_product_ref` FROM `' . _DB_PREFIX_ . 'ebay_product` WHERE `id_product` = ' . (int) $product->id . ' AND `id_attribute` = ' . (int) $datasTmp['id_attribute']);
                         if ($itemID) {
                             // Get Item ID
                             $datasTmp['itemID'] = $itemID;
                             // Delete or Update
                             if ($datasTmp['quantity'] < 1) {
                                 // Delete
                                 if ($ebay->endFixedPriceItem($datasTmp)) {
                                     Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'ebay_product` WHERE `id_product_ref` = \'' . pSQL($datasTmp['itemID']) . '\'');
                                 }
                             } else {
                                 // Update
                                 if ($ebay->reviseFixedPriceItem($datasTmp)) {
                                     Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_product', array('date_upd' => pSQL($date)), 'UPDATE', '`id_product_ref` = ' . (int) $itemID);
                                 }
                                 // if product not on eBay we add it
                                 if ($ebay->errorCode == 291) {
                                     // We delete from DB and Add it on eBay
                                     Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'ebay_product` WHERE `id_product_ref` = \'' . pSQL($datasTmp['itemID']) . '\'');
                                     $ebay->addFixedPriceItem($datasTmp);
                                     if ($ebay->itemID > 0) {
                                         Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_product', array('id_country' => 8, 'id_product' => (int) $product->id, 'id_attribute' => (int) $datasTmp['id_attribute'], 'id_product_ref' => pSQL($ebay->itemID), 'date_add' => pSQL($date), 'date_upd' => pSQL($date)), 'INSERT');
                                     }
                                 }
                             }
                         } else {
                             // Add
                             $ebay->addFixedPriceItem($datasTmp);
                             if ($ebay->itemID > 0) {
                                 Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_product', array('id_country' => 8, 'id_product' => (int) $product->id, 'id_attribute' => (int) $datasTmp['id_attribute'], 'id_product_ref' => pSQL($ebay->itemID), 'date_add' => pSQL($date), 'date_upd' => pSQL($date)), 'INSERT');
                             }
                         }
                     }
                 }
             } else {
                 // No variations case
                 // Load eBay Description
                 $datas['description'] = str_replace(array('{MAIN_IMAGE}', '{MEDIUM_IMAGE_1}', '{MEDIUM_IMAGE_2}', '{MEDIUM_IMAGE_3}', '{PRODUCT_PRICE}', '{PRODUCT_PRICE_DISCOUNT}'), array(isset($datas['picturesLarge'][0]) ? '<img src="' . $datas['picturesLarge'][0] . '" class="bodyMainImageProductPrestashop" />' : '', isset($datas['picturesMedium'][1]) ? '<img src="' . $datas['picturesMedium'][1] . '" class="bodyFirstMediumImageProductPrestashop" />' : '', isset($datas['picturesMedium'][2]) ? '<img src="' . $datas['picturesMedium'][2] . '" class="bodyMediumImageProductPrestashop" />' : '', isset($datas['picturesMedium'][3]) ? '<img src="' . $datas['picturesMedium'][3] . '" class="bodyMediumImageProductPrestashop" />' : '', Tools::displayPrice($datas['price']), isset($datas['price_original']) ? 'au lieu de <del>' . Tools::displayPrice($datas['price_original']) . '</del> (remise de ' . round($datas['price_percent']) . '%)' : ''), $datas['description']);
                 // Check if product exists on eBay
                 $itemID = Db::getInstance()->getValue('SELECT `id_product_ref` FROM `' . _DB_PREFIX_ . 'ebay_product` WHERE `id_product` = ' . (int) $product->id);
                 if ($itemID) {
                     // Get Item ID
                     $datas['itemID'] = $itemID;
                     // Delete or Update
                     if ($datas['quantity'] < 1) {
                         // Delete
                         if ($ebay->endFixedPriceItem($datas)) {
                             Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'ebay_product` WHERE `id_product_ref` = \'' . pSQL($datas['itemID']) . '\'');
                         }
                     } else {
                         // Update
                         if ($ebay->reviseFixedPriceItem($datas)) {
                             Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_product', array('date_upd' => pSQL($date)), 'UPDATE', '`id_product_ref` = ' . (int) $itemID);
                         }
                         // if product not on eBay we add it
                         if ($ebay->errorCode == 291) {
                             // We delete from DB and Add it on eBay
                             Db::getInstance()->Execute('DELETE FROM `' . _DB_PREFIX_ . 'ebay_product` WHERE `id_product_ref` = \'' . pSQL($datas['itemID']) . '\'');
                             $ebay->addFixedPriceItem($datas);
                             if ($ebay->itemID > 0) {
                                 Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_product', array('id_country' => 8, 'id_product' => (int) $product->id, 'id_attribute' => 0, 'id_product_ref' => pSQL($ebay->itemID), 'date_add' => pSQL($date), 'date_upd' => pSQL($date)), 'INSERT');
                             }
                         }
                     }
                 } else {
                     // Add
                     $ebay->addFixedPriceItem($datas);
                     if ($ebay->itemID > 0) {
                         Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_product', array('id_country' => 8, 'id_product' => (int) $product->id, 'id_attribute' => 0, 'id_product_ref' => pSQL($ebay->itemID), 'date_add' => pSQL($date), 'date_upd' => pSQL($date)), 'INSERT');
                     }
                 }
             }
             // Check error
             if (!empty($ebay->error)) {
                 $tab_error[md5($ebay->error)]['msg'] = $ebay->error;
                 if (!isset($tab_error[md5($ebay->error)]['products'])) {
                     $tab_error[md5($ebay->error)]['products'] = array();
                 }
                 if (count($tab_error[md5($ebay->error)]['products']) < 10) {
                     $tab_error[md5($ebay->error)]['products'][] = $datas['name'];
                 }
                 if (count($tab_error[md5($ebay->error)]['products']) == 10) {
                     $tab_error[md5($ebay->error)]['products'][] = '...';
                 }
                 $count_error++;
             } else {
                 $count_success++;
             }
             $count++;
         }
     }
     if ($count_error > 0) {
         file_put_contents(dirname(__FILE__) . '/log/syncError.php', '<?php $tab_error = ' . var_export($tab_error, true) . '; ?>');
     }
 }