Is there a place in the Product table - or any table that matter - that I can display the store locations where a product may be at for customers to view?
Thank you in advance,
~D
Is there a place in the Product table - or any table that matter - that I can display the store locations where a product may be at for customers to view?
Thank you in advance,
~D
There's no field specifically for that 'out of the box', but each product record in the DB has extra 'ExtensionData' fields that we put in there exactly for this kind of need. You'd have to do a little XML package customization to have that info displayed on the front-end, but that's a pretty small mod. Then just store the information in that extra field.
Thanks, Scott. . . So, say if we have obviously more than one location, I could enter each location, seperated by a comma and then display that in the XML package. I could then pass the SKU (or grab the SKU) and display each location that particular product is located?
Donato,
It sounds like it might be beneficial to store each location as an XML node in the Extension Data field. For example:
That allows one to potentially treat each location as a separate variable.Code:<locations> <loc1>Paris</loc1> <loc2>Rome</loc2> <loc3>Westlake</loc3> </locations>
In the XML package, add the following query:
In the product template <xsl:template match="Product"> parameters, one could use:Code:<query name="ExtensionData" rowElementName="Product" retType="xml"> <sql> <![CDATA[ SELECT Product.ProductID, CONVERT(xml, ExtensionData) MyExtensionData FROM Product WHERE Product.ProductID = @ProductID FOR xml path('Product') ]]> </sql> <queryparam paramname="@ProductID" paramtype="request" requestparamname="ProductID" sqlDataType="int" defvalue="0" validationpattern="" /> </query>
After that, the variables can be referenced easily.Code:<xsl:param name="Loc1"><xsl:value-of select="/root/ExtensionData/Product/MyExtensionData/locations/loc1" disable-output-escaping="yes" /></xsl:param> <xsl:param name="Loc2"><xsl:value-of select="/root/ExtensionData/Product/MyExtensionData/locations/loc2" disable-output-escaping="yes" /></xsl:param> <xsl:param name="Loc3"><xsl:value-of select="/root/ExtensionData/Product/MyExtensionData/locations/loc3" disable-output-escaping="yes" /></xsl:param>
Hope this helps.
Thanks man! So, if I store our StoreID's in one of the fields, like ExtensionData or somehting, and seperate them by a comma, how would I go about matching those StoreIDs to a node? I thought about a case statement, but I am not sure if that will work in XML or if that is even the way to go. Sorry, but I am fairly new to XML.
Thanks again!
~D