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

Commerce Caching - Timeout - Best practices?

$
0
0

Hi everybody.

We have a commerce site with +200.000 variants and we experience that the cache is often empty when users are fetching products/variants/categories - Propably because many products/variants are not accessed very often. Our initial thoughts were to increase the different relevant timeouts in the Commerce config files, but we are unsure that the side effects might be.

Is there any reason for not increasing the timeouts to "1:0:0" (one day) instead of the default 15 minutes? The only problem I can think of is an increased memory usage.

And do anybody know the difference between the different timeouts in the ecf.catalog.config? 

<Cache enabled="true" collectionTimeout="0:15:0" entryTimeout="0:15:0" nodeTimeout="0:15:0" schemaTimeout="0:15:0"/>


An attempt was made to access a socket in a way forbidden by its access permissions

$
0
0

Hi all,

I followed the steps for installing EPiserver commerce given in the website but i am facing the problem which i kept below.

I sortouted with many couldnt find whats wrong in that i have done many times like trying to install it like 6 times even though everytime i am facing the same issue

EpiServer Form: Conditional Cross field validation support?

$
0
0

Hi,

I'm trying to create a EpiServer Form which has two fields, The user only needs to fill one of the fields but should get a validation error if both fields are empty.
Is there anyway to create this kind of conditional cross field validation both on client and server side?

BR
Micke

Learning Platform Add-on Recommendation

$
0
0

Hello all guys, 

is there any Learning Platrform (or something similar/could be adapted) add-on to EpiServer? 

Thank you in advance, cheers!

Page/Block Types missing in edit mode/can't edit blocks

$
0
0

More quirky issues with my development site.  Just synced up data from production down to development (SQL backup/restore, replace existing) and noticed that I can't edit a container with blocks (Sub Menu Nav type).  That led me to notice that all pages are missing a type next to ID when looking at the CMS in Edit Mode.  I also don't have the ability to choose page types when creating a new page, same with blocks.  StartPage is listed in the ContentType table, and my Home Page of ID 52, shows a ContentType of 6 in the Content database.

Any ideas what relationship is broken?  What SQL query can I run to check?

Thanks,

Tim

Sort By Price on Product Variation using Find Query

$
0
0

Hi all!

We are using Catelog Product Model to search products and already had Sort by options with DisplayName and Relavance.

Now we would like to sort the results with Price(Asc & Dsc) wich is with variation. In our case We have developed query with  Catelog Product Model, 

So until we get the results of query we are not going to get the price of variation.

If anyone achieved this scenario please help us to break it.

Here is some code snippet:

query = query.OrderByDescending(p => p.DisplayName); //Used to sort with Display Name. P->Product  Model

We tried with 

query = query.OrderByDescending(p => p.GetProductPrice()); which is not effecting the results, because of not having price here.

var results = query
.ApplyBestBets()
.Skip((page - 1) * pageSize)
.Take(pageSize)
.Track()
.GetContentResult();

Thank you!

Unable to upload video files

$
0
0

Hello.

I'm having trouble uploading video files.

Has the following code:

    [ContentType(GUID = "1f7218e9-bddf-4734-b067-4d2d68b5dade")]
    [MediaDescriptor(ExtensionString = "mp4,webm,ogg,mov")]
    public class VideoMediaData : VideoData
    {
        [CultureSpecific]
        [Display(
            Name = "Name",
            Description = "Name of the video file",
            Order = 10)]
        public virtual string VideoName { get; set; }
    }

Have no problems uploading images and for example PDF files with similar solution.

Error messages I get when uploading video files are:
Object reference not set to an instance of an object.

Any thoughts on why it doesn't work and maybe some suggestion on some solution I can try?

Multiple searches in one request

$
0
0

I want to use Episerver Find MultiSearch to limit nr of requests to Find, as specified here

How can I dynamically add Searches, typically inside a foreach statement?

The code below works, but I can see through Fiddler that nr of request matches 'mainCategories' count.

if (mainCategories.Any())
 {
     var multiSearchQuery = SearchClient.Instance.MultiSearch<EntryContentBase>();
     foreach (var mainCategory in mainCategories)
     {
        var mainCategoryName = mainCategory.Term;
        multiSearchQuery.Searches.Add(
                multiSearchQuery.Client.Search<EntryContentBase>()
                     .CommonProductFilter(currentStore)
                     .AddPromotionPrefixAndStoreFilter(prefix, currentStore)
                     .Filter(p => p.MainCategory().Match(mainCategoryName))
                     .Take(count));
     }
     var contentResults = multiSearchQuery.GetContentResult();
}

Update page property content via SQL queries

$
0
0

Hello!

I'm trying to change a specific word to another word on all pages on my website via SQL queries to the database. I have managed to do this by doing a update query on the views tblProperty and tblPageLanguage. Nothing breaks and I can't find any trace of the replaced word on the site, except for one place.

When I enter editor mode and edit a page, the old word is still present in the properties view. As soon as I make any edit to, for example, a XHTML-property and publish, the old words once again appears on the page.

My question is where this text is saved in the SQL database.

Best regards

Search option for select content popup in CMS edit

$
0
0

Hi,

I need to show search option for content pages in "Select Content" popup for editors. I have below few page type properies across the application.

1) public virtual ContentReference ProductPage { get; set; }

2) public virtual IEnumerable<ContentReference> Industries { get; set; }

Editors are facing difficulties to identify the required page to map becuase sometimes editors has to go multiple level of tree structure to map it.

For media files, we are getting search option. Below is the sample example

[UIHint(UIHint.Image)]
public virtual ContentReference DefaultWhiteLogo { get; set; }

Can you please someone assist to get search option "Select Content" for content pages as well?

Thanks,

Suresh B

Unable to Create Local Block on Commerce Page as full UI is not displayed

$
0
0

We are experiencing a problem that ulitmately results in a 409 error from the server when adding a new component.

On a CMS page, When a block is added to a ContentArea all is fine whether created as a local block or created in the assets panel.

On a Commerce Page, Creating a block via the asset panel and draggin into the ContentArea works fine.

On a Commerce Page, When a block is added to a ContentArea as a local block, only the "Name" field is presented.  On "Saving" the block, a 409 error is generated if the block has [Required] properties, presumably because the validation is failing on save.  Therefore we are unable to create local content blocks on Commerce pages.

I have noticed that the response from the call to /EPiServer/shell/Stores/metadata/EPiServer.Core.ContentData differs for the CMS and Commerce very slightly.

CMS:

{
"title": "Settings",
"displayUI": true,
"displayOrder": 30,
"name": "Advanced",
"uiType": "epi/shell/layout/SimpleContainer",
"options": {}
}],

Commerce:

{
"title": "Settings",
"displayUI": false,
"displayOrder": 30,
"name": "Advanced",
"uiType": "epi/shell/layout/SimpleContainer",
"options": {}
}],

Using a tool such as Charles Proxy and modifying the Response mid-flight to return True on the Commerce side solved my problem, the block is presented properly and is commited/saved properly.

My question is why are we seeing 'displayUI' set to false when adding a local block on a commerce page?  And how do we force it to be true.

SubmitButtonElementBlock.ascx renders class attribute twice

$
0
0

The SubmitButtonElementBlock.ascx in version 4.28.0.0 renders the class attribute twice which causes problems with the styling of this element:

<button id="7e374cd6-a2e7-47f4-a9c1-35cf941ef307" class="" name="submit" type="submit" value="7e374cd6-a2e7-47f4-a9c1-35cf941ef307" data-f-is-finalized="false"
    data-f-is-progressive-submit="true" data-f-type="submitbutton" data-f-element-name="__field_10047"
        class="Form__Element FormExcludeDataRebind FormSubmitButton">
        Submit</button>

How can I submit this as a bug?

Multiple episerver form container views?

$
0
0

Disclaimer: apparently I cannot post links on the forum cause my account hasn't associated to a company

I am following the guide regarding custom forms on develop guides.

It tells you to copy FormContainerBlock.ascx from the zip file to your configured viewpath. It also tells you to use the filename as is. And the controller from which you inherit (FormContainerBlockController) actually has hardcoded the viewpath.

PartialViewResult partialViewResult = this.PartialView("FormContainerBlock", (object) currentBlock);

So you cannot really have multiple views for the formcontainer. Why not have it like the elements that the view will corrospond to the typename of the FormContainer model (or maybe the controller)? Also it could fall back to using FormContainerBlock.ascx if no other is available.

Was this changed, cause there are forum thread here on world that actually states that it load a view corrosponding to the model. But it could also be that an action filter hooks in and change the view path ...

A new block created within a page with workflow should be approved and published at the same time with the page

$
0
0

Our customer found that when a workflow is enabled and you click the "create a new block" link within a ContentArea of a page to build a block, after clicking "Create," it takes you back to the original page/block acting like the block has been published but it has not. This is leading to content authors building pages out with blocks that don't display on the front-end because they're not actually published.

This issue only occurs when the workflow is enabled and when using the "create a new block" link within a Contentarea field.

Later the customer found that the same scenario occurs with the "projects" feature in Episerver as well, so even with workflow disabled, if you're working on content in a project and create a block through the local dropzone link, it results in the same user experience issue where you think the block was set as ready to publish but it's still in draft mode. 

We hope the blocks created within page and project could be approved and published with pages and projects. So the user does not have to publish the blocks separately, since most time, the user does not realize the blocks are not published. 

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?


Block in published page has “This item is not used anywhere.”

$
0
0

I have a scheduled job that loops through all pages of a certain type and creates a block for each page and puts it in a ContentArea.

var newBlockForArea = _contentRepository.GetDefault<CrossLinkContainerBlock>
(assetsFolderForPage.ContentLink, productPageClone.Language);
(newBlockForArea as IContent).Name = "newCrossLinkContainer";

---

var blockReference = _contentRepository.Save((newBlockForArea as IContent), SaveAction.Publish,
AccessLevel.NoAccess);

var newItem = new ContentAreaItem();
newItem.ContentLink = blockReference;
productPageClone.GeneralContentArea.Items.Add(newItem);

When the block is created it is published.

When the page is updated it is either saved or published depending on earlier status.

_contentRepository.Save(productPageClone, SaveAction.ForceCurrentVersion | SaveAction.Publish,
AccessLevel.NoAccess);`

Later when inspecting the page, the block is in the page's assets folder and the block in in the correct ContentArea and it renders correctly. The only problem is that when I edit the block, it says "This item is not used anywhere."

However, then I republish the page the block is in, and then edit the block, it says "Changes made here will affect at least 1 item" as it should.

I am using Episerver 11.11.2.0

I have run the scheduled job manually each time I've tested this.

Has anyone any idea why this is happening?

productPageClone is found like this:

var contentTypes = _contentTypeRepository.List();

var productPageType = contentTypes.Where(x => x.DisplayName != null && x.Name == "ProductPage").FirstOrDefault();

var criterias = new PropertyCriteriaCollection
{
// Find pages of a specific page type
new PropertyCriteria()
{
Name = "PageTypeID",
Condition = CompareCondition.Equal,
Required = true,
Type = PropertyDataType.PageType,
Value = productPageType.ID.ToString()
}
};

// Search pages under root since more than one startpage

var languagesInSite = ServiceLocator.Current.GetInstance<ILanguageBranchRepository>().ListEnabled();

var allPages = new List<PageData>();

foreach (var lang in languagesInSite)
{
// using findallpageswithcriteria to get unpublished pages and bypass security
var pages = DataFactory.Instance.FindAllPagesWithCriteria(
PageReference.RootPage,
criterias,
lang.LanguageID,
new LanguageSelector(lang.LanguageID)
);

allPages.AddRange(pages.ToList());
}
allPages = allPages.OrderBy(x => x.ContentLink.ID).ToList();


// findallpageswithcritera gets pages in wastebasket, filter these out
var pagesNotInWasteBasket = allPages.Where(x => !x.IsDeleted);

for (int i = 0; i < pagesNotInWasteBasket.Count(); i++)
{
var page = pagesNotInWasteBasket.ElementAt(i);

if (page is ProductPage)
{
var productPage = page as ProductPage;
var versionsInLanguage = _contentVersionRepository.List(productPage.ContentLink, productPage.Language.Name);

// get published version if it exists
var publishedVersion = versionsInLanguage.Where(x => x.Status == VersionStatus.Published).FirstOrDefault();

// get latest saved draft
var latestSavedVersion = versionsInLanguage.OrderByDescending(x => x.Saved).FirstOrDefault();

if (publishedVersion != null && publishedVersion.ContentLink.WorkID == latestSavedVersion.ContentLink.WorkID)
{
var publishedPage = _contentRepository.Get<ProductPage>(publishedVersion.ContentLink);
MigrateProperties(publishedPage, true, publishedVersion.IsCommonDraft);
}
else if (publishedVersion != null && publishedVersion.ContentLink.WorkID < latestSavedVersion.ContentLink.WorkID)
{
var publishedPage = _contentRepository.Get<ProductPage>(publishedVersion.ContentLink);
MigrateProperties(publishedPage, true, publishedVersion.IsCommonDraft);

var latestSavedDraftPage = _contentRepository.Get<ProductPage>(latestSavedVersion.ContentLink);
MigrateProperties(latestSavedDraftPage, false, latestSavedVersion.IsCommonDraft);
}
else if (publishedVersion == null)
{
var latestSavedDraftPage = _contentRepository.Get<ProductPage>(latestSavedVersion.ContentLink);
MigrateProperties(latestSavedDraftPage, false, latestSavedVersion.IsCommonDraft);
}
}

Extend the default implementation of PermissionDB.SaveRolesForPermission with overloads allowing custom "ClearByName" and "ClearByPermission" params

$
0
0

The base implementation for PermissionDB.SaveRolesForPermission doesn't allow for customising the "ClearByName" and "ClearByPermission" parmeters passed to the netPermissionSave SP.

When saving permissions, the default implementation requires us to pass in all users in the permission for a save - with ClearByPermission always being 1, it will remove all users with the permission and replace them with the new list of users to save (rather than just add/remove a specific user).

It seems that in Episerver CMS Admin > Permissions For Functions, the approach taken by Episerver is for editing multiple users on one specific permission.

Our desire is to easily edit multiple permissions for one specific user. (An "opposite" design approach).

We would do this by calling netPermissionSave with ClearByName = 1, and ClearByPermission null. This will remove permissions for that specific user, and resave just permissions for that user.

There is no way to customize if ClearByName or ClearByPermission is called with a value, so we need to implement our own custom call to the netPermissionSave DB to achieve the peformance we desire (our own version of PermissionDB & DefaultPermissionRepository). We then need to ensure (for performance reasons) the correct params are used depending on the context/desire of the call.

With a few custom overloads (with default params) in PermissionDB we could easily customise how the call runs for our front end, whilst still leaving the Admin side working as it currently does - without the need for an entirely custom implementation.

Episerver DXP - Trusted Certificates

$
0
0

Hi I have a question from a colleague working on something, I would think it's a no just to Azure but wondering if anyone had any info.

We are wondering if there's any way of intalled a trusted certificate such as how you would in your local Tursted Root Certificates on a local machine. We have some communicate with a Salesforce identity provider that requires the certificate installed and intalling at a the infrastructure level would be useful.

Anyone had any experience of this happening on the DXP?

THanks,

ContentDeliveryApi: System.InvalidOperationException: 'The object has not yet been initialized. Ensure that HttpConfiguration.EnsureInitialized()

$
0
0

Hello,

I have added ContentDeliveryApi (Cms and Core) to my application, but after that I'm receiving an error:

System.InvalidOperationException: 'The object has not yet been initialized. Ensure that HttpConfiguration.EnsureInitialized() is called in the application's startup code after all other initialization code.'

I followed similar topic (https://world.episerver.com/forum/developer-forum/Developer-to-developer/Thread-Container/2017/4/the-object-has-not-yet-been-initialized--ensure-that-httpconfiguration-ensureinitialized/), but none of these solutions did work.

Current configuration

web.config

I have an option to disable MapHttpAttributeRoutes:

<add key="episerver:serviceapi:maphttpattributeroutes" value="false" />

MapHttpAttributeRoutes

I already had one invocation of the MapHttpAttributeRoutes in my application.

That is:

[ModuleDependency(typeof(EPiServer.Commerce.Initialization.InitializationModule))]
public class SiteInitialization : IConfigurableModule
{
   // ...
  public void ConfigureContainer(ServiceConfigurationContext context)
  {
    // ...
    GlobalConfiguration.Configure(config =>
    {
    // ...
    config.MapHttpAttributeRoutes();
    });
  }
}

But, after installation of ContentDeliveryApi packages, I'm receiving this error:

A route named 'MS_attributerouteWebApi' is already in the route collection. Route names must be unique.Parameter name: name

So, it seems there's one more invocation of the MapHttpAttributeRoutes in either EPiServer.ContentDeliveryApi.Cms or EPiServer.ContentDeliveryApi.Core.

When I removed the MapHttpAttributeRoutes from my SiteInitialization, I get the original System.InvalidOperationException (the subject of the thread).

EnsureInitialized

I tried to add EnsureInitialized to my Global.asax.cs, but this didn't resolve the problem.

public class Global : EPiServer.Global
{
  // ...
  protected void Application_Start()
  {
    // ...
    WebApiConfig.Register(GlobalConfiguration.Configuration); // this was already here
    GlobalConfiguration.Configuration.EnsureInitialized(); // newly added, but it didn't help
  }
}

Episerver versions

The .NET Framework is 4.8.

  • EPiServer.Azure: 10.0.1
  • EPiServer.CMS: 11.15.0
  • EPiServer.CMS.AspNet: 11.15.0
  • EPiServer.CMS.Core: 11.15.0
  • EPiServer.CMS.TinyMce: 2.10.1
  • EPiServer.CMS.UI: 11.24.1
  • EPiServer.CMS.UI.AspNetIdentity: 11.24.1
  • EPiServer.CMS.UI.Core: 11.24.1
  • EPiServer.Commerce: 13.18.0
  • EPiServer.Commerce.Azure: 14.0.4
  • EPiServer.Commerce.Core: 13.18.0
  • EPiServer.Commerce.UI: 13.18.0
  • EPiServer.Commerce.UI.CustomerService: 13.18.0
  • EPiServer.Commerce.UI.ManagerIntegration: 13.18.0
  • EPiServer.ContentDeliveryApi.Cms: 2.10.0
  • EPiServer.ContentDeliveryApi.Core: 2.10.0
  • EPiServer.Framework: 11.15.0
  • EPiServer.Framework.AspNet: 11.15.0
  • EPiServer.Logging.Log4Net: 2.2.2
  • EPiServer.Personalization: 1.0.0
  • EPiServer.Personalization.Commerce 3.2.12
  • EPiServer.Personalization.Common: 3.1.0
  • EPiServer.Personalization.MaxMindGeolocation: 1.0.0
  • EPiServer.ServiceLocation.StructureMap: 2.0.3
  • EPiServer.Session: 1.0.0
  • EPiServer.Tracking.Commerce 3.2.12
  • EPiServer.Tracking.Core: 1.14.0

Thank you in advance!

No results in Content Search API

$
0
0

Hello, I have a problem with usage of the Content Search API --

I have installed Content Search API by following instruction at the Episerver World. However, the API yields no results:

{"totalMatching": 0,"results": null}

The configuration of Episerver Find seems to be proper, i.e.:

  • There are Document Types listed in Overview on the Find page.
  • There are results if I'm using Episerver.Find.Client: Client.CreateFromConfig().Search<FindDocument>().GetResult(); // yields proper results.

Now, I tried to use the API in following ways. All yields no results and there's no error in the logs.

Method 1: By using Swagger UI.

Method 2: By using Visual Studio Code Rest API Client.:

### Search
GET {{baseUrl}}/{{v2}}/search/content
?languages=sv
&query=*
Accept: 'application/json'
Accept-Language: *
Authorization: Bearer {{accessToken}}

Method 3: By using the code directly:

var searchResponse = _contentApiSearchProvider.Search(new SearchRequest { Query = "*", }, new List<string> {"sv"});
var contentApiModels = searchResponse.Results?.ToList(); // is null

Using following package versions:

<package id="EPiServer.CMS" version="11.15.0" targetFramework="net48" />
<package id="EPiServer.ContentDeliveryApi.Cms" version="2.10.0" targetFramework="net48" />
<package id="EPiServer.ContentDeliveryApi.Commerce" version="2.10.0" targetFramework="net48" />
<package id="EPiServer.ContentDeliveryApi.Core" version="2.10.0" targetFramework="net48" />
<package id="EPiServer.ContentDeliveryApi.Search" version="2.10.0" targetFramework="net48" />
<package id="EPiServer.ContentDeliveryApi.Search.Commerce" version="2.10.0" targetFramework="net48" />
<package id="EPiServer.Find" version="13.2.6" targetFramework="net48" />
<package id="EPiServer.Find.Cms" version="13.2.6" targetFramework="net48" />
<package id="EPiServer.Find.Commerce" version="11.1.2" targetFramework="net48" />
<package id="EPiServer.Find.Framework" version="13.2.6" targetFramework="net48" />

I tried different variations of the query and request configuration, but none of these solutions yields proper results.

Do you know what might be the cause of that?

Viewing all 6894 articles
Browse latest View live