VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: nickon2 on August 11, 2013, 17:46:13 PM

Title: duplicate prices
Post by: nickon2 on August 11, 2013, 17:46:13 PM
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]
Title: Re: duplicate prices
Post by: Maxim Pishnyak on August 11, 2013, 18:05:37 PM
Looks like discount is not apply.
Title: Re: duplicate prices
Post by: nickon2 on August 11, 2013, 18:25:33 PM
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
Title: Re: duplicate prices
Post by: Maxim Pishnyak on August 12, 2013, 14:21:38 PM
Aren't 'overwrite price' and 'discount' different terms?
Title: Re: duplicate prices
Post by: nickon2 on August 12, 2013, 14:34:45 PM
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
Title: Re: duplicate prices
Post by: Maxim Pishnyak on August 12, 2013, 15:09:48 PM
Excuse me my possible incompetence in discount area, but I think that discounts could be created in 'Taxes and Calculation rules' in VM backend.
Title: Re: duplicate prices
Post by: nickon2 on August 12, 2013, 16:23:31 PM
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

Title: Re: duplicate prices
Post by: Maxim Pishnyak on August 13, 2013, 11:47:28 AM
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'.
Title: Re: duplicate prices
Post by: Milbo on August 16, 2013, 14:25:50 PM
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
Title: Re: duplicate prices
Post by: nickon2 on August 16, 2013, 21:57:54 PM
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


Title: Re: duplicate prices
Post by: Maxim Pishnyak on August 18, 2013, 11:34:07 AM
Quote from: Maxim Pishnyak on August 13, 2013, 11:47:28 AM
I think you also checked
http://docs.virtuemart.net/manual/17-products-menu/36-calc-edit.html
and saw word 'discount' there too.
Why this discount method is not acceptable?
Title: Re: duplicate prices
Post by: nickon2 on August 18, 2013, 17:28:31 PM
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.
Title: Re: duplicate prices
Post by: Maxim Pishnyak on August 24, 2013, 12:20:10 PM
You could pm me access and I could try to help.
Title: Re: duplicate prices
Post by: Maxim Pishnyak on August 25, 2013, 20:05:53 PM
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.
Title: Re: duplicate prices
Post by: nickon2 on August 25, 2013, 23:43:25 PM
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
Title: Re: duplicate prices
Post by: Maxim Pishnyak on September 18, 2013, 09:28:34 AM
Quote from: krentzis on September 18, 2013, 07:43:20 AM
This solved my double pricing problem as I described here
http://forum.virtuemart.net/index.php?topic=118845.0 (http://forum.virtuemart.net/index.php?topic=118845.0)