How to Override BannerHitsLeft & BannerClicksLeft on Receiving Staging Server?

kentico guy asked on September 2, 2020 19:55

Kentico 12 Portal Engine 12.0.15

I had previously posted about BannerHitsLeft and BannerClicksLeft resetting to 0 when they get staged using the staging module. People said it might have been a development fail or other stuff. It turns out from Kentico official support email that this is actually the way Kentico was designed. I'm not sure exactly why; that seems like a huge disconnect in functionality. Why would we want values to reset when the object gets staged?

Anywhoo, my business is not happy about it. So I'm wondering, what's the recommended way to override this functionality? I'm not really looking for code snips (unless you have some handy or if you can give tiny EventArg extensions etc).. I'm just looking for a super high level overview on how you recommend this to be done. If you do give me a decent snip then I'll try to post my finished code after I do the override, so others will have it in the future. If I have to build it from complete scratch, then I probably won't do that.

I'm not really expecting anyone to do my work; I am curious from a general perspective how you would advise this to be done? I'm thinking that I'd listen for the staging server EventArgs then check one of those args to see if it's a banner object and then reroute the object to a custom extended staging server which will set those values back to what the EventArgs object originally received?

Thoughts?

Recent Answers


Mika Hawkins answered on September 3, 2020 07:23

HI, I have been having the same issue for a long time now, Unfortunately I am not able to find a solution to this. Hope to find a solution soon....

Regards, Mika Hawkins

1 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 3, 2020 09:23

Hi, I will just explain why is this by design. The source instance in this case is considered as testing or just editing instance where the content is managed by the editors and it is not accessed by the real visitors of the web site. The visitors are usually accessing the target instance, which is the live site. And in majority of cases you do not want to overwrite e.g. some testing banner hits from the source instance to the live site.

Anyway, could you please describe your use case and environment setup and why you want to stage these data? Maybe it is a valid use case scenario and we consider it as a feature improvement into the future.

0 votesVote for this answer Mark as a Correct answer

kentico guy answered on September 3, 2020 22:54

Well, my use case is that the business doesn't want to set that value more than once. The entire app is designed to stage the exact object and all properties into next environment. I don't see why all the sudden we'd want property values on a particular object to reset when we stage the object.

I actually don't use Kentico very much for the end user. I am usually doing development work on items for my business. However, I do stage objects all the time and I don't ever want their property values to reset when I stage the object. I can't think of a single case where I'd want to set an int value after I stage it; that would just take more of my precious time, as I'd have to login to another server, click stuff, then set the value again through the frontend. I'd advise you to add this as an option if you want people to keep using your software; as a professional developer myself, I can tell you this wouldn't be difficult to do (if I had your source code), and would keep your customers happy.

Thank you,

-KG

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 4, 2020 06:33

Thanks. I have provided the feedback to our product management. Right now, "BannerHitsLeft", "BannerClicksLeft" are excluded explicitly within the TypeInfo definition. It would require some manual setup/customization for at least these two fields whenever the object is staged from source to target instances. So, this means e.g. in the application start event remove those two columns from the SyncronizationSettings.ExcludedStagingColumns property of the Banner’s TypeInfo. This should cover your needs.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.