Hi all Sorry if this has been answered elsewhere but i am unable to find a solution. I have added 2 checkout attributes and i want the second one to be dependent on the first answer using the conditions tab. However when I try to add a condition, it says "No attribute exists that could be used as condition". Just wondering if I have missed something in my setup. I am on V4.1. Thanks
The first attribute in which the second attribute is to be dependent must have the control type of either 1) dropdown 2) radio button 3) checkbox 4) color square
if there are no attributes with the above control type then you would get the message "No attribute exists that could be used as condition". It is because other attribute types like textbox, multiline textbox are of free entry types and it would be difficult to put conditions on the free entry values and thus NopCommerce does not support it.
You need to save the checkout attribute before you can edit conditional attributes.
The user will get the message like "Please save the checkout attribute before you can edit conditional attribute " in case the attribute has not been saved.
Hi Sanju Thank you for the reply. My first checkout attribute is a drop list with "Yes" and "No" as the possible values. However the second attribute still has "No attribute exists that could be used as condition." come up when I try to add a condition.
Ok, I just downloaded 4.1 and tested and I found a similar issue. When I debugged the solution I found a bug in the code which prevents the conditional attribute to be loaded. There is an unnecessary guard block implemented in the
PrepareConditionAttributesModel()
method of the
CheckoutAttributeModelFactory
class. You need to remove the guard block which validates the enable condition.
if (!model.EnableCondition) return;
The enable condition value is determined on the basis of
conditionattributesxml
being null or not. It is always null when created so the code flow will never proceed forward where the condition model is prepared. So you need to remove the guard block from the code.