Disclaimer: This mod is provided on an "as-is" basis without warranty of any kind. Feel free to use and improve it, but please do not sell it.
Description: This mod is for those X-Cart masters who are not familiar with the templates structure yet. Install this mod, refresh any dynamic X-Cart page and check the HTML source. You'll see that X-Cart prints the templates names where the '{include}' Smarty tags are used. So you'll be able to find the required template easily, just check the source and find the template name near the necessary HTML code.
How to install:
0. This mod was created for X-Cart 4.1.7. If you use other X-Cart versions, you may need to alter the code.
1. Edit the '<xcart_dir>/include/func/func.core.php' file and add the following code before the last '>?' line:
PHP Code:
function func_show_as_comment($string, $end=false) {
$templates = array (
"buttons/go_image_menu.tpl",
"modules/Special_Offers/customer/cart_checkout_buttons.tpl",
"main/title_selector.tpl",
"modules/QuickBooks/orders.tpl",
"modules/UPS_OnLine_Tools/ups_currency.tpl",
"buttons/go_image.tpl",
"buttons/go_image_menu.tpl",
"main/image_property.tpl",
"main/include_js.tpl"
);
if (!in_array($string, $templates) ) {
echo "\n\n<!--";
if ($end) echo " / ";
echo "$string -->\n\n";
}
}
2. Edit the '<xcart_dir>/Smarty-2.6.12/Smarty.class.php' file, replace:
PHP Code:
function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
{
static $_cache_info = array();
with
PHP Code:
function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
{
static $_cache_info = array();
func_show_as_comment($resource_name);
then replace:
PHP Code:
ob_start();
if ($this->_is_compiled($resource_name, $_smarty_compile_path)
|| $this->_compile_resource($resource_name, $_smarty_compile_path))
{
include($_smarty_compile_path);
}
$_smarty_results = ob_get_contents();
ob_end_clean();
with
PHP Code:
ob_start();
if ($this->_is_compiled($resource_name, $_smarty_compile_path)
|| $this->_compile_resource($resource_name, $_smarty_compile_path))
{
include($_smarty_compile_path);
}
func_show_as_comment($resource_name, true);
$_smarty_results = ob_get_contents();
ob_end_clean();
3. Again edit the '<xcart_dir>/Smarty-2.6.12/Smarty.class.php' file, replace:
PHP Code:
function _smarty_include($params)
{
if ($this->debugging) {
with
PHP Code:
function _smarty_include($params)
{
func_show_as_comment($params[smarty_include_tpl_file]);
if ($this->debugging) {
and replace:
PHP Code:
$this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $debug_start_time;
}
if ($this->caching) {
$this->_cache_info['template'][$params['smarty_include_tpl_file']] = true;
}
}
with
PHP Code:
$this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $debug_start_time;
}
if ($this->caching) {
$this->_cache_info['template'][$params['smarty_include_tpl_file']] = true;
}
func_show_as_comment($params[smarty_include_tpl_file], true);
}
__________________
Eugene Kaznacheev,
Evangelist/Product Manager at Ecwid:
http://www.ecwid.com/ (since Sept 2009)
ex-Head of X-Cart Tech Support Department
ex- X-Cart Hosting Manager -
X-Cart hosting
ex-X-Cart Technical Support Engineer
Note: For the official guaranteed tech support services please turn to the
Customers HelpDesk.