Handle process navigation better
This commit is contained in:
@@ -68,15 +68,24 @@ class Wiaas_Product_Supplier {
|
||||
* Retrieve organisation id of the supplier of the product
|
||||
*
|
||||
* @param $product_id
|
||||
* @return int organization_id
|
||||
* @return int|false organization_id
|
||||
*/
|
||||
public static function get_supplier_organisation_id_from_product($product_id) {
|
||||
|
||||
$supplier_terms = wp_get_object_terms($product_id, 'supplier');
|
||||
$supplier_organisation_slug = $supplier_terms[0]->slug;
|
||||
$supplier_organisation_id = get_term_by('slug', $supplier_organisation_slug, 'wiaas-user-organization')->term_id;
|
||||
if (empty( $supplier_terms )) {
|
||||
|
||||
return $supplier_organisation_id;
|
||||
return false;
|
||||
}
|
||||
|
||||
$supplier_organisation_slug = $supplier_terms[0]->slug;
|
||||
$supplier_organisation = get_term_by('slug', $supplier_organisation_slug, 'wiaas-user-organization');
|
||||
|
||||
if ($supplier_organisation) {
|
||||
return $supplier_organisation->term_id;
|
||||
}
|
||||
|
||||
return $supplier_organisation ? $supplier_organisation->term_id : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user