does nop not store the values of type datepicker product attributes?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
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;

            if (productVariantAttribute.AttributeControlType == AttributeControlType.TextBox ||
                productVariantAttribute.AttributeControlType == AttributeControlType.MultilineTextbox ||
                productVariantAttribute.AttributeControlType == AttributeControlType.Datepicker)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
    }


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?
11 years ago
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.
11 years ago
andy, i have a followup question..

how do i access the values entered into those productVariantAttributes? say a datepicker
11 years ago
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].
11 years ago
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)
11 years ago
My example was a CheckoutAttribute but the idea should be the same.  I'm also on 2.3.
11 years ago
ahh, you beat me to it! i should have started typing in things into visual studio before asking u moronic questions

yes i see those services, its all tehre :)
Thanks~!
ill bug you again if i get stuck,

regards,
-noob
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.