News:

Support the VirtueMart project and become a member

Main Menu

duplicate prices

Started by nickon2, August 11, 2013, 17:46:13 PM

Previous topic - Next topic

nickon2

Hi,

I am using vm2 version 2.0.22a on a joomla 2.5.11 installation with php version 5.3.25.
I am trying to show the original price, the discounted price and the price difference.
So I have configured the pricing tab account to the screenshot you can see attached.
and although the product with the discounted price show the way it should, all other product show the salesprice twice (one with striketrhough and an other normally.)
as you can see here http://demo.multitec.gr/%CF%80%CF%81%CE%BF%CE%B9%CE%BF%CE%BD%CF%84%CE%B1/laptops-notebooks/toshiba.
It's not a template issue as I have tried the original one.
What I do when I add the price is I add the price to final price and check Calculate the Cost price to calculate the other prices (don't know if this has to do anything with this problem)
What am I doing wrong ?

Kind Regards

[attachment cleanup by admin]

Maxim Pishnyak

Looks like discount is not apply.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

nickon2

Hi,

I hope I am not doing this wrong.
To do a discount I go to the product and change the price to Override and then check  Overwrite final

Maxim Pishnyak

Aren't 'overwrite price' and 'discount' different terms?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

nickon2

Quote from: Maxim Pishnyak on August 12, 2013, 14:21:38 PM
Aren't 'overwrite price' and 'discount' different terms?
Not if the overwrite price is lower.
Could you please tell me if I am doing something wrong or point me to the right docs

Maxim Pishnyak

Excuse me my possible incompetence in discount area, but I think that discounts could be created in 'Taxes and Calculation rules' in VM backend.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

nickon2

From http://docs.virtuemart.net/manual/17-products-menu/28-product-edit.html#product-information

QuoteOverride: if you wish to temporarily add a discount to a product, click on the checkbox


Maxim Pishnyak

I think you also checked
http://docs.virtuemart.net/manual/17-products-menu/36-calc-edit.html
and saw word 'discount' there too.

But I want to say thank you. I will ask guys to make an accent on more pure 'discount'.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

Milbo

Disable the overrides,.... You can also disable the price with override. imho just a matter of configuration. We will consider this for the next mayor version, thanks
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

nickon2

Hi Milbo,

By default the price overrides are disabled. I only use them on selected products when I want to add a discount.
Am I missing something ?

I fixed (?) this issues by changing the default.php in category as posted in post https://forum.virtuemart.net/index.php?topic=117935.0
but haven't found a solution for productdetails
Does this make any sense ?

Kind Regards



Maxim Pishnyak

You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

nickon2

Hi Maxim,

I have tried that too. I need to apply different disount amounts on different products so setting up rules to just make one discount to one product at a time does not make sense to create rules as the price differs every time.
Have you tried yourself to apply discount on products? Because even using rules does not solve the problem. It's the same thing.
The problem is that vm is not dipslaying the prices as it should.
And please,  please don't anwser a question with a question,  this does not help. If you have a solution or even an hint to a solution please post.

Maxim Pishnyak

You could pm me access and I could try to help.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

Maxim Pishnyak

Quote from: nickon2 on August 11, 2013, 17:46:13 PM
all other product show the salesprice twice (one with striketrhough and an other normally.)
Sorry, I understand your issue too late.

So you need compare these identical prices and if they are equal show that one without strikethorugh? Try to use IF statement. I'm sure it's very simple to do. Report here if you will have some problems with this.

And I'm sorry I lost original value that you put in Price override for Toshiba Satellite C855D-127  Pearl White.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

nickon2

#14
Hi,

I have managed to partially fix this problem by editing two files
1. currencydisplay.php
2. default.php in category folder

I haven't managed to apply it to productdetails page yet (any help welcome)

In currencydisplay this is what I changed: 

+++ currencydisplay.php.modified   2013-08-26 00:20:35.000000000 +0300
@@ -387,6 +387,31 @@
         $descr = '';
         if($this->_priceConfig[$name][2]) $descr = JText::_($description);
         //          vmdebug('createPriceDiv $name '.$name.' '.$product_price[$name]);
+// ==
+// START MODIFICATION for showing - 1 price (if there is no discount) or 3 prices (is there is discount)
+// ==
+
+// Checks if there is a discount.
+if ($name == "discountAmount" && $vis == "none")
+{
+// If discount is empty (discountAmount) (display: none) it gives you an empty string instead of <div>
+return "";
+}
+
+// If you have an discount and want to show the Price with Tax
+if ($name == "basePrice")
+{
+// Checks if there is a discount.
+if(!empty($product_price['discountAmount']))
+{
+ // Discount exist: Show Price with Tax and with an extended CSS class
+ return $descr.$product_price[$name];
+ }
+}
+
+// ==
+// END MODIFICATION
+// ==

And in default.php the if statment goes like:

-//START My modifications for showing prices!!!
-               
-               if ($this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices))
-               {
-               ?>
-                  <div class="price-crossed"> <?php echo $this->currency->createPriceDiv('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX_MULTITEC', $product->prices) ;?>
-                  </div>
-                  <?php echo $this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices); ?>
-                  <div class="sales-price"> <?php echo $this->currency->createPriceDiv('salesPrice','COM_VIRTUEMART_PRODUCT_SALESPRICE',$product->prices);?>
-                  </div>
-                  <?php
-               }
-               else
-               {
-                  echo $this->currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
-               }
-                  }
-//END My modifications for showing prices!!!
-                  ?>                
-                  <div class="addtocart-button-browsepage">
+                     //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);
+                     $unitPriceDescription = JText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE', $product->product_unit);
+                     echo $this->currency->createPriceDiv ('unitPrice', $unitPriceDescription, $product->prices);
+                  } ?>
+                 <div class="addtocart-button-browsepage">

I hope the dev's could improve the code, apply it where ever else it is needed and push it back into vm

Kind Regards


P.S. this is taken from
https://forum.virtuemart.net/index.php?topic=97672.0