phpjoomlajoomla2.5productvirtuemart

How can I get product data of a VirtueMart 2 product in an external file?


is it possible to get the data of a VirtueMart 2 product in an external php file?

I'm using joomla 2.5 and VirtueMart 2 and need to retrieve the product data in a php-file on the same host. this php file isn't part of the VirtueMart component and also not part of an other component. this file is supposed to give the retrieved product data to a jquery widget...


Solution

  • it seems to me that it isn't possible.

    the best practice in my case is to build a joomla module and enter all my code in the helper-php. my php file for the ajax response is now part of the module. with that i can easily access an VirtueMart 2 product:

    if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'helpers'.DS.'config.php');
    VmConfig::loadConfig();
    if (!class_exists( 'VmModel' )) require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'helpers'.DS.'vmmodel.php');
    
    $productModel = VmModel::getModel('Product');
    $product = $productModel->getProduct(Product_ID);