wrav / related

A simple plugin that adds a widget within the Craft CP page sidebar, allowing you to quickly and easily access related entries.
MIT License
5 stars 4 forks source link

Any plans to make this work with Craft Commerce / Products ? #12

Closed terryupton closed 1 year ago

terryupton commented 3 years ago

As the title says... :-)

reganlawton commented 3 years ago

Great idea I'll have to look into this when I'm not smashed but the feature shouldn't be that tricky

terryupton commented 2 years ago

Hey Regan. Hope you're good. Any plans to look at this in the near future? 😀

matt-adigital commented 1 year ago

+1

I've had a look in the files as we also need this functionality and it seems easy to add related products to entries / categories / etc. A little more involved to get the modal onto the product page itself. To add to categories I've done the following steps.

Edit the RelatedService.php file to have the following on line 91:

$products = [];
if (class_exists('craft\commerce\elements\Product')) {
    $query = craft\commerce\elements\Product::find();
    $query->relatedTo = $element;
    $query->anyStatus();
    $products = $query->all();
}

Then just add $products into the $elements = array_merge( part of the code.

I hope that helps @terryupton and hopefully this can be included in a future release @reganlawton ? Thanks.

reganlawton commented 1 year ago

When should have been done jsut not closed