Support » Plugin: WPAdverts - Classifieds Plugin » Redirection of Adverst_list is not correct

  • Resolved legentlemanfr

    (@legentlemanfr)


    Hi Greg,

    I am developing a website with 2 languages thank to WPML plugin and I have a problem in the use of [adverts_list] shortcode with “redirect_to” option.
    Here is the configuration :
    Page A (french)
    [adverts_list “redirect_to”=French_Results_Page” show_results=”0″]

    Page B (english)
    [adverts_list “redirect_to”=English_Results_Page” show_results=”0″]

    The problem is that Page B is redirected towards French_Result_Page with a list of ads in the french version.

    Note that without redirection, the shortcode returns correctly the list of ads in the good version.

    Any idea ?

    BR.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    please note that your redirect_to has quote characters in incorrect places it should be

    
    [adverts_list redirect_to="English_Results_Page" show_results="0″]
    

    also i assume that in place of English_Results_Page you are entering either actual ID of a page you want to redirect to or an absolute URL of a page (starting with http:// or https://) you would like to redirect users to?

    If this will not help it would be best if you could paste here a link to a page where you are having this problem.

    Hello Greg,

    Sorry, wrong copy/paste for the quote characters. My shortcodes are well formatted.
    Here are the two links:
    <b>French page :</b>
    https://legentlemanfrancais.fr/vintage/
    with shortcode [adverts_list redirect_to=”https://legentlemanfrancais.fr/annonces/&#8221; show_results=”0″ show_pagination=”0″ switch_views=”0″]

    <b>English version of the same page (synchronized with WPML) :</b>
    https://legentlemanfrancais.fr/vintage-en/?lang=en
    with shortcode [adverts_list redirect_to=”https://legentlemanfrancais.fr/adverts/?lang=en&#8221; show_results=”0″ show_pagination=”0″ switch_views=”0″]

    In the english page, the action field in the search <form> reflects well the redirect_to parameter of the shortcode.
    By examining, it seems that https://legentlemanfrancais.fr/adverts/?query=XXX page is loaded. As the language argument ?lang=en is missing in the URL, a 301 HTTP redirect error is generated.

    Thanks again for your support.

    Antoine

    Plugin Author Greg Winiarski

    (@gwin)

    Hi, note that this has more to do with how the HTML forms are being sent rather than with WPAdverts or WPML.

    The search form is being sent using GET method, on submit your form inputs are being appended to the query string, and the GET params you have in ‘action’ attribute are removed, so in your case to get the desired result in your form you would need to have a hidden input with lang param

    
    <input type="hidden" name="lang" value="en" />
    

    or the redirect URL should have the lang attribute in the URL like this, for example, https://legentlemanfrancais.fr/en/adverts/ although i am not sure if it is possible to setup WPML like that.

    Hello,

    I’ve just add a condition on ICL_LANGUAGE_CODE and your new input in /templates/list.php and it works perfectly.

    Thanks Greg.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Redirection of Adverst_list is not correct’ is closed to new replies.