Displaying discounts

Hi everybody,

I have created an own theme based on azure and discovered now that after creating a discount on a specific product I don’t see any information in the product details. So I started digging in this forum and found out that it can be achieved with the UVP field. Unfortunately I don’t want to(can’t) use this field due to I have different prices for the product variants.

Therefore I started analyzing the code/database and found a table that is responsible for the relations between oxarticles and oxdiscount - oxobject2discount. On PHP side there is a class oxDiscount which seems to be a manager that can be used for checking whether an article has a discount (isForArticle()) or not and a method getAbsValue() for calculating the absolute discount value.

Unfortunately I have no idea how this class works. How does getAbsValue() know which product is used for calculating the absolute discount value?

The other question is how do I get access to this manager object in lets say listitem_grid.tpl?

Is there maybe a more elegant solution to achieve this? Where is the best place for changing the templates in order to see the discount in the articles view and article details?

Thanks in advance.
Martin

Ok, I found this topic http://www.oxid-esales.com/forum/showthread.php?t=8215&page=2. Think that will help me

Hi Martin,

RRP (UVP) and discounts are two different pairs of shoes. RRP one would use e.g. if the manufacturer proposes a price of 19 EUR, you are selling it for 15 EURs instead.
For assigning discounts, go to admin -> shop settings -> discounts. You will find the field “quantity” here. Try playing around with the From field: set it to “0” or to “1” so you’ll see that the discount can either be displayed only during the checkout or already on the product’s detail page. Additionally, you can show up the regular price here from the price field in product management in your theme with getFPrice.

Regards

Hi Marco,

thanks for your reply.

I played with the from field of quantity and I don’t see any difference. But what I have discovered is that if I logon it indeed works.

Do you have an idea what I need to change in order to see also as a new customer without an account the prices after discount?

Oh my god. That’s incredible how the system is complicated to use.

Don’t assign countries to discounts otherwise you will see them only if you logon.

In order to see discounts immediately you have to set quantity to 0.

If you set quantity to 1 than you see it only in the shopping cart.

Unfortunately I have not found any documentation that describes it in that way.

Now I need just to get the original price and I am happy :slight_smile:

oxarticle::getBasePrice() returns the original price


    public function getFBasePrice()
    {
        if ( $oPrice = $this->getPrice() ) {
            return $this->getPriceFromPrefix().oxLang::getInstance()->formatCurrency( $this->getBasePrice() );
        }
    }

Added this method into oxarticle.php that will return a formated base price. Or is there already a similar method?

I have one more question:

Is it possible to create discounts per variant. Lets say I have a tshirt where size S - L have a price of 10 Euro and sizes > XL 12 Euro. I would like to create a discount on all shirts so they will cost 8 Euro each. With the given feature right now this is not possible since I can only specify a fixed amount or a percentage as discount. Setting a discount per variant would fix this.