// Remove old code and calls to AdminCatalog

This commit is contained in:
tDidierjean
2012-01-10 17:16:54 +00:00
parent 9d4dac5363
commit 2560f50da8
9 changed files with 14 additions and 406 deletions
-108
View File
@@ -71,122 +71,14 @@ function displayJavascriptAlert($s)
echo '<script type="text/javascript">alert(\''.addslashes($s).'\');</script>';
}
if (Tools::isSubmit('ajaxProductManufacturers'))
{
AdminTab::$currentIndex = 'index.php?tab=AdminCatalog';
$manufacturers = Manufacturer::getManufacturers();
$jsonArray = array();
if ($manufacturers)
foreach ($manufacturers AS $manufacturer)
$jsonArray[] = '{"optionValue": "'.$manufacturer['id_manufacturer'].'", "optionDisplay": "'.htmlspecialchars(trim($manufacturer['name'])).'"}';
die('['.implode(',', $jsonArray).']');
}
if (Tools::isSubmit('ajaxReferrers'))
{
require(_PS_CONTROLLER_DIR_.'admin/AdminReferrersController.php');
}
if (Tools::isSubmit('ajaxProductSuppliers'))
{
AdminTab::$currentIndex = 'index.php?tab=AdminCatalog';
$suppliers = Supplier::getSuppliers();
if ($suppliers)
{
$jsonArray = array();
foreach ($suppliers AS $supplier)
$jsonArray[] = '{"optionValue": "'.$supplier['id_supplier'].'", "optionDisplay": "'.htmlspecialchars(trim($supplier['name'])).'"}';
die('['.implode(',', $jsonArray).']');
}
}
if (Tools::isSubmit('ajaxProductAccessories'))
{
AdminTab::$currentIndex = 'index.php?tab=AdminCatalog';
$jsonArray = array();
$products = Db::getInstance()->executeS('
SELECT p.`id_product`, pl.`name`
FROM `'._DB_PREFIX_.'product` p
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
'.Context::getContext()->shop->addSqlRestrictionOnLang('pl').'
AND p.`id_product` != '.(int)(Tools::getValue('id_product')).'
AND p.`id_product` NOT IN (
SELECT a.`id_product_2`
FROM `'._DB_PREFIX_.'accessory` a
WHERE a.`id_product_1` = '.(int)(Tools::getValue('id_product')).')
ORDER BY pl.`name`');
foreach ($products AS $accessory)
$jsonArray[] = '{"value: "'.(int)($accessory['id_product']).'-'.addslashes($accessory['name']).'", "text":"'.(int)($accessory['id_product']).' - '.addslashes($accessory['name']).'"}';
die('['.implode(',', $jsonArray).']');
}
if (Tools::isSubmit('ajaxDiscountCustomers'))
{
AdminTab::$currentIndex = 'index.php?tab=AdminDiscounts';
$jsonArray = array();
$filter = Tools::getValue('filter');
if (Validate::isBool_Id($filter))
$filterArray = explode('_', $filter);
$customers = Db::getInstance()->executeS('
SELECT `id_customer`, `email`, CONCAT(`lastname`, \' \', `firstname`) as name
FROM `'._DB_PREFIX_.'customer`
WHERE `deleted` = 0 AND is_guest = 0
AND '.(Validate::isUnsignedInt($filter) ? '`id_customer` = '.(int)($filter) : '(`email` LIKE "%'.pSQL($filter).'%"
'.((Validate::isBool_Id($filter) AND $filterArray[0] == 0) ? 'OR `id_customer` = '.(int)($filterArray[1]) : '').'
'.(Validate::isUnsignedInt($filter) ? '`id_customer` = '.(int)($filter) : '').'
OR CONCAT(`firstname`, \' \', `lastname`) LIKE "%'.pSQL($filter).'%"
OR CONCAT(`lastname`, \' \', `firstname`) LIKE "%'.pSQL($filter).'%")').'
ORDER BY CONCAT(`lastname`, \' \', `firstname`) ASC
LIMIT 50');
$groups = Db::getInstance()->executeS('
SELECT g.`id_group`, gl.`name`
FROM `'._DB_PREFIX_.'group` g
LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)($context->language->id).')
WHERE '.(Validate::isUnsignedInt($filter) ? 'g.`id_group` = '.(int)($filter) : 'gl.`name` LIKE "%'.pSQL($filter).'%"
'.((Validate::isBool_Id($filter) AND $filterArray[0] == 1) ? 'OR g.`id_group` = '.(int)($filterArray[1]) : '')).'
ORDER BY gl.`name` ASC
LIMIT 50');
$json = '{"customers" : ';
foreach ($customers AS $customer)
$jsonArray[] = '{"value":"0_'.(int)($customer['id_customer']).'", "text":"'.addslashes($customer['name']).' ('.addslashes($customer['email']).')"}';
$json .= '['.implode(',', $jsonArray).'],
"groups" : ';
$jsonArray = array();
foreach ($groups AS $group)
$jsonArray[] = '{"value":"1_'.(int)($group['id_group']).'", "text":"'.addslashes($group['name']).'"}';
$json .= '['.implode(',', $jsonArray).']}';
die($json);
}
if (Tools::getValue('page') == 'prestastore' AND @fsockopen('addons.prestashop.com', 80, $errno, $errst, 3))
readfile('http://addons.prestashop.com/adminmodules.php?lang='.$context->language->iso_code);
if ($step = (int)(Tools::getValue('ajaxProductTab')))
{
require_once(dirname(__FILE__).'/tabs/AdminCatalog.php');
$catalog = new AdminCatalog();
$admin = new AdminProducts();
$languages = Language::getLanguages(false);
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
$product = new Product((int)(Tools::getValue('id_product')));
if (!Validate::isLoadedObject($product))
die (Tools::displayError('Product cannot be loaded'));
$switchArray = array(3 => 'displayFormPrices', 4 => 'displayFormAttributes', 5 => 'displayFormFeatures', 6 => 'displayFormCustomization', 7 => 'displayFormAttachments');
AdminTab::$currentIndex = 'index.php?tab=AdminCatalog';
if (key_exists($step, $switchArray))
$admin->{$switchArray[$step]}($product, $languages, $defaultLanguage);
}
if (Tools::isSubmit('getAvailableFields') AND Tools::isSubmit('entity'))
{
$jsonArray = array();
-83
View File
@@ -1,83 +0,0 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 6844 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
define('_PS_ADMIN_DIR_', getcwd());
include_once('../config/config.inc.php');
include_once('tabs/AdminCatalog.php');
include_once('tabs/AdminProducts.php');
include_once('init.php');
if (Tools::getValue('token') != Tools::getAdminTokenLite('AdminCatalog'))
die(1);
$catalog = new AdminCatalog();
$adminProducts = new AdminProducts();
echo ' <tr>
<td class="col-left"><label for="id_category_default" class="t">'.$adminProducts->getL('Default category:').'</label></td>
<td>
<select id="id_category_default" name="id_category_default" onchange="checkDefaultCategory(this.value);">';
$categories = Category::getCategories(Context::getContext()->language->id, false);
Category::recurseCategory($categories, $categories[0][1], 1, (int)(Tools::getValue('id_category_default')));
echo ' </select>
</td>
</tr>
<tr>
<td class="col-left">'.$adminProducts->getL('Catalog:').'</td>
<td>
<div style="overflow: auto; min-height: 300px; padding-top: 0.6em;" id="categoryList">
<script type="text/javascript">
$(document).ready(function() {
$(\'div#categoryList input.categoryBox\').click(function (){
if ($(this).is(\':not(:checked)\') && $(\'div#categoryList input.id_category_default\').val() == $(this).val())
jAlert(\''.utf8_encode(html_entity_decode($adminProducts->getL('Consider changing the default category.'))).'\');
});
});
</script>
<table cellspacing="0" cellpadding="0" class="table">
<tr>
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'categoryBox[]\', this.checked)" /></th>
<th>'.$adminProducts->getL('ID').'</th>
<th style="width: 600px">'.$adminProducts->getL('Name').'</th>
</tr>';
$done = array();
$index = array();
$categoryBox = Tools::getValue('categoryBox');
if ($categoryBox != '')
{
$categoryBox = @unserialize($categoryBox);
foreach ($categoryBox AS $k => $row)
$index[] = $row;
}
elseif ((int)Tools::getValue('id_product'))
$index = Product::getProductCategories((int)Tools::getValue('id_product'));
$adminProducts->recurseCategoryForInclude((int)(Tools::getValue('id_product')), $index, $categories, $categories[0][1], 1, (int)(Tools::getValue('id_category_default')));
echo ' </table>
<p style="padding:0px; margin:0px 0px 10px 0px;">'.$adminProducts->getL('Mark all checkbox(es) of categories in which product is to appear').'<sup> *</sup></p>
</div>
</tr>';