Custom Fields
Re-Envisioned
Support General Display element based on 'post'

This topic contains 42 replies, has 3 voices, and was last updated by  carassius 3 years, 10 months ago.

  • Creator
    Topic
  • #1306

    carassius
    Participant

    If I create a basic customer cpt
    name
    phone
    email
    address

    and then in another cpt use ‘type’ => ‘post’ to generate a drop down of names, how can I then filter the other components based on the selected name? Should I use the conditional extension, or is there a way to do this without?

    For example, if someone selects “john doe” I then want the other contact info displayed in input boxes. I hope that makes sense?

Viewing 10 replies - 31 through 40 (of 42 total)
  • Author
    Replies
  • #1362

    Tan Nguyen
    Participant

    Hi Jon, it’s really weird if it return empty value even though customer phone has set. Can you please give me credentials to your website to check? Include FTP and WP-Admin? Can you send me via my email to check it faster? My email is: tan@fitwp.com

    #1363

    carassius
    Participant

    It is on a local host at the moment, but can try and get a live site working

    #1364

    Tan Nguyen
    Participant

    Yeah, glad to meet you, an Australian who like Breaking Bad show like me 🙂

    #1365

    carassius
    Participant

    Who doesnt like breaking bad! Are you Aussie? That would explain the Perth Boat House 😛

    #1366

    carassius
    Participant

    Ok, created a live site at jonmather.info and sent you admin access.

    I created two contacts and a test quote

    #1370

    carassius
    Participant

    Did you get a chance to login and have a look to see what was going on Tan?

    #1371

    carassius
    Participant

    got it! I am a dumb arse, its in the ‘std’ calling the wrong meta!

    #1372

    carassius
    Participant

    So now the issue is that it has completely broken the layout?

    #1373

    carassius
    Participant

    Now that I have the customer conditional working, I am trying to configure the products which are a cloneable group

    My code is looking like this, can you have a look and see what is going wrong for me?

    • The first thing, content is not populating but the correct product ID gets assigned
    • The inputs only appear once, and do not clone at all

    https://pastebin.com/D9W7sauW

    #1375

    Tan Nguyen
    Participant

    Hi Jon,

    Sorry for late reply, I just back again and wonder to see that you can fix your code easily, brilliant.

    I can see you set 'column' => 4 for some ‘hidden’ fields, it’s not necessary as these fields are hidden and some repeated code can be rewrite to cleaner 😉

    All foreach like so:

    
    ...
    foreach ( $_POST as $key => $value )
    {
    	if ( strpos( $key, 'p52_quote_phone_' ) )
    		unset( $_POST[$key] );
    }
    ...
    

    Can be combine and rewrite to 1 foreach like so:

    
    foreach ( $_POST as $key => $value )
    {
    	if ( strpos( $key, 'p52_quote_phone_' ) || strpos( $key, 'p52_quote_company_' ) || strpos( $key, 'p52_quote_delivery_address' ) ... ) // Replace ... with all fake fields you've set
    	unset( $_POST[$key] );
    }
    

    For cloned group, I firstly designed for 1 product only and if we switch to cloned groups, it’s time consuming because it’s related to populate custom data and out of our scope, we’re sorry about that.

    Best Regards

    Tan

Viewing 10 replies - 31 through 40 (of 42 total)

The topic ‘Display element based on 'post'’ is closed to new replies.