Get all campains for an article

Hi,

I’m trying to get all campaigns available for an article, and the most fitting method “GetAllForArticle” is obsolete. Is there any good way to do this?

(I don’t care about the conditions of the campaign, I just want to find all campaigns that is connected to an article in any way, either through an assortment, product list, category or the specific article)

Litium version: 7.6.2

Unfortunately, there’s no built-in way to do this. You could create your own memory cache and listen for the related events to update the data in it.

Another approach could be the one discussed in this thread where you’re retrieving the campaigns that are currently active. Sort of starting in the other end of your question. Get all the campaigns that a user have "unlocked"

Keep performance in mind if these are frequent calls.

Okay, thanks.

I found that thread and got an idea from it earlier, which I got working.
Is the “Campaigns” collection cached in anyway, in ModuleECommerce?

Yes, campaigns are cached to disk.