Forum Replies Created

Viewing 12 replies - 16 through 27 (of 27 total)
  • Thread Starter rrosenthal

    (@rrosenthal)

    I was able to effectively override the animation effect in Max Mega Menu by changing the Divi menu animation as follows:

    Open > Divi Theme Customizer
    Open > Header & Navigation
    Open > Primary Menu Bar
    Change: Drop Down menu Animation to FADE

    I have requested Elegant Themes Support to advise how best to disable the Divi Primary and Secondary Menu Animation, which would allow the plugin animation to takeover.

    Thread Starter rrosenthal

    (@rrosenthal)

    Thanks for your reply, Tom. I looked thru the Divi CSS and Theme options, and just may be missing it. I’ve asked Elegant Themes to check it as well, and will post what I learn for the benefit of others.

    After much research and trials, I was able to use this code to add 2 custom fields to the standard woocommerce registration page, then map those fields to Shipping_Address_2 and Billing_Address_2 for addition to the database. While there may be other/better ways to do this, I couldn’t find any, so hope this may be of use to others. “stid” and “fein” are the customer fields,

    Add to functions.php

    /**
     * Add custom fields for WooCommerce registration.
     *
     * @return string Register custom fields HTML.
     */
    function wooc_extra_register_fields() {
    	?>
    
    	<p class="form-row form-row-first">
    	<label for="reg_stid"><?php _e( 'Sales & Use Tax ID', 'woocommerce' ); ?> <span class="required">*</span></label>
    	<input type="text" class="input-text" name="stid" id="reg_stid" value="<?php if ( ! empty( $_POST['stid'] ) ) esc_attr_e( $_POST['stid'] ); ?>" />
    	</p>
    
    	<p class="form-row form-row-last">
    	<label for="reg_fein"><?php _e( 'Federal/Country Tax ID', 'woocommerce' ); ?> <span class="required">*</span></label>
    	<input type="text" class="input-text" name="fein" id="reg_fein" value="<?php if ( ! empty( $_POST['fein'] ) ) esc_attr_e( $_POST['fein'] ); ?>" />
    	</p>
    
    	<div class="clear"></div>
    
    	<?php
    }
    
    add_action( 'woocommerce_register_form_start', 'wooc_extra_register_fields' );
    
    /**
     * Validate the extra custom fields for registration.
     *
     * @param  string $username          Current username.
     * @param  string $email             Current email.
     * @param  object $validation_errors WP_Error object.
     *
     * @return void
     */
    function wooc_validate_extra_register_fields( $username, $email, $validation_errors ) {
    	if ( isset( $_POST['stid'] ) && empty( $_POST['stid'] ) ) {
    		$validation_errors->add( 'stid_error', __( 'A Sales & Use Tax ID is required to open an account!', 'woocommerce' ) );
    	}
    
    	if ( isset( $_POST['fein'] ) && empty( $_POST['fein'] ) ) {
    		$validation_errors->add( 'fein_error', __( 'A Federal/Country Tax ID is required to open an account!.', 'woocommerce' ) );
    	}
    
    }
    
    add_action( 'woocommerce_register_post', 'wooc_validate_extra_register_fields', 10, 3 );
    
    /**
     * Save the extra custom fields to Shipping and Billing Address_2 fields.
     *
     * @param  int  $customer_id Current customer ID.
     *
     * @return void
     */
    function wooc_save_extra_register_fields( $customer_id ) {
    	if ( isset( $_POST['stid'] ) ) {
    		// WordPress stid custom field.
    		update_user_meta( $customer_id, 'shipping_address_2', sanitize_text_field( $_POST['stid'] ) );
    	}
    
    	if ( isset( $_POST['fein'] ) ) {
    		// WooCommerce fein custom field.
    		update_user_meta( $customer_id, 'billing_address_2', sanitize_text_field( $_POST['fein'] ) );
    	}
    
    }
    
    add_action( 'woocommerce_created_customer', 'wooc_save_extra_register_fields' );

    I looked at these plugins online, but not purchased them as they appear to work at checkout. My requirements are to place and capture the custom fields on the My Accounts page. This way a user cannot register (setup an account) unless they have the required field data.

    Crespo — looks like Claudio tested and verified your code worked, and that you should also save the country code. Did that work for you?

    Thread Starter rrosenthal

    (@rrosenthal)

    Come on … anybody??

    Forum: Hacks
    In reply to: Woocommerce Custom Reg Fields
    Thread Starter rrosenthal

    (@rrosenthal)

    Thanks. I have opened another thread in the plugins area per your suggestion.

    Thread Starter rrosenthal

    (@rrosenthal)

    Thanks. I realized it required the Premium version after reading another post, I had originally missed. I’ve purchased the Premium version and have the add-ons runnings ?? Everything working as expected.

    Thread Starter rrosenthal

    (@rrosenthal)

    Earlier posts indicates additional add-ons are provided with the premium version.

    Thread Starter rrosenthal

    (@rrosenthal)

    I appreciate it and will keep you posted ??

    R>

    Thread Starter rrosenthal

    (@rrosenthal)

    Hi Tobias,

    To be clear, I should have said the DataTables plugin is not installed currently on the production site. I only did some basic testing with it on the test site — and when I initially ran into some issues — opted for the Excel export/sort/import to quickly accomplish what the client wanted.

    Before that though, we were using the basic DataTables sort, without the plugin. It was a basic a/n sort on the 0 column, which worked flawlessly. The client then advised they wanted For Sale sorted by $ and Recently Sold sorted by Date (in a hidden column).

    AS I said, it’s in the client’s court to advise the preference on using Excel or implementing the DataTables plugin.

    R>

    Thread Starter rrosenthal

    (@rrosenthal)

    The DataTables plugin is only running on a test site now, which unfortunately isn’t accessible remotely.

    The production site is tfgre.com — navigate to \Listings\For Sale and \Listings\Recently Sold to view the tables — but these are TablePress straight up (i.e., without the DataTables plugin). The production tables were exported to Excel, sorted, and re-imported to TablesPress to achieve the desired ordering.

    I am in-process to review with client to determine if they want to proceed with the Excel method — or invest further to implement the DataTables plugin. It’s in the client’s court at this point.

    Thread Starter rrosenthal

    (@rrosenthal)

    Thanks for your quick reply.

    The date and US$ sorts are new client requests. Until now, basic sorting, such as “aaSorting”: [[4,’desc’]], in TablePress as been sufficient for their needs.

    To answer your question — before submitting my post, I went thru the FAQs and related posts to learn and check what I could about using the DataTables plugin. I came across post-3877034 and your first reply said “After that, all you should need is “aaSorting”: [[3,’desc’]]”.

    I quickly tried the custom commands you provided, however without result, so I’ll need to tinker a little more.

    Thanks again. I’ll post again to advise on progress.

Viewing 12 replies - 16 through 27 (of 27 total)