Home Arrow Icon FAQ Arrow Icon Joomla Products Arrow Icon Joomla Virtuemart - JSON plugin Examples

Joomla Virtuemart - JSON plugin Példák

Lásd a következő URL-eket és az alábbi kimenetet az egyes URL-ek alatt;

Calling Home Page

https://www.yourdomain.com/?cmjspkjson_opt=10

Output

{

    "item": {

        "id": "1",

        "asset_id": "61",

        "title": "Getting Started",

        "alias": "getting-started",

        "introtext": "It's easy",

        "fulltext": "",

        "state": "1",

        "catid": "2",

        "created": "2019-08-29 14:35:43",

        "created_by": "581",

...

...

...

//////////"pageclass_sfx": "\,

    "pageclass_sfx": ""

}

}

https://www.yourdomain.com/index.php?option=com_virtuemart&cmjspkjson_opt=10

https://www.yourdomain.com/Egyéb példák;

index.php?option=com_virtuemart

https://www.yourdomain.com/index.php?option=com_virtuemart&view=category&id=3&cmjspkjson_opt=10


Filtering - Just get the required object from above url;

a) only category object from json;

https://www.yourdomain.com/index.php?option=com_virtuemart&view=category&id=3&cmjspkjson_opt=10&reqobj[]=category


b) getting category.children object

https://www.yourdomain.com/index.php?option=com_virtuemart&view=category&id=3&cmjspkjson_opt=10&reqobj[]=category.children


c) getting first element of array category.children

https://www.yourdomain.com/index.php?option=com_virtuemart&view=category&id=3&cmjspkjson_opt=10&reqobj[]=category.children.0


d) getting images of first element of array category.children

https://www.yourdomain.com/index.php?option=com_virtuemart&view=category&id=3&cmjspkjson_opt=10&reqobj[]=category.children.0.images


You get the idea? Right.

There are just two rules to remember;

1) Write any Virtuemart URL and append the following to the end

&cmjspkjson_opt=10

Hurray! you get the JSON data.

2) If you don't want to get that much data, you can just get the required objects by filtering. For filtering, you need to add the filter by adding the reqobj parameter to the url. 

&reqobj[]=category.children

3) Further great thing is that you can add any number of filters to the url. The benefit is that you can get more than one required objects from one url with just one HTTP request. Efficient!

For example,

&reqobj[]=category.children&reqobj[]=category.children.0.images