Back to PhocacartVendor class

Method isVendor

public static
isVendor
(mixed &$vendor)

Method isVendor - Source code

public static function isVendor(&$vendor)
{
    if (!empty($vendor) && isset($vendor->id) && (int) $vendor->id > 0) {
        $db = Factory::getDBO();
        $query = ' SELECT a.id, a.title, a.image FROM #__phocacart_vendors AS a' . ' WHERE a.user_id = ' . (int) $vendor->id . ' AND a.published = 1' . ' ORDER BY a.ordering';
        $db->setQuery($query);
        $vendorO = $db->loadObject();
        if (isset($vendorO->id) && (int) $vendorO->id > 0) {
            if (isset($vendorO->image) && $vendorO->image != '') {
                $vendor->image = $vendorO->image;
                // Add image info to vendor object
            }
            return true;
            // current user is vendor
        }
        return false;
    }
    return false;
}