TomatoCart v1.1.8.4.1 to v1.1.8.5 Upgrade Guide!

You may not find the upgrade guide from TomatoCart 1.1.8.4.1 to v1.1.8.5. Here it is the detailed upgrade guide for it. If you are still using the TomatoCart v.1.1.8.4.1, it’s time to upgrade your system to v1.1.8.5.

Then, you could upgrade your system to v1.1.8.6 through reading the guide at http://blog.arvixe.com/upgrade-your-tomatocart-store-from-1-1-8-5-to-1-1-8-6/. Finally, you could upgrade your system to v1.1.8.6.1 through reading the guide at http://blog.arvixe.com/upgrade-your-tomatocart-store-from-v1-1-8-6-to-v1-1-8-6-1-through-applying-three-patches/.

Upgrade Steps

1. Database Upgrade

Execute the following sql in your database:

Note: if you had changed the table names (prefix) “toc_” with your tables prefix, please replace the following “toc_” prefix with your own prefix. To check prefix, you can open your database and check beginning of all TomatoCart tables. If you did not use prefix, replace with empty.

CREATE TABLE IF NOT EXISTS toc_variants_specials (
  variants_specials_id int(11) NOT NULL AUTO_INCREMENT,
  products_variants_id int(11) NOT NULL,
  variants_speicals_price decimal(15,4) NOT NULL,
  specials_date_added datetime DEFAULT NULL,
  specials_last_modified datetime DEFAULT NULL,
  start_date datetime DEFAULT NULL,
  expires_date datetime DEFAULT NULL,
  date_status_change datetime DEFAULT NULL,
  status tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (variants_specials_id)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

2. File Upgrade

If you didn’t modify any core code or template code, please apply the file upgrade for your store as follows:

Note: you didn’t touch the following files, please just override them with the same files in v1.1.8.5.

Step 1. Download the v1.1.8.5 package at http://sourceforge.net/projects/tomatocart/files/TomatoCart-v1.1.8.5.zip/download.

Step 2. Unzip the package and find the includes/configure.php file. Then, please just delete it.

Step 3. Upload the complete source files in v1.1.8.5 to your TomatoCart root directory in which v1.1.8.4.1 system was installed.

If you touched the core code or template code, please read the following detailed guide to apply the changes for the core code and template code for your store.

Upgrade Core Code

Step 1. Go to admin > includes > classes > google_sitemap.php.

— Find following code snippet:

$this->_file_name = "sitemaps_{$language_code}_";

— Replace it with:

     if ($language_code !== 'en_US') {
        $this->_file_name = "sitemaps_{$language_code}_";
      }else {
        $this->_file_name = "sitemaps";
      }

— Find following code snippet:

function _createUrlElement($url, $last_mod, $change_freq, $priority) {
      $xml = "\t" . '<url>' . "\n";
      $xml .= "\t\t" . '<loc>' . $url . '</loc>' . "\n";
      $xml .= "\t\t" . '<lastmod>' . $last_mod . '</lastmod>' . "\n";
      $xml .= "\t\t" . '<changefreq>' . $change_freq . '</changefreq>' . "\n";
      $xml .= "\t\t" . '<priority>' . $priority . '</priority>' . "\n";
      $xml .= "\t" . '</url>' . "\n";

      return $xml;
    }

— Replace it with:

function _createUrlElement($url, $last_mod, $change_freq, $priority) {
      global $osC_Language;
      
      $xml = "\t" . '<url>' . "\n";
      
      //multiple language
      if (count($osC_Language->getAll() > 0)) {
        $xml .= "\t\t" . '<loc>' . $url . '?language=' . $osC_Language->getCode() . '</loc>' . "\n";
      }else {
        $xml .= "\t\t" . '<loc>' . $url . '</loc>' . "\n";
      }
      
      $xml .= "\t\t" . '<lastmod>' . $last_mod . '</lastmod>' . "\n";
      $xml .= "\t\t" . '<changefreq>' . $change_freq . '</changefreq>' . "\n";
      $xml .= "\t\t" . '<priority>' . $priority . '</priority>' . "\n";
      $xml .= "\t" . '</url>' . "\n";

      return $xml;
    }

Step 2. Go to admin > includes > classes > importer.php.

— Find following code snippet:

$_csv_enclosure = '',

— Add following code snippet after it:

$_csv_line_length = 1000,

— Find following code snippet:

$this->_csv_enclosure = $parameters['csv_field_enclosed'];

— Add following code snippet after it:

$this->_csv_line_length = $parameters['csv_line_length'];

— Find following code snippet:

while (($cells = fgetcsv($handle, 1000, ",")) !== FALSE) {

— Replace it with:

while (($cells = fgetcsv($handle, $this->_csv_line_length, $this->_csv_delimiter, $this->_csv_enclosure)) !== FALSE) {

— Find following code snippet:

while (($cells = fgetcsv($handle, 1000, ",")) !== FALSE) {

— Replace it with:

while (($cells = fgetcsv($handle, $this->_csv_line_length, $this->_csv_delimiter, $this->_csv_enclosure)) !== FALSE) {

Step 3. Go to admin > includes > classes > products.php.

— Find following code snippet:

osC_Cache::clear('feature-products');

— Add following code snippet after it:

osC_Cache::clear('new_products');

Step 4. Go to admin > includes > classes > specials.php.

— This file is entirely changed, please override it with the specials.php in 1.1.8.5.

Step 5. Go to admin > includes > extmodules > currencies > currencies_dialog.php.

— Find following code snippet:

{xtype: 'hidden', name: 'id'},

— Add following code snippet before it:

{
      		xtype: 'panel',
      		border: false,
      		html: '<?php echo $osC_Language->get('introduction_set_default_currency'); ?>'
      	},

Step 6. Go to admin > includes > extmodules > google_sitemap > main.php.

— Find following code snippet:

win = desktop.createWindow(null, Toc.google_sitemap.GoogleSitemapDialog);

— Add following code snippet after it:

 win.on('saveSuccess', function(feedback) {
        this.app.showNotification({title: TocLanguage.msgSuccessTitle, html: feedback});
      }, this);

Step 7. Go to admin > includes > extmodules > google_sitemap > google_sitemap_dialog.php.

— Find following code snippet:

{
          xtype: 'combo', 
          fieldLabel: '<?php echo $osC_Language->get('field_language_selection'); ?>', 
          id: 'languages',
          width: 230,
          name: 'languages',
          mode: 'remote', 
          store: dsLanguages,
          displayField: 'text',
          valueField: 'id',
          triggerAction: 'all',
          hiddenName: 'languages_code',
          readOnly: true,
          allowBlank: false
        },

— Add following code snippet before it:

{
          xtype: 'panel',
          html: '<?php echo $osC_Language->get('introduction_create_google_sitemaps'); ?>',
          style: 'margin-bottom: 10px;color:#C09853;'
        },

— Find following code snippet:

this.fireEvent('saveSuccess', action.result.feedback);

— Replace it with:

if (action.result.success) {
          this.fireEvent('saveSuccess', action.result.feedback);
        }else {
          Ext.MessageBox.alert(TocLanguage.msgErrTitle, action.result.feedback);
        }

Step 8. Go to admin > includes > extmodules > import_export > import_export_dialog.php.

— This file is entirely changed, please override it with the import_export_dialog.php in the same directory of v1.1.8.5.

Step 9. Go to admin > includes > extmodules > languages > languages_edit_dialog.php.

— Find following code snippet:

 {
          xtype: 'textfield', 
          fieldLabel: '<?php echo $osC_Language->get('field_name'); ?>', 
          name: 'name', 
          allowBlank: false
        },

— Add following code snippet before it:

   	{
      		xtype: 'panel',
      		border: false,
      		html: '<?php echo $osC_Language->get('introduction_set_default_currency'); ?>'
      	},
        {

Step 10. Go to admin > includes > extmodules > specials.

— The files in this fold are entirely changed, please override this fold with the specials fold in the same directory of v1.1.8.5.

Step 11. Go to admin > includes > jsons > google_sitemap.php.

— This file is entirely changed, please override it with the google_sitemap.php in the same directory of v1.1.8.5.

Step 12. Go to admin > includes > jsons > import_export.php.

— Find following code snippet:

'csv_field_enclosed' => $_REQUEST['enclosed'],

— Add following code snippet after it:

 'csv_line_length' => $_REQUEST['line_length'],

Step 13. Go to admin > includes > jsons > login.php.

— Find following code snippet:

$response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_login_invalid'));

— Add following code snippet after it:

 // check database connection
      if (!$osC_Database->isConnected()) {
        $feedback = $osC_Language->get('ms_error_db_connection_failed');
      }else {
        $feedback = $osC_Language->get('ms_error_login_invalid');
      }

Step 14. Go to admin > includes > jsons > specials.php.

— This file is entirely changed, please override it with the specials.php in the same directory of v1.1.8.5.

Step 15. Go to admin > includes > languages > en_US > currencies.php.

— Find following code snippet:

introduction_new_currency = Please fill in the following information for the new currency.

— Add following code snippet before it:

introduction_set_default_currency =<p><b>NOTE:</b> The <b>default currency</b> could be set in this module or under <b>Definitions > Languages</b> module. So, if you wish to use the default currency set in this module, please go to <b>Modules > Services > Currencies</b> to set the <b>Use Default Language Currency</b> to <b>False</b>.</p>

Step 16. Go to admin > includes > languages > en_US > google_sitemap.php.

— Find following code snippet:

introduction_google_sitemaps_submission  = <b>NOTE:</b> The location of the Sitemap is included in the robots.txt file so that Google and other search engines know about your sitemap. But Google still recommend that the sitemaps should be submitted through Google Webmaster Tools account so you can make sure that the Sitemap was processed without any issues, and to get additional statistics about your site. <br/><br/>Please ensure that you has registered with Google Sitemaps, and submitted your initial sitemap before proceeding the following step.

— Add following code snippet before it:

introduction_create_google_sitemaps = <p><b>NOTE:</b> Please ensure your tomatocart directory is writable to create the sitemaps for each language except english. After the creation, you should make it unwritable for the security.</p><p>Be careful with non-ascii characters in frienld URLs for products, categories and articles because they are not the standard characters for url. Only characters you can reliably use for the actual name parts of a URL are a-z, A-Z, 0-9, -, ., _, and ~. Any other characters may result in problem.</p>
error_directory_not_writable = Your tomatocart directory is not writable. Please make it writable to create the sitemap.

Step 17. Go to admin > includes > languages > en_US > import_export.php.

— Find following code snippet:

field_enclosed = Fields enclosed by:

— Add following code snippet after it:

field_line_length = Line Length:

Step 18. Go to admin > includes > languages > en_US > languages.php.

— Find following code snippet:

button_add_definition = Add Definition

— Add following code snippet after it:

introduction_set_default_currency =<p><b>NOTE:</b> The <b>default currency</b> could be set in this module or under <b>Definitions > Currencies</b> module. So, if you wish to use the default currency for the language, please go to <b>Modules > Services > Currencies</b> to set the <b>Use Default Language Currency</b> to <b>True</b>.</p>

Step 19. Go to admin > includes > languages > en_US > login.php.

— Add following code snippet at the end of file:

ms_error_db_connection_failed = Databases Error: Database connection failed.

Step 20. Go to admin > includes > languages > en_US > specials.php.

— Add following code snippet at the end of file:

field_variants = Variants:
field_products_type = Products Type:
products_type_general = General Products
products_type_variants = Variants Products

Step 21. Go to admin > includes > modules > services > currencies.php.

— Find following code snippet:

function install() {
      global $osC_Database;

      $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Use Default Language Currency', 'USE_DEFAULT_LANGUAGE_CURRENCY', '-1', 'Automatically use the currency set with the language (eg, German->Euro).', '6', '0', 'osc_cfg_use_get_boolean_value', 'osc_cfg_set_boolean_value(array(1, -1))', now())");
    }

— Replace it with:

function install() {
      global $osC_Database;
      
      $description = 'The default currency could be set under Definitions > Currencies or Definitions > Languages module. Set this configuration to True to use the default currency for each language ';

      $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Use Default Language Currency', 'USE_DEFAULT_LANGUAGE_CURRENCY', '-1', '" . $description . "', '6', '0', 'osc_cfg_use_get_boolean_value', 'osc_cfg_set_boolean_value(array(1, -1))', now())");
    }

 

Step 22. Go to includes > classes > product.php.

— Find following code snippet:

function getPrice($variants = null, $quantity = 1) {

— Add following code snippet before it:

unction getSpecialPrice($variants = array()) {
      global $osC_Specials;
      
      $new_price = null;
      if (count($variants) < 1) {
        $new_price = $osC_Specials->getPrice($this->_data['id']);
      }else {
        //get the new special price - support the variants specials
        $products_variants_id = $this->getProductVariantsId($variants);
        
        //variants specials price
        $new_price = $osC_Specials->getVariantsPrice($products_variants_id);
      }
      
      return $new_price;
    }

— Find following code snippet:

function getPriceFormated($with_special = false, $variants = array()) {
      global $osC_Services, $osC_Specials, $osC_Currencies;

      $price = '';
      if ($this->isGiftCertificate() && $this->isOpenAmountGiftCertificate()) {
        $price = $osC_Currencies->displayPrice($this->_data['open_amount_min_value'], $this->_data['tax_class_id']) . ' ~ ' . $price = $osC_Currencies->displayPrice($this->_data['open_amount_max_value'], $this->_data['tax_class_id']);
      } else {
        if (($with_special === true) && is_object($osC_Services) && $osC_Services->isStarted('specials') && ($new_price = $osC_Specials->getPrice($this->_data['id']))) {
          if ($this->hasVariants()) {
            $speical_percentage = round($new_price / $this->_data['price'], 2);
            
            $price = '<s>' . $osC_Currencies->displayPrice($this->getPrice($variants), $this->_data['tax_class_id']) . '</s> <span class="productSpecialPrice">' . $osC_Currencies->displayPrice($this->getPrice($variants) * $speical_percentage, $this->_data['tax_class_id']) . '</span>';
          }else {
            $price = '<s>' . $osC_Currencies->displayPrice($this->_data['price'], $this->_data['tax_class_id']) . '</s> <span class="productSpecialPrice">' . $osC_Currencies->displayPrice($new_price, $this->_data['tax_class_id']) . '</span>';
          }
        } else {
          $price = $osC_Currencies->displayPrice($this->getPrice($variants), $this->_data['tax_class_id']);
        }
      }

      return $price;
    }

— Replace it with:

function getPriceFormated($with_special = false, $variants = array()) {
      global $osC_Services, $osC_Specials, $osC_Currencies;
    
      $price = '';
      if ($this->isGiftCertificate() && $this->isOpenAmountGiftCertificate()) {
        $price = $osC_Currencies->displayPrice($this->_data['open_amount_min_value'], $this->_data['tax_class_id']) . ' ~ ' . $price = $osC_Currencies->displayPrice($this->_data['open_amount_max_value'], $this->_data['tax_class_id']);
      } else {
        //get the new special price - support the variants specials
        $new_price = null;
        
        if (($with_special === true) && is_object($osC_Services) && $osC_Services->isStarted('specials')) {
          if ($this->hasVariants()) {
            if (is_array($variants) && !empty($variants)) {
              $products_variants_id = $this->getProductVariantsId($variants);
            }else {
              $products_variants_id = $this->_data['default_variant']['variants_id'];
            }
            
            //variants specials price
            $new_price = $osC_Specials->getVariantsPrice($products_variants_id);
            if ($new_price !== null) {
              $price = '<s>' . $osC_Currencies->displayPrice($this->getPrice($variants), $this->_data['tax_class_id']) . '</s> <span class="productSpecialPrice">' . $osC_Currencies->displayPrice($new_price, $this->_data['tax_class_id']) . '</span>';
            }
          }else {
            //general special price
            $new_price = $osC_Specials->getPrice($this->_data['id']);
            if ($new_price !== null) {
              $price = '<s>' . $osC_Currencies->displayPrice($this->_data['price'], $this->_data['tax_class_id']) . '</s> <span class="productSpecialPrice">' . $osC_Currencies->displayPrice($new_price, $this->_data['tax_class_id']) . '</span>';
            }
          } 
        }
        
        //not to find the new special price
        if ($new_price == null) {
          $price = $osC_Currencies->displayPrice($this->getPrice($variants), $this->_data['tax_class_id']);
        }
      }
    
      return $price;
    }

Step 23. Go to includes > classes > search.php.

— Find following code snippet:

$Qlisting = $osC_Database->query('select SQL_CALC_FOUND_ROWS distinct p.*, pd.*, m.*, i.image, if(s.status, s.specials_new_products_price, null) as specials_new_products_price, if(s.status, s.specials_new_products_price, if (pv.products_price, pv.products_price, p.products_price)) as final_price');

— Replace it with:

$Qlisting = $osC_Database->query('select SQL_CALC_FOUND_ROWS distinct p.*, pd.*, m.*, i.image, vs.status, if(vs.status, vs.variants_speicals_price, if(s.status, s.specials_new_products_price, null)) as specials_new_products_price, if(vs.status, vs.variants_speicals_price, if(s.status, s.specials_new_products_price, if (pv.products_price, pv.products_price, p.products_price))) as final_price');

— Find following code snippet:

$Qlisting->appendQuery('from :table_products p left join :table_products_variants pv on (p.products_id = pv.products_id and pv.is_default = 1) left join :table_manufacturers m using(manufacturers_id) left join :table_specials s on (p.products_id = s.products_id) left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag)');

— Replace it with:

$Qlisting->appendQuery('from :table_products p left join :table_products_variants pv on (p.products_id = pv.products_id and pv.is_default = 1) left join :table_manufacturers m using(manufacturers_id) left join :table_specials s on (p.products_id = s.products_id) left join :table_variants_specials vs on (vs.products_variants_id = pv.products_variants_id) left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag)');

— Find following code snippet:

$Qlisting->bindTable(':table_specials', TABLE_SPECIALS);

— Add following code snippet after it:

$Qlisting->bindTable(':table_variants_specials', TABLE_VARIANTS_SPECIALS);

— Find following code snippet:

if (DISPLAY_PRICE_WITH_TAX == '1') {
        if ($this->_price_from > 0) {
          $Qlisting->appendQuery('and (if(s.status, s.specials_new_products_price, if (pv.products_price, pv.products_price, p.products_price)) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) >= :price_from)');
          $Qlisting->bindFloat(':price_from', $this->_price_from);
        }

        if ($this->_price_to > 0) {
          $Qlisting->appendQuery('and (if(s.status, s.specials_new_products_price, if (pv.products_price, pv.products_price, p.products_price)) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) <= :price_to)');
          $Qlisting->bindFloat(':price_to', $this->_price_to);
        }
      } else {
        if ($this->_price_from > 0) {
          $Qlisting->appendQuery('and (if(s.status, s.specials_new_products_price, if (pv.products_price, pv.products_price, p.products_price)) >= :price_from)');
          $Qlisting->bindFloat(':price_from', $this->_price_from);
        }

        if ($this->_price_to > 0) {
          $Qlisting->appendQuery('and (if(s.status, s.specials_new_products_price, if (pv.products_price, pv.products_price, p.products_price)) <= :price_to)');
          $Qlisting->bindFloat(':price_to', $this->_price_to);
        }
      }

— Replace it with:

if (DISPLAY_PRICE_WITH_TAX == '1') {
        if ($this->_price_from > 0) {
          $Qlisting->appendQuery('and (if(vs.status, vs.variants_speicals_price, if (s.status, s.specials_new_products_price, if (pv.products_price, pv.products_price, p.products_price))) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) >= :price_from)');
          $Qlisting->bindFloat(':price_from', $this->_price_from);
        }

        if ($this->_price_to > 0) {
          $Qlisting->appendQuery('and (if(vs.status, vs.variants_speicals_price, if (s.status, s.specials_new_products_price, if (pv.products_price, pv.products_price, p.products_price))) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) <= :price_to)');
          $Qlisting->bindFloat(':price_to', $this->_price_to);
        }
      } else {
        if ($this->_price_from > 0) {
          $Qlisting->appendQuery('and (if(vs.status, vs.variants_speicals_price, if (s.status, s.specials_new_products_price, if (pv.products_price, pv.products_price, p.products_price))) >= :price_from)');
          $Qlisting->bindFloat(':price_from', $this->_price_from);
        }

        if ($this->_price_to > 0) {
          $Qlisting->appendQuery('and (if(vs.status, vs.variants_speicals_price, if (s.status, s.specials_new_products_price, if (pv.products_price, pv.products_price, p.products_price))) <= :price_to)');
          $Qlisting->bindFloat(':price_to', $this->_price_to);
        }
      }

Step 24. Go to includes > classes > sefu.php.

— Find following code snippet:

function generateURL($link, $page){
    if (SERVICES_KEYWORD_RICH_URLS == '0') {
      $link = str_replace(array('?', '&', '='), array('/', '/', ','), $link);
    } else if(SERVICES_KEYWORD_RICH_URLS == '1'){
      $link = $this->generateRichKeywordURL($link, $page);
    }

    return $link;
  }

— Replace it with:

 function generateURL($link, $page, $parameters){
    if (SERVICES_KEYWORD_RICH_URLS == '0') {
      $link = str_replace(array('?', '&', '='), array('/', '/', ','), $link);
    } else if(SERVICES_KEYWORD_RICH_URLS == '1'){
      $link = $this->generateRichKeywordURL($link, $page, $parameters);
    }

    return $link;
  }

— Find following code snippet:

function generateRichKeywordURL($link, $page){

— Replace it with:

function generateRichKeywordURL($link, $page, $parameters){

— Find following code snippet:

$categories = $this->getCategoryUrl($this->getProductCategory($matches[1]));
        if (empty($categories)) {
          $link = $matches[1] . $this->_reg_anchors['products_id'] . $this->getProductUrl($matches[1]) . '.html';
        } else {
          $link = $this->getCategoryUrl($this->getProductCategory($matches[1])) . '/' . 
                  $matches[1] . $this->_reg_anchors['products_id'] . $this->getProductUrl($matches[1]) . '.html';          
        }

        if( !empty($matches[2]) ) {
          $link .= '?' . substr($matches[2], 1);
        }

— Replace it with:

 //Modify the code to make the product url in the new products page, specials page same as the product url in the catalog
        //To fix the bug - [#123] Two Different SEO link for one product
        $link = $this->getProductCategoryLink($matches[1]);
        
        if(isset($matches[2]) &&  !empty($matches[2])) {
          $link .= '?' . substr($matches[2], 1);
        }

— Find following comment line:

//article categories

— Add following code before it:

 //new products
    }else if (preg_match("/products.php\?new/", $link) > 0) {
      $link = 'new-products.html';
      
      $parameters = str_replace(array('new', '&'), '', $parameters);
      
      if (!empty($parameters)) {
        $link .= '?' . $parameters;
      }
    //specials  
    }else if (preg_match("/products.php\?specials/", $link) > 0) {
      $link = 'specials.html';
      
      if (!empty($parameters)) {
         $parameters = str_replace(array('specials', '&'), '', $parameters);
         
         if (!empty($parameters)) {
           $link .= '?' . $parameters;
         }
      }
    }

— Find following code snippet:

function getCategoryUrl($cPath) {
    global $osC_CategoryTree;
    
    return $osC_CategoryTree->getCategoryUrl($cPath);
  }

— Add following code before it:

/**
   * Get full category link for the product
   * Modify the code to make the product url in the new products page, specials page same as the product url in the catalog
   * To fix the bug - [#123] Two Different SEO link for one product
   * 
   * @access private
   * @param int $products_id
   * @return string
   */
  function getProductCategoryLink($products_id) {
    global $osC_CategoryTree;
    
    $link = '';
    
    $product_category = $this->getProductCategory($products_id);
    $category_url = $this->getCategoryUrl($product_category);
    $full_category_path = $osC_CategoryTree->getFullcPath($product_category);
    
    $link .= $full_category_path . $this->_reg_anchors['cPath'] . $category_url . '/' .
             $products_id . $this->_reg_anchors['products_id'] . $this->getProductUrl($products_id) . '.html';
    
    return $link;
  }

Step 25. Go to includes > classes > shopping_cart.php.

— Find following code snippet:

if ($new_price = $osC_Specials->getPrice(osc_get_product_id($Qproducts->value('products_id')), $variants_array)) {

— Replace it with:

if ($new_price = $osC_Product->getSpecialPrice($variants_array)) {

— Find following code snippet:

if ($new_price = $osC_Specials->getPrice($products_id, $variants)) {

— Replace it with:

if ($new_price = $osC_Product->getSpecialPrice($variants)) {

— Find following code snippet:

if ($new_price = $osC_Specials->getPrice($products_id, $variants)) {

— Replace it with:

if ($new_price = $osC_Product->getSpecialPrice($variants)) {

Step 26. Go to includes > classes > specials.php.

— Add following code at the end of file:

/**
     * Get the variants special price
     * 
     * @access public
     * @param $variants_id int
     * @return mixed
     */
    function getVariantsPrice($variants_id) {
      global $osC_Database;
      
      if (!isset($this->_specials['variants'][$variants_id])) {
        $Qspecial = $osC_Database->query('select variants_speicals_price from :table_variants_specials where products_variants_id = :products_variants_id and status = 1');
        $Qspecial->bindTable(':table_variants_specials', TABLE_VARIANTS_SPECIALS);
        $Qspecial->bindInt(':products_variants_id', $variants_id);
        $Qspecial->setCache('product-variants-specials-' . $variants_id);
        $Qspecial->execute();
        
        if ($Qspecial->numberOfRows() > 0) {
          $this->_specials['variants'][$variants_id] = $Qspecial->valueDecimal('variants_speicals_price');
        } else {
          $this->_specials['variants'][$variants_id] = null;
        }
        
        $Qspecial->freeResult();
      }
      
      return  $this->_specials['variants'][$variants_id];
    }

Step 27. Go to includes > classes > template.php.

— Find following code snippet:

var $_page_image;

— Add following code after it:

/**
 * Holds the rel=”canonical” link to remove the duplication content
 * [#123]Two Different SEO link for one product 
 *
 * @var string
 * @access public
 */
    var $rel_canonical;

— Find following code snippet:

function set($code = null) {
      if ( (isset($_SESSION['template']) === false) || !empty($code) || (isset($_GET['template']) && !empty($_GET['template'])) ) {
        if ( !empty( $code ) ) {
          $set_template = $code;
        } else {
          $set_template = (isset($_GET['template']) && !empty($_GET['template'])) ? $_GET['template'] : DEFAULT_TEMPLATE;
        }

        $data = array();
        $data_default = array();

        foreach ($this->getTemplates() as $template) {
          if ($template['code'] == DEFAULT_TEMPLATE) {
            $data_default = array('id' => $template['id'], 'code' => $template['code']);
          } elseif ($template['code'] == $set_template) {
            $data = array('id' => $template['id'], 'code' => $template['code']);
          }
        }

        if (empty($data)) {
          $data =& $data_default;
        }

        $_SESSION['template'] =& $data;
      }

      $this->_template_id =& $_SESSION['template']['id'];
      $this->_template =& $_SESSION['template']['code'];
    }

— Replace it with:

function set($code = null) {
    	//use the template box or template code to change the template
    	$set_template = null;
		  if ( (!empty($code)) || (isset($_GET['template']) && !empty($_GET['template'])) ) {
		  	if (!empty($code)) {
	  			$set_template = $code;
		  	}else {
		  		$set_template = $_GET['template'];
		  	}
		  	
		  	$_SESSION['change_template'] = true;
		  }
		  
			//there isn't any template set before or the default template is changed
		  if (!isset($_SESSION['change_template'])) {
		  	if ( (isset($_SESSION['template']) === false) || ($_SESSION['template'] != DEFAULT_TEMPLATE) ) {
		  		$set_template = DEFAULT_TEMPLATE;
		  	}
		  }

		  //the template need to be set in the session or changed
		  if ($set_template !== null) {
		  	$data = array();
		  	$data_default = array();
		  	
		  	foreach ($this->getTemplates() as $template) {
		  		if ($template['code'] == DEFAULT_TEMPLATE) {
		  			$data_default = array('id' => $template['id'], 'code' => $template['code']);
		  		} elseif ($template['code'] == $set_template) {
		  			$data = array('id' => $template['id'], 'code' => $template['code']);
		  		}
		  	}
		  	
		  	if (empty($data)) {
		  		$data =& $data_default;
		  	}
		  	
		  	$_SESSION['template'] =& $data;
		  }

      $this->_template_id =& $_SESSION['template']['id'];
      $this->_template =& $_SESSION['template']['code'];
    }

Step 28. Go to includes > content > products > products.php.

— Find following code snippet:

 if ($osC_Services->isStarted('breadcrumb')) {
              $breadcrumb->add($osC_Manufacturer->getTitle(), osc_href_link(FILENAME_DEFAULT, 'manufacturers=' . $_GET['manufacturers'])); 
              $breadcrumb->add($osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID()));  
            }

— Add following code after it:

if (isset($osC_Services) && $osC_Services->isStarted('sefu')) {
              $this->_add_canonical($osC_Product->getID());
            }

— Add following function into the class:

function _add_canonical($products_id) {
      global $toC_Sefu, $request_type;
      
      //get the product link to be stored by the search engine
      $product_link = $toC_Sefu->getProductCategoryLink($products_id);
      
      //get the link prefix
      if ( ($request_type == 'SSL') && (ENABLE_SSL === true) ) {
        $link_prefix = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
      } else {
        $link_prefix = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
      }
      
      $this->rel_canonical = '<link rel="canonical" href="' . $link_prefix . $product_link . '"/>';
    }

Step 29. Go to includes > content > products > products.php.

— Find following code snippet:

$('productInfoPrice').set('text', result.formatted_price + ' ' + this.options.lang.txtTaxText);

— Replace it with:

$('productInfoPrice').set('html', result.formatted_price + ' ' + this.options.lang.txtTaxText);

Step 30. Go to includes > languages >en_US.xml.

— Find following code snippet:

<definition>
      <key>contact_us</key>
      <value><![CDATA[Contact Us]]></value>
      <group>general</group>
    </definition>

—  Add following code after it:

<definition>
      <key>db_connection_failed</key>
      <value><![CDATA[Databases Error: Database connection failed.]]></value>
      <group>general</group>
    </definition>

— Add the language definition under admin panel > Definitions > Languages.

Snap - 2014-04-29 15:16:06

Step 31. Go to includes > modules > payment > authorizenet_cc_aim.php.

— Find following code snippet:

$params['x_tax'] = $osC_Currencies->formatRaw($tax_value);

— Replace it with:

$params['x_tax'] = $osC_Currencies->formatRaw($total_tax);

Step 32. Go to includes > modules > shipping > usps.php.

— Find following code snippet:

$this->_response = str_replace('&amp;lt;sup&amp;gt;&amp;amp;reg;&amp;lt;/sup&amp;gt;', '', $this->_response);
$this->_response = str_replace('&amp;lt;sup&amp;gt;&amp;amp;trade;&amp;lt;/sup&amp;gt;', '', $this->_response);
$this->_response = str_replace('**', '', $this->_response);
$this->_response = str_replace("\r\n", '', $this->_response);
$this->_response = str_replace('\"', '"', $this->_response);

— Replace it with:

 $this->_response = preg_replace('/&amp;lt;sup&amp;gt;&amp;#\d+;&amp;lt;\/sup&amp;gt;/', '', $this->_response);
 $this->_response = str_replace(array('**', "\r\n", '\"'), array('', '', '"'), $this->_response);

Step 33. Go to includes > modules > services > currencies.php.

— Find following code:

if ((isset($_SESSION['currency']) == false) || isset($_GET['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == '1') && ($osC_Currencies->getCode($osC_Language->getCurrencyID()) != $_SESSION['currency']) ) || ((USE_DEFAULT_LANGUAGE_CURRENCY != '1') && (DEFAULT_CURRENCY !=$_SESSION['currency'] )) ) {
            if (isset($_GET['currency']) && $osC_Currencies->exists($_GET['currency'])) {
                $_SESSION['currency'] = $_GET['currency'];
            } else {
                $_SESSION['currency'] = (USE_DEFAULT_LANGUAGE_CURRENCY == '1') ? $osC_Currencies->getCode($osC_Language->getCurrencyID()) : DEFAULT_CURRENCY;
            }

            if ( isset($_SESSION['cartID']) ) {
                unset($_SESSION['cartID']);
            }
        }

— Repalce it with:

//Keep currency selection from currency box for the following requests
        if (isset($_GET['currency']) && $osC_Currencies->exists($_GET['currency'])) {
        	$_SESSION['currency'] = $_GET['currency'];
        	$_SESSION['currency_set'] = true;
        	
        	if ( isset($_SESSION['cartID']) ) {
        		unset($_SESSION['cartID']);
        	}
        }
        
        //set the currency with default language currency or default currency
        if (!isset($_SESSION['currency_set'])) {
        	if ((isset($_SESSION['currency']) == false) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == '1') && ($osC_Currencies->getCode($osC_Language->getCurrencyID()) != $_SESSION['currency']) ) || ((USE_DEFAULT_LANGUAGE_CURRENCY != '1') && (DEFAULT_CURRENCY !=$_SESSION['currency'] )) ) {
				$_SESSION['currency'] = (USE_DEFAULT_LANGUAGE_CURRENCY == '1') ? $osC_Currencies->getCode($osC_Language->getCurrencyID()) : DEFAULT_CURRENCY;
        	
        		if ( isset($_SESSION['cartID']) ) {
        			unset($_SESSION['cartID']);
        		}
        	}
        }

Step 34. Go to includes > application_top.php.

— Find following code snippet:

  $osC_Services->startServices();

— Add following code after it:

// check database connection
  if (!$osC_Database->isConnected()) {
    $messageStack->add('db_error', $osC_Language->get('db_connection_failed'));
  }

Step 35. Go to includes > database_tables.php.

— Find following code snippet:

define('TABLE_TEMPLATES_BOXES_TO_PAGES', DB_TABLE_PREFIX . 'templates_boxes_to_pages');

— Add following code after it:

define('TABLE_VARIANTS_SPECIALS', DB_TABLE_PREFIX . 'variants_specials');

Step 36. Go to templates > glass_gray > index.php.

— Find following code snippet:

if ($osC_Template->hasStyleSheet()) {
    $osC_Template->getStyleSheet();
  }

—  Add following code after it:

  /**
   * general the rel_canonical link to remove the duplication content
   * [#123]Two Different SEO link for one product
   */
  if (isset($osC_Template->rel_canonical)) {
    echo $osC_Template->rel_canonical;
  }

— Find following code snippet:

<div id="pageWrapper">

— Add following code after it:

 <!--  Database Connection failed  -->
  <?php 
    if ($messageStack->size('db_error') > 0) {
  ?>
  <div><?php echo  $messageStack->output('db_error'); ?></div>
  <?php
    }
  ?>

Step 37. Go to templates > bootstrap > css > stylesheet.css.

— Find following code snippet:

#boxManufacturers .boxContents li {margin:5px;border-bottom:none;}

— Add following code after it:

/** box-review**/
.boxReview {word-break:break-all;}
.boxReview a {display:block;}

— Find following code snippet:

ul.grid li { 
    position: relative; 
    display: block; 
    float: left; 
    width: 33.333333%; 
    *width: 27.43%;
    height: 270px; 
    border-right: 1px solid #CDCDCD; 
    border-bottom: 1px solid #CDCDCD; 
    padding: 10px 20px; 
    box-sizing: border-box; 
    -moz-box-sizing: border-box; 
    -webkit-box-sizing: border-box; 
}

— Repalce it with:

ul.grid li { 
    position: relative; 
    display: block; 
    float: left; 
    width: 33.333333%; 
    *width: 27.43%;
    border-right: 1px solid #CDCDCD; 
    border-bottom: 1px solid #CDCDCD; 
    padding: 10px 20px; 
    box-sizing: border-box; 
    -moz-box-sizing: border-box; 
    -webkit-box-sizing: border-box; 
}

— Find following code snippet:

ul.grid li div.left h3 { 
    font-family: "Trebuchet MS", Arial, sans-serif; 
    font-weight: bold; 
    text-transform: uppercase; 
    color: #333333; 
    font-size: 13px; line-height: 18px; 
    margin-bottom: 5px;
    max-height: 36px;
    overflow: hidden;
}

— Replace it with:

ul.grid li div.left h3 { 
    font-family: "Trebuchet MS", Arial, sans-serif; 
    font-weight: bold; 
    text-transform: uppercase; 
    color: #333333; 
    font-size: 13px; line-height: 18px; 
    margin-bottom: 5px;
    height: 40px;
    overflow: hidden;
}

— Find following code snippet:

ul.grid li div.right span.price { 
    display: block; 
    margin-bottom: 5px; 
    font-size: 15px; 
    float: left;
}

— Replace it with:

ul.grid li div.right span.price { 
    display: block; 
    margin-bottom: 5px; 
    font-size: 15px;
    height: 10px; 
    float: left;
}

Step 38. Go to templates > bootstrap > javascript > ajax_shopping_cart.js.

— Find following code snippet:

var selects = $$('tr.variantCombobox select');

— Replace it with:

var selects = $$('.variantCombobox select');

Step 39. Go to templates > bootstrap > javascript > variants.js.

— Find following code snippet:

if (product == undefined || (product['status'] == 0)) {
      $('productInfoAvailable').innerHTML = '<font color="red">' + this.options.lang.txtNotAvailable + '</font>';
    } else {
      if (product['quantity'] > 0) {
        if (this.options.hasSpecial == 0) {
        	// get the formatted price of the variants product by ajax requst
        	this.sendRequest({action: 'get_variants_formatted_price', products_id_string: productsIdString}, function(response) {
            var result = JSON.decode(response);
            
            if (result.success == true) {
              $('productInfoPrice').set('text', result.formatted_price + ' ' + this.options.lang.txtTaxText);
            }else {
              alert(result.feedback);
            }
        	}.bind(this));
        }
        
        $('productInfoSku').set('text', product['sku']);
        if (this.options.displayQty == true) {
          $('productInfoQty').set('text', product['quantity'] + ' ' + this.options.unitClass);
        }
        $('productInfoAvailable').set('text', this.options.lang.txtInStock);
        
        $('shoppingCart').fade('in');
        $('shoppingAction').fade('in');
        
        this.changeImage(product['image']);
      } else {
        $('productInfoAvailable').set('text', this.options.lang.txtOutOfStock);
        if (this.options.displayQty == true) {
          $('productInfoQty').set('text', product['quantity'] + ' ' + this.options.unitClass);
        }
      }
    }

— Replace it with:

 if (product == undefined || (product['status'] == 0)) {
      $('productInfoAvailable').innerHTML = '<font color="red">' + this.options.lang.txtNotAvailable + '</font>';
    } else {
	    if (this.options.hasSpecial == 0) {
	    	// get the formatted price of the variants product by ajax requst
	    	this.sendRequest({action: 'get_variants_formatted_price', products_id_string: productsIdString}, function(response) {
	        var result = JSON.decode(response);
	        
	        if (result.success == true) {
	          $('productInfoPrice').set('html', result.formatted_price);
	        }else {
	          alert(result.feedback);
	        }
	    	}.bind(this));
	    }
	    
	    $('productInfoSku').set('text', product['sku']);
	    if (this.options.displayQty == true) {
	      $('productInfoQty').set('text', product['quantity'] + ' ' + this.options.unitClass);
	    }
	    
	    if (product['quantity'] > 0) {
	    	$('productInfoAvailable').set('text', this.options.lang.txtInStock);
	    }else {
	    	$('productInfoAvailable').set('text', this.options.lang.txtOutOfStock);
	    }
	    
	    $('shoppingCart').fade('in');
	    $('shoppingAction').fade('in');
	    
	    this.changeImage(product['image']);
    }

Step40. Go to templates > bootstrap > models > products.php.

— Find following code snippet:

$Qfeatureproducts->execute();

— Add following code snippet before it:

 //set the cache key for new products module in bootstrap
	if (MODULE_CONTENT_NEW_PRODUCTS_CACHE > 0) {
        $Qfeatureproducts->setCache('new_products-bootstrap-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode() . '-' . $current_category_id, MODULE_CONTENT_NEW_PRODUCTS_CACHE);
    }

— Find following code snippet:

$Qfeatureproducts->bindInt(':max_display_feature_products', MODULE_CONTENT_FEATURE_PRODUCTS_MAX_DISPLAY);

— Add following code after it:

//set the cache key for feature products module in bootstrap
    if (MODULE_CONTENT_NEW_PRODUCTS_CACHE > 0) {
		$Qfeatureproducts->setCache('feature-products-bootstrap-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode() . '-' . $current_category_id, MODULE_CONTENT_NEW_PRODUCTS_CACHE);
    }

Step41. Go to templates > bootstrap > modules > boxes > shopping_cart.php.

— Find following code snippet:

<a class="btn btn-mini" href="<?php echo osc_href_link(FILENAME_CHECKOUT); ?>"><i class="icon-shopping-cart icon-white"></i> <?php echo $osC_Language->get('checkout');?> </a>

— Replace it with:

<a class="btn btn-mini" href="<?php echo osc_href_link(FILENAME_CHECKOUT, 'checkout'); ?>"><i class="icon-shopping-cart icon-white"></i> <?php echo $osC_Language->get('checkout');?> </a>

— Find following code snippet:

<?php echo osc_image(DIR_WS_IMAGES . $images[$i]['image'], $images[$i]['description']); ?>

— Replace it with:

<?php echo osc_link_object(osc_href_link($images[$i]['url']), osc_image(DIR_WS_IMAGES . $images[$i]['image'], $images[$i]['description'])); ?>

Step42. Go to templates > bootstrap > modules > content > slide_show.php.

— Find following code snippet:

<?php echo osc_image(DIR_WS_IMAGES . $images[$i]['image'], $images[$i]['description']); ?>

— Replace it with:

<?php echo osc_link_object(osc_href_link($images[$i]['url']), osc_image(DIR_WS_IMAGES . $images[$i]['image'], $images[$i]['description'])); ?>

Step43. Go to templates > bootstrap > index.php.

— Find following code snippet:

 if ($osC_Template->hasStyleSheet()) {
        $osC_Template->getStyleSheet();
    }

— Add following code snippet after it:

 /**
     * general the rel_canonical link to remove the duplication content
     * [#123]Two Different SEO link for one product
     */
    if (isset($osC_Template->rel_canonical)) {
      echo $osC_Template->rel_canonical;
    }

— Find following code snippet:

<div id="pageWrapper" class="container">

— Add following code before it:

<!--  Database Connection failed  -->
<?php 
  if ($messageStack->size('db_error') > 0) {
?>
<div class="container"><?php echo  $messageStack->output('db_error'); ?></div>
<?php
  }
?>
<!--  END: Database Connection failed  -->

— Find following code snippet:

(function($) {
        $(document).ready(function(){
            $('.carousel').each(function(index, element) {
            	$(this)[index].slide = null;
            });
        });
    })(jQuery);

— Replace it with:

(function($) {
        $(document).ready(function(){
            $('.carousel').carousel({
                interval: 3000
            }).each(function(index, element) {
            	$(this)[index].slide = null;
            });
        });
    })(jQuery);

Done. It maybe difficult for you to apply above changes for your store if you are not a developer. Don’t worry about it. If you need our technical support or assistance for the upgrade, please don’t hesistate to contact us via support@tomatocart.com. We perfer to provide free technical support service for arvixe users.

Upgrade your TomatoCart Store from 1.1.8.5 to 1.1.8.6! – See more at: http://blog.arvixe.com/?s=tomatocart+upgrade#sthash.zyB3jz4M.dpufhttp://blog.arvixe.com/upgrade-your-tomatocart-store-from-1-1-8-5-to-1-1-8-6/
Upgrade your TomatoCart Store from 1.1.8.5 to 1.1.8.6! – See more at: http://blog.arvixe.com/?s=tomatocart+upgrade#sthash.zyB3jz4M.dpuf
Upgrade your TomatoCart Store from 1.1.8.5 to 1.1.8.6! – See more at: http://blog.arvixe.com/?s=tomatocart+upgrade#sthash.zyB3jz4M.dpuf
Tags: , , , , , , , , , | Posted under TomatoCart | RSS 2.0

Author Spotlight

Jack Yin

Jack Yin

TomatoCart Developer & Co Founder - Arvixe Web Hosting / TomatoCart Community Liaison

Leave a Reply

Your email address will not be published. Required fields are marked *


4 + 9 =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>