Avoid duplicated when importing
I had tons of listings that was not checked for duplicates, and in some cases I could already have the lsiting on my site. To avoid duplicates, I came up with a fix that checks the database if the name of the business is present. If it is, it wont import that listing. It can be easliy changed to another field or enhanced by checking 2 or more fields. For my current nees, it's good enough with the name of business. Here you go:
in framework/admin/importer.php
find the function process
in it, after
setlocale( LC_ALL, get_locale() . '.' . get_option( 'blog_charset' ) );
add
mysql_connect("localhost","username","password");
mysql_select_db("name of db");
then after
// ignore invalid lines
if ( !$row )
continue;
add
// ignore if data exists in db
$query = mysql_query("SELECT post_title FROM`apt_posts` WHERE post_status = 'publish' AND post_title = '".$values[0]."'");
$result = mysql_fetch_row($query);
if ( !empty( $result ))
continue;