I have created some products in the way Tea Commerce setup the products.
So I have created them like this: Product 1 - size 32 - size 32½ - size 33
and the same for other products.
But I want to reuse the values, so I don't have to created them below each products. The suggestion you mention might work, but then products have the same options. I think some of the shoes are available in more sizez than others.
I use the Dropdownlist multiple datatype, I just wondering how to pull the selected values. Then I could use these values in my frontend dropdownlist.
While I fully respect your way of doing this, I think I would do it like Rich explained. However, I would make use of the Umbraco Relationship API. So the structure would be like this:
Then when you make a new shoe, you can relate this to the sizes it's available in and pull that info from XSLT/ASP.NET UserControls. Of course, this approach seems quite complex at first, but when the relations are set up, it's really neat!
For easier management of your relations I can only recommend Hendy Rachers RelationType package which can be found here
when I have selected 32 and 33 in my multiple dropdown property.
The option value is not quite correct, as it's the same id I get... I need someway to have an unique id for the node and the selected value. In Tea Commerce each variant has it's own node, but I only have a node for the product.. I don't know if there's some way to compare the node and the selected value from frontend dropdown. So when I add to product to the cart, I get something like "Produkt 1 - size 32" in my order line.
How to get selected dropdown multiple values
I use the datatype dropdown multiple, where I have created some values for shoe sizes as shown below.
How can I get the selected values in backend, so I can use these values in a dropdown in frontend?
e.g. if you have choosen size 32 and 33, these values will be the output, so I can use them in a frontend dropdown.
Hi Bjarne,
There's are otherways of doing this but I never use the Data Types for this type of thing.
Instead I create a separate section of the site where I hold values for this, this also means the client can edit them if needed, so:
- Content
- Website
- Home
- Products etc.
- Settings
- Shoe Sizes
- 32
- 32 1/2
- 33
Then in the XSLT you can pull the values from the settings section.
If you want to use the Umbraco data type then there's one set up for you
Rich
Thanks for your answer.
I have created some products in the way Tea Commerce setup the products.
So I have created them like this:
Product 1
- size 32
- size 32½
- size 33
and the same for other products.
But I want to reuse the values, so I don't have to created them below each products. The suggestion you mention might work, but then products have the same options. I think some of the shoes are available in more sizez than others.
I use the Dropdownlist multiple datatype, I just wondering how to pull the selected values. Then I could use these values in my frontend dropdownlist.
Hi Bjarne,
While I fully respect your way of doing this, I think I would do it like Rich explained. However, I would make use of the Umbraco Relationship API. So the structure would be like this:
- Content
- Site
- Products
- Shoes
- Nike Shox
- Settings
- Sizes
- 32
- 32½
- 33
Then when you make a new shoe, you can relate this to the sizes it's available in and pull that info from XSLT/ASP.NET UserControls. Of course, this approach seems quite complex at first, but when the relations are set up, it's really neat!
For easier management of your relations I can only recommend Hendy Rachers RelationType package which can be found here
Maybe this post may help you getting all values from a dropdown datatype (may need to tweak the code a bit...)
Cheers,
/Dirk
Thanks for your suggestions.
I have the following i my XSLT:
<select class="chooseVariant">
<option value="0">
Choose: <xsl:value-of select="productVariantName"/>
</option>
<xsl:variable name="variantList" select="umbraco.library:Split(productSize, ',')/value" />
<xsl:if test="productSize != ''">
<xsl:for-each select="$variantList">
<option value="{$currentPage/Produkt/@id}">
<xsl:value-of select="current()"/>
</option>
</xsl:for-each>
</xsl:if>
</select>
which give me this in frontend:
when I have selected 32 and 33 in my multiple dropdown property.
The option value is not quite correct, as it's the same id I get... I need someway to have an unique id for the node and the selected value.
In Tea Commerce each variant has it's own node, but I only have a node for the product.. I don't know if there's some way to compare the node and the selected value from frontend dropdown. So when I add to product to the cart, I get something like "Produkt 1 - size 32" in my order line.
is working on a reply...