How to remove a rule based promotion from a cart? - sap-commerce-cloud

I have a rule based promotion applied on my cart.
On the basis of an order entry containing a specific product I want to remove the promotion from the cart.
I tried the method in CartController but it didn't work with the rule based promotion.
How do I go ahead with this?

This is not something that can/should be solved in the CartController. Even if you remove the promotion there, once a recalculation triggers, the promotion will be there again.
You should solve this in the conditions of your promotion. However, out of the box it's not possible to combine include and exclude conditions on qualifying products/categories.
You could look into creating a custom condition, depending on your requirements

Related

Is is possible to check the lot number in Netsuite Inventory Detail against a value defined at the work order level?

We are having an issue with our team members entering completions for the wrong lot number. Does anyone know of a way to have the inventory detail sub-menu check against a lot number value assigned when creating the work order?
Lot number does not seem to be a native field when generating work orders, so I created a custom field for it, which seems to work okay and will propagate through the rest of the document chain, however, I do not have a guess at how to check inventory detail values against this field.

gitlab issue filtering - how to OR filter rather than AND

Gitlab issue filtering seems to default to AND filtering if you have multiple criteria against the same filter object (eg. label). For instance, if you have labels vehicle::car, vehicle::truck, vehicle::motorcycle, if you want to see vehicle::car OR vehicle::truck, if you put label=vehicle::car label=vehicle::truck, it will show nothing.
Is there any way to get around this this?
Thanks
Not possible for the moment. From their documentation on section Filtering with multiple filters of the same type:
When you filter with these multiple filters of the same type, the AND
logic is applied. For example, if you were filtering assignee:#sam
assignee:#sarah, your results include only entries whereby the
assignees are assigned to both Sam and Sarah are returned.
There are some requests for this functionality:
I want to filter on multiple filter labels
All filters should allow the ability to provide an OR condition
Some users suggested that if you add labels in the URL using a comma, e.g. &label_name=A,B it will work. However, I wasn't been able to get this working, had multiple attempts. Let me know if you you are able to make it work.

Kentico - Adding multiple discounts

I'm using Kentico version 8.2, and am trying to allow a user to enter multiple coupons. In the ECommerceContext.CurrentShoppingCart object you have a ShoppingCartCouponCode that you can set. This then adds this coupon to the Discounts collection on that object.
If I change the ShoppingCartCouponCode to something else, then the Discount collection gets recreated with a single item of the new discount again, and loses the old discount.
If I store a copy of the discount collection, then apply the new coupon entered, and then append the copied collection to the new generated Discount collection then that works for only a couple of discounts. I am concerned that doing it this way will cause issues elsewhere.
So has anyone implemented this functionality before and how did/would you go about it?
EDIT: Although it seems like Product Coupons should allow you to do this, they don't work quite the way you would think. When a Product Coupon is applied to the cart, the ShoppingCartDiscountCouponID field for that cart's record in COM_ShoppingCart is updated to include a foreign key reference to the ID of discount coupon in COM_DiscountCoupon. So there can definitely be only one Product Coupon applied to the cart at any one time.
So instead of being a discount on a particular product, they seem to be more like flags that allow you to apply discounts to the entire cart if a particular product is in the cart and the correct coupon code is entered.
However, that doesn't mean we can't do some customization to achieve this affect ourselves. Our first step will be to change the ShoppingCartContent control in CMSModules > Ecommerce > Controls > ShoppingCart to allow multiple coupon codes to be entered. That's the easy part.
The second part is to change how discounts and carts are associated. This could require modifying Kentico's system tables, so do so at your own risk. You'll basically want to decouple foreign key reference from the COM_ShoppignCart table and create a many-to-many relationship between carts and discounts. Personally, I would leave the system tables and API alone and just create another custom table that mapped CartIDs to DiscountIDs (you will probably have to do the same with Orders, too since cart data is applied to order data when an order is created).
The last part is changing how discounts are actually calculated.
Earlier I suggested creating a custom DiscountCouponInfoProvider. Turns out, what you actually want to do is create a custom ShoppingCartInfoProvider and override one of the following methods:
CalculateOrderDiscount()
CalculateItemsDiscount()
I apologize if this isn't descriptive enough, but this will be a significant modification to how Kentico handles Product Coupons, so I don't have a lot of time to get into specifics. However, I would estimate that it would take a least a few weeks to accomplish.
old answer
Hmm, you could create discounts that represent combinations of two or more discounts and apply those if a user selects the right combination.
Or, what I would prefer if I had the time to build it, would be to create a custom DiscountCouponInfoProvider that changes how discounts are applied.M

Remove a button in SuiteScript

I need to be able to remove the delete button when today is greater than a particular calculated date.
There are 2 ideas I had and issues with each:
1 - Set a custom field on the record for the particular calculated date. Then use a workflow action of Remove Button where the custom field is <= today. My issue is I am wondering if there is a way to get "today" because I expected the condition to change allowing me to do that. I tried to use a formula and can't find Now() as a valid function listed.
2 - Workflow are truly scripts in the background. That means the Remove Button should be available in API. Therefore, my idea was to do my conditioning in suite script and then call this function. However, this function also does not exist in supported form. Has anyone hacked this to find what the function that is called in Remove Button is?
If we can get either idea to work, or if you have a third I haven't thought of that accomplishes the same task, that would be great.
I figured out my own answer. In case someone else ever needs this (as I didn't see anything like this on stack overflow), here is how to do option #1:
Save the value to a custom field - custbody_block_dlt_date
In a workflow, use the Remove Button function and use a formula condition
The condition is: {custbody_block_dlt_date} < sysdate
"sysdate" is the way you can get "Now()" or "today" in the condition
An alternative could be to create a User Event Script, on the before load function, get the button object then use the .setVisible(visible) method to hide it based on a date criteria, you may also want to set other restrictions based on roles that allow certain individuals to still be able to delete the record, like high positioned accountants. That avoids creating unnecessary fields on your records, while still providing the functionality that you desire. This could easily be done in < 4 lines of JavaScript.
See nlobjButton for examples.

SharePoint: Unique column values

I Want to have only unique values in a SharePoin List. To achieve this I can use 'ItemAdding' event handler as mentioned in the below link.
http://weblogs.asp.net/vikram/archive/2008/12/24/sharepoint-using-event-handler-to-make-a-column-unique.aspx
Now I have a Doubt: Suppose that two user tries to add list Item in the list with the same column value(which requires unique value) at the same Time. will ItemAdding event would be fired at the same time for both call? If so then there is a possibility that two items having same value in the column. Please confirm.
I think, this method allows you only to have semi-unique values in the column. That is, if everything is normal, it will be unique. However, you cannot compare the properties of two items being added simultaneously (and yes, it may happen, since IIS web server is multi-threaded). Hence you might have duplicate values as a result.
A workaround - implement a "ItemAdded" event handler, too and delete a newly added item, if it has that property the same as some other existing item. This will, of course, happen very rarely.
If you have enough concurrent users that this is likely to be a problem, SharePoint probably isn't the right tool for the job. If the value is created by the user, it is extremely unlikely that two users will be adding the same value at the same time. If it is automatically generated, you probably should be using something based on ID, which is known to be unique.
If you are worried about the possibility of duplicates anyway, just make sure that the field can be edited if you do end up with duplicates causing problems.

Resources