0
votes

Joomla 1.5.26
Virtuemart 1.1.9

I'd like to get data from VM database in a module using the functions of ps_product.php. Some work, some don't.

Calling functions in ps_product that call other functions with "$this->" result in such an error message:

Fatal error: Call to undefined method JDocumentRendererModule::get_field() in (URL)/administrator/components/com_virtuemart/classes/ps_product.php on line XXX

I included in my code:

if( file_exists(dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' )) {
    require_once( dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' );
} else {
    require_once( dirname(__FILE__).'/../components/com_virtuemart/virtuemart_parser.php' );
}

require_once(CLASSPATH.'ps_product.php');

How could I resolve this problem?

1

1 Answers

0
votes

Ok, I found a solution but not sure that it was perfect.

I tried to call the ps_product function in the following way:

$a = ps_product::get_field('product_id', 'product_s_desc');

That doesn't work if the called function calls other functions in the class.

Solution:
Add

$ps_product = new ps_product;

and call functions like
$a = $ps_product->get_field('product_id', 'product_s_desc');

Still some functions don't seem to work properly. For example product_has_attributes function should tell if a a product had assigned attributes or not and it returns always false.(?)