Sitecore overlapping error when deleting an item - sitecore

I am trying to delete an item, but I am getting an error:
The trees Content-CompanySites-MySite1-Data and Content-CompanySites-MySite1-Data-Configuration both contained the global path /sitecore/content/CompanySites/MySite1/Data/Configuration/Features/Project/ProjectOverviewPage - overlapping trees are not allowed.
Same thing happens when I tried to install package or add new item

Review your Unicorn config files.
it is not allowed to have overlapping trees, however you can use Children exclusion patterns to have a root item config, and multiple child configurations.
In other words, the same item would be in several unicorn serialization folders, which of course is also asking for problems. Below some suggestions to fix this.
Search for Content-CompanySites-MySite1-Data and add
<exclude children="true" />
Example
<include name="Content-CompanySites-MySite1-Data" database="master"
path="/Content/CompanySites/MySite1/Data">
<exclude children="true"/> <!-- include /nochildren, exclude all of /nochildren's children -->
</include>
Or remove the /sitecore/content/CompanySites/MySite1/Data/Configuration/Features/Project/ProjectOverviewPage config, or make a exception for this feature.
Example
<include name="Content-CompanySites-MySite1-Data" database="master"
path="/Content/CompanySites/MySite1/Data">
<exclude path="/sitecore/content/CompanySites/MySite1/Data/Configuration/Features/" />
</include>
See also TestConfiguration.xml to get an idea of the possibilities to solve your specific issue.
See /sitecore/admin/showconfig.aspx to get insight of your merged config and where the patches came from.

Related

Sitecore multisite setup with language-culture in url

I want to setup a sitecore solution containing multiple sites. The sites hostnames need to have the suffix language-culture, so I want the urls to be like:
[HOST]/de-DE
[HOST]/sv-SE
[HOST]/fr-BE
[HOST]/nl-BE
I tried to configure the sites with virtualpaths like "de-DE", but that does not help. How should this be configured?
And if I want the belgium site (fr-BE and nl-BE) to be one site with multiple languages (translations), but reachable from given url structure, how should that be setup?
You may have better luck getting answers on https://sitecore.stackexchange.com/, however, I will answer here as I am unable to move your question.
It sounds to me like you need a mixture of both separate website nodes for each site, as well as translated versions within some of those sites (fr-BE and nl-BE).
As long as the site definitions are patched in before the website node, they should be picked up by Sitecore's site resolver based on the virtualFolder. Please note there is a special requirement when using virtualFolders in which the physicalFolder value must match. More info on that here.
<site name="fr-BE" ... virtualFolder="/fr-BE" physicalFolder="/fr-BE" rootPath="/sitecore/content" startItem="/Home Belgium" language="fr-BE" ... />
<site name="nl-BE" ... virtualFolder="/nl-BE" physicalFolder="/nl-BE" rootPath="/sitecore/content" startItem="/Home Belgium" language="nl-BE" ... />
<site name="de-DE" ... virtualFolder="/de-DE" physicalFolder="/de-DE" rootPath="/sitecore/content" startItem="/Home Germany" language="de-DE" ... />
<site name="website" ... virtualFolder="/" rootPath="/sitecore/content" startItem="/Home" ... />
Notice how the first two site definitions point to the same start item (/Home Belgium in my example). This allows you to still use Sitecore's language version translation on that site, while keeping the item tree structure separate from the German site.
Next, you will need to turn off the strip language processor that is responsible for identifying and removing the language prefix from each request. This is on by default and will prevent you from using virtual folders that match a language code.
<!-- Set to false to allow language code virtual folders -->
<setting name="Languages.AlwaysStripLanguage" value="false" />
Lastly, make sure you have the proper languages installed and that your content is published in the appropriate languages.

How do I prevent sitecore from adding a ~ to an image path?

I have a clean install of Sitecore 6.5, DMS 2.0, and the E-Commerce Module and Sample Site (v1.2). When I have the sample site installed, most of the images appear to be broken. The HTML that is rendered includes img src attributes that contain a path that start with /~/. Example:
http://~/media/Images/Ecommerce/Examples/Products/Digital%20SLR/D200.ashx?w=250&as=1
Now, I'm assuming this is either because the sample site hasn't been updated in a while to stay current with Sitecore changes, or there is a configuration for media paths that get returned from it. Here's an example of the XSLT rendering used to write the image:
<img id="product_shot" class="fix" alt="{sc:fld('alt',.)}" title="{sc:fld('alt',.)}" src="/{sc:GetMediaUrl(.)}?w={$ImageWidth}&as=1" />
Does anyone know of a way to prevent the image url from being rendered with a ~ when using XSLT? Did I do something wrong with my initial setup and configuration?
John West gives a great breakdown here: http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2012/12/Sitecore-Idiosyncrasies-Media-URLs.aspx
The important info being a configuration of "Media.MediaLinkPrefix". You can create a patch file, or modify your Web.config to change it to something else. The places I've read have people changing it to a single dash "-/media"
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="Media.RequestExtension">
<patch:attribute name="value"></patch:attribute>
</setting>
<setting name="Media.MediaLinkPrefix">
<patch:attribute name="value">-/media</patch:attribute>
</setting>
</settings>
<customHandlers>
<handler trigger="-/media/" handler="sitecore_media.ashx"/>
</customHandlers>
</sitecore>
</configuration>
Another solution which I can think of is to change your web.config like this:
InvalidItemNameChars: Add “~“
But this will work not only for images but for any content items out there in your Sitecore content tree.
This is more of a workaround than a solution. Since I'm setting this up for demo purposes, it'll do just fine.
In web.config, I changed the value of Media.MediaLinkPrefix to include the hostname and media prefix. Since the Sitecore E-Commerce Example Site XSLT renderings start all calls to sc:GetMediaUrl(.) with a / character and sc:GetMediaUrl(.) itself returns its first character as a /, this causes the src attribute value to be written with the full host name and then correctly resolves:
<img src="//sitecore.local/~/media/Images/Ecommerce/Examples/Products/Digital%20SLR/D200.jpg />
Far from ideal, but for these purposes, this workaround did the trick.

HTML5 PushState Regex Issue

I've been experimenting with Backbone for a project I'm working on, and I've been having problems with getting Backbone's 'pushState' functioning how I'd like to.
I've got a simple project consisting of 4 views, and a router. I'm routing via the id of the elements if it matters in this case. When I go to the hash for one of the views (http://example.com/backbonetest/#step1), it's displayed correctly, and the url is changed. This is what I'd expect to happen here, but the problem comes when I try and navigate to the same thing without the hash in it (http://example.com/backbonetest/step1). I get a 404 on the server (IIS) which is to be expected, as the page doesn't exist.
What I've been trying to do all day is write a regex expression for IIS which would catch and rewrite the url, removing the fragment at the end of the url so the page is served correctly. I'd rather simply rewrite the url than having a physical file with the same name, as the content of the page will be dynamically generated, and will require scripts to get the content anyway.
The issue I've come across may be related to how I need to have the folders/scripts/styles structured on the file system. I was hoping to be able to have the whole example contained within the /backbonetest/ folder. For scripts, 'backbonetest/scripts' and so on.
I made a list of URLs which I've been testing my regex expressions against, and the results I've been trying to achieve:
Input: Output:
2
a2
ab2
ab22
step2
script.js script.js
scripts/ scripts/
555/stuff 555/stuff
scripts/script.js scripts/script.js
Edit: I've since found that the url which is used does not include the preceding slash,
which is why Qtax's solution doesn't work in IIS. The new input structure is shown above.
The '/555/stuff' url I would expect to 404 as normal. I only want to rewrite the url if there are no subdirectories defined other than the current one, and if the url doesn't reference an explicit file (one with an extension for example).
I've been scouring the net all day for a solution to this, as well as experimenting with regexr, but not managed to come up with the proper solution to my problem. After not finding a single thing anywhere, I'm thinking I must be looking at this the wrong way...
Can anyone help me out please?
After much head/desk banging, I've come up with the solution. It's irritatingly simple for all the fuss it's caused:
^[^\./]+$
Essentially:
Replace if the url doesn't contain a '/' or a '.' anywhere in it.
This should now be a solution for anyone using IIS with Backbone and HTML5 push state. Just pop it in the web.config in the root of your app, and change the rewrite action to ".", and it should just work.
This melted my brain all morning!
I've added to this - In my scenario, I have an API project which sits in an API virtual directory (to eliminate the need for CORS) - I obviously don't want to rewrite any of the PAI calls, so I re-wrote mine as follows - you can do similar for your API URLs if needed...
<rule name="Handle PushState">
<match url="^[^\./]+[^\./api]+(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="." />
</rule>

Magento - catalog.xml not using correct template

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.

Ivy and Snapshots (Nexus)

I'm using ant, ivy and nexus repo manager to build and store my artifacts. I managed to get everything working: dependency resolution and publishing. Until I hit a problem... (of course!).
I was publishing to a 'release' repo in nexus, which is locked to 'disable redeploy' (even if you change the setting to 'allow redeploy' (really lame UI there imo). You can imagine how pissed off I was getting when my changes weren't updating through the repo before I realised that this was happening.
Anyway, I now have to switch everything to use a 'Snapshot' repo in nexus. Problem is that this messes up my publish. I've tried a variety of things, including extensive googling, and haven't got anywhere whatsoever. The error I get is a bad PUT request, error code 400.
Can someone who has got this working please give me a pointer on what I'm missing.
Many thanks,
Alastair
fyi, here's my config:
Note that I have removed any attempts at getting snapshots to work as I didn't know what was actually (potentially) useful and what was complete guff. This is therefore the working release-only setup.
Also, please note that I've added the XXX-API ivy.xml for info only. I can't even get the xxx-common to publish (and that doesn't even have dependencies).
Ant task:
<target name="publish" depends="init-publish">
<property name="project.generated.ivy.file" value="${project.artifact.dir}/ivy.xml"/>
<property name="project.pom.file" value="${project.artifact.dir}/${project.handle}.pom"/>
<echo message="Artifact dir: ${project.artifact.dir}"/>
<ivy:deliver
deliverpattern="${project.generated.ivy.file}"
organisation="${project.organisation}"
module="${project.artifact}"
status="integration"
revision="${project.revision}"
pubrevision="${project.revision}" />
<ivy:resolve />
<ivy:makepom
ivyfile="${project.generated.ivy.file}"
pomfile="${project.pom.file}"/>
<ivy:publish
resolver="${ivy.omnicache.publisher}"
module="${project.artifact}"
organisation="${project.organisation}"
revision="${project.revision}"
pubrevision="${project.revision}"
pubdate="now"
overwrite="true"
publishivy="true"
status="integration"
artifactspattern="${project.artifact.dir}/[artifact]-[revision](-[classifier]).[ext]"
/>
</target>
Couple of ivy files to give an idea of internal dependencies:
XXX-Common project:
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info
organisation="com.myorg.xxx"
module="xxx_common"
status="integration"
revision="1.0">
</info>
<publications>
<artifact name="xxx_common" type="jar" ext="jar"/>
<artifact name="xxx_common" type="pom" ext="pom"/>
</publications>
<dependencies>
</dependencies>
</ivy-module>
XXX-API project:
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info
organisation="com.myorg.xxx"
module="xxx_api"
status="integration"
revision="1.0">
</info>
<publications>
<artifact name="xxx_api" type="jar" ext="jar"/>
<artifact name="xxx_api" type="pom" ext="pom"/>
</publications>
<dependencies>
<dependency org="com.myorg.xxx" name="xxx_common" rev="1.0" transitive="true" />
</dependencies>
</ivy-module>
IVY Settings.xml:
<ivysettings>
<properties file="${ivy.project.dir}/project.properties" />
<settings
defaultResolver="chain"
defaultConflictManager="all" />
<credentials host="${ivy.credentials.host}" realm="Sonatype Nexus Repository Manager" username="${ivy.credentials.username}" passwd="${ivy.credentials.passwd}" />
<caches>
<cache name="ivy.cache" basedir="${ivy.cache.dir}" />
</caches>
<resolvers>
<ibiblio name="xxx_publisher" m2compatible="true" root="${ivy.xxx.publish.url}" />
<chain name="chain">
<url name="xxx">
<ivy pattern="${ivy.xxx.repo.url}/com/myorg/xxx/[module]/[revision]/ivy-[revision].xml" />
<artifact pattern="${ivy.xxx.repo.url}/com/myorg/xxx/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<ibiblio name="xxx" m2compatible="true" root="${ivy.xxx.repo.url}"/>
<ibiblio name="public" m2compatible="true" root="${ivy.master.repo.url}" />
<url name="com.springsource.repository.bundles.release">
<ivy pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="com.springsource.repository.bundles.external">
<ivy pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
</chain>
</resolvers>
</ivysettings>
w00h00t.
(There's something cathartic about asking the world for help. Usually you fix the problem much faster, even without a response).
Anyway, for the interested it came down to a couple of things:
a) the addition of -SNAPSHOT to all revisions. This involved forking a second ivy.xml -> ivy.SNAPSHOT.xml and referencing that explicitly in the ivy ant tasks.
b) given that this is a manual addition I had to go through my entire tree of build files and provide parallel paths for release and snapshot flows. This, in my opinion, is lame. But, as I guess we're extremely unlikely to invent any other type of flow, this probably won't bloat, and 2 parallel flows is where it will stay.
c) I specified various hints to ivy to check for updates to the snapshots. e.g. checkUpdated="true" and changePattern=".*-SNAPSHOT" on the resolver. And the addition of
<modules org="myorg" name=*" resolveMode="dynamic" />
Still, it'd be nice if there had been automatic integration with snapshot stuff. A bit of (optional) cleverness on the part of ivy. Let's face it, maven repos like nexus ARE really useful and I'm certainly using ivy only to get round maven's crappy build process. I like using nexus.
Anyway. If anyone ever wants to question further on this, feel free.
I'm not sure if this would help with the problem of having 2 sets of configurations, but at least the build.xml would be a little bit simpler.
You can define the revision attribute on the info element in ivy.xml as ${project.revision}.
You can then omit the revision="${project.revision}" attributes on ivy elements in build.xml.
See my answer on this another question for example:
https://stackoverflow.com/a/8853823/1148030
It should be noted, the only necessary step is to include the '-SNAPSHOT' to revision when publishing to Nexus. The other steps listed in the answer are optional/improvements. To pull the published item down, you need to add '-SNAPSHOT' to the revision as well.