Does anyone know how to remove the stock quantity on the product detail page so it just says "In stock" or "out of stock" without the quantity being displayed?
Before you mention to uncheck the box that says "Display stock level", we did that; the quantity still shows up (bug?).
We are using VirtueMart 3.0.2 and Joomla 3.3.6.
I found this old link which seems to talk about what I want to do, but the file referred to in the example doesn't exist.
http://forum.virtuemart.net/index.php?topic=80684.0
Any assistance is greatly appreciated.
in the default.php somewhere
if($this->product->product_in_stock >0{
echo 'In Stock';
}else{
echo 'Out of Stock';
}
Thank you GJC. I'll give that a try.
Another question... which default.php file do I edit?
I found one here:
httpdocs/templates/t3_blank/tpls/default.php
There is also another one here:
httpdocs/templates/t3_blank/html/com_virtuemart/virtuemart/default.php
and one here:
httpdocs/templates/t3_blank/html/com_virtuemart/productdetails/default.php
There's more, but you get the idea.
Also, I don't have much experience editing php files. Am I just adding the code to the file, or editing existing code.
httpdocs/templates/t3_blank/html/com_virtuemart/productdetails/default.php
adding
Hello again GJC, Thank you for your help so far.
I found the following code on the default.php page:
-------------------------------------------------
<?php
// Manufacturer of the Product
if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {
echo $this->loadTemplate('manufacturer');
}
if ($this->product->product_in_stock >=1) {
echo '<div class="stock"><span class="bold">'.JText::_('DR_AVAILABILITY_NEW').':</span><i class="green">'.JText::_('DR_IN_STOCK_NEW').'</i> <b>'.$this->product->product_in_stock.' '.JText::_('DR_ITEMS_NEW').'</b></div>';
}else {
echo '<div class="stock"><span class="bold">'.JText::_('DR_AVAILABILITY_NEW').':</span><i class="red">'.JText::_('DR_OUT_STOCK_NEW').'</i> <b>'.$this->product->product_in_stock.' '.JText::_('DR_ITEMS_NEW').'</b></div>';
}
echo '<div class="code"><span class="bold">'.JText::_('DR_PRODUCT_CODE_NEW').':</span>'.$this->product->product_sku.'</div>';
?>
-----------------------------------
I am assuming I should add the code after the last </div>'; but before ?>
So code should look like the following:
------------------------------------
echo '<div class="code"><span class="bold">'.JText::_('DR_PRODUCT_CODE_NEW').':</span>'.$this->product->product_sku.'</div>';
if($this->product->product_in_stock >0{
echo 'In Stock';
}else{
echo 'Out of Stock';
}
?>
---------------------------------------
Does that sound right?
should work -- but no test like trying.. ;)
I tried.... nothing happened. :-\
At least the site didn't break, but nothing changed.
Maybe I pasted the code in the wrong place?
I tried something new (experimenting... )
Original code:
if ($this->product->product_in_stock >=1) {
echo '<div class="stock"><span class="bold">'.JText::_('DR_AVAILABILITY_NEW').':</span><i class="green">'.JText::_('DR_IN_STOCK_NEW').'</i> <b>'.$this->product->product_in_stock.' '.JText::_('DR_ITEMS_NEW').'</b></div>';
}else {
echo '<div class="stock"><span class="bold">'.JText::_('DR_AVAILABILITY_NEW').':</span><i class="red">'.JText::_('DR_OUT_STOCK_NEW').'</i> <b>'.$this->product->product_in_stock.' '.JText::_('DR_ITEMS_NEW').'</b></div>';
}
-------------------
Modified Code:
if ($this->product->product_in_stock >=1) {
echo '<div class="stock"><span class="bold">'.JText::_('DR_AVAILABILITY_NEW').':</span><i class="green">'.JText::_('DR_IN_STOCK_NEW').'</i> </div>';
}else {
echo '<div class="stock"><span class="bold">'.JText::_('DR_AVAILABILITY_NEW').':</span><i class="red">'.JText::_('DR_OUT_STOCK_NEW').'</i> </div>';
}
-----------------
I basically removed this part from both sections:
<b>'.$this->product->product_in_stock.' '.JText::_('DR_ITEMS_NEW').'</b>
Result .... nothing changed.
I'm not sure of my next move.
I found the problem (with help from Frans D). I was modifying default.php. The site was using default2.php
The code above in my last post seems to work.