Skip Navigation

[Resolved] Product relationship

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 5 replies, has 2 voices.

Last updated by yairF 1 year ago.

Assisted by: Waqar.

Author
Posts
#2554349

Hi
We have a dedicated search utility on our site, which based on product--model--brand relationship.
I have created new fields called brand-mini and model-mini, plus new product relationships.
I would like to create a new search utility ("View") which copies the same mode of operation as the original one, just use the newly created relationship.
How can this be done ?
Thanks,

#2554841

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

Each view's search only supports having a single relationship's search/query filter. So, if your existing view is already using one relationship's search field, it won't be possible to include another relationship's search field, in it.

To search by different relationships or related posts, you'll need to create separate views, for each of them.

I hope this helps and please let me know if you have any follow-up questions.

regards,
Waqar

#2554925

Hi
Yes, I would need help with the code for the new view.
Thanks, Yair

#2554959

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Yair,

I'm afraid, I couldn't understand exactly which code are you referring to.

Can you please share the temporary admin login details of the website, along with the detailed requirements? I'll be in a better position to suggest the next steps, accordingly.

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2555619

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing these details.

In the view 'View' (ID: 3405), here is the code that was being used for the 'Search and Pagination' section:


[wpv-filter-start hide="false"]
[wpv-filter-controls]
[wpv-control-post-relationship ancestors="brand1@brand-model.parent>model1@product-model.child" url_param="wpv-relationship-filter"]
<div class="row">
	<div class="form-group col-6">
	<label for="wpv-relationship-filter-brand1">[wpml-string context="wpv-views"]Brands[/wpml-string]</label>
		[wpv-control-post-ancestor type="select" default_label="Please select" ancestor_type="brand1@brand-model.parent"]
	</div>
  	<div class="form-group col-6">
	<label for="wpv-relationship-filter">[wpml-string context="wpv-views"]Models[/wpml-string]</label>
		[wpv-control-post-ancestor type="select" default_label="Please select" ancestor_type="model1@product-model.child"]
	</div>
</div>
[/wpv-control-post-relationship]
[wpv-filter-spinner spinner="<em><u>hidden link</u></em>"][/wpv-filter-spinner][/wpv-filter-controls]
[wpv-filter-end]

But, since the newer view 'Mini-Lookup' (ID: 38655), needed a relationship filter for different relationships, I've updated the code for its 'Search and Pagination' section, as follows:


[wpv-filter-start hide="false"]
[wpv-filter-controls]
[wpv-control-post-relationship ancestors="brand1-mini1@brand-mini-model-mini.parent>model1-mini@product-model-mini.child" url_param="wpv-relationship-filter"]
<div class="row">
	<div class="form-group col-6">
		<label for="wpv-relationship-filter-brand1-mini1">[wpml-string context="wpv-views"]Brands-Mini[/wpml-string]</label>
		[wpv-control-post-ancestor type="select" default_label="Please select" ancestor_type="brand1-mini1@brand-mini-model-mini.parent"]
	</div>
	<div class="form-group col-6">
		<label for="wpv-relationship-filter">[wpml-string context="wpv-views"]Models-Mini[/wpml-string]</label>
		[wpv-control-post-ancestor type="select" default_label="Please select" ancestor_type="model1-mini@product-model-mini.child"]
	</div>
</div>
[/wpv-control-post-relationship]
[wpv-filter-spinner spinner="<em><u>hidden link</u></em>"][/wpv-filter-spinner]
[/wpv-filter-controls]
[wpv-filter-end]

Currently, no posts are added in the 'Brands-Mini' and the 'Models-Mini' post types, so there are no options in the search field dropdown. But, once you add some posts and connect them with each other and with the product post type, the search will work.

Note: I couldn't find any page that was using the view 'Mini-Lookup' (ID: 38655), so I created a page named 'Test page for the Mini-Lookup view', which has this view.

#2555627

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.