<?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: Adding custom options to a product in Magento</title>
	<atom:link href="http://subesh.com.np/2009/12/adding-custom-options-product-magento/feed/" rel="self" type="application/rss+xml" />
	<link>http://subesh.com.np/2009/12/adding-custom-options-product-magento/</link>
	<description>PHP &#38; Magento Tips and Tutorials</description>
	<lastBuildDate>Thu, 17 May 2012 05:29:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Md.Shawkat Alam</title>
		<link>http://subesh.com.np/2009/12/adding-custom-options-product-magento/#comment-686</link>
		<dc:creator>Md.Shawkat Alam</dc:creator>
		<pubDate>Thu, 29 Mar 2012 10:22:20 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=155#comment-686</guid>
		<description>After a long search i have placed the fuction in option.php inside catalog/model/product and added $this on the front of this code &quot;$arrayOption[] = setCustomOption(&quot;OPT1,OPT2&quot;, &quot;Select Option&quot;, &quot;drop_down&quot;);&quot; instead of using this i am using $this-&gt;setCustomOption(&quot;OPT1,OPT2&quot;, &quot;Select Option&quot;, &quot;drop_down&quot;);
but getting &quot;SQLSTATE[23000]: Integrity constraint violation: 1048 Column &#039;title&#039; cannot be null&quot; this error. Can you please help!!!</description>
		<content:encoded><![CDATA[<p>After a long search i have placed the fuction in option.php inside catalog/model/product and added $this on the front of this code &#8220;$arrayOption[] = setCustomOption(&#8220;OPT1,OPT2&#8243;, &#8220;Select Option&#8221;, &#8220;drop_down&#8221;);&#8221; instead of using this i am using $this-&gt;setCustomOption(&#8220;OPT1,OPT2&#8243;, &#8220;Select Option&#8221;, &#8220;drop_down&#8221;);<br />
but getting &#8220;SQLSTATE[23000]: Integrity constraint violation: 1048 Column &#8216;title&#8217; cannot be null&#8221; this error. Can you please help!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Banifou</title>
		<link>http://subesh.com.np/2009/12/adding-custom-options-product-magento/#comment-261</link>
		<dc:creator>Banifou</dc:creator>
		<pubDate>Tue, 03 Jan 2012 11:11:01 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=155#comment-261</guid>
		<description>Same for me and I&#039;m using Magento 1.6.1! Does anybody solved this strange behaviour?

Thanks</description>
		<content:encoded><![CDATA[<p>Same for me and I&#8217;m using Magento 1.6.1! Does anybody solved this strange behaviour?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mickey T</title>
		<link>http://subesh.com.np/2009/12/adding-custom-options-product-magento/#comment-259</link>
		<dc:creator>Mickey T</dc:creator>
		<pubDate>Mon, 06 Jun 2011 07:19:10 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=155#comment-259</guid>
		<description>Using Magento 1.5.1.0 I found that the following needs to be added to the above scripts:

$product-&gt;setCanSaveCustomOptions(true);
$product-&gt;save();</description>
		<content:encoded><![CDATA[<p>Using Magento 1.5.1.0 I found that the following needs to be added to the above scripts:</p>
<p>$product-&gt;setCanSaveCustomOptions(true);<br />
$product-&gt;save();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sumi</title>
		<link>http://subesh.com.np/2009/12/adding-custom-options-product-magento/#comment-258</link>
		<dc:creator>Sumi</dc:creator>
		<pubDate>Sat, 26 Mar 2011 09:09:37 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=155#comment-258</guid>
		<description>Hi,

When i tried this code in my custom module (magento v1.5.0.1) I&#039;m getting this error. SQLSTATE[23000]: Integrity constraint violation: 1048 Column &#039;title&#039; cannot be null
Kindly advice..</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>When i tried this code in my custom module (magento v1.5.0.1) I&#8217;m getting this error. SQLSTATE[23000]: Integrity constraint violation: 1048 Column &#8216;title&#8217; cannot be null<br />
Kindly advice..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: magentokid</title>
		<link>http://subesh.com.np/2009/12/adding-custom-options-product-magento/#comment-257</link>
		<dc:creator>magentokid</dc:creator>
		<pubDate>Thu, 30 Dec 2010 06:53:32 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=155#comment-257</guid>
		<description>Nice Tutorial

I want to add custom options in my own module but i am confuse for designing the database please help me on this topic.</description>
		<content:encoded><![CDATA[<p>Nice Tutorial</p>
<p>I want to add custom options in my own module but i am confuse for designing the database please help me on this topic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kasun</title>
		<link>http://subesh.com.np/2009/12/adding-custom-options-product-magento/#comment-256</link>
		<dc:creator>Kasun</dc:creator>
		<pubDate>Fri, 10 Dec 2010 02:39:14 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=155#comment-256</guid>
		<description>Thanks for the reply. But it did not work for me. may be I put the second code snippet in the wrong place. If you can please tell me where to put the below code.

$arrayOption = array();
	/**
	 * For Creating dropdown,select,multiselect,radio type of custom option
	 */
	$arrayOption[] = setCustomOption(&quot;OPT1,OPT2&quot;, &quot;Select Option&quot;, &quot;drop_down&quot;);
	/**
	 * For Creating textfield and textarea type of custom option
	 */
	$arrayOption[] = setCustomOption(&quot;Anyvalue&quot;, &quot;Area&quot;, &quot;area&quot;, true);
	/**
	 * Load the product you want to assign custom option to
	 */
	$product = Mage::getModel(&quot;catalog/product&quot;)-&gt;load(167);
	foreach ($arrayOption as $options) {
		foreach ($options as $option) {
			$opt = Mage::getModel(&#039;catalog/product_option&#039;);
			$opt-&gt;setProduct($product);
			$opt-&gt;addOption($option);
			$opt-&gt;saveOptions();
		}
	}


Thanks,
Kasun Withana</description>
		<content:encoded><![CDATA[<p>Thanks for the reply. But it did not work for me. may be I put the second code snippet in the wrong place. If you can please tell me where to put the below code.</p>
<p>$arrayOption = array();<br />
	/**<br />
	 * For Creating dropdown,select,multiselect,radio type of custom option<br />
	 */<br />
	$arrayOption[] = setCustomOption(&#8220;OPT1,OPT2&#8243;, &#8220;Select Option&#8221;, &#8220;drop_down&#8221;);<br />
	/**<br />
	 * For Creating textfield and textarea type of custom option<br />
	 */<br />
	$arrayOption[] = setCustomOption(&#8220;Anyvalue&#8221;, &#8220;Area&#8221;, &#8220;area&#8221;, true);<br />
	/**<br />
	 * Load the product you want to assign custom option to<br />
	 */<br />
	$product = Mage::getModel(&#8220;catalog/product&#8221;)-&gt;load(167);<br />
	foreach ($arrayOption as $options) {<br />
		foreach ($options as $option) {<br />
			$opt = Mage::getModel(&#8216;catalog/product_option&#8217;);<br />
			$opt-&gt;setProduct($product);<br />
			$opt-&gt;addOption($option);<br />
			$opt-&gt;saveOptions();<br />
		}<br />
	}</p>
<p>Thanks,<br />
Kasun Withana</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://subesh.com.np/2009/12/adding-custom-options-product-magento/#comment-255</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 09 Dec 2010 08:48:57 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=155#comment-255</guid>
		<description>Easiest method is to add code on class Mage_Catalog_Model_Convert_Adapter_Product, path would be app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php. But this is not recommended, please create a module that extends this class and add this code there.</description>
		<content:encoded><![CDATA[<p>Easiest method is to add code on class Mage_Catalog_Model_Convert_Adapter_Product, path would be app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php. But this is not recommended, please create a module that extends this class and add this code there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kasun</title>
		<link>http://subesh.com.np/2009/12/adding-custom-options-product-magento/#comment-254</link>
		<dc:creator>Kasun</dc:creator>
		<pubDate>Thu, 09 Dec 2010 04:56:33 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=155#comment-254</guid>
		<description>Hi,

I have a problem. To where add this code? I know very little about magento. So please answer my question ASAP with the exact path to the file.

Thank You,
Kasun</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have a problem. To where add this code? I know very little about magento. So please answer my question ASAP with the exact path to the file.</p>
<p>Thank You,<br />
Kasun</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://subesh.com.np/2009/12/adding-custom-options-product-magento/#comment-253</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 16 Nov 2010 12:20:49 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=155#comment-253</guid>
		<description>You can add this function on core files as well but it is a better practice to make your own module and add these codes.</description>
		<content:encoded><![CDATA[<p>You can add this function on core files as well but it is a better practice to make your own module and add these codes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sonu</title>
		<link>http://subesh.com.np/2009/12/adding-custom-options-product-magento/#comment-252</link>
		<dc:creator>sonu</dc:creator>
		<pubDate>Tue, 16 Nov 2010 09:44:59 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=155#comment-252</guid>
		<description>hi subesh, it may sounds funny but am pretty new to magento. could you please tell me where to use this function, i mean do i need to create a module.</description>
		<content:encoded><![CDATA[<p>hi subesh, it may sounds funny but am pretty new to magento. could you please tell me where to use this function, i mean do i need to create a module.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

