<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Getting the default option of a ubercart product attribute</title>
	<atom:link href="http://www.klunde.net/2009/02/20/getting-the-default-option-of-a-ubercart-product-attribute/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.klunde.net/2009/02/20/getting-the-default-option-of-a-ubercart-product-attribute/</link>
	<description>www.klunde.net</description>
	<lastBuildDate>Mon, 21 Jun 2010 10:45:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kristian Lunde</title>
		<link>http://www.klunde.net/2009/02/20/getting-the-default-option-of-a-ubercart-product-attribute/comment-page-1/#comment-1129</link>
		<dc:creator>Kristian Lunde</dc:creator>
		<pubDate>Sat, 11 Apr 2009 09:04:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.klunde.net/?p=262#comment-1129</guid>
		<description>Hi Ben

Yes that is also a soltution to it, but it is definitely not the optimal way to go about it. I am pretty sure this is a bug in the Ubercart module.

No you are right, I did not, I added this piece of code in my node-product.tpl.php template (which is the template file of my products). I added this before printing out the size selector and cart button, as you can see in my example below.

&lt;pre lang=&quot;php&quot;&gt;
//get all attributes related to the node
$attributes = uc_product_get_attributes($node-&gt;nid);

//get the id of default size of the product
$default_size = $attributes[1]-&gt;default_option;

// Print the chart button
echo $node-&gt;content[&#039;add_to_cart&#039;][&#039;#value&#039;];
&lt;/pre&gt;

The &lt;i&gt;echo $node-&gt;content[&#039;add_to_cart&#039;][&#039;#value&#039;]&lt;/i&gt; is where the actual size selector and cart button is generated.</description>
		<content:encoded><![CDATA[<p>Hi Ben</p>
<p>Yes that is also a soltution to it, but it is definitely not the optimal way to go about it. I am pretty sure this is a bug in the Ubercart module.</p>
<p>No you are right, I did not, I added this piece of code in my node-product.tpl.php template (which is the template file of my products). I added this before printing out the size selector and cart button, as you can see in my example below.</p>
<pre lang="php">
//get all attributes related to the node
$attributes = uc_product_get_attributes($node->nid);

//get the id of default size of the product
$default_size = $attributes[1]->default_option;

// Print the chart button
echo $node->content['add_to_cart']['#value'];
</pre>
<p>The <i>echo $node->content['add_to_cart']['#value']</i> is where the actual size selector and cart button is generated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bensbury</title>
		<link>http://www.klunde.net/2009/02/20/getting-the-default-option-of-a-ubercart-product-attribute/comment-page-1/#comment-1084</link>
		<dc:creator>Bensbury</dc:creator>
		<pubDate>Thu, 09 Apr 2009 23:54:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.klunde.net/?p=262#comment-1084</guid>
		<description>This problem bugged the hell out of me too.
I found that the default failed to appear if it had the same SKU as the option.

A non-coding way around is to use a Base SKU for the product and then make new codes for all options.

The default appears in the stock but you turn it inactive.
Then all the options become available.

A non-programming work-around.

btw... you haven&#039;t told anywhere where to put your code?</description>
		<content:encoded><![CDATA[<p>This problem bugged the hell out of me too.<br />
I found that the default failed to appear if it had the same SKU as the option.</p>
<p>A non-coding way around is to use a Base SKU for the product and then make new codes for all options.</p>
<p>The default appears in the stock but you turn it inactive.<br />
Then all the options become available.</p>
<p>A non-programming work-around.</p>
<p>btw&#8230; you haven&#8217;t told anywhere where to put your code?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
