=== Plugin Name === Contributors: modernminds, yaroslav0yachmenov, maximtkachuk Donate link: https://modernmodules.com/plugins/magento-2-wordpress-integration-plugin/ Tags: magento, ecommerce, integration Requires at least: 3.5 Tested up to: 4.9.1 Stable tag: trunk License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Combine Magento 2 with the CMS capabilities of WordPress. Seamless user experience for visitors by integrating the design of Magento and WordPress. == Description == Combine the powerful e-commerce solution Magento 2 with the excellent CMS capabilities of WordPress. The Magento 2 WordPress Integration Plugin integrates Magento 2 with WordPress so users will have an unified user experience. Share session/cart data, navigation menus, header, footer, products, layout elements and static blocks by using shortcodes or functions. This plugin is not meant to replace Magento 2, instead it will allow you to create a seamless user experience for your visitors by integrating the design of Magento and WordPress. This is a FREE VERSION with LIMITED FUNCTIONALITY of the premium plugin that can be found here: https://modernmodules.com/plugins/magento-2-wordpress-integration-plugin/ = Features = * Include Magento header in your WordPress theme by our API * Include Magento css into WordPress theme header automatically * Manage store views * Manage including of css and showing Magento header * Manage including of js in Magento header * Manage one or more blocks to build your customized header by Magento 2 blocks * Manage one or more blocks to build your customized header by CSS selectors. == Installation == You can only use this plugin if your WordPress installation is on the same server as your Magento installation. This plugin requires several Magento store files to be included using PHP, this means it needs to be on the same server as your WordPress Installation. In addition, session data is stored per server and thus only available if both platforms are installed on the same server. Nevertheless, in most setups you can use different subdomains with this plugin. 1. Purchase and download the WordPress plugin 2. Upload the contents of the zip to your plugin directory 3. Enable the plugin in your WordPress admin 4. Complete the settings in the plugin settings page 5. Apply the following patch to WordPress to avoid conflicts between WordPress and Magento 2: File: WORDPRESS_ROOT/wp-includes/l10n.php WordPress __() function is used for translation but is in conflict with Magento 2. Therefore, please find this function at around line 172 and REPLACE `function __( $text, $domain = 'default' ) { return translate( $text, $domain ); }` WITH `function __( $text, $domain = 'default' ) { if(defined('M2I_MAGE_DIR') && class_exists('M2I_External') && M2I_External::$needs_mage_translate){ return M2I_External::translate(func_get_args()); } else { return translate( $text, $domain ); } }` == Frequently Asked Questions == = Where can I purchase the premium plugin? = You can buy the premium plugin that includes all features at: https://modernmodules.com/plugins/magento-2-wordpress-integration-plugin/ = What should be the absolute path of my Magento directory? = An example could be: /data/web/magento2/ It should go the the main directory of your Magento 2 installation = Does it support Magento 1? = No, for support of Magento 1 there are several other plugins available = What are the server requirements? = Magento 2 and WordPress should be able to read eachothers location. Therefore, it does not matter if you use a subdirectory for example, as long as they are on the same server and can be accessed by the same user. == Screenshots == 1. General settings 2. Advanced settings 3. Magento 2 WordPress Integration == Changelog == = 1.2 = * Fixed Full Page Cache issue on 2.2 Magento in production mode with internal cache. * Improved templates loading functionality from WP side (premium version only) * Added new WP filters to make plugin more flexible: "m2i_template_name" (premium version only), "m2i_footer_before_mage_elements_html" (premium version only), "m2i_footer_after_mage_elements_html" (premium version only), "m2i_header_before_mage_elements_html", "m2i_header_after_mage_elements_html". * Refreshed slider and product-view templates (premium version only) * Add-to-cart button bugs fixed, now it's more interactive like the native button in Magento (premium version only) * Class and tag settings for DOM approach replaced with CSS selector setting both for the footer (premium version only) and header * Fixed Base URL checking bug, when only minified version of require.js is presented * Fixed charset issue for M2I_DOMDocument * Help tab added on settings page * Tooltips for advanced settings extended * And other more minor but valuable improvements! = 1.1.3 = * Fixed conflicts with other plugins (fix for Magento 2 autoloader) * Fixed fatal errors in debug mode or error_reporting (restore_error_handler used) = 1.1.1 = * Translations added (English and Ukrainian for now) * More hooks (m2i_before_init, m2i_after_init), plugin is more flexible * baseUrl error fixed, when Magento 2 is launching from root * Select2 field for Store view with searchability = 1.1 = * Store-view field improved * Flags options fixed * Integrator improved = 1.0.6 = * Launched the base version of the plugin == Features in the Premium Version == * Include Magento blocks in your WordPress theme * Use shortcodes to include products, layout blocks, and static blocks in the WordPress editor * Share session and cart data between Magento 2 and WordPress * Include product information in your WordPress editor * Seamlessly integrate your Magento 2 and WordPress theme * Display cart/mini cart with session data == Basic Usage Premium Version == You can use the following functions in your theme files: * Get HTML content (as string) of the header: m2i_get_header() * Get HTML content (as string) of the footer: m2i_get_footer() * Get HTML content (as string) for CSS files: m2i_get_links_css_tags() * Get HTML content (as string) for JS files: m2i_get_scripts_from_head() or m2i_get_scripts_from_body() * Get HTML content (as string) of the parts (elements) of the site by CSS selector: m2i_get_els_by_css_selector($css_selector) * Get HTML content (as string) of the part (element) of the site by CSS selector: m2i_get_el_by_css_selector($css_selector) * Get Product Data as array: m2i_get_product($sku_or_id, $by_id = false) * Get Categories List as array: m2i_get_cat_collection($is_active = true, $level = false, $sort_by = false, $page_size = false) * Get Store Views List as array: m2i_get_stores() * Get Store Views List as array: m2i_get_blocks() * Get Customer Info as array: m2i_get_customer_info() * Get HTML content (as string) of the CMS block : m2i_get_cms_block($attrs), where $attrs['name'] - name of the CMS block in your Magento2 * Get HTML content (as string) of the Cart: m2i_get_cart($attrs), if in $attrs is set key 'hide_if_empty' it will be hidden if empty. You can use the following shortcodes in your WordPress editor: * Show Block: [m2i_cms_block name="name_in_layout"] * Show Slider: [m2i_category_slider dom_id="unique-id" cats_ids="categories_ids_separated_by_comas" qty="quantity_of_products" margin="in_number"] * Show Single Product: [m2i_product_block id="product id"] or [m2i_product_block sku="product sku"] * Show Cart: [m2i_cart] or [m2i_cart hide_if_empty] You can override Slider and Single Product templates in your current theme directory CURRENT_THEME_DIR/m2i-templates/product-view.php or slider.php