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

override createPriceDiv() with plugin?

Started by Piszi, December 06, 2013, 16:18:44 PM

Previous topic - Next topic

Piszi

Hello

is there any way I can override the createPriceDiv() function with a plugin or somehow without editing the helper file or should I go with priceDisplay() function and simple html to wrap the price?
I'm trying to this because I would like to add an extra class for prices based on different conditions.

Milbo

imho last parameter of pricediv is doing this.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Piszi

Maybe I'm missing something but as I see the last param is forcenolabel, the name is used as class.
public function createPriceDiv($name,$description,$product_price,$priceOnly=false,$switchSequel=false,$quantity = 1.0,$forceNoLabel=false)
Oh and I'm using 2.0.24, sorry if it's implemented in a newer version like 'a', 'b', 'c' than I will update to the latest.

Milbo

hmm you are right. Seems missing. Lets see what the other templaters say.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Eugen S.

I would do the function like this:

This function would output something like this:

<div class="custom-class">
    JText....
    <span data-price="preSalesWithTax" class="custom-class"> 3,99 Euro </span>
</div>

With the parameter you should be able to define the div class which wraps the whole thing and the class which holds the price int numbers.

The javascript should be changed and select the data field within the tag - not the class name. This way people / templater can assign class names they want and the javascript still works to update prices.

This is 100% flexible and perfect for customization without breaking the javascript price update functionality ;-)
Send me a pm ;-)