<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Easy solution for product variations!</title>
    <link>http://forums.shopify.com/categories/1/posts/19044</link>
    <language>en-us</language>
    <description>Feed for discussion topic Easy solution for product variations!</description>
    <item>
      <title>Easy solution for product variations!</title>
      <author>James L</author>
      <pubDate>Fri, 25 Apr 2008 00:36:07 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/19044</link>
      <guid>http://forums.shopify.com/categories/1/posts/19044</guid>
      <description>&lt;p&gt;If you want to add product variations, just like I did &amp;#8211; you can take advantage of my 2-day hunt to find the answer!&lt;/p&gt;


	&lt;p&gt;In your admin section, click Assets. Click Theme Editor and under Templates click cart.liquid.&lt;/p&gt;


	&lt;p&gt;Scroll down the code until you see this:&lt;/p&gt;


&lt;code&gt;&lt;pre&gt;

&amp;lt;h2&amp;gt;You have selected the items below for purchase&amp;lt;/h2&amp;gt;

        &amp;lt;h3&amp;gt;&amp;lt;a href="{{item.product.url}}"&amp;gt;{{ item.title }}&amp;lt;/a&amp;gt;&amp;lt;/h3&amp;gt;
        &amp;lt;span class="money"&amp;gt;{{ item.price | money}} each.&amp;lt;/span&amp;gt;

&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;Now all you need to do is add the following code here&amp;#8230;&lt;/p&gt;


&lt;code&gt;&lt;pre&gt;

&amp;lt;label for="{{ item.title }}"&amp;gt;CHANGE ME 1&amp;lt;label&amp;gt;
   &amp;lt;select name="attributes[{{ item.title }}]" id="{{ item.title }}"&amp;gt;
   &amp;lt;option value="CHANGE ME 2" 
       {% if cart.attributes.item.title ==  "CHANGE ME 2" %} checked="checked" {% endif %} CHANGE ME 2 &amp;lt;/option&amp;gt;
    &amp;lt;option value="CHANGE ME 3" 
       {% if cart.attributes.item.title ==  "CHANGE ME 3" %} checked="checked" {% endif %} CHANGE ME 3 &amp;lt;/option&amp;gt;
&amp;lt;/select&amp;gt;

&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;For more options in the drop down, keep adding:&lt;/p&gt;


&lt;code&gt;&lt;pre&gt;

&amp;lt;option value="CHANGE ME 2" 
       {% if cart.attributes.item.title ==  "CHANGE ME 2" %} checked="checked" {% endif %} CHANGE ME 2 &amp;lt;/option&amp;gt;

&lt;/pre&gt;&lt;/code&gt;before &amp;lt;/select&amp;gt;

	&lt;p&gt;Make sure to keep all &amp;#8220;CHANGE ME&amp;#8221;s that end in the same number the same as each other. So all three &amp;#8220;CHANGE &lt;span class="caps"&gt;ME 2&lt;/span&gt;&amp;#8221; should become the same word.&lt;/p&gt;


	&lt;p&gt;You can add another drop-down list just by copying the first code snippet, and customizing again.&lt;/p&gt;


	&lt;p&gt;After a purchase, if you go to your Orders page, the results from the drop-down menus will be shown in the orange &amp;#8220;note&amp;#8221; box.&lt;br /&gt;Each result will be named as the exact product type it refers to, so it is easy to match it up!&lt;/p&gt;


	&lt;p&gt;Extra hint: If you have two drop-downs like I do (Fabrics and Colours), just add the word Fabric to the 1st form select label, and Colour to the second select label. So this:&lt;/p&gt;


&lt;code&gt;&lt;pre&gt;

&amp;lt;label for="{{ item.title }}"&amp;gt;

&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;will look like this:&lt;/p&gt;


&lt;code&gt;&lt;pre&gt;

&amp;lt;label for="{{ item.title }} Colour"&amp;gt;

&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;Just makes it easier to tell the difference at a glance.&lt;/p&gt;


	&lt;p&gt;Hope you enjoy guys!&lt;/p&gt;


	&lt;p&gt;James&lt;/p&gt;</description>
    </item>
    <item>
      <title>James MacAulay commented</title>
      <author>James MacAulay</author>
      <pubDate>Wed, 07 May 2008 23:47:50 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/19044#comment-19465</link>
      <guid>http://forums.shopify.com/categories/1/posts/19044#comment-19465</guid>
      <description>&lt;p&gt;That looks nifty, great work! It doesn&amp;#8217;t look like it would really persist past the user clicking to update the cart, though, since this code&amp;#8230;&lt;/p&gt;


&lt;code&gt;&lt;pre&gt;
{% if cart.attributes.item.title ==  "CHANGE ME 2" %}
&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;...wouldn&amp;#8217;t reference &lt;code&gt;item.title&lt;/code&gt; correctly because it would take &lt;code&gt;cart.attributes.item.title&lt;/code&gt; to be a literal attribute called &amp;#8220;item.title.&amp;#8221; Or am I wrong?&lt;/p&gt;</description>
    </item>
    <item>
      <title>HunkyBill commented</title>
      <author>HunkyBill</author>
      <pubDate>Thu, 08 May 2008 00:26:57 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/19044#comment-19466</link>
      <guid>http://forums.shopify.com/categories/1/posts/19044#comment-19466</guid>
      <description>&lt;p&gt;Hi,&lt;/p&gt;


	&lt;p&gt;I remember talking James through this one. He started with the basics, advanced some, and through persistance came up with his code here. It has numerous obvious problems, that I neglected to point out, but hey, he was on a roll. In fact, he went from an &lt;strong&gt;IF&lt;/strong&gt; statement with 40 &lt;strong&gt;ELSE&lt;/strong&gt; cases, to a &lt;strong&gt;CASE&lt;/strong&gt; statement with 40 possible &lt;strong&gt;WHEN&lt;/strong&gt; conditions, to this&amp;#8230;so he was justifiably proud.&lt;/p&gt;


	&lt;p&gt;Why on earth would you, as a &lt;strong&gt;SHOPIFY &lt;span class="caps"&gt;DEVELOPER&lt;/span&gt;&lt;/strong&gt; post to this with the question &lt;strong&gt;Or am I wrong?&lt;/strong&gt;.&lt;/p&gt;


	&lt;p&gt;You think we, the &lt;em&gt;community&lt;/em&gt;, will hesitate to jump on you and not ask the &lt;strong&gt;obvious&lt;/strong&gt; question, &lt;strong&gt;If you don&amp;#8217;t know what you&amp;#8217;re doing, how can you expect us to stick with you?&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Are you &lt;strong&gt;wrong?&lt;/strong&gt; here James. Do you really not know your own Shopify? Hehehehe&amp;#8230;..&lt;/p&gt;


	&lt;p&gt;Just having a little fun.. poking the dog with a stick&amp;#8230;maybe he&amp;#8217;ll growl&amp;#8230; maybe he&amp;#8217;ll bite&amp;#8230;rrrrr&amp;#8230; nice doggy&amp;#8230;&lt;/p&gt;</description>
    </item>
    <item>
      <title>puniour commented</title>
      <author>puniour</author>
      <pubDate>Thu, 08 May 2008 02:27:17 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/19044#comment-19468</link>
      <guid>http://forums.shopify.com/categories/1/posts/19044#comment-19468</guid>
      <description>&lt;p&gt;Hey James,&lt;/p&gt;


	&lt;p&gt;When I goto &amp;#8220;Templates click cart.liquid&amp;#8221;, I dont see the code that you described? why?&lt;/p&gt;</description>
    </item>
    <item>
      <title>tobi commented</title>
      <author>tobi</author>
      <pubDate>Thu, 08 May 2008 14:10:54 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/19044#comment-19483</link>
      <guid>http://forums.shopify.com/categories/1/posts/19044#comment-19483</guid>
      <description>&lt;p&gt;HunkeyBill: I wrote most of the original code for Shopify and probably still log most surviving lines of code in the codebase as well as 100% of liquid but you are way ahead of me in terms of clever liquid applications :-)&lt;/p&gt;</description>
    </item>
    <item>
      <title>James L commented</title>
      <author>James L</author>
      <pubDate>Fri, 09 May 2008 01:15:04 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/19044#comment-19493</link>
      <guid>http://forums.shopify.com/categories/1/posts/19044#comment-19493</guid>
      <description>&lt;p&gt;Hey, looks like my old post finally got some attention!!&lt;/p&gt;


	&lt;p&gt;Thanks James &amp;#8211; I think it&amp;#8217;s nifty too :) but you&amp;#8217;re right, it doesn&amp;#8217;t stay put after an Update Cart.&lt;/p&gt;


	&lt;p&gt;Thanks again HunkyBill for even responding, and then helping me too &amp;#8211; very kind of you. &lt;span class="caps"&gt;BTW&lt;/span&gt;, aside from the Update Cart issue which resets the selection boxes, what other problems are there?&lt;/p&gt;


	&lt;p&gt;puniour &amp;#8211; The code might not be exactly the same in different themes. The one I am using is Tangerine but at the time of posting the instructions, I could have been using Summersteps. (I changed themes as Summersteps was not playing nicely) If you are having issues try changing themes.&lt;br /&gt;Anyway, the code is still the same, it&amp;#8217;s just a case of where to put it.&lt;/p&gt;


	&lt;p&gt;Tobi &amp;#8211; you are a legend. Shopify is great. Just thought it had to be said.&lt;/p&gt;


	&lt;p&gt;: }}&lt;/p&gt;


	&lt;p&gt;P.S. Not finished yet, but this is my site showing the drop-downs:&lt;br /&gt;&lt;a href="http://m-interiors.myshopify.com/"&gt;http://m-interiors.myshopify.com/&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Just add items to your cart to test them out.&lt;/p&gt;</description>
    </item>
    <item>
      <title>James L commented</title>
      <author>James L</author>
      <pubDate>Fri, 09 May 2008 01:36:23 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/19044#comment-19494</link>
      <guid>http://forums.shopify.com/categories/1/posts/19044#comment-19494</guid>
      <description>&lt;p&gt;... Thought I&amp;#8217;d add a screenshot to show how the order looks when it comes through.&lt;/p&gt;</description>
    </item>
    <item>
      <title>James L commented</title>
      <author>James L</author>
      <pubDate>Fri, 16 May 2008 23:28:50 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/19044#comment-19724</link>
      <guid>http://forums.shopify.com/categories/1/posts/19044#comment-19724</guid>
      <description>&lt;p&gt;Does anyone know how to add these results to an email (formatted).&lt;/p&gt;


	&lt;p&gt;I can add them, but they come through as one long line of text, very hard to read, e.g. colourredfabricarizona&lt;/p&gt;


	&lt;p&gt;Is it possible to automatically format the attributes, similar to how they look in the &lt;span class="caps"&gt;RSS&lt;/span&gt;?&lt;/p&gt;


	&lt;p&gt;More like this&amp;#8230;&lt;/p&gt;


	&lt;p&gt;Colour: Red&lt;br /&gt;Fabric: Arizona&lt;/p&gt;</description>
    </item>
    <item>
      <title>HunkyBill commented</title>
      <author>HunkyBill</author>
      <pubDate>Sat, 17 May 2008 18:57:35 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/19044#comment-19729</link>
      <guid>http://forums.shopify.com/categories/1/posts/19044#comment-19729</guid>
      <description>&lt;p&gt;@JamesL&lt;/p&gt;


	&lt;p&gt;If your email is sent as plain text, the tab and newline characters will help&amp;#8230;. they are &amp;#8221;\t&amp;#8221; and &amp;#8221;\n&amp;#8221; respectively. I think this is the case, but I am not 100% on that.. try it..&lt;/p&gt;</description>
    </item>
    <item>
      <title>James L commented</title>
      <author>James L</author>
      <pubDate>Sun, 18 May 2008 00:34:37 +0000</pubDate>
      <link>http://forums.shopify.com/categories/1/posts/19044#comment-19732</link>
      <guid>http://forums.shopify.com/categories/1/posts/19044#comment-19732</guid>
      <description>&lt;p&gt;I can&amp;#8217;t add tabs or line breaks, I&amp;#8217;m just pulling the info from my drop-downs, which is something like {{ attributes.etc }}&lt;/p&gt;


	&lt;p&gt;Another question, is is possible for my drop-downs to only show up, when items in the cart belong to a certain collection. I don&amp;#8217;t know how to do this in liquid, but it sounds possible.&lt;/p&gt;


	&lt;p&gt;I would only need a simple if/else, as the drop-downs should only be invisible for 1 category.&lt;/p&gt;


	&lt;p&gt;What I&amp;#8217;m after is&amp;#8230;&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;if&lt;/strong&gt; the product in the cart belongs to collection A, show the following, &lt;strong&gt;else&lt;/strong&gt;... don&amp;#8217;t!&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
