For the past 3 days, I've been stuck on a dropdown list development using joomla 2.5, I have to retrieve data from database and show this data in a drop down the steps I followed are mentioned below:
Inside the models folder I have created a new model inside fields folder and name this file "fieldname.php"
Now the file "Models/fields/fieldname.php" contains following source code:
<?php
defined('JPATH_BASE') or die;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
class JFormFieldMyCompany extends JFormFieldList
{
protected $type = 'MyCompany';
public function getOptions()
{
// Initialize variables.
$options = array();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id As value,name As text');
$query->from('#_k2_tags AS a');
$query->order('a.name');
$db = $this->getDbo();
// Get the options.
$db->setQuery($query);
$options = $db->loadObjectList();
// Check for a database error.
if ($db->getErrorNum()) {
JError::raiseWarning(500, $db->getErrorMsg());
}
print_r($options);exit;
return $options;
}
}
after that inside my model filter.php I added the following code.
Models/filter.php:
<?php
defined( '_JEXEC' ) or die;
jimport('joomla.application.component.modeladmin');
class FiltersModelFilter extends JModelAdmin
{
//Add this handy array with database fields to search in
protected $searchInFields = array('text','a.name');
//Override construct to allow filtering and ordering on our fields
public function __construct($config = array()) {
$config['filter_fields']=array_merge($this->searchInFields,array('a.name'));
parent::__construct($config);
}
public function getTable($type = 'Filter', $prefix = 'FiltersTable', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}
protected function loadFormData()
{
$data = JFactory::getApplication()->getUserState('com_filters.edit.filter.data', array());
if (empty($data)) {
$data = $this->getItem();
}
return $data;
}
public function getForm($data = array(), $loadData = true)
{
$form = $this->loadForm('com_filters.filter', 'filter', array('control' => 'jform', 'load_data' => $loadData));
return $form;
}
protected function getListQuery(){
$db = JFactory::getDBO();
$query = $db->getQuery(true);
//CHANGE THIS QUERY AS YOU NEED...
$query->select('id As value, name As text')
->from('#_k2_tags AS a');
// Filter search // Extra: Search more than one fields and for multiple words
$regex = str_replace(' ', '|', $this->getState('filter.search'));
if (!empty($regex)) {
$regex=' REGEXP '.$db->quote($regex);
$query->where('('.implode($regex.' OR ',$this->searchInFields).$regex.')');
}
// Filter company
$company= $db->escape($this->getState('filter.name'));
if (!empty($company)) {
$query->where('(a.name='.$company.')');
}
// Filter by state (published, trashed, etc.)
$state = $db->escape($this->getState('filter.state'));
if (is_numeric($state)) {
$query->where('a.published = ' . (int) $state);
}
elseif ($state === '') {
$query->where('(a.published = 0 OR a.published = 1)');
}
//echo $db->replacePrefix( (string) $query );//debug
return $query;
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* #since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
// Initialise variables.
$app = JFactory::getApplication('administrator');
// Load the filter state.
$search = $this->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
//Omit double (white-)spaces and set state
$this->setState('filter.search', preg_replace('/\s+/',' ', $search));
//Filter (dropdown) state
$state = $this->getUserStateFromRequest($this->context.'.filter.published', 'filter_state', '', 'string');
$this->setState('filter.state', $state);
//Filter (dropdown) company
$state = $this->getUserStateFromRequest($this->context.'.filter.name', 'filter_company', '', 'string');
$this->setState('filter.name', $state);
//Takes care of states: list. limit / start / ordering / direction
parent::populateState('a.name', 'asc');
}
}
Inside the "Views/filter/view.html.php"
<?php
defined( '_JEXEC' ) or die;
jimport( 'joomla.application.component.view');
class FiltersViewFilter extends JView
{
protected $item;
protected $form;
protected $state;
protected $sortColumn;
protected $sortDirection;
protected $searchterms;
public function display($tpl = null)
{
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->form = $this->get('Form');
$this->state= $this->get('State');
//Following variables used more than once
$this->sortColumn = $this->state->get('list.ordering');
$this->sortDirection= $this->state->get('list.direction');
$this->searchterms= $this->state->get('filter.search');
$this->addToolbar();
parent::display($tpl);
}
public function addToolbar()
{
if ($this->item->ID) {
JToolBarHelper::title(JText::_('Filter Title'));
} else {
JToolBarHelper::title(JText::_('Add Filter Title'));
}
JToolBarHelper::apply('filter.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('filter.save', 'JTOOLBAR_SAVE');
JToolBarHelper::save2new('filter.save2new', 'JTOOLBAR_SAVE_AND_NEW');
JToolBarHelper::cancel('filter.cancel');
}
}
inside the views/filter/tmpl/default.php
<?php defined( '_JEXEC' ) or die;
//Get companie options
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
$companies = JFormHelper::loadFieldType('MyCompany', false);
$companyOptions=$companies->getOptions(); // works only if you set your field getOptions on public!!
//Get companie options
?>
<form action="index.php?option=com_filters&ID=<?php echo $this->item->ID ?>"
method="post" name="adminForm" class="form-validate">
<fieldset id="filter-bar">
<div class="filter-search fltlft">
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->searchterms); ?>" title="<?php echo JText::_('Search in Names, etc.'); ?>" />
<button type="submit">
<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>
</button>
<button type="button" onclick="document.id('filter_search').value='';this.form.submit();">
<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>
</button>
</div>
<div class="filter-select fltrt">
<select name="filter_state" class="inputbox" onchange="this.form.submit()">
<option value="">
<?php echo JText::_('JOPTION_SELECT_PUBLISHED');?>
</option>
<?php echo JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('archived'=>false)), 'value', 'text', $this->state->get('filter.published'), true);?>
</select>
<select name="filter_type" class="inputbox" onchange="this.form.submit()">
<option value=""> - Select Company - </option>
<?php echo JHtml::_('select.options', $companyOptions, 'value', 'text', $this->state->get('filter.name'));?>
</select>
</div>
</fieldset>
<div class="width-60 fltlft">
<fieldset class="adminform">
<ul class="adminformlist">
<?php foreach ($this->form->getFieldset() as $field): ?>
<li><?php echo $field->label; ?>
<?php echo $field->input; ?></li>
<?php endforeach ?>
</ul>
</fieldset>
</div>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
Please help me in identification of my error I need to sort out issue as soon as possible.
change this Models/fields/fieldname.php to Models/fields/mycompany.php
also change from JFormFieldMyCompany to JFormFieldMycompany
and protected $type = 'MyCompany'; to protected $type = 'mycompany';
I have upgrade my opencart site version 1.4.9.2 to version1.5.X,
I upgrade the database but don't know how to upgrade the files.
If there is any script regarding this please send me.
I use the script to update the table:-
<?php
# Upgrade Script Beta v2
// Run full install if config doesn't exist
if (!file_exists('../config.php')) {
header('Location: ./index.php');
exit;
}
set_error_handler("myErrorHandler");
// Configuration
require_once('../config.php');
// Startup
require_once(DIR_SYSTEM . 'startup.php');
// Get Path & Url
$errors = array();
$baseurl=(isset($_SERVER['HTTPS']) ? 'https' :'http'). '://' . $_SERVER['HTTP_HOST'] . str_replace('/install','',dirname($_SERVER['REQUEST_URI']));
chdir('..');
$basepath=getcwd();
chdir(dirname(__FILE__));
if (!$link = #mysql_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD)) {
$errors[] = 'Could not connect to the database server using the username and password provided.';
} else {
if (!#mysql_select_db(DB_DATABASE, $link)) {
$errors[] = 'The database could selected, check you have permissions, and check it exists on the server.';
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Installation</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>OpenCart 1.x Upgrade Script (BETA)</h1>
<div id="container">
<?php
function myErrorHandler($errno, $errstr, $errfile, $errline) {
echo "LINE $errline: [$errno] $errstr<br/>";
return;
}
if (empty($errors)) {
// Run upgrade script
$file='upgrade-14x-to-15x.no-opt.sql';
if (!file_exists($file)) {
$errors[] = 'Upgrade SQL file '.$file.' could not be found.';
} else {
mysql_query('set character set utf8', $link);
if ($sql=file($file)) {
$query = '';
foreach($sql as $line) {
// Hacks for compatibility (needs to be improved)
$line = str_replace("oc_", DB_PREFIX, $line);
$line = str_replace(" order ", " `order` ", $line);
$line = str_replace(" ssl ", " `ssl` ", $line);
$line = str_replace("NOT NULL DEFAULT ''", "NOT NULL", $line);
$line = str_replace("NOT NULL DEFAULT NULL", "NOT NULL", $line);
$line = str_replace("NOT NULL DEFAULT 0 COMMENT '' auto_increment", "NOT NULL COMMENT '' auto_increment", $line);
$line = trim($line);
//$line = str_replace(";", "", $line);
if ((substr(trim($line), 0, 2) == '--') || (substr(trim($line), 0, 1) == '#')) { continue; }
if (preg_match('/^ALTER TABLE (.+?) ADD PRIMARY KEY/', $line, $matches)) {
$res = mysql_query(sprintf("SHOW KEYS FROM %s",$matches[1]), $link);
$info = mysql_fetch_assoc(mysql_query(sprintf("SHOW KEYS FROM %s",$matches[1]), $link));
if ($info['Key_name'] == 'PRIMARY') { continue; }
}
if (preg_match('/^ALTER TABLE (.+?) ADD (.+?) /', $line, $matches)) {
if (mysql_num_rows(#mysql_query(sprintf("SHOW COLUMNS FROM %s LIKE '%s'", $matches[1],str_replace('`', '', $matches[2])), $link)) > 0) { continue; }
}
if (preg_match('/^ALTER TABLE (.+?) DROP (.+?) /', $line, $matches)) {
if (mysql_num_rows(#mysql_query(sprintf("SHOW COLUMNS FROM %s LIKE '%s'", $matches[1],str_replace('`', '', $matches[2])), $link)) <= 0) { continue; }
}
if (preg_match('/INNER JOIN (.+?) /', $line, $matches)) {
$xx = #mysql_query(sprintf("SHOW TABLES LIKE '%s'", str_replace('`', '', $matches[1])), $link);
if ($xx && mysql_num_rows($xx) <= 0) { continue; }
}
if (preg_match('/^DROP TABLE (.+?);/', $line, $matches)) {
if (preg_match('/^DROP TABLE IF EXISTS (.+?);/', $line, $matches2)) {
//if (mysql_num_rows(#mysql_query(sprintf("DESC %s", str_replace('`', '', $matches2[1])), $link)) <= 0) { continue; }
} else {
if (mysql_num_rows(#mysql_query(sprintf("SHOW TABLES LIKE '%s'", str_replace('`', '', $matches[1])), $link)) <= 0) { continue; }
}
}
if (strpos($line, 'ALTER TABLE') !== FALSE && strpos($line, 'DROP') !== FALSE && strpos($line, 'PRIMARY') === FALSE) {
$params = explode(' ', $line);
if ($params[3] == 'DROP') {
if (mysql_num_rows(#mysql_query("SHOW COLUMNS FROM $params[2] LIKE '$params[4]'", $link)) <= 0) { continue; }
}
}
if (preg_match('/^ALTER TABLE ([^\s]+) DEFAULT (.+?) /', $line, $matches)) {
if (mysql_num_rows(#mysql_query(sprintf("SHOW TABLES LIKE '%s'", str_replace('`', '', $matches[1])), $link)) <= 0) { continue; }
}
if (preg_match('/^ALTER TABLE (.+?) MODIFY (.+?) /', $line, $matches)) {
if (mysql_num_rows(#mysql_query(sprintf("SHOW COLUMNS FROM %s LIKE '%s'", $matches[1],str_replace('`', '', $matches[2])), $link)) <= 0) { continue; }
}
if (preg_match('/^ALTER TABLE (.+?) CHANGE (.+?) (.+?) /', $line, $matches)) {
if (mysql_num_rows(#mysql_query(sprintf("SHOW COLUMNS FROM %s LIKE '%s'", $matches[1],str_replace('`', '', $matches[2])), $link)) <= 0) {
continue;
}
// if it does exist, be sure the new name doesn't also exist. If so, then just delete it.
if (mysql_num_rows(#mysql_query(sprintf("SHOW COLUMNS FROM %s LIKE '%s'", $matches[1],str_replace('`', '', $matches[3])), $link)) > 0) {
#mysql_query(sprintf("ALTER TABLE %s DROP %s", $matches[1], str_replace('`', '', $matches[2])), $link); //Drop the column if it was supposed to be changed to a column that already exists
continue;
}
}
if (preg_match('/^DELETE FROM (.+?) WHERE (.+?) /', $line, $matches)) {
if (preg_match('~ WHERE (.*);$~', $line, $matches2)) {
if (preg_match_all('~`([^`]+)`~', $matches2[1], $matched)) {
$notfound = 0;
foreach ($matched[1] as $m) {
if (mysql_num_rows(#mysql_query(sprintf("SHOW COLUMNS FROM %s LIKE '%s'", $matches[1],str_replace('`', '', $m)), $link)) <= 0) {
$notfound++;
}
}
if ($notfound) { continue; }
}
}
}
if (preg_match('/^INSERT INTO (.+?) \(([^)]+)\) /', $line, $matches)) {
$parts = explode(",", str_replace("`", "", $matches[2]));
$notfound = 0;
foreach ($parts as $m) {
if (mysql_num_rows(#mysql_query(sprintf("SHOW COLUMNS FROM %s LIKE '%s'", $matches[1], trim($m)), $link)) <= 0) {
$notfound++;
}
}
if ($notfound) { continue; }
}
if (preg_match('/^INSERT INTO (.+?) \(([^)]+)\) SELECT ([^FROM]+) FROM `([^`]+)`/', $line, $matches)) {
$parts = explode(",", str_replace("`", "", $matches[3]));
$notfound = 0;
foreach ($parts as $m) {
if (mysql_num_rows(#mysql_query(sprintf("SHOW COLUMNS FROM %s LIKE '%s'", $matches[4], trim($m)), $link)) <= 0) {
$notfound++;
}
}
if ($notfound) { continue; }
}
//if (preg_match('/^ALTER TABLE (.+?) DEFAULT (.+?) /',$line,$matches)) {
// if (mysql_num_rows(#mysql_query(sprintf("SHOW COLUMNS FROM %s LIKE '%s'",$matches[1],str_replace('`','',$matches[2])), $link)) <= 0) { continue; }
//}
//if (preg_match('/^ALTER TABLE (.+?) ALTER (.+?) /',$line,$matches)) {
// if (mysql_num_rows(#mysql_query(sprintf("SHOW COLUMNS FROM %s LIKE '%s'",$matches[1],str_replace('`','',$matches[2])), $link)) <= 0) { continue; }
//}
if (!empty($line)) {
$query .= $line;
if (preg_match('/;\s*$/', $line)) {
if (mysql_query($query, $link) === false) {
$errors[] = 'Could not execute this query: ' . $query . ' ' . mysql_error($link);
}
$query = '';
}
}
}
}
}
}
// Check if there are any products associated with a store (pre-1.4.1)
$info = mysql_fetch_assoc(mysql_query("SELECT * FROM " . DB_PREFIX . "product_to_store", $link));
// If not, then add them all to the default
if (!$info) {
$resource = mysql_query("SELECT product_id FROM " . DB_PREFIX . "product", $link);
$data = array();
$i = 0;
while ($result = mysql_fetch_assoc($resource)) {
$data[$i] = $result;
$i++;
}
foreach ($data as $product) {
mysql_query("INSERT INTO " . DB_PREFIX . "product_to_store SET product_id = '".$product['product_id']."', store_id = '0'", $link);
}
}
// Check if there are any informations associated with a store (pre-1.4.1)
$info = mysql_fetch_assoc(mysql_query("SELECT * FROM " . DB_PREFIX . "information_to_store", $link));
// If not, then add them all to the default
if (!$info) {
$resource = mysql_query("SELECT information_id FROM " . DB_PREFIX . "information", $link);
$data = array();
$i = 0;
while ($result = mysql_fetch_assoc($resource)) {
$data[$i] = $result;
$i++;
}
foreach ($data as $information) {
mysql_query("INSERT INTO " . DB_PREFIX . "information_to_store SET information_id = '".$information['information_id']."', store_id = '0'", $link);
}
}
// Check if there are any categories associated with a store (pre-1.4.1)
$info = mysql_fetch_assoc(mysql_query("SELECT * FROM " . DB_PREFIX . "category_to_store", $link));
// If not, then add them all to the default
if (!$info) {
$resource = mysql_query("SELECT category_id FROM " . DB_PREFIX . "category", $link);
$data = array();
$i = 0;
while ($result = mysql_fetch_assoc($resource)) {
$data[$i] = $result;
$i++;
}
foreach ($data as $category) {
mysql_query("INSERT INTO " . DB_PREFIX . "category_to_store SET category_id = '".$category['category_id']."', store_id = '0'", $link);
}
}
// Check if there are any manufacturers associated with a store (pre-1.4.1)
$info = mysql_fetch_assoc(mysql_query("SELECT * FROM " . DB_PREFIX . "manufacturer_to_store", $link));
// If not, then add them all to the default
if (!$info) {
$resource = mysql_query("SELECT manufacturer_id FROM " . DB_PREFIX . "manufacturer", $link);
$data = array();
$i = 0;
while ($result = mysql_fetch_assoc($resource)) {
$data[$i] = $result;
$i++;
}
foreach ($data as $manufacturer) {
mysql_query("INSERT INTO " . DB_PREFIX . "manufacturer_to_store SET manufacturer_id = '".$manufacturer['manufacturer_id']."', store_id = '0'", $link);
}
}
######################################
# START 1.5.x UPGRADE CODE
######################################
/**
* Convert Store table to Setting table
*/
$sql = "SELECT * FROM " . DB_PREFIX . "store";
$resource = mysql_query($sql, $link);
if ($resource) {
if (is_resource($resource)) {
$i = 0;
$data = array();
while ($result = mysql_fetch_assoc($resource)) {
$data[$i] = $result;
$i++;
}
mysql_free_result($resource);
}
}
// Only run if coming from 1.4.x to 1.5.x. Skip if coming from another 1.5.x version
if ($data && isset($data[0]['zone_id'])) {
$storedata = array();
foreach ($data as $d) {
$storedata[$d['store_id']] = $d;
unset($storedata[$d['store_id']]['store_id']);
}
foreach ($storedata as $store_id => $value) {
// Verify the store id doesn't already exist
$qry = mysql_fetch_assoc(mysql_query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '" . (int)$store_id . "'", $link));
if ($qry) { continue; }
// New store fields
if (!isset($value['address'])) { $value['address'] = '' ;}
if (!isset($value['email'])) { $value['email'] = '' ;}
if (!isset($value['telephone'])) { $value['telephone'] = '' ;}
if (!isset($value['fax'])) { $value['fax'] = '' ;}
if (!isset($value['layout'])) { $value['layout'] = '' ;}
if (!isset($value['image_compare_height'])) { $value['image_compare_height'] = '' ;}
if (!isset($value['image_compare_width'])) { $value['image_compare_width'] = '' ;}
if (!isset($value['image_manufacturer_height'])) { $value['image_manufacturer_height'] = '' ;}
if (!isset($value['image_manufacturer_width'])) { $value['image_manufacturer_width'] = '' ;}
if (!isset($value['image_wishlist_height'])) { $value['image_wishlist_height'] = '' ;}
if (!isset($value['image_wishlist_width'])) { $value['image_wishlist_width'] = '' ;}
// special case
if (!isset($value['use_ssl'])) { $value['use_ssl'] = $value['ssl'] ;}
if (!isset($value['ssl'])) {
if ($value['use_ssl']) {
$value['ssl'] = str_replace('http://', 'https://', $value['url']);
} else {
$value['ssl'] = $value['url'];
}
mysql_query("INSERT INTO " . DB_PREFIX . "store SET `ssl` = '" . $value['ssl'] . "' WHERE store_id = '" . (int)$store_id . "', `group` = 'config'", $link);
}
foreach ($value as $k => $v) {
mysql_query("INSERT INTO " . DB_PREFIX . "setting SET `key` = 'config_" . $k . "', `value` = '" . $v . "', store_id = '" . (int)$store_id . "', `group` = 'config'", $link);
}
}
$sql = "ALTER TABLE `" . DB_PREFIX . "store`
DROP `title`,
DROP `meta_description`,
DROP `template`,
DROP `country_id`,
DROP `zone_id`,
DROP `language`,
DROP `currency`,
DROP `tax`,
DROP `customer_group_id`,
DROP `customer_price`,
DROP `customer_approval`,
DROP `guest_checkout`,
DROP `account_id`,
DROP `checkout_id`,
DROP `stock_display`,
DROP `stock_check`,
DROP `stock_checkout`,
DROP `order_status_id`,
DROP `logo`,
DROP `icon`,
DROP `image_thumb_width`,
DROP `image_thumb_height`,
DROP `image_popup_width`,
DROP `image_popup_height`,
DROP `image_category_width`,
DROP `image_category_height`,
DROP `image_product_width`,
DROP `image_product_height`,
DROP `image_additional_width`,
DROP `image_additional_height`,
DROP `image_related_width`,
DROP `image_related_height`,
DROP `image_cart_width`,
DROP `image_cart_height`,
DROP `catalog_limit`,
DROP `cart_weight`,
AUTO_INCREMENT=1;";
mysql_query($sql, $link);
}
/**
* Convert Options to Global Options
*/
/*
# Convert options over.. big job
ALTER TABLE `oc_order_option`
ADD `product_option_id` int(11) NOT NULL DEFAULT 0 COMMENT '' AFTER order_product_id,
ADD `type` varchar(32) NOT NULL DEFAULT '' COMMENT '' COLLATE utf8_bin AFTER value,
MODIFY `value` text NOT NULL DEFAULT '' COMMENT '' COLLATE utf8_bin,
DROP `price`,
DROP `prefix`;
ALTER TABLE `oc_product_option`
ADD `option_id` int(11) NOT NULL DEFAULT 0 COMMENT '' AFTER product_id,
ADD `option_value` text NOT NULL DEFAULT '' COMMENT '' COLLATE utf8_bin AFTER option_id,
ADD `required` int(1) NOT NULL DEFAULT 0 COMMENT '' AFTER option_value,
DROP `sort_order`;
DROP TABLE `oc_product_option_description`;
ALTER TABLE `oc_product_option_value`
ADD `option_id` int(11) NOT NULL DEFAULT 0 COMMENT '' AFTER product_id,
ADD `option_value_id` int(11) NOT NULL DEFAULT 0 COMMENT '' AFTER option_id,
ADD `price_prefix` varchar(1) NOT NULL DEFAULT '' COMMENT '' COLLATE utf8_bin AFTER price,
ADD `points` int(8) NOT NULL DEFAULT 0 COMMENT '' AFTER price_prefix,
ADD `points_prefix` varchar(1) NOT NULL DEFAULT '' COMMENT '' COLLATE utf8_bin AFTER points,
ADD `weight` decimal(15,8) NOT NULL DEFAULT '' COMMENT '' AFTER points_prefix,
ADD `weight_prefix` varchar(1) NOT NULL DEFAULT '' COMMENT '' COLLATE utf8_bin AFTER weight,
MODIFY `quantity` int(3) NOT NULL DEFAULT 0 COMMENT '',
ALTER `subtract` DROP DEFAULT,
DROP `prefix`,
DROP `sort_order`;
DROP TABLE `oc_product_option_value_description`;
write this back to the config.php
// HTTP
define('HTTP_SERVER', 'http://localhost/v150/');
define('HTTP_IMAGE', 'http://localhost/v150/image/');
define('HTTP_ADMIN', 'http://localhost/v150/admin/');
// HTTPS
define('HTTPS_SERVER', 'http://localhost/v150/');
define('HTTPS_IMAGE', 'http://localhost/v150/image/');
*/
if (!empty($errors)) { //has to be a separate if
?>
<p>The following errors occured:</p>
<?php foreach ($errors as $error) {?>
<div class="warning"><?php echo $error;?></div><br />
<?php } ?>
<p>The above errors occurred because the script could not properly determine the existing state of those db elements. Your store may not need those changes. Please post any errors on the forums to ensure that they can be addressed in future versions!</p>
</div>
<?php } else { ?>
<h2>SUCCESS!!! Click here to goto your store</h2>
<?php } ?>
<div class="center">OpenCart.com</div>
</body>
</html>
Please try this script. Instructions also available. http://forum.opencart.com/viewtopic.php?t=50292
I dont know a script that is able to update the Opencart files. You simply need to empty your FTP and upload the 1.5.x package. If you're using any (custom) modules, you'll need to re-install them. But be carefull, because modules developed for 1.4.x are not automatically compatible with 1.5.x.