This commit is contained in:
rGaillard
2011-07-06 10:54:11 +00:00
parent 4d2c770c6f
commit 8fc7f11014
5398 changed files with 482149 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
<?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');
$levelExists = array();
for ($i = 0; $i <= 5; $i++)
if ($_GET['level'] >= $i)
{
if ($i == 0)
$eBayCategoryListLevel = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'ebay_category` WHERE `level` = 1 AND `id_category_ref` = `id_category_ref_parent`');
else
$eBayCategoryListLevel = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'ebay_category` WHERE `level` = '.(int)($i + 1).' AND `id_category_ref_parent` IN (SELECT `id_category_ref` FROM `'._DB_PREFIX_.'ebay_category` WHERE `id_ebay_category` = '.(int)($_GET['level'.$i]).')');
if ($eBayCategoryListLevel)
{
$levelExists[$i + 1] = true;
echo '<select name="category'.(int)$_GET['id_category'].'" id="categoryLevel'.(int)($i + 1).'-'.(int)$_GET['id_category'].'" rel="'.(int)$_GET['id_category'].'" style="font-size: 12px; width: 160px;" OnChange="changeCategoryMatch('.(int)($i + 1).', '.(int)$_GET['id_category'].');">
<option value="0">'.('No category selected').'</option>';
foreach ($eBayCategoryListLevel as $ec)
echo '<option value="'.(int)$ec['id_ebay_category'].'" '.((isset($_GET['level'.($i + 1)]) && $_GET['level'.($i + 1)] == $ec['id_ebay_category']) ? 'selected="selected"' : '').'>'.$ec['name'].($ec['is_multi_sku'] == 1 ? ' *' : '').'</option>';
echo '</select> ';
}
}
if (!isset($levelExists[$_GET['level'] + 1]))
echo '<input type="hidden" name="category'.(int)$_GET['id_category'].'" value="'.(int)$_GET['level'.$_GET['level']].'" />';
}
else
echo 'ERROR';
+31
View File
@@ -0,0 +1,31 @@
<?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';
+21
View File
@@ -0,0 +1,21 @@
<?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');
Db::getInstance()->autoExecute(_DB_PREFIX_.'ebay_category_configuration', array('sync' => (int)($_GET['action'])), 'UPDATE', '`id_category` = '.(int)$_GET['id_category']);
$nbProducts = Db::getInstance()->getValue('
SELECT COUNT(`id_product`) as nb
FROM `'._DB_PREFIX_.'product`
WHERE `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_ebay_category` > 0 AND `sync` = 1)');
echo $nbProducts;
}
else
echo 'ERROR';
+54
View File
@@ -0,0 +1,54 @@
<?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');
$currentPath = Db::getInstance()->getRow('
SELECT ecc.`id_ebay_category`, ec.`id_category_ref`, ec.`id_category_ref_parent`, ec.`level`
FROM `'._DB_PREFIX_.'ebay_category_configuration` ecc
LEFT JOIN `'._DB_PREFIX_.'ebay_category` ec ON (ec.`id_ebay_category` = ecc.`id_ebay_category`)
WHERE ecc.`id_category` = '.(int)$_GET['id_category']);
$_GET['level'] = $currentPath['level'];
$_GET['level'.($currentPath['level'])] = $currentPath['id_ebay_category'];
for ($levelStart = $currentPath['level']; $levelStart > 1; $levelStart--)
{
$currentPath = Db::getInstance()->getRow('
SELECT ec.`id_ebay_category`, ec.`id_category_ref`, ec.`id_category_ref_parent`, ec.`level`
FROM `'._DB_PREFIX_.'ebay_category` ec
LEFT JOIN `'._DB_PREFIX_.'ebay_category_configuration` ecc ON (ecc.`id_ebay_category` = ec.`id_ebay_category`)
WHERE ec.`id_category_ref` = '.(int)$currentPath['id_category_ref_parent']);
$_GET['level'.($levelStart - 1)] = $currentPath['id_ebay_category'];
}
$levelExists = array();
for ($i = 0; $i <= 5; $i++)
if ($_GET['level'] >= $i)
{
if ($i == 0)
$eBayCategoryListLevel = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'ebay_category` WHERE `level` = 1 AND `id_category_ref` = `id_category_ref_parent`');
else
$eBayCategoryListLevel = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'ebay_category` WHERE `level` = '.(int)($i + 1).' AND `id_category_ref_parent` IN (SELECT `id_category_ref` FROM `'._DB_PREFIX_.'ebay_category` WHERE `id_ebay_category` = '.(int)($_GET['level'.$i]).')');
if ($eBayCategoryListLevel)
{
$levelExists[$i + 1] = true;
echo '<select name="category'.(int)$_GET['id_category'].'" id="categoryLevel'.(int)($i + 1).'-'.(int)$_GET['id_category'].'" rel="'.(int)$_GET['id_category'].'" style="font-size: 12px; width: 160px;" OnChange="changeCategoryMatch('.(int)($i + 1).', '.(int)$_GET['id_category'].');">
<option value="0">'.('No category selected').'</option>';
foreach ($eBayCategoryListLevel as $ec)
echo '<option value="'.(int)$ec['id_ebay_category'].'" '.((isset($_GET['level'.($i + 1)]) && $_GET['level'.($i + 1)] == $ec['id_ebay_category']) ? 'selected="selected"' : '').'>'.$ec['name'].($ec['is_multi_sku'] == 1 ? ' *' : '').'</option>';
echo '</select> ';
}
}
if (!isset($levelExists[$_GET['level'] + 1]))
echo '<input type="hidden" name="category'.(int)$_GET['id_category'].'" value="'.(int)$_GET['level'.$_GET['level']].'" />';
}
else
echo 'ERROR';