• Resolved playbasfa

    (@playbasfa)


    Hello, i have a website about restaurants.
    Clients can add a new dish in that restaurant thank you to your plugin.

    The journey implemented already is this
    Right now the customer fill the form and one of this field is a drop down menu with a list of all the restaurant so that he can choose to which restaurant the dish he submitting belong to.

    But the journey I would like to implement is this
    The customer will start the journey from the restaurant page, for this reason once he click on the option “add a dish” (he is in the restaurant page at this moment) I would like that he is redirect to the “add dish page” like before but this time there is no need to fill the field “Restaurant” because somehow this data is passed from the previous page. I don’t even need to show the field on the front-end, for me the important is that the dish is created correctly.

    Could you help please?
    Thank you,
    Fabrizio

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Shabti Kaplan

    (@shabti)

    We got a very similar feature request yesterday. I’m coming up with a way to implement it.

    Can this be accomplished by adding a post object field or relationship field? If so, perhaps we can add some conditional logic to make this field’s value equal a post id sent by the “add dish” button…

    Thread Starter playbasfa

    (@playbasfa)

    Mmm I’m not sure about your question to be honest. I am not used to use Post Object and Relationship, so I don’t know if they can be helpful.
    But maybe I can be more detailed so that you can have a better visibility about the request.

    I have a taxonomy called ‘Restaurant’ and every time I publish a new dish (dish is my CPT) i select which taxonomy term (which restaurant) I want to associate to that specific dish.
    Now, I want the button ‘add a dish’ to be placed in the archive pages of the taxonomy terms of Restaurant taxonomy.

    As an example, I have the Restaurant ‘Uncle Joe’
    So, if I go to ‘mywebsite/uncle_joe’, I land on an archive page where I show all the dishes associated to that tax term (that means dishes sold in that restaurant) AND the button ‘add a dish’.

    Important: Every dish must have a mandatory ACF that is called “name of the restaurant”.

    By clicking on the button “Add a dish” what I would like is one of these 2 options:

    1) Your form appear on a modal popup (Display option: modal) but the ACF “name of the restaurant” is already filled (and maybe even hidden in the front end from the visitor) retrieving the data somehow for the fact of being on the archive page of the taxonomy
    or
    2) Same as point above, the your widget is in a different page and I land in the page clicking on the ‘add a dish’ of above

    I was thinking to the ‘Dynamic’ feature that I always see in other widget, which allows to get dynamically values from the page where it is used.
    These archive page can have also some ACF associated, so I could store the name of the restaurant in a Custom Field, and use it in your widget through Dynamic feature maybe
    Hope I have been clear and more helpful than before with this ??

    Thread Starter playbasfa

    (@playbasfa)

    This is really key for my website and without that I can’t go live, so I’m really thinking hard and maybe I found a work-around.
    Would be easier to do something like what I’m gonna explain here below?

    The idea is to create a different form for each Restaurant so that if that form is filled, this means that the data filled belong to that specific restaurant.

    Here again the problem is, how can I know which form was filled?

    Thank you again,
    Fabrizio

    Plugin Author Shabti Kaplan

    (@shabti)

    Hello, Fabrizio!

    Like I said this is similar to what others have been asking for. So I want to help you out with this issue.

    This is what I can do. Let me know if it sounds good to you.

    In the “new post” option I will add an option called “related term”. You will the option to configure this manually or dynamically based on the current taxonomy term. If you choose current term, it will link the post to the term and vice versa

    What do you say?

    Thread Starter playbasfa

    (@playbasfa)

    The fact that you could implement something “on-demand” I think is amazing and will push your plugin to be one of the best out there.

    That said, I’ve a doubt about your proposal, when you say “it will link the post to the term and viceversa” how this link will happen?
    It will not be possible to determine to which ACF this information would be passed I guess? If not, where this information will be stored?

    I think what would be nice is apply the option you suggested to the specific field instead than to the “New Post” option, in this way the the dynamic value will be passed into a specific custom field determined from the user and differents dynamic values can be passed to different custom field.

    I did a sketch to explain better, you can look at it here

    Thank you so much,
    Fabrizio

    • This reply was modified 4 years, 10 months ago by playbasfa.
    • This reply was modified 4 years, 10 months ago by playbasfa.
    • This reply was modified 4 years, 10 months ago by playbasfa.
    • This reply was modified 4 years, 10 months ago by playbasfa.
    • This reply was modified 4 years, 10 months ago by playbasfa.
    Plugin Author Shabti Kaplan

    (@shabti)

    I like your idea and this is something that I’m going to look into implementing. However, I think it would be best to have these options in the ACF dashboard (under the field’s default value setting) rather than in the Elementor editor.

    Now that I said that I realize there is a hook you can use to have default value be dynamic. Maybe it can help you for now.

    replace field name with your field name. This will only work if the form is on the term archive page.

    Warning only use on a testing or staging site

    add_filter( 'acf/prepare_field', function( $field ) {
    	
    		// bail early if no 'admin_only' setting
    		if( $field[ 'name' ] != 'field_name' ) return $field;	
    
    		$term_id = get_queried_object()->term_id;
                    $field[ 'value' ] = $term_id; 
             
    		// return
    		return $field;
    	} );
    Thread Starter playbasfa

    (@playbasfa)

    Thank you so much I’m gonna try that!

    I read again your previous message and I think what you mean when you say

    If you choose current term, it will link the post to the term and vice versa

    is that the “current” term is the one of the archive page where your widget is launched from, and this term will be associated to the CPT created?

    So, if I use your widget from the Restaurant ‘Uncle Joe’ archive page, it will create a new CPT (dish, in my case) that will have ‘Uncle Joe’ as Restaurant taxonomy associated?
    And, if Uncle joe is child of ‘Los Angeles’, also the hierarchy will be mantained when assoxiated to the new cpt, right?

    If yes, this is also something really useful that I would LOVE to have.

    Do you have any rough idea about the release date?

    Thank you,
    Fabrizio

    Plugin Author Shabti Kaplan

    (@shabti)

    We’re currently working on a way to get this out tomorrow. If not, then some time next week

    Thread Starter playbasfa

    (@playbasfa)

    Great, thank you so much! ??

    Thread Starter playbasfa

    (@playbasfa)

    Hi Shabi, can I ask you if this is gonna be released in the Pro version or not?
    I also want to inform you that I just discover this plugin of you –> https://www.ads-software.com/plugins/advanced-post-queries/ and I’m gonna build my all website thank to this because otherwise the structure I would have need to achieve what I need would have been way more difficult.
    So thank you!

    Plugin Author Shabti Kaplan

    (@shabti)

    hello Fabrizio good to hear from you again. This is going to be released hopefully today in the free version. We literally just finished testing it. I was also debating whether or not to add the original request of saving the term based on the origin URL but this would be a bit more complicated so that will be for the future.

    I’m really glad you’re getting good use out of both my plugins!

    Thread Starter playbasfa

    (@playbasfa)

    Tks Shabi, I can’t wait to try it ??

    Plugin Author Shabti Kaplan

    (@shabti)

    Hi Fabrizio if you update the plugin now you will have have a new option under the post tab when using the new post action that will allow you to automatically add terms to the new post. There is also an option to automatically add the current term.
    Let me know how it goes

    Thread Starter playbasfa

    (@playbasfa)

    Hi Shabti, first of all, thank you so much, is working!!! ??

    Second, this is still not what will fix all our problems but part of them.
    What would really be amazing, since we’re using your widget also in a CPT page, is to pass some attributes of this CPT item for example the title.

    This is still not implemented right?

    Still my number one favourite feature is the one where an ACF can be hidden in the front-end and the value of it can be set dynamically (as Elementor does usually) like with a short code or with an other ACF ??

    Thank you so much,
    Fabrizio

    • This reply was modified 4 years, 10 months ago by playbasfa.
    Plugin Author Shabti Kaplan

    (@shabti)

    Hello Fabrizio, I’m working on implementing these features, but especially the second one. I’m want to add a bunch of shortcode options to the ACF fields page.

    I’ll keep you updated

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘How to fill a field based on the origin url’ is closed to new replies.