Question: Show Product Type values on Product Details page in Virtuemart 2
We'll edit this file:
Note that if you are using a Virtuemart template, you might need to edit the file that is in your template directory instead.
Place this code somewhere at the top (or bottom) of the file:
And now place this function call wherever you want to display assigned Product Type information on the page:
/components/com_virtuemart/views/productdetails/tmpl/default.php
Note that if you are using a Virtuemart template, you might need to edit the file that is in your template directory instead.
Place this code somewhere at the top (or bottom) of the file:
function list_product_type($pid) { $db = JFactory::getDBO(); $html = ""; $q = "SELECT * FROM #__fastseller_product_product_type_xref "; $q .= "LEFT JOIN #__fastseller_product_type USING (product_type_id) "; $q .= "WHERE product_id='$pid' AND product_type_publish='Y' "; $q .= "ORDER BY product_type_list_order"; $db->setQuery($q); $pts = $db->loadObjectList(); $q = "SELECT * FROM #__fastseller_product_type_parameter "; $q .= "WHERE product_type_id="; foreach ($pts as $pt) { $html .= "<br />\n<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n"; $html .= "<tr><td colspan=\"2\"><strong>Info: ".$pt->product_type_name."</strong></td></tr>\n"; // SELECT parameter value of product $q2 = "SELECT * FROM #__fastseller_product_type_".$pt->product_type_id; $q2 .= " WHERE product_id='$pid'"; $db->setQuery($q2); $info = $db->loadAssoc(); $db->setQuery($q . $pt->product_type_id ." ORDER BY parameter_list_order"); $params = $db->loadObjectList(); foreach ($params as $param) { $html .= "<tr class=\"\" height=\"18\">\n"; $html .= "<td width=\"30%\">".$param->parameter_label; $html .= "</td>\n<td>"; $html .= $info[$param->parameter_name]." ".$param->parameter_unit."</td></tr>\n"; } $html .= "</table>\n"; } echo $html; }
And now place this function call wherever you want to display assigned Product Type information on the page:
// now call function $pid = JRequest::getVar('virtuemart_product_id', null); list_product_type($pid);