[Solved] Include one file from virtuemart into another component.

Started by yiun, June 09, 2011, 20:37:39 PM

Previous topic - Next topic

yiun

I want to include a file from virtuemart via "require_one()" into another component.
But when I do that I just getting a white page on my website.

In the file /components/com_test/test.php is the line:
require_once(JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'classes' . DS . 'ps_product.php');

The file "ps_product.php" definitly exists. When I remove the content it works without any problems. It seems there is a problem with the references in the file "ps_products" (CLASSPATH e.g.).

I'm greatful for any help.

PRO

You are going to have to load more than that

in one of my modules they load this
// Load the virtuemart main parse code
if( file_exists(dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' )) {
   require_once( dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' );
   $mosConfig_absolute_path = realpath( dirname(__FILE__).'/../..' );
} else {
   require_once( dirname(__FILE__).'/../components/com_virtuemart/virtuemart_parser.php' );
}

yiun

Thanks for the fast reply!

First I have activate the debug in the file php.ini by changing

error_reporting = E_ALL & ~E_NOTICE
to
error_reporting = E_ALL | E_STRICT


and

display_errors = Off
to
display_errors = On


So I was getting different errors which help me to find the solution.
When you want to use the virtuemart-classes you have to include "virtuemart_parser.php" first. Just add the following on the top of your file:
require_once( JPATH_SITE.DS.'components' . DS . 'com_virtuemart' . DS . 'virtuemart_parser.php');

Quick Reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
7+4+3:
Shortcuts: ALT+S post or ALT+P preview