5 replies [Last post]
bowwowadmin's picture
Offline
Bug FinderEarly adopter... addicted to alphas.
Joined: 12/09/2007
Juice: 70
Was this information Helpful?

The csv import worked like a champ

I'm working on this charity case of a project with crunchyinmilk we were able to get 22,000 products with the csv import, although after all the server timeouts (I ended up changing the php.ini to not timeout for 35 minutes and bumped the memory up to 100MB had to comment one of the lines in the content.module and then it went good.)we have lots of duplicate nodes actually about 7,500 duplicates. node_create or something gave all the duplicate products numbers after the name starting with _0. the nids are all different.I was wondering how to delete them all maybe with node_delete.
.
I didn't know if I should post this at the um other topic or not so I started this after not finding anything on mass delete of products.
sorry I'm new to posting on forums, drupal and ubercart but it rocks what a learning curve. just what a person with severe ADD.
Well I'm sucked in no gettin out now

Reference topic
http://www.ubercart.org/forum/development/803/csv_import_0_1_alpha

this is Eric with days of nights of dru_uc . Thanks guys I will blame it on you.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: I need info to delete duplicate products. after using the g

lol Hate to make ya lose much sleep on us... but then again, I do, too. Eye-wink

The quickest way to do this will be a script that queries the node table for any node ending in _0 and then deletes those nodes by nid:

<?php
  $result
= db_query("SELECT nid FROM {node} WHERE name LIKE '%_0'");
  while (
$data = db_fetch_array($result)) {
   
node_delete($data['nid']);
  }
?>

Backup your data before running that! You can try pasting that into a Drupal page w/ the PHP filter. Also, if you have phpMyAdmin, I'd recommend just running that query (remove the { }) in the SQL tab to see what nodes it pulls up. If those aren't the ones you want to delete, don't run this code. Eye-wink

bowwowadmin's picture
Offline
Bug FinderEarly adopter... addicted to alphas.
Joined: 12/09/2007
Juice: 70
I just woke up thanks

Thank you for the fast response. With fresh eyes I used dev and the names are all the same but the Path is the only thing that is different. I am just going to have to delete all of the products no biggie. I was wondering if I change the

<?php
  $result
= db_query("SELECT nid FROM {node} WHERE name LIKE '%_0'");
  while (
$data = db_fetch_array($result)) {
   
node_delete($data['nid']);
  }
?>

to

<?php
  $result
= db_query("SELECT nid FROM {node} WHERE type LIKE 'product'");
  while (
$data = db_fetch_array($result)) {
   
node_delete($data['nid']);
  }
?>

well I tried the above and it deletes like 100 then gives the white screen. Any suggestions

Eric

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: I just woke up thanks

I would just keep running it over and over again until you're done. It's probably faster than using the Admin Content interface since you can do more at a time.

bowwowadmin's picture
Offline
Bug FinderEarly adopter... addicted to alphas.
Joined: 12/09/2007
Juice: 70
A script to delete all your products from drupal

thanks I got this script that did the trick of refresh so I could just watch it flash 500 times from

mooffie - December 16, 2007 - 11:35

If it timeouts on 100 items, let's delete only 30 and repeat this again and again and again (by refreshing the page). Sounds primitive, but actually that's how D6's Batch API works. Haven't tried this code, but it should work.

<?php
  $amt
= 30; // how many items to delete in one go?

 

$result = db_query_range("SELECT nid FROM {node} WHERE type LIKE 'product'", 0, $amt);

 

$n = 0;
  while (
$data = db_fetch_array($result)) {
   
node_delete($data['nid']);
    ++
$n;
  }

  if (

$n == $amt) { // is there more to delete?
   
drupal_goto($_GET['q']); // yep.
 
}
?>

at thread
http://drupal.org/node/201378
thanks for your help
now on to other issues on other posts
ERic

bowwowadmin's picture
Offline
Bug FinderEarly adopter... addicted to alphas.
Joined: 12/09/2007
Juice: 70
Duplicate Product nodes with csv import of products

I thought my duplicating products was my fault but it seems to be something else.
I import just one product with all my fields and the confirmation says just added one node but I go to products or recent posts and it shows 2, each with different paths and that is the only difference between the two. look at the screen shots for settings and url stuff.

help
Eric
sorry this is the other tread that I posted to but haven't got a response back.

http://www.ubercart.org/forum/development/803/csv_import_0_1_alpha

AttachmentSize
importconfermation.png 69.76 KB
product1.png 87.89 KB
product2.png 83.2 KB
productimportsettings.png 100.18 KB