Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Buttons inside the categories box?


Mark1

Recommended Posts

Posted

Does anyone know how to use butons inside the categories box? I want to use custom buttons instead of just the words of the categories.

 

Any help would be appreciated.

 

 

thanks!!

 

Mark

Posted

patch catalog/includes/boxes/categories.php to use tep_image and use the languageID (set somewhere in formerly included PHPs) + categories-name to determine button to display...

// display category name

   $categories_string .= $foo[$counter]['name'];

 

instead of this line you'll probably want to add something more useful...

like this (i coded it right now - tested & working *G*)

// display category name

# build possible filename for category - using languageID PATH: WS_IMAGES/cats/<languagename>/categoryname.jpg 

$buttonfile = DIR_WS_IMAGES . "cats/" . $_SESSION['language'] ."/". $foo[$counter]['name'] . ".jpg";

# TODO: check for special chars and escape them (maybe use add_slashes ?



# determine if category image exists, if not - decide to display image or text

if (file_exists($buttonfile) == true ) {  #use image for category

 $categories_string .=  tep_image( 

       /*Filename*/ $buttonfile, 

       /*Description*/ $foo[$counter]['name'],

       /*Width*/ DISPLAY_IMAGE_WIDTH, 

       /*Height*/ '', 

       /*Additional Parameters*/ ''

 );

}	

else {  # good old text-category

 $categories_string .= "n<!-- Missing File:" .$buttonfile. "-->n"; # COMMENT THIS LINE OUT FOR PRODUCTION SERVER!

 $categories_string .= $foo[$counter]['name']; 

}

# END OF CATEGORIES - IMAGES Contrib

 

 

hint:

place this below the "function.... " line in order to dump all globals available

echo "<pre>"; print_r ($GLOBALS); echo "</pre>";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...