Developer forum

Forum » Ecommerce - Standard features » How to reach the EcomProductItems > ProductItemRequired value?

How to reach the EcomProductItems > ProductItemRequired value?

Peter Leleulya
Reply

Hi guys,

I have some troubles to get some data to my template.
On a product detail page of a BOM product I show the underlying products (Bill of material).
This list consists of BOMProductItems and BOMConfigurators, which both are available throug a template loop.

When I throw the available tags within the loops I am provided with the following:

BOMProductItems:
Ecom:Product.Item.ID            System.String    PRODITEM0001
Ecom:Product.Item.Name            System.String    Some name 1
Ecom:Product.Item.NoneSelected.Text    System.String    
Ecom:Product.Item.Quantity        System.Double    1

BOMConfigurators:
Ecom:Product.Configurator.ID        System.String    PRODITEM0002
Ecom:Product.Configurator.Name        System.String    Some name 2
Ecom:Product.Configurator.Quantity    System.Double    1
Ecom:Product.Configurator.Selected    System.String    

This data corresponds to the database table dbo.EcomProductItems.
This table contains a column "ProductItemRequired" which is filled by our import and this value is needed in the frontend.
But I can't seem to find this data and I'm not sure if, where and how to extend something to get to this data.

Does anybody have a clue?

Kind regards,
Peter.


Replies

 
Peter Leleulya
Reply

I now use this function to determine if a productitem is required.
It doesn't feel right though ...
It would help if there would be a GetProductItemByID method available ....
(Adding the Required boolean to the ProductItem object would even be better)
 

    public static bool ProductItemIsOptional(string productId, string productItemId)
        {
            var result = false; // default

            var product = Product.GetProductByID(productId);
            if (product == null) return false;
            var productItemCollection = ProductItem.getProductItems(product);
            if (productItemCollection == null) return false;
            var productItem = productItemCollection.SingleOrDefault(pi => pi.ID.Equals(productItemId));
            if (productItem != null) {result = !productItem.Required;}

            return result;
        }

 
Nicolai Høeg Pedersen
Reply

Well, the API does not have anything that does this for you - so this is your best option for now...

 

You must be logged in to post in the forum