X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   How to generate a product catalog to embed on any (non-X-Cart) page? (https://forum.x-cart.com/showthread.php?t=75161)

ModDM 04-02-2017 04:44 AM

How to generate a product catalog to embed on any (non-X-Cart) page?
 
How to generate a product catalog to embed on any (non-X-Cart) page?

A grid list or any type of list with the products, just as on the catalog pages of X-Cart.

Possibly all-in-one, consisting of parts like:

- thumbnails
- titles
- short descriptions
- prices
- add to cart buttons

qualiteam 04-02-2017 11:10 PM

Re: How to generate a product catalog to embed on any (non-X-Cart) page?
 
It depends on where you want to include the data. Will you do it server-side, or do you want to include the section into an HTML page via a JavaScript code?
Anyway, implementing this may be tricky as the server-side solution may conflict with your PHP code, and the JavaScript solution may require complex JavaScript code to get all the X-Cart functions (pagers, add-to-cart, ...) work as intended.

ModDM 04-03-2017 12:13 AM

Re: How to generate a product catalog to embed on any (non-X-Cart) page?
 
You talk about conflicts with PHP, but therefore you have for example json to have data available which can be (that's my idea, because that's where json could be suitable for) easily translated. I read your REST-api could do it. I was just - as an interested user - very interested how this works.

The data as described in my original question will be eventually used in a HTML / PHP page, that's the goal. Anyway, generating such data server side will also be fine, so we can use it in our pages. Any info about this would be more than welcome. Thanks in advance.

qualiteam 04-04-2017 12:30 AM

Re: How to generate a product catalog to embed on any (non-X-Cart) page?
 
I thought of rendering embedded catalog pages exactly the same way that they appear on the X-Cart-based site.
But if JSON information about products works for you (and you render the catalog with your own templates), REST API may be a solution.
Although REST API doesn't provide the full access to the source code, it is a mediator between third-party applications and the X-Cart database. With the API you can query database records. Every API call matches to a method in the Model\Repo\* class that handles that database table. So, if you "search" for products, it looks for "search" method in the repository class for Product model and runs it with the parameters you pass in your API call - this way you can filter products returned by the query.


All times are GMT -8. The time now is 01:36 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.