Hier eine Möglichkeit wie man bei seinen Produktbilden eine Flag setzen kann, ob der Artikel neu ist oder um wie viel Prozent dieser reduziert wurde:
Für Shopversion 1.05 (Für 1.06 hängt am Ende des Beitrags eine neue Anleitung):dazu in der "/includes/classes/product.php" vor "return array ('PRODUCTS_NAME' =>...." (ca. Zeile 415) das hier einfügen/ergänzen:
if ($array['products_date_added'] != '0000-00-00 00:00:00' && MAX_DISPLAY_NEW_PRODUCTS_DAYS
!= '0') { $date_new_products = date("Y-m-d", mktime(1, 1, 1, date("m"), date("d") - MAX_DISPLAY_NEW_PRODUCTS_DAYS
, date("Y"))); if ($date_new_products." 00:00:00"> $array['products_date_added']) { $product_isnew = ''; //Produkt ist alt } else { $product_isnew = '1'; //Produkt ist neu }} in das Konstrukt "return array ('PRODUCTS_NAME' =>...." das hier eingfügen:
'PRODUCTS_OLDNEW'=>$product_isnew,
'PRODUCTS_PRICE_P' => $products_price['percent'],
In Datei "/includes/classes/xtcPrice.php" suchen:
function xtcFormatSpecial
($pID, $sPrice, $pPrice, $format, $vpeStatus = 0) { if ($format) {//BOF - Dokuman - 2009-06-03 - show 'ab' / 'from' for the lowest price, not for the highest! //$price = '<span class="productOldPrice">'.INSTEAD.$this->xtcFormat($pPrice, $format).'</span><br />'.ONLY.$this->checkAttributes($pID).$this->xtcFormat($sPrice, $format); //BOF - vr - 2009-12-11 avoid div / 0 if product price is 0 if (!isset($pPrice) || $pPrice == 0) $discount = 0; else $discount = ($pPrice - $sPrice) / $pPrice * 100; $price = '<span class="productOldPrice"><small>'.INSTEAD
.'</small><del>'.$this->xtcFormat($pPrice, $format).'</del></span><br />'.ONLY
.$this->checkAttributes($pID).$this->xtcFormat($sPrice, $format).'<br /><small>'.YOU_SAVE
.round($discount).' % /'.$this->xtcFormat($pPrice-$sPrice, $format).'</small>'; //BOF - vr - 2009-12-11 avoid div / 0 if product price is 0//EOF - Dokuman - 2009-06-03 - show 'ab' / 'from' for the lowest price, not for the highest! if ($vpeStatus == 0) { return $price; } else { return array ('formated' => $price, 'plain' => $sPrice); } } else { return round($sPrice, $this->currencies[$this->actualCurr]['decimal_places']); } } und ersetzen mit:
function xtcFormatSpecial
($pID, $sPrice, $pPrice, $format, $vpeStatus = 0) { if ($format) { if (!isset($pPrice) || $pPrice == 0) $discount = 0; else $discount = ($pPrice - $sPrice) / $pPrice * 100; $price = '<span class="productOldPrice"><small>'.$this->xtcFormat($pPrice, $format).'</small></span><br/>'.$this->checkAttributes($pID).$this->xtcFormat($sPrice, $format); $price_perc = round($discount); if ($vpeStatus == 0) { return $price; } else { return array ('formated' => $price, 'plain' => $sPrice, 'percent' => $price_perc); } } else { return round($sPrice, $this->currencies[$this->actualCurr]['decimal_places']); } } und nun sollte man die neuen Variablen PRODUCTS_OLDNEW & PRODUCTS_PRICE_P in den Templates verwenden können:
[template]/module/product_listing/....html
[template]/module/new_products*.html
[template]/module/specials.html
[template]/module/cross_selling.html
an gewünschter Stelle im Template das hier einfügen:
{if $module_data.PRODUCTS_PRICE_P != ''}
<div class="product_special">{$module_data.PRODUCTS_PRICE_P}</div>
{/if}
{if $module_data.PRODUCTS_OLDNEW != '' && $module_data.PRODUCTS_PRICE_P == ''}
<div class="product_isnew"></div>
{/if}
In der "/includes/modules/default.php" in ca. Z. 240 nach dem:
$listing_sql = "select DISTINCT p.products_fsk18,
p.products_shippingtime,
p.products_model,
mal das einfügen:
p.products_date_added,
in der ca. Z. 309 nach:
$listing_sql = "select p.products_fsk18,
p.products_shippingtime,
p.products_model,
das einfügen:
p.products_date_added,
in der Z.388 nach:
$listing_sql = "select p.products_fsk18,
p.products_shippingtime,
das einfügen:
p.products_date_added,
und der Z. 466 nach:
$listing_sql = "select p.products_fsk18,
p.products_shippingtime,
p.products_model,
das einfügen:
p.products_date_added,
Zusätzlich müssen noch die entsprechenden CSS-Classes ("product_special", "product_isnew") eingerichtet werden damit ein entsprechendes Bild über das Produktbild gelegt wird. Anbei noch ein Screenshot wie es ausschauen kann...
[ Für Gäste sind keine Dateianhänge sichtbar ]
[
EDIT GTB 20.05.2011: Code formatiert.]
[
EDIT Tomcraft 09.06.2011: Code erweitert.]
[
EDIT franky_n 10.12.2011: Code erweitert.]
[
EDIT franky_n 11.12.2011: Code erweitert.]
[
EDIT Tomcraft 26.02.2013: Anleitung für Shopversion 1.06 ergänzt, danke an ralph_84.]
[
EDIT Tomcraft 19.12.2013: Anleitung für Shopversion 1.06 aktualisiert, danke an ralph_84.]
[
EDIT Tomcraft 19.12.2013: Fehler in Anleitung für Shopversion 1.06
korrigiert.]
Linkback: https://www.modified-shop.org/forum/index.php?topic=13054.0