I'd like to be able to recreate sections of my magento site outside of the magento root folder.
I have a Wordpress based site, and I'd like to have template files in the Wordpress theme be able to pull e.g. product details, the product template, or even the Magento checkout (if this is possible somehow).
This would be so that Wordpress takes responsibility for CMS content and frontend CSS, whilst Magento takes care of the product catalog and orders. There appear to be a few ways this might be possible, but I'm finding the official documentation pretty vague!
Note: I'm aware of using the Fishpig extension to pull Wordpress content into Magento, this isn't what I'm trying to do!
I believe my idea was possible in Magento 1 by doing something like this: Load / Get a block outside of Magento routing for external use
I currently have my filesystem organised as follows:
/ /index.php /wp/<wordpress> /mage/<magento>
index.php file is currently being used to initiate both the Wordpress session and the Magento session, my method was based on this post: How can I bootstrap Magento 2 in a test.php script?
Doing this lets me initiate the Wordpress frontend, and injecting the following into my wordpress template files works:
<?php echo get_class($this->_objectManager->create('\Magento\Catalog\Model\Category')); ?>
(outputs: "Magento\Catalog\Model\Category\Interceptor" )
So I can use a Mage function inside a Wordpress theme. But it's a hacky approach and creates a clash on the __() function, since both Mage and Wordpress declare their own version of this function as part of their respective translations modules (I commented it out in app/functions.php).
I think the better way to do it might be using API calls: http://devdocs.magento.com/guides/v2.0//extension-dev-guide/service-contracts/service-to-web-service.html
My question is - which approach (SOAP vs REST vs something else) would seem simplest and most suitable and why? Clearly I am going to have to do some learning here, but is there any documented example of anybody doing anything similar to this?
or should I abandon this idea completely?!