Search code examples
intershop

How to get current channel domain in pipeline based on the current application


In pipeline, I need to get channel domain to which current application is assigned.

I get current ApplicationBO instance but I haven't been able to get channel domain from it (I tried inspecting it in debugger, but I can only get domain for the application but not for the channel).

This is how currently applications and channels are assigned:

Company organization:

  • Channel 1
    • App 1 <--- Get Channel1 if in this app
  • Channel 2
    • App 2 <--- Get Channel2 if in this app

Both applications share the common cartridge which contains pipeline in which I need to get current channel


Solution

  • There are two options:

    1. Call pipeline DetermineRepositories-Channel which returns you a Repository object (that is the Channel). On the Repository use object path Repository:RepositoryDomain to get the Domain. I'm not sure how big the performance implication is though..
    2. Use object path ApplicationBO:Extension("PersistentObjectBOExtension"):PersistentObject:Domain to get the owning domain of the application itself. That will always be the channel(Domain). Because that's where storefront applications are born.

    In case you need to convert the Domain object to a Repository object you can use pipelet GetRepositoryByRepositoryDomain.