Forum Replies Created

Viewing 15 replies - 1 through 15 (of 55 total)
  • Thread Starter ole1986

    (@ole1986)

    Unfortunately the given database structure does not allow me to do proper search filter requests based on the post data (the given slots/time) from inside the booking.

    That is why I took the notify email (the email a user is entering) to figure out the amount of registrations.

    Doing some advanced request without a proper filter option in the database may slow it down.
    Especially when you have stored alot slots.

    I have requested a DB change here already:
    https://www.ads-software.com/support/topic/database-improvements/

    Thread Starter ole1986

    (@ole1986)

    @centenarypark

    At the moment it is only available on GitHub and working for the free appointment hour booking as well as for the WP Time Slot Booking Plugin.

    I did not had the chance to make it available on
    The WP plugin repository..

    But I can arrange it asap. So updates will be available as expected.

    @tayyabirfan7272 Or you can block them by email **per day** by using my extension plugin for it

    Check out this:
    https://www.ads-software.com/support/topic/appointment-hour-booking-extended/
    Or
    https://github.com/ole1986/wp-time-slots-extended/releases

    Thread Starter ole1986

    (@ole1986)

    Thanks for the update!

    But its still buggy.

    For example when I book a slot in frontend, the *first slot* gets subtracted (as expected). But when I try to book another the capacity does not change (visually – JS).

    In the previous version it even fully reset to the service capacity (even if therewere several bookings)

    The reason I assume is the htmlSlots.sort call inside getCurrentSlots and common misuse of the sort method

    Also I think the method getCurrentSlots is called to often causing unexpected performance issues.

    For those who are interessted in the solution, feel free create a new file named

    36_fbuilder.fapp.getCurrentSlots.js

    into the plugin directory js/fields-public/
    and insert the following code (plugin will automatically load it).

    
    /* ### Amended "getCurrentSlots" method for version 1.3.01 ### */
    $.fbuilder.controls['fapp'].prototype.getCurrentSlots = function (arr, d, s) {
    	var me = this;
    	var duration = parseFloat(me.services[s].duration);
    	var html = "";
    	var htmlSlots = new Array();
    	var pb = 0;
    	var pa = 0;
    	var v = false;
    	var capacity_service = me.services[s].capacity;
    	if (true) {
    		var compactUsedSlots = me.getCompatSlots(me.htmlUsedSlots[d])
    		for (var i = 0; i < compactUsedSlots.length; i++) {
    			//if (compactUsedSlots[i].quantity>=capacity_service && compactUsedSlots[i].serviceindex==s)
    			if (compactUsedSlots[i].serviceindex == s) {
    				compactUsedSlots[i].st = compactUsedSlots[i].h1 * 60 + compactUsedSlots[i].m1;
    				compactUsedSlots[i].t = $.datepicker.parseDate("yy-mm-dd", compactUsedSlots[i].d).getTime() + compactUsedSlots[i].st * 60 * 1000;
    				compactUsedSlots[i].html = "";
    				var v = false;
    				if (me.minDate !== "" && me.getMinDate != "") //check with the min date
    				{
    					var current = me.getMinDate;
    					var currenttime = current.getTime() - me.tz * 60 * 60 * 1000;
    					if (compactUsedSlots[i].t > currenttime) {
    						v = true;
    					}
    				}
    				else
    					v = true;
    				if (v) {
    					if (compactUsedSlots[i].quantity >= capacity_service || compactUsedSlots[i].currentSelection)
    						compactUsedSlots[i].html = '<div s="' + s + '" h1="' + compactUsedSlots[i].h1 + '" m1="' + compactUsedSlots[i].m1 + '" h2="' + compactUsedSlots[i].h2 + '" m2="' + compactUsedSlots[i].m2 + '" style="' + (!me.usedSlotsCheckbox ? "display:none" : "") + '" class="htmlUsed  ' + ((typeof compactUsedSlots[i].s !== 'undefined') ? compactUsedSlots[i].s.replace(/ /g, "").toLowerCase() + " old" : " choosen") + '"><a>' + me.formatString(compactUsedSlots[i], false, me.tz) + '</a>' + ((typeof compactUsedSlots[i].e !== 'undefined') ? "<div class=\"ahbmoreinfo\">" + compactUsedSlots[i].e + "</div>" : "") + '</div>';
    					compactUsedSlots[i].availableslot = false;
    					htmlSlots[htmlSlots.length] = compactUsedSlots[i];
    				}
    			}
    		}
    	}
    
    	if ((typeof specialPadding === 'undefined')) {
    		pb = me.pb;
    		pa = me.pa;
    	}
    	for (var i = 0; i < arr.length; i++) {
    		st = arr[i].t1 || (arr[i].h1 * 60 + arr[i].m1 * 1);
    		et = arr[i].t2 || (arr[i].h2 * 60 + arr[i].m2 * 1);
    		if (st >= et)
    			et += 24 * 60;
    		st += me.pb;
    		while (st + duration + me.pa <= et && st < 24 * 60) {
    			html = "<div class=\"availableslot\"><a href="">" + me.formatString({ st: st, et: st + duration }, false, me.tz) + ((typeof cp_hourbk_cmpublic !== 'undefined') ? "<span class=\"ahb_slot_availability\"><span class=\"p\">ahbslotavailabilityP</span><span class=\"t\">ahbslotavailabilityT</span></span>" : "") + "</a></div>";
    			htmlSlots[htmlSlots.length] = { availableslot: true, st: st, serviceindex: s, h1: Math.floor((st) / 60), m1: ((st) % 60), h2: Math.floor((st + duration) / 60), m2: ((st + duration) % 60), html: html, t: $.datepicker.parseDate("yy-mm-dd", arr[i].day).getTime() + st * 60 * 1000 };
    			if (!me.bSlotsCheckbox)
    				st += me.bduration;
    			else
    				st += me.bduration + pa + pb;
    		}
    	}
    
    	htmlSlots.sort(function (a, b) {
    		return a.t - b.t;
    	});
    
    	var slotQty = {};
    	htmlSlots.filter(function (i) {
    		return !i.availableslot;
    	}).forEach(function (s) {
    		if (!slotQty.hasOwnProperty(s.t)) {
    			slotQty[s.t] = 0;
    		}
    		slotQty[s.t] += s.quantity;
    	});
    
    	htmlSlots.filter(function (i) {
    		return i.availableslot;
    	}).forEach(function (x) {
    		x.html = x.html.replace("ahbslotavailabilityP", (capacity_service - (slotQty[x.t] ?? 0)));
    	});
    
    	//remove duplicates
    	htmlSlots = htmlSlots.reduce(function (field, e1) {
    		var matches = field.filter(function (e2) { return e1.html == e2.html });
    		if (matches.length == 0) {
    			field.push(e1);
    		} return field;
    	}, []);
    	htmlSlots = htmlSlots.reduce(function (field, e1) {
    		var matches = field.filter(function (e2) { return e1.t == e2.t });
    		if (matches.length == 0) {
    			field.push(e1);
    		}
    		else {
    			for (var i = 0; i < field.length; i++)
    				if (field[i].t == e1.t && !field[i].availableslot && e1.availableslot) {
    					field[i] = e1;
    					break;
    				}
    		}
    		return field;
    	}, []);
    	me.usedSlots[d] = me.usedSlots[d] || [];
    	if (me.usedSlots[d].length > 0 && htmlSlots.length > 0)
    		for (var i = 0; i < me.usedSlots[d].length; i++)
    			for (var j = 0; j < htmlSlots.length; j++)
    				if (htmlSlots[j].serviceindex == me.usedSlots[d][i].serviceindex && htmlSlots[j].h1 == me.usedSlots[d][i].h1 && htmlSlots[j].m1 == me.usedSlots[d][i].m1 && htmlSlots[j].h2 == me.usedSlots[d][i].h2 && htmlSlots[j].m2 == me.usedSlots[d][i].m2) {
    					if (htmlSlots[j].html.indexOf("currentSelection") == -1) htmlSlots[j].html = htmlSlots[j].html.replace("htmlUsed", "htmlUsed currentSelection");
    					if (htmlSlots[j].html.indexOf("currentSelection") == -1) htmlSlots[j].html = htmlSlots[j].html.replace("availableslot", "availableslot currentSelection");
    				}
    	return htmlSlots;
    }
    
    • This reply was modified 3 years, 10 months ago by ole1986.
    • This reply was modified 3 years, 10 months ago by t-p.
    Thread Starter ole1986

    (@ole1986)

    Also, the paddings are not correctly visualized in the backend
    See this image

    At least it is showing correctly at frontend.
    BUT AS already mentioned for some unknow reason and at some unknown time the slot times just become a fulle different from what the days actually planed for without booking some in meanwhile or reconfiguring things. It just appears wrong and ppl. book on the rong slot time

    Thread Starter ole1986

    (@ole1986)

    In addition to this the database and how the information are stores makes it difficult to extend the plugins since all relevant and important data are stored as php serialized data

    Thread Starter ole1986

    (@ole1986)

    In addition to this I have found out when I do the hacky thing of add the following JS into wp_head

    var cp_hourbk_cmpublic = true;

    it does display the number of available slots, BUT it does not decrease it correctly when “Show end time [help?]” flag is hooked

    UPDATE: Possible reason for the incorrect decrease of availability is the padding option. Noted this when choosing a “padding of 30 minutes after”

    • This reply was modified 3 years, 11 months ago by ole1986.
    Thread Starter ole1986

    (@ole1986)

    UPDATE

    I just updated the plugin to support both plugins with version 1.0.2

    “WP Time Slots Booking Form” AND “Appointment Hour Booking”

    Thread Starter ole1986

    (@ole1986)

    Hi,
    thank you for your answer

    I think its only a visual thing.
    Since I choose the last available slot, the selected time completely disappered.
    But once I submit the data and reopen the page, the “unused slots” are shown.

    Unfortunately the used time does not seem show “available capacity” also (which should be zero than)

    You can checkout my example page below:
    https://test.cloud86.de/slot-buchung/
    with date “2021-04-07” and time “17:15 – 19:15”

    Thread Starter ole1986

    (@ole1986)

    Hi codepeople,

    thank you. I have also noticed that.
    I think I can make it work for both in future.

    Thread Starter ole1986

    (@ole1986)

    Sorry, but I had to correct that the last changes on my given plugin “WP Time Slot Extended” are now focused on the other plugin made by you.

    Since https://de.www.ads-software.com/plugins/appointment-hour-booking/ is more famous I thought that makes more sense to do it for such plugin

    Plugin Author ole1986

    (@ole1986)

    Hi,

    I am sorry for the delay. Best way to trigger an issue is on github.com
    https://github.com/ole1986/wc-invoice-pdf.

    To quickly answer your questions:

    – Vat is not correct – This could be. I will double check the settings to fetch properly from the VAT database used in Woocomerce. https://github.com/ole1986/wc-invoice-pdf/issues/12

    – Legally complient compability (extra fields) – Please raise an issue on the above mentioned github project page

    – Logo image size – You can either try to change dimension of the image to better fit your needs your raise a issue on the github project page.

    – The date is being displayed in US – This issue has been fixed in version 1.5.1

    – Two addresses – Please again raise this as an issue on the project page

    Thank you for reporting. And again sorry for the delay. But as already mentioned in the first post only github.com project issue get higher attention.

    Regards

    Plugin Author ole1986

    (@ole1986)

    Thank you very much for your reply.

    It really sounds like you had the chance to customize several things related to this plug-in.

    What if you take part of this project on GitHub.com?

    I can also add you as contributor, so you can change the code directly and we can deploy new versions quicker.

    I do have many other projects and would be happy about having another developer in my team.

    PS: if you have code related issues I prefer to have such requests on GitHub instead: https://github.com/ole1986/wp-ispconfig3/issues

    PPS: I fully agree with the change from mail to wp_mail especially for security reasons.

    Regards
    Ole

    Plugin Author ole1986

    (@ole1986)

    Hi ipstream,

    Can you please provide me with some more details about your environment?

    * PHP version
    * wp_ispconfig3 version (just to be sure)
    * woocommerce version

    Thank you in advanced

    Thread Starter ole1986

    (@ole1986)

    Hi, I am just asking for the status again?!

Viewing 15 replies - 1 through 15 (of 55 total)