Location: PHPKode > projects > MyEasyShop > myEasySHOP/product_detail.php
<?PHP

/***************************************************/
/*		I N C L U D E S 		   */
/***************************************************/
	require ("etc/myShop.cfg");    
	require (LIBRARIES . "db_mySQL.inc");
	require (LIBRARIES . "template.inc");        
    require (LIBRARIES . "bll_product.inc");
    require (LIBRARIES . "bll_category.inc");
    require (LIBRARIES . "format.inc");
/***************************************************/
    
    if(empty($id)){
    	header ("Location: error.php?msg=Errore nel reperimento delle informazioni utente");
        exit;
    }
    
    $t 	= new Template(TEMPLATES . "product");
    
    $myArray = array(                   
                    "product_template_detail"		=>"product_detail.ihtml",
                    "product_attribute_row"			=>"product_attribute_row.ihtml");
                    
    $t->set_file($myArray);
    reset ($myArray);
	  
	$t->set_var("PAGE_OF_PRODUCT_DETAIL", 	"Lista dei prodotti"); 
		                 	
	$bll_product = new bll_product();		
    $bll_category = new bll_category();
	
    $myarrayproductdetail = $bll_product->get_product_detail($id);                            
         
    if ($myarrayproductdetail == false) {
    	header ("Location: error.php?id=2001");
    	exit;
    }

    if( $id != "0"){
        $sidcategoryparent = $bll_category->ret_idcategoryparent_by_id_product($id);
        $snamecategoryparent = $bll_category->ret_namecategory_by_id($sidcategoryparent);
        $t->set_var("LINK_CATEGORY_FATHER",    		"<FONT color=#6666FF face=verdana size=2><B>Categoria padre:<A HREF=\"categories_list.php?id=".$sidcategoryparent."\">".$snamecategoryparent."</A></B></FONT><BR><HR><BR>");
    } else {
        $t->set_var("LINK_CATEGORY_FATHER",    		"");
    }

    $t->set_var("PRODUCT_DETAIL_NAME",         	$myarrayproductdetail["name"]);                             
    $t->set_var("PRODUCT_DETAIL_DESCRIPTION", 	$myarrayproductdetail["description"]);         
    $t->set_var("PRODUCT_DETAIL_IMGTHUMB",    	PRODUCT_THUMB_IMAGE.$myarrayproductdetail["thumb_image"]);

    if ($myarrayproductdetail["full_image"]== ""){
    	$t->set_var("PRODUCT_DETAIL_FULL_IMAGE",    "zoom"); 
    }else{
    	$t->set_var("PRODUCT_DETAIL_FULL_IMAGE",    "<a href=".PRODUCT_FULL_IMAGE.$myarrayproductdetail["full_image"]." target=\"_new\">zoom</a>");
    }
    
    $t->set_var("PRODUCT_DETAIL_WEIGHT",    	$myarrayproductdetail["weight"]); 
    $t->set_var("PRODUCT_DETAIL_WEIGHT_UNIT",  	$myarrayproductdetail["weight_unit"]); 
    $t->set_var("PRODUCT_DETAIL_LENGTH",    	$myarrayproductdetail["length"]);
    $t->set_var("PRODUCT_DETAIL_WIDTH",        	$myarrayproductdetail["width"]);
    $t->set_var("PRODUCT_DETAIL_HEIGHT",    	$myarrayproductdetail["height"]);
    $t->set_var("PRODUCT_DETAIL_LWH_UNIT",    	$myarrayproductdetail["lwh_unit"]);
    $t->set_var("PRODUCT_DETAIL_URL",    		$myarrayproductdetail["url"]);    
    $t->set_var("PRODUCT_DETAIL_IN_STOCK",    	$myarrayproductdetail["in_stock"]);
    $t->set_var("PRODUCT_DETAIL_START_DATE",  	$myarrayproductdetail["product_start_date"]);
    $t->set_var("PRODUCT_DETAIL_END_DATE",    	$myarrayproductdetail["product_end_date"]);    
    $t->set_var("PRODUCT_DETAIL_PRICE",    		format_price($myarrayproductdetail["price"])); 
    $t->set_var("PRODUCT_DETAIL_PRICE_IVA",    	format_price($myarrayproductdetail["price"] + ($myarrayproductdetail["price"]*$myarrayproductdetail["iva"])));                                                                                  	 
    
    $t->set_var("BASKET_LINK",    				"basket.php");
    $t->set_var("PRODUCTS_LIST_LINK",    		"product.php?id=".$myarrayproductdetail["id_product"]);
    $t->set_var("ADD_PRODUCT_LINK",    			"basket_operations.php?act=add_basket&id_product=".$myarrayproductdetail["id_product"]);
    
    $myarrayproductattribute = $bll_product->get_product_attribute($id);
            
    if ($myarrayproductattribute == false) {
    	$t->set_var("PRODUCT_ATTRIBUTE_ROW",    "Note tecniche non presenti");
    } else {
    	$product_attribute_number = count($myarrayproductattribute);
	    for ($i = 0; $i < $product_attribute_number; $i++) 
	    {                                                     		
			$t->set_var("PRODUCT_ATTRIBUTE_NAME",       $myarrayproductattribute[$i]["name"]);                             
	        $t->set_var("PRODUCT_ATTRIBUTE_VALUE", 		$myarrayproductattribute[$i]["value"]);              
	        $t->parse("PRODUCT_ATTRIBUTE_ROW",          "product_attribute_row", true);                    
		} 
	}
        	
/*                                              
 * 
 * Valorizzazione delle intestazioni della tabella
 *
 */	                      
    $product_name                	= "Nome prodotto";
    $product_description    		= "Descrizione prodotto";
    $product_imgthumb               = "Immagine prodotto";
    $product_imgfull                = "Immagine prodotto";
    $product_weightandunit         	= "Peso prodotto";  
    $product_dimension				= "Dimensioni prodotto";    
    $product_length					= "Lunghezza prodotto";
    $product_width					= "Larghezza prodotto";     
    $product_height					= "Altezza prodotto";  
    $product_lwh_unit				= "Unità di misura";   
    $product_url					= "Indirizzo internet";
    $product_in_stock				= "Vendita in stock";      
    $product_price					= "Prezzo di listino";   
    
    //settable($myarrayproductdetail);                               
        
    $t->set_var("PRODUCT_LABEL_NAME",       $product_name);
    $t->set_var("DESCRIPTION_LABEL", 		$product_description);
    $t->set_var("IMGTHUMB_LABEL",        	$product_imgthumb);
    $t->set_var("IMGFULL_LABEL",        	$product_imgfull);    
    $t->set_var("WEIGHTANDUNIT_LABEL",      $product_weightandunit);
    $t->set_var("DIMENSION_LABEL",    		$product_dimension);  
    $t->set_var("LENGTH_LABEL",        		$product_length);
    $t->set_var("WIDTH_LABEL",        	 	$product_width);
    $t->set_var("HEIGHT_LABEL",        		$product_height);
    $t->set_var("LWH_UNIT_LABEL",        	$product_lwh_unit);
    $t->set_var("URL_LABEL",        		$product_url);
    $t->set_var("IN_STOCK_LABEL",        	$product_in_stock);
    $t->set_var("PRICE_LABEL",        		$product_price);
        
    $t->aparse("product_detail", 			"product_template_detail");                            
?>
Return current item: MyEasyShop