Thursday, May 7, 2009

How to import products with custom options in Magento

Over the past several months I've been using Magento on four stores. I've run into a few things which have required slight modifications.

Recently I needed to import 200 new products. The products all had between 3 and 4 options. The default Magento import does not allow you to import custom options for products so I customized the import to allow imporing of options.

To add this customization to your magento store first copy app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php to app/code/local/Mage/Catalog/Model/Convert/Adapter/Product.php. This will prevent upgrades from overwriting your changes.

Next you need to add some code to "local" version of Product.php (code/local/Mage/Catalog/Model/Convert/Adapter/Product.php). The line numbers below correspond to version 1.3 they may be a bit different in older versions.

At about line 566 you will see:


foreach ($importData as $field => $value) {


Just above that add:

$custom_options = array();


At about line 575 you will see:

$attribute = $this->getAttribute($field);
if (!$attribute) {
continue;
}


You will need to add some code above the continue statement.


/* CUSTOM OPTION CODE */
if(strpos($field,':')!==FALSE && strlen($value)) {
$values=explode('|',$value);
if(count($values)>0) {
@list($title,$type,$is_required,$sort_order) = explode(':',$field);
$title = ucfirst(str_replace('_',' ',$title));
$custom_options[] = array(
'is_delete'=>0,
'title'=>$title,
'previous_group'=>'',
'previous_type'=>'',
'type'=>$type,
'is_require'=>$is_required,
'sort_order'=>$sort_order,
'values'=>array()
);
foreach($values as $v) {
$parts = explode(':',$v);
$title = $parts[0];
if(count($parts)>1) {
$price_type = $parts[1];
} else {
$price_type = 'fixed';
}
if(count($parts)>2) {
$price = $parts[2];
} else {
$price =0;
}
if(count($parts)>3) {
$sku = $parts[3];
} else {
$sku='';
}
if(count($parts)>4) {
$sort_order = $parts[4];
} else {
$sort_order = 0;
}
switch($type) {
case 'file':
/* TODO */
break;

case 'field':
case 'area':
$custom_options[count($custom_options) - 1]['max_characters'] = $sort_order;
/* NO BREAK */

case 'date':
case 'date_time':
case 'time':
$custom_options[count($custom_options) - 1]['price_type'] = $price_type;
$custom_options[count($custom_options) - 1]['price'] = $price;
$custom_options[count($custom_options) - 1]['sku'] = $sku;
break;

case 'drop_down':
case 'radio':
case 'checkbox':
case 'multiple':
default:
$custom_options[count($custom_options) - 1]['values'][]=array(
'is_delete'=>0,
'title'=>$title,
'option_type_id'=>-1,
'price_type'=>$price_type,
'price'=>$price,
'sku'=>$sku,
'sort_order'=>$sort_order,
);
break;
}
}
}
}
/* END CUSTOM OPTION CODE */


Now further on in the code (about line 710) you'll see $product->save(); Just after this add the following code:


/* Remove existing custom options attached to the product */
foreach ($product->getOptions() as $o) {
$o->getValueInstance()->deleteValue($o->getId());
$o->deletePrices($o->getId());
$o->deleteTitles($o->getId());
$o->delete();
}

/* Add the custom options specified in the CSV import file */
if(count($custom_options)) {
foreach($custom_options as $option) {
try {
$opt = Mage::getModel('catalog/product_option');
$opt->setProduct($product);
$opt->addOption($option);
$opt->saveOptions();
}
catch (Exception $e) {}
}
}


That's it, you should be all set to import custom product options.

To import a custom option you need to add a new column to your CSV import file. The name of the column determines the name and type of the option. The format is: Name:Type:Is Required. For example, to create a required drop down option called "Size" your column header should be: Size:drop_down:1 (1 for required, 0 for optional). Here is a list of the Types, these are taken from the "Custom Options" screen in the Magento admin area.
  • field: Field
  • area: Area
  • file: File
  • drop_down: Drop-down
  • radio: Radio Buttons
  • checkbox: Checkbox
  • multiple: Multiple Select
  • date: Date
  • date_time: Date & Time
  • time: Time
For types with multiple values (drop_down, radio, checkbox, multiple) you can specify using a | separator. Example for Small, Medium, Large you would use "Small|Medium|Large" as the value for the "Size:drop_down:1" column in your csv file.

Here's paired down example of the import format:

sku,name,description,price,Size:drop_down:1
T-Shirt1,T-Shirt,A T-Shirt,5.00,Small|Medium|Large
T-Shirt2,T-Shirt2,Another T-Shirt,6.00,XS|S|M|L|XL

In addition you can specify an addition price and SKU modifier for each option value. The syntax for this is Value:[fixed|percent]:price_modifier. For example if you have a product which costs $5 more for a Medium and $10 more for a large you would the following as the option value.

Small|Medium:fixed:5|Large:fixed:10

Here's the first example with additional price/sku modifiers.

sku,name,description,price,Size:drop_down:1
T-Shirt1,T-Shirt,A T-Shirt,5.00,Small:fixed:0:-SM|Medium:percent:2:-MED|Large:percent:3:-LRG
T-Shirt2,T-Shirt2,Another T-Shirt,6.00,XS:fixed:0:-XS|S:fixed:0:-S|M:fixed:1:-M|L:fixed:1:-L|XL:fixed:2:-XL


UPDATE: 5/12
Here's a sample CSV file I used to test code additions by @gancheff and @Brendan.


I hope this modification helps others who need to import product options.

190 comments:

  1. Hello, Great Post. Is there a method of exporting custom options?

    ReplyDelete
  2. I haven't yet had a need to export the custom options. I'll take a look and see what it would take to do this.

    ReplyDelete
  3. The only reason I have to export options would be to get the data format to import them in the first place.

    Is the format you have above, the correct format for custom options?

    ReplyDelete
  4. Yes, the examples in the post show how to include custom options in your import file, just add the custom options column(s) to your existing CSV import file.

    ReplyDelete
  5. Hi,

    is it possible to have more than one custom options for each product?

    ReplyDelete
  6. Yes, specify each custom option as an additional column in your CSV file.

    ReplyDelete
  7. Hello,

    thank you for your post. It was really helpful.
    Is it possible when importing options to remove the existing ones so to avoid duplicates? If your example is imported twice all custom options will be repeated. Can you please suggest a way to first delete the stored in the database custom options and then write the ones in the CSV import file. Perhaps this should be done just before the saving of the imported options but I don't have idea how to code that.

    Thank you.
    Greetings!

    ReplyDelete
  8. With a little research I figured it out. In case anyone needs it here's the code:

    foreach ($product->getOptions() as $o) {
    $o->getValueInstance()->deleteValue($o->getId());
    $o->deletePrices($o->getId());
    $o->deleteTitles($o->getId());
    $o->delete();
    }

    ReplyDelete
  9. @gancheff, thanks for the code to remove existing options before adding the ones specified in the import files. I've added it to the code in the post.

    ReplyDelete
  10. great work,

    just some comments

    1. When i run the import and look at my items there do not have a sort Order. How Can i set this for
    a. The Custom Option Title/Group
    b. for the Sub Items

    2. If i have a large spreadsheet of products with some having one type of custom-option an another not using that custom-option. The Program still will create that option even if i have not set any data in that field.
    Is there a way you can do a pre-check to see if the field has data then create the custom option group. Else skip over creating the custom-option group?

    other than the above comments, great work!

    brendan

    ReplyDelete
  11. ok,

    so ive modified brians code to now accept a sort order. In both the header and details elements. But I still cant work out how to ignore fields where there is no record. The code will still create the header custom option

    this: @list($title,$type,$is_required) = explode(':',$field);
    is now @list($title,$type,$is_required,$sortHeader) = explode(':',$field);

    This:
    'sort_order'=>0,
    is now
    'sort_order'=>$sortOrder,

    for the detail section see below:

    $iSortDetail=1; foreach($values as $v)
    {$parts = explode(':',$v);
    $title = $parts[0];
    if(count($parts)>1) {
    $price_type = $parts[1];
    } else {
    $price_type = 'fixed';
    }
    if(count($parts)>2) {
    $price = $parts[2];
    } else {
    $price =0;
    }
    if(count($parts)>3) {
    $sku = $parts[3];
    } else {
    $sku='';
    }
    if(count($parts)>4) {
    $sortOrder = $parts[4];
    } else {
    $sortOrder=$iSortDetail;
    }
    $custom_options[count($custom_options) - 1]['values'][]=array(
    'is_delete'=>0,
    'title'=>$title,
    'option_type_id'=>-1,
    'price_type'=>$price_type,
    'price'=>$price,
    'sku'=>$sku,
    'sort_order'=>$iSortDetail,
    );
    $iSortDetail++;
    }

    so any ideas would be great

    brendan

    ReplyDelete
  12. Brian,

    I have tried out everything you have listed here. I am willing to pay you respectfully for your time, if you can just take a glance at my CSV file and my Product.php file.

    Please contact me @ muaadlamen@gmail.com

    Thanks

    ReplyDelete
  13. @Brendan, thanks for the suggestion for sort order. I'll take a look at your code and see if I can get it working.

    ReplyDelete
  14. Brian,
    Can this be used to add brand attributes to the products? I have over one thousand brands and need to add the brands to the import file.
    Thanks,
    Shawn

    ReplyDelete
  15. hey brian,

    thanks. the sort order stuff is cool, as the code above works (abliet not quite so elegant!).

    my main issue is where you have a large product file where some fields dont have values. The code still creates the Custom Option Header, but because there is no data in that field the line items are left blank.

    So im really just stuck as to how i can first check the field contents has data if yes then create the Custom Option Header and then the line items

    anyway, thanks again
    brendan

    ReplyDelete
  16. Shawn,

    What do you mean by brand attributes? Do you mean the images or something else?

    brendan

    ReplyDelete
  17. @Brendan thanks for the contribution. I've added your code for including ordering. I also fixed the issue of blank option values (line 1: if(strpos($field,':')!==FALSE && strlen($value)) { )

    ReplyDelete
  18. hey brian,

    ive just tested this out and it works.
    thank you for the update,

    ReplyDelete
  19. Brian,
    What I mean is adding the brand name to products and not creating an extra category. ie Sony TVs or LG TVs. Sony or LG would be a brand that I would attach to a certain group of products in the TV category.

    ReplyDelete
  20. Hi thanks for the post, Im not sure if Im missing something simple. I have inserted the custom code in to the product.php file, and added your sample custom data in the csv file, but I keep getting the "Notice: Undefined variable: custom_options in /homepages/17/d282805926/htdocs/theultimatedress6/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php on line 732" error. Ps I had nothing in the app/code/local/ folder so I change the product.php in the app/code/core/Mage/Catalog/Model/Convert/Adapter/ folder and when that didnt work, I created all the additional folders in the local folder, and put the product.php in there. It must be reading the new code, but Im not getting any success. Any suggestions?

    ReplyDelete
  21. Also I did manage to get it to import a couple of times without any errors, but the custom options didn't appear on the front end. PS I had some other custom code in the product.php adding additional gallery images, but I removed it hoping that it would work without with no success

    ReplyDelete
  22. Ok I found out that I hadnt put a 1 in the hasoptions field. Another question, I can get the radio and dropdown buttons, but I just want to ad a text field, I need to have people input a colour number, this is the heading (Colour Number:field:1) I tried putting a 0 and a 1 in the field, but it doesn't show> Have you had success with text fields?

    ReplyDelete
  23. Shawn,

    You can create an attribute called "brand" (Catalog->Attributes->Manage Attributes). Then just add a "brand" column to your import. My install had a "manufacturer" attribute already setup, it's a "drop-down" type so you have to predefine the list of values.

    ReplyDelete
  24. Online Wedding Planner,

    Thanks you found a couple of issues.

    First, I forgot to put the code to initialize the $custom_options array in the post, I've added it above.

    Second, I never tested with text fields as I don't have product with text input options. The code was not handling them properly. I've updated the code to properly handler field and area types. Your column name will work properly. The input options have slightly different parameters than radio, select, etc.

    You have to specify a value for the option to be created, to create an input option with default values use: ":" as the vale you just have to put something in the row so it's not ignored. Here's the format:
    "Title(not used):price_type:price:sku:max_characters"

    Example: :fixed:5:MONGRM:25

    This would create an input field with a fixed price of $5, a SKU modifier of "MONGRM" and a max of 25 characters.

    Hope this helps!

    ReplyDelete
  25. Is it possible to add additional custom options without deleting the existing ones?

    ReplyDelete
  26. Yes, you can comment out (or remove) the code block that removes the existing options. There's a comment marking it's placement in the code above.

    ReplyDelete
  27. Hi brian
    i have added the code you provided its working perfect but when i import my file having one product only it adds one extra product itself and also process all product at the time of importing but it should process only those product which are specified in csv file . Is there any idea ?

    ReplyDelete
  28. Don't works for me and I dont know why :\
    I did what you write, than I ran Import all products profile and nothing happens. All is importing as usual, no error message but i can't see any options set.

    ReplyDelete
  29. I'm lame, forgot "has_options"

    ReplyDelete
  30. How much more is involved in getting the file upload custom option working. I noticed the comment in the section is just "TODO". I'm trying to code it in myself but any advice you have would be appreciated.

    ReplyDelete
  31. You saved me a lot of time to do it myself. Thank you very much.

    ReplyDelete
  32. Does thsi work on version 1.3.2?

    ReplyDelete
  33. I just found a fix for mass importing configurable products before I found your post. It seems your solution is much simpler. Could this solution be used to add more custom options to the configurable products already loaded into magento? Or would your fix overwrite the current configurable products and options?

    ReplyDelete
  34. Hi can you explain what you mean by "existing csv file"? or where it is located. Do I have to make a new profile and export a new csv file?

    ReplyDelete
  35. If I am not mistaken the locations of the files are var/export and var/import

    ReplyDelete
  36. I am building a store in Spanish and English. The Custom Options load properly and the only trouble that I am having with it's that the English custom options are being loaded as default(admin) and the values that I have assigned in the spreadsheet for the Spanish store do not get loaded.

    I have already specified to which store I want to load the CSV file in the import profile. But this does not seem to work as well. Anyone has any idea or has experienced loading custom options in multiple languages?

    ReplyDelete
  37. Brian ,

    I did all above you said , and when i run my CSV file, i got these words:



    Invalid method Mage_Catalog_Model_Product_Option_Value::deletue(Array( [0] => 1))
    Invalid method Mage_Catalog_Model_Product_Option_Value::deletue(Array( [0] => 2))



    can you give some advice?

    ReplyDelete
  38. Hello Brian !! Thanks so much for your post. I was looking for something like that for a long time!

    Well, I'm starting to do all modifications and I realize that I do not have this folders app/code/local/Mage/Catalog/Model/Convert/Adapter/Product.php. Can I create that to work on it? I'm working on 1.2.1.2 version.
    I'll wait your repply!

    ReplyDelete
  39. Aninhabahr, You have to create the path yourself. Create the folder you mention and follow Brian's instructions and you will be fine.

    ReplyDelete
  40. Hey this is really great work and really helpful since Magento doesn't have this option implemented yet. Has anyone come up with a way to export CSV with the custom options?

    ReplyDelete
  41. Can I use this in XML as well?

    ReplyDelete
  42. Amazing post Brian. Import worked flawless. I'd like to thank you for sharing this script.

    ReplyDelete
  43. thanks for this but indeed, any chance to get this working for imported xml? would really need it, tried to do it like it is instructed but to xml, can't see attributes :( Please someone help if you just can

    ReplyDelete
  44. Hey All,

    Thanks for the post Brian this was great with helping us create a module. Here is a link to more information: http://jc-websolutions.com/mag-customops.html

    It is a module for custom options, tier pricing, and associated products import and export using the CSV option

    ReplyDelete
  45. This comment has been removed by the author.

    ReplyDelete
  46. I freaking love this post. Like seriously, thank you so much for this.

    ReplyDelete
  47. Hey, Brian.you write this post yourself?

    Now I have a problem.

    Well, I've added the custom options successfully as I followed what you said above.

    And the qustion is ,
    I can add them ,but can't change them or delete them.

    have you any idea?

    Waiting for your answer . Thanks! Indeed!

    My email is alivenk@gmail.com

    ReplyDelete
  48. I am having someone develop an online store using magento software.
    It is a distributor who is loading about 2000 of their products. I have found another distributor with about 20,000 items that I would like to add to the store.
    The new dist supplied me with an excel database (without images). The items are grouped in columns with appropriate categories,subcategories, manufacturer, product id, description, upc, list price, my disc price, etc.
    Some of the categories and subs are not in magento from the original dist. Do I need to set up these cat and subs first?
    I am also interested in adding more items from a 3rd distributor.
    All orders will be sent to me and in turn I will order from the appropriate dist.There may be instances when I will need to order from 2 different dist.
    Is there a way to see this on the order? Does the dist field need to be in the database before importing?
    I am not familiar with website programing but eventually want to learn how to do all this on my own.

    Do you offer any service or have any solutions to my requests?

    --
    ThankYou,

    Craig
    702-521-5247
    craigcriv@gmail.com

    ReplyDelete
  49. Hey Brian, can this work with importing grouped products?
    Thanks,
    Shawn

    ReplyDelete
  50. Hello, this is a great modification, thanks for it! I'm having a problem getting the custom options to show for configurable products. When I run an import of a configurable product, the custom options do not show. They are entered into the database, but the main entity record in the database for the configurable product sets the "has_options" field to 0. I do have it set to 1 in my spreadsheet though. I've added some debug code into the import script and before $product->save() is called "has_options" is set to 1 but after $product->save() it is set to 0. It looks like $product->save() is resetting the "has_options" field. Can anyone help? I can't seem to find out why. :(

    ReplyDelete
  51. After integrating the code into magento version 1.3.2.2, I am having trouble adding options in certain circumstances.

    If the product is an existing product with an option set, when I import the csv file, it updates the options correctly with the values in the csv file.

    If the product is a new product, or the product is already setup in the admin with no options setup, when I import the csv file, it doesnt seem to import the options.

    Any tips of a possible solution?

    -Matt

    ReplyDelete
  52. im having the same issues with my magento installation. the product options get imported but they dont show up in the frontend (are visible in the backend). once i save the product in the administration the options also show up in the frontend. any clues?

    ReplyDelete
  53. Is it possible to have images in custom option? I mean a user gets product image changed if he selects a custom option from dropdown? If yes please let me know how?

    Thanks

    ReplyDelete
  54. Hey Brian,
    thanks for your hard work here! This just solved a lot of our problems.

    However, I still can't figure out how to get sorting for details element. For example, for a shirt sizes, this...
    S|M|L|XL|2XL:fixed:2.0

    ...will be displayed in alphabetical order. 2XL will be on top, then L, M, S, XL. Could you please help me on that ? Thank much.

    ReplyDelete
  55. Wonderful job Brian, You are more than a star!!!!! Thank you very much for this. It saves me a lot of time and effort.

    Cheers
    S

    ReplyDelete
  56. It broke after upgrading Magento from 1.3.2.2 to 1.3.2.4, because the original Products.php is changed.
    Just copy it again and re-apply the changes. Then it works again.

    ReplyDelete
  57. I've followed each step to the letter and this is not working for me. Import succeeds but ignored the custom options in the csv. Ive tried both with my own csv and with the sample one provided here.
    As Ronald's post above says it works fine in the latest version so I'm baffled as to why its not working for me! Any pointers??

    ReplyDelete
  58. My problem appears to be similar to what a few people have encountered. The import sort of works but requires you to go into admin, edit each item and add a custom option then clicking save. only now does the imported options show.

    also when not following the process ive mentioned, customers cannot purchase the products what should have custom options, when they add to basket it says something along the lines of 'custom options required' but these options aren't visible to the user!

    Any suggestion??

    ReplyDelete
  59. ignore me Im an idiot! I had missed putting the 'has_options' column into the csv so thats why it wasn't showing up on the products.

    Anyway, thanks Brian, this is a fantastic contribution and its saved me a lot of stress!

    ReplyDelete
  60. Hi, at first thank you for this modification which really should be a core feature..

    I just have one problem. It doesn't work for me and i dont know why :)

    I am using Magento v1.3.2.4 and i want to have a custom option field for my products.

    In my CSV file i have a column:
    Gravurzeile_1:fixed:0:gr-zeile1:25
    (this is my column head, has there something to be in the rows?)
    which should, refering to your example show a custom option field.

    The import process is running fine, no errors. But the custom option does not show up. I am trying to add the custom option to a simple product and have has_options set to 1.

    Even the simple example
    Size:drop_down:1
    XS|S|M|L|XL
    did not work for me.

    ReplyDelete
  61. I'd like to use this hack together with a great script that CSV-imports configurable products (see http://www.magentocommerce.com/boards/viewthread/49620/). I merged the code from this page into my product.php but didn't succed. No errors but no custom options either.

    There are a couple people in these comments that report this problem importing custom options for configurable products - so it might be not related to CSV-import hack for configurables.

    I am using 1.3.2.4 btw.

    ReplyDelete
  62. Many institutions limit access to their online information. Making this information available will be an asset to all.
    Custom Paper Writing

    ReplyDelete
  63. Hi Brian,

    I'm so in need of being able to add thumbnail images to my custom options.Ex if a custom option is set to color I would like to be able to add a color swatch images for black,white etc this feature should have been worked up along with a contribute like yours in a magento release I dont know why its not. I to also would like to be able to export the file once I create a simple product to get a feel on all the columns. I would greatly appriciate your help on accomplishing this I'm so in need.

    Brian
    email:rocket3609@gmail.com

    ReplyDelete
  64. Anyone find a way to save custom options on import and have them show up....rather then resave every product to have them show up?

    ver 1.3.2.4

    Import works great but custom options do not show up on front end after import.

    ReplyDelete
  65. How to import custom options in two languages for two store views? it doesn't work when I put store instead of default - english for example. All custom options are replaced by the latest file uploaded and visible just in one language for both stores. When the overwriting code in product.php is not commented out then I see both languages in the same time. Any solution?

    ReplyDelete
  66. @Sarah - make sure you have 'has_options' set to 1 in your csv file for the products that have options.

    ReplyDelete
  67. What about multilingual stores? how to import custom options for non-default store view?

    ReplyDelete
  68. Amazing, it worked for me in my very first try.

    ReplyDelete
  69. Thanks for sharing your knowledge on magento your blog is very helpful to our magento developer.

    ReplyDelete
  70. HI there,

    im having problems, when i click an option the price main doenst change.

    if i chose A2 + £45

    the main price should change to £60

    any help that would be great
    cheers
    josh

    ReplyDelete
  71. I had an issue updating our product catalogue with new prices - Magento accepted the new prices (CSV containing SKU and Price), but also cleared all custom options.

    To resolve this, I restored the database backup I took before updating the prices, renamed app/code/local/Mage/Catalog/Model/Convert/Adapter/Product.php to app/code/local/Mage/Catalog/Model/Convert/Adapter/_Product.php so it would use the original import script, then did the import again and it worked.

    Is there a bug in this code that could be removed, in case anyone else experiences the same issue?

    Oh, thanks for the script by the way, saved a lot of time when I first imported all the products!

    ReplyDelete
  72. I have 2 custom options, they are uploading geat but 1t duplicates them, so i always have 2 of each, but if i upload a third or forth time it stays at just 2 duplicates. so i think the code you added to delete current option before upload works but not just right, any ideas?

    Thanks

    ReplyDelete
  73. any luck with 1.4.0.1? it seems incompatible...

    ReplyDelete
  74. Hi, i cant seem to get this to work.
    Im using 1.3.2.4 and when i upload the whole Buy box is missing. I have checked and there is a has_options = 1 in my CSV and also it written i DB.

    Any help is more than welcome

    Thanks

    ReplyDelete
  75. THANK YOU FOR THIS PAGE!!!

    I can't get the file upload option to work. I tried "Upload Artwork:file:0:9" in the column header and "Upload Artwork" in the row. I also tried "1" in the row. Any thoughts?

    ReplyDelete
  76. Hi, Can you modify this Great code for V1.4.1 ?
    I tried for V 1.4.1. It doesn't seem to work.

    ReplyDelete
  77. It works in 1.4.1, but as I said above, I didn't get the input type "file" to work. There are a couple of things left out above, but nothing that keeps it from working. Like, it's not obvious (to me) exactly how to enter the data in the csv for sort order to work. Through just trying stuff, I figured out that for sort order of the different custom options, in the csv header, type name:input-type:required:sort-order. e.g. Color:drop_down:1:6 (which is required and the 6th custom option down). While almost the same is true for the product row. name:price-type:price:sku-modifier:sort-order. e.g. Blue:fixed:2:_blue:2 which means blue is 2 dollars extra, adds _blue to the end of the products sku and is the 2nd option within the custom options for Color.

    ReplyDelete
  78. Oh, use a pipe to separate different options. e.g. White:::_white:1|Blue:fixed:2:_blue:2|Red:fixed:3_red:3 means white doesn't cost extra (neither fixed nor a price is needed but the colon separators are needed if you want sku modifiers and/or sort orders). If you just type White|Blue|Red, then they will not cost extra, they will not modify the sku and they will sort alphabetically.

    ReplyDelete
  79. thx for ur post.
    I have another problem here.
    Before importing the csv file, we have to map the fields in admin to their respective fields so that the data will go in correct columns.
    So, in the case of custom options, to which field we will need to map the newly created custom option column?

    ReplyDelete
  80. Has anyone been able to get this to work with Magento 1.4.0.1?

    ReplyDelete
  81. Thank you so much!
    It works fine in 1.4.1 too.

    ReplyDelete
  82. Nice... Importing custom options is great but how could we combine tier pricing along with categories?. I've seen quite a few attempt it within the forms. This would create the most AWESOME import available!...

    ReplyDelete
  83. I love the work you have done here. Thank you SO MUCH.

    ReplyDelete
  84. Hi, This is exactly what I need, I tested it on my test site and it worked fine, but I have now put the code into the live site and it is not working. The import works without any errors, I have got the 'has_options' set to 1, but there is no custom options on the admin side or front end side.

    Any Ideas. If you want to have a look at my product.php file go to:

    http://rapidshare.com/files/358974614/Product.php

    Thanks

    ReplyDelete
  85. I still can't get the "file" option to work. Everything else worked as expected. I really need file uploads as a custom option. Please help if you can. Feel free to pm me at magento's site to gw468 if you need to.

    http://rapidshare.com/files/359598420/Product.php.html

    ReplyDelete
  86. Hi,

    When i add the fields for 2 drop down options in csv file lets for example

    Size:drop_down:1 Type:drop_down:1 Small|Large Extra|Good

    Then it only adds last option that is "Type" size custom options is not adding in the database.
    Please help me what is wrong

    Thnks

    ReplyDelete
  87. Hi Brian,

    Thank you very much for your code.
    I was wondering if you could consider writing a small extension to enable products eraseby importing a line in the CSV
    example : Put a SKU and write "DELETE" in a specific field would mean that you want this product to be erased.

    It would be necessary to look for the product options and attribute so as to delete them properly.

    I'm not familiar enough with Magento to do so but I'd be glad to donate for your time.

    Thank you in advance.

    Sorcy

    ReplyDelete
  88. I've tried everything I can, but cannot get this to work. I can tell Magento that I have options, but it doesn't import them, add them into the database or show in the BE.

    I've downloaded the files above, added the comments manually, added the code into the Mage folder and the local one but nothing seems to work.

    I'm using 1.3.2.4

    Any help gratefully received.

    Cheers
    G

    ReplyDelete
  89. I really impressed this post. you are getting more comments about this post. keep it up. magento ecommerce is really one of the best shopping cart.Magento eCommerce

    ReplyDelete
  90. Thanks VERY much. Saved me hours. You rock.

    ReplyDelete
  91. Thank you so much. You are amazingly awesome. I was always searching for such a simple solution. I've implemented it on my site and it's working on National Furniture Supply

    ReplyDelete
  92. Thanks Brian for the post, and everyone for the helpful comments. Here's a couple of things I discovered implementing this on Magento 1.4.

    1. Missing custom options/buy box/add to cart button on the product page after import.

    Not having the 'options_container' column populated (try "Product Info Column" or "Block after Info Column") could cause the entire 'buy box' to disappear from the product page after import.

    2. The 'required_options' column in the 'catalog_product_entity' table does not get set when one of the custom options is a required option.

    I found a very minor impact when you don't have this column set: adding a product directly to the cart from the product list generates a red error message instead of a green "notice" message. I don't know what else could be impacted by not having this column set so I fixed it anyway.

    Here are the few lines I added to Brian's code:


    SNIPPET #1:

    $hasRequiredOptions = false;

    WHERE:

    Just after the custom_options declaration,

    $custom_options = array();
    // PUT SNIPPET #1 HERE



    SNIPPET #2:

    if (!$hasRequiredOptions && $is_required == '1') {
    $hasRequiredOptions = true;
    }


    WHERE:


    Right after the following,

    /* CUSTOM OPTION CODE */
    if(strpos($field,':')!==FALSE && strlen($value)) {
    $values=explode('|',$value);
    if(count($values)>0) {
    @list($title,$type,$is_required,$sort_order) = explode(':',$field);
    $title = ucfirst(str_replace('_',' ',$title));
    $custom_options[] = array(
    'is_delete'=>0,
    'title'=>$title,
    'previous_group'=>'',
    'previous_type'=>'',
    'type'=>$type,
    'is_require'=>$is_required,
    'sort_order'=>$sort_order,
    'values'=>array()
    );
    // PUT SNIPPET #2 HERE


    SNIPPET #3:

    $product->setRequiredOptions($hasRequiredOptions);

    WHERE:

    Just before saving the product,

    // PUT SNIPPET #3 HERE
    $product->save();

    ReplyDelete
  93. Hi Brian

    This is fantastic. I can't believe it's not in the core Magento product yet.

    Can I ask - did you get anywhere with the export function? I'm going to be giving this to shop data administrators ... and to ask them to maintain a spreadsheet as well as export/import is probably beyond them - and too risky.

    Would be great if I could export with one click, and import with one click, with no spreadsheet step :-)

    Thanks in advance :-)

    Mark

    ReplyDelete
  94. My problem appears to be similar to what a few people have encountered. The import works great but requires you to go into admin, edit each item and add a custom option then clicking save. only now does the imported options show.

    also when not following the process ive mentioned, customers cannot purchase the products what should have custom options, when they add to basket it says something along the lines of 'custom options required' but these options aren't visible to the user!

    Does anyone solved this problem?

    Thanks Peter

    ReplyDelete
  95. Peter, I had the same problem. Are you including the 'has_options' field with a value of "1" for the records that have a custom option?

    ReplyDelete
  96. Just implementing Magento myself. Very important subject. This and simply having Categories be defined in a starting upload. The problem w/ Magento is there are 1000 addons to this and that but then you get a mash up instead of a working system.

    Glad to see you doing this work. Hopefully Magento (or someone here) will get this integrated in future versions of the software.

    I will explore implementation next.

    ReplyDelete
  97. Gareth - just got this to work with 1.4.1.0

    noticed that in this version there is one difference in the for loop.

    default has this:
    foreach ($this->_requiredFields as $field) {

    what is shown in the example is this:
    foreach ($importData as $field => $value) {

    this may have been an update in the new version. works like a charm.

    ReplyDelete
  98. I always be aware about the last product launched to the market. I really love to know about new thing, how ever i looking for the quality, for me is very important. In the same line, the service costumer is important too, because i like the efficient in the company. Thats happen when i buy viagra, i never have to wait long time.

    ReplyDelete
  99. This blog is abosolutely wondeful, i like the new ideas introduced here, it catched my attention since the first time that i saw it. i must to say i usually like the good products specially the ones whic can give a lot of benefits. That is why i am proving
    costa rica investment opportunities

    ReplyDelete
  100. thanks buddy.i searched entire google but your blog is best.thanks and keep it up dear.this code is working fine

    ReplyDelete
  101. Thanks for this! Works perfect, very nice.
    Some people (including me) were looking for a possibility to define the file-option. So I wanted to share my solution - it's quite simple.

    Insert this block:

    if(count($parts) > 5) {
    $filetypes = $parts[5];
    } else {
    $filetypes = "";
    }

    after this part:

    if(count($parts)>4) {
    $sort_order = $parts[4];
    } else {
    $sort_order = 0;
    }

    Then, in the TODO-Section:
    switch($type) {
    case 'file':
    /* TODO */
    $custom_options[count($custom_options) - 1]['file_extension'] = $filetypes;
    // no break!

    Worked for me - just add the filetypes as the fifth part like this:
    :fixed:35.00:some_sku:1:tif,jpg,pdf

    I don't need the image-size, as I'm not dealing with images, but it would be easy to add that as well.
    Just add two more parts, image-size-x and image-size-y and parse them like the filetypes-part. The corresponding fields in the database are called image_size_x and image_size_y.

    ReplyDelete
  102. To everyone that had the problem for re-save the product in order to see the custom options in the fornt page, just do the followings:
    in your CSV file under options_container
    write down : Block after Info Column
    This solve the problem for me
    Hope that it help averyone (my version 1.4.1.1)
    By the way, it's about time to add this to the core of Magento!

    ReplyDelete
  103. Hi Brian,

    very interesting post, i'm also on Magento product import, if you can take a look a this :
    http://www.magentocommerce.com/boards/viewthread/201210

    i was just asked to add support of your custom options syntax.

    ReplyDelete
  104. Just wanted to say, this post is gold. Just finished importing a bunch of items with over 400 options (value:price:sku:sort) each. no problem at all 1.4.1.0. We'll see how well it handles the next set with 1,700 options each. Imagine having to create the options manually... Thanks Brian

    ReplyDelete
  105. Hello,

    i have tried several things, but I could not get a good import. Nothing shows up in the frontend and nothing in the backend.

    I have version 1.4.1.0. Can that be the problem. And how up-to-date is the above code?

    Thanks in advance.

    ReplyDelete
  106. Just used this successfully on 1.4.1.?. I'd love to be able to export too, but it's super helpful already.

    ReplyDelete
  107. Hello,
    this good idea has been integrated in the extension Import_Products_categories__multiple_images_and_custom_options
    and also in the magmi project as plugin.
    But, as some people here, I don't understand how to customize a custom option for each store views.
    In fact, more generally, I see nothing in the syntax to be able to change texts of a custom option for different store views corresponding to different langages. Is there no other solution than doing it manually ?

    ReplyDelete
  108. Hi Brian,

    Can you please help me where I make wrong in adding the following data as custom options

    psize:drop_down:1:1
    Virgin of the Rocks (16x20):fixed:149:-SM|Virgin of the Rocks (20x24):fixed:171:-MED|Virgin of the Rocks (24x36:fixed:218:-LG|Virgin of the Rocks (36x48):fixed:299:-XL

    ReplyDelete
  109. Hi,

    I have read so much about the has_options in this blog and I know, that I have to set the has options to 1. Otherwise, like it is in my case and many other cases in this blog, i only can see my imported custom options, when i first activate the custom option direcly in the product. And here is my question:
    WHERE AND HOW CAN I SET THE CUSTOM OPTIONS TO 1?

    Thank you; Tobi from Germany (i have the German Language Version of Magento 1.4.1.1

    ReplyDelete
  110. Oh YES! now I found it myself after 3 days of searching...

    so here it is:

    if you do an csv import there must me the colum has_options also in this csv file!!!

    example:

    "sku","name","description","price","Size:drop_down:1","has_options"
    "T-Shirt1","T-Shirt","A T-Shirt","5.00","Small|Medium|Large","1"

    in former times, i didn't need the colum "has_options" for csv imports, so i cancelled this colum. But when you start with importing custum options, you also need the colum "has_options" in your csv import.

    Hope, to help others with this

    Tobi

    ReplyDelete
  111. Internet Marketing Company
    http://www.sunbizar-technologies.com
    A Leading Internet Marketing Company providing SEO Services over the globe with Affordable price, Sunbizar Technologies have 6 years experience in search engine optimization industry, web development, software development, and online marketing. Search engine optimization increase web traffic on your website,

    ReplyDelete
  112. Hi guys,

    Thank you Brian for this work.

    Here the missing /*TODO*/ code :



    case 'file':
    $custom_options[count($custom_options) - 1]['sku'] = $your_custom_sku;
    $custom_options[count($custom_options) - 1]['file_extension'] = $your_custom_file_extension;
    $custom_options[count($custom_options) - 1]['image_size_x'] = $your_custom_X_size;
    $custom_options[count($custom_options) - 1]['image_size_y'] = $your_custom_Y_size;
    $custom_options[count($custom_options) - 1]['price'] = $your_custom_price;
    $custom_options[count($custom_options) - 1]['price_type'] = $your_custom_price_type;
    break;

    Don't forget to replace "your_custom_something" by your own code.

    ReplyDelete
  113. AMAZING, it took me days of searching to find your solution but 10 mins to implement it and your code saved me weeks of time. I cant thank you enough for your efforts.

    ReplyDelete
  114. I am having a problem with duplicate entries for the custom options on subsequent uploads of the product list...

    I have the code in there which is supposed to get rid of old data, but apparently it's not working.

    Any thoughts?

    ReplyDelete
  115. Forgot to mention I'm on 1.4.2...

    ReplyDelete
  116. thank you, thank you, thank you! I also searched for days for this solution - i can't tell you how grateful i am to you for posting it, it worked perfectly!

    ReplyDelete
  117. Thanks a ton mate... You saved my time..

    ReplyDelete
  118. Hi Is there any method by which i can delete/update custom option in mass.. Because I found couple of attribute got duplicated. which is a big issue for me as of now. Please help.

    ReplyDelete
  119. I realize that 1.5 now supports Custom Options however the way they have set up the input in the CSV is far more complicated than your method. They require a separate column and row for each of the option titles. Your way is what I have been using for the past year and prefer it. Is there any chance you will modify your code to work with 1.5? Me developer tried copying over your existing code into 1.5 and came up with the following:
    (I copied the code into the proper place in the latest version. However there is a new problem. The latest version of Magento is checking your file for errors before allowing it to be imported. Strictly speaking this is a good thing. It however is a bad thing in regards to our custom options dealio.)

    ReplyDelete
  120. thank you.worked perfect.from your blog inspritation i also started myblog http://magentoforum.blogspot.com hope you suggest me to improve the content of blog

    ReplyDelete
  121. Hi Brian,
    great work. is there any possibility for Magento 1.5? its displaying
    Column names: Warranty:radio:0:2", "Second Option:radio:0:1", "Color_Number:field:1" are invalid

    for above example. thanks

    ReplyDelete
  122. PLEASE: Ver 1.5.0.1

    and... will any kind soul be willing to contact me by phone and walk me through this hack? Thanks!

    nicedayvince@gmail.com

    ReplyDelete
  123. Hi Brian,

    Please take a look at posted link (http://www.magentocommerce.com/boards/viewthread/225014/) and let me know if you have a solution. Seems like you know how to handle these configurations on products.

    ReplyDelete
  124. Thank you so much for this easy to use walk though! I had no troubles inserting it in to my website at all

    ReplyDelete
  125. Its really so nice of you for sharing this.I was facing lot of coding problems.This is one of them.Now its solved.I got better idea due to this.Thanks again.

    Magento Themes

    ReplyDelete
  126. Hey, thanks for this script, custom options are imported, but not shown in frontend.. I have to save the product. I have set has_option to 1, but this doesnt solve the problem. Please advice.

    ReplyDelete
  127. for magento beginnners this forum is useful see this magentoforum.blogspot.com

    ReplyDelete
  128. It looks very informative.So i get some aided information.I bookmarked your site for further updates.web design oman

    ReplyDelete
  129. It was such a help. My friend's e-commerce website is also run by magento and he had been searching for this option for quite a while now. Thanks for the share.

    Alice
    Liposuction Chicago

    ReplyDelete
  130. This comment has been removed by the author.

    ReplyDelete
  131. This really helps.I guess all you have to do is to specify a value for the option to be created, to create an input option with default values use: ":" as the vale you just have to put something in the row so it's not ignored.


    Miamii Buick Dealer

    ReplyDelete
  132. Hundreds of ecommerce systems exist, but very few can match the power of Magento. Just like reading to instructions online but nothing beats to the one you provided which is detailed and accurate. And like looking for a good e-commerce site is like looking for
    Double Roller Blinds that fits your needs and lifestyle.

    ReplyDelete
  133. Great Boss! Your code and way of explining things need salutation.............It helped me a lot and worked at first trial.
    Thanks a lot

    ReplyDelete
  134. Nice post. This post is different from what I read on most blog. And it have so many valuable things to learn.Thank you for your sharing!
    Website Design Company 

    ReplyDelete
  135. tried to import on magento 1.5.1.0 it imported as normal, and the custom options did not show.

    ReplyDelete
  136. Hey Brian,

    Thanks for such a useful post, it helps but i got stuck while importing configurable products with custom attributes and if you can provide any dummy csv file that import configurable products, that will be really a great help. Please help me!!

    Thanks in advance !!

    ReplyDelete
  137. Sorry , but i'm having trouble with this, I think I have put the code in correctly, but when i go to import the csv it still doesn't recognise the Size:drop_down:1 field. Can I send someone my products.php file to check for me? I would be very grateful.

    Thanks in advance!

    ReplyDelete
  138. HI
    I also cannot get this to work. then I found this thread, but I have absolutely no idea what to enter in the TODO section (I only want to import "size" custom options, such as "35", "44", etc...)

    Someone please help.

    Thanks

    case 'file':
    $custom_options[count($custom_options) - 1]['sku'] = $your_custom_sku;
    $custom_options[count($custom_options) - 1]['file_extension'] = $your_custom_file_extension;
    $custom_options[count($custom_options) - 1]['image_size_x'] = $your_custom_X_size;
    $custom_options[count($custom_options) - 1]['image_size_y'] = $your_custom_Y_size;
    $custom_options[count($custom_options) - 1]['price'] = $your_custom_price;
    $custom_options[count($custom_options) - 1]['price_type'] = $your_custom_price_type;
    break;

    Don't forget to replace "your_custom_something" by your own code.

    ReplyDelete
  139. Hi,

    didn't work for me as well, however I'm not such computer guy. Found another way to import products along with options, categories and other things like that - it is a software program, something like "magento store manager" or so (don't remember exactly) - as for me it was working perfectly when I tried it. There's one big disadvantage - it is not free and my trial period expired... Guess this might be useful for someone anyway

    Thanks

    ReplyDelete
  140. Magmi (http://sourceforge.net/apps/mediawiki/magmi/index.php?title=Main_Page) can import product with custom options using the custom options plugin based on the syntax described in this blog (with some enhancements).
    It can do this fast and it's free.

    ReplyDelete
  141. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. i've got this error when trying to run import profile script within another maegnto website:

      Fatal error: Call to undefined method Mage_Catalog_Model_Product_Attribute_Backend_Media::addImagesWithDifferentMediaAttributes() in /home/arredpit/public_html/app/code/local/Mage/Catalog/Model/Convert/Adapter/Product.php on line 810

      Delete
  142. This is working on Magento 1.5 too. Just you need to add a column in csv 'has_options' & set the value to '1' for the products which are having custom options.

    Thanks for post btw.

    ReplyDelete
  143. Thanks for taking the time to share your thoughts.Your post is truly informative for me and i am so grateful to you for sharing this informative post here.
    Ecommerce developer

    ReplyDelete
  144. murthy full info about what in specific? this article may be considered as pure enlightment on this matter of massive importing. Everything is so well explained. i've found that the author has made wven corrections to the original
    post so that everyone can attain to the perfection of this script, if we can call it that way. Post or write bout uour need. Help someone
    and you'll get help.

    ReplyDelete
  145. Great article magneto developer..really an interesting and useful information is provided with a nice ideas here.
    web designing company

    ReplyDelete
    Replies
    1. I have no words for this great post such a awe-some information I got gathered. Thanks to Author.
      php web development

      Delete
  146. Replies
    1. works great... just remember to upload csv file with the "has_options" column with "1" value....!

      Delete
    2. Hi, were you able to get this working with 1.6. Please email me kevin@kevinw.me

      Delete
    3. hi
      would you be able to help me i followed the instructions to the letter and also made sure has_options colomn has 1 in it, but it isnt showing the options im using magento community 1.6.1. email me a getitonfancydress@hotmail.co.uk

      Delete
    4. Dont worry i have managed works beautifully, forgot to put spaces between the separator and the next option.

      Delete
  147. Is there anyone can tell me where I can find the files I exported? yoursite.com/public_html/var/export, this seems do not work...
    Thanks,
    Website design Services

    ReplyDelete
  148. Magento 1.6.2

    I get error on import.
    Column names: "Boxed Chocolates:drop_down:0", "Bouquet_Size:radio:1", "Mylar_Balloons:drop_down:0", "Stuffed_Animal:drop_down:0" are invalid

    ReplyDelete
    Replies
    1. I got the same error, I'm runing Magento 1.7, does anyone know the fix for this?

      Delete
  149. Hello,

    A very Very Very good tutorial Post by you.

    I was searching this from last week.
    But really this found me today and I am feeling too glad n enjoying this code.

    Still i facing one little problem..would you like to help me?
    I have set custom options "STICHING" with 5 option "CHECKBOX".

    Blouse stitching:fixed:300|Blouse stitching and fall beding:fixed:25|Patticoat:fixed:1000|Fancy blouse stitching:fixed:300|Pre-stitched saree:fixed:400

    it set only main title "STITCHING OPTIONS" and next nothing do anything..

    please help little bit...hope..

    thanks
    Praful

    ReplyDelete
  150. Great work! i tested it, worked nicely for me.

    ReplyDelete
  151. Magento is emerging as one of the most efficient E-commerce source not only because of its front-end features but also because of its free nature.
    Magento Programmers India

    ReplyDelete
  152. it works fine. It has its consequences though.
    It happened to me that i started working for http://www.arredo-shop.it.
    - The used to input every single product and customize options manually as magento wants. They had about 2300 products.
    - I made the configuration to the file and started importing greatly some 1500 new products.
    - Then they asked me change prices of all products using the same "batch" strategy (formerly they used to change them prices manually, and that is one by one...argghh)

    So they prepared the new prices using my 2 columns "comma separated" open office file and was just ready to import them. (one column for the "sku" and one for the "price")

    WHAT HAPPENED?
    All "new" products (imported by me with my script) where flawlessly updated.
    ...All 2300 "old products" (the ones they customized manually so patiently..)

    simply L O S T THEIR CUSTOM OPTIONS!

    so just b e aware.... awful issue. Learn from this story to avoid losing your job.. help others understand..

    ReplyDelete
  153. Excellent information and nice to see you, Thanks



    Magento Development

    ReplyDelete
  154. Works perfect on Magento ver. 1.7.0.2. Thanks!

    ReplyDelete
    Replies
    1. Hi, How you make it works in ver 1.7.0.2?
      I get this error:

      "Column names: "Packaging:drop_down:1" are invalid"

      Magento cannot detected the column

      Delete
  155. Hi All,

    I need to change order the configurable product dropdown in front end. There is a option in admin panel but client requires that order is default or we have to give the option in csv import file. I tried lot but not yet get done. So I planned to update the position field directly in "catalog_product_super_attribute" table when importing product. Anyone can you tell where is insert query..?

    Advance Thanks!!!

    ReplyDelete
  156. i just want to thank u for ure work, really helpful

    ReplyDelete
  157. Hello,

    For Add Product Options Value Using Magento API and Excel Sheet great help at folllowing url :

    http://www.webslike.com/Thread-How-To-Add-Product-Options-Value-Using-Magento-API-and-Excel-Sheet

    ReplyDelete
  158. Hi,
    I'm having a problem with Magento 1.7.0.2:
    I can't get it working.
    I had to create new folders for the local PHP file and I changed the file like you wrote.
    Now, when importing the products, there's only one product that gets the curstom values. All the others don't. Please help me!

    Greetz

    ReplyDelete
    Replies
    1. I got it working!
      The Has_options field was zero...
      But now, with some products, I'm getting the same option three times...

      Delete
    2. Deleted and added all products again,... It seems to work now :)

      Delete
  159. E-commerce now a days is really helpful in expanding business.And your blog has also provided very good information,it's useful to every one.
    Web development Bangalore

    ReplyDelete
  160. thanks for nice tutorial for me its a different thought


    I want to set the first value in a dropdown is default value in product page.

    ReplyDelete
  161. web development company in oman

    Thanks for sharing these wonderful designs, its helpful to all.

    ReplyDelete
  162. Magento developer should keep the daily update in website development and make a great ideas to build a unique style the website.That is the good responsibility for being expert in magento development field.
    Magento Development bangalore

    ReplyDelete
  163. Column names: "Tyre Size:drop_down:1" are invalid

    how to fix?

    ReplyDelete
  164. Hi Brain

    I have a color-swatches-for-custom-options extension with me. I can upload the custom option details with MAGMI (Color:drop_down...etc), but I don't know how to upload the custom option images with MAGMI. if you know way to do it. Please let me know. this one is TOP URGENT!!!!

    ReplyDelete
  165. Tremendous things here. I am very satisfied to peer your article. Thank you so much and I'm looking ahead to contact you. Will you kindly drop me a mail?
    Magento Developers

    ReplyDelete
  166. E-commerce now a days is really helpful in expanding business.And your blog has also provided very good information,it's useful to every one.
    Responsive web design company | Responsive web design services

    ReplyDelete
  167. I just want to know weather it supports with Magneto CE 1.7 as i tried and it's not working.

    ReplyDelete
  168. Magento Integration is explained very discreetly and effectively . thanks

    ReplyDelete