Sorry but I had to rewrote this function to be IE compatible (you can see a demo of its use on tomatocart.biztrak.fr - button search & add to cart). It is as following:
<?php
/**
* Generate an internal URL address for the catalog side
*
* @param string $class: classname of the button
* @param string $label: value of the button
* @param boolean $submit: if true then the button is a part of a form
* @param string $submit_link: action link of the button
*/
function osc_draw_css_button($class='button', $label='', $submit=true, $submit_link='', $parameters=null)
{
global $osC_Language, $osC_Template;
$image_submit = '<input type="submit" class="'.$class.'"';
if (!empty($label) && isset($label)) { $image_submit .= ' value="'.$label.'"'; }
if (!empty($parameters)) { $image_submit .= ' ' . $parameters; }
$image_submit .= ' />';
if (!($submit || empty($submit_link)))
{
return "<form method='post' action='".$submit_link."'>".$image_submit."</form>";
}
else
{
return $image_submit;
}
}
?>
You can then use it to draw an "add to cart" button like this:
osc_draw_css_button('buttonAddMedium', $osC_Language->get('button_add_to_cart'), false, osc_href_link(FILENAME_PRODUCTS, $Qproducts->value('products_id') . '&action=cart_add'))
where "buttonAddMedium" is the class name of the button (to modify in the stylesheet.css file of the template) and the standard function osc_href_link permit to construct an action url.
The interest of this new function is to build one time a button (normal, hover and active css values can be defined in stylesheet.css an you can customize you button) and use it everywhere by changing the link & the label (you won't have now to drow one button per action and per language).
Hope it can help you for templating and welcome in the tomatocart promising adventure.
Helgvor STOLL