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);
Update eines frisch installierten/nicht veränderten Shops:
Dazu einfach alle Dateien aus dem Verzeichnis "install" in die entsprechenden Verzeichnisse im Shop kopieren.
inc/xtc_check_min_qty.inc.php
inc/xtc_get_products_min_qty.inc.php
includes/pricecalc.js.php
includes/header.php
includes/classes/product.php
includes/classes/xtcPrice.php
includes/modules/order_details_cart.php
includes/modules/product_info.php
templates/xtc4/module/product_info/product_info_v1.html
shopping_cart.php
Update eines modifizierten Shops:
Dazu einfach folgende Dateien aus dem Verzeichnis "install" in die entsprechenden Verzeichnisse im Shop kopieren.
inc/xtc_check_min_qty.inc.php
inc/xtc_get_products_min_qty.inc.php
includes/pricecalc.js.php
lang/german/admin/configuration.php
Zeile342
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.');
includes/header.php
Zeile 259, aus:
<?php } ?>
</head>
wird
<?php }
if (strstr($PHP_SELF, FILENAME_PRODUCT_INFO )) {
require('includes/pricecalc.js.php');
}?>
</head>
includes/classes/product.php
Zeile 331-338:
$staffel_query = xtDBquery("SELECT
quantity,
personal_offer
FROM
".TABLE_PERSONAL_OFFERS_BY.(int) $_SESSION['customers_status']['customers_status_id']."
WHERE
products_id = '".$this->pID."'
ORDER BY quantity ASC");
ändern in:
$staffel_query = xtDBquery("SELECT
quantity,
personal_offer
FROM
".TABLE_PERSONAL_OFFERS_BY.(int) $_SESSION['customers_status']['customers_status_id']."
WHERE
products_id = '".$this->pID."'
AND quantity > '1'
ORDER BY quantity ASC");
includes/classes/xtcPrice.php
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);
}
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; }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
Zeile 49-53, nach:
if (STOCK_CHECK == 'true') {
$mark_stock = xtc_check_stock($products[$i]['id'], $products[$i]['quantity']);
if ($mark_stock)
$_SESSION['any_out_of_stock'] = 1;
}
einfügen:
$min_qty = xtc_check_qty($products[$i]['id'], $products[$i]['quantity']);
if ($min_qty)
$_SESSION['any_piece_too_less'] = 1;
includes/modules/product_info.php
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);
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']));
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}
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>
shopping_cart.php
Zeile43:
$_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';
}
Diese Anleitung:
Dateinamen 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. Das Javascript-Modul berechnet den aktuellen Preis und gibt eine Meldung aus, wenn die Menge unter der Mindestmenge liegt.