{"id":922,"date":"2013-12-30T22:38:40","date_gmt":"2013-12-30T22:38:40","guid":{"rendered":"http:\/\/scunster.co.uk\/?p=922"},"modified":"2013-12-30T22:45:10","modified_gmt":"2013-12-30T22:45:10","slug":"adding-an-image-to-a-product-option-checkbox","status":"publish","type":"post","link":"https:\/\/scunster.co.uk\/?p=922","title":{"rendered":"Adding an image to a product option checkbox"},"content":{"rendered":"<p>You can add an image using the &#8220;image&#8221; option of the OpenCart option. Unfortunately this option only works as a radio button and once ticked can not be unticked.<\/p>\n<p>To show the check box option image you need to add the following code to the product.tpl file under:<\/p>\n<p>\/catalog\/view\/theme\/&#8221;your_theme&#8221;\/template\/product<\/p>\n<p>Directly after:<\/p>\n<pre>        &lt;?php if ($option[&#39;type&#39;] == &#39;checkbox&#39;) { ?&gt;\r\n        &lt;div id=&quot;option-&lt;?php echo $option[&#39;product_option_id&#39;]; ?&gt;&quot; class=&quot;option&quot;&gt;\r\n          &lt;?php if ($option[&#39;required&#39;]) { ?&gt;\r\n          &lt;span class=&quot;required&quot;&gt;*&lt;\/span&gt;\r\n          &lt;?php } ?&gt;\r\n          &lt;b&gt;&lt;?php echo $option[&#39;name&#39;]; ?&gt;:&lt;\/b&gt;&lt;br \/&gt;\r\n          &lt;?php foreach ($option[&#39;option_value&#39;] as $option_value) { ?&gt;<\/pre>\n<p>Add This:<\/p>\n<pre>&lt;!-- Following was added by ME! to allow images on checkbox --&gt;\r\n\r\n&lt;label for=&quot;option-value-&lt;?php echo $option_value[&#39;product_option_value_id&#39;]; ?&gt;&quot;&gt;&lt;img src=&quot;&lt;?php echo $option_value[&#39;image&#39;]; ?&gt;&quot; alt=&quot;&lt;?php echo $option_value[&#39;name&#39;] . ($option_value[&#39;price&#39;] ? &#39; &#39; . $option_value[&#39;price_prefix&#39;] . $option_value[&#39;price&#39;] : &#39;&#39;); ?&gt;&quot; align=&quot;middle&quot;\/&gt;&lt;\/label&gt;\r\n\r\n&lt;!-- Above was added by ME! to allow images on checkbox --&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>You can add an image using the &#8220;image&#8221; option of the OpenCart option. Unfortunately this option only works as a radio button and once ticked can not be unticked. To show the check box option image you need to add the following code to the product.tpl file under: \/catalog\/view\/theme\/&#8221;your_theme&#8221;\/template\/product Directly after: &lt;?php if ($option[&#39;type&#39;] == [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[185,12],"tags":[],"class_list":["post-922","post","type-post","status-publish","format-standard","hentry","category-open-cart","category-webhosting"],"_links":{"self":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/922","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=922"}],"version-history":[{"count":5,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/922\/revisions"}],"predecessor-version":[{"id":927,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/922\/revisions\/927"}],"wp:attachment":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=922"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}