/web/1/000/076/129/313906/htdocs/styroporzuschnitte24_shop/admin/categories.php (18.53 KB)
<?php
/* --------------------------------------------------------------
categories.php 2011-12-19 gm
Gambio GmbH
http://www.gambio.de
Copyright (c) 2011 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(categories.php,v 1.140 2003/03/24); www.oscommerce.com
(c) 2003 nextcommerce (categories.php,v 1.37 2003/08/18); www.nextcommerce.org
(c) 2003 XT-Commerce - community made shopping http://www.xt-commerce.com ($Id: categories.php 1249 2005-09-27 12:06:40Z gwinger $)
Released under the GNU General Public License
--------------------------------------------------------------
Third Party contribution:
Enable_Disable_Categories 1.3 Autor: Mikel Williams | mikel@ladykatcostumes.com
New Attribute Manager v4b Autor: Mike G | mp3man@internetwork.net | http://downloads.ephing.com
Category Descriptions (Version: 1.5 MS2) Original Author: Brian Lowe <blowe@wpcusrgrp.org> | Editor: Lord Illicious <shaolin-venoms@illicious.net>
Customers Status v3.x (c) 2002-2003 Copyright Elari elari@free.fr | www.unlockgsm.com/dload-osc/ | CVS : http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/elari/?sortby=date#dirlist
Released under the GNU General Public License
--------------------------------------------------------------*/
require_once ('includes/application_top.php');
require_once ('includes/classes/'.FILENAME_IMAGEMANIPULATOR);
/* magnalister v1.0.1 */
if (function_exists('magnaExecute')) magnaExecute('magnaInventoryUpdate', array('action' => 'inventoryUpdate'), array('inventoryUpdate.php'));
/* END magnalister */
// BOF GM_MOD
include_once(DIR_FS_ADMIN . 'gm/classes/GMProductUpload.php');
include_once(DIR_FS_ADMIN . 'gm/classes/GMUpload.php');
include_once(DIR_FS_ADMIN . 'gm/classes/GMAltText.php');
require_once(DIR_FS_ADMIN . 'gm/fckeditor/fckeditor.php');
// EOF GM_MOD
require_once ('includes/classes/categories.php');
require_once (DIR_FS_INC.'xtc_get_tax_rate.inc.php');
require_once (DIR_FS_INC.'xtc_get_products_mo_images.inc.php');
require_once (DIR_WS_CLASSES.'currencies.php');
// BOF GM_MOD statusbar
$gmStatusbar = MainFactory::create_object('GMStatusbar');
// EOF GM_MOD statusbar
$currencies = new currencies();
$catfunc = new categories();
//this is used only by group_prices
if ($_GET['function']) {
switch ($_GET['function']) {
case 'delete' :
// BOF GM_MOD:
xtc_db_query("DELETE FROM personal_offers_by_customers_status_".(int) $_GET['statusID']."
WHERE products_id = '".(int) $_GET['pID']."'
AND quantity = '".(double) $_GET['quantity']."'");
break;
}
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath='.$_GET['cPath'].'&action=new_product&pID='.(int) $_GET['pID']));
}
// Multi-Status Change, separated from $_GET['action']
// --- MULTI STATUS ---
if (isset ($_POST['multi_status_on'])) {
//set multi_categories status=on
if (is_array($_POST['multi_categories'])) {
foreach ($_POST['multi_categories'] AS $category_id) {
$catfunc->set_category_recursive($category_id, '1');
}
}
//set multi_products status=on
if (is_array($_POST['multi_products'])) {
foreach ($_POST['multi_products'] AS $product_id) {
$catfunc->set_product_status($product_id, '1');
}
}
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath='.$_GET['cPath'].'&'.xtc_get_all_get_params(array ('cPath', 'action', 'pID', 'cID'))));
}
if (isset ($_POST['multi_status_off'])) {
//set multi_categories status=off
if (is_array($_POST['multi_categories'])) {
foreach ($_POST['multi_categories'] AS $category_id) {
$catfunc->set_category_recursive($category_id, "0");
}
}
//set multi_products status=off
if (is_array($_POST['multi_products'])) {
foreach ($_POST['multi_products'] AS $product_id) {
$catfunc->set_product_status($product_id, "0");
}
}
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath='.$_GET['cPath'].'&'.xtc_get_all_get_params(array ('cPath', 'action', 'pID', 'cID'))));
}
// --- MULTI STATUS ENDS ---
//regular actions
if ($_GET['action']) {
switch ($_GET['action']) {
case 'setcflag' :
if (($_GET['flag'] == '0') || ($_GET['flag'] == '1')) {
if ($_GET['cID']) {
$catfunc->set_category_recursive($_GET['cID'], $_GET['flag']);
}
}
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath='.$_GET['cPath'].'&cID='.$_GET['cID']));
break;
//EOB setcflag
case 'setpflag' :
if (($_GET['flag'] == '0') || ($_GET['flag'] == '1')) {
if ($_GET['pID']) {
$catfunc->set_product_status($_GET['pID'], $_GET['flag']);
}
}
if ($_GET['pID']) {
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath='.$_GET['cPath'].'&pID='.$_GET['pID']));
} else {
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath='.$_GET['cPath'].'&cID='.$_GET['cID']));
}
break;
//EOB setpflag
case 'setsflag' :
if (($_GET['flag'] == '0') || ($_GET['flag'] == '1')) {
if ($_GET['pID']) {
$catfunc->set_product_startpage($_GET['pID'], $_GET['flag']);
if ($_GET['flag'] == '1') $catfunc->link_product($_GET['pID'], 0);
}
}
if ($_GET['pID']) {
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath='.$_GET['cPath'].'&pID='.$_GET['pID']));
} else {
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath='.$_GET['cPath'].'&cID='.$_GET['cID']));
}
break;
//EOB setsflag
case 'update_category' :
$catfunc->insert_category($_POST, '', 'update');
break;
case 'insert_category' :
$catfunc->insert_category($_POST, $current_category_id);
break;
case 'update_product' :
$catfunc->insert_product($_POST, '', 'update');
break;
case 'insert_product' :
$catfunc->insert_product($_POST, $current_category_id);
break;
case 'edit_crossselling' :
$catfunc->edit_cross_sell($_GET);
break;
case 'multi_action':
// xs:booster start - multiauktion (v1.041)
if (isset($_POST['multi_xtb'])) {
$_SESSION['xtb1']['multi_xtb']=array();
require_once("../".DIR_WS_CLASSES.'xtbooster.php');
$xtb = new xtbooster_base;
$xtb->config();
$requestx = "ACTION:TradeTemplateFetch";
$resx = $xtb->parse($xtb->exec($requestx));
$MULTI_REVERSECATS = $resx['MULTI_REVERSECATS'];
$MULTI_ONLYONSTOCK = $resx['MULTI_ONLYONSTOCK'];
if (is_array($_POST['multi_products'])) {
$x=$_POST['multi_products'];
foreach($x as $products_id) {
$q = xtc_db_query("select products_quantity from ".TABLE_PRODUCTS." where products_id = '".$products_id."'");
$p = xtc_db_fetch_array($q);
if($MULTI_ONLYONSTOCK=='true'&&$p['products_quantity']<1) continue;
$_SESSION['xtb1']['multi_xtb'][]=$products_id;
}
}
if (is_array($_POST['multi_categories'])) {
$_xtb_max_p = 10000;
function _xtb_reverse($category_id=0) {
global $_xtb_max_p,$MULTI_ONLYONSTOCK;
$cp = xtc_db_query("select * from ".TABLE_CATEGORIES." where parent_id = '".$category_id."'");
while($c=xtc_db_fetch_array($cp)) {
$q = xtc_db_query("select p.products_id, p.products_quantity from ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_TO_CATEGORIES." p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '".$c['categories_id']."'");
while($p = xtc_db_fetch_array($q)) {
if($MULTI_ONLYONSTOCK=='true'&&$p['products_quantity']<1) continue;
$_SESSION['xtb1']['multi_xtb'][$p['products_id']] = $p['products_id'];
}
if($_xtb_max_p--<0) break;
_xtb_reverse($c['categories_id']);
}
}
foreach ($_POST['multi_categories'] AS $i=>$category_id) {
$q = xtc_db_query("select p.products_id, p.products_quantity from ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_TO_CATEGORIES." p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '".$category_id."'");
while($p = xtc_db_fetch_array($q)) {
if($MULTI_ONLYONSTOCK=='true'&&$p['products_quantity']<1) continue;
$_SESSION['xtb1']['multi_xtb'][$p['products_id']] = $p['products_id'];
}
if($MULTI_REVERSECATS=='true') _xtb_reverse($category_id);
}
}
header("Location: xtbooster.php?xtb_module=add&mode=multi_xtb");
exit;
}
// xs:booster end - multiauktion (v1.041)
break;
case 'multi_action_confirm' :
// --- MULTI DELETE ---
if (isset ($_POST['multi_delete_confirm'])) {
//delete multi_categories
if (is_array($_POST['multi_categories'])) {
foreach ($_POST['multi_categories'] AS $category_id) {
$catfunc->remove_categories($category_id);
}
}
//delete multi_products
if (is_array($_POST['multi_products']) && is_array($_POST['multi_products_categories'])) {
foreach ($_POST['multi_products'] AS $product_id) {
$catfunc->delete_product($product_id, $_POST['multi_products_categories'][$product_id]);
}
}
}
// --- MULTI DELETE ENDS ---
// --- MULTI MOVE ---
if (isset ($_POST['multi_move_confirm'])) {
//move multi_categories
if (is_array($_POST['multi_categories']) && xtc_not_null($_POST['move_to_category_id'])) {
foreach ($_POST['multi_categories'] AS $category_id) {
$dest_category_id = xtc_db_prepare_input($_POST['move_to_category_id']);
if ($category_id != $dest_category_id) {
$catfunc->move_category($category_id, $dest_category_id);
}
}
}
//move multi_products
if (is_array($_POST['multi_products']) && xtc_not_null($_POST['move_to_category_id']) && xtc_not_null($_POST['src_category_id'])) {
foreach ($_POST['multi_products'] AS $product_id) {
$product_id = xtc_db_prepare_input($product_id);
$src_category_id = xtc_db_prepare_input($_POST['src_category_id']);
$dest_category_id = xtc_db_prepare_input($_POST['move_to_category_id']);
$catfunc->move_product($product_id, $src_category_id, $dest_category_id);
}
}
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath='.$dest_category_id.'&'.xtc_get_all_get_params(array ('cPath', 'action', 'pID', 'cID'))));
}
// --- MULTI MOVE ENDS ---
// --- MULTI COPY ---
if (isset ($_POST['multi_copy_confirm'])) {
//copy multi_categories
if (is_array($_POST['multi_categories']) && (is_array($_POST['dest_cat_ids']) || xtc_not_null($_POST['dest_category_id']))) {
$_SESSION['copied'] = array ();
foreach ($_POST['multi_categories'] AS $category_id) {
if (is_array($_POST['dest_cat_ids'])) {
foreach ($_POST['dest_cat_ids'] AS $dest_category_id) {
if ($_POST['copy_as'] == 'link') {
$catfunc->copy_category($category_id, $dest_category_id, 'link');
}
elseif ($_POST['copy_as'] == 'duplicate') {
$catfunc->copy_category($category_id, $dest_category_id, 'duplicate');
} else {
$messageStack->add_session('Copy type not specified.', 'error');
}
}
}
elseif (xtc_not_null($_POST['dest_category_id'])) {
if ($_POST['copy_as'] == 'link') {
$catfunc->copy_category($category_id, $_POST['dest_category_id'], 'link');
}
elseif ($_POST['copy_as'] == 'duplicate') {
$catfunc->copy_category($category_id, $_POST['dest_category_id'], 'duplicate');
} else {
$messageStack->add_session('Copy type not specified.', 'error');
}
}
}
unset ($_SESSION['copied']);
}
//copy multi_products
if (is_array($_POST['multi_products']) && (is_array($_POST['dest_cat_ids']) || xtc_not_null($_POST['dest_category_id']))) {
foreach ($_POST['multi_products'] AS $product_id) {
$product_id = xtc_db_prepare_input($product_id);
if (is_array($_POST['dest_cat_ids'])) {
foreach ($_POST['dest_cat_ids'] AS $dest_category_id) {
$dest_category_id = xtc_db_prepare_input($dest_category_id);
if ($_POST['copy_as'] == 'link') {
$catfunc->link_product($product_id, $dest_category_id);
}
elseif ($_POST['copy_as'] == 'duplicate') {
$catfunc->duplicate_product($product_id, $dest_category_id);
} else {
$messageStack->add_session('Copy type not specified.', 'error');
}
}
}
elseif (xtc_not_null($_POST['dest_category_id'])) {
$dest_category_id = xtc_db_prepare_input($_POST['dest_category_id']);
if ($_POST['copy_as'] == 'link') {
$catfunc->link_product($product_id, $dest_category_id);
}
elseif ($_POST['copy_as'] == 'duplicate') {
$catfunc->duplicate_product($product_id, $dest_category_id);
} else {
$messageStack->add_session('Copy type not specified.', 'error');
}
}
}
}
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath='.$dest_category_id.'&'.xtc_get_all_get_params(array ('cPath', 'action', 'pID', 'cID'))));
}
// --- MULTI COPY ENDS ---
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath='.$_GET['cPath'].'&'.xtc_get_all_get_params(array ('cPath', 'action', 'pID', 'cID'))));
break;
#EOB multi_action_confirm
} //EOB switch action
} //EOB if action
// CATEGORIES-FILTER
$coo_feature_helper = MainFactory::create_object('FeatureFunctionHelper');
$coo_control = MainFactory::create_object('FeatureControl');
$feature_array = $coo_control->get_feature_array();
// CATEGORIES-FILTER
//
// POST ACTIONS (CATEGORIES)
// 'new feature'
if (isset($_POST['insert_feature'])) {
$coo_feature_helper->new_feature($_GET['cID'], $_POST['featureSelect']);
$coo_control = NULL;
$coo_filter = NULL;
$_GET['action'] = 'edit_category';
}
// 'save feature data'
// 'delete feature filter'
if (isset($_POST['save_features'])) {
$coo_feature_helper->save_feature($_GET['cID']);
$coo_control = NULL;
$_GET['action'] = 'edit_category';
}
// POST ACTIONS (PRODUCT)
// delete 'feature setup' for product_id
if (isset($_POST['deleteSetup'])) {
$prod_id = (int) $_GET['pID'];
$coo_control = MainFactory::create_object('ProductFeatureHandler');
$coo_control->clear_feature_value($prod_id);
$coo_control->build_feature_index($prod_id);
$coo_control->build_categories_index($prod_id);
$coo_control = NULL;
}
// check if the catalog image directory exists
if (is_dir(DIR_FS_CATALOG_IMAGES)) {
if (!is_writeable(DIR_FS_CATALOG_IMAGES))
$messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
} else {
$messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
}
// redirect to categories overview to prevent adding content twice
if($_GET['action'] == 'insert_category' || $_GET['action'] == 'insert_product')
{
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, xtc_get_all_get_params(array('action'))));
}
// end of pre-checks and actions, HTML output follows
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['language_charset']; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script type="text/javascript" src="includes/general.js"></script>
<script type="text/javascript" src="includes/javascript/categories.js"></script>
<style type="text/css">
.product_tabs_wrapper{
border: 1px solid #ccc;
background: #efefef;
padding: 2px;
margin: 2px 0;
}
.product_tabs_headline{
width: 100%;
display: block;
}
.product_tab_box{
margin: 3px 0;
line-height: 16px;
}
.product_tab_headline{
margin-right: 15px;
display: block;
float: left;
height: 16px;
}
.product_tab_box input,
.product_tab_box textarea{
float: left;
display: none;
}
.product_tab_edit,
.product_tab_delete{
display: block;
float: right;
margin: 0 2px;
cursor: pointer;
}
.product_tab_clear{
clear: both;
}
</style>
</head>
<body style="margin: 0; background-color: #FFFFFF">
<div id="spiffycalendar" class="text"></div>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table style="border:none; width:100%;" cellspacing="2" cellpadding="2">
<tr>
<td class="columnLeft2" width="<?php echo BOX_WIDTH; ?>" valign="top">
<table style="border: none; width: <?php echo BOX_WIDTH; ?>;" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table>
</td>
<!-- body_text //-->
<td class="boxCenter" width="100%" valign="top">
<?php
//----- new_category / edit_category (when ALLOW_CATEGORY_DESCRIPTIONS is 'true') -----
if ($_GET['action'] == 'new_category' || $_GET['action'] == 'edit_category') {
include (DIR_WS_MODULES.'new_category.php');
}
elseif ($_GET['action'] == 'new_product') {
include (DIR_WS_MODULES.'new_product.php');
}
elseif ($_GET['action'] == 'edit_crossselling') {
include (DIR_WS_MODULES.'cross_selling.php');
} else {
//set $cPath to 0 if not set - FireFox workaround, didn't work when de/activating categories and $cPath wasn't set
if (!$cPath) { $cPath = '0'; }
include (DIR_WS_MODULES.'categories_view.php');
}
?>
<!-- close tables from above modules //-->
</td>
<!-- body_text_eof //-->
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>