How do I write a PHP snippet to read an OpenCart database to pull products by category and display it outside of an OpenCart framework? So for instance, I build this nice frontend website for widgets A and B, but then have a subdir called /cart where OpenCart is installed, and in my frontend website I load some kind of OpenCart library file and then read the database to get products by category (A and B). Or, perhaps you know the technique with direct SQL itself?
This question is different than this one because I'm trying to not build a new template in OpenCart, but use an API (or go direct to the database) to show products outside of OpenCart's application framework and in my own application framework.
I tried asking this over at the OpenCart forums, but oddly the mods deleted that post without explanation, and never told me why. So, I had no choice but to go digging for an answer from the code since the developer docs were poor for this kind of question. What I found was that the product catalog for OpenCart can be accessed by either looking at the class methods in the following file, or by loading that class file within your other web application. (As for how to load that class file, that will take some work to figure out -- I don't know yet.)
In your OpenCart 2.x directory, look for this file:
catalog/model/catalog/product.php
You'll find out from the SQL code how OpenCart gets a list of products and then how to get the product detail on a single product.