Jump to content

If not available else function


Sanyy

Recommended Posts

Hi,

 

i have a issue with a booking plugin in Wordpress. If a room is booked, it is showing the room in search results just with a "NOT AVAILABLE" label. From a UX perspective it is a better option to not show it at all if the room is booked.

 

I found the code controlling the issue:

//available or not
if ( nd_booking_is_qnt_available(nd_booking_is_available($nd_booking_id,$nd_booking_date_from,$nd_booking_date_to),$nd_booking_date_from,$nd_booking_date_to,$nd_booking_id) == 1 ) {
    $nd_booking_availability = "";
}else{
    $nd_booking_availability = "<span class='nd_options_color_white nd_booking_font_size_10 nd_booking_line_height_10 nd_booking_letter_spacing_2 nd_booking_padding_3_5 nd_booking_top_10 nd_booking_position_absolute nd_booking_right_10 nd_booking_bg_yellow'>".__('NOT AVAILABLE','nd-booking')."</span>";
}

I tried a few options but allways generate a blank page. Any idea what should be written after "else" so that the booked room won't show at all in search results.

 

Cheers.

 

Link to comment
Share on other sites

Hi.

 

Just comment it out then?

//available or not
if ( nd_booking_is_qnt_available(nd_booking_is_available($nd_booking_id,$nd_booking_date_from,$nd_booking_date_to),$nd_booking_date_from,$nd_booking_date_to,$nd_booking_id) == 1 ) {
    $nd_booking_availability = "";
}else{
     // DO NOTHING 
    // --------- >> Commented out: $nd_booking_availability = "<span class='nd_options_color_white nd_booking_font_size_10 nd_booking_line_height_10 nd_booking_letter_spacing_2 nd_booking_padding_3_5 nd_booking_top_10 nd_booking_position_absolute nd_booking_right_10 nd_booking_bg_yellow'>".__('NOT AVAILABLE','nd-booking')."</span>";
}
Link to comment
Share on other sites

Hi BigB,

 

by commenting out, the room shows, just not available and no label.

 

I enter "return:0;" then the room does not show, which is good, but a empty space shows instead, so when a pagination of 4 rooms is per page, it shows only 3 rooms, instead of 4. :/

 

Any idea?

Link to comment
Share on other sites

Hi Barand, yes that is the logical thing, but i am a PHP beginner, and trying to sort this out myself. The autor of the plugin did it like that, but for me it is not logical to display a booked room in a search result when looking for available rooms.

 

Here is the full code:

https://pastebin.com/sXmaUvap

 

Do you have any idea what to edit and how?

 

Cheers.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.