New Condition To Add Discount If Another Product Is Present Aside From The Action List

Hi,
image

Currently we have a discount that reduces the price of certain products in a list called Test with a condition that for orders with order row total with VAT is >= 1.0.

This works fine but if the user adds the product in the action list Test, the discount is applied, which is normal. We would like to add another condition that this discount should only apply if there’s another product added in the cart.

I think this will work if we add the condition “Cart contains product from category” but we have so many categories to add.

Is there a way somehow that we could add a condition that adds the Test list instead and that it will take effect if another product is added other than that from the Test list.

Please advise.

Thanks in advance

Litium version: 7.6.1

You could create a second list and put all other products that you want to have the condition based on in it and set if you choose any product from that list in this case.

1 Like

Thanks for the reply.

In our case it’s basically all products except for the few in the list.
I tried making a Simple list and it is a very tedious manual job to select thousands of product. There’s no select all button as well.
I tried making a Smart list however it seems that you could not remove the products in the smart list that you would want to be not included.

There might be a way to create a list of products easily that I may not be aware of. Please advise.

Oh wait, I found a way to highlight everything in the Simple list by clicking shift. It takes a while to add everything but this may do.

Hi,

Another solution is that you create a new field and add to all products (all the field templates). Only the products that you will exclude will have some value for this field. You create a smart list with condition like “all the products not having a value in this new field”.

1 Like

Hi Steve,

Your suggestion works very well but I have a follow-up question.

We have a situation that we could not add everything in the list, is there somehow that we can add a custom condition that is “all products but NOT the products in this list” via the ProductConditionType?

I tried and have this as a start

protected override IEnumerable<FilteredOrderRow> Evaluate(ConditionArgs conditionArgs)
{
            if (m_data.FilterRows)
            {
                return conditionArgs.FilteredOrderRows.Any(product => product.ProductSetIDs.Except(m_data.ProductSetIDs).Any())
                    ? Enumerable.Empty<FilteredOrderRow>()
                    : conditionArgs.FilteredOrderRows.Where(product => product.ProductSetIDs.Except(m_data.ProductSetIDs).Any());
            }
            else
            {
                return conditionArgs.OrderRows.Any(product => product.ProductSetIDs.Except(m_data.ProductSetIDs).Any())
                    ? Enumerable.Empty<FilteredOrderRow>()
                    : conditionArgs.OrderRows.Where(product => product.ProductSetIDs.Except(m_data.ProductSetIDs).Any());
            }
 }

but I could not make it to work. I’m not really sure if what I’m doing is correct or is this possible.

Please advise.

Thanks in advance

Upon thorough check I found out that the ProductSetIDs is the ProductList id and not ProductIds. I may have to get the products inside this list and filter everything.

Yes but then there will be too many lists to keep track of, maybe better to also have some field with type boolean attached the products so you can differentiate on?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.