This commit is contained in:
Executable
+35
@@ -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';
|
||||
|
||||
Executable
+31
@@ -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';
|
||||
|
||||
Executable
+21
@@ -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';
|
||||
|
||||
Executable
+54
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user