{"id":346,"date":"2013-06-19T14:59:37","date_gmt":"2013-06-19T12:59:37","guid":{"rendered":"http:\/\/www.zhurov.ory.ua\/?p=346"},"modified":"2013-06-19T14:59:37","modified_gmt":"2013-06-19T12:59:37","slug":"cms-opencart-%d0%b4%d0%be%d0%b1%d0%b0%d0%b2%d0%bb%d0%b5%d0%bd%d0%b8%d0%b5-%d0%bf%d0%be%d0%bb%d1%8f-%d0%b4%d0%bb%d1%8f-%d1%82%d0%be%d0%b2%d0%b0%d1%80%d0%b0","status":"publish","type":"post","link":"https:\/\/zhurov.ory.ua\/?p=346","title":{"rendered":"CMS OpenCart &#8212; \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0434\u043b\u044f \u0442\u043e\u0432\u0430\u0440\u0430"},"content":{"rendered":"<p>Q: \u041a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430?<br \/>\nA: \u0412\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u044f\u0434 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439:<br \/>\n<!--more--><\/p>\n<h2>Admin<\/h2>\n<p>ALTER TABLE `\u0438\u043c\u044f_\u0442\u0430\u0431\u043b\u0438\u0446\u044b` ADD `price_for` varchar(64) NOT NULL;<\/p>\n<h3>Model<\/h3>\n<p><em>\/admin\/model\/catalog\/product.php<\/em><br \/>\n$this-&gt;db-&gt;query(&#171;INSERT INTO &#187; . DB_PREFIX . &#171;product<br \/>\nSET model = &#8216;&#187; . $this-&gt;db-&gt;escape($data[&#8216;model&#8217;]) . &#171;&#8216;,<br \/>\nsku = &#8216;&#187; . $this-&gt;db-&gt;escape($data[&#8216;sku&#8217;]) . &#171;&#8216;,<br \/>\nlocation = &#8216;&#187; . $this-&gt;db-&gt;escape($data[&#8216;location&#8217;]) . &#171;&#8216;,<br \/>\nquantity = &#8216;&#187; . (int)$data[&#8216;quantity&#8217;] . &#171;&#8216;,<br \/>\nstock_status_id = &#8216;&#187; . (int)$data[&#8216;stock_status_id&#8217;] . &#171;&#8216;,<br \/>\ndate_available = &#8216;&#187; . $this-&gt;db-&gt;escape($data[&#8216;date_available&#8217;]) . &#171;&#8216;,<br \/>\nmanufacturer_id = &#8216;&#187; . (int)$data[&#8216;manufacturer_id&#8217;] . &#171;&#8216;,<br \/>\nshipping = &#8216;&#187; . (int)$data[&#8216;shipping&#8217;] . &#171;&#8216;,<br \/>\nprice = &#8216;&#187; . (float)$data[&#8216;price&#8217;] . &#171;&#8216;,<br \/>\n<strong>price_for = &#8216;&#187; . (float)$data[&#8216;price_for&#8217;] . &#171;&#8216;, <\/strong><br \/>\nweight = &#8216;&#187; . (float)$data[&#8216;weight&#8217;] . &#171;&#8216;,<br \/>\nweight_class_id = &#8216;&#187; . (int)$data[&#8216;weight_class_id&#8217;] . &#171;&#8216;,<br \/>\nlength = &#8216;&#187; . (float)$data[&#8216;length&#8217;] . &#171;&#8216;,<br \/>\nwidth = &#8216;&#187; . (float)$data[&#8216;width&#8217;] . &#171;&#8216;,<br \/>\nheight = &#8216;&#187; . (float)$data[&#8216;height&#8217;] . &#171;&#8216;,<br \/>\nmeasurement_class_id = &#8216;&#187; . (int)$data[&#8216;measurement_class_id&#8217;] . &#171;&#8216;,<br \/>\nstatus = &#8216;&#187; . (int)$data[&#8216;status&#8217;] . &#171;&#8216;,<br \/>\ntax_class_id = &#8216;&#187; . (int)$data[&#8216;tax_class_id&#8217;] . &#171;&#8216;,<br \/>\ndate_added = NOW()&#187;);<\/p>\n<p>$this-&gt;db-&gt;query(&#171;UPDATE &#187; . DB_PREFIX . &#171;product<br \/>\nSET model = &#8216;&#187; . $this-&gt;db-&gt;escape($data[&#8216;model&#8217;]) . &#171;&#8216;,<br \/>\nsku = &#8216;&#187; . $this-&gt;db-&gt;escape($data[&#8216;sku&#8217;]) . &#171;&#8216;,<br \/>\nlocation = &#8216;&#187; . $this-&gt;db-&gt;escape($data[&#8216;location&#8217;]) . &#171;&#8216;,<br \/>\nquantity = &#8216;&#187; . (int)$data[&#8216;quantity&#8217;] . &#171;&#8216;,<br \/>\nstock_status_id = &#8216;&#187; . (int)$data[&#8216;stock_status_id&#8217;] . &#171;&#8216;,<br \/>\ndate_available = &#8216;&#187; . $this-&gt;db-&gt;escape($data[&#8216;date_available&#8217;]) . &#171;&#8216;,<br \/>\nmanufacturer_id = &#8216;&#187; . (int)$data[&#8216;manufacturer_id&#8217;] . &#171;&#8216;,<br \/>\nshipping = &#8216;&#187; . (int)$data[&#8216;shipping&#8217;] . &#171;&#8216;,<br \/>\nprice = &#8216;&#187; . (float)$data[&#8216;price&#8217;] . &#171;&#8216;,<br \/>\n<strong>price_for = &#8216;&#187; . (float)$data[&#8216;price_for&#8217;] . &#171;&#8216;, <\/strong><br \/>\nweight = &#8216;&#187; . (float)$data[&#8216;weight&#8217;] . &#171;&#8216;,<br \/>\nweight_class_id = &#8216;&#187; . (int)$data[&#8216;weight_class_id&#8217;] . &#171;&#8216;,<br \/>\nlength = &#8216;&#187; . (float)$data[&#8216;length&#8217;] . &#171;&#8216;,<br \/>\nwidth = &#8216;&#187; . (float)$data[&#8216;width&#8217;] . &#171;&#8216;,<br \/>\nheight = &#8216;&#187; . (float)$data[&#8216;height&#8217;] . &#171;&#8216;,<br \/>\nmeasurement_class_id = &#8216;&#187; . (int)$data[&#8216;measurement_class_id&#8217;] . &#171;&#8216;,<br \/>\nstatus = &#8216;&#187; . (int)$data[&#8216;status&#8217;] . &#171;&#8216;,<br \/>\ntax_class_id = &#8216;&#187; . (int)$data[&#8216;tax_class_id&#8217;] . &#171;&#8216;,<br \/>\ndate_modified = NOW() WHERE product_id = &#8216;&#187; . (int)$product_id . &#171;&#8216;&#187;);<\/p>\n<h3>Controller<\/h3>\n<p><em>\/admin\/controller\/catalog\/product.php<\/em><br \/>\n$this-&gt;data[&#8216;entry_price&#8217;] = $this-&gt;language-&gt;get(&#8216;entry_price&#8217;);<br \/>\n<strong>$this-&gt;data[&#8216;entry_price_for&#8217;] = $this-&gt;language-&gt;get(&#8216;entry_price_for&#8217;);<\/strong><\/p>\n<p>if (isset($this-&gt;request-&gt;post[&#8216;price&#8217;])) {<br \/>\n$this-&gt;data[&#8216;price&#8217;] = $this-&gt;request-&gt;post[&#8216;price&#8217;];<br \/>\n} else if (isset($product_info)) {<br \/>\n$this-&gt;data[&#8216;price&#8217;] = $product_info[&#8216;price&#8217;];<br \/>\n} else {<br \/>\n$this-&gt;data[&#8216;price&#8217;] = &#187;;<br \/>\n}<br \/>\n<strong>if (isset($this-&gt;request-&gt;post[&#8216;price_for&#8217;])) {<br \/>\n$this-&gt;data[&#8216;price_for&#8217;] = $this-&gt;request-&gt;post[&#8216;price_for&#8217;];<br \/>\n} else if (isset($product_info)) {<br \/>\n$this-&gt;data[&#8216;price_for&#8217;] = $product_info[&#8216;price_for&#8217;];<br \/>\n} else {<br \/>\n$this-&gt;data[&#8216;price_for&#8217;] = &#187;;<br \/>\n}<br \/>\n<\/strong><\/p>\n<h3>View<\/h3>\n<p><em>\/admin\/view\/template\/catalog\/product_form.tpl<\/em><br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;&lt;?php echo $entry_price; ?&gt;&lt;\/td&gt;<br \/>\n&lt;td&gt;&lt;input type=&#187;text&#187; name=&#187;price&#187; value=&#187;&lt;?php echo $price; ?&gt;&#187; \/&gt;&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n<strong><br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;&lt;?php echo $entry_price_for; ?&gt;&lt;\/td&gt;<br \/>\n&lt;td&gt;&lt;input type=&#187;text&#187; name=&#187;price_for&#187; value=&#187;&lt;?php echo $price_for; ?&gt;&#187; \/&gt;&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n<\/strong><\/p>\n<p>&nbsp;<\/p>\n<h3>Language<\/h3>\n<p><em>\/admin\/language\/russian\/catalog\/product.php<\/em><br \/>\n<strong>$_[&#8216;entry_price_for&#8217;] = &#8216;\u0426\u0435\u043d\u0430 \u0437\u0430:&#8217;;<\/strong><\/p>\n<h2>Template<\/h2>\n<h3>Controller<\/h3>\n<p><em>\/catalog\/controller\/product\/product.php<\/em><br \/>\n$this-&gt;data[&#8216;text_price&#8217;] = $this-&gt;language-&gt;get(&#8216;text_price&#8217;);<br \/>\n<strong>$this-&gt;data[&#8216;text_price_for&#8217;] = $this-&gt;language-&gt;get(&#8216;text_price_for&#8217;);<\/strong><\/p>\n<p>$this-&gt;data[&#8216;price&#8217;] = $product_info[&#8216;price&#8217;];<br \/>\n<strong>$this-&gt;data[&#8216;price_for&#8217;] = $product_info[&#8216;price_for&#8217;];<\/strong><\/p>\n<p>$this-&gt;data[&#8216;products&#8217;][] = array(<br \/>\n&#8216;product_id&#8217; =&gt; $result[&#8216;product_id&#8217;],<br \/>\n&#8216;thumb&#8217; =&gt; $image,<br \/>\n&#8216;name&#8217; =&gt; $result[&#8216;name&#8217;],<br \/>\n&#8216;price&#8217; =&gt; $price,<br \/>\n<strong>&#8216;price_for&#8217; =&gt; $price_for,<\/strong><br \/>\n&#8216;special&#8217; =&gt; $special,<br \/>\n&#8216;rating&#8217; =&gt; $rating,<br \/>\n&#8216;reviews&#8217; =&gt; sprintf($this-&gt;language-&gt;get(&#8216;text_reviews&#8217;), (int)$result[&#8216;reviews&#8217;]),<br \/>\n&#8216;href&#8217; =&gt; $this-&gt;url-&gt;link(&#8216;product\/product&#8217;,<br \/>\n&#8216;product_id=&#8217; . $result[&#8216;product_id&#8217;])<br \/>\n);<\/p>\n<h3>View<\/h3>\n<p><em>\/catalog\/view\/theme\/\u0432\u0430\u0448\u0430_\u0442\u0435\u043c\u0430\/template\/product\/product.tpl<\/em><br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;[b]&lt;?php echo $text_price; ?&gt;[\/b]&lt;\/td&gt;<br \/>\n&lt;td&gt;&lt;?php if (!$special) { ?&gt;<br \/>\n&lt;?php echo $price; ?&gt;<br \/>\n&lt;?php } else { ?&gt;<br \/>\n&lt;span style=&#187;text-decoration: line-through;&#187;&gt;&lt;?php echo $price; ?&gt;&lt;\/span&gt; [color= #F00;]&lt;?php echo $special; ?&gt;[\/color]<br \/>\n&lt;?php } ?&gt;&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n<strong>&lt;tr&gt;<br \/>\n&lt;td&gt;&lt;b&gt;&lt;?php echo $text_price_for; ?&gt;&lt;\/b&gt;&lt;\/td&gt;<br \/>\n&lt;td&gt;&lt;?php echo $price_for; ?&gt;&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<\/strong><\/p>\n<h3>Language<\/h3>\n<p><em>\/catalog\/language\/russian\/product\/product.php<\/em><br \/>\n$_[&#8216;text_price&#8217;] = &#8216;\u0426\u0435\u043d\u0430:&#8217;;<br \/>\n<strong>$_[&#8216;text_price_for&#8217;] = &#8216;\u0426\u0435\u043d\u0430 \u0437\u0430:&#8217;;<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Q: \u041a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430? A: \u0412\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u044f\u0434 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-346","post","type-post","status-publish","format-standard","hentry","category-25"],"_links":{"self":[{"href":"https:\/\/zhurov.ory.ua\/index.php?rest_route=\/wp\/v2\/posts\/346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhurov.ory.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhurov.ory.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhurov.ory.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhurov.ory.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=346"}],"version-history":[{"count":13,"href":"https:\/\/zhurov.ory.ua\/index.php?rest_route=\/wp\/v2\/posts\/346\/revisions"}],"predecessor-version":[{"id":359,"href":"https:\/\/zhurov.ory.ua\/index.php?rest_route=\/wp\/v2\/posts\/346\/revisions\/359"}],"wp:attachment":[{"href":"https:\/\/zhurov.ory.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhurov.ory.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhurov.ory.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}