PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Automatische Artikelnummervergabe + Default Werte setzen



cybermailer
08.04.2019, 13:10
Hallo,

hoffe auch einwenig Hilfe wie ich das Ganze angehe.

Und zwar möchte ich dass die Artikelnummer automatisch vergeben wird in Ableitung der Products_id. Außerdem würde ich gerne einige Felder direkt per Default befüllen z.B. Stückzahl für jeden Artikel ist 10.

Wie macht man das unter GX3 in der aktuellen Version?

Danke für eure Hilfe!

masterronnow
09.04.2019, 13:04
Hallo,

bisher gibt es noch keine Update sichere Lösung dafür und von Gambio selber leider noch immer keine integrierte Funktion.

Schau aber mal hier, ob das noch funktioniert: https://www.gambio.de/forum/threads/automatische-artikelnummernvergabe.6223/page-3

cybermailer
13.04.2019, 18:47
Vielen Dank. Basierend auf Stefans Code von Gambio

Quelle:
https://www.gambio.de/forum/threads/automatische-artikelnummernvergabe.6223/page-3

habe ich das ganze wie folgt gelöst:

In der Datei: /admin/html/compatibility/product/product_master_data.inc.php

Folgenden Code gesucht:


<div class="span6">
<?php echo xtc_draw_input_field('products_model', $pInfo->products_model); ?>
</div>

geändert in:


<div class="span6">
<?php

//set auto product_id if not already set - prefix can be changed
if(!$pInfo->products_model) {
$my_product_id_query = xtc_db_query("SELECT MAX(products_id)
AS products_id
FROM " . TABLE_PRODUCTS . "
");
$my_product_id = xtc_db_fetch_array($my_product_id_query);

$my_product_id = $my_product_id["products_id"] + 1;
$my_product_id = str_pad($my_product_id, 4 ,'0', STR_PAD_LEFT); //fill previouse positions of number with 0. i.e. 10 -> 0010
} else {
//product_id exists
$my_product_id = $pInfo->products_model;
}

//echo xtc_draw_input_field('products_model', $pInfo->products_model); //original code
echo xtc_draw_input_field('products_model', "A".$my_product_id);

?>
</div>

Getestet mit: Mit Gambio GX 3.11.2.0

Domazet
18.01.2020, 17:26
Funktioniert mit Gambio 3.15.2.1 nicht

LG

Domazet
19.01.2020, 16:44
Doch, es funktioniert, ich habe Fehler gemacht, Sorry

KlausK
19.01.2020, 20:34
Vielen Dank für deine Korrektur :D