I made some override customizations for a client's product_info page, placing those customizations in the /includes/templates/responsive_sheffield_blue/product_info/extra_main_template_vars directory. My client then reported that the following items were missing, but only on the product_info page:
- The shopping cart icon was missing in the header
- The payment icon was missing from the footer
- The social icons were missing from the left-side screen display
- The back-to-top icon was missing
The issue is that this template's overrides make calls to the $template->get_template_dir function with the first parameter (the filename) set to an empty string ('') for those missing items. Since the product_info directory exists as part of the template's directory structure, that function finds the directory present and returns that directory so that, for instance, instead of attempting to load /includes/templates/responsive_sheffield_blue/images/cart.png, the template atempts to load /includes/templates/responsive_sheffield_blue/product_info//cart.png.
Following are the changes required to correct this behavior:
/includes/templates/responsive_sheffield_blue/common/tpl_footer.php, line 45
Code:
<img src="<?php echo $template->get_template_dir(FOOTER_PAYMENT_ICON,DIR_WS_TEMPLATE, $current_page_base,'images').'/'.FOOTER_PAYMENT_ICON; //-20140413-lat9-add FOOTER_PAYMENT_ICON as 1st parameter ?>" alt="payments we accept" class="payments-image" />
/includes/templates/responsive_sheffield_blue/common/tpl_header.php, line 93
Code:
<li><img src="<?php echo $template->get_template_dir(HEADER_ICON_CART,DIR_WS_TEMPLATE, $current_page_base,'images').'/'.HEADER_ICON_CART; //-20140413-lat9-add HEADER_ICON_CART as 1st parameter ?>" alt="cart icon" class="cart-icon" /><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo $_SESSION['cart']->count_contents();?> <?php echo HEADER_TITLE_CART_ITEMS; ?> - <?php echo $currencies->format($_SESSION['cart']->show_total());?></a> | </li>
<li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
/includes/templates/responsive_sheffield_blue/common/tpl_main_page.php, lines 52, 58 and 80
Code:
<script src="<?php echo $template->get_template_dir('jquery.sidebar.js',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/jquery.sidebar.js'; //-20140413-lat9-add jquery.sidebar.js as 1st parameter ?>" type="text/javascript"></script>
Code:
html: "<a href='<?php echo FACEBOOK; ?>' target='_blank' title='<?php echo FACEBOOK_TITLE; ?>'><img src='<?php echo $template->get_template_dir(FACEBOOK_ICON,DIR_WS_TEMPLATE, $current_page_base,'images').'/'.FACEBOOK_ICON ?>' class='soico facebook-sh' alt='<?php echo FACEBOOK_ALT; ?>' /></a><a href='<?php echo TWITTER; ?>' target='_blank' title='<?php echo TWITTER_TITLE; ?>'><img src='<?php echo $template->get_template_dir(TWITTER_ICON,DIR_WS_TEMPLATE, $current_page_base,'images').'/'.TWITTER_ICON ?>' class='soico twitter-sh' alt='<?php echo TWITTER_ALT; ?>' /></a><a href='<?php echo YOUTUBE; ?>' target='_blank' title='<?php echo YOUTUBE_TITLE; ?>'><img src='<?php echo $template->get_template_dir(YOUTUBE_ICON,DIR_WS_TEMPLATE, $current_page_base,'images').'/'.YOUTUBE_ICON ?>' class='soico youtube-sh' alt='<?php echo YOUTUBE_ALT; ?>' /></a><a href='<?php echo PINTEREST; ?>' target='_blank' title='<?php echo PINTEREST_TITLE; ?>'><img src='<?php echo $template->get_template_dir(PINTEREST_ICON,DIR_WS_TEMPLATE, $current_page_base,'images').'/'.PINTEREST_ICON ?>' class='soico pinterest-sh' alt='<?php echo PINTEREST_ALT; ?>' /></a><a href='<?php echo GOOGLE; ?>' target='_blank' title='<?php echo GOOGLE_TITLE; ?>'><img src='<?php echo $template->get_template_dir(GOOGLE_ICON,DIR_WS_TEMPLATE, $current_page_base,'images').'/'.GOOGLE_ICON ?>' class='soico google-sh' alt='<?php echo GOOGLE_ALT; ?>' /></a><a href='<?php echo BLOG; ?>' target='_blank' title='<?php echo BLOG_TITLE; ?>'><img src='<?php echo $template->get_template_dir(BLOG_ICON,DIR_WS_TEMPLATE, $current_page_base,'images').'/'.BLOG_ICON ?>' class='soico blog-sh' alt='<?php echo BLOG_ALT; ?>!' /></a>", // can be anything; 20140413-la9-Add 1st parameters to *all* get_template_dir calls
Code:
<script src="<?php echo $template->get_template_dir('back_to_top.min.js',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/back_to_top.min.js'; //-20140413-lat9-Add 1st parm to call ?>" type="text/javascript"></script>
Bookmarks