VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: Kuubs on November 18, 2020, 14:23:00 PM

Title: Virtuemart Product customfieldsSorted is empty
Post by: Kuubs on November 18, 2020, 14:23:00 PM
Hello,

I have a question regarding the product module, I want to display a product with their custom fields. Unfortunately i run into a problem regarding the custom fields. If I use the following rendersublayout:

<?php echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'position' => array('ontop''addtocart'))); ?>

Only the add to cart button gets rendered. I checked and it is because the customfieldsSorted is empty:

if (!empty($product->customfieldsSorted[$position])) { ...

Can someone help me out?

I get the product the following way:

$productModel = VmModel::getModel('Product');
$product = $productModel->getProduct(2);
$productModel->addImages($product);
Title: Re: Virtuemart Product customfieldsSorted is empty
Post by: Kuubs on November 18, 2020, 14:45:38 PM
Found the solution:

$products = array();

$products[] = $product;

shopFunctionsF::sortLoadProductCustomsStockInd($products,$productModel);

$product = $products[0];