Skip to content

Enabling and Disabling Entities

Relewise has a .NET SDK which, among other things, will make implementing tracking very easy.
It is available via NuGet.

Start by making a ITracker-instance.

csharp
ITracker tracker = new Tracker(new Guid("00000000-0000-0000-0000-000000000001"), "your api key", "server-url");

Read more about how to authenticate against our API here.

Enable and Disable Products

In Relewise, disabling an entity refers to removing the entity from search results and recommendations, without removing the entity from the database itself.

While an entity is disabled, its tracking statistics and associated behavioral tracking is saved and kept by Relewise. This tracking data is kept for three months before the disabled entity is automatically deleted from Relewise.

This is to allow products to be temporarily cycled out of availability, such as if it is out of stock or similar, without losing the tracking data for the product or variant.

 

Use ProductAdministrativeAction to alter the properties of a product or variant:

csharp
tracker.Track(
    new ProductAdministrativeAction(
        Language.Undefined, Currency.Undefined, new FilterCollection(
            new ProductIdFilter("productId")
        ), ProductAdministrativeAction.UpdateKind.Disable
    )
);

To disable or enable a specific variant, make sure you specify both the productId as well as the variantId. Remember that variant ids are only unique on product level.

csharp
tracker.Track(
    new ProductAdministrativeAction(
        Language.Undefined, Currency.Undefined, new FilterCollection(
            new ProductIdFilter("productId"), new VariantIdFilter("variantId")
        ), ProductAdministrativeAction.UpdateKind.None, ProductAdministrativeAction.UpdateKind.Disable
    )
);

The above examples show how to disable a product; to enable them, simply use the UpdateKind.Enable instead. You can read more about the various update kinds in our API Reference.

Don't know us? Don't worry - you can find more information about us, by visiting our main page www.relewise.com