How to import products to Marketpress

Hi,

I just installed Marketpress and now I need to import a list of products from an old ZenCart site. Can you point me to any instructions on how to import a list of products? I hope to import the product list and any links to product photos and categories as automatically as possible.

I will want to have a couple of different ways to search products by manufacturer and by other product features. Is that best acheived by categories or tags or both?

Thanks Martin

  • DavidM
    • DEV MAN’s Mascot

    Hi Martin and welcome to WPMU DEV!

    There’s not an import option available as yet, but it’s in the plans. That said, it may require a bit of tweaking, but you should be able to use the CSV Importer to import via a csv list.

    http://wordpress.org/extend/plugins/csv-importer/

    Alternatively, TurboCSV is a premium pluing that can import any custom post type, not just MarketPress products, so it can work for importing pretty much anything into WordPress.

    http://wpplugins.com/plugin/145/turbocsv-2/

    And fortunately, an awesome member from the site here provided a file for use with TurboCSV and MarketPress in the following thread.

    https://premium.wpmudev.org/forums/topic/bulk-import-for-marketpress#post-68026

    Hope that helps!

    -David

  • Tony
    • Design Lord, Child of Thor

    I’ve successfully imported data by uploading to wp-ecommerce and then using marketpress to import from wp-ecommerce. It’s a pain, but do-able.

    Unfortunately, it doesn’t import the images. Just a few basic fields, or did I miss something?

    Isn’t it possible to just upload data through MyPHPAdmin?

    Can the “featured” images be uploaded via ftp, and then just assigned? Almost all of our images are basically SKUnumber.jpg

    I guess I’m looking for an easier method to create and upload hundreds, and potentially thousands of products than doing them one at a time.

    Someone else mentioned TurboCSV, but then said he had to manually add the images, which is a deal killer for me.

    Any ideas?

  • cry1978
    • The Incredible Code Injector

    My blog tells you how to do it, I have moved whole wordpress to new host and new domain, or do it to the same domain but new sub directory.

    this will import all though but it should not hurt anything, but an easy way to product everything is to do a database backup and download it to pc, then zip up your whole entire wordpress root folder just to cpanel is fine and simple.

    Then do my tutorials I found online it works, you will have all store mods, images, descriptions, posts, pages, everything.

    Just remember to backup your database in database backups in cpanel, zip up whole root of wordpress folder to cpanel, downloading is not required, it will still be in there in cpanel, but you can download it if you want.

    An easy way to save an entire wordpress to a new directory is the copy and paste in file manager, copy the wordpress over to new sub dir or new addon domain directory of a sub directory of where your wordpress is, just copy the wp-content folder over, that should set everything you need for another copy of your wordpress, then do the import and export method. Your good to go!

    Now about the copying over to this new store mod I have no idea, but all do what they said and give you a report back…

    here is the tutorial on how to save a wordpress to a new wordpress, it will save the entire wp store too over like I said, I did this 5 times already.

    http://crystalspalace1.blogspot.com/?zx=dc37cdf4edddd10e

  • cry1978
    • The Incredible Code Injector

    Ok it all works out!!!!

    after I did the above, I went to the new store products page and clicked import and look at this!!!

    This will allow you to import your products and most of their attributes from the WP e-Commerce plugin.

    It appears that you have 25 products from WP e-Commerce. Click below to begin your import!

    now checkout my new store now, wow lol, I did this in 10 mins, it works

    http://chatterfriends.com/world/

    my official website to see my websites and contact me is at

    http://crystalspalace.yolasite.com/

    I study a lot in web design and how everything works, I have video tutorials just about on every niche product, website, training courses that I provide. You can find my twitter, facebook, and major websites that I have designed or run here.

    I hope this tutorial works out for you too, GOD BLESS!!!

  • DavidM
    • DEV MAN’s Mascot

    Hi guys,

    The instructions for importing from MarketPress are located at the bottom of the installation page:

    https://premium.wpmudev.org/project/e-commerce/installation/

    @tony, good point regarding the featured images. It’s been a little while since I looked into that one and will have to take a good look back at that once I get a free moment. I’ve not sought support for TurboCSV (haven’t dug into it in a little while) but I do hear the developer’s very helpful. Perhaps he might be able to help with that.

    @jccoldwell, sorry I missed your post here but the installation page I linked to above should sort that one for ya.

    Cheers,

    David

  • Tony
    • Design Lord, Child of Thor

    @david

    I went ahead with CSVpig and I’m loving it so far with Marketpress. It took me a little bit of testing to figure everything out, but I can tell already that I have a lot more freedom with importing data and product taxonomies than I would with a typical wordpress plugin shopping cart.

    I chose CSVpig because of the one-time bundle license that lets me use it on as many sites as I want. They have an annual fee license, but I’d rather pony-up and buy the bundle with no annual fees to worry about.

    The downside is the lack of support for featured images, though CSVpig mentioned that they might include that in a future release.

    In the meantime, I’ve simply imported the image, and then using css I have visibility set to hidden and the height and width set to 1 at the end of the post.

    After import, I run a plugin called “Auto Post Thumbnail” by Aditya Mooley.

    It takes a few minutes, but it creates a featured image from the first image within all post/pages/products that do not already have a featured image set

    Essentially, I can load 1000 products, run the auto post thumbnail, and then come back later and all my post now have featured images.

    It’s a pain, and a non-programmer hack, but it works!

  • Tony
    • Design Lord, Child of Thor

    Yes it was brilliant if I do say so myself.

    The only hiccup was that the data uploaded, but it didn’t really take until we went and hit “update” on each and every product (over 400 so far)

    Until then, the SKU wasn’t showing up in product page view, so we knew something was wrong.

    Thankfully I had someone that had nothing better to do than to go hit update on 400 products.

    :slight_smile:

  • RichardHK
    • Flash Drive

    Any news on when the “Import from CSV” importer will appear in our Settings panel?

    Does the temporary ‘Coming soon…” message mean very soon?? Sitting on 300+ products to import.

    Thanks for any timing info. (Aaron?)

    PS. I re-opened message as not really resolved until native importer available. Right? Shoot me if not.

  • DavidM
    • DEV MAN’s Mascot

    Hi RichardHK,

    While we don’t give ETA’s as a general rule, I’ll ping Aaron to see how this one’s coming along.

    This thread actually should have been moved to our feedback and feature suggestion forum earlier so I’ll get that moved. We don’t have an open status in this forum but this section is very well monitored for input and feedback.

    Thanks,

    David

  • Hiltos
    • WPMU DEV Initiate

    Hi,

    I’m in the middle of creating a site with Multisite and Marketpress with Buddypress. Any more news on the CSV importer? I don’t mean to be a bother, but my customers are about beating down my door asking for it.

    Thank you for any news you have. :slight_smile:

  • DavidM
    • DEV MAN’s Mascot

    Hiya Hiltos and first off, welcome to WPMU DEV!

    The importer hasn’t been included as yet and while we can’t give an ETA still, it is in the plans. If you need something right away, you could try one of the plugins mentioned above. You might also consider enlisting the aid of a developer to get that done.

    The API is already in place, which makes it easier and therefore quicker for a developer to do so, plus the existing WP-eCommerce importer could serve as an example to work from.

    -David

  • tousti
    • WPMU DEV Initiate

    Tony’s method for creating post thumbnails is great. I only add hotlink to the image on the post content (and use CSS to set it to display:none) so there’s no need to upload anything. Although, I have one problem conserning the import:

    I’m using the Worpress CSV Importer plugin and I’m able to import everything that’s needed except product category (I don’t import product tags). I’ve tried both product_category and csv_ctax_product_category but the products always end up “Uncatagorized”. What I’ve read above it should work, but I haven’t been able to figure out the cause for this problem. Any ideas?

  • Jahsun
    • New Recruit

    OK happy new year to all and may it be a blessing to us.

    Just wanna say, i too was looking for this option to import products into marketpress via csv. after reading this forum I decided to try chesterbailey combined with Tony’s method. i could not afford CSVPig at the moment so i purchased TurboCSV and download the “Auto Post Thumbnail” by Aditya Mooley.

    I will post the results when i am done activating and testing.

    +1 for marketpress csv importer

  • Jahsun
    • New Recruit

    So far everything work fine with TurboCSV except for the same issues Tony had, lack of support for featured images and SKU issues as well. I would like to know if you (Tony) can share your method with me in details? i am still a novice trying to understand css. Currently I’m on a low budget but I am willing to pay someone if i can afford it.

    I tried posting a job on the developers section but the price they are asking for is ridiculous, i might as well purchase a premium shopping cart “TWICE” and still have change left over (not to say i have that kind of money), but since i am a dedicated WordPress and WPMU Dev fan i will continue to support these projects as best as i can.

  • BlueNet
    • WPMU DEV Initiate

    It’s official! Version 1.0 of MarketPress Product Importer has been released. If you currently use the WPMU DEV plugin, MarketPress, and have been looking for a quick and easy way to import products to your online store, or product listing site, this is for you.

    I manage several affiliate product listing sites, and couldn’t keep up with the ever changing “product data feeds” for each site. Since I really wanted to use MarketPress, I decided to develop a product importer specifically for MarketPress.

    I’m looking forward to sharing it with anyone that can use it, and of course, the WPMU Dev team. Like most initial releases, there are many items not yet integrated, so test it out and provide feedback.

    The MarketPress Product Importer currently supports (basic product data, featured images, categories, tags, skus, price, sale price, and external product links).

    Official WordPress Plugin Download

    http://wordpress.org/extend/plugins/marketpress-product-importer/

    Development Website Link

    http://bluenetpublishing.com/plugins/marketpress-product-importer/

    CSVisual (CSV uploader with Visual field Mapping)

    http://bluenetpublishing.com/wp-content/uploads/2012/01/csvisual.zip

    NOTE: I tested this on Bird-Feeders.com, and successfully imported 896 products. There's still more to do on that site, but now my "Commission Junction" data feeds are a breeze.

    Thanks

  • BlueNet
    • WPMU DEV Initiate

    Hi Johnny,

    Yes. When the importer is run, the uploaded product data is converted to market press CPT product posts. Here’s a brief explanation of the process.

    When this plugin was activated, a new database table is created for storing the product data temporarily. In order to run the importer, that table needs to be populated with the users product information. I’m planning to integrate the CSV import directly into the plugin, but for now, I’m using CSVisual, an edited version of Quick CSV import with Visual Mapping by Alexander Skakunov.

    Once the product data has been added to the (_mpimporter) table, the plugin will recognize it, and show the “number of products” available, as well as, an “Import Now” button.

    Simply click the “Import Now” button, and the plugin will import your new products. NOTE: Data in the (_mpimporter) was not deleted, so running the import again will just create copies of the products in MarketPress. I’m working on an update to handle this, so users will have the ability to update existing MarketPress products, without having a duplicate record created.

  • BlueNet
    • WPMU DEV Initiate

    For all the “dev” types interested in the guts of the plugin, listed below is my process() function. It’s where all the magic happens.

    <?php
    function process() {
    global $wpdb;

    set_time_limit(0); //this can take a while
    $this->results = 0;

    $delay = 2;

    $mpimporter_table = $wpdb->prefix . 'mpimporter';
    $products = $wpdb->get_results("SELECT * FROM " . $mpimporter_table, ARRAY_A);

    foreach ($products as $product) {
    //import product
    $old_id = $product['ID'];
    unset($product['ID']); //clear id so it inserts as a new product
    $product['post_type'] = 'product';
    $product['comment_status'] = 'closed';
    $product['comment_count'] = 0;

    // insert product tags
    $product['tax_input']['product_tag'] = $product['prod_tags'];

    //create the post
    $new_id = wp_insert_post($product);

    // insert product categories
    $product_cats = array_map('trim',explode(",",$product['prod_category']));
    wp_set_object_terms($new_id, $product_cats, 'product_category');

    //price function
    $func_curr = '$price = round($price, 2);return ($price) ? $price : 0;';

    //sku function
    $func_sku = 'return preg_replace("/[^a-zA-Z0-9_-]/", "", $value);';

    update_post_meta($new_id, 'mp_var_name', array($product['prod_var_name']));
    update_post_meta($new_id, 'mp_sku', array_map(create_function('$value', $func_sku), array($product['prod_sku'])));
    update_post_meta($new_id, 'mp_price', array_map(create_function('$price', $func_curr), array($product['prod_price'])));

    //add sale price only if set and different than reg price
    if (isset($product['prod_sale_price']) && $product['prod_sale_price'] != $product['prod_price']) {
    update_post_meta($new_id, 'mp_is_sale', 1);
    update_post_meta($new_id, 'mp_sale_price', array_map(create_function('$price', $func_curr), array($product['prod_sale_price'])));
    }

    //add stock count

    //add external link
    if (!empty($product['prod_link'])) {
    update_post_meta($new_id, 'mp_product_link', esc_url_raw($product['prod_link']));
    }

    //add extra shipping

    // add image attachment
    if (isset($product['prod_image']) && (!empty($product['prod_image']))) {
    //$img = get_post_meta($post->ID, "Image URL", true);
    $img = $product['prod_image'];
    $ext = substr(strrchr($img,'.'),1);

    // WordPress Upload Directory to Copy to (must be CHMOD to 777)
    $uploads = wp_upload_dir();
    $copydir = $uploads['path']."/";

    // Code to Copy Image to WordPress Upload Directory (Server Must Support file_get_content/fopen/fputs)
    $data = file_get_contents($img);
    $filetitle = strtolower(str_replace(array(' ', '-', '.', '(', ')', '!', '@', '#', '$', '%', '^', '&', '*', '_', '=', '+'), "-", $product['post_title']));
    $file = fopen($copydir . $filetitle."-".$new_id.".".$ext, "w+");
    fputs($file, $data);
    fclose($file);

    // Insert Image to WordPress Media Libarby
    $filepath = $uploads['path']."/".$filetitle."-".$new_id.".".$ext;

    $wp_filetype = wp_check_filetype(basename($filepath), null);
    $attachment = array(
    'post_mime_type' => $wp_filetype['type'],
    'post_title' => $product['prod_sku'],
    'post_content' => '',
    'post_type' => 'attachment',
    'post_parent' => $new_id,
    'post_status' => 'inherit'
    );

    // Get Attachment ID for Post
    $attach_id = wp_insert_attachment($attachment, $filepath, $new_id);
    require_once(ABSPATH . 'wp-admin/includes/image.php');
    $attach_data = wp_generate_attachment_metadata($attach_id, $filepath);
    wp_update_attachment_metadata($attach_id, $attach_data);

    // Attached Image as Featured Thumbnail in Post
    update_post_meta($new_id, '_thumbnail_id', $attach_id);
    }

    ob_flush();
    flush();
    sleep($delay);

    // increment count
    $this->results++;
    }

    } // end process()
    ?>

    If this helps you, please send a few points my way.

    BlueNet

  • johnnymestizo
    • HummingBird

    So, the process of getting products from a affiliate network is this (correct me if I’m wrong):

    – create a login

    – get approved for merchants

    – get approved for their program

    – export all approved programs(products) as a CSV

    Then with your plugin:

    – Import all from CSV.

    Your plugin will auto pull from csv, create the titles, cats, etc,

    Is that correct?

    Some aff networks allow for auto export of CSV file to a specific folder on my server. Does your plugin auto import from a csv file on a timed occurrence?

    If, some affiliate programs expire or cut the program, will the products still be loaded?

    How many aff networks do you currently support CSV export for?

    How automated can I get the above processes?

    Cheers,

    Johnny

  • BlueNet
    • WPMU DEV Initiate

    Hi Johnny,

    At the moment, I have no plans to monetize any of the MarketPress Product Importer code. As far as I’m concerned, it’s free to anyone that finds it useful. My hope is that over the next couple weeks / months, I’ll be able to reach the 1,000+ membership points, by helping solve problems for WPMU members.

    BlueNet

  • BlueNet
    • WPMU DEV Initiate

    Hi Fondeli,

    Sorry to hear you’re having trouble. Can you give me more details, so I can help diagnose the issue?

    1. Where do you see the reference to 2408 products? Is it in the DB?

    2. How did you get the product data into the (_mpimporter) table?

    BlueNet

  • Ovidiu
    • Code Wrangler

    The importer solution is brilliant. it will tremendously help me setting up a new shop for a client but I have another related question:

    if a customer has a tool for managing his stock (for the real life warehouse) is there any chance to get that synchronized with marketpress?

    I guess you’d have to have an API and some custom coding done but I wouldn’t know where to start looking so has anyone done anything similar yet?

  • sequin
    • Site Builder, Child of Zeus

    Hi BlueNet,

    This seems like the perfect solution for me but I can’t get past the first hurdle… I realise it makes me sound very dim… but I’m not sure what I should be entering to define database settings in config.inc

    Thanks!

  • olidax
    • Flash Drive

    HELPFUL tips for trouble with Featured Images and CSVisual! Hoping this helps someone else too…

    The Importer Plugin works well but I was having trouble with understanding how to launch the CSVisual and then my Featured Images didn’t upload correctly… got mySQL errors. These 2 things solved my problems:

    A) Featured Images – Add this to your php.ini file: allow_url_fopen = On

    B) Using the CSVisual file:

    1. Download the csvisual folder to your hard drive

    2. Go to your Host, Ex. Bluehost, and navigate to your file manger.

    3. In file manager, create a folder on the same level as your WP and call it csvisual then upload the csvisual.zip file and open it.

    4. After the upload and the zip file is open, goto the config.ini file and right click to edit.

    5. Modify the database settings using the same settings as your wordpress. If your not sure go to your wordpress folder, WP, and view the config file there, then copy that information to the csviual config file.

    Ex. //database settings

    define(“DB_HOST” , ‘localhost’);

    define(“DB_LOGIN” , ‘Name_Clothshop’);

    define(“DB_PASSWORD”, ’234myclothshop’);

    define(“DB_NAME” , ‘Name_Clothshop”);

    save and test…….

    6. Goto to your browser and type the name of your url with the folder you created.

    Ex. http://www.myclothingstore.com/csvisul

    It should work then.

  • DavidM
    • DEV MAN’s Mascot

    Hi everyone,

    This thread’s a bit older now and MarketPress has since seen an integrated CSV importer, though I suspect BlueNet’s importer would work just as well still (thanks @bluenet, that really was awesome to share it)!

    Other CSV solutions may work as well, the more the merrier! :slight_smile:

    Cheers,

    David

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.