{"id":5059,"date":"2016-12-08T10:53:27","date_gmt":"2016-12-08T01:53:27","guid":{"rendered":"https:\/\/www.live-commerce.com\/support\/?page_id=5059"},"modified":"2016-12-08T11:20:04","modified_gmt":"2016-12-08T02:20:04","slug":"ogetrelatedproducts","status":"publish","type":"page","link":"https:\/\/www.live-commerce.com\/support\/functions\/ogetrelatedproducts","title":{"rendered":"o::getRelatedProducts"},"content":{"rendered":"<h3>\u6982\u8981<\/h3>\n<p>\u6307\u5b9a\u3057\u305f\u5546\u54c1\u306e\u95a2\u9023\u5546\u54c1\u60c5\u5831\u3092\u5168\u3066\u53d6\u5f97\u3057\u307e\u3059\u3002<br \/>\n&nbsp;<\/p>\n<h3>\u4f7f\u3044\u65b9<\/h3>\n<pre class=\"lang:default decode:true \" >&lt;?php \r\n$getRelatedProducts  = o::getRelatedProducts($pid, $isSeo = 'false'); \r\nprint_r($getRelatedProducts);\r\n?&gt;<\/pre>\n<p>&nbsp;<\/p>\n<h3>\u5f15\u6570\u306e\u5185\u5bb9<\/h3>\n<ul style=\"list-style-type: square\">\n<li>$pid : \u5546\u54c1ID\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\n<\/li>\n<li>$isSeo : \u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u7a7a\u3067\u3082\u53ef\u3002SEO URL\u3092\u6709\u52b9\u306b\u3057\u305f\u3044\u5834\u5408\u306f true\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>\u8fd4\u308a\u5024<\/h3>\n<p>array<\/p>\n<ul style=\"list-style-type: square\">\n<li>product_id : \u5546\u54c1ID<\/li>\n<li>product_name : \u5546\u54c1\u540d<\/li>\n<li>product_image : \u5546\u54c1\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u540d<\/li>\n<li>product_description : \u5546\u54c1\u8aac\u660e<\/li>\n<li>product_href : \u5546\u54c1\u30da\u30fc\u30b8\u306eURL\n<\/li>\n<\/ul>\n<pre class=\"lang:default highlight:0 decode:true \" >\/\/ \u51fa\u529b\u7d50\u679c\r\nArray\r\n(\r\n    [0] =&gt; Array\r\n        (\r\n            [product_id] =&gt; 230\r\n            [product_name] =&gt; \u82b1\r\n            [product_image] =&gt; src=\"resources\/upload\/products\/thumbnail3\/no_image.gif\" width=\"46\" height=\"46\"\r\n            [product_description] =&gt; \r\n            [product_href] =&gt; http:\/\/www.sample.com\/category\/select\/pid\/230\r\n        )\r\n\r\n    [1] =&gt; Array\r\n        (\r\n            [product_id] =&gt; 105\r\n            [product_name] =&gt; \u548c\u6b4c\u5c71\u7523 \u5c0f\u6885 \u7b49\u7d1aA 2L\u30b5\u30a4\u30ba \u7d044K\r\n            [product_image] =&gt; src=\"resources\/upload\/products\/thumbnail3\/02892870.jpg\" width=\"46\" height=\"35\"\r\n            [product_description] =&gt; \u548c\u6b4c\u5c71\u7523 \u7b49\u7d1aA 2L\u30b5\u30a4\u30ba \u7d044K         3143  \r\n            [product_href] =&gt; http:\/\/www.sample.com\/category\/select\/pid\/105\r\n        )\r\n\r\n    [2] =&gt; Array\r\n        (\r\n            [product_id] =&gt; 70\r\n            [product_name] =&gt; \u5317\u6d77\u9053\u7523\u4ed6 \u30b5\u30e4 A\u54c1 \u7d041K x1\r\n            [product_image] =&gt; src=\"resources\/upload\/products\/thumbnail3\/02887593.jpg\" width=\"46\" height=\"35\"\r\n            [product_description] =&gt; \u5317\u6d77\u9053\u7523\u4ed6 A\u54c1 \u7d041K\u5165           \r\n            [product_href] =&gt; http:\/\/www.sample.com\/category\/select\/pid\/70\r\n        )\r\n\r\n    [3] =&gt; Array\r\n        (\r\n            [product_id] =&gt; 69\r\n            [product_name] =&gt; \u5343\u8449\u7523\u30fb\u5c71\u5f62\u7523 \u3044\u3093\u3052\u3093 \u7b49\u7d1aA M\u30b5\u30a4\u30ba \u7d042K x1\r\n            [product_image] =&gt; src=\"resources\/upload\/products\/thumbnail3\/02887579.jpg\" width=\"46\" height=\"35\"\r\n            [product_description] =&gt; \u5343\u8449\u7523\u30fb\u5c71\u5f62\u7523 \u7b49\u7d1aA M\u30b5\u30a4\u30ba \u7d042K\u5165          \r\n            [product_href] =&gt; http:\/\/www.sample.com\/category\/select\/pid\/69\r\n        )\r\n\r\n)<\/pre>\n<p>&nbsp;<\/p>\n<h3>\u4f7f\u7528\u4f8b<\/h3>\n<pre class=\"lang:default decode:true \" >&lt;?php\r\n    $relatedProducts = c::executeCacheForFunction('related_products', 'o::getRelatedProducts' , array($this-&gt;p_id,\r\n                                                                                                      c::executeCacheForFunction('configuration', 'o::_', array('SEO_URL'))));\r\n \r\n if ($relatedProducts) :\r\n?&gt;\r\n&lt;!--Related products--&gt;\r\n&lt;div class=\"itemtable\"&gt;\r\n  &lt;div class=\"title\"&gt;\r\n    &lt;h2&gt;&lt;?php echo TEXT_RELATED_PRODUCTS; ?&gt;&lt;\/h2&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div class=\"box\"&gt;\r\n    &lt;?php foreach ($relatedProducts as $rprow) : ?&gt;\r\n    &lt;h3 class=\"top\"&gt;&lt;?php echo $rprow['product_name']; ?&gt;&lt;\/h3&gt;\r\n    &lt;div class=\"clearfix\"&gt;\r\n      &lt;p class=\"images\"&gt;&lt;img &lt;?php echo $rprow['product_image']; ?&gt;\/&lt;\/p&gt;\r\n      &lt;p class=\"text\"&gt;&lt;?php echo $rprow['product_description']; ?&gt;&lt;\/p&gt;\r\n    &lt;\/div&gt;\r\n    &lt;?php endforeach; ?&gt;\r\n  &lt;\/div&gt;\r\n&lt;\/div&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 \u6307\u5b9a\u3057\u305f\u5546\u54c1\u306e\u95a2\u9023\u5546\u54c1\u60c5\u5831\u3092\u5168\u3066\u53d6\u5f97\u3057\u307e\u3059\u3002 &nbsp; \u4f7f\u3044\u65b9 &lt;?php $getRelatedProducts = o::getRelatedProducts($pid, $isSeo = &#8216;fals [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":154,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5059","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.live-commerce.com\/support\/wp-json\/wp\/v2\/pages\/5059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.live-commerce.com\/support\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.live-commerce.com\/support\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.live-commerce.com\/support\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.live-commerce.com\/support\/wp-json\/wp\/v2\/comments?post=5059"}],"version-history":[{"count":4,"href":"https:\/\/www.live-commerce.com\/support\/wp-json\/wp\/v2\/pages\/5059\/revisions"}],"predecessor-version":[{"id":5080,"href":"https:\/\/www.live-commerce.com\/support\/wp-json\/wp\/v2\/pages\/5059\/revisions\/5080"}],"up":[{"embeddable":true,"href":"https:\/\/www.live-commerce.com\/support\/wp-json\/wp\/v2\/pages\/154"}],"wp:attachment":[{"href":"https:\/\/www.live-commerce.com\/support\/wp-json\/wp\/v2\/media?parent=5059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}