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
Quote from: chrs23 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/pcsQuote from: chrs23 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
Hi everybody,
I'm in the same case.
Does someone could explain us how we can display multi prices ?
Thank's by advance
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.
Quote from: logobis 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.
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.
Quote from: chrs23 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
How do I change the displayed values, the lowest to be first?
Many Thanks.
Try this extension
http://extensions.virtuemart.net/products/quantity-related-price-calculation-detail
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.
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.
//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.
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.
I will have a look and come back to you.
Just for info
Milbo has said in VM3 all prices will be available (although he does not say how they will be structured)
@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.
//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
Hi lanthan,
your fix works like charm :)
Default tax get tax with id 1 now.
Thank you.
You are welcome!
did this option exist in vm3?
did this option get added to VM3 ?
if so where ?
The code works also for VM3 (Short test on V3.02). You could have tested this on your own by the way.
override folder
html/com_virtuemart/productdetails/default.php
insert it from line 160. Don´t forget the language overrides.
Like Hutson said, it might be possible that all prices are available on productdetail page with vm3. So probably there could be a solution without DB access. I will check this out in a few weeks and let you know.
Quote from: chrs23 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
I need exactly the same, so still no solution in the core of VM2 or VM3?
Would be nice if customers had a way to see that one product has different prices per quantity as the example you mentioned.
Buy the membership, it is included there.
The code for vm2.6 is
$usermodel = VmModel::getModel ('user');
$currentVMuser = $usermodel->getCurrentUser ();
if(!is_array($currentVMuser->shopper_groups)){
$virtuemart_shoppergroup_ids = (array)$currentVMuser->shopper_groups;
} else {
$virtuemart_shoppergroup_ids = $currentVMuser->shopper_groups;
}
$allPrices = VmModel::getModel('product')->loadProductPrices($this->product->virtuemart_product_id, 0,$virtuemart_shoppergroup_ids,true);
array_reverse($allPrices);
echo '<table>';
foreach($allPrices as $prices){
echo '<tr>';
echo '<td> '.$prices['price_quantity_start'] .'</td>';
echo '<td> '.$prices['price_quantity_end'] .'</td>';
echo '<td> '.$this->currency->priceDisplay($prices['product_price']) .'</td>';
echo '</tr>';
}
echo '</table>';
?>
hello,
I tried the code and put it into my layout, it works.
but i woul like to have tax included prices
what is the code to change it ?
thanks
Serge
Hello, i know that this is an old post but i need some help please. The price listing working fine but how can i show seperate tax amount for every single price in product page.
Example:
Price: 150,00 from 0 to 10 Pieces (Tax amount 20$)
Price: 100,00 from 11 to 20 Pieces (Tax amount 15$)
Price: 50,00 from 21 to 30 Pieces (Tax amount 10$)
Many thanks
echo out the $prices to see if tax is there
otherwise just do a calc on each price to work out the tax if it is always the same and display it
Quote from: Milbo on March 09, 2015, 19:37:03 PM
Buy the membership, it is included there.
What membership? I'd love to buy, and to see what extra features there are, but can't find it.
EDIT: Finally I found this: http://extensions.virtuemart.net/support/virtuemart-supporter-membership-detail
I had seen donation links, but never read the small print. OMG. Used Virtuemart for the first time almost 10 years ago, never knew this existed. Please advertise more prominently!
Hi! Today I found myself searching the same thing, so I checked out the code and came with my own implementation using sublayouts like this:
create a new sublayout in vm directory or your tremplate override named multiprices.php and paste this code
<?php
defined('_JEXEC') or die('Restricted access');
$product = $viewData['product'];
if (count($product->allPrices) > 1) {
$usermodel = VmModel::getModel('user');
$currentVMuser = $usermodel->getCurrentUser();
$currencyDisplay = CurrencyDisplay::getInstance();
$productModel = VmModel::getModel('product');
$shoppergroupModel = VmModel::getModel('shoppergroup');
if(!is_array($currentVMuser->shopper_groups)){
$current_user_shopper_groups = (array)$currentVMuser->shopper_groups;
} else {
$current_user_shopper_groups = $currentVMuser->shopper_groups;
}
?>
<div class="price-ranges">
<h3>
<i class="fa fa-sliders" aria-hidden="true"></i> <?php echo JText::_('COM_VIRTUEMART_MULTIPRICES'); ?>
</h3>
<?php
foreach ($current_user_shopper_groups as $sgKey => $shoppergroup_id) {
foreach ($product->allPrices as $key => $price) {
if ($shoppergroup_id == 1 || $price['virtuemart_shoppergroup_id'] == $shoppergroup_id) {
if (!array_key_exists('salesPrice', $price)) {
$product->selectedPrice = $key;
$price = $productModel->getPrice($product, $price['price_quantity_start']);
}
$shopperGroupDetail = $shoppergroupModel->getShopperGroup($shoppergroup_id);
$quantityEndText = ($key !== (count($product->allPrices) - 1) && (int)$price['price_quantity_end'] > 0) ? VMText::_('COM_VIRTUEMART_MULTIPRICES_END') . ' ' . $price['price_quantity_end'] : VMText::_('COM_VIRTUEMART_MULTIPRICES_END') . ' ' . VMText::_('COM_VIRTUEMART_MULTIPRICES_FINAL');
$shopperGroupText = VMText::_('COM_VIRTUEMART_SHOPPERGROUP_GUEST') != $shopperGroupDetail->shopper_group_name ? VMText::_('COM_VIRTUEMART_MULTIPRICES_SHOPPER_GROUP_PREFIX') . ' ' . $shopperGroupDetail->shopper_group_name : VMText::_('COM_VIRTUEMART_MULTIPRICES_SHOPPER_GROUP_PREFIX') . ' ' . VMText::_('COM_VIRTUEMART_MULTIPRICES_SHOPPER_GROUP_GENERAL');
$priceRange = '<span class="shopper-group">' . $shopperGroupText . '</span>' . '<span class="price">' . $currencyDisplay->priceDisplay($price['salesPrice']) . '</span> <span class="range">' . VMText::_('COM_VIRTUEMART_MULTIPRICES_START') . ' ' . $price['price_quantity_start'] . ' ' . $quantityEndText . '</span>';
?>
<div class="price-range">
<?php echo $priceRange; ?>
</div>
<?php
}
}
}?>
</div>
<?php
}
then in your productdetails/default.php template paste this line of code where you want the multiprices table to be rendered:
<?php echo shopFunctionsF::renderVmSubLayout('multiprices', array('product'=>$this->product)); ?>
then load this lang strings in your overrides lanf file
COM_VIRTUEMART_MULTIPRICES ="Price Ranges"
COM_VIRTUEMART_MULTIPRICES_SHOPPER_GROUP_PREFIX="List"
COM_VIRTUEMART_MULTIPRICES_SHOPPER_GROUP_GENERAL="General"
COM_VIRTUEMART_MULTIPRICES_START = "from"
COM_VIRTUEMART_MULTIPRICES_END ="to"
COM_VIRTUEMART_MULTIPRICES_FINAL = "∞"
last add this CSS to your template css
.productdetails .vm-product-details-container .price-ranges {
font-size: 14px;
text-transform: uppercase;
letter-spacing: initial;
line-height: initial;
color: #555;
word-spacing: 3px;
margin-bottom: 10px;
}
.productdetails .vm-product-details-container .price-ranges h3 {
font-size: 20px;
margin-top: 30px;
border-bottom: 1px solid #e5e5e5;
padding: 15px 0 10px;
text-transform: uppercase;
}
.productdetails .vm-product-details-container .price-range {
padding-left: 10px;
}
.productdetails .vm-product-details-container .price-ranges span.price {
font-weight: bold;
}
.productdetails .vm-product-details-container .price-ranges span.range {
}
Hi
Thank you @lanthan for very useful mod.
I would need your recommend in case I want to show this listing multiple price to registered user only.
My price still show even user not login.
Nice one razor7, that was a very elegant solution.
With a few tweaks it has allowed me to display a list of prices that are discounted via calculations.
Just wanted to say thank you.