[Gelöst] Assign products/posts to other products/posts manually
This support ticket is created vor 5 Jahren, 8 Monaten. 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.
Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.
Some products fit well together with others. These products can't be grouped using taxonomies or hierarchical relationships.
For example: Product A has three recommenations (product B,C, and D), regardless of taxonomy.
So I suppose, you would have to manually assign certain products to another.
Then on the front-end, display a list of these recommended products below the main product.
This list should be editable as View.
Yes this is possible but we would need a way to group the products.
What you can do is to create a Checkbox group custom field for this and then use this to group the products that can be related.
Lets say you have 3 groups, Each product will be assigned to a group, then you can use views to filter for that group based on the page where the view is added.
Please let me know what you think of this then we can talk about how to implement this.
I get the rough idea, but don't know how to apply it in detail...
Especially step 4:
1. Create custom field with checkboxes (i.e. 3 groups) for product single template.
2. Assign each product to one of the groups.
3. Create a view that filters the value that is saved in the database when the product was assigned to a group in step 2.
4. How do I get this view to display with the right product? The template for the product page is the single product template...
How do I get this view to display with the right product? The template for the product page is the single product template
So you can add a view to this template.
Follow these steps:
1. Create a view that will list the products.
2. Scroll to the query filter section and click "Add Filter" then search for the custom field that you've used to group the items.
3. Then you need to set the filter to "Shortcode Parameter" then give the parameter a name, example in my screenshot
4. Next just customize your view loop output on how you want the items to be displayed.
5. Finally insert your view into the product template and then add the parameter to the view. It should look like this [wpv-view name='my-view' my-attribute='[types field='some-field'][/types]']. This way we are passing the value of the current post into the view so that it filters for that same posts with that custom field value.
I setup the configuration like you said, but I'm still not getting the result I need.
I followed you're steps:
1. Create a view that will list the products.
2. Add filter with custom field
3. Set shortcode parameter/attribut
4. Customize view loop output
5. Insert snippet [wpv-view name='my-view' my-attribute='[types field='some-field'][/types]'] with changes according to my setup.
The result is that all products are grouped, no matter whether the checkbox is ticked or not. So just by adding the check bocks in the custom field configuration, all products show up through the [wpv-view] snippet.
I need to be able to select whether a product belongs to that group or not.
And the products that are selected should be displayed with the fitting product, not the other way around.
Here's an example to show what I mean:
There are 12 products, that are grouped by taxonomies into 4 groups:
- A, B, C
- D, E, F
- X, Y, Z
- 1, 2, 3
When you're on the single product page for A or B or C, a list of the products X, Y, Z should show below.
When you're on the single product page for D or E or F, a list of the products 1, 2, 3 should show below.
thanks a lot for your assistance.
Unfortunately, as soon as I select another item, they all show up randomly on every product again.
I'll try again to explain what I need and hope you can come up with a solution 🙂
I have about 200 products.
They are grouped in 8 main categories.
The view for a single product works fine. It shows the data from the respective product.
Now, below the product, I want a list that only shows products that fit together with this product. For example:
For each product of category 1, I'd like to display a certain group of products from category 5, but not all of them.
For each product of category 2, I'd like to display a certain group of products from category 6, but not all of them.
For each product of category 3, I'd like to display a certain group of products from category 7, but not all of them.
For each product of category 4, I'd like to display a certain group of products from ategory 8, but not all of them.
My solution would remain the same. Its just that when the products are created you will add a marker for the items that you want to be displayed under this.
So you say you want "For each product of category 1, I'd like to display a certain group of products from category 5, but not all of them."
Now we can do this if we mark a product from Category 1 with a custom field that will tell views to filter for products from Category 5, however the challenge is that view will want to display all the products from cat 5.
Now we need to know what we can use to then subdivide from that category the products we need, for e.g if we have products in category 5 being marked with some additional information that can be related to the viewed products.
Its all about marking the products you want to relate with each other with some custom field that is filterable.