1

This is specific to Magento 2.1, but knowledge on other versions may help in pointing me in the right direction.

I have tried a few things and have scoured the internet for similar solutions but most have not been answered or are for previous Magento versions.

I have an existing standalone website that was completely custom built that uses PHP, HTML, CSS and JavaScript and almost all files are '.php'. This existing site is not on any platform and is not 'E-Commerce'. The existing site is visually how we want it, it has a custom dealer locator, custom json and other data retrieval portions. I want to take these files and structure, preferably exactly how it is, and use it as a E-Commerce site that is integrated with Magento. By Integrated I mean having the ability to call Magento's functions/methods so I can use Magento's tools such as creating and editing accounts, shopping cart, checkouts, etc.

Thus far, I have created my own custom theme in Magento, created custom modules and neither of which seem to give me the capabilities of what I am looking for (or else I have misunderstood the documentation and need to expand). Magento uses MVC structure and I would prefer to not use it if possible. The current format I have my site in is in the structure below.

Preferred file structure or similar

Above is how I built the existing site and it is structured how we develop. In what direction should I go in order to achieve this custom development structure within Magento while being able to use Magento tools?

My question is very similar to this post, but I would like to use the Magentos tools in a more direct way and potentially exactly how they already exist. Using Magento as backend ONLY for website

I will elaborate, add code, answers and questions as fast as I can upon a request.

0

I think the way you are going about this is blatantly incorrect, especially if you don't like the previous answer you have linked.

You consistently say you don't want to change anything to your existing setup/structure, while at the same time wanting to integrate with a very particular framework, while saying you want to use this framework "directly as [it] already exists". It's not going to work if you don't want to simply use the REST API, which probably doesn't make sense for your case given that you'd be making API calls when you could be injecting straight into templates.

You need to re-do your structure in a custom Magento module and template. If all you have is a frontend, then you can integrate that into Magento.

See here: http://devdocs.magento.com/guides/m1x/magefordev/mage-for-dev-4.html

  • Although I was hoping to not have to change the structure, I guess I am forced to do so. Thank you for the reply. I have seen the link you posted before, but I did not look through it since it says it is for Magento V1. Does this documentation still apply to Magento 2.1? Also, If I create a custom Module, do I need to create a custom theme too or are they 'in lieu of' one another? – CommonKnowledge Jan 14 '17 at 17:17
  • Magento 2 has architectural changes, so I would refer specifically to Magento 2 documentation if that's what you are using. – Summer Developer Jan 14 '17 at 17:19
  • @CommonKnowledge devdocs.magento.com – Summer Developer Jan 14 '17 at 17:20
0
+100

When integrating Magento and something else there are three methods: use an external frontend, use Magento for the frontend and integrate the external data source or run them together in the same codebase and use the classes for example from Magento inside your other app.

The first two methods would use the respective system's API interfaces while possible to access their databases directly instead, while the latter would natively give you access to the public API of each framework in their native contexts.

As long as your other framework is PHP based and uses composer you shouldn't have any trouble instantiating Magento inside your app to use its functionality.

You would want to be careful with how you expose Magento routes to the frontend so it doesn't conflict with your other framework. In this case it is common to delegate a route such as /shop* for example to be a dedicated base URL for Magento, while everything else belongs to your other framework.


In your particular example, it doesn't appear that your website is (A) very complex and (B) worth bothering to do all of this for. You said you don't want to use an MVC structure, but judging purely by your screenshot I imagine there's not very much to your site at this stage.

To run two systems together you would need to either use Magento's API to pull and push data in the context of your custom framework, OR you would need to replicate your layout into Magento so that when you hit customer pages or checkout that it still looks the same. If you've gone that far, you may as well just build your custom functionality from your existing website into a Magento theme and custom module.

TL;DR: it's possible to do what you want to do, but you need to weigh up whether it's worth it. You will add maintenance burden across frameworks and it will take you almost as long as it might to port your functionality into a Magento module anyway.

Disclaimer: I have worked on a project where we used Magento for the front facing framework and pulled in external data. It took a couple of months to get everything working correctly, consistently and with high availability. It's fun to do, but TBH I'm not sure it is necessary.

  • 1
    Thank you very much! This was very helpful and has given me the motivation to continue with my planned customization. I was really hoping for the answer "It could be done". – CommonKnowledge Jan 16 '17 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.