Author Topic: listing multiple prices on product page  (Read 10215 times)

chrs23

  • Beginner
  • *
  • Posts: 2
listing multiple prices on product page
« on: March 18, 2013, 14:42:02 pm »
I have Joomla 2.5.9 VM 2.0.12 and want to upgrade to make possible mutliple pricing for products.

I test now 2.0.18a, but as I see the price will change only after I modify the quantity. This is bad, because customer who wants to buy more pcs, left page because high price. (costomer do not test quantity modifying)
Customer buys normaly not 1 pcs, so pricing is for example the following:

Can somebody help me, how to make a list at product page like so:
1-19pcs - 1 EUR/pcs
20-49pcs - 0,8 EUR/pcs
50-     -0,7 EUR/pcs

(min. and max Quantity is changing.)

Many thanks. ;D




logobis

  • Beginner
  • *
  • Posts: 19
Re: listing multiple prices on product page
« Reply #1 on: March 18, 2013, 17:15:35 pm »
I have Joomla 2.5.9 VM 2.0.12 and want to upgrade to make possible mutliple pricing for products.

I test now 2.0.18a, but as I see the price will change only after I modify the quantity. This is bad, because customer who wants to buy more pcs, left page because high price. (costomer do not test quantity modifying)
Customer buys normaly not 1 pcs, so pricing is for example the following:

Can somebody help me, how to make a list at product page like so:
1-19pcs - 1 EUR/pcs
20-49pcs - 0,8 EUR/pcs
50-     -0,7 EUR/pcs
I have Joomla 2.5.9 VM 2.0.12 and want to upgrade to make possible mutliple pricing for products.

I test now 2.0.18a, but as I see the price will change only after I modify the quantity. This is bad, because customer who wants to buy more pcs, left page because high price. (costomer do not test quantity modifying)
Customer buys normaly not 1 pcs, so pricing is for example the following:

Can somebody help me, how to make a list at product page like so:
1-19pcs - 1 EUR/pcs
20-49pcs - 0,8 EUR/pcs
50-     -0,7 EUR/pcs

(min. and max Quantity is changing.)

Many thanks. ;D





Hi everybody,

I'm in the same case.
Does someone could explain us how we can display multi prices ?
Thank's by advance

logobis

  • Beginner
  • *
  • Posts: 19
Re: listing multiple prices on product page
« Reply #2 on: March 26, 2013, 21:11:45 pm »
A little up...
It seem's incredible that there is no solution to display multiprices !!!
OK, prices change well when quantity is updated but if the customer doesn't show all the price's ranges it's a joke !
no one has a solution ?
Thank's.

chrs23

  • Beginner
  • *
  • Posts: 2
Re: listing multiple prices on product page
« Reply #3 on: March 27, 2013, 14:39:08 pm »
A little up...
It seem's incredible that there is no solution to display multiprices !!!
OK, prices change well when quantity is updated but if the customer doesn't show all the price's ranges it's a joke !
no one has a solution ?
Thank's.

I have a half solution, without hard php programming.
I do not need short description, so I change at the template, that short description will be shown under the BUY bottom.
Of course at every products should write hand the price range, but it do not change a lot of time. So price is shown. The modify it is very easy later at administrator page.

JoelSTK

  • Beginner
  • *
  • Posts: 1
Re: listing multiple prices on product page
« Reply #4 on: April 26, 2014, 19:19:25 pm »
I have Joomla 2.5.9 VM 2.0.12 and want to upgrade to make possible mutliple pricing for products.

I test now 2.0.18a, but as I see the price will change only after I modify the quantity. This is bad, because customer who wants to buy more pcs, left page because high price. (costomer do not test quantity modifying)
Customer buys normaly not 1 pcs, so pricing is for example the following:

Can somebody help me, how to make a list at product page like so:
1-19pcs - 1 EUR/pcs
20-49pcs - 0,8 EUR/pcs
50-     -0,7 EUR/pcs

(min. and max Quantity is changing.)

Many thanks. ;D

How do I change the displayed values​​, the lowest to be first?

Many Thanks.

lucafo

  • Beginner
  • *
  • Posts: 1
  • Skype Name: muellescrom01

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 7637
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.2
Re: listing multiple prices on product page
« Reply #6 on: May 06, 2014, 19:39:09 pm »
You could do a query in the template for all prices for the product id from jos_virtuemart_product_prices and display them as a list in your template.
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

lanthan

  • Jr. Member
  • **
  • Posts: 99
  • VM 2.6.10, J2.5.27, PHP5.5
Re: listing multiple prices on product page
« Reply #7 on: July 30, 2014, 16:41:59 pm »
Hi all,
as many people and me too where seeking for a solution here is mine. Direct DB access is not! recommended. For showing all multiple prices on your productdetailpage add the following code to your productdetail.php. If your product quantity end of the last price is zero, the price is shown only with the start amount plus a different text ->COM_VIRTUEMART_MULTIPRICES_FROM. Tax and currency is checked. Output is ordered by "price_quantity_start" could be changed into "product_price". This means, even if you add a price later, everything will be in order.

Code: [Select]
//get multiprices form current product_id
$db = JFactory::getDBO ();
$q = 'SELECT `product_price`,`price_quantity_start`,`price_quantity_end`,`product_tax_id`,`product_currency` FROM `#__virtuemart_product_prices` WHERE `virtuemart_product_id`="' . $this->product->virtuemart_product_id . '" ORDER BY `price_quantity_start` ';
$db->setQuery ($q);
$multiprices = $db->loadObjectList();

//get the number of multiprices
$count = $db->getAffectedRows();

//get tax and currency

for ($i = 0; $i < $count; $i++) {
 $q = 'SELECT `currency_symbol` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $multiprices[$i]->product_currency . '" ';
$db->setQuery ($q);
$currency[$i] = $db->loadresult();

// for default tax rule, check your default tax id and probably change ...product_tax_id = "1" into your default tax id
if ($multiprices[$i]->product_tax_id == "0") {$multiprices[$i]->product_tax_id ="1";}

$q = 'SELECT `calc_value` FROM `#__virtuemart_calcs` WHERE `virtuemart_calc_id`="' . $multiprices[$i]->product_tax_id . '" ';
$db->setQuery ($q);
$taxvalue = $db->loadresult();
$q = 'SELECT `calc_value_mathop` FROM `#__virtuemart_calcs` WHERE `virtuemart_calc_id`="' . $multiprices[$i]->product_tax_id . '" ';
$db->setQuery ($q);
$mathop = $db->loadresult();

//tax calculation
if ($mathop == "+%") {$multiprices[$i]->product_price = $multiprices[$i]->product_price * (1 + $taxvalue / 100);}
if ($mathop == "-%") {$multiprices[$i]->product_price = $multiprices[$i]->product_price - ($multiprices[$i]->product_price * ($taxvalue / 100));}
if ($mathop == "+")  {$multiprices[$i]->product_price = $multiprices[$i]->product_price + $taxvalue;}
if ($mathop == "-")  {$multiprices[$i]->product_price = $multiprices[$i]->product_price - $taxvalue;}

//price rounding, changing . to ,
$multiprices[$i]->product_price = number_format (round ($multiprices[$i]->product_price, 2), 2, ',', '.');
}
 
//display only if multiprice
if ($count > 1) {
echo '<div id="multiprices">'; //your multiprice div container
echo JText::_('COM_VIRTUEMART_MULTIPRICES')."</br>";

for ($i = 0; $i < $count; $i++) {

if ($i == ($count - 1) && $multiprices[$i]->price_quantity_end == "0"){
//display if last multiprice and quantity end is = 0
echo JText::_('COM_VIRTUEMART_MULTIPRICES_PRICE')." ".$multiprices[$i]->product_price ." ". $currency[$i]." ".JText::_('COM_VIRTUEMART_MULTIPRICES_FROM'). " " .$multiprices[$i]->price_quantity_start ." ". JText::_('COM_VIRTUEMART_MULTIPRICES_QTY')."</br>";
}
else {
//default display
echo JText::_('COM_VIRTUEMART_MULTIPRICES_PRICE')." ".$multiprices[$i]->product_price ." ". $currency[$i]." ".JText::_('COM_VIRTUEMART_MULTIPRICES_START'). " " .$multiprices[$i]->price_quantity_start. " " .JText::_('COM_VIRTUEMART_MULTIPRICES_END') ." ". $multiprices[$i]->price_quantity_end ." ". JText::_('COM_VIRTUEMART_MULTIPRICES_QTY')."</br>";
}
}
echo '</div>';
}

And add theses language vars to your language overrides

COM_VIRTUEMART_MULTIPRICES ="Staffelpreise"
COM_VIRTUEMART_MULTIPRICES_START = "von"
COM_VIRTUEMART_MULTIPRICES_FROM = "ab"
COM_VIRTUEMART_MULTIPRICES_END ="bis"
COM_VIRTUEMART_MULTIPRICES_QTY ="Stück"
COM_VIRTUEMART_MULTIPRICES_PRICE ="Preis:"

Hope this helps some of you! I would appreciate, if someone could add the DB access into a function and provides the vars to productdetailpage.php.

fallnet

  • Beginner
  • *
  • Posts: 10
Re: listing multiple prices on product page
« Reply #8 on: August 01, 2014, 14:46:17 pm »
Hi lanthan,

thank you for share your code.
I have problem with show price with VAT.

When is payment rules default, it doesnt add VAT.
So I must select rules VAT 21%.

Thank you.

lanthan

  • Jr. Member
  • **
  • Posts: 99
  • VM 2.6.10, J2.5.27, PHP5.5
Re: listing multiple prices on product page
« Reply #9 on: August 05, 2014, 15:08:52 pm »
I will have a look and come back to you.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2639
  • VirtueMart Version: 3.2.5
Re: listing multiple prices on product page
« Reply #10 on: August 05, 2014, 17:47:18 pm »
Just for info

Milbo has said in VM3 all prices will be available (although he does not say how they will be structured)
regards
A

Joomla 3.8.2
php 5.6 + php 7

lanthan

  • Jr. Member
  • **
  • Posts: 99
  • VM 2.6.10, J2.5.27, PHP5.5
Re: listing multiple prices on product page
« Reply #11 on: August 05, 2014, 23:37:49 pm »
@Hutson -> Yes, I read it. If VM3 (stable) comes out I will have a look at this.

@fallnet
If you choose "default" the stored product_tax_id is zero. As there is no tax calculation with that id, no tax will be calculated. To solve this problem you just have to set the product_tax_id to 1 or any other existing id. Please give me feedback if this works. I couldn´t test it. Thanks.

Code: [Select]
//get tax and currency

for ($i = 0; $i < $count; $i++) {
 $q = 'SELECT `currency_symbol` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $multiprices[$i]->product_currency . '" ';
$db->setQuery ($q);
$currency[$i] = $db->loadresult();

// for default tax rule, check your default tax id and probably change ...product_tax_id = "1" into your default tax id
if ($multiprices[$i]->product_tax_id == "0") {$multiprices[$i]->product_tax_id ="1";}

$q = 'SELECT `calc_value` FROM `#__virtuemart_calcs` WHERE `virtuemart_calc_id`="' . $multiprices[$i]->product_tax_id . '" ';
$db->setQuery ($q);
$taxvalue = $db->loadresult();
$q = 'SELECT `calc_value_mathop` FROM `#__virtuemart_calcs` WHERE `virtuemart_calc_id`="' . $multiprices[$i]->product_tax_id . '" ';
$db->setQuery ($q);
$mathop = $db->loadresult();

//tax calculation

fallnet

  • Beginner
  • *
  • Posts: 10
Re: listing multiple prices on product page
« Reply #12 on: August 06, 2014, 13:07:44 pm »
Hi lanthan,

your fix works like charm :)
Default tax get tax with id 1 now.

Thank you.

lanthan

  • Jr. Member
  • **
  • Posts: 99
  • VM 2.6.10, J2.5.27, PHP5.5
Re: listing multiple prices on product page
« Reply #13 on: August 11, 2014, 02:23:05 am »
You are welcome!

motybz

  • Beginner
  • *
  • Posts: 22
Re: listing multiple prices on product page
« Reply #14 on: December 07, 2014, 11:33:13 am »
did this option exist in vm3?