News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

HACK / Config / Setup Admin Product List page New Columns! :D

Started by lipes, May 06, 2012, 04:24:19 AM

Previous topic - Next topic

lipes

Hi. It's possible to have new columns in the Back End.. Product List/Table view ( administrator/index.php?option=com_virtuemart&view=product ) ?

I want to add/insert two new Columns:
- the product Weight ;
- the Product Final Price;

and i want to Removesome unusefull Columns that I  Dont need like the:
- Cost price;
- Shopper Reviews;
- Send Email to shoppers;

where or how can we do it ?!
Thanks.
VM V. online: J2.5.14 | VM 2.0.20a | SQL 5.1.70 | PHP 5.3.25

John2400


lipes

#2
Sounds interesting, has a simple design that is good. But its one more extension not a native setting in VM.....

I think (it's my opinion) it would be better if in some next future release of Virtuemart the Users Administrators could have the ability/possibility to choose (add/hide) the Columns in the Administration Areas as a setting/configuration option.
That would be very usefull to all off us, dont you think?!

Is possible to do a Override of this file to test some changes without lost the original work?!!

I want to change the default <!-- Product price -->
<td><?php echo isset($product->product_price_display)? $product->product_price_display:JText::_('COM_VIRTUEMART_NO_PRICE_SET') ?></td>

To any php code that give us the product final sales price... Because we dont work/need the base price..

It's Strange to have product price Column like:
12.19512
4.87805
etc...
this are not a clean prices to have in administration column..
so it's really need/necessary to find a way to work with the Final Product Price...   :-[
VM V. online: J2.5.14 | VM 2.0.20a | SQL 5.1.70 | PHP 5.3.25

lipes

#3
I've inserted the Column with the Product weigth :)
But cant find the PHP Code to insert the Value of Product Final Price, can you help me, please?! Only miss that thing... :-\
here's my code:
<?php
/**
*
* Description
*
* @package VirtueMart
* @subpackage
* @author
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: product.php 3304 2011-05-20 06:57:27Z alatak $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
AdminUIHelper::startAdminArea();

/* Load some variables */
$search_date JRequest::getVar('search_date'null); // Changed search by date
$now getdate();
$nowstring $now["hours"].":".substr('0'.$now["minutes"], -2).' '.$now["mday"].".".$now["mon"].".".$now["year"];
$search_order JRequest::getVar('search_order''>');
$search_type JRequest::getVar('search_type''product');
// OSP in view.html.php $virtuemart_category_id = JRequest::getInt('virtuemart_category_id', false);
if ($product_parent_id=JRequest::getInt('product_parent_id'false))   $col_product_name='COM_VIRTUEMART_PRODUCT_CHILDREN_LIST'; else $col_product_name='COM_VIRTUEMART_PRODUCT_NAME';

?>

<form action="index.php" method="post" name="adminForm" id="adminForm">
<div id="header">
<div id="filterbox">
<table class="">
<tr>
<td align="left">
<?php echo JText::_('COM_VIRTUEMART_FILTER'?>:
<select class="inputbox" id="virtuemart_category_id" name="virtuemart_category_id" onchange="document.adminForm.submit(); return false;">
<option value=""><?php echo JText::sprintf'COM_VIRTUEMART_SELECT' ,  JText::_('COM_VIRTUEMART_CATEGORY')) ; ?></option>
<?php echo $this->category_tree?>
</select>
<?php echo JHTML::_('select.genericlist'$this->manufacturers'virtuemart_manufacturer_id''class="inputbox" onchange="document.adminForm.submit(); return false;"''value''text',
  $this->model->virtuemart_manufacturer_id );
?>


<?php echo JText::_('COM_VIRTUEMART_PRODUCT_LIST_SEARCH_BY_DATE'?>&nbsp;
<input type="text" value="<?php echo JRequest::getVar('filter_product'); ?>" name="filter_product" size="25" />
<?php
echo $this->lists['search_type'];
echo $this->lists['search_order'];
echo vmJsApi::jDate(JRequest::getVar('search_date'$nowstring), 'search_date''class="datepicker" size="9"');
//echo JHTML::calendar( JRequest::getVar('search_date', $nowstring), 'search_date', 'search_date', '%H.%M %d.%m.%Y', 'size="20"');
?>

<button onclick="this.form.submit();"><?php echo JText::_('COM_VIRTUEMART_GO'); ?></button>
<button onclick="document.adminForm.filter_product.value=''; document.adminForm.search_type.options[0].selected = true;"><?php echo JText::_('COM_VIRTUEMART_RESET'); ?></button>
</td>

</tr>
</table>
</div>
<div id="resultscounter"><?php echo $this->pagination->getResultsCounter(); ?></div>

</div>

<div style="text-align: left;">
<?php
// $this->productlist

?>

<table class="adminlist" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th><input type="checkbox" name="toggle" value="" onclick="checkAll('<?php echo count($this->productlist); ?>')" /></th>
<th><?php echo $this->sort('product_name',$col_product_name?> </th>
<?php if (!$product_parent_id ) { ?>
                <th><?php echo $this->sort('product_parent_id','COM_VIRTUEMART_PRODUCT_CHILDREN_OF'); ?></th>
                <?php ?>
                <th><?php echo JText::_('COM_VIRTUEMART_PRODUCT_PARENT_LIST_CHILDREN'); ?></th>
                <th><?php echo JText::_('COM_VIRTUEMART_PRODUCT_MEDIA'); ?></th>
<th><?php echo $this->sort('product_sku'?></th>
<th><?php echo $this->sort('product_price''COM_VIRTUEMART_PRODUCT_PRICE_TITLE') ; ?></th>
<?php /* <th><?php echo JHTML::_('grid.sort', 'COM_VIRTUEMART_CATEGORY', 'c.category_name', $this->lists['filter_order_Dir'], $this->lists['filter_order'] ); ?></th> */ ?>
<th><?php echo JText::_'COM_VIRTUEMART_CATEGORY'); ?></th>
<!-- Only show reordering fields when a category ID is selected! -->
<?php
$num_rows 0;
if( $this->virtuemart_category_id ) { ?>

<th>
<?php echo $this->sort('ordering''COM_VIRTUEMART_FIELDMANAGER_REORDER'); ?>
<?php echo JHTML::_('grid.order'$this->productlist); //vmCommonHTML::getSaveOrderButton( $num_rows, 'changeordering' ); ?>
</th>
<?php ?>
<th><?php echo $this->sort('mf_name''COM_VIRTUEMART_MANUFACTURER_S') ; ?></th>
<th><?php echo $this->sort('product_weight''COM_VIRTUEMART_PRODUCT_WEIGHT') ; ?></th>
<th><?php echo $this->sort('modified_on''Actualizado') ; ?></th>
<!-- <th><?php /* echo JText::_('COM_VIRTUEMART_REVIEW_S'); ?></th>
<th><?php echo JText::_('COM_VIRTUEMART_PRODUCT_EMAILTOSHOPPERS'); */ ?></th> -->
<th width="40px" ><?php echo $this->sort('published'); ?></th>
                <th><?php echo $this->sort('virtuemart_product_id''COM_VIRTUEMART_ID')  ?></th>

        </tr>
</thead>

<tbody>
<?php
if (
$total count($this->productlist) ) {
$i 0;
$k 0;
$keyword JRequest::getWord('keyword');
foreach ($this->productlist as $key => $product) {
$checked JHTML::_('grid.id'$i $product->virtuemart_product_id,null,'virtuemart_product_id');
$published JHTML::_('grid.published'$product$i );
?>

<tr class="row<?php echo $k ?>">
<!-- Checkbox -->
<td><?php echo $checked?></td>
<!-- Product name -->
<?php
$link 'index.php?option=com_virtuemart&view=product&task=edit&virtuemart_product_id='.$product->virtuemart_product_id.'&product_parent_id='.$product->product_parent_id;
                                
/* Product list should be ordered */
$parent_id JRequest::getVar('product_parent_id');

?>

<td><?php
                        
echo JHTML::_('link'JRoute::_($link), $product->product_name, array('title' => JText::_('COM_VIRTUEMART_EDIT').' '.$product->product_name));

                                
?>
</td>
<!-- Vendor name -->
                                <?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>
<!-- Media -->
<?php
/* Create URL */
$link JRoute::_('index.php?view=media&virtuemart_product_id='.$product->virtuemart_product_id.'&option=com_virtuemart');
?>

<td><?php echo JHTML::_('link'$link'<span class="icon-nofloat vmicon vmicon-16-media"></span> ('.$product->mediaitems.')''title ="'JText::_('COM_VIRTUEMART_MEDIA_MANAGER').'" ' );
 ?>
</td>
<!-- Product SKU -->
<td><?php echo $product->product_sku?></td>
<!-- Product price -->
<td><?php echo isset($product->product_price_display)? $product->product_price_display:JText::_('COM_VIRTUEMART_NO_PRICE_SET'?></td>
<!-- Category name -->
<td><?php //echo JHTML::_('link', JRoute::_('index.php?view=category&task=edit&virtuemart_category_id='.$product->virtuemart_category_id.'&option=com_virtuemart'), $product->category_name);
echo $product->categoriesList;
?>
</td>
<!-- Reorder only when category ID is present -->
<?php if( $this->virtuemart_category_id ) { ?>
<td class="order">
<span><?php echo $this->pagination->orderUpIcon$itrue'orderup'JText::_('COM_VIRTUEMART_MOVE_UP'), $product->ordering ); ?></span>
<span><?php echo $this->pagination->orderDownIcon$i$total true'orderdown'JText::_('COM_VIRTUEMART_MOVE_DOWN'), $product->ordering ); ?></span>
<input class="ordering" type="text" name="order[<?php echo $product->id?>]" id="order[<?php echo $i?>]" size="5" value="<?php echo $product->ordering?>" style="text-align: center" />
<?php // echo vmCommonHTML::getOrderingField( $product->ordering ); ?>
</td>
<?php ?>
<!-- Manufacturer name -->
<td><?php echo JHTML::_('link'JRoute::_('index.php?view=manufacturer&task=edit&virtuemart_manufacturer_id[]='.$product->virtuemart_manufacturer_id.'&option=com_virtuemart'), $product->mf_name); ?></td>

<!-- Product weight -->
<td><?php echo isset($product->product_weight)? $product->product_weight:JText::_('COM_VIRTUEMART_PRODUCT_WEIGTH'?></td>

<!-- Product modification  -->
<td><?php echo isset($product->modified_on)? $product->modified_on:JText::_('Modificado em'?></td>

<!-- Reviews -->
<!--
<?php /* $link = 'index.php?option=com_virtuemart&view=ratings&task=listreviews&virtuemart_product_id='.$product->virtuemart_product_id; ?>
<td><?php echo JHTML::_('link'$link$product->reviews.' ['.JText::_('COM_VIRTUEMART_REVIEW_FORM_LBL').']'); ?></td>
<td style="position:relative;">
<textarea class="element-hidden vm-order_comment vm-showable" name="orders[<?php  echo $product->virtuemart_product_id?>][comments]" value="" cols="5" rows="5"/></textarea>
<?php echo JHTML::_('link''#'JText::_('COM_VIRTUEMART_ADD_COMMENT'), array('class' => 'show_comment')); */ ?>
-->
</td>



<!-- published -->
<td><?php echo $published?></td>
                                <!-- Vendor name -->
<td><?php echo $product->virtuemart_product_id// echo $product->vendor_name; ?></td>
</tr>
<?php
$k $k;
$i++;
}
}
?>

</tbody>
<tfoot>
<tr>
<td colspan="16">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
</table>
</div>
<!-- Hidden Fields -->
<input type="hidden" name="product_parent_id" value="<?php echo JRequest::getInt('product_parent_id'0); ?>" />
<?php echo $this->addStandardHiddenToForm(); ?>
</form>

<?php AdminUIHelper::endAdminArea(); ?>
<script type="text/javascript">
    <!--

    jQuery('.show_comment').click(function() {
jQuery(this).prev('.element-hidden').show();
return false
    });

    jQuery('.element-hidden').mouseleave(function() {
jQuery(this).hide();
    });
    jQuery('.element-hidden').mouseout(function() {
jQuery(this).hide();
    });
    -->
</script>


UPDATE: I've also inserted the Product Modified on "Date" that is extrem usefull to every admin because sometimes we dont know how long ago we dont update the product info or price .. so with that Column we can see the Product Modification Date :)

* Just dont know:
- how to override this file and dont lose the work for next VM update :|
- how to insert the product final price
VM V. online: J2.5.14 | VM 2.0.20a | SQL 5.1.70 | PHP 5.3.25

lipes

In this file: \administrator\components\com_virtuemart\views\product\tmpl\product_edit_information.php
i saw this: <?php echo $this->product->prices['salesPriceTemp']; ?>

I've changed the code product_price to: salesPriceTemp

but the Table Price Column says now this: No price set

hum... it's difficult because i cant find any PHP code like "product_final_price" or similar ...

UPDATING....
show_price_including_tax -> Doesnt work
pricefinal -> Doesnt work
price_final -> Doesnt work
final_price -> Doesnt work
VM V. online: J2.5.14 | VM 2.0.20a | SQL 5.1.70 | PHP 5.3.25