WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Widgets
[resolved] Submenus for multilingual categories (WPML/DynamicWidgets) (26 posts)

  1. pb_advancis
    Member
    Posted 1 year ago #

    Hi there,

    i am using dynamic widgets to show submenus in each of my categories. The support for WPML works as it should ... nearly. I seem to have the same problem as here (http://wordpress.org/support/topic/plugin-dynamic-widgets-dynamic-widgets-wpml-submenus-on-sidebars?replies=11) but i cant find a way to solve it.

    Category-A contains the posts a1, a2, a3 and so on. So when i now say submenu-A should be shown only at the category-A-page an its children, it works fine in the main language. It also works for the children in other languages, but not for the category page itself.

    According to the former thread there seems to be a problem with the connection between the multilingual categories. I translated them and they are perfectly connected (language switcher/auto menus/etc.). The only clue i have is, that the posts each have the exact same slug, but categories can´t so they get additions like "-nl" for dutch or "-fr" for french.

    Any ideas how i could fix this. Here´s the site i´m currently working on
    http://advancis.net/web

    Thanks in advance :-)

    http://wordpress.org/extend/plugins/dynamic-widgets/

  2. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    The only thing I can tell you is that when it's connected to eachother it should work. DW is not looking at the slug. Only looking at IDs.

    When DW detects another then the default language, it looks up the connected ID so it can apply the rules for it.

  3. pb_advancis
    Member
    Posted 1 year ago #

    Hi there,

    we finally managed to find help via the WPML support. Unfortunately we could find the problem but not solve it. It seems the problem refers to a part of your plugin. Could you please check this? Here´s what they told us:

    I wanted to update you on what I have found while torubleshooting the issue.

    In the dynamic-widgets/dynwid_worker.php the plugin author is running a check (line 663 – case 'category')

    1
    if ( in_array($id, $act_cat) ) {

    I believe the problem is there.

    The array returns the following IDs: 3, 5, 9, 6, 7, 8, 4

    The category ID for this page:http://advancis.net/web/de/category/produkte/ is 37 and as you can see the php conditional fails to return true. 37 is not found in the array.

    This is something the plugin author needs to correct.

    I will inform our "Themes & Plugins Compatibility" team about it so they can contact the plugin author. If you like it may not be a bad idea to open a support ticket in his forum referencing this forum thread.

    And here´s the link to the other support thread:

    http://wpml.org/forums/topic/submenus-for-multilingual-categories-wpmldynamicwidgets/page/3/

    Thanks so far :-)

  4. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Is 37 the ID of the category in the default language? If so, then this category should be in the list of categories in DW admin and seems not to be ticked. When 37 is not the category of the default language. Which ID of the default language is connected to it?

  5. pb_advancis
    Member
    Posted 1 year ago #

    Hi,

    the IDs of our category are as following:

    English (default):

    3/News
    5/Products
    9/Solutions
    6/References
    7/Ressources
    8/Service
    4/Partners

    German:

    35/News
    37/Products
    41/Solutions
    96/References
    39/Ressources
    40/Service
    97/Partners

  6. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    I assume ID 37 should be connected to ID 5 then. Because DW does return 5, it probably can't find the language you're in and then returns the default back. The current language for WPML is detected using the WPML API function wpml_get_current_language()

  7. sarah.n
    Member
    Posted 1 year ago #

    Qurl,

    This is Sarah from WPML. I am the one assisting Paul in his thread over at our forum. He asked me to leave a comment here so I hope this is OK.

    As Paul wrote earlier, the two categories in question
    5/Products (en) - 37/Produkte (de) are connected to each other.
    The default category 5/Products (en) is checked in the DW admin settings.

    As far as I can see DW does indeed detect the correct language on the page in question.

    Adding:
    echo "curlang: <pre>"; print_r($curlang); echo "</pre>";

    below:

    // WPML Plugin support
    	include_once(DW_MODULES . 'wpml_module.php');
    	if ( DW_WPML::detect(FALSE) ) {
    		$curlang = DW_WPML::detectLanguage();
    	}

    Returns correctly "de".

    To exclude the possibility of a user error or misconfiguration may I ask whether the user needs to configure the plugin in a certain way when WPML is active? I could not find any information in the plugin's settings screen on this but I wanted to ask just in case I am missing the obvious here.

  8. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Hello Sarah, sure no problem!

    I'm wondering what DW_WPML::getID() returns. It should return 5 there when 37 is connected to 5.

  9. sarah.n
    Member
    Posted 1 year ago #

    Qurl,

    Thank you for getting back to me.

    DW_WPML::getID() returns 37.

    I followed the code logic in DW and I feel the problem is (line 642 - dynamic-widgets/dynwid_worker.php)

    $id = get_query_var('cat');

    If I'm not mistaken this will return the term_id however what WPML saves in icl_translations is the term_taxonomy_id not the term_id

    This is causes the function getID() in wpml_module.php to pass the wrong data to wpml_get_content_translation()which returns the wrong trid which in turn causes the function getID() return the wrong result - did I manage to confuse you yet, he, he?

    I can send you some screenshots that illustrate the above if you like (need an email address for this)

  10. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, that explains something. I guess WPML must have had good reasons to use the term_taxonomy_id instead of the term_id. Funny the problem never occured during testing or before with other WPML users.

    This means this is an incompatibility between WPML and DW. I have to look into this to see if I'm able to come up with a solution for that.

  11. sarah.n
    Member
    Posted 1 year ago #

    Thank you! Let me know if I can be of any help.

    Also, when you resolve this I would encourage you to get the "Multilingual Ready" certification and get listed here: http://wpml.org/documentation/plugins-compatibility/

  12. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Hello Paul and Sarah,

    I think I've found a solution for this matter by converting the term_id to the term_taxonomy_id and back in the getID() method. It's a bit hard to test myself as all my term_id and term_taxonomy_id pairs are exactly the same in my test environment. Are you interested in testing it out? I haven't committed the change to SVN. So, please send me an email on info at qurl dot nl or via my contact form and I will send back a modified ./mods/wpml_module.php

  13. sarah.n
    Member
    Posted 1 year ago #

    Qurl,

    Did Paul contact you already for this? If not I will because I am interested to test you fix.

  14. sarah.n
    Member
    Posted 1 year ago #

    Thank you Jacco. I received your email. As far as I can tell the fix works. I asked Paul to check his site as well and confirm that it works for him.

    I hope he will leave a reply here saying as much soon.

    Thank you again for your support and cooperation. It's been a real pleasure!

    Like I mentioned in another comment, I would definitely encourage you to get the "Multilingual Ready" certification for DW and get it listed here: http://wpml.org/documentation/plugins-compatibility/

  15. pb_advancis
    Member
    Posted 1 year ago #

    At first sight it seems to finally be fixed. At second i unfortunately found some new issues regarding

    a) nearly completely missing menus in the usual widget interface inside wordpress
    b) the menus on the category pages now work and are connected as the should, but the pages inside the categories no longer contain the menus they had before

    i´m not at the office today so this is only my first impression. I would do a more detailed check tomorrow morning (german time - from now on about 22 hours). I suggest the fix is causing, so i hope it can be handled easily. Thanks so far.

    Paul

  16. sarah.n
    Member
    Posted 1 year ago #


  17. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Hmm... I find it a bit hard to believe complete menus disapear caused by DW as DW is not touching menus. Unless those menus are located within widgets of course.

    Let's assume it's indeed casued by the implemented fix. That would suggest we have an inconsistency between the use of the term_id and term_taxonomy_id. The fix only reacts when it comes accross a category. DW can't see if it's a main category or a sub-category.

  18. pb_advancis
    Member
    Posted 1 year ago #

    Indeed, they are located in the widget area. The structure of the site follows this schematic:

    Website
    /HOME
    //Page
    //Page
    //..
    /CATEGORY1
    //Page
    //Page
    //..
    /CATEGORY2
    //Page
    //Page
    //..

    and so on. There are no sub-categories. Every category page contains a custom excerpt and an icon of each page inside it. Further between the header image and the content area i placed a widget area to display submenus.

    So each category page AND each page inside the category displays this submenu. Before the fix this worked only in the main language, but in others the submenus were missing on the category pages. The submenus on all other pages worked fine. Now it´s the other way arround.

  19. pb_advancis
    Member
    Posted 1 year ago #

    For a better understanding you might want to take a look at the website: http://advancis.net/web/

  20. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Ah ok, so the fix should only react when IN a category AND NOT IN default language.

  21. pb_advancis
    Member
    Posted 1 year ago #

    Yes, and only on the category page itself, because as i mentioned, everything else worked.

  22. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    I'm withdrawing my comment. The getID() method only responds when not in the default language. But I guess it should actually respond in this case.

  23. pb_advancis
    Member
    Posted 1 year ago #

    Qurl,

    would it be easier, if i gave you access to our WP installation and FTP. If you write me an e-mail i will sent you the details (pb@advancis.de).

  24. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Paul,

    I'm sorry, I've not been able to work on this issue due to traveling. Working on this issue at your end would mean I have to charge you for that. Dynamic Widgets is a free plugin and I provide basic free support for it.

    What I'm planning to do is send you a modified version again which will respond to the category page no matter what. I'm not sure that will solve the problem, but might bring us closer to the solution.

  25. pb_advancis
    Member
    Posted 1 year ago #

    Hi Jacco,

    i just replaced the file you´ve sent to me, but it seems that there is no difference. Basically we could imagine to pay for extended support. If you sent me an offer via e-mail, i would try to get permission for it.

    If you find a shorter solution, that would be excellent. But we are at a point, where finding another solution is no option for us, so we need to fix this as it is.

  26. Qurl
    Member
    Plugin Author

    Posted 1 year ago #

    Hello Paul,

    My apologies for the late reply. I'm back home now.

    I hoped my previous try would solve something or bring us closer to a solution. I'm going to send you some details via email.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic