Hello,
I want to loop through my child products on the category page to get all the product_s_desc of the child products to display on the category page. How can I do this?
Is there some sort of function to get the data of the child products? I don't see anything in the $this->product array.
In product model ou have getUncategorizedChildren
$productModel = VmModel::getModel ('product');
$productModel->setId($product->virtuemart_product_id);
$uncatChildren = $productModel->getUncategorizedChildren(false);
if($uncatChildren){
foreach ($uncatChildren as $k => $child) {
$child = $productModel->getProduct((int)$child,true);
//you can acces to this $child here
}
}
Quote from: Huubs on February 07, 2020, 08:50:21 AM
Hello,
I want to loop through my child products on the category page to get all the product_s_desc of the child products to display on the category page. How can I do this?
Is there some sort of function to get the data of the child products? I don't see anything in the $this->product array.
Child products that are displayed?
Or are you referring to the children on a parent that is displayed?
Quote from: PRO on February 07, 2020, 17:06:05 PM
Quote from: Huubs on February 07, 2020, 08:50:21 AM
Hello,
I want to loop through my child products on the category page to get all the product_s_desc of the child products to display on the category page. How can I do this?
Is there some sort of function to get the data of the child products? I don't see anything in the $this->product array.
Child products that are displayed?
Or are you referring to the children on a parent that is displayed?
No the child products don't have categoires so the parent is only visible in the category for a clean shop. Now you can select the child products via a custom field, but I want to show certain data from the child productts on the category page
Quote from: Studio 42 on February 07, 2020, 16:39:09 PM
In product model ou have getUncategorizedChildren
$productModel = VmModel::getModel ('product');
$productModel->setId($product->virtuemart_product_id);
$uncatChildren = $productModel->getUncategorizedChildren(false);
if($uncatChildren){
foreach ($uncatChildren as $k => $child) {
$child = $productModel->getProduct((int)$child,true);
//you can acces to this $child here
}
}
Thanks
im gonna check it out that works!