Hi guys
Is there a simple way to add a column to the productlist toolbar. In the toolbar you have ex. Children and Product children of,...... I rather use this column for lets say the stock of my product. I,m sure there is some brains in here that can tell me where and mayby how to do this :)
I have attached a screen shot to explain what I mean for easier understanding
VirtueMart 2.6.12.2
[attachment cleanup by admin]
assuming stock level is in the $product object change administrator\components\com_virtuemart\views\product\tmpl\default.php
over rides work in the admin as well
Hi,
and thanks a bunch. Would it be to much to ask for a little bit more explanation on howto, mayby a step by step guide. I,m a newbee and just not as good as many of you in here :)
Create an override by copying the
\administrator\components\com_virtuemart\views\product\tmpl\default.php
into
\administrator\templates\bluestork\html\com_virtuemart\product\default.php
these are the headers for child stuff
<?php if (!$product_parent_id ) { ?>
<th width="10%"><?php echo $this->sort('product_parent_id','COM_VIRTUEMART_PRODUCT_CHILDREN_OF'); ?></th>
<?php } ?>
<th width="80px" ><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_PARENT_LIST_CHILDREN'); ?></th>
Replace with what you want
And then do the same for the detail
<?php if (!$product_parent_id ) { ?>
<td><?php
if ($product->product_parent_id ) {
VirtuemartViewProduct::displayLinkToParent($product->product_parent_id);
}
?></td>
<!-- Vendor name -->
<?php } ?>
<td><?php
VirtuemartViewProduct::displayLinkToChildList($product->virtuemart_product_id , $product->product_name);
?>
</td>
And here is a small stock thing I wrote to help admins easily see stock stuff in the list
<?php
if ($product->published) {
$published;
$available = $product->product_in_stock - $product->product_ordered;
if ($available < 1){
echo "<div class='stockout'>";
echo "Out ". $available;
} elseif ($available > 1 && $available < $product->low_stock_notification ) {
echo "<div class='stocklow'>";
echo "Low ". $available;
} else {
echo "<div class='stockok'>";
echo "In ". $available;
}
echo "</div>";
echo 'Stk: '.$product->product_in_stock;
// echo '<br/>Ord: '.$product->product_ordered;
// echo '<br/>Lvl: '.$product->low_stock_notification;
}
?>
The classes allow styling of the various stock positions you could code these as inline styles in the above code to simplify things
.stockout {
font-weight:bold;
color:red;
}
.stocklow {
font-weight:bold;
font-size: 110%;
color:orange;
}
.stockok {
font-weight:bold;
font-size: 110%;
color:green;
}
Thanks a bunch Huston
Your not only a heromember in here right now. You are my hero too :)
Since you know your way around this, please let me ask you one more question ! One thin we always wanted to have in Virtuemart but never figured out how ! A function or a area where we could se the total STOCK VALUE for the whole shop. Is there a way to something like that, or is there a plugin or something already that ads this function.
Thanks for your brilliant help
I do all this type of reporting using ODBC connections to the database or a copy of the dbase
see here
http://forum.virtuemart.net/index.php?topic=124493.msg425712#msg425712 (http://forum.virtuemart.net/index.php?topic=124493.msg425712#msg425712) My reply
Thanks again Huston
Your code snippet above for showing stock in product list now work like a charm. Thank you very much :) Now, theres one more field I want to show in the product list, product_mpn
I use this field for the wearhouse location of my products.
Is there a code snippet you have that can solve this too ?
<td align ="left>">
<div class="adminprod"> <!--<span style="float:left; clear:left"> -->
<?php echo JHtml::_('link', JRoute::_($link), $product->product_name, array('title' => vmText::_('COM_VIRTUEMART_EDIT').' '.$product->product_name)); ?>
</div>
<div class="adminsku">
<?php echo $product->product_sku;
if (!empty($product->product_mpn)){
echo '<span style="font-style: italic;color:green;"><br/>MPN:- ' . $product->product_mpn . '</span>';
}
?>
</div>
</td>
This use the product name column and sticks the MPN in there if not empty
You can style the class with CSS
Dear Hutson,
Thanks a bunch for helping me out. You are the best.
One question, If I need some custom programming. Can I hire you ? Send me an PM if ok :)
Again, thanks for all your help
Humstad
I do not do custom programming 8)
There are a number of great posters on these boards that will do custom work GJC Web Design is always very helpful
Hi Hutson, if your still around,
All you did for me helped a lot. I,m a very happy man. Now, I got one last question for you :)
This is regarding the mpn field. As I told you earlier I use this field for my products location. All got much easier when adding this to my product list like you showed me. But the ultimate thing would be to also add this field to the print sheet, ex replacing the Discount field in the print sheet.
What I want is basicly is print my order and see the location ( mpn field ) on the print sheet instead of ex. the discount table
Can that be done ?
you've already been answered here!!! http://forum.virtuemart.net/index.php?topic=126994.0
Thanks GJC
Some of my brain is possible not working. Thanks for the reminder. Need to get som Red Bull :)