News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Need plugin event calculation

Started by noras, June 21, 2016, 15:52:42 PM

Previous topic - Next topic

noras

Hello,

I have a problem. I need help. He wants to create a plugin that will initiate in your shopping cart corresponding discounts. Calculations have several assumptions, depending on the specific product quantity.
I found the course https://dev.virtuemart.net/projects/virtuemart/wiki/Calculation_Plugins

He needs a clue how I can change the price of the basket. I was able to change the price by:

$pricesUnformatted[0]['salesPriceWithDiscount'] = 8;
        $pricesUnformatted[0]['discountAmount'] = 2;
        $pricesUnformatted[0]['salesPriceTemp'] = 8;
        $pricesUnformatted['billDiscountAmount'] = 2;
        $pricesUnformatted['billTotal'] = $pricesUnformatted['billTotal'] - $pricesUnformatted['billDiscountAmount'];

        $cart->pricesUnformatted = $pricesUnformatted;
        $cart->setCartIntoSession(false,true);
        $cart->saveCartFieldsInCart();


This changes the price in view of the cart. Sadly after confirmation of the order, the old prices are visible in the mail and on the list of orders.

You can specify some way?

Studio 42


noras

It is not possible.
Individualspecific implementation of the discounts.
I came up with even the idea to use a pluginvm shopper. I think to use the plgVmOnUserOrder () I have yet to see it. But I think it will be.

Can you hint there anything better?