Skip Navigation

[Résolu] Customization with wp types beta plugin Relationship feature

This support ticket is created Il y a 6 années et 8 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Marqué : 

Ce sujet contient 4 réponses, a 2 voix.

Dernière mise à jour par vimalS Il y a 6 années et 8 mois.

Assisté par: Minesh.

Auteur
Publications
#627933

Hi Team,

I have two post types.
1) Courses
2) Lessons
Relationship between above two post types is many to many.

For Example,
"Course 1" is having 5 lessons "lesson 1","lesson 2","lesson 3","lesson 4","lesson 5"
On edit page of any "Course 1" I am displaying "lesson 1","lesson 2","lesson 3","lesson 4","lesson 5" using ui sortable.

To fetch lessons for course I am using table "wp_toolset_associations" which is created by wp types beta plugin, now I would like to set order for lessons using ui sortable and in fornt end when I display "Course 1", lessons should be display in the order which I have set using ui sortable in admin panel.

Note : To display courses and its lessons I have created view and I have added filter for post relationship and I am passing ID of course to get its related lessons.

To achive above goal, If I add an extra field in "wp_toolset_associations" table.. Will it be removed when I update plugin?
Is this proper way? If not, Can you suggest any other way?

Thanks!!

#628171

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - we DO NOT recommend to modify anything within the core database tables as it may cause issue sooner or later this would results in pure customization and eventually that is not supported as it's beyond the scope of our support policy.

When you create M2M post relationship - it will allow you to create fields for intermediary post type we are still Beta version and lot of work is in progress. I will be in touch with Devs and check with them if its possible to order by intermediary post type fields.

To achive above goal, If I add an extra field in "wp_toolset_associations" table.. Will it be removed when I update plugin?
==> The field will be available but this is not the recommended way.

#628176

Hi Minesh,

Somehow I managed with existing "wp_toolset_associations" table for ordering stuff.
But now I am facing problem to display it in order using view.
I want to do order by "wp_toolset_associations" primary key "id" and for that I did something like this

add_filter( 'wpv_view_settings', 'prefix_modify_filter_offset_view', 5, 2 ); // use a low priority number of 5, so this runs early
function prefix_modify_filter_offset_view( $view_settings, $view_id ) {
    if ( $view_id == 145 ) { // if displaying a View with ID equal to 374
       // echo "<pre>";
       // print_r($view_settings);
       // exit;
       $view_settings['orderby_as'] = 'id';
       //$view_settings['order'] = '';
      // echo "<pre>";
      // print_r($view_settings);     exit;
    }
    
    //exit;
    return $view_settings;
}

But, it doesn't seems to be working with view.

#628177

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

This is pure custom programming which is beyond the scope of our support policy. If you need custom programming for you project, please feel free to contact our certified partners:
=> https://toolset.com/contractors/

#628180

Ok