Php 如何在外部文件中获取VirtueMart 2产品的产品数据?
是否可以在外部php文件中获取VirtueMart 2产品的数据Php 如何在外部文件中获取VirtueMart 2产品的产品数据?,php,joomla,joomla2.5,product,virtuemart,Php,Joomla,Joomla2.5,Product,Virtuemart,是否可以在外部php文件中获取VirtueMart 2产品的数据 我正在使用joomla 2.5和VirtueMart 2,需要在同一主机上的php文件中检索产品数据。此php文件不是VirtueMart组件的一部分,也不是其他组件的一部分。这个文件应该将检索到的产品数据提供给jquery小部件…在我看来,这是不可能的 在我的例子中,最好的做法是构建一个joomla模块,并在helper php中输入我的所有代码。 我的ajax响应的php文件现在是模块的一部分。有了它,我可以轻松访问Virtu
我正在使用joomla 2.5和VirtueMart 2,需要在同一主机上的php文件中检索产品数据。此php文件不是VirtueMart组件的一部分,也不是其他组件的一部分。这个文件应该将检索到的产品数据提供给jquery小部件…在我看来,这是不可能的 在我的例子中,最好的做法是构建一个joomla模块,并在helper php中输入我的所有代码。 我的ajax响应的php文件现在是模块的一部分。有了它,我可以轻松访问VirtueMart 2产品:
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);
在我看来这是不可能的 在我的例子中,最好的做法是构建一个joomla模块,并在helper php中输入我的所有代码。 我的ajax响应的php文件现在是模块的一部分。有了它,我可以轻松访问VirtueMart 2产品:
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);
在我看来这是不可能的 在我的例子中,最好的做法是构建一个joomla模块,并在helper php中输入我的所有代码。 我的ajax响应的php文件现在是模块的一部分。有了它,我可以轻松访问VirtueMart 2产品:
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);
在我看来这是不可能的 在我的例子中,最好的做法是构建一个joomla模块,并在helper php中输入我的所有代码。 我的ajax响应的php文件现在是模块的一部分。有了它,我可以轻松访问VirtueMart 2产品:
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);