News:

Looking for documentation? Take a look on our wiki

Main Menu

Display pricing table by quantity

Started by rayge, June 19, 2013, 21:58:23 PM

Previous topic - Next topic

rayge

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?
I Use: Joomla 3.4.1 & VM 3.0.9

rayge

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.
I Use: Joomla 3.4.1 & VM 3.0.9

bprevost

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?

TRIPLEdm

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.
JC
www.tripledm.com
www.sapromo.com
"... Yesterday is History, Tomorrow is a Mystery, Today is a gift, that's why we call it Present"

rayge

#4
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>
I Use: Joomla 3.4.1 & VM 3.0.9

TRIPLEdm

Thank you!!!

I am going to try the solution I appreciate all your help!
JC
www.tripledm.com
www.sapromo.com
"... Yesterday is History, Tomorrow is a Mystery, Today is a gift, that's why we call it Present"

rayge

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.
I Use: Joomla 3.4.1 & VM 3.0.9

reloadedman

hi
The code is good i need to show price with tax or salesprice.
Pls help

servlet

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)
Он-лайн магазин за фототапети http://mishelfoster.com

Maxim Pishnyak

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?
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

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

servlet

Он-лайн магазин за фототапети http://mishelfoster.com

athollium

please i need to show the price with the tax and rules, where is the table in the db to do thta?
best regards

balai

Max you mean that the sales price will be stored in the db?

Vicki Payne

#14
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