Julien
Forum Replies Created
-
Forum: Plugins
In reply to: [Polylang] API language selectionJust found out that you need PRO for this.
Basically buy the PRO version then you can call getEntityRecoards and get language :const posts = useSelect<Post[] | null>(select => select("core").getEntityRecords("postType", post_type, { per_page: 99, lang: selectedLanguage, }) );Forum: Plugins
In reply to: [Delivery & Pickup Date Time for WooCommerce] Delivery details in app missingHi, if you want to display date + time in the app it’s easy, just add those lines in yout functions.php child (example for pickup) :
add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number' ); function change_woocommerce_order_number( $order_id ) { $pickup_date = get_post_meta( $order_id,'pickup_date', true ); $pickup_time = get_post_meta( $order_id,'pickup_time', true ); $pickup = date_i18n( 'd/m', strtotime( $pickup_date ) ) ; $new_order_id = $order_id . " - " . $pickup. " - " . $pickup_time; return $new_order_id; }That’s nice from you but I’ve found the solution, here is the solution (to add in functions.php file of current template) :
add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number' ); function change_woocommerce_order_number( $order_id ) { $service_time = get_post_meta( $order_id, '_wfs_service_time', true ); $service_date = get_post_meta( $order_id, '_wfs_service_date', true ); $new_order_id = $order_id . " - " . $service_date . " - " . $service_time; return $new_order_id; }This way my client can get order number + date + time + name of client in Woo Commerce app.
- This reply was modified 5 years, 1 month ago by Julien.
So I was able to do it by adding an id “dates” to select in “render-service-dates.php” and then run this javascript :
var d = new Date(); var today = new Date(); var dd = String(today.getDate()).padStart(2, '0'); var mm = String(today.getMonth() + 1).padStart(2, '0'); var yyyy = today.getFullYear(); todaysDate = yyyy + '-' + mm + '-' + dd; if(d.getHours() >= 15){ //because the shift for my client ends at 3pm [].slice.call( document.querySelector('select[id="dates"]').children ) .forEach(function(elem) { if ( elem.value == todaysDate ) elem.parentNode.removeChild(elem); }); }But it’s not viable because there’s no post to get the service dates for the next day so it shows the wrong message..
- This reply was modified 5 years, 1 month ago by Julien.
Ok I’ve added the id=”dates” to it then with this code I was able to remove an option :
var selectobject = document.getElementById("dates"); for (var i=0; i<selectobject.length; i++) { if (selectobject.options[i].value == '2021-04-19') selectobject.remove(i); }- This reply was modified 5 years, 1 month ago by Julien.
Would you say it’s possible through javascript if I remove an option from the select by passing an ID to it ?
Do you have any idea where I should start to do this ?
Yes that’s a good start, I’ve already set the modal to display like this but I wanted to know if you can provide me with a custom code that would disable the current day if the shift is over for this day.
For example : if the shift for the 1st april ends at 4pm then at 5pm this day is not part of the modal anymore, not selectable and it starts with the 2nd instead ?
Very good plugin otherwise !!- This reply was modified 5 years, 1 month ago by Julien.