tpl_account_history_info_default.php issues
Windows 10
PHP 8.025
Apache2
Zencart 1.5.8a (both unmoded and moded)
While in the process of updating my cart from 1.5.7d to 1.5.8a, I ran into a couple of issues with the subject file.
First:
See: tpl_account_history_info_default.php around line 83
PHP Code:
<?php
/**
* Used to display any downloads associated with the cutomers account
*/
if (DOWNLOAD_ENABLED == 'true') require($template->get_template_dir('tpl_modules_downloads.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_downloads.php');
?>
The if qualifier (DOWNLOAD_ENABLED == 'true') is going to run the require code even if there are no products that are downloadable in the order.
Another qualifier is necessary to prevent it from processing unnecessarily, and, in my case, it causes horizontal spacing issues between Download and Status History & Comments.
I wrote the following code to fix it somewhat. It could probably be moved higher up the page where all the foreach code is ran but I'm leaving it where it's at for now...because it works.
PHP Code:
$order_includes_downloads = '';
foreach($order->products as $op) {
if (isset($op['attributes']) && !empty($op['attributes'])) {
foreach($op['attributes'] as $attr) {
$haystack_1 = nl2br(zen_output_string_protected($attr['option']));
$haystack_2 = nl2br(zen_output_string_protected($attr['value']));
$needle = 'Download';
if(stripos($haystack_1, $needle) !== false || stripos($haystack_2, $needle) !== false) {
$order_includes_downloads = true;
}
}
}
}
if (DOWNLOAD_ENABLED == 'true' && $order_includes_downloads == true) { ?>
<div id="accountHistoryDownloads" class="back"><?php
require($template->get_template_dir('tpl_modules_downloads.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_downloads.php'); ?>
</div><br class="clearBoth">
<?php
}
?>
Second:
My template would not recognize the constant 'HEADING_TAX' => 'Tax' from the default language file...lang.english.php. I had to put it in languages/english/MY TEMPLAGE/lang.account_history_info.php before it would work. That's a good temp fix but I don't know why or what causes it to do this...all the other "HEADING_" constants are working fine???
Third:
The code for creating new address with a new account, adding addresses to the account page, changing a shipping address, and changing a delivery address are nearly identical.
Wouldn't a function be better suited to handle all of these situations?
I will work on a function after I finish merging all of my files. I got sidetracked for 3 days messing with the account history and checkout pages because they are so intertwined.
That's all I can remember from upgrading this file.
Thanks.
Re: tpl_account_history_info_default.php issues
The code you have added to the template is already part of the download module. You don't have to do what you're doing.
Re: tpl_account_history_info_default.php issues
Quote:
Originally Posted by
swguy
The code you have added to the template is already part of the download module. You don't have to do what you're doing.
Thanks.
I didn't look at the download module...too focused on fixing the problem I was having.
The additional <div> and <br> clear both I added are necessary in my mostly tableless template.
I'm 3 weeks into upgrading my 1.5.7d files to 1.58a...getting tired and frustrated. May be time to take a break.
I will look at the download module tomorrow and probably modify it instead of this file.