本文整理汇总了PHP中Self::getSimilarALaCarte方法的典型用法代码示例。如果您正苦于以下问题:PHP Self::getSimilarALaCarte方法的具体用法?PHP Self::getSimilarALaCarte怎么用?PHP Self::getSimilarALaCarte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Self
的用法示例。
在下文中一共展示了Self::getSimilarALaCarte方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getALaCarteDetails
/**
* Reads the details of the LaCarte matching the
* passed name.
*
* @access public
* @param string $laCarte
* @return array
* @since 1.0.0
* @version 1.0.0
*/
public static function getALaCarteDetails($aLaCarteID)
{
if (!is_numeric($aLaCarteID)) {
$query = DB::table('vendor_locations')->where('slug', $aLaCarteID)->select('id')->first();
if ($query) {
$aLaCarteID = $query->id;
} else {
$arrData['status'] = Config::get('constants.API_SUCCESS');
$arrData['no_result_msg'] = 'No matching values found.';
$arrData['data'] = array();
$arrData['total_count'] = 0;
return $arrDatas;
}
}
//Checking the bookmark status of the product
$data['access_token'] = $_SERVER['HTTP_X_WOW_TOKEN'];
$userID = UserDevices::getUserDetailsByAccessToken($data['access_token']);
$bookmark = DB::table('user_bookmarks as ub')->where('user_id', '=', $userID)->where('vendor_location_id', '=', $aLaCarteID)->select('id', 'type')->first();
//array to store the matching result
$arrData = array();
//query to read the details of the A-La-Carte
$queryResult = DB::table(DB::raw('vendor_locations as vl'))->join('vendors', 'vendors.id', '=', 'vl.vendor_id')->join(DB::raw('vendor_location_attributes_text as vlat'), 'vlat.vendor_location_id', '=', 'vl.id')->join(DB::raw('vendor_attributes as va'), 'va.id', '=', 'vlat.vendor_attribute_id')->leftjoin(DB::raw('vendor_locations_curator_map as vlcm'), 'vlcm.vendor_location_id', '=', 'vl.id')->leftjoin('curators', 'curators.id', '=', 'vlcm.curator_id')->join(DB::raw('vendor_location_address as vla'), 'vla.vendor_location_id', '=', 'vl.id')->join(DB::raw('locations as loc1'), 'loc1.id', '=', 'vla.area_id')->join(DB::raw('locations as loc2'), 'loc2.id', '=', 'vla.city_id')->join(DB::raw('locations as loc3'), 'loc3.id', '=', 'vla.state_id')->join(DB::raw('locations as loc4'), 'loc4.id', '=', 'vla.country_id')->join('locations as loc5', 'loc5.id', '=', 'vl.location_id')->leftJoin(DB::raw('media_resized_new as m2'), 'm2.id', '=', 'curators.media_id')->leftJoin(DB::raw('vendor_location_attributes_integer as vlai'), 'vlai.vendor_location_id', '=', 'vl.id')->leftJoin(DB::raw('vendor_attributes as va2'), 'va2.id', '=', 'vlai.vendor_attribute_id')->where('vl.id', $aLaCarteID)->where('vl.a_la_carte', '=', 1)->where('vl.status', 'Active')->where('va2.alias', 'reward_points_per_reservation')->groupBy('vl.id')->select('vl.id as vl_id', 'vl.vendor_id', 'vla.address', 'vla.pin_code', 'vla.latitude', 'vla.longitude', 'vendors.name as title', DB::raw('MAX(IF(va.alias = "restaurant_info", vlat.attribute_value, "")) AS resturant_info'), DB::raw('MAX(IF(va.alias = "short_description", vlat.attribute_value, "")) AS short_description'), DB::raw('MAX(IF(va.alias = "terms_and_conditions", vlat.attribute_value, "")) AS terms_conditions'), DB::raw('MAX(IF(va.alias = "menu_picks", vlat.attribute_value, "")) AS menu_picks'), DB::raw('MAX(IF(va.alias = "expert_tips", vlat.attribute_value, "")) AS expert_tips'), DB::raw('MAX(IF(va.alias = "special_offer_title", vlat.attribute_value, "")) AS special_offer_title'), DB::raw('MAX(IF(va.alias = "special_offer_desc", vlat.attribute_value, "")) AS special_offer_desc'), 'loc1.name as area', 'loc1.id as area_id', 'loc2.name as city', 'loc3.name as state_name', 'loc4.name as country', 'loc5.name as locality', 'curators.name as curator_name', 'curators.bio as curator_bio', 'curators.designation as designation', 'vl.pricing_level', 'vlai.attribute_value as reward_point', 'm2.file as curator_image', 'vl.location_id as vl_location_id', 'vlcm.curator_tips', 'vla.city_id', 'vl.slug')->first();
if ($queryResult) {
//reading the review ratings
$arrReview = Review::findRatingByVendorLocation(array($queryResult->vl_id));
//reading vendor-cuisine
$arrVendorCuisine = Self::getVendorLocationCuisine(array($queryResult->vl_id));
//reading the similar vendors
$arrSimilarVendor = Self::getSimilarALaCarte(array('location_id' => $queryResult->area_id, 'pricing_level' => $queryResult->pricing_level, 'city_id' => $queryResult->city_id));
$arrSimilarAlacarteFilters = $arrSimilarVendor;
//print_r($filters); die("hmm");
$arrResultAlacarte = Self::fetchListings($arrSimilarAlacarteFilters);
//print_r($arrResult); die("hmm");
//initializing the values for experience
if (Self::isExperienceAvailable($queryResult->vl_id)) {
$experienceAvailable = 'true';
$experienceURL = URL::to('/') . '/experience/' . $aLaCarteID;
} else {
$experienceAvailable = 'false';
$experienceURL = '';
}
//getting the images
$arrImage = self::getVendorImages($queryResult->vl_id);
//formatting the array for the data
$arrData['data'] = array('type' => 'A-La-Carte Details', 'id' => $queryResult->vl_id, 'title' => $queryResult->title, 'resturant_information' => empty($queryResult->resturant_info) ? "" : $queryResult->resturant_info, 'short_description' => empty($queryResult->short_description) ? "" : $queryResult->short_description, 'terms_and_condition' => empty($queryResult->terms_conditions) ? "" : $queryResult->terms_conditions, 'special_offer_title' => empty($queryResult->special_offer_title) ? "" : $queryResult->special_offer_title, 'special_offer_desc' => empty($queryResult->special_offer_desc) ? "" : $queryResult->special_offer_desc, 'pricing' => $queryResult->pricing_level, 'image' => $arrImage, 'rating' => array_key_exists($queryResult->vl_id, $arrReview) ? $arrReview[$queryResult->vl_id]['averageRating'] : 0, 'review_count' => array_key_exists($queryResult->vl_id, $arrReview) ? $arrReview[$queryResult->vl_id]['totalRating'] : 0, 'cuisine' => array_key_exists($queryResult->vl_id, $arrVendorCuisine) ? $arrVendorCuisine[$queryResult->vl_id] : array(), 'experience_available' => $experienceAvailable, 'experience_url' => $experienceURL, 'location_address' => array("address_line" => $queryResult->address, "locality" => $queryResult->locality, "area" => $queryResult->area, "city" => $queryResult->city, "pincode" => $queryResult->pin_code, "state" => $queryResult->state_name, "country" => $queryResult->country, "latitude" => $queryResult->latitude, "longitude" => $queryResult->longitude), 'curator_information' => array('curator_name' => is_null($queryResult->curator_name) ? "" : $queryResult->curator_name, 'curator_bio' => is_null($queryResult->curator_bio) ? "" : $queryResult->curator_bio, 'curator_image' => is_null($queryResult->curator_image) ? "" : Config::get('constants.API_MOBILE_IMAGE_URL') . $queryResult->curator_image, 'curator_designation' => is_null($queryResult->designation) ? "" : $queryResult->designation, 'suggestions' => is_null($queryResult->curator_tips) ? "" : $queryResult->curator_tips), 'menu_pick' => is_null($queryResult->menu_picks) ? "" : $queryResult->menu_picks, 'similar_option' => $arrSimilarAlacarteFilters, 'similar_option' => $arrResultAlacarte, 'reward_point' => is_null($queryResult->reward_point) ? 0 : $queryResult->reward_point, 'expert_tips' => is_null($queryResult->expert_tips) ? "" : $queryResult->expert_tips, 'slug' => $queryResult->slug, 'bookmark_status' => is_null($bookmark) ? 0 : 1);
//reading the review details
$arrData['data']['review_detail'] = Review::getVendorLocationRatingDetails($queryResult->vl_id);
//reading the locations
$arrData['data']['other_location'] = self::getVendorLocation($queryResult->vendor_id, $queryResult->vl_location_id);
//setting the value of status
$arrData['status'] = Config::get('constants.API_SUCCESS');
} else {
$arrData['status'] = Config::get('constants.API_ERROR');
$arrData['no_result_msg'] = 'No matching values found.';
}
return $arrData;
}
示例2: getALaCarteDetails
public function getALaCarteDetails($aLaCarteID)
{
$arrData = array();
$queryResult = DB::table(DB::raw('vendor_locations as vl'))->join('vendors', 'vendors.id', '=', 'vl.vendor_id')->join(DB::raw('vendor_location_attributes_text as vlat1'), 'vlat1.vendor_location_id', '=', 'vl.id')->join(DB::raw('vendor_location_attributes_text as vlat2'), 'vlat2.vendor_location_id', '=', 'vl.id')->join(DB::raw('vendor_location_attributes_text as vlat3'), 'vlat3.vendor_location_id', '=', 'vl.id')->join(DB::raw('vendor_location_attributes_text as vlat4'), 'vlat4.vendor_location_id', '=', 'vl.id')->join(DB::raw('vendor_attributes as va1'), 'va1.id', '=', 'vlat1.vendor_attribute_id')->join(DB::raw('vendor_attributes as va2'), 'va2.id', '=', 'vlat2.vendor_attribute_id')->join(DB::raw('vendor_attributes as va3'), 'va3.id', '=', 'vlat3.vendor_attribute_id')->leftJoin(DB::raw('vendor_attributes as va4'), 'va4.id', '=', 'vlat4.vendor_attribute_id')->leftjoin('vendor_locations_curator_map as vlcm', 'vlcm.vendor_location_id', '=', 'vl.id')->leftjoin('curators', 'curators.id', '=', 'vlcm.curator_id')->join(DB::raw('vendor_location_address as vla'), 'vla.vendor_location_id', '=', 'vl.id')->join(DB::raw('locations as loc1'), 'loc1.id', '=', 'vla.area_id')->join(DB::raw('locations as loc2'), 'loc2.id', '=', 'vla.city_id')->join(DB::raw('locations as loc3'), 'loc3.id', '=', 'vla.state_id')->join(DB::raw('locations as loc4'), 'loc4.id', '=', 'vla.country_id')->leftJoin(DB::raw('media_resized_new as m2'), 'm2.id', '=', 'curators.media_id')->leftJoin(DB::raw('vendor_location_attributes_integer as vlai'), 'vlai.vendor_location_id', '=', 'vl.id')->leftJoin(DB::raw('vendor_attributes as va5'), 'va5.id', '=', 'vlai.vendor_attribute_id')->leftJoin(DB::raw('vendor_location_attributes_text as vlat5'), 'vlat5.vendor_location_id', '=', 'vl.id')->leftJoin(DB::raw('vendor_attributes as va6'), 'va6.id', '=', 'vlat5.vendor_attribute_id')->where('vl.id', $aLaCarteID)->where('vl.a_la_carte', '=', 1)->where('va1.alias', 'restaurant_info')->where('va2.alias', 'short_description')->where('va3.alias', 'terms_and_conditions')->where('va4.alias', 'menu_picks')->where('va5.alias', 'reward_points_per_reservation')->where('va6.alias', 'expert_tips')->groupBy('vl.id')->select('vl.id as vl_id', 'vl.slug as vl_slug', 'vl.vendor_id', 'vl.status as vl_status', 'vla.address', 'vla.pin_code', 'vla.latitude', 'vla.longitude', 'vendors.name as title', 'vlat1.attribute_value as resturant_info', 'vlat2.attribute_value as short_description', 'vlat3.attribute_value as terms_conditions', 'vlat4.attribute_value as menu_picks', 'loc1.name as area', 'loc1.id as area_id', 'loc2.name as city', 'loc3.name as state_name', 'loc4.name as country', 'curators.name as curator_name', 'curators.bio as curator_bio', 'curators.designation as designation', 'vl.pricing_level', 'vlai.attribute_value as reward_point', 'vlat5.attribute_value as expert_tips', 'm2.file as curator_image', 'vl.location_id as vl_location_id', 'vlcm.curator_tips')->first();
//echo "<pre>"; print_r($queryResult); die;
if ($queryResult) {
//reading the review ratings
$arrReview = Self::findRatingByVendorLocation(array($queryResult->vl_id));
//reading vendor-cuisine
$arrVendorCuisine = Self::getVendorLocationCuisine(array($queryResult->vl_id));
$arrVendorCuisineID = Self::getRestaurantCuisineID(array($queryResult->vl_id));
//reading vendor-cuisine
$seo_meta_description = DB::select("SELECT vat.attribute_value AS seo_meta_description\n FROM vendor_attributes_text AS vat\n LEFT JOIN vendor_attributes AS va ON va.id = vat.vendor_attribute_id\n WHERE vat.vendor_id = '{$queryResult->vendor_id}'\n AND va.alias = 'seo_meta_description'");
//reading vendor-cuisine
$seo_meta_keywords = DB::select("SELECT vat.attribute_value AS seo_meta_keywords\n FROM vendor_attributes_text AS vat\n LEFT JOIN vendor_attributes AS va ON va.id = vat.vendor_attribute_id\n WHERE vat.vendor_id = '{$queryResult->vendor_id}'\n AND va.alias = 'seo_meta_keywords'");
//reading vendor-cuisine
$seo_title = DB::select("SELECT vat.attribute_value AS seo_title\n FROM vendor_attributes_text AS vat\n LEFT JOIN vendor_attributes AS va ON va.id = vat.vendor_attribute_id\n WHERE vat.vendor_id = '{$queryResult->vendor_id}'\n AND va.alias = 'seo_title'");
//print_r($queryResult);die;
$special_offer_title = DB::select("SELECT vat.attribute_value AS special_offer_title\n FROM vendor_location_attributes_text AS vat\n LEFT JOIN vendor_attributes AS va ON va.id = vat.vendor_attribute_id\n WHERE vat.vendor_location_id = '{$queryResult->vl_id}'\n AND va.alias = 'special_offer_title'");
$special_offer_desc = DB::select("SELECT vat.attribute_value AS special_offer_desc\n FROM vendor_location_attributes_text AS vat\n LEFT JOIN vendor_attributes AS va ON va.id = vat.vendor_attribute_id\n WHERE vat.vendor_location_id = '{$queryResult->vl_id}'\n AND va.alias = 'special_offer_desc'");
//print_r($special_offer_desc);die;
/* $seoDetails = array('seo_meta_description' =>$seo_meta_description,
'seo_meta_keywords'=>$seo_meta_keywords,'seo_title'=>$seo_title);
print_r($seo_title);
echo $seo_meta_description['0']->seo_meta_description;*/
if (empty($seo_meta_description)) {
$seoMetaDesc = '';
} else {
$seoMetaDesc = $seo_meta_description['0']->seo_meta_description;
}
if (empty($special_offer_title)) {
$specialOfferTitle = '';
} else {
$specialOfferTitle = $special_offer_title[0]->special_offer_title;
}
if (empty($special_offer_desc)) {
$specialOfferDesc = '';
} else {
$specialOfferDesc = $special_offer_desc[0]->special_offer_desc;
}
//print_r($specialOffer);die;
if (empty($seo_meta_keywords)) {
$seoMetaKey = '';
} else {
$seoMetaKey = $seo_meta_keywords['0']->seo_meta_keywords;
}
if (empty($seo_title)) {
$seoTitle = '';
} else {
$seoTitle = $seo_title['0']->seo_title;
}
/*exit;*/
//reading the similar vendors
$arrSimilarVendor = Self::getSimilarALaCarte(array('location_id' => $queryResult->area_id, 'pricing_level' => $queryResult->pricing_level));
//initializing the values for experience
if (Self::isExperienceAvailable($queryResult->vl_id)) {
$experienceAvailable = 'true';
$experienceURL = URL::to('/') . '/experience/' . $aLaCarteID;
} else {
$experienceAvailable = 'false';
$experienceURL = '';
}
//getting the images
$arrImage = $this->getVendorImagesDetails($queryResult->vl_id);
//formatting the array for the data
$arrData['data'] = array('type' => 'A-La-Carte Details', 'slug' => $queryResult->vl_slug, 'id' => $queryResult->vl_id, 'title' => $queryResult->title, 'vl_status' => $queryResult->vl_status, 'resturant_information' => $queryResult->resturant_info, 'short_description' => $queryResult->short_description, 'terms_and_condition' => $queryResult->terms_conditions, 'seo_meta_description' => $seoMetaDesc, 'seo_meta_keywords' => $seoMetaKey, 'seo_title' => $seoTitle, 'pricing' => $queryResult->pricing_level, 'image' => $arrImage, 'rating' => array_key_exists($queryResult->vl_id, $arrReview) ? $arrReview[$queryResult->vl_id]['averageRating'] : 0, 'review_count' => array_key_exists($queryResult->vl_id, $arrReview) ? $arrReview[$queryResult->vl_id]['totalRating'] : 0, 'cuisine' => array_key_exists($queryResult->vl_id, $arrVendorCuisine) ? $arrVendorCuisine[$queryResult->vl_id] : array(), 'cuisineID' => array_key_exists($queryResult->vl_id, $arrVendorCuisineID) ? $arrVendorCuisineID[$queryResult->vl_id] : array(), 'experience_available' => $experienceAvailable, 'experience_url' => $experienceURL, 'location_address' => array("address_line" => $queryResult->address, "area" => $queryResult->area, "city" => $queryResult->city, "pincode" => $queryResult->pin_code, "state" => $queryResult->state_name, "country" => $queryResult->country, "latitude" => $queryResult->latitude, "longitude" => $queryResult->longitude), 'curator_information' => array('name' => is_null($queryResult->curator_name) ? "" : $queryResult->curator_name, 'bio' => is_null($queryResult->curator_bio) ? "" : $queryResult->curator_bio, 'image' => is_null($queryResult->curator_image) ? "" : Config::get('constants.API_LISTING_IMAGE_URL') . $queryResult->curator_image, 'designation' => is_null($queryResult->designation) ? "" : $queryResult->designation), 'menu_pick' => is_null($queryResult->menu_picks) ? "" : $queryResult->menu_picks, 'similar_option' => $arrSimilarVendor, 'reward_point' => is_null($queryResult->reward_point) ? 0 : $queryResult->reward_point, 'expert_tips' => is_null($queryResult->expert_tips) ? "" : $queryResult->expert_tips, 'special_offer_title' => $specialOfferTitle, 'special_offer_desc' => $specialOfferDesc, 'curator_tips' => is_null($queryResult->curator_tips) ? "" : $queryResult->curator_tips);
//reading the review details
$arrData['data']['review_detail'] = $this->getVendorLocationRatingDetails($queryResult->vl_id);
//reading the locations
$arrData['data']['other_location'] = $this->getVendorLocation($queryResult->vendor_id, $queryResult->vl_location_id);
}
return $arrData;
}