News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

PHP code to know if product has childs or custom fields?

Started by Marttyn, November 11, 2014, 18:28:01 PM

Previous topic - Next topic

Marttyn

Hi!
Ive modified my views so the products can be added to cart from virtuemart and category views.
But i would like that products with child products, or with custom fields to display "Details" button instead of "Add to cart".

Ive tried with

if($product->customsChilds){
    echo "<p>has child</p>";
}
else{
    echo "<p>no child</p>";
}


and


if($product->customfieldsCart){
    echo "<p>has custom fields</p>";
}
else{
    echo "<p>no custom fields</p>";
}


With no luck, as some of my products has childs or custom fields but this still show no child/custom fields  :(
Is there any other way to check if product has custom fields of childs?

Thanks!


GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Marttyn

It works with code from first post, although i was having some strange problem. I deleted the item and created again and now works fine.
It was using stockable variant.