Quantcast
Channel: Optimizely Search & Navigation
Viewing all 6894 articles
Browse latest View live

Forms file upload error

$
0
0

Whenever I try to upload a file on a form I get the following js error:

If I don't add a file then the form submits fine. This is on my local dev environment.

Using EpiServer CMS V11.9 and EPiserver Forms V4.14.1


Block versioning (part 2)

$
0
0

Hi I already read this forum post:

https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2015/5/block-versioning/

But neither the extension or listing versions work for some reason. I always get DateTime.MinValue.

I have tried...

public static class ContentExtensions
    {
        public static DateTime GetLastModified(this BlockData block)
        {
            // ReSharper disable once SuspiciousTypeConversion.Global
            return block is IChangeTrackable changeTrackable ? changeTrackable.Saved : DateTime.MinValue;
        }
}

And also tried:

var softLinks = _contentSoftLinkRepository.Load(page.ContentLink, false)
                    .Where(x => x.SoftLinkType == ReferenceType.PageLinkReference)
                    .Select(x => x.ReferencedContentLink)
                    .ToList();
                var contentLinks = softLinks.Select(_contentRepository.Get<IContent>).ToList();
                var blockDate = softLinks.OfType<BlockData>()
                    .SelectMany(block => _contentVersionRepository.List(((IContent) block).ContentLink))
                    .Select(version => version.Saved)
                    .OrderByDescending(date => date)
                    .FirstOrDefault();

Any ideas?

Can't see embed code in editor

$
0
0

Hi!

After upgrade to update 304 we cant see the source code for embed and iframes that we published in the editor before the upgrade. The page can still show the iframe and embed content but its invisible in the editmode, when we hit the view source button in the editor the popup is blank. If we put new embed or iframe code in the editor it works, Then we can view the source in the editor and the embed code shows in the popup. 

Any clues on what's going on?

We are running: 

  • EPiServer.Forms.UI 4.27.0.0
  • EPiServer.UI 11.23.6.0
  • EPiServer 11.14.1.0
  • EPiServer.Cms.AspNet 11.14.1.0
  • EPiServer.XForms 1.0.3.0
  • EPiServer.LinkAnalyzer 11.14.1.0
  • EPiServer.Cms.Shell.UI 11.23.6.0
  • EPiServer.Search.Cms 9.0.3.0

Best regards

Kristian

Order with multiple shipments, how to apply a custom shipping promotion to one shipment only ?

$
0
0

Hi,

I have looked everywhere on the forum, but could not find an answer to my question :

I am creating a custom shipping promotion type for an eCommerce website that is used by multiple stores. 

When a customer places an order, he can put items from multiple stores in the cart. Cart items are then grouped into multiple shipments, one shipment per store.

The custom shipping promotion will need to apply for one store only, so it will carry a store id.

The problem is that i don't know how to apply a shipping promotion only to a specific shipment. i found some interesting piece of information which suggests to implement a custom ShippingRewardApplicator but don't know how to do this(if that is the right way to do it).

Anyone already had to do this?

Many thanks !

Support for filtering on facets in general, not just NestedFacetRequest

$
0
0

It is not possible to filter on facets, only nested facets.

This is needed to keep facet counts as expected when filters are applied

Validation on a BlockType - no errormessage in UI when saving block

$
0
0

We have a block with properties Image and ImageAlt. To get the ImageAlt to be required if the user add an Image we created a custom validation class for the block.

public class ImageBlockValidator : IValidate<ImageBlock>
    {
        public IEnumerable<ValidationError> Validate(ImageBlock instance)
        {
            if (instance.Image != null && string.IsNullOrEmpty(instance.ImageAlt))
            {
                return new[] { new ValidationError
                {
                    ErrorMessage = LocalizationService.Current.TranslateKey("/validationmessages/imageblock/imagealt/heading"),
                    PropertyName = instance.GetPropertyName(block => block.ImageAlt),
                    RelatedProperties = new[] { "Image" }, 
                    Severity = ValidationErrorSeverity.Error,
                    ValidationType = ValidationErrorType.StorageValidation
                }};
            }
            return new ValidationError[0];
        }
    }

But when a user add an Image and click "Spara" no error message is shown i the UI, the "Spara" button gets inactive and nothing happens. The block isn´t saved.

But if the user saves the block before adding an Image and then goes back to edit the block and adds an Image the validation error message is shown.

Restrict Access for block types

Stored procedure maxes out DTU in Azure

$
0
0

We're having the same issue as Johan describes in the following post: https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2017/5/what-function-is-making-this-sql-call/DTU maxes out and the query seems to be running for about five hours (in production). The query stands for about 95% of our CPU load. We've added the index, marked as a solution in above post, but without success. I've talked with other developers that are experiencing the same issues with their customers so it doesn't seem isolated to our solution. We're running the latest EPiServer version with Find.

Also, the following post suggests deactivation of "Clear Thumbnail Properties" Schedule Job. But we don't even have it active. 
https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2019/7/extreme-poor-performance-of-clear-thumbnail-properties-schedule-job/

Any suggestions on where to take this further?

Regards,
Michael


Display dropdown when add items to list

$
0
0

Hi,

I have a list:

[ClientEditor(SelectionFactoryType = typeof(MyTypesFactory))]
[UIHint("DropDownList")]
public virtual IList<string> Types { get; set; }

Now i want the user to be able to select items in a dropdown and add this to my Types list,

    public class MyTypesFactory : ISelectionFactory
    {
        public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
        {
            return _myTypes.Select(item => new SelectItem {Value = item, Text = item}).Cast<ISelectItem>().ToArray();
        }
        private readonly string[] _myTypes = {"Article", "Book", "Dataset"
        };
	}

But i can't get the dropdown to display when the user click on the add button, i only see the dropdown on the already selected items (the items in my Types list)

How can i get a dropdown with a list of the items that my array, _myTypes , contains? Use EPI 11.

Using UsingSynonyms in Find correctly

$
0
0

Hello,

We have some problems with getting correct search results with the usage of synonyms.
Search for some texts yields 0 aswers when there should be a lot of answers if synonyms are working correct.
I noticed in some post that we did'nt use .InField() in our qyery. I then added it after the .UsingSynonyms() row.

var hitSpec = new HitSpecification
{
    HighlightExcerpt = true,
    EncodeTitle = false,
    EncodeExcerpt = false
};
var results = SearchClient.Instance.UnifiedSearchFor(q)
         .UsingSynonyms()
         .InField(x => x.SearchSection)
         .Track()
         .ApplyBestBets()
         .UsingAutoBoost()
         .TermsFacetFor(x => x.SearchSection)
         .Skip(skipNumber)
         .Take(pageSize)
         .StaticallyCacheFor(TimeSpan.FromMinutes(5))
         .GetResult(hitSpec);

I have try to change the order of the different query methods but this is the only way I got it to actually work. Changing the order of where .UsingSynonyms() is applied I get an error either from the compiler or a runtime error.

After adding the .InField() row I started getting a status 500 response from the search query. The error message as bellow in my local environment:

Exception type: TypeMismatchException
Exception message: Content with id 'xxxx' is of type 'EPiServer.Core.ContentAssetFolder' which does not inherit required type 'EPiServer.Core.IContentMedia'

Note: We are sharing the same Find index between local, development and stage environments.

Error in the development environment:

Exception type: TypeMismatchException
Exception message: Content with id 'xxxx' is of type 'Castle.Proxies.ImageBlockProxy' which does not inherit required type 'EPiServer.Core.IContentMedia'

The new code exists only on my local and our development environment. Both environments got the same error but for different types and different Content.

After indexing Find manually (through Admin) the error is not triggered for my local and development environments. I actually get results returned and the synonyms seem to work properly. If I index Find manually through my stage environment I do get the same error again on local and development environments.
I can't wrap my head arround this one. How come indexing stage breaks the other two and indexing one of the other two make them work?
I know there are some editorial differences between the environments but nothing that makes Find, index data in a different way, only query for results differently.

The little I understand is that the .InField() somehow tries to convert stuff to IContentMedia. Is that right?
If I do not want this conversion to happen, how can I successfully query for synonyms?

Override episerver preview url to SPA on another server

$
0
0

I have EPI server instance with content delivery API enabled. On the other end I have Angular SPA application hosted on separate domain/server. 

I would like editors to be able to preview their changes. How to point the preview to the SPA rather than regular EpiServer preview, based on layouts and views?

Commerce Marketing bug

$
0
0

We upgraded Commerce from version 13.15.0 to 13.18.2 and campaign total order count is not updated anymore.

I tested by creating a campaign and a offer as seen below on version 13.15. Created one order with a product in the campaign and totals orders and redemptions was set to 1. Then we upgraded to 13.18.2 and created another order with the same product. Redemptions was updated to 2 but total orders was not updated to 2 as expected. Anyone else with this problem?

Using a CDN with Episerver

$
0
0

I have an existing Episerver project, all the images and media are genrally uploaded via the back office's media section.

Recently they have significantly inrecressed the amount of media on the website, and are considring, using some kind of CDN to serve the content.

Is it possible to use a CDN with episerver - I would like the back office users not to have to do anything diffrent than they do now, so still upload the images in the normal way.

Has anyone ever done something like this? where do I start?

Using Groups to restrict members content

$
0
0

I have gone through the community api documentation and have a question around the groups microservice. 

My query is in relation to utilising Groups to restrict content (in this case forums/sub forums) based on users groups. I can’t see documentation supporting this using community api groups. I could look into Identity roles and restrict based on roles but it feels Groups can almost do it, I just need some direction.

I have managed to utilise the Comments microservice to create a forum similar to episerver world so far.

As an example

Lets say you have a forum with the following sub forums:

 

  • Episerver Cms
  • Episerver Commerce
  • Episerver Find

 

I have a member called “Joe Bloggs”

I would like to associated each sub forum as a Group and then specify Joe Bloggs as a member of lets says Episerver Cms which means he isn’t a member of commerce or find and thus cannot get access to that sub forum (content).

Any help would be apperciated. Thanks

Using ReactJs.Net is DXP

$
0
0

This may not directly be related to Episerver and DXP but I will give it a try.

I'm currently working on a new Episerver application and have an idea of building some parts/components of the site with React Js. I've stumbled over the library ReactJs.NET and I really wanted to use this lib to be able to render components server side and easy pass models and translations from the backend to the react components. This has been working excellent locally on my computer.

The other day we got access to our DXP environments, unfortunately it seems like the ReactJs.Net library doesn't run at all in Azure. The problem as far as I know is related to the visual c++ redistributable 2015 package not being installed. There is a lot of different information about this, and it's hard to filter out what is actually correct.

Does anyone have any experience of working with ReactJs.Net in DXP / Azure?


Refreshing page in edit mode after ajax call to controller

$
0
0

Let's say I have a property on the page:

[Display(
    Name = "Selection Box",
    GroupName = Global.GroupNames.Contact
)]
public virtual bool SelectionBox { get; set; }

An then in the view, I have this code:

@if (PageEditing.PageIsInEditMode)
{
    @Html.CheckBoxFor(modelItem => Model.CurrentPage.SelectionBox,
        new
        {
            @class = "toggle",
            @data_url = Url.Action("UpdatePage", "DefaultPage"),
        })<script>
        $(function () {
            $('.toggle').change(function () {
                var self = $(this);
                var url = self.data('url');
                var value = self.prop('checked');
                $.ajax({
                    url: url,
                    data: { selected: value },
                    type: 'POST',
                    success: function (response) {
                        alert(response);
                    }
                });
            });
        });</script>
}

Controller method is very simple:

public ViewResult UpdatePage(ProductPage currentPage, bool selected)
        {
            var currentPageEdit = _contentRepository
                .Get<ProductPage>(currentPage.ContentLink)
                .CreateWritableClone() as ProductPage;
            if (currentPageEdit != null)
            {
                currentPageEdit.SelectionBox = selected;
                _contentRepository.Save(currentPageEdit, SaveAction.Default, AccessLevel.NoAccess);
            }
            var model = CreateModel(currentPageEdit);
            return View(string.Format("~/Views/{0}/Index.cshtml", currentPage.GetOriginalType().Name), model);
        }

Basically what it does, it takes the value of the checkbox, does a AJAX call to the controller, which then updates the page property with value. And this works fine. What I'm struggling with, is how to refresh the page in preview after the succesful save in the controller. 

I have tried subscribing to contentSaved event, but it's not called. 

Essentially I'm looking for a way to either:

  1. notify the UI from the controller that update happened and it should reload
  2. notify the UI from the javascript that the update to property/page happened and it needs to refresh

In my use case, editor will be pointing to a collection (coming from external system), and it will render list of items in that collection. Then user would be able to pick which items from that collection to show or hide. I'd like to maintain the list of exclusions as a property, which I anticipate I could update via AJAX calls.

If there are better options - I'm open for those as well.

Custom url:s

$
0
0

Hello,

Current version of EPiServer.CMS = 11.10.6

I have a structure that looks something like figure1.

Each "MyPage" will have a unique code/id in it's "Name in URL" (URLSegment).
This is a multisite multilingual environment.

What I would like to achieve is that all "MyPage" gets a url directly under "ContainerPage1", in this format:
mypage4 = my-domain/ContainerPage1/unique-code-from-mypage4/the-page-name-from-mypage4/
mypage1 = my-domain/ContainerPage1/unique-code-from-mypage1/the-page-name-from-mypage1/


Figure 1

SiteStartPage
- ContainerPage1
-- MyPage1
-- ContainerPage2
--- MyPage2
--- MyPage3
--- ContainerPage3
---- MyPage4
---- MyPage5

SiteStartPage2
...

Tips are gratefully received :)


So far I have been playing around with something like this, it seems to "work" ( the part after /unique-code-from-mypage4/ can be anything in this ), but I'm pretty sure there are better ways and that there are tons of possible problems here ;). Haven't any real experince doing this partial router stuff.

	public class MyPagePartialRouter : IPartialRouter<ContainerNode, MyPage>
	{
		...
		private IContentLoader _contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
		private IUrlSegmentGenerator _urlSegmentGenerator = ServiceLocator.Current.GetInstance<IUrlSegmentGenerator>();
		public object RoutePartial(ContainerNode content, SegmentContext segmentContext)
		{
			...
			var nextSegment = segmentContext.GetNextValue(segmentContext.RemainingPath);
			var theSegmentWithUniqueCode = HttpUtility.UrlDecode(nextSegment.Next);
			var myPageInstanceFound = _contentLoader.GetDescendents(_refefToContainerPage1)
				.Select(x =>
				{
					if (_contentLoader.TryGet<MyPage>(x, out var myPageInstance))
						if (myPageInstance.URLSegment == theSegmentWithUniqueCode)
							return myPageInstance;
					return null;
				})
				.FirstOrDefault(x => x != null);
			if (myPageInstanceFound == null)
				return null;
			segmentContext.RemainingPath = ""; // I had to do like this otherwise I got a 404 
			segmentContext.RoutedContentLink = myPageInstanceFound.ContentLink;
			return myPageInstanceFound;
		}
		public PartialRouteData GetPartialVirtualPath(MyPage content, string language, RouteValueDictionary routeValues, RequestContext requestContext)
		{
			var urlSegment = _urlSegmentGenerator.IsValid(content.URLSegment)
				? content.URLSegment
				: _urlSegmentGenerator.Create(content.URLSegment);
			return new PartialRouteData()
			{
				BasePathRoot = _refefToContainerPage1,
				PartialVirtualPath = string.Format("{0}/{1}/", urlSegment, _urlSegmentGenerator.Create(content.Name))
			};
		}
	}

Article Page Site Structure Builder Not working.

how to put a json file in DAM?

$
0
0

If I drag an image into the media asset thing (the folder symbol in the top right, then choose the "media" tab, then chose a folder) I can then view that image in a web browser using the globalassets usl, such as: https://www.mysite.com/globalassets/brand/somebrand/somedir/images/my.jpg Now I need to server a static json file.  If I drag and drop a json file into the DAM media window, it seems to accept it, and if I try twice, it says it already exists. But if I browse that directory (the dialog below it strangely called powerslice), I cant see it in the list, and if I try to access my new static json media, I get a 404.  E.g.  https://www.mysite.com/globalassets/brand/somebrand/somedir/images/some.json

Is there any way to get json files recognised as media, or some other way to serve json which doesnt require proamming?

Guidance on headless mode and preview needed

$
0
0

We currently have a SPA written in Angular with some system components that we would like to re-use on Epi Server side.

I have some pros and cons and some doubts for each option:

Enable headless mode in Epi and re-use/extend SPA application to consume data from episerver

  • PROS:
    • Reuse existing components/limits the effort
    • No need for CSS
    • Seamless experience for users
  • CONS:
    • Possibly effort needed to get OPE working properly (in case editors need it)
  • DOUBTS:
    • Existing SPA app would server as preview (even without OPE) but it sits on different server/URL - can preview work that way?

Bring in the required components into Epi (duplicate) and embed them in pages

  • PROS
    • Easier to put together /leverage OPE
  • CONS
    • some duplication of code
    • might need to adjust some services for components

Rebuild the components in the episerver instance

  • PROS
    • full control over the components
    • full OPE support
  • CONS
    • duplicating the effort
  • new components/features might not align in Epi and rest of the system

I'm personally thinking that option 1. might be the best, because it would allow to take full advantage of the components and effort already invested. However OPE support might be challenging (but probably we can convince user to use preview instead of OPE).

My biggest concern is - can headless mode in EPI work with the actual front-end and preview being hosted from a different website/domain. Disregard license limitations - it's DXC.

Viewing all 6894 articles
Browse latest View live