VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: sallyit on June 28, 2012, 10:52:47 AM

Title: Price view: add text after price value
Post by: sallyit on June 28, 2012, 10:52:47 AM
Joomla 2.5.4 + Virtuemart 2.0.6.

Sorry for my bad english.
I'm configuring an italian e-commerce and I need to add text "+IVA" AFTER the "SALESPRICE_WITHOUT_TAX" value.
I simply want to view price like that:

Price: € 10,00 +IVA

I tried to modify the file vm.css  e default.php (in templates/mytemplate/html/com_virtuemart/productdetails/default.php) but the text is been wrapped, like that:
Price: € 10,00
+ IVA

Someone can help me? Thank you in advance.
Title: Re: Price view: add text after price value
Post by: srajca on June 28, 2012, 11:27:39 AM
I'm new to PHP but maybe you can try this code
in your productdetails/default_showprices.php find this code
echo $this->currency->createPriceDiv('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices);
and change it with this one
echo $this->currency->createPriceDiv('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices) . ' + IVA';
Let me know if it works.
Title: Re: Price view: add text after price value
Post by: sallyit on June 28, 2012, 11:57:27 AM
Thank you for your answer.

It does'nt work. Same problem: it is been wrapped, like that:

Price: € 10,00
+ IVA

I think the problem is in the "vm.css", in the FLOAT property... but I can't solve it..... :-\ .... are several days that I'm fighting with this part of code.
Title: Re: Price view: add text after price value
Post by: sallyit on June 28, 2012, 12:01:43 PM
....to be more precise I'm working on this file:
/templates/mytemplates/html/com_virtuemart/productdetails/default.php.

Other variation works good excluded this..... >:(
Title: Re: Price view: add text after price value
Post by: srajca on June 28, 2012, 13:30:57 PM
looking at it quickly now, what you could do is maybe the following. I can't guarantee that it will work.
Replace the code mentioned before with this one
echo $this->currency->createPriceDiv('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices, 'COM_VIRTUEMART_PRODUCT_PLUS_IVA');
and then go to your languages folder and add COM_VIRTUEMART_PRODUCT_PLUS_IVA=" + IVA" to your en-GB.com_virtuemart.ini or/and it-IT.com_virtuemart.ini

as I said this was a quick look at the code, I am no expert, hardly a beginner ;) but give it a try and let me know if it works.
Title: Re: Price view: add text after price value
Post by: sallyit on June 28, 2012, 16:47:40 PM
Thank you very much for your interesting and code, but unlikely it does'nt work.
... with a little bit modification it prints:

Prezzo: € 10,00
COM_VIRTUEMART_PRODUCT_PLUS_IVA

I repeat: I was able to set it to write "+ IVA" but the problem is that text "+IVA" is printed in a row below.  ???

I can't believe this customization is so hard...... I write in the italian Virtuemart forum too, but nothing.  :-\

Title: Re: Price view: add text after price value
Post by: srajca on June 28, 2012, 18:24:10 PM
yeah I doubted myself as well that the code should work. Well now that I think of it, you would have to find where can you edit the $this->product->prices, because it has to be done so that after every price display it inserts a </br> which has to be otherwise if you would have more than one price display it would all be in one line. That is my guess however. I don't know much of PHP or Virtuemart, I barely started ;) So maybe one of the developers should be able to help here.
So far what I can suggest is that you use price without IVA which is another way of saying $$$ + IVA.
Title: Re: Price view: add text after price value
Post by: srajca on July 02, 2012, 23:42:42 PM
hey what if you try this

<?php  echo number_format($this->product->prices['costPrice'], 2, ',', ' ') . ' + IVA';  ?>

add it to your productdetails/default_showprices.php

let me know if it works
Title: Re: Price view: add text after price value
Post by: vmhabib on September 11, 2012, 14:42:44 PM
Hello !
For me it is a very good result to get something like this:

Price: € 10,00
+ IVA
or
Price: € 10,00
per day
Please tell me what's the necessary to modify for it.

Kindy regards !
Title: Re: Price view: add text after price value
Post by: david_a on September 21, 2012, 12:02:17 PM
Hi this works for me, although it is a bit crude:

BACK EVERYTHING UP FIRST

In views\productdetails\tmpl\default_showprices.php find

echo $this->currency->createPriceDiv('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $this->product->prices);

(or the code for whichever of the price options you wish to display) and add this line below putting in whatever text you require inside the <div> tags or call a language file if you prefer

echo '<div class="vatText">incl vat</div>';

then in vmsite-lts.css add the styles:

div.PricesalesPrice {
    min-width: 45px;
    padding-right: 5px;
    float: left;
}

to style the text itself use

div.vatText {
    font-size: 11px;
}

and style as you require

For the category browse page do the same in views\category\tmpl\default.php

Cheers  David




Title: Re: Price view: add text after price value
Post by: Cr3ativ3 on April 16, 2014, 18:49:54 PM
Hi i know this topic has not been discussed for a long time but i thought i would share my solution that may help others who come across this potential problem:

Please see:
http://forum.virtuemart.net/index.php?topic=123405.0 (http://forum.virtuemart.net/index.php?topic=123405.0)