Navigation überspringen

[Gelöst] Assign products/posts to other products/posts manually

This support ticket is created vor 5 Jahren, 10 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.

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

Supporter timezone: America/Jamaica (GMT-05:00)

Dieses Thema enthält 8 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Shane vor 5 Jahren, 9 Monaten.

Assistiert von: Shane.

Author
Artikel
#1209611

Hi there,

I'm creating a product catalog.

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.

Is that possible?

#1209685

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hello,

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.

Thanks,
Shane

#1210074

OK, thanks.

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...

Regards
Björn

#1210205

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Screenshot 2019-03-05 at 1.53.09 PM.png

Hi Bjorn,

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.

Please let me know if this helps.

Thanks,
Shane

#1211096

Thanks for your assistance.

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.

#1211500

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Bjorn,

Would you mind allowing me to have admin access to the site as well as a link to product where you are doing the tests?

The private fields have been enabled for your next response.

Thanks,
Shane

#1211996

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Bjorn,

I had to make some changes to the custom field so that you can use only 1 view instead of having to create a different view for each.

Now I used the checkboxes group and gave it multiple options and just changed the filters to match this new group.

If you look at product A here
versteckter Link

You will see it displaying product 1 as the recommended one.

Please let me know if this helps.
Thanks
Shane

#1212290

Hi there,

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.

What would be your approch?

Regards
Björn

#1212638

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Bjorn,

Thank you for the further explanation.

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.

Thanks,
Shane