21 Aug
2012
Posted in: Tutorials
By    2 Comments

TomatoCart v1.1.7 to v1.1.8 Upgrade Guide!

The upgrade guide is a step-by-step tutorial to help users to upgrade TomatoCart v1.1.7 to v1.1.8. If you have not yet updated to v1.1.7, please review its upgrade guide before applying these changes.

Note: Always backup the complete system before you do the upgrade.

Update Steps

1. Datebase Upgrade

DROP TABLE IF EXISTS toc_wishlists_products_variants;
CREATE TABLE toc_wishlists_products_variants(
wishlists_products_variants_id int(11) NOT NULL AUTO_INCREMENT,
whishlists_id int(11) NOT NULL,
whishlists_products_id int(11) NOT NULL,
products_variants_groups_id int(11) NOT NULL,
products_variants_groups varchar(32) NOT NULL,
products_variants_values_id int(11) NOT NULL,
products_variants_values varchar(32) NOT NULL,
PRIMARY KEY (wishlists_products_variants_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO toc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Timezone(Get it at www.php.net/manual/en/timezones.php)', 'STORE_TIME_ZONE', '', 'The timezone my store is located in', '1', '8', now());
INSERT INTO toc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Synchronize cart with the database when customer logged in', 'SYNCHRONIZE_CART_WITH_DATABASE', '1', 'Synchronize cart with the database when customer logged in!', '1', '26', 'osc_cfg_use_get_boolean_value', 'osc_cfg_set_boolean_value(array(1, -1))', now());
INSERT INTO toc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Check stocks when synchronize cart with the database', 'CHECK_STOCKS_SYNCHRONIZE_CART_WITH_DATABASE', '1', 'Check stocks when synchronize cart with the database', '1', '27', 'osc_cfg_use_get_boolean_value', 'osc_cfg_set_boolean_value(array(1, -1))', now());
INSERT INTO toc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Display Product Attributes Filter', 'PRODUCT_ATTRIBUTES_FILTER', '1', 'Do you want to display the Product Attributes Filter?', '8', '10', 'osc_cfg_use_get_boolean_value', 'osc_cfg_set_boolean_value(array(1, -1))', now());
INSERT INTO toc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Link the Product Attributes and Category/Manufacturer Filter', 'PRODUCT_LINK_FILTER', '1', 'Do you want to filter the products with the Product Attributes Filter and Category/Manufacturer Filter at the same time?', '8', '11', 'osc_cfg_use_get_boolean_value', 'osc_cfg_set_boolean_value(array(1, -1))', now());
INSERT INTO toc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Display the telephone number', 'DISPLAY_TELEPHONE_NUMBER', '1', 'Set true to make the telephone number display in the order details.', '11', '6', 'osc_cfg_use_get_boolean_value', 'osc_cfg_set_boolean_value(array(1, -1))', now());
INSERT INTO toc_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Enable SSL Connection', 'EMAIL_SSL', '1', 'Connect the smtp server with ssl connection', '12', '7', 'osc_cfg_use_get_boolean_value', 'osc_cfg_set_boolean_value(array(1, -1))', now());

2. File Upgrade

In this release, a lot of the core files and template files were modified. Please update the core files as follows:

  • Upload and overwrite the complete source files in v1.1.8 except the includes/configure.php, ext/piwik/config/config.ini.php and the templates/glass_gray. (Note: if you have modified any core file, this action may override your modifications. )
  • For the template system, if you have make some changes to the template files, you need do some manual changes according the following step3 – Template Upgrade.

3. Template Upgrade

Please following the instructions to upgrade system. It is based on glass_gray template and can be applied to all other v1.x templates.

#templates/#template#/index.php

–Replace the following code:

<!--[if IE]>
<style type="text/css">
  #productInfoTab a {
    top:11px;
  }
 
  #productInfoTab a.unselect {
    top:13px;
  }
</style>
<![endif]-->
<?php
  if ($osC_Template->hasPageTags()) {
    echo $osC_Template->getPageTags();
  }
 
  if ($osC_Template->hasJavascript()) {
    $osC_Template->getJavascript();
  }
 
  if ($osC_Template->hasStyleSheet()) {
    $osC_Template->getStyleSheet();
  }
?>

With:

<?php
  if ($osC_Template->hasPageTags()) {
    echo $osC_Template->getPageTags();
  }
 
  if ($osC_Template->hasHeaderJavascript()) {
    $osC_Template->getHeaderJavascript();
  }
 
  if ($osC_Template->hasStyleSheet()) {
    $osC_Template->getStyleSheet();
  }
?>

–Find the following line: 

<meta name="Generator" content="TomatoCart" />

Add the following code after the above line:

<?php
  $content_left = $osC_Template->getBoxGroup('left');
  $content_right = $osC_Template->getBoxGroup('right');
 
  if (osc_empty($content_left) && osc_empty($content_right)) {
?>
<style type="text/css">#pageContent, #pageBlockLeft{width:960px;}</style>
<?php
  }else if (osc_empty($content_left)) {
?>
<style type="text/css">#pageContent {width: 745px;}</style>
<?php
  }else if (osc_empty($content_right)) {
?>
<style type="text/css">#pageContent {width: 745px;}#pageBlockLeft{width:960px;}</style>
<?php
  }
?>

–Replace the following code:

<?php echo osc_link_object(osc_href_link(FILENAME_CHECKOUT, null, 'SSL'), '<span id="popupCart">' . osc_image('templates/' . $osC_Template->getCode() . '/images/shopping_cart_icon.png') . '<span id="popupCartItems">' . $osC_ShoppingCart->numberOfItems() . '</span>' . '<span>' . $osC_Language->get('text_items') . '</span></span>') ; ?>

With:

<?php echo osc_link_object(osc_href_link(FILENAME_CHECKOUT, null, 'SSL'), '<span id="popupCart">' . osc_image('templates/' . $osC_Template->getCode() . '/images/shopping_cart_icon.png') . '<span id="popupCartItems">' . $osC_ShoppingCart->numberOfItems() . '</span>' . '<span class="cartText cartCallpased">' . $osC_Language->get('text_items') . '</span></span>') ; ?>

–Replace the following code:

<?php
    $content_left = $osC_Template->getBoxGroup('left');
 
    if (!empty($content_left)) {
  ?>
 
    <div id="pageColumnLeft">
      <div class="boxGroup">
      <?php
          echo $content_left;
      ?>
      </div>
    </div>
 
  <?php
    } else {
  ?>
    <style type="text/css"><!--
      #pageContent {
        width: 745px;
      }
    //--></style>
  <?php
    }
  ?>

With:

<?php
    if (!empty($content_left)) {
  ?>
 
    <div id="pageColumnLeft">
      <div class="boxGroup">
      <?php
          echo $content_left;
      ?>
      </div>
    </div>
 
  <?php
    }
  ?>

–Replace the following code:

<?php
    $content_right = $osC_Template->getBoxGroup('right');
  ?>
  <?php
    if (!empty($content_right)) {
  ?>
      <div id="pageColumnRight">
        <div class="boxGroup">
      <?php
          echo $content_right;
      ?>
        </div>
      </div>
 
  <?php
    } elseif ( empty($content_right) && empty($content_left) ) {
  ?>
      <style type="text/css"><!--
      #pageContent, #pageBlockLeft{
        width:960px;
      }
      --></style>
  <?php
    } elseif ( empty($content_right) ) {
  ?>
      <style type="text/css"><!--
      #pageContent {
        width: 745px;
      }
 
      #pageBlockLeft{
        width:960px;
      }
      //--></style>
  <?php
    }
 
    unset($content_left);
    unset($content_right);
  ?>

With:

<?php
    if (!empty($content_right)) {
  ?>
      <div id="pageColumnRight">
        <div class="boxGroup">
      <?php
          echo $content_right;
      ?>
        </div>
      </div>
 
  <?php
    }
 
    unset($content_left);
    unset($content_right);
  ?>

–Find the following code:

<?php 
    if ($osC_Services->isStarted('banner') && $osC_Banner->exists('468x60')) {
      echo '<p align="center">' . $osC_Banner->display() . '</p>';
    }
  }
?>

Add the following code after it:

<?php
  if ($osC_Template->hasJavascript()) {
    $osC_Template->getJavascript();
  }
?>

#templates/#template#/stylesheet.css

–Find the following code:

.clear {
  clear: both;
  height: 15px;
}

Add the following code after it:

a, button { noFocusLine:expression(this.onFocus=this.blur()) }

 –Replace the following code:

.boxContents {
  font-family: Tahoma, 'Trebuchet MS', Verdana, Arial, sans-serif;
  font-size: 11px;
  padding: 5px;
  border: 1px solid #DDDDDD;
  border-bottom: none;
  background: #f6f6f6; 
}

With:

.boxContents {
  font-family: Tahoma, 'Trebuchet MS', Verdana, Arial, sans-serif;
  font-size: 11px;
  padding: 5px;
  border: 1px solid #DDDDDD;
  border-bottom: none;
  background: #f6f6f6;
  word-wrap:break-word;
}

–Remove the following code:

/* All menu links on hover or focus */
#categoriesTree a:hover, #categoriesTree a:focus, #subMenusContainer a:hover, #subMenusContainer a:focus, #categoriesTree a.mainMenuParentBtnFocused, #subMenusContainer a.subMenuParentBtnFocused{
}
 
/* sub menu links on hover or focus */
#subMenusContainer a:hover, 
#subMenusContainer a:focus, 
#categoriesTree a.mainMenuParentBtnFocused, 
#subMenusContainer a.subMenuParentBtnFocused,
#categoriesTree li a:hover,
#categoriesTree li a:focus{
}

–Replace the following code:

/* popupCart */
#popupCartContent {width: 312px; z-index: 1000; background-color:#F3F3F3; border-left: 1px solid #D9D9D9; border-right: 1px solid #D9D9D9; border-top: 1px solid #D9D9D9; border-bottom: 1px solid #8B8A8A; padding:0; margin: 0;}
#popupCartContent h6 {color: #BEBEBE;border: 0;}
#popupCartContent .productImage {border: 1px solid #dddddd;}
#popupCartContent .subtotal {color: #464646; font-weight: bold; float: right;padding-bottom: 10px;}
#popupCartContent p {padding: 3px 3px 5px 0px; margin: 0;}
#popupCartContent .content {border: none}

With:

/* popupCart */
.cart a:hover {text-decoration:none;}
#popupCart .cartCallpased {padding-right:15px;background: url(images/arrow-down.png) no-repeat right center;cursor:pointer;}
#popupCart .cartExpanded {padding-right:15px;background: url(images/arrow-up.png) no-repeat right center;cursor:pointer;}
#popupCartContent .cartEmpty{color:#464646;margin-left:10px;float:left;}
#popupCartContent {width: 312px; z-index: 1000; background-color:#F3F3F3; border-left: 1px solid #D9D9D9; border-right: 1px solid #D9D9D9; border-top: 1px solid #D9D9D9; border-bottom: 1px solid #8B8A8A; padding:0; margin: 0;}
#popupCartContent h6 {color: #BEBEBE;border: 0;}
#popupCartContent .productImage {border: 1px solid #dddddd;}
#popupCartContent .subtotal {color: #464646; font-weight: bold; float: right;margin-right:10px;margin-bottom:10px;}
#popupCartContent .content {border: none}
#btnClosePopCart {background: none;border:0;color:#FFFFFF;cursor:pointer;position:absolute;right:5px;font-weight:bolder;font-size:18px;}

–Find the following code:

.messageStackSuccess {
  font-family: Tahoma, 'Trebuchet MS', Verdana, Arial, sans-serif;
  font-size: 10px;
  background-color: #99ff00;
}

Add the following code after it:

/*Shopping Cart Page*/
.stockWarning {border: 1px dotted #C8AD91;background-color: #FFFCF5;padding:10px;}
.markProductOutOfStock {color:#dc143c;font-weight:bolder;}

–Replace the following code:

/* compareProducts */
#compareProducts {width: 100%; border: 1px solid #CCCCCC;}
#compareProducts td.label {font-weight: bold;}
#compareProducts td {padding: 5px;}
#compareProducts tr.odd {background: #F8F7F5 none repeat scroll 0 0;}
#compareProducts tr.even {background: #EEEDED none repeat scroll 0 0 !important;}

With:

/* compareProducts */
#compareProducts {width: 100%; border: 1px solid #CCCCCC;}
#compareProducts td.label {font-weight: bold;}
#compareProducts td {padding: 10px; border-bottom: 1px solid #CCCCCC; border-right:1px solid #CCCCCC;vertical-align: top;}
#compareProducts td.last {border-right: 0;}
#compareProducts tr.odd {background: #F8F7F5 none repeat scroll 0 0;}
#compareProducts tr.even {background: #EEEDED none repeat scroll 0 0 !important;}
#compareProducts th {background: #D9E5EE; border-bottom: 1px solid #CCCCCC; border-right:1px solid #CCCCCC; padding: 10px;text-indent: 5px; vertical-align: top;}
#compareProducts tr.first {text-align:center;}
#compareProducts .links, #compareProducts .button {margin-top: 10px;}
#compareProducts tr.last th, #compareProducts tr.last td {border-bottom:0;}
#compareProducts .attribute, #compareProducts .variant {display:block;margin-bottom:5px;}
 
.compareContainer {padding: 15px;}
.compareContainer h1 {float: left; margin: 0 0 5px 0;}
.compareHeader {border-bottom: 1px solid #DDDDDD;}

–Replace the following code:

#productInfoTab a {
  border-top: 1px solid #DDDDDD;
  border-left: 1px solid #DDDDDD;
  border-right: 1px solid #DDDDDD;
  display:block;
  float:left;
  font-size:13px;
  font-weight:bold;
  margin-right:2px;
  padding:6px 15px 7px;
  text-decoration: none;
  position: relative;
  top: 1px;
}
 
#productInfoTab a.select {
  color: #000000;
  background-color: #F3F3F3;
}
 
#productInfoTab a.unselect {
  cursor: pointer;
  color: #8C8C8C; 
  background-color: #EAEAEA;
  border-bottom: 1px solid #DDDDDD;
  top: 3px;
  padding:5px 15px;
}
 
#tabReviews .content {padding: 10px;}
#tabReviews h3 {margin-top: 15px; font-size: 14px}
#tabReviews h6 {margin: 10px 0px 5px 0px; font-size: 13px}
#tabReviews textarea {margin-left: 10px;width: 470px;}
#tabReviews .submitFormButtons {text-align:right; margin-right: 25px;}

With:

#productInfoTab a {
  background: #EAEAEA;
  border-color: #DDDDDD;
  border-style: solid;
  border-width: 1px;
  color: #8C8C8C;
  display: block;
  float: left;
  font-size: 13px;
  font-weight: bold;
  margin-right: 2px;
  padding: 6px 15px 7px;
  position: relative;
  text-decoration: none;
  top: 1px;
  cursor: pointer;
}
 
#productInfoTab a.select {
  color: #000000;
  background-color: #F3F3F3;
  border-bottom: 0 none;
  padding-bottom: 8px;
}
 
#tabReviews .content {padding: 10px;}
#tabReviews h3 {margin-top: 15px; font-size: 14px}
#tabReviews h6 {margin: 10px 0px 5px 0px; font-size: 13px}
#tabReviews textarea {width: 470px;}
#tabReviews .submitFormButtons {text-align:right; margin-right: 25px;}
#frmReviews label {width: 130px;margin:0;}
#frmReviews #author_name {width: 200px;}

–Replace the following code:

.captcha span {display: block;}
.captcha-image, .captcha-field {float: left;}
.captcha-image {margin-right: 10px;border: 1px solid #DDDDDD;}

With:

.captcha {position: relative;height:100px;}
.captcha span {display: block;}
.captcha-image {position:absolute; left: 0; top: 5px;margin-right: 10px;border: 1px solid #DDDDDD;}
.captcha-field {position: absolute; left: 230px; top: 5px;}
.captcha-field p {margin: 3px 0;}

#templates/#template#/content/account/wishlist.php

–Replace the following code:

<tr class="<?php echo ((($rows/2) == floor($rows/2)) ? 'productListing-even' : 'productListing-odd'); ?>">        
           <td align="center"><?php echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $product['products_id']), $osC_Image->show($product['image'], $product['name'], 'hspace="5" vspace="5"')) . '<br />' . $product['name'] . '<br />' . $osC_Currencies->format($product['price']); ?></td>         
           <td valign="top"><?php echo osc_draw_textarea_field('comments[' . $product['products_id'] . ']', $product['comments'], 20, 5, 'id="comments_' . $product['products_id'] . '"'); ?></td>
           <td align="center" valign="top"><?php echo $product['date_added']; ?></td>
           <td align="center" valign="top">
             <?php echo osc_link_object(osc_href_link(FILENAME_ACCOUNT, 'wishlist=delete&products_id=' . $product['products_id']), osc_draw_image_button('button_delete.gif', $osC_Language->get('button_delete'))); ?>
             <br />&nbsp;<br/>
             <?php echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $product['products_id'] . '&action=cart_add'), osc_draw_image_button('button_add_to_cart.png', $osC_Language->get('button_add_to_cart'))); ?>
           </td>
         </tr>

With:

<tr class="<?php echo ((($rows/2) == floor($rows/2)) ? 'productListing-even' : 'productListing-odd'); ?>">        
           <td align="center"><?php echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, (!osc_empty($product['variants']) ? str_replace('#', '_', osc_get_product_id_string($product['products_id'], $product['variants'])) : $product['products_id'])), $osC_Image->show($product['image'], $product['name'], 'hspace="5" vspace="5"')) . '<br />' . $product['name'] . '<br />' . $osC_Currencies->format($product['price']); ?></td>         
           <td valign="top"><?php echo osc_draw_textarea_field('comments[' . $product['products_id'] . ']', $product['comments'], 20, 5, 'id="comments_' . $product['products_id'] . '"'); ?></td>
           <td align="center" valign="top"><?php echo $product['date_added']; ?></td>
           <td align="center" valign="top">
             <?php echo osc_link_object(osc_href_link(FILENAME_ACCOUNT, 'wishlist=delete&products_id=' . $product['products_id']), osc_draw_image_button('button_delete.gif', $osC_Language->get('button_delete'))); ?>
             <br />&nbsp;<br/>
             <?php echo osc_link_object(osc_href_link(FILENAME_PRODUCTS, $product['products_id'] . '&action=cart_add' . (!osc_empty($product['variants']) ? '&variants=' . osc_parse_variants_array($product['variants']) : '')), osc_draw_image_button('button_add_to_cart.png', $osC_Language->get('button_add_to_cart'))); ?>
           </td>
         </tr>

 

#templates/#template#/modules/jsons/popup_cart.php

–Replace the following code:

$content .= $osC_Language->get('box_shopping_cart_empty');

With:

$content .= '<strong class="cartEmpty">' . $osC_Language->get('box_shopping_cart_empty') . '</strong>';

–Replace the following code:

$content .= '<p class="subtotal">' . $osC_Language->get('box_shopping_cart_subtotal') . '&nbsp;&nbsp;' . $osC_Currencies->format($osC_ShoppingCart->getSubTotal()) . '</p>

With:

$content .= '<strong class="subtotal">' . $osC_Language->get('box_shopping_cart_subtotal') . '&nbsp;&nbsp;' . $osC_Currencies->format($osC_ShoppingCart->getSubTotal()) . '</strong>

 

#templates/#template#/content/info/info_sitemap.php

–Replace the following code:

<li><?php echo osc_link_object(osc_href_link(FILENAME_INFO), $osC_Language->get('box_information_heading')); ?>
          <ul>
            <li><?php echo osc_link_object(osc_href_link(FILENAME_INFO, 'shipping'), $osC_Language->get('box_information_shipping')); ?></li>
            <li><?php echo osc_link_object(osc_href_link(FILENAME_INFO, 'privacy'), $osC_Language->get('box_information_privacy')); ?></li>
            <li><?php echo osc_link_object(osc_href_link(FILENAME_INFO, 'conditions'), $osC_Language->get('box_information_conditions')); ?></li>
            <li><?php echo osc_link_object(osc_href_link(FILENAME_INFO, 'contact'), $osC_Language->get('box_information_contact')); ?></li>
          </ul>
        </li>

With:

<li><?php echo osc_link_object(osc_href_link(FILENAME_INFO), $osC_Language->get('box_information_heading')); ?>
          <ul>
            <?php
                while($Qarticles_listing->next()) {
            ?>
            <li><?php echo osc_link_object(osc_href_link(FILENAME_INFO, 'articles&articles_id=' . $Qarticles_listing->valueInt('articles_id')), $Qarticles_listing->value('articles_name')); ?></li>
            <?php
                }
            ?>
          </ul>
        </li>
        <li>
          <?php echo osc_link_object(osc_href_link(FILENAME_INFO, 'faqs'), $osC_Language->get('info_faqs_heading'));?>
          <ul>
            <?php
                while($Qfaqs_listing->next()) {
            ?>
            <li><?php echo osc_link_object(osc_href_link(FILENAME_INFO, 'faqs&faqs_id=' . $Qfaqs_listing->valueInt('faqs_id')), $Qfaqs_listing->value('faqs_question')); ?></li>
            <?php
                }
            ?>
          </ul>
        </li>

 

#templates/#template#/content/products/info.php

–Find the following code:

<?php
  if ($messageStack->size('products') > 0) {
    echo $messageStack->output('products');
  }
?>

Add the following code after it:

<?php
  if ($messageStack->size('reviews') > 0) {
    echo $messageStack->output('reviews');
  }
?>

–Replace the following code:

echo osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), $osC_Product->getID() . '&action=wishlist_add'), $osC_Language->get('add_to_wishlist'));

With:

echo osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), $osC_Product->getID() . '&action=wishlist_add'), $osC_Language->get('add_to_wishlist'), 'class="wishlist"');

–Replace the following code:

<div id="productInfoTab">

With:

<div id="productInfoTab" class="clearfix">

–Remove the following line:

<div style="clear:both;"></div>

–Replace the following code:

<?php if (!$osC_Customer->isLoggedOn()) { ?>
              <p><?php echo sprintf($osC_Language->get('login_to_write_review'), osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); ?></p>
            <?php } else { ?>
 
              <p><?php echo $osC_Language->get('introduction_rating'); ?></p>
 
              <form id="frmReviews" name="newReview" action="<?php echo osc_href_link(FILENAME_PRODUCTS, 'reviews=new&' . $osC_Product->getID() . '&action=process'); ?>" method="post">
 
              <?php
                $ratings = osC_Reviews::getCategoryRatings($osC_Product->getCategoryID());
                if (sizeof($ratings) == 0) {
              ?>
                <p><?php echo '<b>' . $osC_Language->get('field_review_rating') . '</b>&nbsp;&nbsp;&nbsp;' . $osC_Language->get('review_lowest_rating_title') . ' ' . osc_draw_radio_field('rating', array('1', '2', '3', '4', '5')) . ' ' . $osC_Language->get('review_highest_rating_title'); ?></p>
                <input type="hidden" id="rat_flag" name="rat_flag" value="0" />

With:

<?php
              if ($osC_Reviews->is_enabled == false) {
            ?>
                <p><?php echo sprintf($osC_Language->get('login_to_write_review'), osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); ?></p>
            <?php
              } else {
            ?>
 
              <form id="frmReviews" name="newReview" action="<?php echo osc_href_link(FILENAME_PRODUCTS, 'reviews=new&' . $osC_Product->getID() . '&action=process'); ?>" method="post">
              <p><label for="author_name"><strong><?php echo $osC_Language->get('field_review_author'); ?></strong></label><input type="text" name="author_name" id="author_name" value="<?php echo $osC_Customer->isLoggedOn() ? $osC_Customer->getName() : (isset($_SESSION['review_author_name']) ? $_SESSION['review_author_name'] : ''); ?>" /></p>
 
              <?php
                $ratings = osC_Reviews::getCategoryRatings($osC_Product->getCategoryID());
                if (sizeof($ratings) == 0) {
              ?>
                <p><label><?php echo '<strong>' . $osC_Language->get('field_review_rating') . '</strong></label>' . $osC_Language->get('review_lowest_rating_title') . ' ' . osc_draw_radio_field('rating', array('1', '2', '3', '4', '5')) . ' ' . $osC_Language->get('review_highest_rating_title'); ?></p>
                <input type="hidden" id="rat_flag" name="rat_flag" value="0" />

–Replace the following code:

<?php echo osc_draw_textarea_field('review', null, 45, 5); ?>

With:

<?php echo osc_draw_textarea_field('review', isset($_SESSION['review']) ? $_SESSION['review'] : null, 45, 5); ?>
                <p><?php echo $osC_Language->get('review_note_message'); ?></p>
 
                <div class="clearfix captcha">
                  <div class="captcha-image"><?php echo osc_image(osc_href_link(FILENAME_PRODUCTS, 'reviews=show_captcha'), $osC_Language->get('captcha_image_title'), 215, 80, 'id="captcha-code"'); ?></div>
                  <div class="captcha-field clearfix">
                    <div><?php echo osc_link_object(osc_href_link('#'), osc_image('ext/securimage/images/refresh.png', $osC_Language->get('refresh_captcha_image_title')), 'id="refresh-captcha-code"'); ?></div>
                    <p><?php echo $osC_Language->get('enter_captcha_code'); ?></p>
                    <div><?php echo osc_draw_input_field('captcha_code', '', 'size="22"'); ?></div>
                  </div>
                  <script type="text/javascript">
                    $('refresh-captcha-code').addEvent('click', function(e) {
                      e.stop();
 
                      var reviewsController = '<?php echo osc_href_link(FILENAME_PRODUCTS, 'reviews=show_captcha', 'AUTO', true, false); ?>';
                      var captchaImgSrc = reviewsController + '&' + Math.random();
 
                      $('captcha-code').setProperty('src', captchaImgSrc);
                    });
                  </script>
                </div>

–Remove the following line:

allowCheckout: <?php echo (STOCK_ALLOW_CHECKOUT == '1') ? 'true' : 'false'; ?>,

 

#templates/#template#/content/checkout/checkout_success.php

–Replace the following code:

$Qproducts = $osC_Database->query('select products_id, products_name from :table_orders_products where orders_id=:orders_id order by products_name');
    $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
    $Qproducts->bindInt(':orders_id', $Qorder->valueInt('orders_id'));
    $Qproducts->execute();
 
    $products_array = array();
    while ($Qproducts->next()) {
      $products_array[] = array('id' => $Qproducts->valueInt('products_id'),
                                'text' => $Qproducts->value('products_name'));
    }

With:

$Qproducts = $osC_Database->query('select products_id, products_name, products_type from :table_orders_products where orders_id=:orders_id order by products_name');
    $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
    $Qproducts->bindInt(':orders_id', $Qorder->valueInt('orders_id'));
    $Qproducts->execute();
 
    $products_array = array();
    $has_downloadable = false;
    $has_simple = false;
    while ($Qproducts->next()) {
      if ($Qproducts->valueInt('products_type') == PRODUCT_TYPE_SIMPLE) {
        if ($has_simple === false) {
          $has_simple = true;
        }
      }
 
      if ($Qproducts->valueInt('products_type') == PRODUCT_TYPE_DOWNLOADABLE) {
        if ($has_downloadable === false) {
          $has_downloadable = true;
        }
      }
 
      $products_array[] = array('id' => $Qproducts->valueInt('products_id'),
                                'text' => $Qproducts->value('products_name'));
    }

 

#templates/#template#/content/search/search.php

–Find the following line:

<li><?php echo osc_draw_label($osC_Language->get('field_search_price_to'), 'pto') . osc_draw_input_field('pto'); ?></li>

Add the following code after it:

<li><?php echo osc_draw_label($osC_Language->get('field_search_date_from'), 'datefrom') . osc_draw_date_pull_down_menu('datefrom', null, false, null, null, date('Y') - $osC_Search->getMinYear(), 0); ?></li>
      <li><?php echo osc_draw_label($osC_Language->get('field_search_date_to'), 'dateto') . osc_draw_date_pull_down_menu('dateto', null, null, null, null, date('Y') - $osC_Search->getMaxYear(), 0); ?></li>

 

#templates/#template#/javascript/search/search.php

–Replace the following code:

<script type="text/javascript"><!--
function check_form() {
    var error_message = "<?php echo $GLOBALS['osC_Language']->get('js_error'); ?>";
  var error_found = false;
  var error_field;
  var keywords = document.advanced_search.keywords.value;
  var pfrom = document.advanced_search.pfrom.value;
  var pto = document.advanced_search.pto.value;
  var pfrom_float;
  var pto_float;
  var dfrom;
  var dfrom_days = document.advanced_search.datefrom_days.value;
  var dfrom_months = document.advanced_search.datefrom_months.value;
  var dfrom_years = document.advanced_search.datefrom_years.value;
  var dto;
  var dto_days = document.advanced_search.dateto_days.value;
  var dto_months = document.advanced_search.dateto_months.value;
  var dto_years = document.advanced_search.dateto_years.value;
 
  if ( (dfrom_days.length > 0) && (dfrom_months.length > 0) && (dfrom_years.length > 0) ) {
    dfrom = dfrom_years + dfrom_months + dfrom_days;
  }
 
  if ( (dto_days.length > 0) && (dto_months.length > 0) && (dto_years.length > 0) ) {
    dto = dto_years + dto_months + dto_days;
  }
 
  if ((dfrom.length > 0) && (dto.length > 0)) {
    if (dfrom > dto) {
      error_message = error_message + "* <?php echo $GLOBALS['osC_Language']->get('error_search_to_date_less_than_from_date'); ?>\n";
      error_field = document.advanced_search.dateto_days;
      error_found = true;
    }
  }
 
  if (pfrom.length > 0) {
    pfrom_float = parseFloat(pfrom);
    if (isNaN(pfrom_float)) {
      error_message = error_message + "* <?php echo $GLOBALS['osC_Language']->get('error_search_price_from_not_numeric'); ?>\n";
      error_field = document.advanced_search.pfrom;
      error_found = true;
    }
  } else {
    pfrom_float = 0;
  }
 
  if (pto.length > 0) {
    pto_float = parseFloat(pto);
    if (isNaN(pto_float)) {
      error_message = error_message + "* <?php echo $GLOBALS['osC_Language']->get('error_search_price_to_not_numeric'); ?>\n";
      error_field = document.advanced_search.pto;
      error_found = true;
    }
  } else {
    pto_float = 0;
  }
 
  if ( (pfrom.length > 0) && (pto.length > 0) ) {
    if ( (!isNaN(pfrom_float)) && (!isNaN(pto_float)) && (pto_float < pfrom_float) ) {
      error_message = error_message + "* <?php echo $GLOBALS['osC_Language']->get('error_search_price_to_less_than_price_from'); ?>\n";
      error_field = document.advanced_search.pto;
      error_found = true;
    }
  }
 
  if (error_found == true) {
    alert(error_message);
    error_field.focus();
    return false;
  } else {
    return true;
  }
}
 
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=520,height=320,screenX=150,screenY=150,top=150,left=150')
}
//--></script>

With:

<script type="text/javascript"><!--
function check_form() {
    var error_message = "<?php echo $GLOBALS['osC_Language']->get('js_error'); ?>";
  var error_found = false;
  var error_field;
  var keywords = document.getElementById('keywords').value;
  var pfrom = document.getElementById('pfrom').value;
  var pto = document.getElementById('pto').value;
  var pfrom_float;
  var pto_float;
  var dfrom;
  var dfrom_days = document.getElementById('datefrom_days').value;
  var dfrom_months = document.getElementById('datefrom_months').value;
  var dfrom_years = document.getElementById('datefrom_years').value;
  var dto;
  var dto_days = document.getElementById('dateto_days').value;
  var dto_months = document.getElementById('dateto_months').value;
  var dto_years = document.getElementById('dateto_years').value;
 
  dfrom = Date.UTC(dfrom_years, dfrom_months, dfrom_days);
  dto = Date.UTC(dto_years, dto_months, dto_days);
 
  if (dfrom > dto) {
    error_message = error_message + "* <?php echo $GLOBALS['osC_Language']->get('error_search_to_date_less_than_from_date'); ?>\n";
    error_field = document.getElementById('dateto_days');
    error_found = true;
  }
 
  if (pfrom.length > 0) {
    pfrom_float = parseFloat(pfrom);
    if (isNaN(pfrom_float)) {
      error_message = error_message + "* <?php echo $GLOBALS['osC_Language']->get('error_search_price_from_not_numeric'); ?>\n";
      error_field = document.getElementById('pfrom');
      error_found = true;
    }
  } else {
    pfrom_float = 0;
  }
 
  if (pto.length > 0) {
    pto_float = parseFloat(pto);
    if (isNaN(pto_float)) {
      error_message = error_message + "* <?php echo $GLOBALS['osC_Language']->get('error_search_price_to_not_numeric'); ?>\n";
      error_field = document.getElementById('pto');
      error_found = true;
    }
  } else {
    pto_float = 0;
  }
 
  if ( (pfrom.length > 0) && (pto.length > 0) ) {
    if ( (!isNaN(pfrom_float)) && (!isNaN(pto_float)) && (pto_float < pfrom_float) ) {
      error_message = error_message + "* <?php echo $GLOBALS['osC_Language']->get('error_search_price_to_less_than_price_from'); ?>\n";
      error_field = document.getElementById('pto');
      error_found = true;
    }
  }
 
  if (error_found == true) {
    alert(error_message);
    error_field.focus();
    return false;
  } else {
    return true;
  }
}
 
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=520,height=320,screenX=150,screenY=150,top=150,left=150')
}
//--></script>

 

#templates/#template#/content/checkout/checkout.php

–Replace the following code:

<?php 
  if ( isset($_GET['view']) && !empty($_GET['view']) ) {
?>      
      view: '<?php echo $_GET['view']; ?>',
<?php 
  }else if ($messageStack->size('payment_error_msg') > 0) {
?>
      view: 'paymentInformationForm',
<?php
  }
?>

With:

<?php
        $default_image_file = 'includes/languages/' . $osC_Language->getCode() . '/images/buttons/button_continue.gif';
        $image_file = 'templates/' . $_SESSION['template']['code'] . '/images/buttons/languages/' . $osC_Language->getCode() . '/button_continue.gif';
 
        if(file_exists($image_file)){
      ?>
      continueBtn: '<?php echo $image_file; ?>',
      <?php   
        }else {
      ?>
      continueBtn: '<?php echo $default_image_file; ?>',
 
      <?php 
        }
 
        if ( isset($_GET['view']) && !empty($_GET['view']) ) {
      ?>      
            view: '<?php echo $_GET['view']; ?>',
      <?php 
        }else if ($messageStack->size('payment_error_msg') > 0) {
      ?>
            view: 'paymentInformationForm',
      <?php
        }
      ?>

 

#templates/#template#/content/index/category_products_listing.php

–Replace the following code:

require('includes/modules/products_attributes.php');
 
// optional Product List Filter
  if (PRODUCT_LIST_FILTER > 0) {
    if (isset($_GET['manufacturers']) && !empty($_GET['manufacturers'])) {
      $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$osC_Language->getID() . "' and p.manufacturers_id = '" . (int)$_GET['manufacturers'] . "' order by cd.categories_name";
    } else {
      $filterlist_sql = "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";
    }
 
    $Qfilterlist = $osC_Database->query($filterlist_sql);
    $Qfilterlist->execute();
 
    if ($Qfilterlist->numberOfRows() > 1) {
 
      echo '<form name="filter" action="' . osc_href_link(FILENAME_DEFAULT) . '" method="get">' . $osC_Language->get('filter_show') . '&nbsp;';
      if (isset($_GET['manufacturers']) && !empty($_GET['manufacturers'])) {
        echo osc_draw_hidden_field('manufacturers', $_GET['manufacturers']);
        $options = array(array('id' => '', 'text' => $osC_Language->get('filter_all_categories')));
      } else {
        echo osc_draw_hidden_field('cPath', $cPath);
        $options = array(array('id' => '', 'text' => $osC_Language->get('filter_all_manufacturers')));
      }

With:

//get all the subcategories
  $categories_ids = array();
  $osC_CategoryTree->getChildren($current_category_id, $categories_ids);
  $categories_ids[] = $current_category_id;
 
  //whether the product attributes filter is enabled
  if (defined('PRODUCT_ATTRIBUTES_FILTER') && (PRODUCT_ATTRIBUTES_FILTER == '1')) {
    require('includes/modules/products_attributes.php');
  }
 
// optional Product List Filter
  if (PRODUCT_LIST_FILTER > 0) {
    if (isset($_GET['manufacturers']) && !empty($_GET['manufacturers'])) {
      $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$osC_Language->getID() . "' and p.manufacturers_id = '" . (int)$_GET['manufacturers'] . "' order by cd.categories_name";
    } else {
      $filterlist_sql = "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id in (" . implode(',', $categories_ids) . ") order by m.manufacturers_name";
    }
 
    $Qfilterlist = $osC_Database->query($filterlist_sql);
    $Qfilterlist->execute();
 
    if ($Qfilterlist->numberOfRows() > 1) {
 
      echo '<form name="filter" action="' . osc_href_link(FILENAME_DEFAULT) . '" method="get">' . $osC_Language->get('filter_show') . '&nbsp;';
      if (isset($_GET['manufacturers']) && !empty($_GET['manufacturers'])) {
        echo osc_draw_hidden_field('manufacturers', $_GET['manufacturers']);
        $options = array(array('id' => '', 'text' => $osC_Language->get('filter_all_categories')));
      } else {
        echo osc_draw_hidden_field('cPath', $cPath);
        $options = array(array('id' => '', 'text' => $osC_Language->get('filter_all_manufacturers')));
      }
 
      //whether the products attributes filter and the category/manufacturer filter is linked
      if (defined('PRODUCT_LINK_FILTER') && (PRODUCT_LINK_FILTER == '1')) {
        if (isset($_GET['products_attributes']) && is_array($_GET['products_attributes'])) {
          foreach($_GET['products_attributes'] as $att_value_id => $att_value) {
            echo osc_draw_hidden_field('products_attributes[' . $att_value_id . ']', $att_value);
          }
        }
      }

 

#templates/#template#/content/index/product_listing.php

–Replace the following code:

require('includes/modules/products_attributes.php');

With:

//whether the product attributes filter is enabled
  if (defined('PRODUCT_ATTRIBUTES_FILTER') && (PRODUCT_ATTRIBUTES_FILTER == '1')) {
    require('includes/modules/products_attributes.php');
  }

Find the following code:

if (isset($_GET['sort'])) {
        echo osc_draw_hidden_field('sort', $_GET['sort']);
      }

Add the following code before it:

//whether the products attributes filter and the category/manufacturer filter is linked
      if (defined('PRODUCT_LINK_FILTER') && (PRODUCT_LINK_FILTER == '1')) {
        if (isset($_GET['products_attributes']) && is_array($_GET['products_attributes'])) {
          foreach($_GET['products_attributes'] as $att_value_id => $att_value) {
            echo osc_draw_hidden_field('products_attributes[' . $att_value_id . ']', $att_value);
          }
        }
      }

 

#templates/#template#/content/info/info_contact.php

–Replace the following code:

<span><?php echo osc_draw_label($osC_Language->get('enter_captcha_code'), 'captcha_code', null, true); ?></span>

With:

<span class="clearfix"><?php echo osc_draw_label($osC_Language->get('enter_captcha_code'), 'captcha_code', null, true); ?></span>

 

#templates/#template#/content/info/guestbook_new.php

–Replace the following code:

<span><?php echo osc_draw_label($osC_Language->get('enter_captcha_code'), 'captcha_code', null, true); ?></span>

With:

<span class="clearfix"><?php echo osc_draw_label($osC_Language->get('enter_captcha_code'), 'captcha_code', null, true); ?></span>

 

 

Random Posts

  • Pingback: Subject: Missing Upgrade Guides? – by: aforjeh | PHP World

  • Richard Adams

    Just want to say that I have successfully upgraded from 1.1.7 to 1.1.8 using the above instructions but I only needed to do the Database Upgrade and File Upgrade steps, as I have not done anything special to the previous Template. The new Glass_gray Template worked fine for me with my data and images and no change to the source code!