Dealplaza template system fonts color
- Posted by Alfred (50) Offline
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
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
The topic has been marked as resolved.
- Posted by erwinschro (1034) Offline
Here are codes to be used
Have fun with that..
11 years 7 months ago #8
by erwinschro
$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..
The topic has been marked as resolved.
- Posted by erwinschro (1034) Offline
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
The topic has been marked as resolved.
- Posted by Alfred (50) Offline
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.
- Posted by andy (759) Offline
Esposito,
Try this
11 years 7 months ago #11
by andy
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;
The topic has been marked as resolved.