Originally Posted by
moZe
This definitely where it failing. In my_template/templates/tpl_product_info_display.php
<?php
/**
* display the main product image
*/
require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php');
echo $template;
?>
When I try to echo the variable $template, the page fails to load.
Im checking your suggestions now, MC. Thanks.
Correct, echoing $template which is a class will cause an error (and a log to be generated).
The entire section for that part in the default code looks like:
Code:
<!--bof Main Product Image -->
<?php
if (zen_not_null($products_image)) {
?>
<?php
/**
* display the main product image
*/
require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
}
?>
<!--eof Main Product Image-->
So what this does is go look to see if the file tpl_modules_main_product_image.php is located in your includes/templates/YOUR_TEMPLATE/templates override directory. If it is not found then it will use the template_default version of the same file. So, if you have tpl_modules_main_product_image.php in your templates override directory, then it will pull it. The default version of this file is:
Code:
<?php
/**
* Module Template
*
* @package templateSystem
* @copyright Copyright 2003-2011 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_modules_main_product_image.php 18698 2011-05-04 14:50:06Z wilt $
*/
?>
<?php require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_MAIN_PRODUCT_IMAGE)); ?>
<div id="productMainImage" class="centeredContent back">
<script language="javascript" type="text/javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . zen_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $_GET['products_id']) . '\\\')">' . zen_image(addslashes($products_image_medium), addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT) . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>'; ?>');
//--></script>
<noscript>
<?php
echo '<a href="' . zen_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $_GET['products_id']) . '" target="_blank">' . zen_image($products_image_medium, $products_name, MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT) . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>';
?>
</noscript>
</div>
As you can/may see in the first actual execution line, a file is "required" to be included and that is a file found in the directory DIR_WS_MODULES (Defined in includes/configure.php) that is then to use the override system again but have the name: FILENAME_MAIN_PRODUCT_IMAGE (I forget where that filename is defined, but it is part of the ZC code), anyways, that file is "included" and is required to be present otherwise the code will error at this point. Then there are the things that the module file will pull in to get the data needed to support the above code, and that, and that, etc.... Eventually if all of the files were stacked up one could see a straight run of code, but they are broken up because they serve unique purposes. Anyways... To validate that it is/is not a problem with your template, if you temporarily switch to the default ZC template, do things work like expected. If so, then the resolution should be focused primarily on your template overrides. If not, then it could be a slight mix, but at least it's a test that helps evaluate the condition(s).
Bookmarks