{"id":141,"date":"2009-06-01T14:46:12","date_gmt":"2009-06-01T12:46:12","guid":{"rendered":"http:\/\/kavdesign.net\/wordpress\/?p=141"},"modified":"2011-04-20T16:51:25","modified_gmt":"2011-04-20T14:51:25","slug":"how-to-add-a-link-to-the-manufacturer-for-each-product-in-the-virtuemart-caregory-browse-page","status":"publish","type":"post","link":"https:\/\/www.kavdesign.net\/blog\/coding\/how-to-add-a-link-to-the-manufacturer-for-each-product-in-the-virtuemart-caregory-browse-page\/","title":{"rendered":"How to add a link to the manufacturer, for each product in the virtuemart caregory browse page?"},"content":{"rendered":"<p>To do this first read this post:<\/p>\n<p><a href=\"http:\/\/www.pcinvent.net\/technology\/programming\/how-to-hack-manufacture-name-in-virtuemart-browse-page-template\" target=\"_blank\">http:\/\/www.pcinvent.net\/technology\/programming\/how-to-hack-manufacture-name-in-virtuemart-browse-page-template<\/a><\/p>\n<p>where it is explained: How to hack Manufacture Name in Virtuemart Browse Page Template?<\/p>\n<p>Then step by step explanation:<\/p>\n<p>1. open your: ps_product.php<\/p>\n<p>and add this function:<\/p>\n<p>\/**<br \/>\n* Functon to get the id of the manufacturer this product is assigned to<br \/>\n*<br \/>\n* @param int $product_id<br \/>\n* @return string the manufacturer id<br \/>\n*\/<br \/>\nfunction get_mf_id($product_id) {<br \/>\n$db = new ps_DB;<\/p>\n<p>$q = &#8220;SELECT mf_name,#__{vm}_manufacturer.manufacturer_id FROM #__{vm}_product_mf_xref,#__{vm}_manufacturer &#8220;;<br \/>\n$q .= &#8220;WHERE product_id=&#8217;$product_id&#8217; &#8220;;<br \/>\n$q .= &#8220;AND #__{vm}_manufacturer.manufacturer_id=#__{vm}_product_mf_xref.manufacturer_id&#8221;;<\/p>\n<p>$db-&gt;query($q);<br \/>\n$db-&gt;next_record();<br \/>\nif ($db-&gt;f(&#8220;manufacturer_id&#8221;)) {<br \/>\nreturn $db-&gt;f(&#8220;manufacturer_id&#8221;);<br \/>\n}<br \/>\nelse {<br \/>\nreturn &#8220;&#8221;;<br \/>\n}<br \/>\n}<\/p>\n<p>2.\u00a0 Then open shop.browse.php and add this lines:<\/p>\n<p>$mf_id = $ps_product-&gt;get_mf_id( $db_browse-&gt;f(&#8216;product_id&#8217;) );<br \/>\n$tpl-&gt;set( &#8216;mf_id&#8217;, $mf_id );<\/p>\n<p>after:<\/p>\n<p>\/\/The Code below is written by Andy Ng &lt;\u00a0 Andy@PCinvent.infoThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it &gt;<br \/>\n\/\/Please keep the above author credit line<br \/>\n$mf_name = $ps_product-&gt;get_mf_name( $db_browse-&gt;f(&#8216;product_id&#8217;) );<br \/>\n$tpl-&gt;set(&#8216;mf_name&#8217;,$mf_name);<\/p>\n<p>3.\u00a0 Add this line in shop.browse.php:<\/p>\n<p>$products[$i][&#8216;manufacturer_id&#8217;] = $mf_id;<\/p>\n<p>somewhere after:<\/p>\n<p>$products[$i][&#8216;cdate&#8217;] = $VM_LANG-&gt;convert( vmFormatDate($db_browse-&gt;f(&#8220;cdate&#8221;), $VM_LANG-&gt;_(&#8216;DATE_FORMAT_LC&#8217;) ));<br \/>\n$products[$i][&#8216;mdate&#8217;] = $VM_LANG-&gt;convert( vmFormatDate($db_browse-&gt;f(&#8220;mdate&#8221;), $VM_LANG-&gt;_(&#8216;DATE_FORMAT_LC&#8217;) ));<br \/>\n$products[$i][&#8216;product_url&#8217;] = $db_browse-&gt;f(&#8220;product_url&#8221;);<\/p>\n<p>4.\u00a0 Add thil core into your browse page:<\/p>\n<p>&lt;a href=&#8221;&lt;?php echo $sess-&gt;url( URL.&#8221;index.php?option=com_virtuemart&amp;page=shop.browse&amp;manufacturer_id=&#8221;. $manufacturer_id ) ?&gt;&#8221;&gt;<br \/>\n&lt;?php echo $mf_name; ?&gt;<br \/>\n&lt;\/a&gt;<\/p>\n<p>that should be it.<\/p>\n<p>It works for VM 1.1.2<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To do this first read this post: http:\/\/www.pcinvent.net\/technology\/programming\/how-to-hack-manufacture-name-in-virtuemart-browse-page-template where it is explained: How to hack Manufacture Name in Virtuemart Browse Page Template? Then step by&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/www.kavdesign.net\/blog\/coding\/how-to-add-a-link-to-the-manufacturer-for-each-product-in-the-virtuemart-caregory-browse-page\/\">Continue reading<span class=\"screen-reader-text\">How to add a link to the manufacturer, for each product in the virtuemart caregory browse page?<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[9,29],"tags":[33],"class_list":["post-141","post","type-post","status-publish","format-standard","hentry","category-coding","category-joomla","tag-virtuemart","entry"],"_links":{"self":[{"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/posts\/141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/comments?post=141"}],"version-history":[{"count":8,"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/posts\/141\/revisions"}],"predecessor-version":[{"id":143,"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/posts\/141\/revisions\/143"}],"wp:attachment":[{"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/media?parent=141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/categories?post=141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/tags?post=141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}