Results 1 to 1 of 1

Thread: Avoid duplicated when importing

  1. #1
    Thread Starter
    Veteran annonse's Avatar
    Join Date
    Jun 2011
    Location
    Norway
    Posts
    439
    Thanks
    58
    Thanked 62 Times in 44 Posts

    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;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Avoid renewal of free advertisement
    By kilop in forum Report ClassiPress Bugs
    Replies: 1
    Last Post: November 27th, 2011, 08:17 AM
  2. Ads duplicated on homepage
    By ssmedia in forum Help Using ClassiPress
    Replies: 1
    Last Post: August 5th, 2011, 07:53 AM
  3. Avoid duplicate ads
    By yoodac in forum ClassiPress General Discussion
    Replies: 4
    Last Post: April 20th, 2011, 08:55 PM
  4. [SOLVED] Posts duplicated
    By jean5774 in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: September 13th, 2010, 11:32 AM
  5. SexyBoomarks is being duplicated
    By san123 in forum Help Using ClassiPress
    Replies: 2
    Last Post: July 1st, 2010, 09:57 AM