Author Topic: Single price configuration without tax not working (if override price is selecte  (Read 4823 times)

gpessoa

  • Jr. Member
  • **
  • Posts: 129
In an installation where you want to use a single sales price, without tax, (if we use a promotion – override price) it doesn’t allow VM to show the earlier price scratched.

If we choose to also select (in administration) the price without tax, the system doubles the price in both in categories and products.
I already try on default template, but it is the same.

I think that this is a problem of the code, because I tried the help section (Administration & Configuration VM 2) but had no help.
http://forum.virtuemart.net/index.php?topic=109316.0





[attachment cleanup by admin]

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Hello,

Please try without template overrides and reply back. As i remember we have already reply to your issue in two other threads.

If that a custom template? Did you ask your template provider?

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

gpessoa

  • Jr. Member
  • **
  • Posts: 129

I already try on default template, but it is the same.

I think that this is a problem of the code, because I tried the help section (Administration & Configuration VM 2) but had no help.
http://forum.virtuemart.net/index.php?topic=109316.0

As you can see, I've tested it with all defaults, but it doesn`t work!
Please do the test there in your system, and easily verify that there is a bug.
I think it's a question of code, which from what I understand, requires working with the two prices (with and without taxes).
The problem is that I do not work with price with taxes.



On Category:
Code: [Select]
//todo add config settings
if ($this->showBasePrice) {
echo $this->currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices);
echo $this->currency->createPriceDiv ('basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $product->prices);
}
echo $this->currency->createPriceDiv ('variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $product->prices);
if ($product->prices['basePriceWithTax'] !== $product->prices['salesPrice']) {
echo '<span class="price-crossed" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices) . "</span>";
}
if ($product->prices['salesPriceWithDiscount'] != $product->prices['salesPrice']) {
echo $this->currency->createPriceDiv ('salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $product->prices);
}
echo $this->currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
echo $this->currency->createPriceDiv ('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices);
echo $this->currency->createPriceDiv ('discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices);
echo $this->currency->createPriceDiv ('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $product->prices);
$unitPriceDescription = JText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE', $product->product_unit);
echo $this->currency->createPriceDiv ('unitPrice', $unitPriceDescription, $product->prices);
On Product:
Code: [Select]
//vmdebug('view productdetails layout default show prices, prices',$this->product->prices);

if (empty($this->product->prices) and VmConfig::get ('askprice', 1) and !$this->product->images[0]->file_is_downloadable) {

?>

<a class="ask-a-question bold" href="<?php echo $this->askquestion_url ?>"><?php echo JText::('COM_VIRTUEMART_PRODUCT_ASKPRICE'?></a>

<?php

}

if ($this->showBasePrice) {

echo $this->currency->createPriceDiv ('basePrice''COM_VIRTUEMART_PRODUCT_BASEPRICE'$this->product->prices);

echo $this->currency->createPriceDiv ('basePriceVariant''COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT'$this->product->prices);

}

echo $this->currency->createPriceDiv ('variantModification''COM_VIRTUEMART_PRODUCT_VARIANT_MOD'$this->product->prices);

if ($this->product->prices['basePriceWithTax'] !== $this->product->prices['salesPrice']) {

echo '<span class="price-crossed" >' $this->currency->createPriceDiv ('basePriceWithTax''COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX'$this->product->prices) . "</span>";

}

if ($this->product->prices['salesPriceWithDiscount'] != $this->product->prices['salesPrice']) {

echo $this->currency->createPriceDiv ('salesPriceWithDiscount''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT'$this->product->prices);

}

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

echo $this->currency->createPriceDiv ('priceWithoutTax''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX'$this->product->prices);

echo $this->currency->createPriceDiv ('discountAmount''COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT'$this->product->prices);

echo $this->currency->createPriceDiv ('taxAmount''COM_VIRTUEMART_PRODUCT_TAX_AMOUNT'$this->product->prices);

$unitPriceDescription JText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE'$this->product->product_unit);

echo $this->currency->createPriceDiv ('unitPrice'$unitPriceDescription$this->product->prices);
Thanks in advanced for your help

gpessoa

  • Jr. Member
  • **
  • Posts: 129
Any help? :'(

gpessoa

  • Jr. Member
  • **
  • Posts: 129
I just can´t believe anyone can help me.
Nobody answers ...
See on the forum hundreds of lines of code and for this matter, not a single comma!
I'm disappointed! :'(

gpessoa

  • Jr. Member
  • **
  • Posts: 129
Test carried out using Vat Tax.
As you can see, I'm using the default template ...
I have updated the VM to version 2.0.13, but BUG keeps.
The problem is that the VM shows the price scratched even when there is no discount.


[attachment cleanup by admin]

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Hello,

Yes, you have right, it's a bug. I let dev team knowns about that and will be fixed. By the moment you could use the following temporary solution: http://forum.virtuemart.net/index.php?topic=108865.msg364872#msg364872

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

gpessoa

  • Jr. Member
  • **
  • Posts: 129
I don`t think you understand my problem.
In the example that the discount does not appear, it is correct, because this product has no discount!
The problem is that VM shows two prices, one being scratched, when just had to show a single price (final sales price, not scratched)
Besides this, should also work with prices without Tax, because the price scratched only works if the price is with tax (B2B)
This happens both in the categories as in the products

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Hello,

It is the same thing, i suppose you gonna make that change but your own.

The right code you should use for comparing the base price with tax and sales prices no be displayed is:

 if (round($this->product->prices['basePriceWithTax'],VmConfig::get('salesPriceRounding')) != $this->product->prices['salesPrice']) {
             echo '<span class="price-crossed" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices) . "</span>";
        }

Please corrected .. you don't have the VmConfig::get('salesPriceRounding')

ok? Can you corrected in your templates?

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

gpessoa

  • Jr. Member
  • **
  • Posts: 129
As you can see, this is the code that I already have in default_showprices.php

Code: [Select]
if ($this->showBasePrice) {
echo $this->currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $this->product->prices);
if (round($this->product->prices['basePrice'],$this->currency->_priceConfig['basePriceVariant'][1]) != $this->product->prices['basePriceVariant']) {
echo $this->currency->createPriceDiv ('basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $this->product->prices);
}

}
echo $this->currency->createPriceDiv ('variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $this->product->prices);
if (round($this->product->prices['basePriceWithTax'],VmConfig::get('salesPriceRounding')) != $this->product->prices['salesPrice']) {
   
echo '<span class="price-crossed" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices) . "</span>";
}
if (round($this->product->prices['salesPriceWithDiscount'],VmConfig::get('salesPriceRounding')) != $this->product->prices['salesPrice']) {
echo $this->currency->createPriceDiv ('salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $this->product->prices);
}
echo $this->currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $this->product->prices);
echo $this->currency->createPriceDiv ('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices);
echo $this->currency->createPriceDiv ('discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $this->product->prices);
echo $this->currency->createPriceDiv ('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $this->product->prices);
$unitPriceDescription = JText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE', JText::_('COM_VIRTUEMART_UNIT_SYMBOL_'.$this->product->product_unit));
echo $this->currency->createPriceDiv ('unitPrice', $unitPriceDescription, $this->product->prices);
}


Where do I do this configuration?


Please corrected .. you don't have the VmConfig::get('salesPriceRounding')

ok? Can you corrected in your templates?


and for the avoidance of doubt, I am using all the default and bezze5 template

Joomla 2.5.7
PHP 5.3.17
VM 2.0.13

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Hi,

I was speaking with alatak for that issue yesterday and it seems that today she find the issue and fix it, i test it and it works great. The fix will be included on the next release. But for now please do the follow:

Udate the file calculationh.php under   administrator\components\com_virtuemart\helpers
replace the line 303 from this:

$this->productPrices['basePriceWithTax'] = $this->roundInternal($this->executeCalculation($this->rules['Tax'], $this->productPrices['basePrice'], true));

to this:

$this->productPrices['basePriceWithTax'] = $this->roundInternal($this->executeCalculation($this->rules['Tax'], $this->productPrices['basePrice'], true),'basePriceWithTax');

Please test it and let us know if that is working for you also...

Test it with tax per product, vat tax per product and no tax (i test will all of them).

Regards

Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

gpessoa

  • Jr. Member
  • **
  • Posts: 129
Hi bytelord,
Now it runs, but not in all situations:
Without VAT or Tax per product, previous scratched price does not show (anywhere), still a Bug.
With Vat or Tax per product, it works on category and products, but  it does not work in layout VM Front Page (Featured Products, Latest Products, Top Ten Products, Recently Viewed Products),
Also, to make it work, I had to change the configuration, pricing, rounding digits from -1 to 2.
So, please tri to solve this last issues: previous scratched price when not using Vat or Taxes, and Front Page layout.
Thanks in advanced,
Guilherme

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Hi,

Yes you have right because the if statements doen't need any more ...

For category page use:

<?php
                  if ($this->show_prices == '1') {
                     if (empty($product->prices['salesPrice']) and VmConfig::get ('askprice', 1) and  !$product->images[0]->file_is_downloadable) {
                        echo JText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE');
                     }
                     //todo add config settings
                     if ($this->showBasePrice) {
                        echo $this->currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices);
                        echo $this->currency->createPriceDiv ('basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $product->prices);
                     }
                     echo $this->currency->createPriceDiv ('variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $product->prices);
                     //if (round($product->prices['basePriceWithTax'],$this->currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
                        echo '<span class="price-crossed" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices) . "</span>";
                     //}
                     //if (round($product->prices['salesPriceWithDiscount'],$this->currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
                        echo $this->currency->createPriceDiv ('salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $product->prices);
                     //}
                     echo $this->currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
                     echo $this->currency->createPriceDiv ('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices);
                     echo $this->currency->createPriceDiv ('discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices);
                     echo $this->currency->createPriceDiv ('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $product->prices);
                     $unitPriceDescription = JText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE', $product->product_unit);
                     echo $this->currency->createPriceDiv ('unitPrice', $unitPriceDescription, $product->prices);
                  } ?>

Make the necessary changes to other flypages and productdetails/showprices.

Please test and report back. Just tested worked on my dev installations (2012f, 2013a)

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!