function Build_Minimal_Product_Listing($Product, $Product_Object, $Catalogue_URL = "") {
global $wpdb, $items_table_name, $fields_meta_table_name;
global $UPCP_Options;
$Links = $UPCP_Options->Get_Option("UPCP_Product_Links");
$ProductString = "";
$Currency_Symbol = $UPCP_Options->Get_Option("UPCP_Currency_Symbol");
$Currency_Symbol_Location = $UPCP_Options->Get_Option("UPCP_Currency_Symbol_Location");
$Thumbnail_Support = $UPCP_Options->Get_Option("UPCP_Thumbnail_Support");
$Pretty_Links = $UPCP_Options->Get_Option("UPCP_Pretty_Links");
$Permalink_Base = $UPCP_Options->Get_Option("UPCP_Permalink_Base");
if ($Permalink_Base == "") {$Permalink_Base = "product";}
if ( is_array($Product) ) {$Product = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $items_table_name WHERE Item_ID=%d", $Product['Item_ID'] ) );}
if ( ! is_object($Product) ) {return;}
if ($Product->Item_Sale_Mode == "Yes") {$Product->Item_Price = $Product->Item_Sale_Price;}
else {$Product->Item_Price = $Product->Item_Price;}
if ($Currency_Symbol_Location == "Before" and is_object($Product)) {$Product->Item_Price = $Currency_Symbol . $Product->Item_Price;}
elseif (is_object($Product)) {$Product->Item_Price .= $Currency_Symbol;}
$uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2);
if ($Catalogue_URL == "") {
$Base = $uri_parts[0];
if ($Pretty_Links == "Yes") {$Base = substr($Base, 0, strpos($Base, "/" . $Permalink_Base . "/")+1);}
}
else {$Base = $Catalogue_URL;}
if (trim($Product->Item_Link) != "") {$ItemLink = $Product->Item_Link;}
elseif ($Pretty_Links == "Yes") {$ItemLink = $Base . $Permalink_Base . "/" . $Product->Item_Slug . "/";}
elseif (isset($uri_parts[1]) and strpos($uri_parts[1], "page_id") !== false) {$ItemLink = $Base . "?" . substr($uri_parts[1], 0, strpos($uri_parts[1], "&")) . "&SingleProduct=" . $Product->Item_ID;}
else {$ItemLink = $Base . "?SingleProduct=" . $Product->Item_ID;}
if ($Product->Item_Photo_URL != "") {
$PhotoURL = htmlspecialchars($Product->Item_Photo_URL, ENT_QUOTES);
if ($Thumbnail_Support == "Yes") {
$Post_ID = UPCP_getIDfromGUID($PhotoURL);
if ($Post_ID != "") {
$PhotoURL_Array = wp_get_attachment_image_src($Post_ID,"medium");
$PhotoURL = $PhotoURL_Array[0];
}
}
}
else {$PhotoURL = plugins_url('ultimate-product-catalogue/images/No-Photo-Available.png');}
$ProductString .= "<a class='upcp-minimal-link' href='" . $ItemLink . "' " . ($Links == "New" ? "target='_blank'" : "") . ">";
$ProductString .= "<div class='upcp-minimal-title'>" . $Product->Item_Name . "</div>";
$ProductString .= "<div class='upcp-minimal-img-div'>";
$ProductString .= "<img class='upcp-minimal-img' src='" . $PhotoURL . "' alt='Product Image' />";
$ProductString .= "</div>";
if ( is_array($Product_Object) ) {$Product_Object = $wpdb->get_results( $wpdb->prepare( "SELECT Field_ID, Meta_Value FROM $fields_meta_table_name WHERE Item_ID=%d", $Product_Object->Get_Item_ID() ) );}
// if ( ! is_object($Product_Object) ) {return;}
$ProductString .= Get_Custom_Fields_Link($Product_Object->Get_Item_ID(), "my_btn");
//$ProductString .= "<div class='upcp-minimal-price'>" . $Product->Item_Price . "</div>";
$ProductString .= "</a>";
return $ProductString;
}