Jump to content
xt:Commerce Community Forum

Artikelbild Name


Ape50

Recommended Posts

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:

Link to comment
Share on other sites

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_name,

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'];

}

Link to comment
Share on other sites

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.

:cool:

Quoted post

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

Link to comment
Share on other sites

Originally posted by hubbabubba@Aug 31 2005, 08:12 AM

Habs auf die schnelle nicht getestet. Probier mal aus.

Quoted post

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

<?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); [url]www.oscommerce.com[/url]

(c) 2003 nextcommerce (categories.php,v 1.37 2003/08/18); [url]www.nextcommerce.org[/url]

Released under the GNU General Public License

--------------------------------------------------------------

Third Party contribution:

Enable_Disable_Categories 1.3 Autor: Mikel Williams | [email][email protected][/email]

New Attribute Manager v4b Autor: Mike G | [email][email protected][/email] | http://downloads.ephing.com

Category Descriptions (Version: 1.5 MS2) Original Author: Brian Lowe <[email protected]> | Editor: Lord Illicious <[email protected]>

Customers Status v3.x (c) 2002-2003 Copyright Elari [email][email protected][/email] | [url]www.unlockgsm.com/dload-osc/[/url] | 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_statuses();

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['listing_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[$language_id]));

if (ALLOW_CATEGORY_DESCRIPTIONS == 'true') {

$sql_data_array = array('categories_name' => xtc_db_prepare_input($_POST['categories_name'][$language_id]),

'categories_heading_title' => xtc_db_prepare_input($_POST['categories_heading_title'][$language_id]),

'categories_description' => xtc_db_prepare_input($_POST['categories_description'][$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_description'][$language_id]),

'categories_meta_keywords' => xtc_db_prepare_input($_POST['categories_meta_keywords'][$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_available']);

$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_statuses();

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_allowed']),

'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_filename) ) {

unlink(DIR_FS_CATALOG_ORIGINAL_IMAGES.$pn_filename);

}

rename( DIR_FS_CATALOG_ORIGINAL_IMAGES.$products_image_name,

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_PRECISION);

}

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_staffel_' . $group_data[$col]['STATUS_ID']]);

$staffelpreis = xtc_db_prepare_input($_POST['products_price_staffel_' . $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_PRECISION);

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'][$language_id]),

'products_description' => xtc_db_prepare_input($_POST['products_description_'.$language_id]),

'products_short_description' => xtc_db_prepare_input($_POST['products_short_description_'.$language_id]),

'products_url' => xtc_db_prepare_input($_POST['products_url'][$language_id]),

'products_meta_title' => xtc_db_prepare_input($_POST['products_meta_title'][$language_id]),

'products_meta_description' => xtc_db_prepare_input($_POST['products_meta_description'][$language_id]),

'products_meta_keywords' => xtc_db_prepare_input($_POST['products_meta_keywords'][$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_description']) . "',

'" . 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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

?hhmm Sorry mein Fehler, ist ja die selbe datei. War ich neben meinen Schuhen...

JUHU es geht an alles die auch so etwas Suchen, oder auch den XTC Shop f?r gro?e projekte nutzen m?chten. Macht diesen Hack bei euch rein...

Danke an dich :wub: hubbabubba :laugh: :laugh: :laugh:

So etwas habe ich schon lange gesucht. Danke Danke Danke Danke Danke Danke Danke und nochmal Danke.... Hoffentlich kann ich auch ?rgend wann mal jemand so helfen. Danke

Link to comment
Share on other sites

Hallo

Eine Funktion geht leider nicht mehr oder besser gesagt wenn ich bei dem Artikel Preis den Preis ?ndere z.B von 2 EUR auf 3 EUR kommt dieses Fehler. Wenn ich die Artikelbeschreibung ?ndere geht alles ohne Probleme.

Hier der Fehler:

bbb

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/web302/html/Shop/admin/categories.php:315) in /var/www/html/web302/html/Shop/admin/includes/functions/general.php on line 146

Link to comment
Share on other sites

Originally posted by Ape50@Aug 31 2005, 04:48 PM

bbb

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/web302/html/Shop/admin/categories.php:315) in /var/www/html/web302/html/Shop/admin/includes/functions/general.php on line 146

Quoted post

Genau Zeile 315. Ne Kontrollmeldung vergessen rauszunehmen.

echo "bbb";

Herausl?schen bitte.

Gru?

Hen

Link to comment
Share on other sites

Wie du richtig bemerkst, ist das ein "Hack". Hab angst, da? da noch'n Wurm drin ist und ich waschkorbweise Beschwerden bekomme.

Mache bitte vorl?ufig sorgf?ltigst Sicherungen und etwas ?fter als sonst. Sicherungen deines "images" Ordners und der Datenbank.

Diesen Hack k?nnte man auch zum Dowload anbieten f?r die, die das nicht selber machen wollen.

Wenn andere das auch wollen. Und alles l?uft. Bittesch?n.

so long

Gru?

Hen

Link to comment
Share on other sites

  • 1 month later...

Hallo, ich habe da noch ein Problem. Also ich lade ein Artikelbild in den Artikel rein. Es funktioniert nat?rlich SUPER. Nun wenn ich jedoch wieder ein anderes Bild rein haben m?chte lade ich das nat?rlich auch wieder in den Artikel rein.

Aber wenn ich jetzt reinschaue Setzt der Shop dieses mal das Bild an mit dem Artikel-ID Name aber jedoch dann mit JPG obwohl es jpg ist....! Nun habe ich zwar das neue Bild drauf aber auf meinem Server sind nun zwei Bilder. Und wenn ich das hochrechne sind das dann sehr viele Bilder doppelt.

Noch eine Frage gibt es etwas damit man das durchlaufen lassen kann das es die alten Bilder l?scht von denen gar kein Artikel mehr im Shop ist. Wenn ich z.B einen Artikel L?sche ist ja das Bild immer noch auf meinem Server.... Obwohl der Artikel gel?scht wurde...

Vielen Dank an euch im Voraus....

Link to comment
Share on other sites

  • 3 months later...

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...