We help IT Professionals succeed at work.

Parse error: syntax error

pdmstudios
pdmstudios asked
on
I'm having an issue with this php file, please help me out. It says I have a parse error on line 503.


<?php echo $header; ?>
<!-- start Global Mega Options AJAX product validation -->
<!-- Joseph De Araujo 2011 www.alreadymade.com -->
<script src="catalog/view/javascript/jquery/jquery-validate/jquery.validate.min.js" type="text/javascript"></script>
<script src="catalog/view/javascript/jquery/jquery-validate/lib/jquery.metadata.js" type="text/javascript"></script>
<script src="catalog/view/javascript/jquery/jquery-validate/lib/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$.metadata.setType("attr", "validate");
      $("#product").validate();
});
</script>

<?php echo $column_left; ?><?php echo $column_right; ?>

<div id="content">
  <div class="top">
    <div class="left"></div>
    <div class="right"></div>
    <div class="center">
      <h1><?php echo $heading_title; ?></h1>
    </div>
  </div>
  <div class="middle">
    <div style="width: 100%; margin-bottom: 30px;">
      <table style="width: 100%; border-collapse: collapse;">
        <tr>
          <td style="text-align: center; width: 250px; vertical-align: top;"><a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="thickbox" rel="gallery"><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" id="image" style="margin-bottom: 3px;" /></a><br />
            <span style="font-size: 11px;"><?php echo $text_enlarge; ?></span> | <a href="javascript:;"  style="font-size: 11px;" onclick="getPreview('<?php echo $thumb; ?>', '<?php echo $popup; ?>');">Restore default image</a></td>
          <td style="padding-left: 15px; width: 296px; vertical-align: top;"><table width="100%">
              <?php if ($display_price) { ?>
              <tr>
                <td><b><?php echo $text_price; ?></b></td>
                <td><?php if (!$special) { ?>
                  <span id="product_price"><?php echo $price; ?></span>
                  <?php } else { ?>
                  <span style="text-decoration: line-through;"><?php echo $price; ?></span> <span style="color: #F00;" id="product_price"><?php echo $special; ?></span>
                  <?php } ?></td>
              </tr>
              <?php } ?>
              <tr>
                <td><b><?php echo $text_availability; ?></b></td>
                <td><?php echo $stock; ?></td>
              </tr>
              <tr>
                <td><b><?php echo $text_model; ?></b></td>
                <td><?php echo $model; ?></td>
              </tr>
              <?php if ($manufacturer) { ?>
              <tr>
                <td><b><?php echo $text_manufacturer; ?></b></td>
                <td><a href="<?php echo str_replace('&', '&amp;', $manufacturers); ?>"><?php echo $manufacturer; ?></a></td>
              </tr>
              <?php } ?>
              <?php if ($review_status) { ?>
                    <tr>
                <td><b><?php echo $text_average; ?></b></td>
                <td><?php if ($average) { ?>
                  <img src="catalog/view/theme/default/image/stars_<?php echo $average . '.png'; ?>" alt="<?php echo $text_stars; ?>" style="margin-top: 2px;" />
                  <?php } else { ?>
                  <?php echo $text_no_rating; ?>
                  <?php } ?></td>
              </tr>
                    <?php } ?>
            </table>
            <br />
            <?php if ($display_price) { ?>
<!-- Start Alreadymade.com Global Mega Options
Replace your current options with this entire section of code
 -->
            <form action="<?php echo str_replace('&', '&amp;', $action); ?>" method="post" enctype="multipart/form-data" id="product">
            <?php if (!empty($options) || !empty($attributes)) { ?>
              <b><?php echo $text_options; ?></b><br />
              <div style="background: #FFFFCC; border: 1px solid #FFCC33; padding: 10px; margin-top: 2px; margin-bottom: 15px;">
                <table style="width: 100%;">
<!-- GMO start copy global options here -->
                <?php if (!empty($attributes)) { ?>
                  <?php foreach ($aoptions as $aoption) { ?>
                  <tr>
                    <td>
<?php if($aoption['mode'] != "hidden"){echo $aoption['name']; ?>:<br /><?php } ?>

<?php if($aoption['mode'] == "select"){ ?>
                      <select name="option[<?php echo $aoption['option_id']; ?>][]" id="option[<?php echo $aoption['option_id']; ?>]"<?php echo $aoption['option_value'][0]['extra']['reqd'] == '1' ? ' validate="required:true"' : ''; ?><?php echo isset($aoption['option_value'][0]['extra']['allowmultiple']) && $aoption['option_value'][0]['extra']['allowmultiple'] == '1' ? ' multiple="multiple"' : ''; ?><?php echo isset($aoption['option_value'][0]['extra']['list_height']) ? ' size="'.$aoption['option_value'][0]['extra']['list_height'].'"' : ''; ?>>
                        <option value="">Please select --------------- </option>
                        <?php foreach ($aoption['option_value'] as $option_value) { ?>
                        <option value="<?php echo $option_value['option_value_id']; ?>" <?php echo (isset($option_value['option_image']) && !empty($option_value['option_image']) ? 'data-image="'.$option_value['option_image_thumb'] .'" data-popup="'.$option_value['option_image_popup'] .'"' : ''); ?>><?php echo $option_value['name']; ?>
                        <?php if ($option_value['price']) { ?>
                        <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                        <?php } ?>
                        </option>
                        <?php } ?>
                      </select>
                    <?php } //end if select ?>

                    <?php if($aoption['mode'] == "radio"){ ?>
                        <?php
                        $reqdradio = '1';
                         foreach ($aoption['option_value'] as $option_value) { ?>
                        <input type="radio" name="option[<?php echo $aoption['option_id']; ?>][]" value="<?php echo $option_value['option_value_id']; ?>" <?php echo (isset($option_value['option_image']) && !empty($option_value['option_image']) ? 'onClick="getPreview(\''.$option_value['option_image_thumb'] .'\', \''.$option_value['option_image_popup'] .'\');"' : ''); ?><?php echo $option_value['extra']['reqd'] && $reqdradio == '1' ? 'validate="required:true" ' : ''; ?> />
                        <?php echo $option_value['name']; ?>
                          <?php if ($option_value['price']) { ?>
                          <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                          <?php } ?>
                          <br />
                        <?php
                        $reqdradio = '0';
                         } ?>
                    <?php } //end if radio ?>

                    <?php if($aoption['mode'] == "checkbox"){ ?>
                        <?php
                        $reqdchkbx = '1'; //set initial value to only render reqd on first option
                        /*[<?php echo $option_value['option_value_id']; ?>] */
                          foreach ($aoption['option_value'] as $option_value) { ?>
                        <input type="checkbox" name="option[<?php echo $aoption['option_id']; ?>][]" value="<?php echo $option_value['option_value_id']; ?>" <?php echo (isset($option_value['option_image']) && !empty($option_value['option_image']) ? 'onClick="getPreview(\''.$option_value['option_image_thumb'] .'\', \''.$option_value['option_image_popup'] .'\');"' : ''); ?><?php echo $option_value['extra']['reqd'] && $reqdchkbx == '1' ? 'validate="required:true, minlength:1" ' : ''; ?>/>
                        <?php echo $option_value['name']; ?>
                          <?php if ($option_value['price']) { ?>
                          <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                          <?php } ?>
                          <br />
                        <?php $reqdchkbx = '0';
                          }
                        ?>
                    <?php } //end if checkbox ?>

                    <?php if($aoption['mode'] == "hidden"){ ?>
                    <?php foreach ($aoption['option_value'] as $option_value) { ?>
                      <input type="hidden" name="txtoption[<?php echo $aoption['option_id']; ?>]" id="txtoption[<?php echo $aoption['option_id']; ?>]" value="" <?php echo isset($option_value['extras']['txtmaxlength']) ? 'maxlength="'. $option_value['extras']['txtmaxlength'] .'"' : ''; ?> />
                    <?php } ?>
                    <?php } //end if hidden ?>

                    <?php if($aoption['mode'] == "text"){ ?>
                    <?php foreach ($aoption['option_value'] as $option_value) { ?>
                      <input type="text" name="txtoption[<?php echo $aoption['option_id']; ?>]" id="txtoption[<?php echo $aoption['option_id']; ?>]" value="" <?php echo $option_value['extra']['reqd'] ? 'validate="required:true"' : ''; ?> <?php echo isset($option_value['extras']['txtmaxlength']) ? 'maxlength="'. $option_value['extras']['txtmaxlength'] .'"' : ''; ?> />
                          <?php if ($option_value['price']) { ?>
                          <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                          <?php } ?>
                    <?php } ?>
                    <?php } //end if text ?>

                    <?php if($aoption['mode'] == "upload"){ ?>
                    <input id="button<?php echo $aoption['option_id']; ?>" type="file" name="imageupload[]" value="" class="ajaxuploadfield" /><br>
                    <input type="hidden" name="txtoption[<?php echo $aoption['option_id']; ?>]" value="" id="image<?php echo $aoption['option_id']; ?>" /><span><?php if ($option_value['price']) { ?>
                          <?php echo $option_value['price']; ?>
                          <?php } ?></span>
                   <?php } //end if text ?>

                    <?php if($aoption['mode'] == "textarea"){ ?>
                    <?php foreach ($aoption['option_value'] as $option_value) { ?>
                      <textarea name="txtoption[<?php echo $aoption['option_id']; ?>]" id="txtoption[<?php echo $aoption['option_id']; ?>]"<?php echo isset($option_value['extra']['reqd']) && $option_value['extra']['reqd']=="1" ? ' validate="required:true"' : ''; ?> cols="40" rows="2" /></textarea>
                    <?php } ?>
                    <?php } //end if textarea ?>
                    </td>
                  </tr>
                  <?php } ?>
                <?php
                } ?>
<!-- GMO end copy global options here -->

<!-- GMO start copy of amended normal options -->
                  <?php foreach ($options as $option) { ?>
                  <tr>
                    <td>

<?php if($option['mode'] != "hidden"){echo $option['name']; ?>:<br /><?php } ?>

<!-- GMO start copy of amended normal options -->
       <?php foreach ($options as $option) { ?>
                  <tr>
                    <td>

<?php if($option['mode'] != "hidden"){echo $option['name']; ?>:<br /><?php } ?>
<?php if($option['mode'] == "select"){ ?>
                      <select name="option[<?php echo $option['option_id']; ?>][]" id="option[<?php echo $option['option_id']; ?>]"<?php echo $option['option_value'][0]['extra']['reqd'] == '1' ? ' validate="required:true"' : ''; ?><?php echo isset($option['option_value'][0]['extra']['allowmultiple']) && $option['option_value'][0]['extra']['allowmultiple'] == '1' ? ' multiple="multiple"' : ''; ?><?php echo isset($option['option_value'][0]['extra']['list_height']) ? ' size="'.$option['option_value'][0]['extra']['list_height'].'"' : ''; ?>>
         <option value="">Please select --------------- </option>
                        <?php foreach ($option['option_value'] as $option_value) { ?>
                        <option value="<?php echo $option_value['option_value_id']; ?>" <?php /*echo (isset($option_value['option_image']) && !empty($option_value['option_image']) ? 'data-image="'.$option_value['option_image_thumb'] .'" data-popup="'.$option_value['option_image_popup'] .'"' : ''); */?>><?php echo $option_value['name']; ?>
                        <?php if ($option_value['price']) { ?>
                        <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                        <?php } ?>
                        </option>
                        <?php } ?>
                      </select></td>
                    <?php } //end if select ?>

                    <?php if($option['mode'] == "radio"){ ?>
                        <?php
                        $reqdradio = '1';
                        foreach ($option['option_value'] as $option_value) { ?>
                        <input type="radio" name="option[<?php echo $option['option_id']; ?>][]" value="<?php echo $option_value['option_value_id']; ?>" <?php echo (isset($option_value['option_image']) && !empty($option_value['option_image']) ? 'onClick="getPreview(\''.$option_value['option_image_thumb'] .'\', \''.$option_value['option_image_popup'] .'\');"' : ''); ?><?php echo $option_value['extra']['reqd'] && $reqdradio == '1' ? 'validate="required:true" ' : ''; ?> />
                        <?php echo $option_value['name']; ?>
                          <?php if ($option_value['price']) { ?>
                          <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                          <?php } ?>
                          <br />
                        <?php
                        $reqdradio = '0';
                         } ?>
                    <?php } //end if radio ?>

                    <?php if($option['mode'] == "checkbox"){ ?>
                    <?php
                        $reqdchkbx = '1'; //set initial value to only render reqd on first option
                        foreach ($option['option_value'] as $option_value) { ?>
                        <input type="checkbox" name="option[<?php echo $option['option_id']; ?>][]" value="<?php echo $option_value['option_value_id']; ?>" <?php echo (isset($option_value['option_image']) && !empty($option_value['option_image']) ? 'onClick="getPreview(\''.$option_value['option_image_thumb'] .'\', \''.$option_value['option_image_popup'] .'\');"' : ''); ?><?php echo $option_value['extra']['reqd'] && $reqdchkbx == '1' ? 'validate="required:true, minlength:1" ' : ''; ?>/>
                        <?php echo $option_value['name']; ?>
                          <?php if ($option_value['price']) { ?>
                          <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                          <?php } ?>
                          <br />
                        <?php $reqdchkbx = '0';
                          }
                        ?>
                    <?php } //end if checkbox ?>

                    <?php if($option['mode'] == "text"){ ?>
                    <?php foreach ($option['option_value'] as $option_value) { ?>
                      <input type="text" name="txtoption[<?php echo $option['option_id']; ?>]" value="" <?php echo isset($option_value['extra']['reqd']) ? 'validate="required:true"' : ''; ?> <?php echo isset($option_value['extras']['txtmaxlength']) ? 'maxlength="'. $option_value['extras']['txtmaxlength'] .'"' : ''; ?> />
                    <?php } ?>
                    <?php } //end if text ?>

                    <?php if($option['mode'] == "hidden"){ ?>
                      <input type="hidden" name="txtoption[<?php echo $option['option_id']; ?>]" value="" <?php echo isset($option_value['extras']['txtmaxlength']) ? 'maxlength="'. $option_value['extras']['txtmaxlength'] .'"' : ''; ?> />
                    <?php } //end if hidden ?>

                    <?php if($option['mode'] == "upload"){ ?>
                    <input id="button<?php echo $option['option_id']; ?>" type="file" name="imageupload[]" value="" class="ajaxuploadfield" /><br>
                    <input type="hidden" name="txtoption[<?php echo $option['option_id']; ?>]" value="" id="image<?php echo $option['option_id']; ?>" />
<noscript>
<style>.ajaxuploadfield{display:none;}</style>
<input type="file" name="upoption[<?php echo $option['option_id']; ?>]" value="" />
</noscript>
                   <?php } //end if text ?>

                    <?php if($option['mode'] == "textarea"){ ?>
                    <?php foreach ($option['option_value'] as $option_value) { ?>
                      <textarea name="txtoption[<?php echo $option['option_id']; ?>]"<?php echo isset($option_value['extra']['reqd']) && $option_value['extra']['reqd']=="1" ? ' validate="required:true"' : ''; ?> /></textarea>
                    <?php } ?>
                    <?php } //end if textarea ?>
                    </td>
                  </tr>
                  <?php } ?>
<!-- GMO end copy amended normal options here -->

                </table>
              </div>
<!-- End Global Mega Options -->

              <?php } ?>
              <?php if ($display_price) { ?>
              <?php if ($discounts) { ?>
              <b><?php echo $text_discount; ?></b><br />
              <div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-top: 2px; margin-bottom: 15px;">
                <table style="width: 100%;">
                  <tr>
                    <td style="text-align: right;"><b><?php echo $text_order_quantity; ?></b></td>
                    <td style="text-align: right;"><b><?php echo $text_price_per_item; ?></b></td>
                  </tr>
                  <?php foreach ($discounts as $discount) { ?>
                  <tr>
                    <td style="text-align: right;"><?php echo $discount['quantity']; ?></td>
                    <td style="text-align: right;"><?php echo $discount['price']; ?></td>
                  </tr>
                  <?php } ?>
                </table>
              </div>
              <?php } ?>
              <?php } ?>
              <div class="content">
                <?php echo $text_qty; ?>
                <input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />
                <a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
                <?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?>
              </div>
              <div>
                <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
                <input type="hidden" name="redirect" value="<?php echo str_replace('&', '&amp;', $redirect); ?>" />
              </div>
            </form>
            <?php } ?></td>
        </tr>
      </table>
    </div>
    <div class="tabs">
      <a tab="#tab_description"><?php echo $tab_description; ?></a>
      <a tab="#tab_image"><?php echo $tab_image; ?>  (<?php echo count($images); ?>)</a>
      <?php if ($review_status) { ?><a tab="#tab_review"><?php echo $tab_review; ?></a><?php } ?>
      <a tab="#tab_related"><?php echo $tab_related; ?> (<?php echo count($products); ?>)</a>
    </div>
    <div id="tab_description" class="tab_page"><?php echo $description; ?></div>
    <?php if ($review_status) { ?>
    <div id="tab_review" class="tab_page">
      <div id="review"></div>
      <div class="heading" id="review_title"><?php echo $text_write; ?></div>
      <div class="content"><b><?php echo $entry_name; ?></b><br />
        <input type="text" name="name" value="" />
        <br />
        <br />
        <b><?php echo $entry_review; ?></b>
        <textarea name="text" style="width: 98%;" rows="8"></textarea>
        <span style="font-size: 11px;"><?php echo $text_note; ?></span><br />
        <br />
        <b><?php echo $entry_rating; ?></b> <span><?php echo $entry_bad; ?></span>&nbsp;
        <input type="radio" name="rating" value="1" style="margin: 0;" />
        &nbsp;
        <input type="radio" name="rating" value="2" style="margin: 0;" />
        &nbsp;
        <input type="radio" name="rating" value="3" style="margin: 0;" />
        &nbsp;
        <input type="radio" name="rating" value="4" style="margin: 0;" />
        &nbsp;
        <input type="radio" name="rating" value="5" style="margin: 0;" />
        &nbsp; <span><?php echo $entry_good; ?></span><br />
        <br />
        <b><?php echo $entry_captcha; ?></b><br />
        <input type="text" name="captcha" value="" autocomplete="off" />
        <br />
        <img src="index.php?route=product/product/captcha" id="captcha" /></div>
      <div class="buttons">
        <table>
          <tr>
            <td align="right"><a onclick="review();" class="button"><span><?php echo $button_continue; ?></span></a></td>
          </tr>
        </table>
      </div>
    </div>
    <?php } ?>
    <div id="tab_image" class="tab_page">
      <?php if ($images) { ?>
      <div style="display: inline-block;">
        <?php foreach ($images as $image) { ?>
        <div style="display: inline-block; float: left; text-align: center; margin-left: 5px; margin-right: 5px; margin-bottom: 10px;"><a href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>" class="thickbox" rel="gallery"><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" style="border: 1px solid #DDDDDD; margin-bottom: 3px;" /></a><br />
          <span style="font-size: 11px;"><?php echo $text_enlarge; ?></span></div>
        <?php } ?>
      </div>
      <?php } else { ?>
      <div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;"><?php echo $text_no_images; ?></div>
      <?php } ?>
    </div>
    <div id="tab_related" class="tab_page">
      <?php if ($products) { ?>
      <table class="list">
        <?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { ?>
        <tr>
          <?php for ($j = $i; $j < ($i + 4); $j++) { ?>
          <td width="25%"><?php if (isset($products[$j])) { ?>
            <a href="<?php echo str_replace('&', '&amp;', $products[$j]['href']); ?>"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a><br />
            <a href="<?php echo str_replace('&', '&amp;', $products[$j]['href']); ?>"><?php echo $products[$j]['name']; ?></a><br />
            <span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span><br />
            <?php if ($display_price) { ?>
            <?php if (!$products[$j]['special']) { ?>
            <span style="color: #900; font-weight: bold;"><?php echo $products[$j]['price']; ?></span>
            <?php } else { ?>
            <span style="color: #900; font-weight: bold; text-decoration: line-through;"><?php echo $products[$j]['price']; ?></span> <span style="color: #F00;"><?php echo $products[$j]['special']; ?></span>
            <?php } ?>
            <?php } ?>
                  <a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" >&nbsp;</a>
            <br />
            <?php if ($products[$j]['rating']) { ?>
            <img src="catalog/view/theme/default/image/stars_<?php echo $products[$j]['rating'] . '.png'; ?>" alt="<?php echo $products[$j]['stars']; ?>" />
            <?php } ?>
            <?php } ?></td>
          <?php } ?>
        </tr>
        <?php } ?>
      </table>
      <?php } else { ?>
      <div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;"><?php echo $text_no_related; ?></div>
      <?php } ?>
    </div>
  </div>
  <div class="bottom">
    <div class="left"></div>
    <div class="right"></div>
    <div class="center"></div>
  </div>
  <?php if ($tags) { ?>
  <div class="tags"><?php echo $text_tags; ?>
  <?php foreach ($tags as $tag) { ?>
  <a href="<?php echo $tag['href']; ?>"><?php echo $tag['tag']; ?></a>,
  <?php } ?>
  </div>
  <?php } ?>
</div>
<script type="text/javascript"><!--
$('#review .pagination a').live('click', function() {
      $('#review').slideUp('slow');
            
      $('#review').load(this.href);
      
      $('#review').slideDown('slow');
      
      return false;
});                  

$('#review').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?>');

function review() {
      $.ajax({
            type: 'POST',
            url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>',
            dataType: 'json',
            data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
            beforeSend: function() {
                  $('.success, .warning').remove();
                  $('#review_button').attr('disabled', 'disabled');
                  $('#review_title').after('<div class="wait"><img src="catalog/view/theme/default/image/loading_1.gif" alt="" /> <?php echo $text_wait; ?></div>');
            },
            complete: function() {
                  $('#review_button').attr('disabled', '');
                  $('.wait').remove();
            },
            success: function(data) {
                  if (data.error) {
                        $('#review_title').after('<div class="warning">' + data.error + '</div>');
                  }
                  
                  if (data.success) {
                        $('#review_title').after('<div class="success">' + data.success + '</div>');
                                                
                        $('input[name=\'name\']').val('');
                        $('textarea[name=\'text\']').val('');
                        $('input[name=\'rating\']:checked').attr('checked', '');
                        $('input[name=\'captcha\']').val('');
                  }
            }
      });
}
//--></script>
<script type="text/javascript"><!--
$.tabs('.tabs a');
//--></script>

<!-- START FILE UPLOAD SCRIPT -->
<script type="text/javascript" src="catalog/view/javascript/jquery/ajaxupload.js"></script>
<script type="text/javascript"><!--
$(document).ready(function() {

function setUpload(uploadid,image){
      new AjaxUpload(uploadid, {
            action: 'index.php?route=product/file',
            name: 'image',
            autoSubmit: true,
            responseType: 'json',
            onChange: function(file, extension) {},
            onSubmit: function(file, extension) {
                  $(uploadid).after('<img src="catalog/view/theme/default/image/loading_1.gif" id="loading" />');
            },
            onComplete : function(file,json){

                  if (json.error) {
                        alert(json.error);
                  } else {
                $(uploadid).replaceWith(file); //replace the file field with the name of file
                        $(image).attr('value', file); //add filename to input field (for the cart)

                //Experimental, custom for different setup
                //$(uploadid).remove();   //remove the upload field so it cannot be reused
                        //$(preview).attr('src', json.src); //return a preview file
                //$('<li></li>').appendTo($('#filelist')).text(file); //create an uploaded file list
                //For the list you need to create an element with an id of 'filelist' eg. div or td
                  }
            $('#loading').remove(); //remove the uploading animation

            }
      });
}//end function setUpload

  <?php
  if(isset($aoptions)){
   foreach ($aoptions as $aoption) {
    if($aoption['mode'] == "upload") {
  ?>
setUpload('#button<?php echo $aoption['option_id']; ?>','#image<?php echo $aoption['option_id']; ?>');
  <?php }}} ?>

  <?php
  if(isset($options)){
   foreach ($options as $option) {
    if($option['mode'] == "upload") {
  ?>
setUpload('#button<?php echo $option['option_id']; ?>','#image<?php echo $option['option_id']; ?>');
  <?php }}} ?>

});

//--></script>
<!-- END FILE UPLOAD SCRIPT -->

<script language="javascript" type="text/javascript"><!--
$('select').change(function() {
   getPreview($(this).children('option:selected').data('image'), $(this).children('option:selected').data('popup'));
});
function getPreview(image,popup) {
   $('#image').attr('src',image);
   $('a.thickbox').attr('href',popup);
}
//--></script>

<?php echo $footer; ?>
Comment
Watch Question

Dave BaldwinFixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014

Commented:
It's telling you that the PHP interpreter reached the end of the file and something was missing.  Since I get 501 lines in your code, it is likely that you have mis-matched curly braces '{}' somewhere so that either you are missing one or you have an extra.  Missing is when I usually get that error.  
possibly

            <?php if ($display_price) { ?>
at line 67 doesn't have a matching closing braces. or something else inside that Form
Most Valuable Expert 2011
Top Expert 2016
Commented:
@pdmstudios: Please use the code snippet feature to post code at EE.  It gives us line numbers and unispace fonts - makes it much easier to read and discuss the programming.

PHP parse errors have a text that accompanies them.  It is useful if you post the text of the error.  For example, the error message here is:
Parse error: syntax error, unexpected $end in /home/myaccount/public_html/RAY_temp_pdmstudios.php on line 501

The reason you have an error on like 503 and we see the error on line 501 is probably because you have a couple of extra blank lines that did not get carried forward in the posted code.

If this is really a PHP script (an entire PHP script) then something is missing.  The first line of the code uses an undefined variable.  You might want to add error_reporting(E_ALL) to help you catch these things before you find your code behaving unpredictably!

And finally a word about style and substance.  PHP lets you intermix program logic code and HTML presentation, dropping in and out of PHP, echoing variables to the browser stream, etc.  This is a terrible idea, and you should stop doing it before you get yourself into real trouble.  Instead, perform all of your data gathering and program logic in one PHP script.  Prepare all your PHP variable values before you send a single line of HTML to the browser.  Then substitute the PHP variables into the HTML strings, and send it all at once.  HEREDOC notation is useful for this kind of design.  If you do it that way, you will never again find yourself with 500+ lines of stuff and a hard-to-spot parse error.  This is often referred to as "separation of code and presentation layers" and it is one of the first things we are taught in computer science classes.

Best of luck with your project, ~Ray
<?php echo $header; ?>
<!-- start Global Mega Options AJAX product validation -->
<!-- Joseph De Araujo 2011 www.alreadymade.com -->
<script src="catalog/view/javascript/jquery/jquery-validate/jquery.validate.min.js" type="text/javascript"></script>
<script src="catalog/view/javascript/jquery/jquery-validate/lib/jquery.metadata.js" type="text/javascript"></script>
<script src="catalog/view/javascript/jquery/jquery-validate/lib/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$.metadata.setType("attr", "validate");
      $("#product").validate();
});
</script>

<?php echo $column_left; ?><?php echo $column_right; ?>

<div id="content">
  <div class="top">
    <div class="left"></div>
    <div class="right"></div>
    <div class="center">
      <h1><?php echo $heading_title; ?></h1>
    </div>
  </div>
  <div class="middle">
    <div style="width: 100%; margin-bottom: 30px;">
      <table style="width: 100%; border-collapse: collapse;">
        <tr>
          <td style="text-align: center; width: 250px; vertical-align: top;"><a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="thickbox" rel="gallery"><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" id="image" style="margin-bottom: 3px;" /></a><br />
            <span style="font-size: 11px;"><?php echo $text_enlarge; ?></span> | <a href="javascript:;"  style="font-size: 11px;" onclick="getPreview('<?php echo $thumb; ?>', '<?php echo $popup; ?>');">Restore default image</a></td>
          <td style="padding-left: 15px; width: 296px; vertical-align: top;"><table width="100%">
              <?php if ($display_price) { ?>
              <tr>
                <td><b><?php echo $text_price; ?></b></td>
                <td><?php if (!$special) { ?>
                  <span id="product_price"><?php echo $price; ?></span>
                  <?php } else { ?>
                  <span style="text-decoration: line-through;"><?php echo $price; ?></span> <span style="color: #F00;" id="product_price"><?php echo $special; ?></span>
                  <?php } ?></td>
              </tr>
              <?php } ?>
              <tr>
                <td><b><?php echo $text_availability; ?></b></td>
                <td><?php echo $stock; ?></td>
              </tr>
              <tr>
                <td><b><?php echo $text_model; ?></b></td>
                <td><?php echo $model; ?></td>
              </tr>
              <?php if ($manufacturer) { ?>
              <tr>
                <td><b><?php echo $text_manufacturer; ?></b></td>
                <td><a href="<?php echo str_replace('&', '&amp;', $manufacturers); ?>"><?php echo $manufacturer; ?></a></td>
              </tr>
              <?php } ?>
              <?php if ($review_status) { ?>
                    <tr>
                <td><b><?php echo $text_average; ?></b></td>
                <td><?php if ($average) { ?>
                  <img src="catalog/view/theme/default/image/stars_<?php echo $average . '.png'; ?>" alt="<?php echo $text_stars; ?>" style="margin-top: 2px;" />
                  <?php } else { ?>
                  <?php echo $text_no_rating; ?>
                  <?php } ?></td>
              </tr>
                    <?php } ?>
            </table>
            <br />
            <?php if ($display_price) { ?>
<!-- Start Alreadymade.com Global Mega Options
Replace your current options with this entire section of code
 -->
            <form action="<?php echo str_replace('&', '&amp;', $action); ?>" method="post" enctype="multipart/form-data" id="product">
            <?php if (!empty($options) || !empty($attributes)) { ?>
              <b><?php echo $text_options; ?></b><br />
              <div style="background: #FFFFCC; border: 1px solid #FFCC33; padding: 10px; margin-top: 2px; margin-bottom: 15px;">
                <table style="width: 100%;">
<!-- GMO start copy global options here -->
                <?php if (!empty($attributes)) { ?>
                  <?php foreach ($aoptions as $aoption) { ?>
                  <tr>
                    <td>
<?php if($aoption['mode'] != "hidden"){echo $aoption['name']; ?>:<br /><?php } ?>

<?php if($aoption['mode'] == "select"){ ?>
                      <select name="option[<?php echo $aoption['option_id']; ?>][]" id="option[<?php echo $aoption['option_id']; ?>]"<?php echo $aoption['option_value'][0]['extra']['reqd'] == '1' ? ' validate="required:true"' : ''; ?><?php echo isset($aoption['option_value'][0]['extra']['allowmultiple']) && $aoption['option_value'][0]['extra']['allowmultiple'] == '1' ? ' multiple="multiple"' : ''; ?><?php echo isset($aoption['option_value'][0]['extra']['list_height']) ? ' size="'.$aoption['option_value'][0]['extra']['list_height'].'"' : ''; ?>>
                        <option value="">Please select --------------- </option>
                        <?php foreach ($aoption['option_value'] as $option_value) { ?>
                        <option value="<?php echo $option_value['option_value_id']; ?>" <?php echo (isset($option_value['option_image']) && !empty($option_value['option_image']) ? 'data-image="'.$option_value['option_image_thumb'] .'" data-popup="'.$option_value['option_image_popup'] .'"' : ''); ?>><?php echo $option_value['name']; ?>
                        <?php if ($option_value['price']) { ?>
                        <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                        <?php } ?>
                        </option>
                        <?php } ?>
                      </select>
                    <?php } //end if select ?>

                    <?php if($aoption['mode'] == "radio"){ ?>
                        <?php
                        $reqdradio = '1';
                         foreach ($aoption['option_value'] as $option_value) { ?>
                        <input type="radio" name="option[<?php echo $aoption['option_id']; ?>][]" value="<?php echo $option_value['option_value_id']; ?>" <?php echo (isset($option_value['option_image']) && !empty($option_value['option_image']) ? 'onClick="getPreview(\''.$option_value['option_image_thumb'] .'\', \''.$option_value['option_image_popup'] .'\');"' : ''); ?><?php echo $option_value['extra']['reqd'] && $reqdradio == '1' ? 'validate="required:true" ' : ''; ?> />
                        <?php echo $option_value['name']; ?>
                          <?php if ($option_value['price']) { ?>
                          <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                          <?php } ?>
                          <br />
                        <?php
                        $reqdradio = '0';
                         } ?>
                    <?php } //end if radio ?>

                    <?php if($aoption['mode'] == "checkbox"){ ?>
                        <?php
                        $reqdchkbx = '1'; //set initial value to only render reqd on first option
                        /*[<?php echo $option_value['option_value_id']; ?>] */
                          foreach ($aoption['option_value'] as $option_value) { ?>
                        <input type="checkbox" name="option[<?php echo $aoption['option_id']; ?>][]" value="<?php echo $option_value['option_value_id']; ?>" <?php echo (isset($option_value['option_image']) && !empty($option_value['option_image']) ? 'onClick="getPreview(\''.$option_value['option_image_thumb'] .'\', \''.$option_value['option_image_popup'] .'\');"' : ''); ?><?php echo $option_value['extra']['reqd'] && $reqdchkbx == '1' ? 'validate="required:true, minlength:1" ' : ''; ?>/>
                        <?php echo $option_value['name']; ?>
                          <?php if ($option_value['price']) { ?>
                          <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                          <?php } ?>
                          <br />
                        <?php $reqdchkbx = '0';
                          }
                        ?>
                    <?php } //end if checkbox ?>

                    <?php if($aoption['mode'] == "hidden"){ ?>
                    <?php foreach ($aoption['option_value'] as $option_value) { ?>
                      <input type="hidden" name="txtoption[<?php echo $aoption['option_id']; ?>]" id="txtoption[<?php echo $aoption['option_id']; ?>]" value="" <?php echo isset($option_value['extras']['txtmaxlength']) ? 'maxlength="'. $option_value['extras']['txtmaxlength'] .'"' : ''; ?> />
                    <?php } ?>
                    <?php } //end if hidden ?>

                    <?php if($aoption['mode'] == "text"){ ?>
                    <?php foreach ($aoption['option_value'] as $option_value) { ?>
                      <input type="text" name="txtoption[<?php echo $aoption['option_id']; ?>]" id="txtoption[<?php echo $aoption['option_id']; ?>]" value="" <?php echo $option_value['extra']['reqd'] ? 'validate="required:true"' : ''; ?> <?php echo isset($option_value['extras']['txtmaxlength']) ? 'maxlength="'. $option_value['extras']['txtmaxlength'] .'"' : ''; ?> />
                          <?php if ($option_value['price']) { ?>
                          <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                          <?php } ?>
                    <?php } ?>
                    <?php } //end if text ?>

                    <?php if($aoption['mode'] == "upload"){ ?>
                    <input id="button<?php echo $aoption['option_id']; ?>" type="file" name="imageupload[]" value="" class="ajaxuploadfield" /><br>
                    <input type="hidden" name="txtoption[<?php echo $aoption['option_id']; ?>]" value="" id="image<?php echo $aoption['option_id']; ?>" /><span><?php if ($option_value['price']) { ?>
                          <?php echo $option_value['price']; ?>
                          <?php } ?></span>
                   <?php } //end if text ?>

                    <?php if($aoption['mode'] == "textarea"){ ?>
                    <?php foreach ($aoption['option_value'] as $option_value) { ?>
                      <textarea name="txtoption[<?php echo $aoption['option_id']; ?>]" id="txtoption[<?php echo $aoption['option_id']; ?>]"<?php echo isset($option_value['extra']['reqd']) && $option_value['extra']['reqd']=="1" ? ' validate="required:true"' : ''; ?> cols="40" rows="2" /></textarea>
                    <?php } ?>
                    <?php } //end if textarea ?>
                    </td>
                  </tr>
                  <?php } ?>
                <?php
                } ?>
<!-- GMO end copy global options here -->

<!-- GMO start copy of amended normal options -->
                  <?php foreach ($options as $option) { ?>
                  <tr>
                    <td>

<?php if($option['mode'] != "hidden"){echo $option['name']; ?>:<br /><?php } ?>

<!-- GMO start copy of amended normal options -->
       <?php foreach ($options as $option) { ?>
                  <tr>
                    <td>

<?php if($option['mode'] != "hidden"){echo $option['name']; ?>:<br /><?php } ?>
<?php if($option['mode'] == "select"){ ?>
                      <select name="option[<?php echo $option['option_id']; ?>][]" id="option[<?php echo $option['option_id']; ?>]"<?php echo $option['option_value'][0]['extra']['reqd'] == '1' ? ' validate="required:true"' : ''; ?><?php echo isset($option['option_value'][0]['extra']['allowmultiple']) && $option['option_value'][0]['extra']['allowmultiple'] == '1' ? ' multiple="multiple"' : ''; ?><?php echo isset($option['option_value'][0]['extra']['list_height']) ? ' size="'.$option['option_value'][0]['extra']['list_height'].'"' : ''; ?>>
         <option value="">Please select --------------- </option>
                        <?php foreach ($option['option_value'] as $option_value) { ?>
                        <option value="<?php echo $option_value['option_value_id']; ?>" <?php /*echo (isset($option_value['option_image']) && !empty($option_value['option_image']) ? 'data-image="'.$option_value['option_image_thumb'] .'" data-popup="'.$option_value['option_image_popup'] .'"' : ''); */?>><?php echo $option_value['name']; ?>
                        <?php if ($option_value['price']) { ?>
                        <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                        <?php } ?>
                        </option>
                        <?php } ?>
                      </select></td>
                    <?php } //end if select ?>

                    <?php if($option['mode'] == "radio"){ ?>
                        <?php
                        $reqdradio = '1';
                        foreach ($option['option_value'] as $option_value) { ?>
                        <input type="radio" name="option[<?php echo $option['option_id']; ?>][]" value="<?php echo $option_value['option_value_id']; ?>" <?php echo (isset($option_value['option_image']) && !empty($option_value['option_image']) ? 'onClick="getPreview(\''.$option_value['option_image_thumb'] .'\', \''.$option_value['option_image_popup'] .'\');"' : ''); ?><?php echo $option_value['extra']['reqd'] && $reqdradio == '1' ? 'validate="required:true" ' : ''; ?> />
                        <?php echo $option_value['name']; ?>
                          <?php if ($option_value['price']) { ?>
                          <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                          <?php } ?>
                          <br />
                        <?php
                        $reqdradio = '0';
                         } ?>
                    <?php } //end if radio ?>

                    <?php if($option['mode'] == "checkbox"){ ?>
                    <?php
                        $reqdchkbx = '1'; //set initial value to only render reqd on first option
                        foreach ($option['option_value'] as $option_value) { ?>
                        <input type="checkbox" name="option[<?php echo $option['option_id']; ?>][]" value="<?php echo $option_value['option_value_id']; ?>" <?php echo (isset($option_value['option_image']) && !empty($option_value['option_image']) ? 'onClick="getPreview(\''.$option_value['option_image_thumb'] .'\', \''.$option_value['option_image_popup'] .'\');"' : ''); ?><?php echo $option_value['extra']['reqd'] && $reqdchkbx == '1' ? 'validate="required:true, minlength:1" ' : ''; ?>/>
                        <?php echo $option_value['name']; ?>
                          <?php if ($option_value['price']) { ?>
                          <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                          <?php } ?>
                          <br />
                        <?php $reqdchkbx = '0';
                          }
                        ?>
                    <?php } //end if checkbox ?>

                    <?php if($option['mode'] == "text"){ ?>
                    <?php foreach ($option['option_value'] as $option_value) { ?>
                      <input type="text" name="txtoption[<?php echo $option['option_id']; ?>]" value="" <?php echo isset($option_value['extra']['reqd']) ? 'validate="required:true"' : ''; ?> <?php echo isset($option_value['extras']['txtmaxlength']) ? 'maxlength="'. $option_value['extras']['txtmaxlength'] .'"' : ''; ?> />
                    <?php } ?>
                    <?php } //end if text ?>

                    <?php if($option['mode'] == "hidden"){ ?>
                      <input type="hidden" name="txtoption[<?php echo $option['option_id']; ?>]" value="" <?php echo isset($option_value['extras']['txtmaxlength']) ? 'maxlength="'. $option_value['extras']['txtmaxlength'] .'"' : ''; ?> />
                    <?php } //end if hidden ?>

                    <?php if($option['mode'] == "upload"){ ?>
                    <input id="button<?php echo $option['option_id']; ?>" type="file" name="imageupload[]" value="" class="ajaxuploadfield" /><br>
                    <input type="hidden" name="txtoption[<?php echo $option['option_id']; ?>]" value="" id="image<?php echo $option['option_id']; ?>" />
<noscript>
<style>.ajaxuploadfield{display:none;}</style>
<input type="file" name="upoption[<?php echo $option['option_id']; ?>]" value="" />
</noscript>
                   <?php } //end if text ?>

                    <?php if($option['mode'] == "textarea"){ ?>
                    <?php foreach ($option['option_value'] as $option_value) { ?>
                      <textarea name="txtoption[<?php echo $option['option_id']; ?>]"<?php echo isset($option_value['extra']['reqd']) && $option_value['extra']['reqd']=="1" ? ' validate="required:true"' : ''; ?> /></textarea>
                    <?php } ?>
                    <?php } //end if textarea ?>
                    </td>
                  </tr>
                  <?php } ?>
<!-- GMO end copy amended normal options here -->

                </table>
              </div>
<!-- End Global Mega Options -->

              <?php } ?>
              <?php if ($display_price) { ?>
              <?php if ($discounts) { ?>
              <b><?php echo $text_discount; ?></b><br />
              <div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-top: 2px; margin-bottom: 15px;">
                <table style="width: 100%;">
                  <tr>
                    <td style="text-align: right;"><b><?php echo $text_order_quantity; ?></b></td>
                    <td style="text-align: right;"><b><?php echo $text_price_per_item; ?></b></td>
                  </tr>
                  <?php foreach ($discounts as $discount) { ?>
                  <tr>
                    <td style="text-align: right;"><?php echo $discount['quantity']; ?></td>
                    <td style="text-align: right;"><?php echo $discount['price']; ?></td>
                  </tr>
                  <?php } ?>
                </table>
              </div>
              <?php } ?>
              <?php } ?>
              <div class="content">
                <?php echo $text_qty; ?>
                <input type="text" name="quantity" size="3" value="<?php echo $minimum; ?>" />
                <a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
                <?php if ($minimum > 1) { ?><br/><small><?php echo $text_minimum; ?></small><?php } ?>
              </div>
              <div>
                <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
                <input type="hidden" name="redirect" value="<?php echo str_replace('&', '&amp;', $redirect); ?>" />
              </div>
            </form>
            <?php } ?></td>
        </tr>
      </table>
    </div>
    <div class="tabs">
      <a tab="#tab_description"><?php echo $tab_description; ?></a>
      <a tab="#tab_image"><?php echo $tab_image; ?>  (<?php echo count($images); ?>)</a>
      <?php if ($review_status) { ?><a tab="#tab_review"><?php echo $tab_review; ?></a><?php } ?>
      <a tab="#tab_related"><?php echo $tab_related; ?> (<?php echo count($products); ?>)</a>
    </div>
    <div id="tab_description" class="tab_page"><?php echo $description; ?></div>
    <?php if ($review_status) { ?>
    <div id="tab_review" class="tab_page">
      <div id="review"></div>
      <div class="heading" id="review_title"><?php echo $text_write; ?></div>
      <div class="content"><b><?php echo $entry_name; ?></b><br />
        <input type="text" name="name" value="" />
        <br />
        <br />
        <b><?php echo $entry_review; ?></b>
        <textarea name="text" style="width: 98%;" rows="8"></textarea>
        <span style="font-size: 11px;"><?php echo $text_note; ?></span><br />
        <br />
        <b><?php echo $entry_rating; ?></b> <span><?php echo $entry_bad; ?></span>&nbsp;
        <input type="radio" name="rating" value="1" style="margin: 0;" />
        &nbsp;
        <input type="radio" name="rating" value="2" style="margin: 0;" />
        &nbsp;
        <input type="radio" name="rating" value="3" style="margin: 0;" />
        &nbsp;
        <input type="radio" name="rating" value="4" style="margin: 0;" />
        &nbsp;
        <input type="radio" name="rating" value="5" style="margin: 0;" />
        &nbsp; <span><?php echo $entry_good; ?></span><br />
        <br />
        <b><?php echo $entry_captcha; ?></b><br />
        <input type="text" name="captcha" value="" autocomplete="off" />
        <br />
        <img src="index.php?route=product/product/captcha" id="captcha" /></div>
      <div class="buttons">
        <table>
          <tr>
            <td align="right"><a onclick="review();" class="button"><span><?php echo $button_continue; ?></span></a></td>
          </tr>
        </table>
      </div>
    </div>
    <?php } ?>
    <div id="tab_image" class="tab_page">
      <?php if ($images) { ?>
      <div style="display: inline-block;">
        <?php foreach ($images as $image) { ?>
        <div style="display: inline-block; float: left; text-align: center; margin-left: 5px; margin-right: 5px; margin-bottom: 10px;"><a href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>" class="thickbox" rel="gallery"><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" style="border: 1px solid #DDDDDD; margin-bottom: 3px;" /></a><br />
          <span style="font-size: 11px;"><?php echo $text_enlarge; ?></span></div>
        <?php } ?>
      </div>
      <?php } else { ?>
      <div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;"><?php echo $text_no_images; ?></div>
      <?php } ?>
    </div>
    <div id="tab_related" class="tab_page">
      <?php if ($products) { ?>
      <table class="list">
        <?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { ?>
        <tr>
          <?php for ($j = $i; $j < ($i + 4); $j++) { ?>
          <td width="25%"><?php if (isset($products[$j])) { ?>
            <a href="<?php echo str_replace('&', '&amp;', $products[$j]['href']); ?>"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a><br />
            <a href="<?php echo str_replace('&', '&amp;', $products[$j]['href']); ?>"><?php echo $products[$j]['name']; ?></a><br />
            <span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span><br />
            <?php if ($display_price) { ?>
            <?php if (!$products[$j]['special']) { ?>
            <span style="color: #900; font-weight: bold;"><?php echo $products[$j]['price']; ?></span>
            <?php } else { ?>
            <span style="color: #900; font-weight: bold; text-decoration: line-through;"><?php echo $products[$j]['price']; ?></span> <span style="color: #F00;"><?php echo $products[$j]['special']; ?></span>
            <?php } ?>
            <?php } ?>
                  <a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" >&nbsp;</a>
            <br />
            <?php if ($products[$j]['rating']) { ?>
            <img src="catalog/view/theme/default/image/stars_<?php echo $products[$j]['rating'] . '.png'; ?>" alt="<?php echo $products[$j]['stars']; ?>" />
            <?php } ?>
            <?php } ?></td>
          <?php } ?>
        </tr>
        <?php } ?>
      </table>
      <?php } else { ?>
      <div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;"><?php echo $text_no_related; ?></div>
      <?php } ?>
    </div>
  </div>
  <div class="bottom">
    <div class="left"></div>
    <div class="right"></div>
    <div class="center"></div>
  </div>
  <?php if ($tags) { ?>
  <div class="tags"><?php echo $text_tags; ?>
  <?php foreach ($tags as $tag) { ?>
  <a href="<?php echo $tag['href']; ?>"><?php echo $tag['tag']; ?></a>,
  <?php } ?>
  </div>
  <?php } ?>
</div>
<script type="text/javascript"><!--
$('#review .pagination a').live('click', function() {
      $('#review').slideUp('slow');
            
      $('#review').load(this.href);
      
      $('#review').slideDown('slow');
      
      return false;
});                  

$('#review').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?>');

function review() {
      $.ajax({
            type: 'POST',
            url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>',
            dataType: 'json',
            data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
            beforeSend: function() {
                  $('.success, .warning').remove();
                  $('#review_button').attr('disabled', 'disabled');
                  $('#review_title').after('<div class="wait"><img src="catalog/view/theme/default/image/loading_1.gif" alt="" /> <?php echo $text_wait; ?></div>');
            },
            complete: function() {
                  $('#review_button').attr('disabled', '');
                  $('.wait').remove();
            },
            success: function(data) {
                  if (data.error) {
                        $('#review_title').after('<div class="warning">' + data.error + '</div>');
                  }
                  
                  if (data.success) {
                        $('#review_title').after('<div class="success">' + data.success + '</div>');
                                                
                        $('input[name=\'name\']').val('');
                        $('textarea[name=\'text\']').val('');
                        $('input[name=\'rating\']:checked').attr('checked', '');
                        $('input[name=\'captcha\']').val('');
                  }
            }
      });
}
//--></script>
<script type="text/javascript"><!--
$.tabs('.tabs a');
//--></script>

<!-- START FILE UPLOAD SCRIPT -->
<script type="text/javascript" src="catalog/view/javascript/jquery/ajaxupload.js"></script>
<script type="text/javascript"><!--
$(document).ready(function() {

function setUpload(uploadid,image){
      new AjaxUpload(uploadid, {
            action: 'index.php?route=product/file',
            name: 'image',
            autoSubmit: true,
            responseType: 'json',
            onChange: function(file, extension) {},
            onSubmit: function(file, extension) {
                  $(uploadid).after('<img src="catalog/view/theme/default/image/loading_1.gif" id="loading" />');
            },
            onComplete : function(file,json){

                  if (json.error) {
                        alert(json.error);
                  } else {
                $(uploadid).replaceWith(file); //replace the file field with the name of file
                        $(image).attr('value', file); //add filename to input field (for the cart)

                //Experimental, custom for different setup
                //$(uploadid).remove();   //remove the upload field so it cannot be reused
                        //$(preview).attr('src', json.src); //return a preview file
                //$('<li></li>').appendTo($('#filelist')).text(file); //create an uploaded file list
                //For the list you need to create an element with an id of 'filelist' eg. div or td
                  }
            $('#loading').remove(); //remove the uploading animation

            }
      });
}//end function setUpload

  <?php
  if(isset($aoptions)){
   foreach ($aoptions as $aoption) {
    if($aoption['mode'] == "upload") {
  ?>
setUpload('#button<?php echo $aoption['option_id']; ?>','#image<?php echo $aoption['option_id']; ?>');
  <?php }}} ?>

  <?php
  if(isset($options)){
   foreach ($options as $option) {
    if($option['mode'] == "upload") {
  ?>
setUpload('#button<?php echo $option['option_id']; ?>','#image<?php echo $option['option_id']; ?>');
  <?php }}} ?>

});

//--></script>
<!-- END FILE UPLOAD SCRIPT -->

<script language="javascript" type="text/javascript"><!--
$('select').change(function() {
   getPreview($(this).children('option:selected').data('image'), $(this).children('option:selected').data('popup'));
});
function getPreview(image,popup) {
   $('#image').attr('src',image);
   $('a.thickbox').attr('href',popup);
}
//--></script>

<?php echo $footer; ?>

Open in new window

Most Valuable Expert 2011
Top Expert 2016

Commented:
http://www.experts-exchange.com/help/viewHelpPage.jsp?helpPageID=26

I'd like an explanation of why you marked this answer down to a "B" without even a single word of response or further question, thanks.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.