Dealplaza template system fonts color

I think that from VM side is the best choice as when the quantity ends, there are no available deals to buy.
So calling back the code,
<?php
$db = & JFactory::getDBO();
$id = $custom[3]->value;
$sql = 'SELECT product_ordered FROM #__virtuemart_products WHERE virtuemart_product_id='.$id;
$db->setQuery($sql) ;
$item_sold = $db->loadResult();
echo $item_sold;
?>

Where i can add this VM Call? Many Thanks for your help
11 years 7 months ago #7 by Alfred
The topic has been marked as resolved.
Here are codes to be used
$db = & JFactory::getDBO();
 
// to get num of sold item
$id = $custom[3]->value;
$sql = 'SELECT product_ordered FROM #__virtuemart_products WHERE virtuemart_product_id='.$id;
$db->setQuery($sql);
$item_sold = $db->loadResult();
echo $item_sold;
 
// to get number of stock available
$sql2 = 'SELECT product_in_stock FROM #__virtuemart_products WHERE virtuemart_product_id='.$id;
$db->setQuery($sql2);
$num_of_product_in_Stock = $db->loadResult();
echo $num_of_product_in_Stock;

Have fun with that..
11 years 7 months ago #8 by erwinschro
The topic has been marked as resolved.

Where i can add this VM Call?


Of course call them inside the following files:

/deals_plazza/html/com_k2/dealplazza/category_item.php and
/deals_plazza/html/com_k2/dealplazza/item.php
11 years 7 months ago #9 by erwinschro
The topic has been marked as resolved.
Hi erwinschro. Many thanks for your help. One sole question. To display remaining deals available?
11 years 7 months ago #10 by Alfred
The topic has been marked as resolved.
Esposito,
Try this
$db = & JFactory::getDBO();
 
// to get num of sold item
$id = $custom[3]->value;
$sql = 'SELECT product_ordered FROM #__virtuemart_products WHERE virtuemart_product_id='.$id;
$db->setQuery($sql);
$item_sold = $db->loadResult();
echo $item_sold;
 
// to get number of stock available
$sql2 = 'SELECT product_in_stock FROM #__virtuemart_products WHERE virtuemart_product_id='.$id;
$db->setQuery($sql2);
$num_of_product_in_Stock = $db->loadResult();
echo $num_of_product_in_Stock;
 
// to get remaining stock
$remaining_stock = $num_of_product_in_Stock - $item_sold;
echo $remaining_stock;
11 years 7 months ago #11 by andy
The topic has been marked as resolved.
Powered by Kunena Forum