product quantity in category

philippe.t
30 Posts
philippe.t posted this 07 September 2023
Ask a Question

hello,

How to display the product_in_stock with category or productdetails in virtuemart ?

i want to display the quantity of the product in category or productdetails.

But in your system, we can not use this with an element exist.
have you solution as element php like

<?php echo $product->shortDesc;

?>

i think

echo $product->product_in_stock

but not working.

Regards,
Philippe

hello, How to display the product_in_stock with category or productdetails in virtuemart ? i want to display the quantity of the product in category or productdetails. But in your system, we can not use this with an element exist. have you solution as element php like <?php echo $product->shortDesc; ?> i think echo $product->product_in_stock but not working. Regards, Philippe

Last edited 08 September 2023 by Support Team

Vote to pay developers attention to this features or issue.
5 Replies
Order By: Standard | Newest
Support Team
Support Team posted this 08 September 2023

philippe,

We have forwarded your request to the dev team.

...................................................
Sincerely,
Alan R.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

philippe, We have forwarded your request to the dev team. ................................................... Sincerely, Alan R. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
philippe.t
30 Posts
philippe.t posted this 08 September 2023

Thanks Alan.

we also have other specifications for the product
like:
product_sku
product_gtin
product_mpn
product_weight
product_weight_uom
product_length
product_width
product_lwh_uom
mf_name
categories_name
priceWithoutTax
priceBeforeTax
salesPriceWithDiscount
etc...
if you can solve this

Regards
philippe

Thanks Alan. we also have other specifications for the product like: product_sku product_gtin product_mpn product_weight product_weight_uom product_length product_width product_lwh_uom mf_name categories_name priceWithoutTax priceBeforeTax salesPriceWithDiscount etc... if you can solve this Regards philippe
philippe.t
30 Posts
philippe.t posted this 11 September 2023

Hello,

if this use can be useful to someone, for example:
in the category products with php element:

<?php

$productModel = VmModel::getModel('product');
$Productdetail = $productModel->getproduct($this->products["products"][$itemIndex]->virtuemart_product_id);
echo $Productdetail->product_name;
echo "<br>";
echo $Productdetail->product_in_stock;
echo "<br>";
echo $Productdetail->product_sku;
echo "<br>";
echo $Productdetail->slug;
echo "<br>";
?>
etc...

in productdetails :

<?php echo $this->product->product_desc; ?>
<?php echo $this->product->product_s_desc; ?>
<?php echo $this->product->product_in_stock; ?>

etc...

Regards
Philippe

Hello, if this use can be useful to someone, for example: in the category products with php element: <?php $productModel = VmModel::getModel('product'); $Productdetail = $productModel->getproduct($this->products["products"][$itemIndex]->virtuemart_product_id); echo $Productdetail->product_name; echo "&lt;br&gt;"; echo $Productdetail->product_in_stock; echo "&lt;br&gt;"; echo $Productdetail->product_sku; echo "&lt;br&gt;"; echo $Productdetail->slug; echo "&lt;br&gt;"; ?> etc... in productdetails : <?php echo $this->product->product_desc; ?> <?php echo $this->product->product_s_desc; ?> <?php echo $this->product->product_in_stock; ?> etc... Regards Philippe

Last edited 11 September 2023 by philippe.t

Support Team
Support Team posted this 12 September 2023

Hello Philippe,

To display the product quantity (product_in_stock) in VirtueMart using PHP code, you can try the following:

<?php
$product = JFactory::getApplication()->input->get('product_id');
$quantity = VirtueMartModelProduct::model()->getProductSingle($product)->product_in_stock;

echo "Quantity in stock: " . $quantity;
?>

Make sure to place this code in the appropriate location within your VirtueMart template or page, depending on where you want to display the product quantity.

Please note that the code above assumes that you have the necessary VirtueMart functions and variables available in your Joomla environment. If you encounter any issues, it's a good idea to consult VirtueMart's documentation or support for further assistance, as the code may vary depending on your specific VirtueMart setup.

If you have any more questions or need further assistance, feel free to ask.
...................................................
Sincerely,
Ahmad.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hello Philippe, To display the product quantity (product_in_stock) in VirtueMart using PHP code, you can try the following: <?php $product = JFactory::getApplication()->input->get('product_id'); $quantity = VirtueMartModelProduct::model()->getProductSingle($product)->product_in_stock; echo "Quantity in stock: " . $quantity; ?> Make sure to place this code in the appropriate location within your **VirtueMart** template or page, depending on where you want to display the product quantity. Please note that the code above assumes that you have the necessary **VirtueMart** functions and variables available in your Joomla environment. If you encounter any issues, it's a good idea to consult VirtueMart's documentation or support for further assistance, as the code may vary depending on your specific VirtueMart setup. If you have any more questions or need further assistance, feel free to ask. ................................................... Sincerely, Ahmad. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
philippe.t
30 Posts
philippe.t posted this 12 September 2023

Hello Ahmad,

Thanks for your good response.

And i saw we can also use in categories/products list :

<?php echo $p[$itemIndex]->product_in_stock;
?>

you used the variable $p and $itemIndex in your nicepage template for categoriesproduct list

Regards,
Philippe

Hello Ahmad, Thanks for your good response. And i saw we can also use in categories/products list : <?php echo $p[$itemIndex]->product_in_stock; ?> you used the variable $p and $itemIndex in your nicepage template for categoriesproduct list Regards, Philippe

Last edited 12 September 2023 by philippe.t

You must log in or register to leave comments