Sitecore ECM: Subscription module - sitecore

I need to insert a Subscription form into a CMS Web page.
I though to re-use the default source code already developed and coming with the ECM package after the installation.
In the Layout/EmailCampaign folder there is an user control: Subscription Form.ascx
In the OnInit method, they are calling another method to retrieve some parameters.
Parameters like Require Authentication, Show List, Target Audience List.
Is there somebody who knows where do I have to define those parameters ? They are all the time empty or null.
Thank you,

Hmm or maybe it's done on the Target Audience you associate to the control. You may be able to add the required parameters when added the control to a layout/sub-layout or when adding through presentation settings.

I believe these are configured when you add the control as a component. You can change the settings when you edit the related item for the component when added to the page.

The parameters you mention, usually comes from the data-template:
/sitecore/templates/Email Campaign/Subscription Sublayout Parameters
And you set them where you assign Layout Details to the presentation item:
This applies to my Sitecore 6.5 installation, in the administration content editor:
Choose your item, click Presentation, in the Layout section, choose Details, choose Edit, choose the tab Controls, locate the sublayout that represents your subscribtion form and choose Edit.
In the following popup you will be able to set the values of the parameters that you mention.
If you don't see the three parameters Target audience list, Require authentication and Show list here, you might have forgotten to assign the datatemplate :
/sitecore/templates/Email Campaign/Subscription Sublayout Parameters
...to your parameter template on your Sublayout item.
I suspect the last section to be your real problem, due to the fact that you get null values

Related

Sitecore Personalization - Change Sublayout parameters based on visitor profile

Is there any way to set different parameters for a sublayout based on visitor profile. When I goto presentation details and click personalize I can only set different datasource or rendering for different conditions.
Very short story is; you can't. While you might be able to via the Rules Engine as Vincent suggests; a more common solution is to not have a component rely too much on component parameters.
Try looking into moving your parameter into the datasource template for the item itself. That way, whatever it is you need to control when personalising, becomes something you define on the content item itself. Semantically also more correct - parameters should not really be used for anything that would change in personalisation scenarios.
You can create rules under /sitecore/system/Marketing Center/Personalization/Rules. To understand rules this could be a start point http://sdn.sitecore.net/reference/sitecore%206/rules%20engine%20cookbook.aspx
The diea, is that you create different rules, which will execute some actions when a set of conditions are satisfied.
Then, in the presentation detail of your control, you can chose which rules to apply.
In order to view the personalization section in the presentation details you need to go to:
Sitecore => Control Panel => preferences => Change your application options => View tab => Third section "Control properties" and check the "Show the personalization section.

Sitecore Conditional Showing of Fields

So I am rather new to sitecore, and it's a topic that wasn't covered during my training. My questions is just to help point me to the correct term, or documentation on a method to do the following.
I have a definition item, with a ton of field groups, what I want to do is something like:
if Value of Field X is "yes" then collapse/hide Field X or Field Group X.
Does that make sense? Is it a validation rule? or some other kind of rules, is it a workflow I need to attach? Do you place it on just the field I want to hide, or the field that triggers the action?
I appreciate any guidance.
There is nothing out-of-the-box in Sitecore to achieve what you want but there is no reason you cannot create a composite custom field type to do this. The following articles will help you achieve this:
Creating a custom Sitecore Field
Getting to Know Sitecore: Custom Fields, Part 1
Create a new control, inheriting either from Droplist (if the comparison of the value is to be text based) or Droplink (for comparison of ID). You could add a parameter in the Source field of the control to specify what the values that trigger the hide should be.
The underlying control in the Content Editor is just a standard HTML select element. Add onchange events to the control and add your Javascript handler to hide the other controls. Since I could not find a way of adding additional custom css classes to the Sitecore controls, it would be best/easiest to hide all other controls in the same collapsible group after you control. This would mean you would need to group your controls better (or logically at least).
The Javascript will be something like this (the Content Editor uses the Prototype JS framework):
if ($(this).getValue() == 'no') {
// find the parent container of this control and then hide all the next siblings in the same group
$(this).up('.scEditorFieldMarker').nextSiblings('.scEditorFieldMarker').invoke('hide');
}
You can test this by running the above in the console, change out the keyword this with the id of your field, e.g. $('FIELD2292054').
What I am not sure about is how to trigger the hide on initial load, i.e. when someone returns to an existing item, it may be possible by adding to one of the pipelines, but would be better using a JS solution if possible. I'll have a think about this and get a proper code sample up over the next few days.
EDIT: You can add an event handler to sc:contenteditorupdated to handle the content editor being rel-oaded.
document.observe("sc:contenteditorupdated", myFunction);
I wrote up a blog post and put the code on GitHub if you are interested.
Not sure if you have come across Andy Uzick's this blog post.
He wisely talks about hiding fields in the Content Editor and has also created a Sitecore Module called Hide Field Template Extension which is hosted on the Sitecore Marketplace with the full source code to extend.
After reading through and trying the extension, I do feel that it will not completely resolve your issue (how you have described it in the question).
But it will give you:
A mid-term solution to hide a few unnecessary field that some content editors would not like to view.
Fields that are only required by administrators for admin purpose - to de-clutter these fields could be hidden.
Just one thing to bear in mind that it mentions in the requirements Sitecore 6.5 & 6.6. I have not tested it in Sitecore 7. If you are using Sitecore 7, which I think you are, one could modify the source code and make it work for Sitecore 7.
Have a look and share your findings.
Happy Sitecoring!

How do you do preloading of components

I would like to know how do you do pre-loading of components in sitecore 7.1?
What I tried so far:
Create a standard value for the page.
Then modify the presentation details of the standard value.
Then add components that I want preloaded in the page.
Then create a Branch for the page.
Use the Branch to create the page.
This works fine except when I add new components in the page's standard value, all existing page is affected with my changes.
What I need to know - is there away that the old page is not affected by my changes in the standard value?
Is there a way only the new page that I create is affected when I modify the pre-loading of components in my page?
Your input is appreciated.
There are few things one should consider:
If there current Sitecore installation is upgraded from 6.4 or prior version to your current version; the item's layout deltas might be an issue. You will have to check the raw values of the Layout details field and figure it out.
Any changes made on the Layout Details on Standard Values do get cascaded down to the items created from that specific Template.
If you don't want these changes to get inherited try multiple inheritance. And change the template of those items created.
Lastly, if the above doesn't work, try creating a new template with the changes you want and change the Template of those items created.
Hope the above helps. Share any further questions you might have or even if the above haven't answered your questions.
Happy Sitecoring!
The main purpose of __Standard Values is automatic update of existing items.
In this case, you should not configure the item's layout in the __Standard Values.
You need to use Branch and configure layout in the Page item instead of __Standard Values.

Sitecore personalisation - DropLink

Not fully used personalisaiton yet, so have what I hope is an easy question.
My page is setup where users can use a droplink to pick content for 3 "slots" on the homepage, from a "bucket" of available content items that can appear.
I want to use a "rule" to show different items in each slot, depending on if the rule is met or not, but I can't seem to work out where I set this.
Right now, my page editor view is broken (currently have an open ticket with Sitecore for work out why this is), so I am hoping this can be done from the content editor.
I have already ticked the "Show the Personalization Section" under Application Options.
This sounds like a conditional rendering rule that you're wanting to create. If that is the case, unless you want to apply the rule to ALL renderings (which I wouldn't recommend), you would create the rule under
System -> Marketing Center -> Personalization -> Rules. Here you can set up a conditional rendering rule that will check conditions and then do something. Since this is going to apply to presentation, the actions are limited. Mostly to presentation.
Now to apply that, you go to the layout details on the item or the standard values for the item template. When you click on the rendering (like you would to set a data source), it brings you to the edit screen and you should be able to scroll down to the Personalization section. If your rule is not in the list, then it's most likely in the wrong place. Anyway, if it's there, you simply put a check next to that box and it will now apply that rule when figuring out the layout details when the item is rendered.

Selecting a datasource item for preset components

Before digging into my explanation i will summarize my question:
How do I provide the user (editor) with a user-friendly possibility to select a datasource item for sublayouts that are preset on the standard values?
My situation is as follows:
I have a page template, with pre-defined layout on the standard values.
Let's say the layout consists of:
one placeholder "wrapper"
one sublayout "content"
This sublayout is pre-defined on my page template, but can also be placed in the placeholder using the Page Editor.
It needs to have a datasource item that defines a Title and Body value.
Now, if a user adds this sublayout to the placeholder using the Page Editor, he will get a nice interface to select or create the datasource item (see screenshot).
However, if the sublayout was pre-defined on the standard values, it will be added without datasource (I can't pre-set the data source in the standard values because it's still unknown by then).
At that point there seems to be no way to get to that nice interface for selecting or creating a datasource item.
Ideally I want to be able to add a field to my template that can hold a datasource item which the user can select/create using the nice interface. I looked at the datasource field type, which could be an alternative, but it's still not exactly what I want.
Bare in mind that the content sublayout is just an example.
I understand that in that specific case I could solve it by always adding a title/body field to the template which hold the values if there is no datasource, but for my real world problem that won't suffice.
I don't have a whole lot of experience with the Page Editor (with the new way of working with it) so I would like to get some advice on this subject.
According to what you said here:
Ideally I want to be able to add a field to my template that can hold a datasource item which the user can select/create using the nice interface. I looked at the datasource field type, which could be an alternative, but it's still not exactly what I want.
It seems you want an intuitive data source selector interface in the CMS shell similar to the Page Editor-based UI.
Quick answer: Simply put, there's nothing that does this for you in Sitecore.
Longer answer: There are still some options for you, e.g.
Define a global "dummy" data source and set that to be the data source set in in Presentation > Layout Details of the template's standard values. So every time you create a new page, it will always point to that dummy value to show something.
From here you can do a few things:
If the user must use the shell UI and not Page Editor, they can simply create another data source item for the specific page and update that page to point to it using the existing native interface in Layout Details.
Another option is to write an event handler, say for item:created or similar that when you create an item, auto-create a corresponding data source item for this specific page (whether this auto-created item be a sub-items or global item...) then programmatically set this to be the data source. A similar concept is shown in this video by Nick Wesselman: http://www.techphoria414.com/Blog/2012/May/Sitecore_Page_Editor_Unleashed