It's my first time implementing Sitecore ECM feature. I've cut up some html templates into layouts and sublayouts, created the datasources I needed, and made a branch template with the $name item set to be of template "AB Testable message".
Following Frank Rooijen's blog post: http://www.newguid.net/sitecore/2013/building-custom-newsletter-templates-for-sitecores-ecm-2-x/ I've set the body field in the $name to go to my message root child, set all the sublayout datasources to the relevant child items of the message root.
Andit all works fine!
What I really want to know is how the sublayout's datasource paths are derived to their new location after being instantiated from the create/insert action from the ECM Speak page.
I've been using reflector to try and get some insight, but I don't think I'm looking in the right places.
The ECM package adds a new config file at /App_Config/Includes/Sitecore.EmailCampaign.config. Within that file you can see some new event handlers are added, most notably:
<event name="item:added">
<handler type="Sitecore.Modules.EmailCampaign.Core.ItemEventHandler, Sitecore.EmailCampaign" method="OnItemAdded" />
</event>
<event name="item:copied">
<handler type="Sitecore.Modules.EmailCampaign.Core.ItemEventHandler, Sitecore.EmailCampaign" method="OnMessageCopied" />
</event>
If you decompile Sitecore.EmailCampaign.dll and look at the corresponding Class and follow through the code you will see call to MessageRelationsCorrector.CorrectItemRelations() which handles all the work to replace the IDs of the DataSources of new created and copied messages.
jammykam is spot on.
The one thing that I'd add though (after banging my head for a while) is that even though the processing first does a check on template descends from AB Testable Message or the other email types, the actual correction of item relations only happens if the email template is exactly one of the built-in templates like AB Testable Message. Don't try and have you own template that derives. Sigh.
Related
I am using Sitecore 7.2 and weblog 2.3.
I have a blog with couple of Entries, the posts show up fine. I am trying to create a Custom Template "CustomEntry" that inherits "Entry"
I followed all the steps from the link https://github.com/WeTeam/WeBlog/wiki/Template-Settings. The Blog is now completely empty. While debugging, it appears that GetBlogEntries() is empty. I believe this is an Index related issue. There are couple of things unclear to me.
When creating a new template for Entry, I understand that I should inherit Entry. I have inherited both Entry and StandardTemplate and sorted the Entry to be above the Standard Template. Is this what I am supposed to do?
In the following code, what should be "", Should it be the Blog template that I am using. in my case CustomEntry? I understand that the value should be the ID for "CustomEntry" Template.
<locations hint="list:AddCrawler">
<master type="Sitecore.Modules.WeBlog.Search.Crawlers.DatabaseCrawler,Sitecore.Modules.WeBlog">
<include hint="list:IncludeTemplate" entryTemplate="$(EntryTemplateID)" commentTemplate="$(CommentTemplateID)">
<myEntry>{D5608C5D-45E4-43FA-B2E4-DCD9DDF3E5A1}</myEntry>
<myComment>{C85123CF-DA89-4C37-ACFA-4F8BA5157AC1}</myComment>
</include>
</master>
<web type="Sitecore.Modules.WeBlog.Search.Crawlers.DatabaseCrawler,Sitecore.Modules.WeBlog">
<include hint="list:IncludeTemplate" entryTemplate="$(EntryTemplateID)" commentTemplate="$(CommentTemplateID)">
<myEntry>{D5608C5D-45E4-43FA-B2E4-DCD9DDF3E5A1}</myEntry>
<myComment>{C85123CF-DA89-4C37-ACFA-4F8BA5157AC1}</myComment>
</include>
</web>
</locations>
Yes, you should create 3 templates each one will inherit from either BlogEntry, BlogCategory or BlogComment:
/sitecore/templates/Modules/WeBlog/BlogEntry /sitecore/templates/Modules/WeBlog/BlogCategory /sitecore/templates/Modules/WeBlog/BlogComment
The settings listed in the snippet are for the search index which you have setup on the master and web indexes.
These settings should be the template IDs of your new templates that inherit from the builtin templates. The names of the tags "myEntry" or "myComment" can be called whatever you like and only the Guid will be read from these tags.
<myEntry>{D5608C5D-45E4-43FA-B2E4-DCD9DDF3E5A1}</myEntry>
<myComment>{C85123CF-DA89-4C37-ACFA-4F8BA5157AC1}</myComment>
I would try rebuilding the search index called weBlog to see if this fixes the issue.
You have to make sure that you have blog entries published that are based on the new templates you have created.
You could use Luke -https://code.google.com/p/luke/ to examine the Sitecore indexes /data/indexes to see if you are getting blog items in your index.
left.phtml the file that displays the left navigation on a magento page is only showing on one list view page and not the others does anyone have a solution to get that file to show in all list views
If you are tasking left.phtml,
Then According magento structure left.phtml are only show for Non-Anchor category in it left side of category.
And layer navigation are only showing for Anchor category.for anchor left.phtml is not showing.
For non-Anchor categories
see catalog.xml code
<catalog_category_default translate="label">
<label>Catalog Category (Non-Anchor)</label>
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
</reference>
Also for
Anchor categories
see at catalog.xml
<catalog_category_layered translate="label">
<label>Catalog Category (Anchor)</label>
<reference name="left">
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
</reference>
Hope ,you will understand.
Check the layout in folder theme/package (it can be in default/default, when your theme is in another folder)
Check if layout is plugged (use in your layout.xml something like <remove name="header">). If header will be removed - you use correct layout
Check the handle and reference name, where you are adding block. For example: you are adding layered navigation block. On one page it placed in handle <catalog_category_layered>, but your page there no this handle. Try to add to <catalog_category_default> or even in <default>.
Open your template and check if the block was added there. Look for
<?php $this->getChildHtml('blockName'); ?>
Try to change your block name (maybe on this page already exist block with the same name)
(this option can be useless for you) Please check the block output in system / configuration / advanced
Maybe there is a conflict between two navigation modules (for example module A and module B). The module A can use it for rewrite. But the module B will use it only for investigation and use on this page it's own calls. In that case the module A will not work (to resolve this issue you need to change rewrite. class A should rewrite class B)
If you are trying to add navigation to CMS page - try to google this topic (how to add navigation to CMS page). There are many examples and I don't want to duplicate them.
I'm working on a multi-language solution in Sitecore and want to use the DisplayName property of an item to represent the URL to allow for language-specific URLs.
I've set the useDisplayName web.config property to true as shown below
<linkManager defaultProvider="sitecore">
<providers>
<clear />
<add name="sitecore"
alwaysIncludeServerUrl="false"
encodeNames="true"
type="Sitecore.Links.LinkProvider, Sitecore.Kernel"
addAspxExtension="false"
shortenUrls="true"
languageEmbedding="asNeeded"
languageLocation="filePath"
useDisplayName="true" />
</providers>
</linkManager>
I've also been playing with the <encodeNameReplacements> section which can replace %20 with a hyphen in the URL to give nice clean URLs - this is done with the following for those who are interested:
<replace mode="on" find=" " replaceWith="-" />
All very good, except that Sitecore breaks if a user enters a hyphen within a DisplayName with the above setting turned on.... If I turn the above setting off, then I have to ensure that users enter nice hyphen separated values for the DisplayName otherwise we start seeing nasty %20s again in the URL...
So, is there a way to validate the DisplayName property to either disallow or allow hyphens being used?
Or, even better, is there a way to hook into whatever code is executed when the encodeNameReplacements thing happens? This would be ideal, as I could allow users to enter whatever they like for DisplayName, then just sanitise this value on the fly.
There is a solution for this, but it will require some coding and it's quite complex.
I have used this kind of solution in many projects before and it's the only way of solving this, that i'm aware of.
You don't want to really replace spaces with hyphens when saving the item, because it's not user friendly.
My solution works at runtime.
First get rid of the <replace> rule you added.
Then create your own LinkProvider (inherit from Sitecore's default provider).
Inside the LinkProvider create a method to "normalize" the item's displayname (e.g. replace spaces for hyphens), let's call this method NormalizeDisplayName(). Make it public and static cause you will need it later.
So now you have managed to let Sitecore replace all spaces with hyphens in links. The rest you can still configure using the default provider options (addAspxExtension="false" useDisplayName="true", etc)
Next up is the ItemResolver: Sitecore's default ItemResolver is not going to recognize the item path anymore so you are going to add your own ItemResolver to fix this.
Create a class that inherits from Sitecore.Pipelines.HttpRequest.HttpRequestProcessor and configure it to be used in the <httpRequestBegin> pipeline after the default ItemResolver.
Now, when the itemresolver is processed you will first split up the requested itempath (let's assume that "/category-name/subitem-name" was requested).
Starting from the siteroot (which can be pulled from Sitecore.Context.Site), loop through all children while normalizing their item names using your NormalizeDisplayName() method you created earlier, until you find one that matches the part of your item path.
So in this case, loop through the children of your Home item until you find one that matches normalized displayname "category-name". Then do the same thing for the children of that item until you find the item with normalized displayname "subitem-name".
This way you can resolve the requested item and it will also work if the original displayname already contained hyphens!
I'm sorry that I can't give you complete code examples as it's quite complex and is not limited to just the above things. You also need to think about redirecting if the URL is not properly formatted and make exceptions for master/core database to prevent Sitecore from breaking.
Hope this helps you!
If you see the source in .net reflector (Sitecore.Shell.Framework.Commands.SetDisplayName) there are no pipelines that runs.
You could make a Saving event, making the display name, as you want replacing hypen with a space
public void OnItemSaving(object sender, EventArgs args)
{
Item item = Event.ExtractParameter(args, 0) as Item;
item.Appearance.DisplayName = item.Appearance.DisplayName.Replace("-", " ");
}
Just a quick example of the event
Noob developing a Magento theme and I can't seem to figure out why Magento is not using the path I specify in the setTemplate action on catalog.xml.
I've got my own theme in /app/design/frontend/default/mycustomtheme and I've been patching files over from the base and making changes.
I've copied over /app/design/frontend/base/default/layout/catalog.xml to my custom theme at /app/design/frontend/default/mycustomtheme/layout/catalog.xml. I've set the template to be a specific phtml file...
<catalog_product_view translate="label">
<label>Catalog Product View (Any)</label>
<!-- Mage_Catalog -->
<reference name="root">
<action method="setTemplate"><template>page/2column.phtml</template></action>
</reference>
Yet it's not working. Can someone spot what the problem might be? I've got all cache disabled and other changes I make I can see immediately, just not this one.
edit: I should note, if I change something else in the catalog_product_view xml node I see those changes are reflected. For instance if I remove <action method="addJs"><script>varien/product.js</script></action> then I see the reference is removed in the rendered html file.
edit2: Adding images to address questions ...
did you setup-up / configured the theme from your store backend?
Yes, and it's actually loading the correct header and footer, and it's properly styled.
Are you sure you have such template under /app/design/frontend/default/mycustomtheme/template/page/ directory?
Yes, I can confirm the file is there
OMG. The (one and only) product I was testing on had a specific layout set under the "Design" section. So I guess that was overriding anything I had set in catalog.xml
I'd like to have the 3 hours of my life back.
What I've Done
Inside SharePoint I created a List based on the Project Tasks template
I deleted most default columns, and added new custom columns
I added data using the new format
Then I did a "Save as template" and chose to save the template with the content
What IS Working
Now, when I use that template to create a new List inside of SharePoint it works perfectly. The custom columns are present, and the data is all pre-filled as expected.
What ISN'T Working
However, when I use the AddList or AddListFromFeature methods made available by SharePoint web services the new list is created, but it is simply based off of the original Project Tasks template with the default columns and no data!
What I've Tried
I tried following the suggestion in the article from Phase 2 to setup a custom template ID, but that only prevented me from using the template at all (was no longer listed when I do a "Create").
I'm still trying to figure out if this article applies - it seems to be a similar issue, but applied to Sites instead of Lists.
I found that another person was having the same problem about a year ago.
System Setup
Working with SharePoint 2007 (I think?), using PHP with NuSOAP to connect. The connection is definitely working as I've added items to lists, created lists, and read data.
Code Samples
Request - against Phase 2 Method template above
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2034="http://tempuri.org"><SOAP-ENV:Body>
<AddListFromFeature xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>2Test Milestone Release</listName>
<description>Testing this out</description>
<featureID>{00BFEA71-513D-4CA0-96C2-6A47775C0119}</featureID>
<templateID>151</templateID>
</AddListFromFeature></SOAP-ENV:Body></SOAP-ENV:Envelope>
Response - fails due to templateID not being recognized
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring><detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Cannot complete this action.
Please try again.</errorstring><errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x81072101</errorcode></detail></soap:Fault></soap:Body></soap:Envelope>
I'm stumped! So if you can help - I'd be a very happy person! Thanks, in advance!
I would chase why you can't create the list via the interface in the first place, these two web service calls don't seem to include the important parameter when creating from custom templates, lets analyse the querystrings:
New Project Tasks (out of the box)
http://site/_layouts/new.aspx?FeatureId={00bfea71-513d-4ca0-96c2-6a47775c0119}&ListTemplate=150
New Project Tasks Custom (saved in the list template gallery)
http://site/_layouts/new.aspx?CustomTemplate=PT6.stp&FeatureId={00bfea71-513d-4ca0-96c2-6a47775c0119}&ListTemplate=150
New Project Tasks Custom (manifest.xml edited to 151)
http://site/_layouts/new.aspx?CustomTemplate=PT6.stp&FeatureId={00bfea71-513d-4ca0-96c2-6a47775c0119}&ListTemplate=151
They all work, so my take here is that the Web Service is a no no for custom templates, or it has some secret magic (common in list definitions) since specifying only the ListTemplate without being explicitly CUSTOM won't work even in the UI.
If you can't get around with this apparent limitation, my suggestions are:
.NET, note that this post has some voodoo in the first comment if you happen to get the same error
Make an IFRAME with http://site/_layouts/new.aspx?CustomTemplate=PT6.stp&FeatureId={00bfea71-513d-4ca0-96c2-6a47775c0119}&ListTemplate=150 as source and fill the fields using javascript, and then trigger the OK button click, make some full page loading transition and it will even look good.
Method 2 needs to be done from the same domain, if you are not running your PHP from the same domain (unlikely) you need to create a page inside the SharePoint site to contain this hack, it can be as simple as a Web Part Page with a Content Editor Web Part in it, you read some querystring parameters, place them on the fields, trigger the OK and wait for the page to change so you can redirect to a "success" page.
Edit: I got curious and looked at the source of New.aspx, it has this little snippet (bIsCustomTemplate = strCustomTemplate != null, strCustomTemplate = querystring "CustomTemplate"):
<% if (bIsCustomTemplate) { %>
<input id="onetidCustomTemplate" type="Hidden" name="CustomTemplate" value=<%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(strCustomTemplate),Response.Output);%> />
<% } %>
I looked at the disassembled code but I don't think we can post it here, but it only proves that the UI builds it from a post (Request.Form) and looks for the CustomTemplate parameter, and the Web Service has only those methods were you can't specify a custom template.