News:

Support the VirtueMart project and become a member

Main Menu

show Out of stack in category view

Started by kavoosi127, May 05, 2014, 02:36:01 AM

Previous topic - Next topic

kavoosi127

hi
i want to show out of stack in category view..
for example in this page

http://ninimahsool.ir/shop/دسته-بندی-محصولات/وسایل-خواب

under the title of each product if it's out of stack show out of stack!
i know i should edit templates/my_template/html/com_virtuemart/category/default.php but i don't know how!!
please help..

GJC Web Design

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

kavoosi127

yes sorry..
i mean stock
i want to add an if sentence like this:
if product stock level<1 then echo 'Out of stock'
can you help me?

GJC Web Design

I've pointed you to the relavent page with the way to obtain the stock level...

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

kavoosi127

<?php
               if ($product->stock->stock_level == '0') {
                  echo 'out of stack' ; }
                  ?>

i added this code but no thing happen!!
i'm poor in php code writing!!
how can i write right code?

GJC Web Design

echo out   $product->stock->stock_level to see what it is first .. maybe you need something in config etc

the code snippet is correct if $product->stock->stock_level exists and equals 0

but check what its value is
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

JoomTut

Simple, use this code:
// Availability
if ($product->product_in_stock == 0) { ?>
<div class="availability">
<?php echo "Out of stack"?>
</div>
<?php ?>
   

Advanced, use VirueMart Configuration -> Action when a Product is Out of Stock.
http://www.joomtut.com - How to Joomla!
Joomla! & VirtueMart Pro Support.
http://www.joomtut.com/joomla-clip.html - 14 steps to creating a Joomla! website with video clip tutorials