VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: rayge on June 19, 2013, 21:58:23 PM

Title: Display pricing table by quantity
Post by: rayge on June 19, 2013, 21:58:23 PM
I am trying to setup a pricing table display by quantity per shopper group logged in.
Right now we are only focusing on 1 pricing group but i have something like this.

0-24 $0.85
25-124 $0.75

I have added this to a test product but I only see the 1st price in the product details.
and the price only changes when they have chosen the proper quantity range.

I would like to see the prices + quantities so they know what to expect before selecting a quantity.

When i try and do this
echo "<pre>";
print_r($this->product->prices);
echo "</pre>";

I only see the base price

Any ideas?
Title: Re: Display pricing table by quantity
Post by: rayge on June 22, 2013, 22:49:52 PM
OK looks like i will be having to custom code it myself. it shouldnt be hard to do anyways.
and I couldn't find anything even remotely related to the info i was trying to find in the code so I could use was was already available..
If anyone wants the basic starting code lemme know and I will post it.
Title: Re: Display pricing table by quantity
Post by: bprevost on June 23, 2013, 13:32:13 PM
Quote from: rayge on June 22, 2013, 22:49:52 PM
OK looks like i will be having to custom code it myself. it shouldnt be hard to do anyways.
and I couldn't find anything even remotely related to the info i was trying to find in the code so I could use was was already available..
If anyone wants the basic starting code lemme know and I will post it.

Hi Rayge,

I'm looking to show the price for each range in quantity in my Category layout AND product details page.
If you figured it out, let me know, this will be VERY useful.

Can anyone else help on this?
Title: Re: Display pricing table by quantity
Post by: TRIPLEdm on June 23, 2013, 17:34:13 PM
Please do share the solution I am also having the same problem.

It shows price X, then you change quantity it it does not show the TOTAL amount for eg. 5 items, just the base price.
Title: Re: Display pricing table by quantity
Post by: rayge on June 24, 2013, 22:27:51 PM
OK this is what i am using inside the pruductdetails/default_showprices.php file you may use it how you see fit.

<?php
$usermodel 
VmModel::getModel ('user');
$currentVMuser $usermodel->getCurrentUser ();
$currentVMuser->shopper_groups[] = '0'//This allows pricing for ALL Shopper groups to appear
$virtuemart_shoppergroup_ids $currentVMuser->shopper_groups;
$virtuemart_shoppergroup_id_str implode(',',$virtuemart_shoppergroup_ids);

//ADDED BY RLH TO SHOW A PRICE LIST
$db JFactory::getDBO();
$sql "
SELECT
product_price, price_quantity_start, price_quantity_end
FROM #__virtuemart_product_prices
WHERE
virtuemart_product_id = '"
.$this->product->virtuemart_product_id."'
AND
virtuemart_shoppergroup_id IN ("
.$virtuemart_shoppergroup_id_str.")
"
;
$db->setQuery($sql);
$prices $db->loadObjectList();

?>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<tr>
<td>Quatity</td>
<td>Price</td>
</tr>
<tr>
<?php
$ct
=0;
foreach(
$prices as $price) {

$price_range $price->price_quantity_start.' - '.$price->price_quantity_end;
if($price->price_quantity_end == && $price->price_quantity_start 0) {
$price_range ' > '.$price->price_quantity_start;
}
if($price->price_quantity_end == && $price->price_quantity_start == 0) {
$price_range ' ANY ';
}

if($ct>0) {
echo '</tr><tr>';
}
echo '<td>'.$price_range.'</td>';
echo '<td>$'.round($price->product_price,2).'</td>';
$ct++;
}
?>

</tr>
</table>
Title: Re: Display pricing table by quantity
Post by: TRIPLEdm on June 25, 2013, 13:23:18 PM
Thank you!!!

I am going to try the solution I appreciate all your help!
Title: Re: Display pricing table by quantity
Post by: rayge on July 03, 2013, 22:57:51 PM
FYI since 2.0.21g  they changed how the shopper group variable shows up so i changed the code in the POST ABOVE.
Please recopy everything before the first table tag to get the new code.
Title: Re: Display pricing table by quantity
Post by: reloadedman on July 08, 2013, 12:02:37 PM
hi
The code is good i need to show price with tax or salesprice.
Pls help
Title: Re: Display pricing table by quantity
Post by: servlet on September 05, 2013, 23:09:38 PM
Quote from: rayge on July 03, 2013, 22:57:51 PM
FYI since 2.0.21g  they changed how the shopper group variable shows up so i changed the code in the POST ABOVE.
Please recopy everything before the first table tag to get the new code.


Please post(paste) this code in this section to be implemented in the next version...
http://forum.virtuemart.net/index.php?board=139.0
Is it possible to add tax (and calculation rules)
Title: Re: Display pricing table by quantity
Post by: Maxim Pishnyak on September 08, 2013, 09:59:31 AM
Quote from: servlet on September 05, 2013, 23:09:38 PM
Is it possible to add tax (and calculation rules)
Did you do some digging in places where taxes or rules are used in VM?
Title: Re: Display pricing table by quantity
Post by: Milbo on September 08, 2013, 12:41:46 PM
Comes in vm2.1
Title: Re: Display pricing table by quantity
Post by: servlet on September 08, 2013, 12:59:41 PM
Thanks Milbo ;)
Title: Re: Display pricing table by quantity
Post by: athollium on December 27, 2013, 19:24:01 PM
please i need to show the price with the tax and rules, where is the table in the db to do thta?
best regards
Title: Re: Display pricing table by quantity
Post by: balai on December 30, 2013, 10:04:06 AM
Max you mean that the sales price will be stored in the db?
Title: Re: Display pricing table by quantity
Post by: Vicki Payne on March 13, 2014, 18:14:28 PM
Hi, rayge -

We've been using your default_priceslist (edit) default_showprices override for a few months, mostly with good results. However, we have found recently that sometimes when product prices are added, the prices aren't displayed in the correct order. For instance, prices will display this way:
>2500          $0.50
1000-2499   $0.60
1-999           $0.70

(normally the 1-999 price will be displayed first). If I try deleting all prices (then saving) then re-adding all prices one by one (and saving each time)... sometimes this will correct the issue, but sometimes it will not, so this is very puzzling.

I've been watching the data in the virtuemart_product_prices table to try and find out exactly what is happening -- it doesn't seem that the prices are loading according to order of the rows OR in order of the virtuemart_product_price_id column. In my opinion, they should be filtered from lowest quantity to highest, of course, but even if they are listed consistently by the virtuemart_product_price_id that would be an improvement (even though prices and quantity prices would still need to be saved individually as they are added).

This will be a really nice feature if added to VM 2.1 as Milbo stated above, but this issue definitely needs addressing. Let me know if you need to have access to the site I'm finding this on - it was not happening for previous products but is now happening for almost every product added, so maybe that's a clue (shop has about 500 products).

Thank you,
Vicki
Title: Re: Display pricing table by quantity
Post by: cheide on April 14, 2014, 01:38:09 AM
to sort lowest to highest ad this line:

ORDER BY price_quantity_start, price_quantity_end;

right after

virtuemart_shoppergroup_id IN (".$virtuemart_shoppergroup_id_str.")
Title: Re: Display pricing table by quantity
Post by: dmuntean on May 14, 2014, 17:30:18 PM
Thank you, This works great!
Title: Re: Display pricing table by quantity
Post by: WebStuff on July 22, 2014, 19:11:03 PM
For those trying to find the VAT rate(and other taxes) it should be available in these arrays for the productdetails page. I've put my Vat tax array in as is to show which variable it would be.:

Discount Before Tax
$this->product->prices['DBTax']
Misc Tax
$this->product->prices['Tax']
VAT Tax
$this->product->prices['VatTax'] => Array ( [1] => Array ( [0] => VAT [1] => 20.0000 [2] => +% [3] => 1 [4] => 52 [5] => [6] => 1 [7] => 1 ) )
Discount After Tax
$this->product->prices['DATax']

So to get my VAT rate I would use :
$vat_rate = $this->product->prices['VatTax'][1][1];
which gives the value 20.0000;
The rest is just simple maths.

If you want this on the category pages find where the products are stepped through and use $product->prices array instead.
Hope this helps.
Title: Re: Display pricing table by quantity
Post by: Milbo on July 29, 2014, 15:33:54 PM
Thank you Mirrosandglass,

In vm3, all prices are always already loaded. I am sure you will have fun with it.
Title: Re: Display pricing table by quantity
Post by: WebStuff on July 29, 2014, 16:22:40 PM
Quote from: Milbo on July 29, 2014, 15:33:54 PM
In vm3, all prices are always already loaded. I am sure you will have fun with it.
Thanks Milbo,
I'm already at a good stage playing with the vm3 svn on Joomla 3.3.3.    :-)
Title: Re: Display pricing table by quantity
Post by: lanthan on July 30, 2014, 17:22:57 PM
including tax calculation

http://forum.virtuemart.net/index.php?topic=114040.msg427903#msg427903
Title: Re: Display pricing table by quantity
Post by: lamcpp on August 06, 2014, 20:30:42 PM
Ok, please tell me how do each of these price link after pressing the product is added to the cart with the appropriate price
Title: Re: Display pricing table by quantity
Post by: servlet on May 24, 2016, 17:14:02 PM
Ok. Is it possible to display table in vm 3 now?
Title: Re: Display pricing table by quantity
Post by: jenkinhill on May 24, 2016, 17:47:53 PM
I believe it is available in the member version: http://extensions.virtuemart.net/support/virtuemart-supporter-membership-detail
Title: Re: Display pricing table by quantity
Post by: servlet on May 24, 2016, 18:35:34 PM
Just make VM commercial extension. It will be better...