News:

Support the VirtueMart project and become a member

Main Menu

Access virtuemart product data externally

Started by aqr996, July 17, 2016, 15:55:34 PM

Previous topic - Next topic

aqr996

Hi,
Is there a quick fire method of accessing all the data for a product from an external file by using its sku?

I have looked at http://stackoverflow.com/questions/24204394/how-can-i-get-prodcut-data-of-a-virtuemart-2-product-in-an-external-file

and tried to replace the Product ID with my desired id but to no avail:

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

In short terms, I'm looking for a way to access product data.

PRO

what kind of format do you want?

what is the data used for?

This can be done with using a separate product details template

Studio 42

DS do not exist in Joomla 3.
So use
    if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
    VmConfig::loadConfig();
    if (!class_exists( 'VmModel' )) require(JPATH_ADMINISTRATOR .  '/components/com_virtuemart/helpers/vmmodel.php');
   
    $productModel = VmModel::getModel('Product');
    $product = $productModel->getProduct(Product_ID);

I removed since 1 year in all my creation the DS and it work always when it's a path to a file as here.