Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • I’m having the same issue this morning. The server is up and otherwise healthy.

    The corrected code in lightbox.php is:

    function get_images_url(){
    
    	global $wpdb;
    	//$image_urls = $_POST['urls'];
    	$all_urls = array();
    	if ( empty( $_POST['urls'] ) ) { return; }
    	foreach ($_POST['urls'] as $value) {
    		$image_urls[] = esc_url($value);
    	}
    
    	foreach ($image_urls as $image_url) {
    		$query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s'", $image_url);
    		$id = $wpdb->get_var($query);
    		$attachment = get_post( $id );
    		$description = $attachment->post_content;
    		array_push($all_urls,$description);
    	}
    	echo json_encode($all_urls);
    	die();
    }

    I’m using Version 2.1.0. hugeit_lightbox_get_images_url() does not exist. You must edit get_images_url() as I have above.

    The fix is to simply copy and paste my function, replacing the one that exists.

    As regards support, its incredible to see instances of this from April 2017 and its still not fixed in November 2017.

    • This reply was modified 8 years, 6 months ago by cbcjock.

    I’m also seeing this issue. Can I ask how you repaired the table?

    There is a ‘hack’ work around but the problem stems from the fact that ‘nights’ is not covered in the checks for availability. It reverts to checking by minutes and seconds, as such, its only going to get slower the more bookings are made.

    I’ll upload some code later when I have it in front of me.

    Did you ever receive an answer for this?

    From a high level, I’m assuming if your load balancer had sticky sessions it wouldn’t be a problem as you have a common database and with a stick session you would always be hitting the same App server.

    Hi Folks, thank you for the reply. I won’t be committing any code just yet as I feel there is a better solution for this. From running more tests and looking at the HTML code, the calendar when loaded appears to be requesting all bookings for a given product. So in our case, there might be 100 bookings for a hotel room for a year. This is an awful lot of data to crunch for a user who may be only looking to check in this month for a week.

    I feel a better solution would be to gradually load the calendar, perhaps 3 months at a time as a User clicks through it e.g. A user loads the product page and the first three months are loaded. When I click forward, the next 3 are requested by AJAX. Its far more manageable for the system and should drop the page load time considerably. We can spend all the time we wish improving the back end code but there is no point asking that code to crunch dates that are months in the future that may not be of interest to the average user e.g. Someone booking a room is probably only looking 3 to 6 months in the future, and would probably be ok with a mild blip as they request the next 3 months.

    Thanks ozomri, I saw your post above and tried it. Its not causing the problem we are observing.

    We ran the shop locally with webgrind to trace the stack and the bottle neck is ‘get_unavailable_mintues()’ in /includes/class-wc-product-booking.php If you look at that trace, you will see the array_push can be called, in some cases, millions of times. The code isn’t terribly clear but the hypothesis that its checking each minute for a booking definetely seems correct.

    If you then look at class-wc-product-accommodation-booking.php and the return of get_duration_unit(), its ‘night’ This is passed back to class-wc-product-booking.php but the unit only has one use in the entire code, so I believe the system defaults back to ‘minute’ and runs accordingly.

    Long story short, if you change the get_duration_unit() to ‘hour’, the system is about 60% faster. If you change it to ‘day’, the system is over 90% faster (But this is not usable in production systems as you loose the ability to checkin/out on the same day.

    We left get_duration_unit() as ‘night’ and made some changes in the class-wc-product-booking.php to force the system to assume its working with ‘hour’ e.g. Check units are hours and advance all timescales by hours, not minutes. I don’t believe any performance can be gained here as you need the granularity of ‘hour’ but there may be some intelligent shortcuts that could be taken e.g. If the checkin / checkout days are known along with the times, you don’t need to check the whole day.

    • This reply was modified 9 years, 3 months ago by cbcjock.

    Hi All, was there ever a solution found for this? We have the exact same problem. We have 90 rooms and with 455 bookings in the system, the product load page becomes unbearably slow often to the point of time out.

    I had this problem til about 30 seconds ago. Go to the Settings Page of WordPress. Check the Blog Location address. It is most likely set to https.

Viewing 10 replies - 1 through 10 (of 10 total)