#1 (permalink)  
Alt 24.08.2005, 23:32
xt:C Sponsor
 
Registriert seit: 01.10.2004
Beiträge: 54
Standard

Sch?nen Guten Morgen (00.:29 Uhr)

Ich brauche schon wieder hilfe. Ich denke mal f?r euch Profis ist das kein Problem, aber f?r den kleinen anf?ger schon. Also ich habe den XTC Shop wie jeder hier. Nun im Adminbereich wenn ich einen Artikel erstelle und ein Bild von meinem Computer aussuche und dann anschlie?en den Artikel und das Bild Hochlade, soweit geht alles.

Nur wenn das Bild auf meinem PC z.B Artikel.jpg heist wird dieses selbe Name auch in meinem Shop ?bernommen. Nun wenn ich noch einen Artikel mit einem anderen Bild erstelle und ausversehen der Name des Bildes ist gleich. Haben bei Artikel das selbe Bild.

Was ich meine ist, wie schaffe ich es das der Shop selbst einen Bildnahmen erstellt. Es w?hre nicht schlecht wenn der Bildnahme, die Zahl des Artikels hat z.B ...product_info.php?products_id=8

Vielen Dank im Voraus.

P.S Habe die Forensuche schon ben?tzt, leider nichts gefunden. Habe aber schon sehr viel hier gelesen. Gr??le :biggrin:
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #2 (permalink)  
Alt 25.08.2005, 15:02
xt:C Sponsor
 
Registriert seit: 01.10.2004
Beiträge: 54
Standard

Kann mir keiner Fehlen, das ist mir sehr wichtig.

Ich w?rde mich echt freuen. Ist keine Bl?de Frage ist ernst gemeint. :sad:
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #3 (permalink)  
Alt 25.08.2005, 15:27
Benutzerbild von polkhigh33
xt:C Supportmitarbeiter
 
Registriert seit: 26.10.2003
Ort: Hamburg
Beiträge: 6.862
Standard

ist in 3.0.3 realisiert, da wird die nr des artikeldatensatzes als bildname genommen.
__________________
dieser beitrag ist ohne gewähr und stellt nur meine meinung und keinesfalls eine rechtsberatung dar. im zweifelsfalle ist er ironisch gemeint.
.:netzdesign33.de:. | .:blog33.de:.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #4 (permalink)  
Alt 26.08.2005, 06:56
Erfahrener Benutzer
 
Registriert seit: 08.03.2005
Ort: Mußtopp
Beiträge: 638
Standard

Hi,

das kannst du mit ein paar eingef?gten Programmzeilen l?sen beim Artikel-Bildupload. (allerdings alles ohne Gew?hr :-)

Du benutzt xtcommerce Version 2 RC 1.2 ?!
Der folgende Patch gibt den Grafik-Dateinamen die Artikelnummer als Name.

Gru?






Gehe in die Datei: admin/categories.php
Suche folgende Stelle im Programmcode (ca. Zeile 270).

if ($products_image = new upload('products_image', DIR_FS_CATALOG_ORIGINAL_IMAGES, '777', '', true)) {
$products_image_name = $products_image->filename;

$sql_data_array['products_image'] = xtc_db_prepare_input($products_image_name);

require(DIR_WS_INCLUDES . 'product_thumbnail_images.php');
require(DIR_WS_INCLUDES . 'product_info_images.php');
require(DIR_WS_INCLUDES . 'product_popup_images.php');

} else {
$products_image_name = $_POST['products_previous_image'];
}


Dann f?gst du folgenden Programmteil ein.

if ($products_image = new upload('products_image', DIR_FS_CATALOG_ORIGINAL_IMAGES, '777', '', true)) {
$products_image_name = $products_image->filename;

// ------ Einf?gung Beginn ---------------------
if( preg_match('/(^.*)\.(.*$)/', $products_image_name, $treffer) ) {
$p_name=$treffer[1];
$p_ext =$treffer[2];
$pn_name=strtolower($_POST['products_model']);

$pn_filename = $pn_name.".".$p_ext;

rename( DIR_FS_CATALOG_ORIGINAL_IMAGES.$products_image_nam e,
DIR_FS_CATALOG_ORIGINAL_IMAGES.$pn_filename);
$products_image_name=$pn_filename;
}
// ------ Einf?gung Ende ---------------------

$sql_data_array['products_image'] = xtc_db_prepare_input($products_image_name);

require(DIR_WS_INCLUDES . 'product_thumbnail_images.php');
require(DIR_WS_INCLUDES . 'product_info_images.php');
require(DIR_WS_INCLUDES . 'product_popup_images.php');

} else {
$products_image_name = $_POST['products_previous_image'];
}

Geändert von hubbabubba (16.08.2008 um 09:44 Uhr)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #5 (permalink)  
Alt 30.08.2005, 22:56
xt:C Sponsor
 
Registriert seit: 01.10.2004
Beiträge: 54
Standard

Danke Danke und Danke klappt Supppper... Nur ich brauche das mit der Produkt ID. Kannst du mir das bitte umschreiben. Ich danke dir vielmals vorher.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #6 (permalink)  
Alt 31.08.2005, 08:12
Erfahrener Benutzer
 
Registriert seit: 08.03.2005
Ort: Mußtopp
Beiträge: 638
Standard

Zitat:
Originally posted by Ape50@Aug 30 2005, 10:56 PM
Danke Danke und Danke klappt Supppper... Nur ich brauche das mit der Produkt ID. Kannst du mir das bitte umschreiben. Ich danke dir vielmals vorher.


Iss ja gut, iss ja gut, ich werd gleich gr??enwahnsinnig. :tongue:

?ndere die Zeile

$pn_name=strtolower($_POST['products_model']);

zu

$pn_name=$_POST['products_id'];


Habs auf die schnelle nicht getestet. Probier mal aus.

Gru?
Hen
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #7 (permalink)  
Alt 31.08.2005, 08:26
Erfahrener Benutzer
 
Registriert seit: 08.03.2005
Ort: Mußtopp
Beiträge: 638
Standard

Zitat:
Originally posted by hubbabubba@Aug 31 2005, 08:12 AM
Habs auf die schnelle nicht getestet. Probier mal aus.
R?ckzug auf breiter Front. Brauchts es gar nicht probieren. So gehts nicht.
Die Proddukt ID steht an dieser Stelle des Programms noch gar nicht fest (wird an sp?terer Stelle erst vom DB-System festgelegt).

Wenn's wirklich die ID sein soll wirds kniffelig. Da m?sste man an mehreren Stellen patchen. Hab ich heut Vormittag keine Zeit. Erz?hl doch mal warum dir die ID so wichtig ist. Hast du mehrere Artikel mit gleicher Artikelnummer? Die eindeutigkeit ist doch i.A. auch so gegeben.

Gru?
Hen
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #8 (permalink)  
Alt 31.08.2005, 09:40
xt:C Sponsor
 
Registriert seit: 01.10.2004
Beiträge: 54
Standard

Hallo, also ich habe da so ein Problem mit anderen H?ndler die das selbe wie ich verkaufe. Dieses schaun gerne mal Artikel. Nr bei mir ab, wie ich hier schon einmal geschrieben habe, habe ich dieses jetzt weggemacht.

Also am besten w?hre die Produkt ID. Habe leider selbst mit dem umschreiben keine ahnung, sonst w?rde ich euch nicht bel?stigen, aber f?r andere user ist das bestimmt auch eine Hilfe. Habe oft hier schon sehr viele Infos gefunden und in meinem Shop eingebaut. Also mein Shop hat schon einiges verpasst bekommen. Nur mit solchen Fragen wie BilderName habe ich leider nicht viel ahnung.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #9 (permalink)  
Alt 31.08.2005, 14:38
Erfahrener Benutzer
 
Registriert seit: 08.03.2005
Ort: Mußtopp
Beiträge: 638
Standard

Ok habe, nochmal'n bischen am Code rumgepf... :smile:

Hier die komplette categories.inc. Kannste mit Copy u. Paste r?bernehmen. Teste mal obs klappt.

Gru?
Hen

[code]
<?php
/* --------------------------------------------------------------
$Id: categories.php,v 1.45 2004/04/25 13:58:08 fanta2k Exp $

XT-Commerce - community made shopping
http://www.xt-commerce.com

Copyright (c) 2003 XT-Commerce und hubbabubba 2005
<-- K?rzung von hubbabubba ist verboten, Aus, Ende! :-P -->
--------------------------------------------------------------
Patch 31.08.2005, save productimages name of ID, from hubbabubba int.ltd.
--------------------------------------------------------------
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

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('includes/application_top.php');
include ('includes/classes/image_manipulator.php');
require_once(DIR_FS_INC .'xtc_get_tax_rate.inc.php');
require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();

if ($_GET['function']) {
switch ($_GET['function']) {
case 'delete':
xtc_db_query("DELETE FROM personal_offers_by_customers_status_" . (int)$_GET['statusID'] . " WHERE products_id = '" . (int)$_GET['pID'] . "' AND quantity = '" . (int)$_GET['quantity'] . "'");
break;
}
xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&action=new_product&pID=' . (int)$_GET['pID']));
}
if ($_GET['action']) {
switch ($_GET['action']) {
case 'setflag':
if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
if ($_GET['pID']) {
xtc_set_product_status($_GET['pID'], $_GET['flag']);
}
if ($_GET['cID']) {
xtc_set_categories_rekursiv($_GET['cID'], $_GET['flag']);
}
}

xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath']));
break;

case 'new_category':
case 'edit_category':
if (ALLOW_CATEGORY_DESCRIPTIONS == 'true')
$_GET['action']=$_GET['action'] . '_ACD';
break;

case 'insert_category':
case 'update_category':
if (($_POST['edit_x']) || ($_POST['edit_y'])) {
$_GET['action'] = 'edit_category_ACD';
} else {
$categories_id = xtc_db_prepare_input($_POST['categories_id']);
if ($categories_id == '') {
$categories_id = xtc_db_prepare_input($_GET['cID']);
}
$sort_order = xtc_db_prepare_input($_POST['sort_order']);
$categories_status = xtc_db_prepare_input($_POST['categories_status']);

// set allowed c.groups
$group_ids='';
if(isset($_POST['groups'])) foreach($_POST['groups'] as $b){
$group_ids .= 'c_'.$b."_group ,";
}
$customers_statuses_array=xtc_get_customers_status es();
if (strstr($group_ids,'c_all_group')) {
$group_ids='c_all_group,';
for ($i=0;$n=sizeof($customers_statuses_array),$i<$n;$ i++) {
$group_ids .='c_'.$customers_statuses_array[$i]['id'].'_group ,';
}
}


$sql_data_array = array( 'sort_order' => $sort_order,
'group_ids'=>$group_ids,
'categories_status' => $categories_status,
'products_sorting' => xtc_db_prepare_input($_POST['products_sorting']),
'products_sorting2' => xtc_db_prepare_input($_POST['products_sorting2']),
'categories_template'=>xtc_db_prepare_input($_POST ['categorie_template']),
'listing_template'=>xtc_db_prepare_input($_POST['l isting_template']));

if ($_GET['action'] == 'insert_category') {
$insert_sql_data = array('parent_id' => $current_category_id,
'date_added' => 'now()');
$sql_data_array = xtc_array_merge($sql_data_array, $insert_sql_data);
xtc_db_perform(TABLE_CATEGORIES, $sql_data_array);
$categories_id = xtc_db_insert_id();
} elseif ($_GET['action'] == 'update_category') {
$update_sql_data = array('last_modified' => 'now()');
$sql_data_array = xtc_array_merge($sql_data_array, $update_sql_data);
xtc_db_perform(TABLE_CATEGORIES, $sql_data_array, 'update', 'categories_id = \'' . $categories_id . '\'');
}
xtc_set_groups($categories_id,$group_ids);
$languages = xtc_get_languages();
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
$categories_name_array = $_POST['categories_name'];
$language_id = $languages[$i]['id'];
$sql_data_array = array('categories_name' => xtc_db_prepare_input($categories_name_array[$langu age_id]));
if (ALLOW_CATEGORY_DESCRIPTIONS == 'true') {
$sql_data_array = array('categories_name' => xtc_db_prepare_input($_POST['categories_name'][$la nguage_id]),
'categories_heading_title' => xtc_db_prepare_input($_POST['categories_heading_ti tle'][$language_id]),
'categories_description' => xtc_db_prepare_input($_POST['categories_descriptio n'][$language_id]),
'categories_meta_title' => xtc_db_prepare_input($_POST['categories_meta_title '][$language_id]),
'categories_meta_description' => xtc_db_prepare_input($_POST['categories_meta_descr iption'][$language_id]),
'categories_meta_keywords' => xtc_db_prepare_input($_POST['categories_meta_keywo rds'][$language_id]));
}

if ($_GET['action'] == 'insert_category') {
$insert_sql_data = array('categories_id' => $categories_id,
'language_id' => $languages[$i]['id']);
$sql_data_array = xtc_array_merge($sql_data_array, $insert_sql_data);
xtc_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array);
} elseif ($_GET['action'] == 'update_category') {
xtc_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', 'categories_id = \'' . $categories_id . '\' and language_id = \'' . $languages[$i]['id'] . '\'');
}
}

if ($categories_image = new upload('categories_image', DIR_FS_CATALOG_IMAGES.'categories/')) {
xtc_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . xtc_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");
}

xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&cID=' . $categories_id));
}
break;


case 'delete_category_confirm':
if ($_POST['categories_id']) {
$categories_id = xtc_db_prepare_input($_POST['categories_id']);

$categories = xtc_get_category_tree($categories_id, '', '0', '', true);
$products = array();
$products_delete = array();

for ($i = 0, $n = sizeof($categories); $i < $n; $i++) {
$product_ids_query = xtc_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . $categories[$i]['id'] . "'");
while ($product_ids = xtc_db_fetch_array($product_ids_query)) {
$products[$product_ids['products_id']]['categories '][] = $categories[$i]['id'];
}
}

reset($products);
while (list($key, $value) = each($products)) {
$category_ids = '';
for ($i = 0, $n = sizeof($value['categories']); $i < $n; $i++) {
$category_ids .= '\'' . $value['categories'][$i] . '\', ';
}
$category_ids = substr($category_ids, 0, -2);

$check_query = xtc_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $key . "' and categories_id not in (" . $category_ids . ")");
$check = xtc_db_fetch_array($check_query);
if ($check['total'] < '1') {
$products_delete[$key] = $key;
}
}

// Removing categories can be a lengthy process
@xtc_set_time_limit(0);
for ($i = 0, $n = sizeof($categories); $i < $n; $i++) {
xtc_remove_category($categories[$i]['id']);
}

reset($products_delete);
while (list($key) = each($products_delete)) {
xtc_remove_product($key);
}
}

xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
break;
case 'delete_product_confirm':
if ( ($_POST['products_id']) && (is_array($_POST['product_categories'])) ) {
$product_id = xtc_db_prepare_input($_POST['products_id']);
$product_categories = $_POST['product_categories'];

for ($i = 0, $n = sizeof($product_categories); $i < $n; $i++) {
xtc_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . xtc_db_input($product_id) . "' and categories_id = '" . xtc_db_input($product_categories[$i]) . "'");
}

$product_categories_query = xtc_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . xtc_db_input($product_id) . "'");
$product_categories = xtc_db_fetch_array($product_categories_query);

if ($product_categories['total'] == '0') {
xtc_remove_product($product_id);
}
}

xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
break;
case 'move_category_confirm':
if ( ($_POST['categories_id']) && ($_POST['categories_id'] != $_POST['move_to_category_id']) ) {
$categories_id = xtc_db_prepare_input($_POST['categories_id']);
$new_parent_id = xtc_db_prepare_input($_POST['move_to_category_id'] );
xtc_db_query("update " . TABLE_CATEGORIES . " set parent_id = '" . xtc_db_input($new_parent_id) . "', last_modified = now() where categories_id = '" . xtc_db_input($categories_id) . "'");
}

xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&cID=' . $categories_id));
break;
case 'move_product_confirm':
$products_id = xtc_db_prepare_input($_POST['products_id']);
$new_parent_id = xtc_db_prepare_input($_POST['move_to_category_id'] );

$duplicate_check_query = xtc_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . xtc_db_input($products_id) . "' and categories_id = '" . xtc_db_input($new_parent_id) . "'");
$duplicate_check = xtc_db_fetch_array($duplicate_check_query);
if ($duplicate_check['total'] < 1) xtc_db_query("update " . TABLE_PRODUCTS_TO_CATEGORIES . " set categories_id = '" . xtc_db_input($new_parent_id) . "' where products_id = '" . xtc_db_input($products_id) . "' and categories_id = '" . $current_category_id . "'");

xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&pID=' . $products_id));
break;
case 'insert_product':
case 'update_product':


if (PRICE_IS_BRUTTO=='true' && $_POST['products_price']){
$_POST['products_price'] = ($_POST['products_price']/(xtc_get_tax_rate($_POST['products_tax_class_id']) +100)*100);
}


if ( ($_POST['edit_x']) || ($_POST['edit_y']) ) {
$_GET['action'] = 'new_product';
} else {
$products_id = xtc_db_prepare_input($_GET['pID']);
$products_date_available = xtc_db_prepare_input($_POST['products_date_availab le']);

$products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

// set allowed c.groups
$group_ids='';
if(isset($_POST['groups'])) foreach($_POST['groups'] as $b){
$group_ids .= 'c_'.$b."_group ,";
}
$customers_statuses_array=xtc_get_customers_status es();
if (strstr($group_ids,'c_all_group')) {
$group_ids='c_all_group,';
for ($i=0;$n=sizeof($customers_statuses_array),$i<$n;$ i++) {
$group_ids .='c_'.$customers_statuses_array[$i]['id'].'_group ,';
}
}

$sql_data_array = array('products_quantity' => xtc_db_prepare_input($_POST['products_quantity']),
'products_model' => xtc_db_prepare_input($_POST['products_model']),
'products_price' => xtc_db_prepare_input($_POST['products_price']),
'products_sort' => xtc_db_prepare_input($_POST['products_sort']),
'group_ids'=>$group_ids,
'products_shippingtime' => xtc_db_prepare_input($_POST['shipping_status']),
'products_discount_allowed' => xtc_db_prepare_input($_POST['products_discount_all owed']),
'products_date_available' => $products_date_available,
'products_weight' => xtc_db_prepare_input($_POST['products_weight']),
'products_status' => xtc_db_prepare_input($_POST['products_status']),
'products_tax_class_id' => xtc_db_prepare_input($_POST['products_tax_class_id ']),
'product_template' => xtc_db_prepare_input($_POST['info_template']),
'options_template' => xtc_db_prepare_input($_POST['options_template']),
'manufacturers_id' => xtc_db_prepare_input($_POST['manufacturers_id']),
'products_fsk18' => xtc_db_prepare_input($_POST['fsk18']));


if (isset($_POST['products_image']) && xtc_not_null($_POST['products_image']) && ($_POST['products_image'] != 'none')) {
$sql_data_array['products_image'] = xtc_db_prepare_input($_POST['products_image']);
}

if ($_GET['action'] == 'insert_product') {
$insert_sql_data = array('products_date_added' => 'now()');
$sql_data_array = xtc_array_merge($sql_data_array, $insert_sql_data);
xtc_db_perform(TABLE_PRODUCTS, $sql_data_array);
$products_id = xtc_db_insert_id();
xtc_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . $products_id . "', '" . $current_category_id . "')");
} elseif ($_GET['action'] == 'update_product') {
$update_sql_data = array('products_last_modified' => 'now()');
$sql_data_array = xtc_array_merge($sql_data_array, $update_sql_data);
xtc_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', 'products_id = \'' . xtc_db_input($products_id) . '\'');
}

if ($products_image = new upload('products_image', DIR_FS_CATALOG_ORIGINAL_IMAGES, '777', '', true)) {
$products_image_name = $products_image->filename;
// ----------- Einf?gung Beginn --------------------------------------------- }
if( preg_match('/(^.*)\.(.*$)/', $products_image_name, $treffer) ) {
// $p_name=$treffer[1];
$p_ext =$treffer[2];
// $pn_name=strtolower($_POST['products_model']);
$pn_name=$products_id;

$pn_filename = $pn_name.".".$p_ext;
if( file_exists(DIR_FS_CATALOG_ORIGINAL_IMAGES.$pn_fil ename) ) {
unlink(DIR_FS_CATALOG_ORIGINAL_IMAGES.$pn_filename );
}
rename( DIR_FS_CATALOG_ORIGINAL_IMAGES.$products_image_nam e,
DIR_FS_CATALOG_ORIGINAL_IMAGES.$pn_filename);

xtc_db_query("update " . TABLE_PRODUCTS . " set products_image = '" . $pn_filename . "' where products_id = '" . (int)$products_id . "'");
$products_image_name=$pn_filename;
}
// ----------- Einf?gung Ende --------------------------------------------- }
$sql_data_array['products_image'] = xtc_db_prepare_input($products_image_name);

require(DIR_WS_INCLUDES . 'product_thumbnail_images.php');
require(DIR_WS_INCLUDES . 'product_info_images.php');
require(DIR_WS_INCLUDES . 'product_popup_images.php');

} else {
echo "bbb";
$products_image_name = $_POST['products_previous_image'];
}

$languages = xtc_get_languages();
// Here we go, lets write Group prices into db
// start
$i = 0;
$group_query = xtc_db_query("SELECT customers_status_id FROM " . TABLE_CUSTOMERS_STATUS . " WHERE language_id = '" . (int)$_SESSION['languages_id'] . "' AND customers_status_id != '0'");
while ($group_values = xtc_db_fetch_array($group_query)) {
// load data into array
$i++;
$group_data[$i] = array('STATUS_ID' => $group_values['customers_status_id']);
}
for ($col = 0, $n = sizeof($group_data); $col < $n+1; $col++) {
if ($group_data[$col]['STATUS_ID'] != '') {
$personal_price = xtc_db_prepare_input($_POST['products_price_' . $group_data[$col]['STATUS_ID']]);
if ($personal_price == '' or $personal_price=='0.0000') {
$personal_price = '0.00';
} else {
if (PRICE_IS_BRUTTO=='true'){
$personal_price= ($personal_price/(xtc_get_tax_rate($_POST['products_tax_class_id ']) +100)*100);
}
$personal_price=xtc_round($personal_price,PRICE_PR ECISION);
}

xtc_db_query("UPDATE personal_offers_by_customers_status_" . $group_data[$col]['STATUS_ID'] . " SET personal_offer = '" . $personal_price . "' WHERE products_id = '" . $products_id . "' AND quantity = '1'");
}
}
// end
// ok, lets check write new staffelpreis into db (if there is one)
$i = 0;
$group_query = xtc_db_query("SELECT customers_status_id FROM " . TABLE_CUSTOMERS_STATUS . " WHERE language_id = '" . (int)$_SESSION['languages_id'] . "' AND customers_status_id != '0'");
while ($group_values = xtc_db_fetch_array($group_query)) {
// load data into array
$i++;
$group_data[$i]=array('STATUS_ID' => $group_values['customers_status_id']);
}
for ($col = 0, $n = sizeof($group_data); $col < $n+1; $col++) {
if ($group_data[$col]['STATUS_ID'] != '') {
$quantity = xtc_db_prepare_input($_POST['products_quantity_sta ffel_' . $group_data[$col]['STATUS_ID']]);
$staffelpreis = xtc_db_prepare_input($_POST['products_price_staffe l_' . $group_data[$col]['STATUS_ID']]);
if (PRICE_IS_BRUTTO=='true'){
$staffelpreis= ($staffelpreis/(xtc_get_tax_rate($_POST['products_tax_class_id ']) +100)*100);
}
$staffelpreis=xtc_round($staffelpreis,PRICE_PRECIS ION);

if ($staffelpreis!='' && $quantity!='') {

// ok, lets check entered data to get rid of user faults
if ($quantity<=1) $quantity=2;
$check_query=xtc_db_query("SELECT
quantity FROM
personal_offers_by_customers_status_" . $group_data[$col]['STATUS_ID'] . "
WHERE products_id='". $products_id."'
and quantity='".$quantity."'");
// dont insert if same qty!
if (xtc_db_num_rows($check_query)<1) {
xtc_db_query("INSERT INTO personal_offers_by_customers_status_" . $group_data[$col]['STATUS_ID'] . " (price_id, products_id, quantity, personal_offer) VALUES ('', '" . $products_id . "', '" . $quantity . "', '" . $staffelpreis . "')");
}
}
}
}
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
$language_id = $languages[$i]['id'];
$sql_data_array = array('products_name' => xtc_db_prepare_input($_POST['products_name'][$lang uage_id]),
'products_description' => xtc_db_prepare_input($_POST['products_description_ '.$language_id]),
'products_short_description' => xtc_db_prepare_input($_POST['products_short_descri ption_'.$language_id]),
'products_url' => xtc_db_prepare_input($_POST['products_url'][$langu age_id]),
'products_meta_title' => xtc_db_prepare_input($_POST['products_meta_title'] [$language_id]),
'products_meta_description' => xtc_db_prepare_input($_POST['products_meta_descrip tion'][$language_id]),
'products_meta_keywords' => xtc_db_prepare_input($_POST['products_meta_keyword s'][$language_id]));

if ($_GET['action'] == 'insert_product') {
$insert_sql_data = array('products_id' => $products_id,
'language_id' => $language_id);
$sql_data_array = xtc_array_merge($sql_data_array, $insert_sql_data);

xtc_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
} elseif ($_GET['action'] == 'update_product') {
xtc_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', 'products_id = \'' . xtc_db_input($products_id) . '\' and language_id = \'' . $language_id . '\'');
}
}

xtc_redirect(xtc_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));
}
break;
case 'copy_to_confirm':

if(isset($_POST['cat_ids']) && $_POST['copy_as'] == 'link') {
$products_id = xtc_db_prepare_input($_POST['products_id']);

foreach($_POST['cat_ids'] as $key){
$check_query = xtc_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $products_id . "' and categories_id = '" . $key . "'");
$check = xtc_db_fetch_array($check_query);
if ($check['total'] < '1') {
xtc_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . $products_id . "', '" . $key . "')");
} else {
$messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY , 'error');
}

}
break;
}


if ( (xtc_not_null($_POST['products_id'])) && (xtc_not_null($_POST['categories_id'])) ) {
$products_id = xtc_db_prepare_input($_POST['products_id']);

$categories_id = xtc_db_prepare_input($_POST['categories_id']);
if(isset($_POST['cat_ids'])) {
$cat_ids=$_POST['cat_ids'];
} else {
$cat_ids=array('0'=>$categories_id);
}

foreach($cat_ids as $key) {
$categories_id=$key;

if ($_POST['copy_as'] == 'link') {
if ($_POST['categories_id'] != $current_category_id) {
$check_query = xtc_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . xtc_db_input($products_id) . "' and categories_id = '" . xtc_db_input($categories_id) . "'");
$check = xtc_db_fetch_array($check_query);
if ($check['total'] < '1') {
xtc_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . xtc_db_input($products_id) . "', '" . xtc_db_input($categories_id) . "')");
}
} else {
$messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY , 'error');
}
} elseif ($_POST['copy_as'] == 'duplicate') {
$product_query = xtc_db_query("select
products_quantity,
products_model,
products_shippingtime,
group_ids,
products_sort,
products_image,
products_price,
products_discount_allowed,
products_date_available,
products_weight,
products_tax_class_id,
manufacturers_id,
product_template,
options_template,
products_fsk18
from " . TABLE_PRODUCTS . "
where products_id = '" . xtc_db_input($products_id) . "'");

$product = xtc_db_fetch_array($product_query);
xtc_db_query("insert into " . TABLE_PRODUCTS . "
(products_quantity,
products_model,
products_shippingtime,
group_ids,
products_sort,
products_image,
products_price,
products_discount_allowed,
products_date_added,
products_date_available,
products_weight,
products_status,
products_tax_class_id,
manufacturers_id,
product_template,
options_template,
products_fsk18)
values
('" . $product['products_quantity'] . "',
'" . $product['products_model'] . "',
'" . $product['products_shippingtime'] . "',
'" . $product['products_sort'] . "',
'" . $product['products_model'] . "',
'" . $product['products_image'] . "',
'" . $product['products_price'] . "',
'" . $product['products_discount_allowed'] . "',
now(),
'" . $product['products_date_available'] . "',
'" . $product['products_weight'] . "',
'0',
'" . $product['products_tax_class_id'] . "',
'" . $product['manufacturers_id'] . "',
'" . $product['product_template'] . "',
'" . $product['options_template'] . "',
'" . $product['products_fsk18'] . "'
)");

$dup_products_id = xtc_db_insert_id();

$description_query = xtc_db_query("select
language_id,
products_name,
products_description,
products_short_description,
products_meta_title,
products_meta_description,
products_meta_keywords,
products_url
from " . TABLE_PRODUCTS_DESCRIPTION . "
where products_id = '" . xtc_db_input($products_id) . "'");
$old_products_id=xtc_db_input($products_id);
while ($description = xtc_db_fetch_array($description_query)) {
xtc_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . "
(products_id,
language_id,
products_name,
products_description,
products_short_description,
products_meta_title,
products_meta_description,
products_meta_keywords,
products_url,
products_viewed)
values (
'" . $dup_products_id . "',
'" . $description['language_id'] . "',
'" . addslashes($description['products_name']) . "',
'" . addslashes($description['products_description']) . "',
'" . addslashes($description['products_short_descriptio n']) . "',
'" . addslashes($description['products_meta_title']) . "',
'" . addslashes($description['products_meta_description ']) . "',
'" . addslashes($description['products_meta_keywords']) . "',
'" . $description['products_url'] . "',
'0')");
}

xtc_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . $dup_products_id . "', '" . xtc_db_input($categories_id) . "')");

$products_id = $dup_products_id;


$i = 0;
$group_query = xtc_db_query("SELECT customers_status_id FROM " . TABLE_CUSTOMERS_STATUS . " WHERE language_id = '" . (int)$_SESSION['languages_id'] . "' AND customers_status_id != '0'");
while ($group_values = xtc_db_fetch_array($group_query)) {
// load data into array
$i++;
$group_data[$i]=array('STATUS_ID' => $group_values['customers_status_id']);
}
for ($col = 0, $n = sizeof($group_data); $col < $n+1; $col++) {
if ($group_data[$col]['STATUS_ID'] != '') {

$copy_query=xtc_db_query("SELECT
&nbsp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #10 (permalink)  
Alt 31.08.2005, 14:41
Erfahrener Benutzer
 
Registriert seit: 08.03.2005
Ort: Mußtopp
Beiträge: 638
Standard

Zitat:
Originally posted by hubbabubba@Aug 31 2005, 02:38 PM
Hier die komplette categories.inc. Kannste mit Copy u. Paste r?bernehmen. Teste mal obs klappt.
Ups, das war wohl'n bischen zu lang f?rs Forum. Naja. Du findest dich schon zurecht.
Ach ?brigens. Nimm den ersten Patch raus!

Gru?
Hen
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
artikelbild

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus



Alle Zeitangaben in WEZ +1. Es ist jetzt 07:51 Uhr.

Copyright © 2011 xt:Commerce GmbH / xt:Commerce International Ltd. - All Rights Reserved

xt:Commerce is a SafeCharge brand