Fatal error: Cannot re-assign $this in /home/…../admin/includes/classes/upload.php on line 31
Posted by admin in osCommerce, tips
I logged in to osCommerce shop administration and I got this error:
Fatal error: Cannot re-assign $this in /home/…../admin/includes/classes/upload.php on line 31
Few days ago the shop was transferet to a server with PHP5 installed. So the problem needs to be fiksed and here is how:
Open file /admin/includes/classes/upload.php and obviously go to line 31 or find:
$this = null;
And replace it with:
unset($this);
The administration should work perfectly now.
Joomla: DB function failed with error number 1054
Posted by admin in joomla, tips
A joomla website was transfered from old server using MySql 4.1.x to new server using MySql 5.
When I tried to edit the website content in joomla administration I got next error:
DB function failed with error number 1054
Unknown column ‘c.access’ in ‘on clause’ SQL=SELECT c.*, g.name AS groupname, cc.name, u.name AS editor, f.content_id AS frontpage, s.title AS section_name, v.name AS author FROM jos_content AS c, jos_categories AS cc, jos_sections AS s LEFT JOIN jos_groups AS g ON g.id = c.access LEFT JOIN jos_users AS u ON u.id = c.checked_out LEFT JOIN jos_users AS v ON v.id = c.created_by LEFT JOIN jos_content_frontpage AS f ON f.content_id = c.id WHERE c.state >= 0 AND c.catid = cc.id AND cc.section = s.id AND s.scope = ‘content’ ORDER BY s.title, c.catid, cc.ordering, cc.title, c.ordering LIMIT 0, 10
The problem can be solved by editing this file: /administrator/components/com_content/admin.content.php
Find:
$query = “SELECT c.*, g.name AS groupname, cc.name, u.name AS editor, f.content_id AS frontpage, s.title AS section_name, v.name AS author”
. “\n FROM #__content AS c, #__categories AS cc, #__sections AS s”
. “\n LEFT JOIN #__groups AS g ON g.id = c.access”
. “\n LEFT JOIN #__users AS u ON u.id = c.checked_out”
. “\n LEFT JOIN #__users AS v ON v.id = c.created_by”
. “\n LEFT JOIN #__content_frontpage AS f ON f.content_id = c.id”
. ( count( $where ) ? “\nWHERE ” . implode( ‘ AND ‘, $where ) : ” )
. $order
. “\n LIMIT $pageNav->limitstart,$pageNav->limit”
;
And replace it with:
$query = “SELECT c.*, g.name AS groupname, cc.name, u.name AS editor, f.content_id AS frontpage, s.title AS section_name, v.name AS author”
. “\n FROM #__content AS c” //, #__categories AS cc, #__sections AS s”
. “\n LEFT JOIN #__groups AS g ON g.id = c.access”
. “\n LEFT JOIN #__users AS u ON u.id = c.checked_out”
. “\n LEFT JOIN #__users AS v ON v.id = c.created_by”
. “\n LEFT JOIN #__content_frontpage AS f ON f.content_id = c.id”
. “\n LEFT OUTER JOIN #__categories AS cc ON c.catid=cc.id”
. “\n LEFT OUTER JOIN #__sections AS s ON cc.section=s.id”
. ( count( $where ) ? “\nWHERE ” . implode( ‘ AND ‘, $where ) : ” )
. $order
. “\n LIMIT $pageNav->limitstart,$pageNav->limit”
;
osCommerce: Add category and product name in title tag
Posted by admin in osCommerce, tips
I’m doing search engine optimization for a shop powered by osCommerce. Title tags are very important for that, so I wanted it to look like this: Shop name :: Category name :: Product name.
If you are using STS (Simple Template System) use:
- Open file
/catalog/includes/modules/sts_inc/general.php - Find line:
$sts->template[’headertags’]= “<title>” . TITLE .”</title>”;
and replace it with:
// BOF add category and product name in title tag
$product_title_query = tep_db_query(”select pd.products_name, pd.products_description from ” . TABLE_PRODUCTS . ” p, ” . TABLE_PRODUCTS_DESCRIPTION . ” pd where p.products_id = ‘” . (int)$HTTP_GET_VARS[’products_id’] . “‘ and pd.products_id = p.products_id and pd.language_id = ‘” . (int)$languages_id . “‘”);
$product_title = tep_db_fetch_array($product_title_query); // get product name$category_query = tep_db_query(”select cd.categories_name, c.categories_image from ” . TABLE_CATEGORIES . ” c, ” . TABLE_CATEGORIES_DESCRIPTION . ” cd where c.categories_id = ‘” . (int)$current_category_id . “‘ and cd.categories_id = ‘” . (int)$current_category_id . “‘ and cd.language_id = ‘” . (int)$languages_id . “‘”);
$category = tep_db_fetch_array($category_query); // get category name$sts->template[’headertags’]= “<title>” . TITLE . ” :: ” . $category[’categories_name’] . ” :: ” . $product_title[’products_name’] . “</title>”;
// EOF add category and product name in title tag - Upload the file and you’re done!
If you are using basic osCommerce use:
- Open file
/catalog/index.php - Find line:
<title><?php echo TITLE; ?></title>
and replace it with:
<?php // BOF add category and product name in title tag
$product_title_query = tep_db_query(”select pd.products_name, pd.products_description from ” . TABLE_PRODUCTS . ” p, ” . TABLE_PRODUCTS_DESCRIPTION . ” pd where p.products_id = ‘” . (int)$HTTP_GET_VARS[’products_id’] . “‘ and pd.products_id = p.products_id and pd.language_id = ‘” . (int)$languages_id . “‘”);
$product_title = tep_db_fetch_array($product_title_query); // get product name$category_query = tep_db_query(”select cd.categories_name, c.categories_image from ” . TABLE_CATEGORIES . ” c, ” . TABLE_CATEGORIES_DESCRIPTION . ” cd where c.categories_id = ‘” . (int)$current_category_id . “‘ and cd.categories_id = ‘” . (int)$current_category_id . “‘ and cd.language_id = ‘” . (int)$languages_id . “‘”);
$category = tep_db_fetch_array($category_query); // get category name
?>
<title><?php echo TITLE . ” :: ” . $category[’categories_name’] . ” :: ” . $product_title[’products_name’]; ?></title> - Do the same for file
/catalog/product_info.php - Upload files and that’s it!
Note: Page title (TITLE) is found in your language file (for example: /catalog/includes/language/english.php)
How to find your absolute server path
Posted by admin in tips
- Create new php file (let’s say you name it
abspath.php). - Insert this code in that file:
<?php
$abspath = getcwd();
echo $abspath;
?> - Upload the file with FTP to the root directory of your site.
- Run
http://www.your-domain.com/abspath.phpin browser and you will get your absolute server path.
osCommerce - Your Shopping Cart is empty!
Posted by admin in osCommerce, tips
I installed Ultimate SEO contribution to my osCommerce shop. Then i noticed, if I click on ‘Buy now’ button from product listing page, I get ‘Your Shopping Cart is empty!’ page. That’s not good for business right, so I had to fix the problem. So to do that, open /includes/modelus/product_listing.php and find code:
$lc_text = ‘<a href=”‘ . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array(’action’)) . ‘action=buy_now&products_id=’ . $listing[’products_id’]) . ‘”>’ . tep_image_button(’button_buy_now.gif’, IMAGE_BUTTON_BUY_NOW) . ‘</a> ‘;
and repleace it with:
$lc_text = ‘<a href=”‘ . tep_href_link(basename($PHP_SELF), ‘action=buy_now&products_id=’ . $listing[’products_id’]) . ‘”>’ . tep_image_button(’button_buy_now.gif’) . ‘</a> ‘;
osCommerce: 1046 - No Database Selected
Posted by admin in osCommerce, tips
Here is a solution to error:
1046 - No Database Selected
select configuration_key as cfgKey, configuration_value as cfgValue from configuration
[TEP STOP]
Open file /catalog/includes/confugure.php and check if your database properties (DataBase Name, UserName and PassWord) are correct.
define(’DB_SERVER’, ‘localhost’); // in most cases you don’t have to change this
define(’DB_SERVER_USERNAME’, ‘database_username’);
define(’DB_SERVER_PASSWORD’, ‘database_password’);
define(’DB_DATABASE’, ‘database_name’);
Make the same check in file /catalog/admin/includes/confugure.php for admin area to work.
How to block spam through comments?
Posted by admin in tips, wordpress
Publishing posts on your blog and signig them on diferent webpages so people can find you and your blog usually causes that spamers finds you as well. There is a simple way to prevent those annoying spams: reCaptcha plugin.
Set it up:
- Download the plugin: reCaptcha Wordpress plugin
- Unzip and upload the folder to your plugin folder (usually: /wp-content/plugins/).
- Activate the plugin.
- reCAPTCHA requires an API key, consisting of a ‘public’ and a ‘private’ key.
You can sign up for a free reCAPTCHA key. - Go to ‘Options -> reCaptcha’ and enter ‘public’ and a ‘private’ key.
Plugin’s homepage.
Custom scrollbar
Posted by admin in html / css, tips
I recived a webpage design which included a page with scrollable content. You can use CSS parameters like scrollbar-face-color, scrollbar-highlight-color, but in my case I needed to remove the arrows, so I found fleXcroll. With this code you can create scrollbar just the way you need it. It’s also very easy to use, that’s why I recommend it.
The zip also includes all the examples for the use.
Download fleXcroll (just look under Download section).
Wordpress security
Posted by admin in tips, wordpress
It is strongly recomeded to dedicate a little of your time to increase the securety of your blog. On BlogSecurity.net you can find various tips on securing your Wordpress blog like: change table prefix in database, restrict wp admin access only to your IP, track updates, detect intrusions …
I find this simple guide very useful: WordPress Security Whitepaper!
Go to previous page with JavaScript
Posted by admin in tips
Here is a simple JavaScript solution how to go back to the previous page.
HTML code:
<a href=”javascript:history.go(-1)”>back</a>


