Bakery 1.72 save_form.php breaking template issue



freeSbee

Hi sky writer

You are right. I was able to reproduce this and will fix it in the next version of Bakery. Thank you for the detailed bug report!

Regrads Christoph

sky writer

Not sure if this is a bug or something specific to my template.  If a field in the checkout "Submit order: Address" form is left blank or filled with an invalid entry, the page reloads with the warning "The fields highlighted in red are blank. Please enter the required information.", but the error check adds an extra closing div which breaks the/my template.  I was able to fix this issue by commenting out two lines in the save_form.php file.

In save_form.php the two checks, one for blank, one for invalid field are:

line ~42
// If blank fields show error message
if (isset($blanks)) {
   $form_error = $MOD_BAKERY['ERR_FIELD_BLANK'];
   $error_bg = $blanks;
   extract($_POST);
   include('view_form.php');
   echo $end_of_wrapper;  // End of bakery wrapper
   return;
}


line ~150
// If any errors occured show address form again
if (@is_array($errors)) { 
   $form_error = '';
   foreach ($errors as $value) {
      $form_error .= $value.'<br />';
   }
   $form_error .= '<br />'.$MOD_BAKERY['ERR_INVAL_TRY_AGAIN'];
   include('view_form.php');
   echo $end_of_wrapper;  // End of bakery wrapper
   return;
}


I commented out the problem line in both instances, like so:
/* echo $end_of_wrapper;  // End of bakery wrapper */

The end_of_wrapper string is defined in the view.php file line~ 144
// Add a wrapper for Bakery to help with layout
echo "\n<div id='mod_bakery_wrapper_f'>\n";
$end_of_wrapper = "\n</div> <!-- End of bakery wrapper -->\n";


and when this is added, in my template anyway, it results in two instances of:
</div> <!-- End of bakery wrapper -->
like so:
<script type='text/javascript'>
      <!--
      mod_bakery_toggle_s tate_f('CA', 'cust', 0);
      -->
   </script>
</div> <!-- End of bakery wrapper -->
</div> <!-- End of bakery wrapper -->
         <div class="clear">
         </div>
      </div>


I haven't found any issues arising from commenting out these lines, but others more knowledgeable may want to test it and comment.

Hope this helps.