Posts

This is a tutorial walk through for Magento 1.7.0.2 Import/Export Dataflow Profiles. You will be able to use this tutorial to import and export a multiple of products and/or customers from you Magento Admin Panel. Its not as frightening as most would think. FYI, this will write over the products that are already created in your Magento store.

I do recommend that you back up your database and/or export your products already installed so you don’t rewrite any product information you wanted to keep.

Things you will need:

  1. Magento installed on your domain
  2. Create and ready CSV or XML to import
  3. Access to the admin panel

Step 1: Go to your admin panel and select the System in the menu. Then navigate to the Import/Export > Dataflow-Profiles. Here you will find a few pre-made dataflows that come with the Magento installation.

Import/Export Dataflow profile

Step 2: You are now looking at the pre-made dataflow that are installed with the Magento Install. You can import/export Customers, Products, and even export Product Stocks. For this tutorial we are selecting the “Import All Products” from this menu.

Dataflow-profiles

A few pre-made import & export profiles in Dataflow Profile

Step 3: You will need to upload your .csv or .xml file that you want to import

Dataflow-profile-upload-file

Upload file via Dataflow Profile

 

 

Step 4: Now that you have the File uploaded you now will need to select the tab “Run Profile” You will see a drop down and a button on this page. Now you will need to select your file that you previously uploaded. You will notice there are a series of numbers in front of the names of the files. These are a series of numbers that relate the time stamp the file was uploaded through the admin panel. This will prevent the system from causing an error with previous uploaded files and just creates a new one.

 

Dataflow-profile-run-profile

Step 5 Click the Run Profile in Popup and let the magento Dataflow go to work.

Dataflow-profile-run-profile-in-popup

Run profile in popup to import products

Please feel free to comment with any questions or comments on this.

There’s a lot of small code snippets I use often. This is where I’ll collect them. If you have any quick tips, feel free to share in the comments.

Genesis-Theme-Framework-Visual-Hook-Reference

Force a page layout
This is very useful for ensuring custom pages you build for a client aren’t broken by them changing the page layout (ex: home page). Or, changing the page layout to something other than the default on archive pages (ex: category). The example below is to set the category page to Sidebar-Content-Sidebar.

// Force layout on category
add_filter('genesis_pre_get_option_site_layout', 'child_category_layout');
function child_category_layout($opt) {
if ( is_category() )
$opt = 'sidebar-content-sidebar';
return $opt;
}

Set default page layout
// Register default site layout option
genesis_set_default_layout( 'full-width-content' );

Setup the child theme
This is what I include at the top of my functions.php file in my child themes. Any time below you see an add_action or add_filter, that part goes in the setup function, and the function itself goes after the setup function.
// Start the engine
require_once(TEMPLATEPATH.'/lib/init.php');
// Setup the child theme
add_action('after_setup_theme','child_child_theme_setup');
function child_child_theme_setup() {
// ** Backend **
// Remove Purchase Themes menu link from dashboard
remove_theme_support('genesis-purchase-menu');
// ** Frontend **
}

Unregister unused page layouts
// Unregister other site layouts
genesis_unregister_layout( 'content-sidebar' );
genesis_unregister_layout( 'sidebar-content' );
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content-sidebar' );

Add Image Sizes
This adds an image size named ‘feature’ with a fixed size of 600×250.  See Mark Jaquith’s post for details.
add_image_size('feature', 600, 250, true);

Modify Post Info

Shortcode Reference
add_filter('genesis_post_info', 'child_post_info_filter');
function child_post_info_filter($post_info) {
$post_info = '[ post_date ] by [ post_author_posts_link ] at [ post_time ] [ post_comments ] [ post_edit ]';
return $post_info;
}

Remove Post Info
remove_action('genesis_before_post_content', 'genesis_post_info');

Modify Post Meta
add_filter('genesis_post_meta', 'child_post_meta_filter');
function child_post_meta_filter($post_meta) {
$post_meta = '[ post_categories ] Tagged with [ post_tags ]';
return $post_meta;
}</code>
<strong>Remove Post Meta</strong>
<code>remove_action('genesis_after_post_content', 'genesis_post_meta');

Change Excerpt More text […]

function child_excerpt_more($more) {
&nbsp;   return '[.....]';
}
add_filter('excerpt_more', 'child_excerpt_more');

Remove Footer
remove_action('genesis_footer','genesis_do_footer');

Remove Footer and Footer Markup
// Remove Footer
remove_action('genesis_footer', 'genesis_do_footer');
remove_action('genesis_footer', 'genesis_footer_markup_open', 5);
remove_action('genesis_footer', 'genesis_footer_markup_close', 15);

Customize the Search Form text
add_filter('genesis_search_button_text', 'child_custom_search_button_text');
function child_custom_search_button_text($text) {
return esc_attr('');
}

Remove Breadcrumbs
add_filter('genesis_breadcrumb_args', 'child_custom_breadcrumb_args');
function child_custom_breadcrumb_args($args) {
$args['sep'] = ' > ';
$args['labels']['prefix'] = '';
return $args;
}

Customize the Site Title (in #header)

This is useful if you want to use the default site title (Settings > Title) but style different elements of it differently. This specific code searches for “of” in the site title, and changes it to <em>of</em>.
// Customize the site title
add_filter('genesis_seo_title','child_customize_site_title', 10, 3);
function child_customize_site_title($title, $inside, $wrap) {
$custom = str_replace("of", "<em>of</em>", $title);
return $custom;
}

Customize the Site Description (in #header)
add_filter('genesis_seo_description','child_customize_site_description', 10, 3);
function child_customize_site_description($description, $inside, $wrap) {
$custom = str_replace("Redefining", "<strong>Redefining</strong>", $description);
return $custom;
}

Remove the Post Title
// Remove Post Title
remove_action('genesis_post_title','genesis_do_post_title');

Remove Page Titles
/** Remove page titles */
add_action( 'get_header', 'child_remove_page_titles' );
function child_remove_page_titles() {
if ( is_page() && ! is_page_template( 'page_blog.php' ) )
remove_action( 'genesis_post_title', 'genesis_do_post_title' );
}

Display Description of Menu Items

To add a description to a menu item, go to Appearances > Menus. At the top right click “Screen Options”, then check “Description”. Now you can click the dropdown arrow next to menu items and add a description. The below code will make it visible on the site.
// Display Description of Menu Items
add_filter( 'walker_nav_menu_start_el', 'child_add_description', 10, 2 );
function child_add_description( $item_output, $item ) {
$description = __( $item->post_content );
return preg_replace(&nbsp; '/(<a.*?>[^<]*?)</', '$1' . '<span >' . $description . '</span></',  $item_output);
}

Register a Sidebar
genesis_register_sidebar(array(
&nbsp;   'name'=>'Homepage Widgets',
'id' => 'homepage-widgets',
'description' => 'This shows up at the bottom of the homepage.',
));

Unregister a Sidebar
unregister_sidebar('sidebar-alt');

Customize Read More Link
// Customize Read More Link
add_filter( 'excerpt_more', 'child_more_link' );
add_filter( 'get_the_content_more_link', 'child_more_link' );
add_filter( 'the_content_more_link', 'child_more_link' );
function child_more_link($more_link, $more_link_text) {
&nbsp;   return sprintf('%s', get_permalink(), 'Read More');
}