Parikesit Posted August 20, 2011 Posted August 20, 2011 I modified tep_draw_button function with below code. And also add jQuery.onready() to general.js file. File: admin/includes/functions/htmp_output.php Line: replace tep_draw_button function around line 344 function tep_draw_button($title = null, $icon = null, $link = null, $priority = null, $params = null) { $params = is_array($params) ? $params : array(tep_output_string($params)); $priority = strtolower($priority) == 'primary' ? 'primary' : 'secondary'; $button_types = array('submit', 'button', 'reset'); $params['type'] = !isset($params['type']) ? 'submit' : $params['type']; if (tep_not_null($link) || !in_array($params['type'], $button_types)) { $params['type'] = 'button'; } $params['class'] = isset($param['class']) ? $param['class'] : ''; $params['class'] .= ' oscDrawButton ' . $priority; if (tep_not_null($icon)) { $params['icon'] = $icon; } if (tep_not_null($link)) { $params['href'] = $link; unset($params['type']); if (isset($params['target'])) { $params['target'] = $params['target']; } elseif (isset($params['newwindow'])) { $params['target'] = '_blank'; } } if (tep_not_null($link)) { $output = '<a'; } else { $output = '<button'; } foreach ($params as $key=>$val) { if (is_numeric($key) && intval($key) == $key) { $output .= ' ' . $val; } else { $output .= ' ' . $key . '="' . tep_output_string($val) . '"'; } } if (tep_not_null($link)) { $output .= '>'.tep_output_string($title).'</a>'; } else { $output .= '>'.tep_output_string($title).'</button>'; } return $output; } File: admin/includes/general.js Line: add below code to the end of general.js //oscDrawButton: enhanced tep_draw_button function $(document).ready(function() { $('.oscDrawButton').each(function() { var icon = $(this).attr('icon') || null; var classType = $(this).hasClass('secondary') ? 'ui-priority-secondary' : 'ui-priority-primary'; var config = {}; if (icon) { if ($(this).hasClass('secondary-icon')) { config = {icons:{secondary:'ui-icon-'+icon}}; } else { config = {icons:{primary:'ui-icon-'+icon}}; } } $(this).removeClass('oscDrawButton primary secondary secondary-icon primary-icon'); $(this).button(config).removeClass('ui-priority-secondary ui-priority-primary').addClass(classType); }); }); Note: I attach general.js file below. Cheers, zaenal recent contributions: mySQLi extension for osc 2.X, OPI: advanced image handling (ajax, thumbnail, watermark, etc), and other contributions all here
Parikesit Posted August 20, 2011 Author Posted August 20, 2011 Note: I attach general.js file below. It's seem .js file not allowed. So I zip it and try to upload it again. recent contributions: mySQLi extension for osc 2.X, OPI: advanced image handling (ajax, thumbnail, watermark, etc), and other contributions all here
Parikesit Posted August 20, 2011 Author Posted August 20, 2011 Note: I attach general.js file below. general-js.zip recent contributions: mySQLi extension for osc 2.X, OPI: advanced image handling (ajax, thumbnail, watermark, etc), and other contributions all here
Parikesit Posted August 21, 2011 Author Posted August 21, 2011 File: admin/includes/functions/htmp_output.php Line: replace tep_draw_button function around Sorry, it should "admin/includes/functions/html_output.php" This modification also works for frontpage catalog. Just replace the same function in "path_to_catalog/includes/functions/html_output.php". Btw, I modified the layout/theme of frontpage catalog, and change all jQuery+jQueryUI with prototypeJS+scriptaculous. And this "tep_draw_button" function make me sick! >_< I think embedding jQuery (or any javascript framework) to PHP function is a bad habit. That's make oscommerce dependent to any javascript framework. And whenever we change the layout/design (for example changing jQuery to prototypeJS), we also need to make modification to PHP function. With above modification to "tep_draw_button", I easly change javascript framework B) @zaenal recent contributions: mySQLi extension for osc 2.X, OPI: advanced image handling (ajax, thumbnail, watermark, etc), and other contributions all here
Recommended Posts
Archived
This topic is now archived and is closed to further replies.