public static class ProductAttributeExtensions { /// <summary> /// A value indicating whether this product variant attribute should have values /// </summary> /// <param name="productVariantAttribute">Product variant attribute</param> /// <returns>Result</returns> public static bool ShouldHaveValues(this ProductVariantAttribute productVariantAttribute) { if (productVariantAttribute == null) return false;
based on the above code if the attributecontroltype is datepicker it returns false and doesnt try to parse the datepicker type productvariant attributes
couls someone explain the reasoing behind this behavior?
Values in this context means individual records to choose from. Textbox, multiline, and datepicker all have entered info and are not selected from a predefined list.
This function is used by the Parser and Formatter to determine if the value that control holds is an ID for a record or something the customer actually typed in.
It's funny that you ask, I was just creating a new AttributeControlType today that is a variation of DatePicker....
var caValuesStr = _checkoutAttributeParser.ParseValues(checkoutAttributes, ca1.Id);
This is pulled from ShoppingCartService. checkoutAttributes is the XML of all the attributes and the Id is what Attribute you want. The result is a IList<string>. DatePicker should always have a single entry so you would verify the Count() > 0 and then use caValueStr[0].
wait is this a checkout attribute or a product variant attribute? my question was for a pva..
i am using nop 2.3, any dependencies on 2.4 -2.6 in the code you posted?
lemme try parsing those values myself using ids. i basically need them to make changes to the subtotal based on the number of days i plan on having two datepickers as checkin and checkout for a hotel(product)