Quantity Range Price Table in product details page (VM 3.6.3 + Joomla3.9.13)

Started by jackynetwork, November 17, 2019, 07:08:06 AM

Previous topic - Next topic

jackynetwork

Does anyone could get a help to let the QTY range table showed in the latest VM 3.6.3 and Joomla 3.9 version.
I would buy a coffee for you if you get me a support.

Thank you, friend !

Jacky

GJC Web Design

I use this in the product details template but there may be cleaner ways using the price & currency models

<?php  //GJC

$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);

$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();
#print 'Debug Line '.__LINE__.' $prices <pre>'; print_r ($prices); print "</pre><br />\n";
if(!empty ($prices) && count($prices) > 1){
?>

<div class="qprices_product">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="pdqprices">
<tr>
<tr>
<td class="pheader"><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_QUANTITY_LBL'?></td>
<td class="pheader" align="right"><?php echo vmText::_('COM_VIRTUEMART_CART_PRICE'?></td>
</tr>
<tr>
<?php
$ct=0;
foreach($prices as $price) {

$price_range '';
if($price->price_quantity_start 0){
$price_range .= $price->price_quantity_start.' - ';
}else{
$price_range '';
}
if($price->price_quantity_end 9999){
$price_range str_replace(' -''',$price_range);
$price_range .= '+';
}else{
$price_range .= $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>\n<tr>\n";
}
echo "<td class='pinfo'>".$price_range."</td>\n";
//with vat is ($price->product_price*1.21)
echo "<td align='right'  class='pinfo'>&euro; ".number_format($price->product_price2','' ')."</td>\n";
$ct++;
}
?>

</tr>
</table>
</div>
<?php
}
//GJC ?>
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation