简体   繁体   中英

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...

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM