INSERT INTO configuration (configuration_id, configuration_key, configuration_value, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'LESS_QTY_ALLOW_CHECKOUT', 'false', 9, 6, NULL, '', NULL, 'xtc_cfg_select_option(array(\'true\', \'false\'),'); INSERT INTO configuration (configuration_id, configuration_key, configuration_value, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'STOCK_MARK_PRODUCT_LESS_QTY', '**', 9, 7, NULL, '', NULL, NULL); INSERT INTO configuration (configuration_id, configuration_key, configuration_value, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'LESS_QTY_CORRECT_QTY', 'false', 9, 8, NULL, '', NULL, 'xtc_cfg_select_option(array(\'true\', \'false\'),'); INSERT INTO configuration (configuration_id, configuration_key, configuration_value, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'LESS_QTY_ADD_CART', 'false', 9, 9, NULL, '', NULL, 'xtc_cfg_select_option(array(\'true\', \'false\'),');
inc/xtc_check_qty.inc.php
inc/xtc_get_products_min_qty.inc.php
includes/pricecalc.js.php
lang/german/admin/configuration.php
ca. Zeile 342
define('STOCK_REORDER_LEVEL_DESC' , 'Ab welcher Stückzahl soll diese Meldung erscheinen?');danach einfügen
define('LESS_QTY_ALLOW_CHECKOUT_TITLE', 'Einkaufen unter der Mindestmenge erlauben'); define('LESS_QTY_ALLOW_CHECKOUT_DESC' , 'Möchten Sie auch dann erlauben zu bestellen, wenn bestimmte Artikel unterhalb der Mindestmenge liegen?'); define('STOCK_MARK_PRODUCT_LESS_QTY_TITLE', 'Kennzeichnung Mindestmenge'); define('STOCK_MARK_PRODUCT_LESS_QTY_DESC' , 'Dem Kunden kenntlich machen, welche Artikel nicht der Mindestmenge entsprechen.'); define('LESS_QTY_CORRECT_QTY_TITLE', 'Änderungen korrigieren'); define('LESS_QTY_CORRECT_QTY_DESC' , 'Wenn der Kunde die Menge im Warenkorb unter die Mindestmenge ändert, den Wert automatisch auf die Mindestmenge korrigieren'); define('LESS_QTY_ADD_CART_TITLE', 'Menge korrigieren'); define('LESS_QTY_ADD_CART_DESC' , 'Wenn der Kunde eine Menge unterhalb der Mindestmenge in den Korb legt, den Wert automatisch auf die Mindestmenge korrigieren');
lang/german/german.php
am Ende (vor dem ?>) einfügen
define('TOO_LESS_QTY_CANT_CHECKOUT', 'Die mit ** markierten Artikel sind leider nicht in der von ihnen gewüschten Anzahl erhältlich.<br />Bitte beachten sie die Mindestmengen und erhöhen sie die Bestellmenge für die gekennzeichneten Artikel. Vielen Dank!'); define('TEXT_MIN_QTY_TOTAL', 'Gesamtpreis:'); define('TEXT_MIN_QTY_NOT_REACHED', 'Mindestmenge noch nicht erreicht!');
includes/application_top.php
ca. Zeile 159:
require_once (DIR_FS_INC.'xtc_js_lang.php');danach einfügen
require_once (DIR_FS_INC.'xtc_check_qty.php');
includes/header.php
ca. Zeile 259, aus:
<?php } ?> </head>wird
<?php } if (strstr($PHP_SELF, FILENAME_PRODUCT_INFO )) { require('includes/pricecalc.js.php'); }?> </head>
includes/classes/product.php
in "function getGraduated", ca. Zeile 305:
while ($staffel_values = xtc_db_fetch_array($staffel_query, true)) {danach einfügen
if ($staffel_values['quantity'] !=1 && $staffel_values['personal_offer'] > 0)
includes/classes/xtcPrice.php
ca. Zeile 99
if ($sPrice = $this->xtcGetGraduatedPrice($pID, $qty)) return $this->xtcFormatSpecialGraduated($pID, $this->xtcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus, $pID);ändern in:
if ($sPrice = $this->xtcGetGraduatedPrice($pID, $qty)) { if ($pPrice == 0) $pPrice = $this->xtcAddTax($sPrice, $products_tax); return $this->xtcFormatSpecialGraduated($pID, $this->xtcAddTax($sPrice, $products_tax), $pPrice, $format, $vpeStatus, $pID); }
ca. Zeile 154, Funktion xtcGetGraduatedPrice, Funktion vollständig ersetzen durch:
function xtcGetGraduatedPrice($pID, $qty) { if (GRADUATED_ASSIGN == 'false') if (xtc_get_qty($pID) > $qty) $qty = xtc_get_qty($pID); //if (!is_int($this->cStatus['customers_status_id']) && $this->cStatus['customers_status_id']!=0) $this->cStatus['customers_status_id'] = DEFAULT_CUSTOMERS_STATUS_ID_GUEST; $graduated_price_query = "SELECT max(quantity) as qty FROM personal_offers_by_customers_status_".$this->actualGroup." WHERE products_id='".$pID."' AND quantity<='".$qty."'"; $graduated_price_query = xtDBquery($graduated_price_query); $graduated_price_data = xtc_db_fetch_array($graduated_price_query, true); if ($graduated_price_data['qty']) { $graduated_price_query = "SELECT personal_offer FROM personal_offers_by_customers_status_".$this->actualGroup." WHERE products_id='".$pID."' AND quantity='".$graduated_price_data['qty']."'"; $graduated_price_query = xtDBquery($graduated_price_query); $graduated_price_data = xtc_db_fetch_array($graduated_price_query, true); $sPrice = $graduated_price_data['personal_offer']; if ($sPrice == 0.00) { $graduated_price_query = "SELECT personal_offer FROM personal_offers_by_customers_status_".$this->actualGroup." WHERE products_id='".$pID."' AND quantity > '1' ORDER BY quantity"; $graduated_price_query = xtDBquery($graduated_price_query); $graduated_price_data = xtc_db_fetch_array($graduated_price_query, true); $sPrice = $graduated_price_data['personal_offer']; } if (isset($sPrice) && $sPrice != 0.00) return $sPrice; } return false; }
ca. Zeile 300, Funktion xtcFormat, Funktion vollständig ersetzen durch:
function xtcFormat($price, $format, $tax_class = 0, $curr = false, $vpeStatus = 0, $pID = 0, $decimal = 0, $quantity = 1) { if ($curr) $price = $this->xtcCalculateCurr($price); if ($tax_class != 0) { $products_tax = $this->TAX[$tax_class]; if ($this->cStatus['customers_status_show_price_tax'] == '0') $products_tax = ''; $price = $this->xtcAddTax($price, $products_tax, $decimal); } if ($quantity > 1) { $price = round($price, 4) * $quantity; } if ($decimal > $this->currencies[$this->actualCurr]['decimal_places']) { $decimal = (round($price, $this->currencies[$this->actualCurr]['decimal_places']) == $price)?$this->currencies[$this->actualCurr]['decimal_places']:$decimal; } else { $decimal = $this->currencies[$this->actualCurr]['decimal_places']; } if ($format) { $Pprice = number_format($price, $decimal, $this->currencies[$this->actualCurr]['decimal_point'], $this->currencies[$this->actualCurr]['thousands_point']); $Pprice = $this->checkAttributes($pID).$this->currencies[$this->actualCurr]['symbol_left'].' '.$Pprice.' '.$this->currencies[$this->actualCurr]['symbol_right']; if ($vpeStatus == 0) { return $Pprice; } else { return array ('formated' => $Pprice, 'plain' => $price); } } else { return round($price, $decimal); } }
includes/modules/order_details_cart.php
ca. Zeile 47-51:if (STOCK_CHECK == 'true') { $mark_stock = xtc_check_stock($products[$i]['id'], $products[$i]['quantity']); if ($mark_stock) $_SESSION['any_out_of_stock'] = 1; }danach einfügen:
$min_qty = xtc_check_qty($products[$i]['id'], $products[$i]['quantity']); if ($min_qty) $_SESSION['any_piece_too_less'] = 1;
ca. Zeile 61
$module_content[$i] = array ('PRODUCTS_NAME' => $products[$i]['name'].$mark_stock, 'PRODUCTS_QTY'...ändern in
$module_content[$i] = array ('PRODUCTS_NAME' => $products[$i]['name'].$mark_stock.$min_qty, 'PRODUCTS_QTY'...
includes/modules/product_info.php
ca. Zeile 45:
xtc_db_query("update ".TABLE_PRODUCTS_DESCRIPTION." set products_viewed = products_viewed+1 where products_id = '".$product->data['products_id']."' and language_id = '".$_SESSION['languages_id']."'");danach einfügen:
$graduated = array(); $graduated_price_query = xtDBquery("SELECT quantity, personal_offer FROM personal_offers_by_customers_status_". $_SESSION['customers_status']['customers_status_id']." WHERE products_id='".$product->data['products_id']."' ORDER BY quantity"); $count = 0; while ($graduated_price_data = xtc_db_fetch_array($graduated_price_query, true)) { if ($graduated_price_data['personal_offer'] > 0.00){ $graduated[$count] = array('ID' => $count, 'VALUE' => $graduated_price_data['quantity']); $count++; $graduated[$count] = array('ID' => $count, 'VALUE' => $xtPrice->xtcFormat($graduated_price_data['personal_offer'], $format = false,$product->data['products_tax_class_id'])); $count++; } } if (sizeof($graduated)==0) { $graduated[0] = array('ID' => 0, 'VALUE' => 1); $graduated[1] = array('ID' => 1, 'VALUE' => $xtPrice->xtcFormat($product->data['products_price'], $format = false,$product->data['products_tax_class_id'])); } $info_smarty->assign('graduated', $graduated);
ca. Zeile 70 + 74:
$info_smarty->assign('ADD_QTY', xtc_draw_input_field('products_qty', '1', 'size="3"').' '.xtc_draw_hidden_field('products_id', $product->data['products_id']));ändern in:
$info_smarty->assign('ADD_QTY', xtc_draw_input_field('products_qty', $graduated[0]['VALUE'], 'size="8" onKeyUp="showPrice(this.form);"').' '.xtc_draw_hidden_field('products_id', $product->data['products_id']));
includes/cart_actions.php
ca. Zeile 67
case 'update_product' :danach einfügen
require_once(DIR_FS_INC . 'xtc_get_products_min_qty.inc.php');
ca. Zeile 80
if ($_POST['cart_quantity'][$i] > MAX_PRODUCTS_QTY) $_POST['cart_quantity'][$i] = MAX_PRODUCTS_QTY;ändern in
if ($_POST['cart_quantity'][$i] > MAX_PRODUCTS_QTY) { $_POST['cart_quantity'][$i] = MAX_PRODUCTS_QTY; } if (LESS_QTY_CORRECT_QTY == 'true' && ($min_qty = xtc_get_products_min_qty((int)$_POST['products_id'][$i])) > $_POST['cart_quantity'][$i]) { $_POST['cart_quantity'][$i] = $min_qty; }
ca. Zeile 101
case 'add_product' : if (isset ($_POST['products_id']) && is_numeric($_POST['products_id'])) { if ($_POST['products_qty'] > MAX_PRODUCTS_QTY) $_POST['products_qty'] = MAX_PRODUCTS_QTY;ändern in
case 'add_product' : if (isset ($_POST['products_id']) && is_numeric($_POST['products_id'])) { if ($_POST['products_qty'] > MAX_PRODUCTS_QTY) { $_POST['products_qty'] = MAX_PRODUCTS_QTY; } require_once(DIR_FS_INC . 'xtc_get_products_min_qty.inc.php'); if (LESS_QTY_ADD_CART == 'true' && ($min_qty = xtc_get_products_min_qty((int)$_POST['products_id'])) > $_POST['products_qty']) { $_POST['products_qty'] = $min_qty; }
templates/xtc4/module/product_info/product_info_v1.html
Zeile 1:
{config_load file="$language/lang_$language.conf" section="product_info"}danach einfügen:
<script language="javascript"> <!-- initPriceArray(); //--> </script> {foreach name=aussen item=graduated_data from=$graduated} <script language="javascript"> <!-- setPriceArray({$graduated_data.ID},{$graduated_data.VALUE}); //--> </script> {/foreach}
ca. Zeile 95-98:
<tr> <td>{$ADD_QTY}</td> <td>{$ADD_CART_BUTTON}</td> </tr>danach einfügen:
<tr> <td colspan="2"> <div id="NEWprice"></div> </td> </tr>vor
{$FORM_END}einfügen
<script type="text/javascript">showPrice(document.forms['cart_quantity']);</script>
templates/xtc4/module/shopping_cart.html
ca. Zeile 12
{if $info_message!=''} <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="main"> </td> </tr> <tr> <td class="errorBox" align="center">{$info_message}</td> </tr> </table> {/if}danach einfügen
{if $qty_message!=''} <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="main"> </td> </tr> <tr> <td class="errorBox" align="center">{$qty_message}</td> </tr> </table> {/if}
shopping_cart.php
ca. Zeile 43:
$_SESSION['any_out_of_stock'] = 0;danach einfügen:
$_SESSION['any_piece_too_less'] = 0;
Zeile 80-96:
if (STOCK_CHECK == 'true') { if ($_SESSION['any_out_of_stock'] == 1) { if (STOCK_ALLOW_CHECKOUT == 'true') { // write permission in session $_SESSION['allow_checkout'] = 'true'; $smarty->assign('info_message', OUT_OF_STOCK_CAN_CHECKOUT); } else { $_SESSION['allow_checkout'] = 'false'; $smarty->assign('info_message', OUT_OF_STOCK_CANT_CHECKOUT); } } else { $_SESSION['allow_checkout'] = 'true'; } }danach einfügen:
if ($_SESSION['any_piece_too_less'] == 1 && LESS_QTY_ALLOW_CHECKOUT == 'false') { $smarty->assign('qty_message', TOO_LESS_QTY_CANT_CHECKOUT); $_SESSION['allow_checkout'] = 'false'; }
Dateinamen sind blau
Datenbankanweisungen sind rot
alter Code ist grün
neuer Code ist gelb
Im Adminbereich als Staffelpreise die Preise hinterlegen, die gewünscht sind. Dabei den Gruppenpreis und den Grundpreis leer lassen(bzw. 0). Dann wird der Artikel erst ab der ersten angegebenen Menge verkauft und berechnet. Die Einstellungen für Kennzeichnung und ob die Mengen korrigiert werden sollen oder nicht, finden sich im Adminbereich unter "Lagerverwaltungs Optionen". Das Javascript-Modul berechnet den aktuellen Preis und gibt eine Meldung aus, wenn die Menge unter der Mindestmenge liegt.