Thank you for the reply
I will eventually try to create my own funciton if this mod works. but im not getting anything showing under the products.
function show_snapshot($product_sku, $show_price=true, $show_addtocart=true ) {
echo $this->product_snapshot($product_sku, $show_price, $show_addtocart);
}
/**
* Returns HTML code for a snapshot of a product based on the product sku.
* This was written to provide a quick way to display a product inside of modules
*
* @param string $product_sku The SKU identifying the product
* @param boolean $show_price Show the product price?
* @param boolean $show_addtocart Show the add-to-cart link?
*/
function product_snapshot( $product_sku, $show_price=true, $show_addtocart=true ) {
global $sess, $VM_LANG, $mm_action_url;
$db = new ps_DB;
require_once(CLASSPATH.'ps_product_category.php');
$ps_product_category = new ps_product_category;
$q = "SELECT product_id, product_name, product_parent_id, product_thumb_image FROM #__{vm}_product WHERE product_sku='$product_sku'";
$db->query( $q );
$html = "";
if ($db->next_record()) {
$cid = $ps_product_category->get_cid( $db->f("product_id" ) );
$html .= "<span style=\"font-weight:bold;\">".$db->f("product_name")."</span>\n";
$html .= "<br />\n";
if ($db->f("product_parent_id")) {
$url = "?page=shop.product_details&category_id=$cid&flypage=".$this->get_flypage($db->f("product_parent_id"));
$url .= "&product_id=" . $db->f("product_parent_id");
} else {
$url = "?page=shop.product_details&category_id=$cid&flypage=".$this->get_flypage($db->f("product_id"));
$url .= "&product_id=" . $db->f("product_id");
}
$html .= "<a title=\"".$db->f("product_name")."\" href=\"". $sess->url($mm_action_url. "index.php" . $url)."\">";
$html .= $this->image_tag($db->f("product_thumb_image"), "alt=\"".$db->f("product_name")."\"");
$html .= "</a><br />\n";
$html .= $db->f("product_s_desc"); // <----------- MOD HERE.
if (_SHOW_PRICES == '1' && $show_price) {
// Show price, but without "including X% tax"
$html .= $this->show_price( $db->f("product_id"), true );
}
if (USE_AS_CATALOGUE != 1 && $show_addtocart && !strstr( $html, $VM_LANG->_PHPSHOP_PRODUCT_CALL)) {
$html .= "<br />\n";
$url = "?page=shop.cart&func=cartAdd&product_id=" . $db->f("product_id");
$html .= "<a title=\"".$VM_LANG->_PHPSHOP_CART_ADD_TO.": ".$db->f("product_name")."\" href=\"". $sess->url($mm_action_url . "index.php" . $url)."\">".$VM_LANG->_PHPSHOP_CART_ADD_TO."</a><br />\n";
}
}
return $html;
}
You can
1. cusrtomize the snapshot function or
2. In mod_featureprod.php, replace the first line of the database query with
$q = "SELECT DISTINCT product_sku, product_s_desc FROM #__{vm}_product, #__{vm}_product_category_xref, #__{vm}_category WHERE \n";
and print the value of $db->f("product_sku") after each call to the snapshot function.
Joseph