Sie sparen X % anzeigen lassen bei UVP

[QUOTE=Hebsacker;86808]hier stehts:

http://www.oxid-esales.com/forum/showthread.php?t=1299#post7517[/QUOTE]

Ja, so habe ich das gemacht:

Im ordner:
out\basic pl\page\details.tpl und im Ordner
out\basic pl\page\details\details.tpl

    [{oxhasrights ident="SHOWARTICLEPRICE"}]
        <div class="cost">
            [{if $product->getFTPrice() > $product->getFPrice()}]
                <b class="old">[{ oxmultilang ident="DETAILS_REDUCEDFROM" }] <del>[{ $product->getFTPrice()}] [{ $currency->sign}]</del></b>
                <span class="desc">[{ oxmultilang ident="DETAILS_REDUCEDTEXT" }]</span><br>
                <sub class="only">[{ oxmultilang ident="DETAILS_NOWONLY" }]</sub>
            [{/if}]
            [{if $product->getFPrice() }]
                <big class="price pricerange" id="test_product_price">[{ $product->getFPrice() }] [{ $currency->sign}]</big>
            [{/if}]
            [{oxifcontent ident="oxdeliveryinfo" object="oCont"}]
            <sup class="dinfo">
                [{assign var="_oPrice" value=$product->getPrice()}]
                [{if $_oPrice && $_oPrice->getVat() > 0 }]
                [{ oxmultilang ident="DETAILS_PLUSSHIPPING" }]
                [{else}]
                [{ oxmultilang ident="DETAILS_PLUSSHIPPING_PLUS" }]
                [{/if}]
                <a href="[{ $oCont->getLink() }]" rel="nofollow">[{ oxmultilang ident="DETAILS_PLUSSHIPPING2" }]</a></sup>
            [{/oxifcontent}]
        </div>
    [{/oxhasrights}]
    [{if $product->getFTPrice() or $product->getFPrice()|replace:",":"." < $product->oxarticles__oxprice->value }][{assign var="uvp" value=$product->getFTPrice()|replace:",":"."}][{assign var="price" value=$product->getFPrice()|replace:",":"."}][{if $product->oxarticles__oxtprice->value != 0}]Sie sparen [{math equation="( z / x ) * ( x - y)" x=$uvp y=$price z=100 format="%.0f"}]%[{/if}][{/if}]

und einmal so:

    [{oxhasrights ident="SHOWARTICLEPRICE"}]
        <div class="cost">
            [{if $product->getFTPrice() > $product->getFPrice()}]
                <b class="old">[{ oxmultilang ident="DETAILS_REDUCEDFROM" }] <del>[{ $product->getFTPrice()}] [{ $currency->sign}]</del></b>
                <span class="desc">[{ oxmultilang ident="DETAILS_REDUCEDTEXT" }]</span><br>
                <sub class="only">[{ oxmultilang ident="DETAILS_NOWONLY" }]</sub>
            [{/if}]
            [{if $product->getFPrice() }]
                <big class="price pricerange" id="test_product_price">[{ $product->getFPrice() }] [{ $currency->sign}]</big>
            [{/if}]
            [{oxifcontent ident="oxdeliveryinfo" object="oCont"}]
            <sup class="dinfo">
                [{assign var="_oPrice" value=$product->getPrice()}]
                [{if $_oPrice && $_oPrice->getVat() > 0 }]
                [{ oxmultilang ident="DETAILS_PLUSSHIPPING" }]
                [{else}]
                [{ oxmultilang ident="DETAILS_PLUSSHIPPING_PLUS" }]
                [{/if}]
                <a href="[{ $oCont->getLink() }]" rel="nofollow">[{ oxmultilang ident="DETAILS_PLUSSHIPPING2" }]</a></sup>
            [{/oxifcontent}]
        </div>
    [{if $product->getFTPrice() or $product->getFPrice()|replace:",":"." < $product->oxarticles__oxprice->value }][{assign var="uvp" value=$product->getFTPrice()|replace:",":"."}][{assign var="price" value=$product->getFPrice()|replace:",":"."}][{if $product->oxarticles__oxtprice->value != 0}]Sie sparen [{math equation="( z / x ) * ( x - y)" x=$uvp y=$price z=100 format="%.0f"}]%[{/if}][{/if}]
    [{/oxhasrights}]

So habe ich den Code eingefügt, aber wenn ich einen Rabbatierten Artikel aufrufe, dann zeigt er mir nicht an um wieviel % er günstiger ist.

[QUOTE=Wizzard;86809]Ja, so habe ich das gemacht:

Im ordner:
out\basic pl\page\details.tpl und im Ordner
out\basic pl\page\details\details.tpl
[/QUOTE]

Hier http://www.oxid-esales.com/forum/showthread.php?t=7266&page=2#post86829 schreibst du das du das Azure Theme benutzt, bist du womöglich einfach nur im falschen Ordner?

Abgesehen davon gehört eine solche Funktionalität nicht ins Template, besser hier eine eigene Klasse von oxarticle ableiten…

Ja ich nutze das Azure Theme, aber wo gebe ich den Code da an?

besser hier eine eigene Klasse von oxarticle ableiten…

Wie mache ich das genau?

[{capture append="oxidBlock_content"}]
  [{assign var="oDetailsProduct" value=$oView->getProduct()}]
  [{assign var="oPictureProduct" value=$oView->getPicturesProduct()}]
  [{assign var="currency" value=$oView->getActCurrency()}]
  [{assign var="sPageHeadTitle" value=$oDetailsProduct->oxarticles__oxtitle->value|cat:' '|cat:$oDetailsProduct->oxarticles__oxvarselect->value}]

    [{if $oView->getPriceAlarmStatus() == 1}]
        [{assign var="_statusMessage1" value="PAGE_DETAILS_THANKYOUMESSAGE1"|oxmultilangassign|cat:" "|cat:$oxcmp_shop->oxshops__oxname->value}]
        [{assign var="_statusMessage2" value="PAGE_DETAILS_THANKYOUMESSAGE2"|oxmultilangassign|cat:" "}]
        [{assign var="_statusMessage3" value="PAGE_DETAILS_THANKYOUMESSAGE3"|oxmultilangassign|cat:" "|cat:$oView->getBidPrice()|cat:" "|cat:$currency->sign|cat:" "}]
        [{assign var="_statusMessage4" value="PAGE_DETAILS_THANKYOUMESSAGE4"|oxmultilangassign}]
        [{include file="message/success.tpl" statusMessage=`$_statusMessage1``$_statusMessage2``$_statusMessage3``$_statusMessage4`}]
    [{elseif $oView-&gt;getPriceAlarmStatus() == 2}]
        [{assign var="_statusMessage" value="PAGE_DETAILS_WRONGVERIFICATIONCODE"|oxmultilangassign}]
        [{include file="message/error.tpl" statusMessage=$_statusMessage}]
    [{elseif $oView-&gt;getPriceAlarmStatus() === 0}]
        [{assign var="_statusMessage1" value="PAGE_DETAILS_NOTABLETOSENDEMAIL"|oxmultilangassign|cat:"&lt;br&gt; "}]
        [{assign var="_statusMessage2" value="PAGE_DETAILS_VERIFYYOUREMAIL"|oxmultilangassign}]
        [{include file="message/error.tpl" statusMessage=`$_statusMessage1``$_statusMessage2`}]
    [{/if}]

    &lt;div id="details"&gt;
        [{ if $oView-&gt;getSearchTitle() }]
          [{ assign var="detailsLocation" value=$oView-&gt;getSearchTitle()}]
        [{else}]
          [{foreach from=$oView-&gt;getCatTreePath() item=oCatPath name="detailslocation"}]
          [{if $smarty.foreach.detailslocation.last}]

            [{assign var="detailsLocation" value=$oCatPath-&gt;oxcategories__oxtitle-&gt;value}]
            [{/if}]
          [{/foreach}]
        [{/if }]


        [{* details locator  *}]
        [{assign var="actCategory" value=$oView-&gt;getActiveCategory()}]
        &lt;div id="overviewLink"&gt;
            &lt;a href="[{ $actCategory-&gt;toListLink }]" class="overviewLink"&gt;[{ oxmultilang ident="WIDGET_BREADCRUMB_OVERVIEW" }]&lt;/a&gt;
        &lt;/div&gt;
        &lt;h2 class="pageHead"&gt;[{$sPageHeadTitle|truncate:80}]&lt;/h2&gt;
        &lt;div class="detailsParams listRefine bottomRound"&gt;
            &lt;div class="pager refineParams clear" id="detailsItemsPager"&gt;
                [{if $actCategory-&gt;prevProductLink}]&lt;a id="linkPrevArticle" class="prev" href="[{$actCategory-&gt;prevProductLink}]"&gt;[{oxmultilang ident="DETAILS_LOCATOR_PREVIUOSPRODUCT"}]&lt;/a&gt;[{/if}]
                &lt;span class="page"&gt;
                   [{oxmultilang ident="DETAILS_LOCATOR_PRODUCT"}] [{$actCategory-&gt;iProductPos}] [{oxmultilang ident="DETAILS_LOCATOR_FROM"}] [{$actCategory-&gt;iCntOfProd}]
                &lt;/span&gt;
                [{if $actCategory-&gt;nextProductLink}]&lt;a id="linkNextArticle" href="[{$actCategory-&gt;nextProductLink}]" class="next"&gt;[{oxmultilang ident="DETAILS_LOCATOR_NEXTPRODUCT"}]&lt;/a&gt;[{/if}]
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div id="productinfo" itemscope itemtype="http://schema.org/Product"&gt;
            [{include file="page/details/inc/fullproductinfo.tpl"}]
        &lt;/div&gt;
    &lt;/div&gt;
    [{ insert name="oxid_tracker" title="DETAILS_PRODUCTDETAILS"|oxmultilangassign product=$oDetailsProduct cpath=$oView-&gt;getCatTreePath() }]
[{/capture}]
[{include file="layout/page.tpl" sidebar="Left"}]

So sieht es in der details.tpl vom Azure Theme aus

[QUOTE=Wizzard;86845]Wie mache ich das genau?[/QUOTE]

In aller Kürze:

Du erstellst dir eine neue Datei mit folgendem Inhalt:


<?php
class my_oxarticle extends my_oxarticle_parent {

	public function getSavingsPercent() {
    	return round((1 - $this->getPrice()->getBruttoPrice() / $this->getTPrice()->getBruttoPrice()) * 100); 
    }

}
?>

und speicherst die unter modules/wizzard/core/my_oxarticle.php.

Im Admin gibst du unter Stammdaten => Grundeinstellungen => System => Module folgendes ein:
oxarticle => wizzard/core/my_oxarticle
oder, falls da schon eine Zeile mit oxarticle steht, hängst du einfach &wizzard/core/my_oxarticle hinten dran.

Jetzt kannst du einfach im Template, z. B. in out\azure pl\page\details\inc\productmain.tpl an der gewünschten Stelle


Ihre Ersparnis beträgt [{ $oDetailsProduct->getSavingsPercent() }] %

einfügen.

Temp-Ordner leeren nicht vergessen!

Danke, ich habe mal alles ausgeführt, ausser den letzten Teil. Mit der productmain.tpl

Ich möchte den Rabatt dann über den Preis angezeigt bekommen in Blau und etwas grösserer Fetten Schrift.

[            [{block name="details_productmain_tprice"}]
                [{oxhasrights ident="SHOWARTICLEPRICE"}]
                    [{assign var="tprice" value=$oDetailsProduct->getTPrice() }]
[{assign var="regularprice" value=$oDetailsProduct->getPrice()}]
[{if $tprice->getBruttoPrice() > $regularprice->getBruttoPrice()}]
                        <p class="oldPrice">
                            <strong>[{oxmultilang ident="DETAILS_REDUCEDFROM"}] <del>[{$oDetailsProduct->getFTPrice()}] [{$currency->sign}]</del></strong>
                        </p>
                    [{/if}]
                [{/oxhasrights}]
            [{/block}]

            <div class="tobasketFunction clear">
                [{block name="details_productmain_price"}]
                    [{oxhasrights ident="SHOWARTICLEPRICE"}]
                        [{if $oDetailsProduct->getFPrice()}]
                            <label id="productPrice" class="price">

                                [{assign var="fPrice" value=$oDetailsProduct->getFPrice()}]
                                [{if !$blCanBuy }]
                                    [{assign var="oParentProduct" value=$oDetailsProduct->getParentArticle()}]
                                    [{if $oParentProduct}]
                                        [{assign var="fPrice" value=$oParentProduct->getFPrice()}]
                                    [{/if}]
                                [{/if}]

                                <strong><span itemprop="price">[{$fPrice}]</span> [{ $currency->sign}] <meta itemprop="priceCurrency" content="[{ $currency->name}]"> *</strong>
                            </label>
                        [{/if}]
                        [{oxscript include="js/widgets/oxamountpriceselect.js" priority=10 }]
                        [{if $oDetailsProduct->loadAmountPriceInfo()}]
                            [{include file="page/details/inc/priceinfo.tpl"}]
                        [{/if}]
                    [{/oxhasrights}]
                [{/block}]

Das ist jetzt der inhalt, der den Preis ausgibt ( denke ich mal )

Ich weiss nicht wo ich das hinsetzen soll und wie die Formatierung für Grosse Fette Schrift und Blau aussehen muss.

Müsste ja dann da rein?

Ihre Ersparnis beträgt [{ $oDetailsProduct->getSavingsPercent() }] %  

z. B. hier:


<p class="oldPrice">
    <strong>[{oxmultilang ident="DETAILS_REDUCEDFROM"}] <del>[{$oDetailsProduct->getFTPrice()}] [{$currency->sign}]</del></strong><br />
    Ihre Ersparnis beträgt <span class="bigFatBlue">[{ $oDetailsProduct->getSavingsPercent() }] %</span>
</p> 

und in der out\azure\src\css\oxid.css fügst du folgende Zeile ein:


.bigFatBlue { color: blue; font-weight:bold; }

Ich habe das mal so gemacht und teste das gleich mal:

            [{block name="details_productmain_tprice"}]
                [{oxhasrights ident="SHOWARTICLEPRICE"}]
                    [{assign var="tprice" value=$oDetailsProduct->getTPrice() }]
[{assign var="regularprice" value=$oDetailsProduct->getPrice()}]
[{if $tprice->getBruttoPrice() > $regularprice->getBruttoPrice()}]
                        <p class="oldPrice">
                            <strong>[{oxmultilang ident="DETAILS_REDUCEDFROM"}] <del>[{$oDetailsProduct->getFTPrice()}] [{$currency->sign}]</del></strong>
                        </p>
                    [{/if}]
                [{/oxhasrights}]
            [{/block}]

            <div class="tobasketFunction clear">
                [{block name="details_productmain_price"}]
                    [{oxhasrights ident="SHOWARTICLEPRICE"}]
                        [{if $oDetailsProduct->getFPrice()}]
                            <label id="productPrice" class="price">

                                [{assign var="fPrice" value=$oDetailsProduct->getFPrice()}]
                                [{if !$blCanBuy }]
                                    [{assign var="oParentProduct" value=$oDetailsProduct->getParentArticle()}]
                                    [{if $oParentProduct}]
                                        [{assign var="fPrice" value=$oParentProduct->getFPrice()}]
                                    [{/if}]
                                [{/if}]

                                <strong><span itemprop="price">[{$fPrice}]</span> [{ $currency->sign}] <meta itemprop="priceCurrency" content="[{ $currency->name}]"> *</strong>
                            </label>
                        [{/if}]
                        [{oxscript include="js/widgets/oxamountpriceselect.js" priority=10 }]
                        [{if $oDetailsProduct->loadAmountPriceInfo()}]
                            [{include file="page/details/inc/priceinfo.tpl"}]
                        [{/if}]
                    [{/oxhasrights}]
<p class="oldPrice">
    <strong>[{oxmultilang ident="DETAILS_REDUCEDFROM"}] <del>[{$oDetailsProduct->getFTPrice()}] [{$currency->sign}]</del></strong><br />
    Ihre Ersparnis beträgt <span class="bigFatBlue">[{ $oDetailsProduct->getSavingsPercent() }] %</span>
</p>
                [{/block}]

In der css habe ich den eintrag ganz unten gemacht.

Ok das hat alles geklappt. Kann man noch einstellen, das das nur bei einem Rabatt angezeigt werden soll, also nicht immer?

[QUOTE=Wizzard;86861]Ok das hat alles geklappt. Kann man noch einstellen, das das nur bei einem Rabatt angezeigt werden soll, also nicht immer?[/QUOTE]

Klar, bei dir war es nur an der falschen Stelle


            [{block name="details_productmain_tprice"}]
                [{oxhasrights ident="SHOWARTICLEPRICE"}]
                    [{assign var="tprice" value=$oDetailsProduct->getTPrice() }]
[{assign var="regularprice" value=$oDetailsProduct->getPrice()}]
[{if $tprice->getBruttoPrice() > $regularprice->getBruttoPrice()}]
<p class="oldPrice">
    <strong>[{oxmultilang ident="DETAILS_REDUCEDFROM"}] <del>[{$oDetailsProduct->getFTPrice()}] [{$currency->sign}]</del></strong><br />
    Ihre Ersparnis beträgt <span class="bigFatBlue">[{ $oDetailsProduct->getSavingsPercent() }] %</span>
</p>
                    [{/if}]
                [{/oxhasrights}]
            [{/block}]

            <div class="tobasketFunction clear">
                [{block name="details_productmain_price"}]
                    [{oxhasrights ident="SHOWARTICLEPRICE"}]
                        [{if $oDetailsProduct->getFPrice()}]
                            <label id="productPrice" class="price">

                                [{assign var="fPrice" value=$oDetailsProduct->getFPrice()}]
                                [{if !$blCanBuy }]
                                    [{assign var="oParentProduct" value=$oDetailsProduct->getParentArticle()}]
                                    [{if $oParentProduct}]
                                        [{assign var="fPrice" value=$oParentProduct->getFPrice()}]
                                    [{/if}]
                                [{/if}]

                                <strong><span itemprop="price">[{$fPrice}]</span> [{ $currency->sign}] <meta itemprop="priceCurrency" content="[{ $currency->name}]"> *</strong>
                            </label>
                        [{/if}]
                        [{oxscript include="js/widgets/oxamountpriceselect.js" priority=10 }]
                        [{if $oDetailsProduct->loadAmountPriceInfo()}]
                            [{include file="page/details/inc/priceinfo.tpl"}]
                        [{/if}]
                    [{/oxhasrights}]

                [{/block}] 

Super danke, muss schon sagen eine super community hier…:wink:

Hallo zusammen,
ich wollte das natürlich auch gleich in unseren Shop einbauen aber leiderklappt das nicht so ganz.

Die php-Erweiterung ist gespeichert und zugewiesen.
Allerdings sieht der meiner Meinung nach relevante Code in der 4.510 bei mir anders aus:

        [{block name="details_productmain_tprice"}]
            [{oxhasrights ident="SHOWARTICLEPRICE"}]
                [{if $oDetailsProduct-&gt;getFTPrice() &gt; $oDetailsProduct-&gt;getFPrice()}]
                    &lt;p class="oldPrice"&gt;
                        &lt;strong&gt;[{oxmultilang ident="DETAILS_REDUCEDFROM"}] &lt;del&gt;[{$oDetailsProduct-&gt;getFTPrice()}] [{$currency-&gt;sign}]&lt;/del&gt;&lt;/strong&gt;
                    &lt;/p&gt;
                [{/if}]
            [{/oxhasrights}]
        [{/block}]

Könnt Ihr mir hier grad noch weiter helfen?
Die Ersparnis soll ja nur angezeigt werden wenn ein UVP eingetragen ist und dieser höher als der derzeit gültige Preis ist.

Wenn ich das hier:
Ihre Ersparnis beträgt <span class=“bigFatBlue”>[{ $oDetailsProduct->getSavingsPercent() }] %</span>

in den block für details_productmain_price eintrage wirds angezeigt aber dann ja immer und die Ersparnis wird mit 100% angezeigt wenn kein UVP eingetragen ist.

Gruss
Volker

Wo genau hast du es reingepackt? Müßte innerhalb des IF-Blocks rein

[QUOTE=activesports;89571]
[{if $oDetailsProduct->getFTPrice() > $oDetailsProduct->getFPrice()}]

[{/if}][/QUOTE]

Hi,

ich habs so gemacht:
[{block name=“details_productmain_tprice”}]
[{oxhasrights ident=“SHOWARTICLEPRICE”}]
[{if $oDetailsProduct->getFTPrice() > $oDetailsProduct->getFPrice()}]
<p class=“oldPrice”>
<strong>[{oxmultilang ident=“DETAILS_REDUCEDFROM”}] <del>[{$oDetailsProduct->getFTPrice()}] [{$currency->sign}]</del></strong><br>
<span class=“smallBlue”>Sie sparen [{ $oDetailsProduct->getSavingsPercent() }] %</span>
</p>
[{/if}]
[{/oxhasrights}]
[{/block}]

Leider wird aber nichts angezeigt.

EDIT: neues phänomen, ich hab noch mal die aktuelle aktuelle Datenbank in meinen Testshop eingelesen.
Wenn ich nun einen Artikel anklicke bei dem der UVP hinterlegt ist werde ich auf die Startseite weitergeleitet???
http://panther/index.php?cl=start&redirected=1

Gruss
Volker

Hallo,
ich bin eben über diesen Artikel gestossen, da ich eine ähnliche Anzeige bei einer Rabatt-Aktion erstellen möchte.
Vielleicht fällt Euch für mein Problem ja auch eine Lösung ein:
Ich möchte in einer gewissen Zeitspanne alle Artikel im Shop um 20% reduzieren und diese Information in dieser Zeitspanne auch in den Artikeltexten darstellen. Geht das?

Vielen Dank für Eure Hilfe
Heike

sowas?

http://www.oxidmodule.com/OXID-Professional-Community-4/Module-PE4/Preismanager-fuer-Oxid-PE4.html

ja, sowas in der Art, allerdings das bereits unter “Shopeinstellungen” / “Rabatte” angebotene System. Ich kann damit wunderbar einzelne Kategorien oder eben alle Produkte aus dem Shop in einem bestimmten Zeitrahmen reduzieren, allerdings wird nur der Preis im Artikel verändert und es steht da nirgends, daß gerade eine Sonderaktion läuft und die Preise um x% reduziert sind…

Wer das ganze lieber ein ein Modul auslagern möchten (die schönere Variante), der wird hier fündig: http://www.oxid-module.eu/blog/ersparnisanzeige-artikelpreis-und-uvp/

Super - Dankeschön!

(kannst/willst Du das ins OXID-Github-Repository packen?)

Hallo

Ich habe mir den Code im Template eingebaut und es funktioniert auch ganz gut.

<div class=“Rabatt”>
[{if $product->getFTPrice() or $product->getFPrice()|replace:",":"." < $product->oxarticles__oxprice->value }][{assign var=“uvp” value=$product->getFTPrice()|replace:",":"."}][{assign var=“price” value=$product->getFPrice()|replace:",":"."}][{if $product->oxarticles__oxtprice->value != 0}]-[{math equation="( z / x ) * ( x - y)" x=$uvp y=$price z=100 format="%.0f"}]%[{/if}][{/if}]
</div>

Wenn ich in oxid.css “border: 1px solid red;” eingebe, dann taucht ein roter strich auch bei den Artikeln die nicht reduziert sind.

Kennt jemand dieses Problem und wie könnte ich es beheben?

Vielen Dank.

Beste Grüsse
Avni

Hallo

Hat sich erledigt.

für die es auch stört:

[{if $product->getFTPrice() or $product->getFPrice()|replace:",":"." < $product->oxarticles__oxprice->value }]
<span class=“Rabatt”>
[{assign var=“uvp” value=$product->getFTPrice()|replace:",":"."}][{assign var=“price” value=$product->getFPrice()|replace:",":"."}][{if $product->oxarticles__oxtprice->value != 0}]-[{math equation="( z / x ) * ( x - y)" x=$uvp y=$price z=100 format="%.0f"}]%[{/if}]
</span>
[{/if}]

Beste Grüsse
Avni