AMELIABOOKING_TOKENS::fetch_category_name( $service_id )

Fetch the category name.


Parameters Parameters

$service_id

(Required)


Top ↑

Return Return

(string)


Source Source

File: src/integrations/ameliabooking/tokens/ameliabooking-tokens.php

	public function fetch_category_name( $service_id ) {

		global $wpdb;

		$category_name = '';

		$category = $wpdb->get_row(
			$wpdb->prepare(
				"SELECT services.id as service_id, services.name as service_name,
				services.categoryId as category_id, categories.name as category_name
				FROM {$wpdb->prefix}amelia_services as services
				INNER JOIN {$wpdb->prefix}amelia_categories as categories
				ON services.categoryId = categories.id
				WHERE services.id = %d
				",
				$service_id
			)
		);

		if ( isset( $category->category_name ) ) {
			$category_name = $category->category_name;
		}

		return $category_name;

	}