News:

Looking for documentation? Take a look on our wiki

Main Menu

Changes in price variant - custom field

Started by gumas85, May 31, 2013, 23:10:01 PM

Previous topic - Next topic

gumas85

Hi,
My goal is to make it possible to order product directly from category page.
I've already made quantity box, addtocart button and price that depends on price variants

And the problem is about those price variants.
It's a simple custom field added in each product

Online it looks like below:


View after expand.


When I choose for example "gold" the price above changes to 135,30 (sum of price and variant)
The problem is I don't want to see +xxx $ in expand menu, I want to see price that is already changed so it should look like this:


And in addition I would like to see normal price next to "standard" (now when the value is 0 nothing appears)

I have found a file customfields.php in administrator/components/com_virtuemart/models where I've already deleted text informing that the product is free.
It's the part of the code. I suppose something has to be changed in this large file but i'm not very familiar in php/mysql and don't know where and how.

I would be glad fo any help.





static function _getCustomPrice($customPrice, $currency, $calculator) {
if ((float)$customPrice) {
$price = strip_tags ($currency->priceDisplay ($calculator->calculateCustomPriceWithTax ($customPrice)));
if ($customPrice >0) {
$price ="+".$price;
}
}
else {
$price = ($customPrice === '') ? '' :  JText::_ ('');
}
return $price;
}