Author Topic: Bakery 1.72 save_form.php breaking template issue  (Read 1334 times)

Offline sky writer

  • Posts: 926
Bakery 1.72 save_form.php breaking template issue
« on: October 05, 2015, 04:58:24 AM »
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
Code: [Select]
// 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
Code: [Select]
// 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:
Code: [Select]
/* echo $end_of_wrapper;  // End of bakery wrapper */
The end_of_wrapper string is defined in the view.php file line~ 144
Code: [Select]
// 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:
Code: [Select]
</div> <!-- End of bakery wrapper -->like so:
Code: [Select]
<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.

freeSbee

  • Guest
Re: Bakery 1.72 save_form.php breaking template issue
« Reply #1 on: October 05, 2015, 01:00:24 PM »
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

Offline sky writer

  • Posts: 926
Re: Bakery 1.72 save_form.php breaking template issue
« Reply #2 on: October 05, 2015, 06:58:51 PM »
Glad to help.

Offline cookiesfromhome

  • Posts: 1
Re: Bakery 1.72 save_form.php breaking template issue
« Reply #3 on: October 27, 2015, 08:50:22 AM »
Nice post.Thanks for the information.

 

postern-length