Hallo,
relativ einfach... der Shop wird ja mit unzähligen Content Blöcken ausgeliefert. Hiervon wird
ja in der Regel nur ein Bruchteil später im Shop verwendet... eines dieser nicht verwendeten
Blöck-Systeme schreibst du dir einfach um...
Für die Datenbankabfrage würde ich das Modul neue produkte verwenden
~/shop/includes/moduels/new_products.php
Code: Alles auswählen
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );
if (!is_numeric(MAX_DISPLAY_NEW_PRODUCTS)) return false;
if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$sql = "SELECT p.products_id, pd.products_name, p.products_image, p.products_tax_class_id,
p.products_price, p.products_base_price, p.products_base_unit, p.products_discount_allowed,
substring(pd.products_description, 1, 150) AS products_description,
IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price
FROM " . $oosDBTable['products] . " p,
" . $oosDBTable['products_description] . " pd LEFT JOIN
" . $oosDBTable['specials] . " s ON pd.products_id = s.products_id
WHERE p.products_status >= '1'
AND p.products_id = pd.products_id
AND pd.products_languages_id = '" . intval($nLanguageID) . "'
ORDER BY p.products_date_added DESC";
} else {
$sql = "SELECT DISTINCT p.products_id, pd.products_name, p.products_image, p.products_tax_class_id,
p.products_price, p.products_base_price, p.products_base_unit, p.products_discount_allowed,
substring(pd.products_description, 1, 150) AS products_description,
IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price
FROM " . $oosDBTable['products] . " p,
" . $oosDBTable['products_description] . " pd LEFT JOIN
" . $oosDBTable['specials] . " s ON pd.products_id = s.products_id,
" . $oosDBTable['products_to_categories] . " p2c,
" . $oosDBTable['categories] . " c
WHERE p.products_id = p2c.products_id
AND pd.products_id = p2c.products_id
AND pd.products_languages_id = '" . intval($nLanguageID) . "'
AND p2c.categories_id = c.categories_id
AND c.parent_id = '" . intval($new_products_category_id) . "'
AND p.products_status >= '1'
ORDER BY p.products_date_added DESC";
}
$new_products_result = $db->SelectLimit($sql, MAX_DISPLAY_NEW_PRODUCTS);
$new_products_array = array();
while ($new_products = $new_products_result->fields) {
$new_product_price = '';
$new_product_special_price = '';
$new_max_product_discount = 0;
$new_product_discount_price = '';
$new_base_product_price = '';
$new_base_product_special_price = '';
$new_special_price = '';
$new_product_price = $oCurrencies->display_price($new_products['products_price], oos_get_tax_rate($new_products['products_tax_class_id]));
$new_special_price = $new_products['specials_new_products_price];
if (oos_is_not_null($new_special_price)) {
$new_product_special_price = $oCurrencies->display_price($new_special_price, oos_get_tax_rate($new_products['products_tax_class_id]));
} else {
$new_max_product_discount = min($new_products['products_discount_allowed],$_SESSION['member]->group['discount]);
if ($new_max_product_discount != 0 ) {
$new_special_price = $new_products['products_price]*(100-$new_max_product_discount)/100;
$new_product_discount_price = $oCurrencies->display_price($new_special_price, oos_get_tax_rate($new_products['products_tax_class_id]));
}
}
if ($new_products['products_base_price] != 1) {
$new_base_product_price = $oCurrencies->display_price($new_products['products_price] * $new_products['products_base_price], oos_get_tax_rate($new_products['products_tax_class_id]));
if ($new_special_price != '') {
$new_base_product_special_price = $oCurrencies->display_price($new_special_price * $new_products['products_base_price], oos_get_tax_rate($new_products['products_tax_class_id]));
}
}
$new_products_array[] = array('products_id' => $new_products['products_id],
'products_image' => $new_products['products_image],
'products_name' => $new_products['products_name],
'products_description' => oos_remove_tags($new_products['products_description]),
'products_base_price' => $new_products['products_base_price],
'products_base_unit' => $new_products['products_base_unit],
'new_product_price' => $new_product_price,
'new_product_special_price' => $new_product_special_price,
'new_max_product_discount' => $new_max_product_discount,
'new_product_discount_price' => $new_product_discount_price,
'new_base_product_price' => $new_base_product_price,
'new_base_product_special_price' => $new_base_product_special_price,
'new_special_price' => $new_special_price);
$new_products_result->MoveNext();
}
$smarty->assign(array('block_heading_new_products' => sprintf($aLang['table_heading_new_products], strftime('%B')),
'new_products_array' => $new_products_array));
und mir dies reduzieren auf