This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: WPML translation and search #8853
    frankdmfrankdm
    Participant

    This seem to work perfectly! Should anything “break” for some reason I will let you know but looks good.

    Thanks!

    in reply to: WPML translation and search #8851
    frankdmfrankdm
    Participant

    You cannot access this content.

    in reply to: WPML translation and search #8848
    frankdmfrankdm
    Participant

    Hey,

    This code does not crash the page no more, however, now the search is never ending. I mean, it keeps “searching”, the “load icon” keeps spinning and never shows any results. So in essence it “hangs” on something.

    Do you want access to my site so you can see the problem first hand? That might e easier to troubleshoot.

    in reply to: WPML translation and search #8845
    frankdmfrankdm
    Participant

    Hey, this code totally crashes my site with the following error:
    Parse error: syntax error, unexpected ‘$lang_arg’ (T_VARIABLE) in /home/mysite/public_html/wp-content/themes/StyleShop/functions.php on line 960

    Had to go into the ftp to change the functions.php back to the original to get it back. It might work based on what I see but somewhere there is a parsing error.

    This is the difference to the add to cart url:

    The default language uses this:
    http://mysite.com/?page_id=6800&add-to-cart=4289

    The translated language uses this:
    http://mysite.com/?page_id=6800&lang=nl&add-to-cart=4289

    So if the search would use that translated style add to cart url when on the default language it would work (I only got two languages)

    I mean, pressing other “add to cart” buttons on the translated pages work fine, it redirects to the localized version of the cart page. However I think the code in functions.php as it is does not get automatically adjusted. So again, I think your code has potential, maybe it has a small error somewhere that crashes it at the moment. But the idea of checking what language we are in and then changing the url should work fine… all that needs to happen is for it to add the “&lang=nl” part to the url when we are on the translated pages and not add it on the site default language.

    in reply to: WPML translation and search #8832
    frankdmfrankdm
    Participant

    Disabling WPML compatibilty makes the search on the localized version work (sounds like it works backwards but it works)…

    HOWEVER, when clicking a search result on the localized version it adds a product to the cart in the site default language.. (in essence the language switches to default when clicking) so I guess there will have to be some sort of “condition” that it checks what the current language is and uses that “add to cart” string instead of the default one ? Currently when a search result is clicked, this is what happens:

    add_filter( ‘asp_results’, ‘asp_links_to_addtocart’, 1, 1 );

    function asp_links_to_addtocart( $results ) {
    foreach ($results as $k=>$r) {
    // Modify the URL
    $results[$k]->link = “/?add-to-cart=”.$r->id.”&quantity=1″;
    }
    return $results;
    }

    As this code happens on the result click both in the default language as any translated pages it turns the site back to the default language when you click a result….

    In there it will need some form of detection and alteration of the “add to cart” url based on the current localization? That is how I see this..

    • This reply was modified 10 years ago by frankdmfrankdm.
    in reply to: Search Statistics #8778
    frankdmfrankdm
    Participant

    You cannot access this content.

    in reply to: Search result link change #8478
    frankdmfrankdm
    Participant

    Thanks worked perfectly!

    in reply to: Search result link change #8474
    frankdmfrankdm
    Participant

    You cannot access this content.

Viewing 8 posts - 1 through 8 (of 8 total)