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

SOLVED: alt. field in product list (default.php,was product.product_list.php)

Started by daniel, October 20, 2012, 13:35:19 PM

Previous topic - Next topic

daniel

Hi everybody,

In VM1 I added an extra field to product.product_form.php to add stock location. This was then saved into the database by adding a field to the database in the table product.

In product.product_list.php I then showed an extra column by first retrieving the value out of the database as such:

$search_sql .= "#__{vm}_product.stock_location LIKE '%$keyword%' OR \n";
and:
if (!empty($category_id) && empty( $product_parent_id)) {
$list  = "SELECT #__{vm}_category.category_name,#__{vm}_product.product_id, [...part of statement left out...] #__{vm}_product.stock_location;


And then displayed it like this:
$VM_LANG->_('PHPSHOP_PRODUCT_FORM_STOCK_LOCATION') => "width=\"15%\"",
and:
$listObj->addCell( $db->f("stock_location") );



But how to in VM2??
In VM2 I have managed to:

  • add the field stock_location to the database in the table product.
  • to edit administrator/components/com_virtuemart/views/product/tmpl/product_edit_information.php to show an extra input field for stock location and it saves it to the database.

Now all i need to do is show this value in a column in administrator/components/com_virtuemart/views/product/tmpl/default.php
For which i first need to retrieve the value out of the database.

The structure of VM2 has changed a lot.
--> Can anybody please tell me what file to edit to retrieve the value stock_location out of the table product in the database, and what should the code be?
--> And how to edit default.php to be able to show this value.

Many thanks in advance!

KR Daniel

daniel

apparently it is very easy in VM2!

All I needed to do was include this code in default.php
<?php echo $product->stock_location?>

and in administrator/components/com_virtuemart/tables/products.php

I added the code
var $stock_location = '';