The code is below.
PHP Code:
define("IMO_JPG_CHEIE","Products");
if(ENABLE_SSL == 'true'){ define("IMO_MEDIA_URL",HTTPS_SERVER.DIR_WS_HTTPS_CATALOG);}
else{ define("IMO_MEDIA_URL",HTTP_SERVER.DIR_WS_CATALOG);}
function imo_load_image($id_products=0,$alt,$atribut="default") {
$category = zen_get_products_category_id($id_products);
$category = zen_get_categories_name($category);
$name = zen_get_products_name($id_products);
$model = imo_get_products_model($id_products);
$link = IMO_Make_fake_jpg($category,$name,$model,$atribut);
return sprintf('<img alt="%s" src="%s">',$alt,IMO_MEDIA_URL.IMO_JPG_CHEIE.$link);
}
/*
* Functie responsabila cu conceperea linkului fake pentru poze
*/
function IMO_Make_fake_jpg($Category="",$Nume="",$Model="", $Atribut="",$term="png") {
$Nume = removeCharacters($Nume);
$Category = removeCharacters($Category);
return "/" . str_replace(" ","-",$Category) . "/".str_replace(" ","-",$Nume)."_".$Atribut."_".$Model.".".$term;
}
function removeCharacters($string) {
$removeCharacters = array("&","?","'",'"',"#",";");
foreach($removeCharacters as $val) {
$string = str_replace($val,"",$string);
}
return $string;
}
function imo_get_products_model($id_products){
global $db;
$check = $db->Execute("select products_model
from " . TABLE_PRODUCTS . "
where products_id='" . (int)$id_products . "'");
return $check->fields['products_model'];
}
It still crash. when i using zen_... instead of imo_....
Because zen-cart don`t come with a easy way to use multiple picture for each attribute i have to port my old implementation from 1.38 to this version and normal to make an upgrade. All the comment are in Romana .. sorry for that.
When i have time i will test to see where is the problem.
Because zen-cart is a modular system it must in future version to have a override system for function like zen_image .. or zen_href ...
Bookmarks