Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Database Optimizer


Jack_mcs

Recommended Posts

12 minutes ago, imusorka said:

@Gergely Having changed it to file, I now get the following error.

select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from currencies

What is the problem with this general query?

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

Just realized we went off topic here. I'll post my issue in the KISSer thread.

To stay on topic, could you please clarify why you think that the file cache method for sessions is better than the database method supported by this add-on? Do you have comparative parse times?

Link to comment
Share on other sites

@imusorka

- no session data area limit with 'text' field type (no crash with overflowed sessions)
- faster
- no problem with The garbage collector callback

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

  • 3 weeks later...

Hi Jack,

Thank you for this great add-on,.. I just installed it and have not run it yet, but I found several minor html issues with a couple of the files and listed them below. These issues seem to be the same for both Before_2.3 and After_2.3 folders in related files.

I also have some concerns regarding how will clearing the database of older customer tracking information affect reporting?

If you plan on doing another release of this add-on, it would be good to have some admin-controlled additional selection of how far back to go to remove such records (..and specifically for customer data), or even a checklist of options based on certain customer criteria that an admin could select to further filter the purge.

My understanding is that this add-on (with the particular checkbox selection) will remove ALL customer records from the database that have not purchased or logged-in in the last 300 days. So, if a customer made a purchase prior to that 300 day mark and has not bought anything since, I would not want them deleted. However, this is the current configuration of this add-on, is that correct?

Or, I may want to remove all customer record’s whose email is bouncing after a certain amount of time, regardless of the time passed since their last purchase or login.


/Before_2.3/New_Files_Only/admin/database_optimizer.php

On line 160, TEXT_VERSION_CHECK_UPDATES_UNRELEASED is not defined anywhere.
Line 173 is missing the closing </div></td> tags
Line 189 and line 205, there are duplicate border=”0” attributes within the same <table> opening tag
Line 197, there is an extra semicolon “;” at the end of the input tag for each of the checkboxes
Line 205, the nested table is not necessary, I removed it and added colspan=”3” and 25px padding to that <td> for the Update button
Line 155, the tep_draw_form() should open and close around the <table> tag: open before the table tag on line 158 and closed on line 161. There is an html error with it being placed between the two </tr> tags,.. though I’m sure the form functions properly. Similar issue on the second tep_draw_form() instance.


/Before_2.3/New_Files_Only/admin/includes/languages/english/database_optimizer.php

Line 21, where it say “Need An Addon?” ..needs to be either “Need&nbsp;An&nbsp;Addon?” or have an in-line css for white-space:nowrap; in the link because right now, it forces “Addon?” to the next line below the yellow button.


Aside from making those changes, I also defined the database_optimizer.php file in /admin/includes/filenames.php to stay consistent with the osC structure:

// Database Optimizer
  define('FILENAME_DATABASE_OPTIMIZER', 'database_optimizer.php');

And then changed that variable name in /admin/includes/boxes/tools.php and for the two tep_draw_form() instances in /admin/database_optimizer.php

And,.. I added a label to the “Select ALL” checkbox on /Before_2.3/New_Files_Only/admin/database_optimizer.php (line 192):

  <td colspan="2" class="smallText">Select ALL</td>
</tr>

 

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

I'm also getting javascript errors (see screenshot below) from the yellow buttons and there is nothing that displays when I click on them.

The first error in the screenshot is on page load and the second, when I click on any of the three javascript buttons.

I'm not good with javascript, so any help would be greatly appreciated. Thanks.

java-errors-screenshot.png

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

Demitry - Thank you for taking the time to report these issues. Regarding your comment about "how far back to go to remove such records", this is already present. See the settings in admin->Configuration->Database Optimizer. Regarding the other items:

Quote

On line 160, TEXT_VERSION_CHECK_UPDATES_UNRELEASED is not defined anywhere.

That definition is part of the Version Checker addon. I used to include it in all of my addons but it became a job updating them all when a new version of it was released. But I see that I didn't add a note to install it so I have added that now.

Quote

Line 173 is missing the closing </div></td> tags
Line 189 and line 205, there are duplicate border=”0” attributes within the same <table> opening tag
Line 197, there is an extra semicolon “;” at the end of the input tag for each of the checkboxes

I was not aware of the above items. They will be fixed in the next version.

Quote

Line 155, the tep_draw_form() should open and close around the <table> tag: open before the table tag on line 158 and closed on line 161. There is an html error with it being placed between the two </tr> tags,.. though I’m sure the form functions properly. Similar issue on the second tep_draw_form() instance.

I'm not aware of a rule that states what the form must surround. This sounds like a W3C error and is not a real issue, that I can see.

Regarding the change for FILENAME_DATABASE_OPTIMIZER, you must be using an old version of the addon. Filename references were removed several versions ago. I may have missed one but I searched the files and can't find any. Also, you mention the change is for the Before 2.3 version. Not using filenames does not apply to that version so it doesn't matter if they are used or not, though I did remove the references from there too. 

Regarding the yellow buttons, I can't duplicate that error and they work fine for me. If you are using an older version they may not work properly - I don't recall.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

2 hours ago, Jack_mcs said:
Quote

Line 155, the tep_draw_form() should open and close around the <table> tag: open before the table tag on line 158 and closed on line 161. There is an html error with it being placed between the two </tr> tags,.. though I’m sure the form functions properly. Similar issue on the second tep_draw_form() instance.

I'm not aware of a rule that states what the form must surround. This sounds like a W3C error and is not a real issue, that I can see.

My understanding of <form> rules is that a <form>...</form> is a single element that must be properly nested inside the rest of the page (nothing starting outside and ending inside, or vice-versa), and in turn, everything in the form is properly nested within <form>. Demitry should be able to examine the page HTML in his browser and see if these rules are violated.

"Between two </tr> tags" -- huh? I don't think there's any way to directly nest table rows without a </table> and more between them. Maybe there's an error in the surrounding page code, and not the form itself.

Link to comment
Share on other sites

Phil - What I meant is that it is OK to have code like any of the following (only relevant parts are shown). The way I read what you posted is that the first method is the only correct one. Is that correct? I have to admit, I don't pay a lot of attention to html errors since they usually don't cause any problems. I've never had a form not work when coded in any of the following ways but maybe it will break in future doctypes.

<form>
  <table>
  </table>
</form>

<table>
  <form>
    <tr>
    </tr>
  </form>
<table>  
  
<table>
  <tr>
    <form>
      <td>
      </td>
    </form>
  </tr>
</table>    

 

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Hi Jack, Phil,

Thank you for pointing out the configuration settings. I did not even realize they were there! I was focused on the /admin/Tools/Database Optimizer.

I figured that the undefined variable was for Version Checker, which I don't have installed,.. but thought I'd mention it anyway for those folks that don't have Version Checker either.

As far as the form issue, I do believe it is a W3C validation issue and like I mentioned, that the forms likely function properly. I looked at the code in FF and it points out all the html errors in red, which helps me locate and fix them. I placed the form tags around the table on both forms and the error went away. On the second one the opening form tag is inside a closed <td></td> tag (line 187) and the closing one is outside of a closing </tr> tag, which does not follow the form rules you listed above. Please don't take it the wrong way,.. my understanding is that you're more of a back-end developer and your php & other code is fantastic! I just try to keep the code as clean as I can, which is probably a waste of time and a bit overkill.

As for adding the file name definition to /admin/includes/filenames.php, ..that was something I did to stay consistent with the osC file structure. My current version is MS2.2 (though I'm about to make the latest BS Edge leap) and my site does have a defined file structure. I did have a look at osC 2.3.4 and it does have the /admin/includes/filenames.php file, so maybe I'm misunderstanding your reply on this because the filename definitions do exist in the newer version as well as in mine. Regardless, it was a minor tweak that does not affect anything in terms of the add-on's functionality... other than stroke my OCD, lol

I included a screenshot of the buttons without the inline css for nowrap that I added and you can see the issue with the center button link. I don't think I downloaded an old version of the add-on. I always try to get the complete & latest contribution that fits my needs. However, I will go back and look to see if this was the most recent one.

Any suggestions on the javascript error for the buttons from the screenshot above? It's not a big deal if I cannot get them working. I included that language definitions file and echoed the descriptions variable below the output message. So, I have all the descriptions on the same page.

I ran the optimization last night and it was amazing!!! reduced my database by 86.74% Thank you!!! Works Awesome!

 

 

database-optimizer.png

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

Actually, that center yellow button link issue is likely due to the TEXT_VERSION_CHECK_UPDATES_UNRELEASED variable being undefined.  If you cannot replicate this issue, then it is probably that long variable name that is pushing the buttons to a smaller width and thereby, the link of the center button onto the next line.

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

Regarding the form mistake at line 187, in the latest version, there isn't a form there at all. Perhaps your changes have altered the placement. I should be looking at the html more closely and will try to do that in the future.

The 2.3.4 version of oscommerce does have a filenames file but the 2.3.4 BS version does not. But I removed the use of filename_ in both versions of this addon. I may have missed some in the pre-2.3.4 version but I run a version of that shop myself and it doesn't have any failures so I don't think so.

The missing text could definitely cause the layout issue. It might cause the javascript error too. The best thing to do is to install the Version Checker addon (it is just an upload to install).

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

22 hours ago, Jack_mcs said:

Phil - What I meant is that it is OK to have code like any of the following (only relevant parts are shown). The way I read what you posted is that the first method is the only correct one. Is that correct? I have to admit, I don't pay a lot of attention to html errors since they usually don't cause any problems. I've never had a form not work when coded in any of the following ways but maybe it will break in future doctypes.


<form>
  <table>
  </table>
</form>

<table>
  <form>
    <tr>
    </tr>
  </form>
<table>  
  
<table>
  <tr>
    <form>
      <td>
      </td>
    </form>
  </tr>
</table>    

 

Well, I think only your first example is correct HTML. Most HTML validators will squawk about unexpected tags (e.g., expecting a <tr> and seeing a <form>). Many HTML tags have a list of legal parent and child tags. Most browsers will attempt to fix up problem nesting and produce something reasonable looking (by inserting new tags), but it's bad practice to rely on that behavior. Your HTML should be properly structured (proper nesting and proper parents and children) if you want the best chances of it always working correctly. Within a table, all content such as a form should be within <td>...</td>, and not in arbitrary places.

Link to comment
Share on other sites

I checked again, and I did download the latest version (V 1.6) that was from Jan 15th this year.

Does keeping the ON/OFF setting to ON in configuration, automatically make it a cron job? In other words, if I only wanted to run it manually, would I have to keep that setting turned off and only turn it on when I wanted to run the optimization?

 

 

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

Jack,

That line is 187 and the form closing tag is on line 211. I got that line number from your file not my changed one. Here is a screenshot of it in DreamWeaver to show what I'm talking about. This shows the whole second form and some of the other stuff I mentioned.

 

 

form-screenshot.png

Edited by Demitry

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

Demitry - The on/off setting is ignored when it is ran manually in Tools. It is only checked when the cron job is ran. It does not create a crong job. You have to set that up yourself.

Regarding line 187, thanks for following up on this. When I looked at it before I was looking in the 2.3.4 file. I looked at the pre-2.3.4 file and see it now. At line 187 in that file and line 154 in the other version, there is an extra </td> at the end of the line. It should be removed. I think that will fix the problem you are seeing.

 

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

right, but removing the closing </td> tag will not resolve it, because then it is followed by an open <tr> tag (as in... <td><form><tr>). Here is a screenshot of how I changed it (including some other edits).

Thank you for the cron job clarification. I initially thought that if that ON/OFF setting is turned to ON, then it would initiate the cron job based on the number of days increment. However, I am glad that I do not have to turn it on and off to apply a manual run. Thank you for that.

 

 

form-fixed-screenshot.png

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

If possible, please post a link to that file so I can compare it to what I have. From the image, it looks like you have an extra tr but It is difficult to tell from an image.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I've never done that and I'm not sure how to do it. I can just paste that code for the page here and you can copy it into a file and look at it in DreamWeaver.

Just a precaution for anyone else who looks at this code, ..This code has my modifications and will not work on your site without modifications to other files, so don't use it!

 

<?php
/*
  $Id: database_optimizer_cron.php,v 1.0 2011/02/02
  database_optimizer_cron.php Originally Created by: Jack_mcs - http://www.oscommerce-solution.com
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce
  Portions Copyright 2011 oscommerce-solution.com

  Released under the GNU General Public License
*/

  require('includes/application_top.php');
  require('includes/database_optimizer_db_handler.php');
  require('includes/languages/english/database_optimizer/database_optimizer_need_help.php');

  DO_CheckDatabase();
  $actionRunOptimizer  = ((isset($_POST['action_run_optimizer']) && $_POST['action_run_optimizer'] == 'process') ? true : false);
  $currentVersion = '';
  $message = '';
  /********************** BEGIN VERSION CHECKER *********************/
  if (file_exists('includes/functions/version_checker.php')) {
      require('includes/languages/' . $language . '/version_checker.php');
      require('includes/functions/version_checker.php');
      $contribPath = 'http://addons.oscommerce.com/info/4441';
      $currentVersion = 'Database Optimizer V 1.6';
      $contribName = 'Database Optimizer V';
      $versionStatus = '';
  }
  /********************** END VERSION CHECKER *********************/

  if (isset($_POST['action']))  {
      /********************** CHECK THE VERSION ***********************/
      if ($_POST['action'] == 'getversion') {
          if (isset($_POST['version_check']) && $_POST['version_check'] == 'on') {
              $versionStatus = AnnounceVersion($contribPath, $currentVersion, $contribName);
          }
      }
  }

  else if ($actionRunOptimizer) {
      $forceOptimize = true;       //this is being ran manually so ignore the setting for optimizing
      require('includes/functions/database_optimizer.php');
      require('includes/modules/database_optimizer.php');
      if (! $optionSelected) {
          $messageStack->add(ERROR_NO_OPTION_SELECTED, 'error');
      }
  }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<link rel="stylesheet" type="text/css" href="includes/database_optimizer.css">
<script type="text/javascript" src="includes/general.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/jquery-ui.css" type="text/css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js"></script>
<script type="text/javascript"><!--
function showHelp(page) { 
//console.log('show help '+page);
	$( "#do_help" ).dialog({
  show: "fade",
  hide: "fade",
  position: ['middle',100], 
  width: 600,
  height: 400,
  modal: true,
  open: function(event, ui)	{ 
   $(this).load(page);
  }
  //, buttons: { "Ok": function() { $(this).dialog("close"); } }
 });
}
function ToggleBoxes(cnt) {   
  for (i = 0; i < cnt; i++) { 
    var id = 'opt_'+ i;
    if (document.getElementById(id).checked == true) {
      document.getElementById(id).checked = false;
    } else {
      document.getElementById(id).checked = true;
    }
  }  
} 
//--></script>
<style type="text/css">
table.BorderedBox {border:1px solid #ddd; background-color:#eee; }
.do_small { float:right;font-family:Verdana, Arial, sans-serif; font-size:10px; font-weight:bold; color:#ff0000 }
.do_small_inline { display:inline-block; font-family:Verdana, Arial, sans-serif; font-size:10px; font-weight:bold; color:#ff0000 }
</style>
<script type="text/javascript"><!--
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=800,screenX=150,screenY=150,top=15,left=15')
}
//--></script>
</head>
<body>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="BorderedBox">
       <tr>
        <td><table border="0" width="40%" cellspacing="0" cellpadding="0">
           <tr>
             <td class="pageHeading" valign="top"><?php echo str_replace(" ", "&nbsp;", $currentVersion); ?></td>
           </tr>
           <tr>
             <td class="smallText" valign="top"><?php echo HEADING_TITLE_SUPPORT_THREAD; ?></td>
           </tr>
        </table></td>

        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
          <td class="smallText" align="right"><?php echo HEADING_TITLE_AUTHOR; ?></td>
         </tr>
<?php
        if (function_exists('AnnounceVersion')) {
            $idParts = explode(' ', $currentVersion);
            foreach ($idParts as $part) {
                     if ($part !== 'V') {
                         $name .= $part;
                     } else {
                         break;
                     }               
            }
            $id = $idParts[count($idParts)-1];
            if (DATABASE_OPTIMIZER_ENABLE_VERSION_CHECKER == 'true') {
?>
         <tr>
           <td style="float:right">
             <table border="0" cellpadding="0">
               <tr>
                 <td class="do_small"><?php echo AnnounceVersion($contribPath, $currentVersion, $contribName); ?></td>
                 <td class="do_small"><INPUT style="vertical-align:middle; margin-top:3px" type="radio" name="version_check_unreleased" onClick="window.open('http://www.oscommerce-solution.com/check_unreleased_updates.php?id=<?php echo $id; ?>&name=<?php echo $name; ?>')"><span style="vertical-align:top"><?php echo TEXT_VERSION_CHECK_UPDATES_UNRELEASED; ?></span></td>
               </tr>
             </table></td>                  
         </tr>
<?php      } elseif (tep_not_null($versionStatus)) {
                 echo '         <tr><td class="do_small">' . $versionStatus . '</td></tr>';
           } else {
                 $open_form = tep_draw_form('version_check', FILENAME_DATABASE_OPTIMIZER, '', 'post') . tep_draw_hidden_field('action', 'getversion');
?>
         <tr>
           <td style="float:right"><?php echo $open_form; ?><table border="0" cellpadding="0">
             <tr>
               <td class="do_small_inline"><INPUT style="vertical-align:middle; margin-top:0px" type="radio" name="version_check" onClick="this.form.submit();"><?php echo TEXT_VERSION_CHECK_UPDATES; ?></td>
               <td class="do_small_inline"><INPUT style="vertical-align:middle; margin-top:0px" type="radio" name="version_check_unreleased" onClick="window.open('http://www.oscommerce-solution.com/check_unreleased_updates.php?id=<?php echo $id; ?>&name=<?php echo $name; ?>')"><?php echo TEXT_VERSION_CHECK_UPDATES_UNRELEASED; ?></td>
             </tr>
           </table></form></td>
         </tr>
<?php 
           } // if (DATABASE_OPTIMIZER_ENABLE_VERSION_CHECKER == 'true')
		   
        } else { 
?>
         <tr>
           <td class="do_small"><?php echo TEXT_MISSING_VERSION_CHECKER; ?></td>
         </tr>
<?php 
        } // if (function_exists('AnnounceVersion'))
?>
        </table></td>
       </tr>

       <tr>
         <td class="do_small tt"><div style="float:right; margin-bottom:10px; color:sienna; text-align:center"><?php echo TEXT_HELP; ?></div></td>
       </tr>
      </table></td>
     </tr>

     <!-- BEGIN LOWER SECTION -->
     <tr>
      <td><table width="100%" border="0" cellspacing="0" cellpadding="0">

       <!-- BEGIN DELETE AND GENERATE FILE -->
        <tr>
          <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="right"><?php echo tep_draw_form('database_optimizer', FILENAME_DATABASE_OPTIMIZER, '', 'post') . tep_draw_hidden_field('action_run_optimizer', 'process'); ?><table width="100%" border="0" cellspacing="0" cellpadding="2">
                <tr>
                  <td><input type="checkbox" name="toggle_boxes" onClick="return ToggleBoxes('<?php echo count($optionsArray); ?>');"></td>
                  <td colspan="2" class="smallText">Select ALL</td>
                </tr>
<?php 
                $idx = 0;
                foreach ($optionsArray as $option) { 
?>
                <tr>
                  <td><input type="checkbox" name="<?php echo $option['post']; ?>" id="<?php echo 'opt_' . $idx; ?>"></td>
                  <td class="smallText"><?php echo $option['option']; ?></td>
                  <td class="smallText"><?php echo $option['explain']; ?></td>
                </tr>
<?php 
                     $idx++; 
                } // foreach
?>
                <tr>
                  <td colspan="3" align="center" style="padding:25px;"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE);?></td>
                </tr>
            </table></form></td>
           </tr>
           </table></td>
         </tr>
        </table></td>
       </tr>
       <!-- END DELETE AND GENERATE FILE -->

       <!-- BEGIN SHOW THE RESULTS -->
<?php if (tep_not_null($message)) { ?>
        <tr>
          <td colspan="2" class="smallText" style="padding:10px 0px 5px 10px;"><?php echo str_replace("\r\n", "<br>", $message); ?></td>
        </tr>
<?php } ?>
     <!-- END SHOW THE RESULTS -->
       
        <tr>
          <td class="main" style="padding:20px 0px 20px 10px;"><span style="font-weight:bold; color:red;">Please Note:</span> All settings for this Database Optimization feature can be managed on the <a href="configuration.php?gID=5011" style="font-size:12px;">Database Optimizer configuration</a> page. </td>
        </tr>
        <tr>
          <td colspan="2" class="main" style="padding:10px 0px 5px 10px;"><div style="width:75%;"><?php echo DO_TEXT_MAIN; ?></div></td>
        </tr>
     <!-- END LOWER SECTION -->

    </table></td>
<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

I don't see a difference in the code for lines 156 - 166 between your file and the uploaded one other than the change you made for the form statements. The tr's match between the two.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Oh, the horror. The horror. My eyes have melted. Tables within tables within tables for layout control is so 1999!

If the W3C validator is complaining about missing or misnested tags (elements), you'll have to copy and paste the HTML page code from your browser's View Page Source. Feel free to ****-out anything sensitive, but don't delete lines (or, conversely, just show pertinent blocks, with the lines numbered so they can be cross referenced with the validator messages). The PHP file you showed has no correlation with the validator line numbers, but will be useful for tracking down the source of problems, once we see exactly what the validator is complaining about. A look through the PHP code didn't seem to show anything particularly bad, and it's possible the validator simply got crossed up with all the nested tables.

Link to comment
Share on other sites

 

Phil, ..yeah, I know the nested tables are pretty bad, lol

Jack, The code I posted above has no errors displayed. This is my "altered" file. The particular form in question on your uploaded file opens the form inside of a closed <td></td> tags set and closes that form outside of a </tr> tag.

So, ...even if you can structure a form as <form><tr><td></td></tr></form> (by removing that closed </td> tag),... it is not proper structure to have an open <tr> tag follow an open <td> tag, which would be the case if you removed that closed </td> tag. As in,... <td><form><tr><td> ... </td></tr></form></td>

I only wanted to bring this to your attention to keep the code structure clean. What you do with it is completely your choice. I've already made the change in my file and I am happy with them.

 

 

Edited by Demitry

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

Having a <form> as the direct child of a <table> is certainly not kosher HTML. Most browsers will silently insert <tr> and <td> to make the DOM legal and presentable, but a validator will certainly squawk about it. Best in the long run to clean it up by making a <form> the child of  <td>, or maybe <table> the child of a <form>, or best of all, get rid of all the tables and use <div>s and CSS to control layout.

Link to comment
Share on other sites

Phil, ...agreed, ..and that's pretty much what I always try to do. Though as for the tables and nested tables, this is legacy osC code and we will likely be poking fun the same way at divs and nested divs at some point in the near future. :)

The issues I brought up are minor and do not affect the functionality of Jack's code and his fantastic contribution.

osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Link to comment
Share on other sites

On 8/26/2017 at 0:02 AM, Demitry said:

we will likely be poking fun the same way at divs and nested divs at some point in the near future. :)

What's this "Blu-ray" thing you old geezers keep prattling on about? Don't you watch a movie like everyone else does, by swallowing a pill? Oh wait, there's now a topical cream containing nanoflash chips, but it's facing stiff competition from the clip-on movie earring.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...