Customize a field in final checkout

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #825448
    Christine Ros
    Participant

    Hello,

    I wish to customize this
    field to modify

    into this
    customize

    I didn’t find to translate in Loco, and I want the field is required.

    Is it possible ?

    • This topic was modified 4 years, 9 months ago by Christine Ros.
    #825638
    J. Davis
    Keymaster

    Hello Christine,

    Thank you for your question however it is not still clear what section you want to edit. Could you provide a link to check this out? Thanks

    best regards,
    J. Davis

    #825919
    Christine Ros
    Participant

    Hi Mr Davis,
    I’d like to modify the thing in red rectangle of the first screen shot to look like in the second screenshot.

    At final checkout, on the page where there is the details of the payment and all about the customer, on the right of the screen, there is a field to add additional info optional.

    I want to modify the text of the label from “note de commande” (order note in original english) into “heure d’arrivée” (check in time in original english)

    I want to write in preset field “exemple: avant 13h30 / Après 13h30” instead of “comment about your order :ex delivery instruction”

    And I want this field to be required because I need to know this information.

    Thank you for help.

    Christine

    #826642
    J. Davis
    Keymaster

    Hi Christine,

    Thank you for your clarification. You will need to override default from with your modification using removing original function and adding new custom one. You may refer to one of the topics below to find examples of code to override the checkout form:

    Client info in admin mail

    Edit Booking / Checkout form

    Or you may order this customization purchasing Extended Support offer. We will adjust the form for you.

    best regards,
    J. Davis

    #827784
    Christine Ros
    Participant

    Hi,
    Oh ! Now support is charged …

    By the way, I know the linked post – one of these is my last year post (free great answer).

    I am not sure you well look at my question, because after 4 days searching in the all directories and files of the booking plugin, no way to find the thing i want to change : it is a woocommerce checkout field !

    Also, I add .mphb-guest-name-wrapper{display:none;} in pethotel.child style.css, but it doesn’t override. This field still appears on checkout. Why ?

    Thank for help (or do I have to pay for this ??)

    #828140
    J. Davis
    Keymaster

    Hi Christine,

    Thank you for your feedback. As far as I know there are available free plugins that allow to edit WooCommerce Checkout page.

    As for the style you try to implement so I’d recommend to add !important to force your style over the default one e.g.

    .mphb-guest-name-wrapper{
    display:none !important;
    }

    We still provide support for free if one owns active license however the custom modifications requires more time and efforts and are not included in default support policy. So we provide you with a solution however if you want us to implement it you may order Extended Support service additionally to get qualified personal assistance.

    best regards,
    J. Davis

    #828146
    Christine Ros
    Participant

    Hello Mr Davis,

    Glad to ear from you. I understand your point of view about customization.

    Now, I also know plugins to edit woocommerce checkout, maybe you could answered the field i’d like to change was handled by WC, not to override function.

    The adding important! in the code doesn’t works.

    Thanks for help.

    #828433
    J. Davis
    Keymaster

    Hi Christine,

    Thank you for your reply. I’ve checked your site and found that it was field at WooCommerce Checkout page and it looks like you have modified it.

    Additionally I could not see guest name field on booking confirmation page. have you managed to remove it?

    best regards,
    J. Davis

    #828454
    Christine Ros
    Participant

    Hi,

    I have installed a plugin to change the text in the field showed on the screen shot above. Also, this plugin make me able to add a field about arrival time.

    To remove guest name on motopress booking plugin, I had to modify checkout-view.php – I have deleted line from 180 to 188.

    To protect the customization from plugin update, I first tryed to add directories in Petotel Child Theme : includes\views\shortcodes\checkout-view.php. But, maybe it is not the right way because guest wrapper still appear on the info checkout page, so i have deleted the additional files on child theme, and make change in original checkout-view.php.
    Is there a better way to protect from update ?

    #829332
    J. Davis
    Keymaster

    Hi Christine,

    The easiest way to remove that field was to use a style I sent. However if you wish to remove it overriding templates of Hotel Booking plugin you will need to add remove default function and add your custom one e.g.

    add_action( 'wp_head', 'remove_my_class_action' );
    function remove_my_class_action(){
    	remove_action( 'mphb_sc_checkout_room_details', array( '\MPHB\Views\Shortcodes\CheckoutView', 'renderGuestsChooser' ), 20, 3 );
    }
    
    add_action( 'mphb_sc_checkout_room_details', 'theme_renderGuestsChooser' , 20, 3 );
    
    function theme_renderGuestsChooser( $roomType, $roomIndex, $booking ){
    		$namePrefix	 = 'mphb_room_details[' . esc_attr( $roomIndex ) . ']';
    		$idPrefix	 = 'mphb_room_details-' . esc_attr( $roomIndex );
    		$maxAdults	 = $roomType->getAdultsCapacity();
    		$maxChildren = $roomType->getChildrenCapacity();
    		?>
    		<?php if ( MPHB()->settings()->main()->isAdultsAllowed() ) { ?>
    			<p class="mphb-adults-chooser">
    				<label for="<?php echo esc_attr( $idPrefix . '-adults' ); ?>">
    					<?php
    						if ( MPHB()->settings()->main()->isChildrenAllowed() ) {
    							_e( 'Adults', 'motopress-hotel-booking' );
    						} else {
    							_e( 'Guests', 'motopress-hotel-booking' );
    						}
    					?>
    					<abbr title="<?php _e( 'Required', 'motopress-hotel-booking' ); ?>">*</abbr>
    				</label>
    				<select name="<?php echo esc_attr( $namePrefix . '[adults]' ); ?>" id="<?php echo esc_attr( $idPrefix . '-adults' ); ?>" class="mphb_sc_checkout-guests-chooser mphb_checkout-guests-chooser" required="required">
    					<option value=""><?php _e( '— Select —', 'motopress-hotel-booking' ); ?></option>
    					<?php
    					for ( $i = 1; $i <= $maxAdults; $i++ ) {
    						?>
    						<option value="<?php echo $i; ?>">
    							<?php echo $i; ?>
    						</option>
    					<?php } ?>
    				</select>
    			</p>
    		<?php } else { ?>
    			<input type="hidden" id="<?php echo esc_attr( $idPrefix . '-adults' ); ?>" name="<?php echo esc_attr( $namePrefix . '[adults]' ); ?>" value="<?php echo esc_attr( $maxAdults ); ?>" />
    		<?php } ?>
    		<?php if ( $roomType->getChildrenCapacity() > 0 && MPHB()->settings()->main()->isChildrenAllowed() ) { ?>
    			<p class="mphb-children-chooser">
    				<label for="<?php echo esc_attr( $idPrefix . '-children' ); ?>">
    					<?php printf( __( 'Children %s', 'motopress-hotel-booking' ), MPHB()->settings()->main()->getChildrenAgeText() ); ?>
    					<abbr title="<?php _e( 'Required', 'motopress-hotel-booking' ); ?>">*</abbr>
    				</label>
    				<select name="<?php echo esc_attr( $namePrefix . '[children]' ); ?>" id="<?php echo esc_attr( $idPrefix . '-children' ); ?>" class="mphb_sc_checkout-guests-chooser mphb_checkout-guests-chooser" required="required">
    					<option value=""><?php _e( '— Select —', 'motopress-hotel-booking' ); ?></option>
    					<?php
    					for ( $i = 0; $i <= $maxChildren; $i++ ) {
    						?>
    						<option value="<?php echo $i; ?>">
    							<?php echo $i; ?>
    						</option>
    					<?php } ?>
    				</select>
    			</p>
    		<?php } else { ?>
    			<input type="hidden" id="<?php echo esc_attr( $idPrefix . '-children' ); ?>" name="<?php echo esc_attr( $namePrefix . '[children]' ); ?>" value="<?php echo esc_attr( $maxChildren ); ?>" />
    		<?php } ?>
    		<!--<p class="mphb-guest-name-wrapper">
    			<label for="<?php echo esc_attr( $idPrefix . '-guest-name' ); ?>">
    				<?php _e( 'Full Guest Name', 'motopress-hotel-booking' ); ?>
    			</label>
    			<input
    				type="text"
    				name="<?php echo esc_attr( $namePrefix . '[guest_name]' ); ?>"
    				id="<?php echo esc_attr( $idPrefix . '-guest-name' ); ?>" />
    		</p>-->
    		<?php
    	}

    This code should be added to functions.php file of the Child Theme.

    best regards,
    J. Davis

    #829741
    Christine Ros
    Participant

    Hello M.Davis
    As I told you, adding code in css.file + important! didn’t works.
    I have edited function.php child theme as you kindly explain to me, instead of delete lines of code in checkout-view.php and it is ok too, i’ve tried to code something like you did, but as i am not a master in php, i certainly made something (s) wrong. So thank you a hundred times for your help.
    Have a very good day.

    #829745
    J. Davis
    Keymaster

    Hi Christine,

    Thank you for your reply.

    1. As for css I meant that I could check why the style did not work if you remove modifications however it is noted any more if it work with function code I’ve sent.

    2. Do you mean the code I sent works properly or you still need some modifications?

    best regards,
    J. Davis

    #829797
    Christine Ros
    Participant

    Hi,

    2 – I mean your code works great, mine was not good coded

    1 – ok, i understand. Do you want me to restore function.php child theme to check why css doesn’t works ?

    #829861
    J. Davis
    Keymaster

    Hi Christine,

    1. We just want to help you resolve the question you have. If you are satisfied with function code that removed guest name field we may leave it as it is. However if you insist to resolve this request by means of CSS we may proceed in this direction. Thanks.

    best regards,
    J. Davis

    #830024
    Christine Ros
    Participant

    Hello again,

    My problem is solved, I am very happy with the result.
    Thank you again.
    Christine

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.