Developer forum

Forum » Ecommerce - Standard features » Accessing Campaign names with ProductViewModel

Accessing Campaign names with ProductViewModel

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

Is there any way I can access the campaign the product is attached to?

I know there is a Discount property on the ProductViewModel Class but there seems to be no information about the Name of the discount.

Thank you,

Adrian


Replies

 
Nicolai Pedersen
Reply

Nope - currently not. The discount property is the discount as a price. The discount can come from more than one discount, so if we give you something to get that information, it will be a list of discounts. 

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

I understand the challenges. But the customer's request to display an active campaign name as a badge on a product is a valid request and we cannot ask the admin to always edit a custom field on the product with the name of the active campaign. Especially since we are already providing a few fields on each Discount

That's why I was thinking that we may be able to get the discount information as a list of active campaigns based on the Product Discounts that are set in the product.

It can be a different property than the Discounts (where the focus is on the prices).

I can think of a few properties that would be useful to get on a product that is assigned to one or more (active) discounts:

  • Campaign name
  • Campaign Description
  • Valid from
  • Valid to
  • Image
  • Benefit (percentage or amount)

This way we can enrich the product information without having to make extensive price calculations.

If there is a method in the API to get Campaigns by ProductID we can also use that.

Thank you,

Adrian

 

 

You must be logged in to post in the forum