{"id":13534730,"url":"https://github.com/hws47a/VF_EasyAjax","last_synced_at":"2025-04-02T00:30:36.674Z","repository":{"id":2145150,"uuid":"3089620","full_name":"hws47a/VF_EasyAjax","owner":"hws47a","description":"[Magento 1 Extension] It allows frontend developer to send ajax requests and return a custom information from the server without a php developer help (without any php code).","archived":false,"fork":false,"pushed_at":"2018-03-13T20:12:53.000Z","size":62,"stargazers_count":63,"open_issues_count":2,"forks_count":14,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-11-02T22:32:50.223Z","etag":null,"topics":["magento","php"],"latest_commit_sha":null,"homepage":"https://fishchenko.com/projects/easy-ajax","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hws47a.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-02T19:53:13.000Z","updated_at":"2023-03-03T13:27:04.000Z","dependencies_parsed_at":"2022-08-28T14:50:43.575Z","dependency_job_id":null,"html_url":"https://github.com/hws47a/VF_EasyAjax","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hws47a%2FVF_EasyAjax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hws47a%2FVF_EasyAjax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hws47a%2FVF_EasyAjax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hws47a%2FVF_EasyAjax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hws47a","download_url":"https://codeload.github.com/hws47a/VF_EasyAjax/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246734842,"owners_count":20825210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["magento","php"],"created_at":"2024-08-01T08:00:37.991Z","updated_at":"2025-04-02T00:30:36.392Z","avatar_url":"https://github.com/hws47a.png","language":"PHP","funding_links":[],"categories":["Magento Extensions","Modules"],"sub_categories":[],"readme":"# VF_EasyAjax Module\n\n[![Build Status](https://travis-ci.org/hws47a/VF_EasyAjax.svg?branch=master)](https://travis-ci.org/hws47a/VF_EasyAjax)\n[![Codacy Badge](https://api.codacy.com/project/badge/grade/293388b1fa664d6ab6f1bed025a963e0)](https://www.codacy.com/app/hws47a/VF_EasyAjax)\n\nAllows frontend developers send ajax requests for every page and get Json response.  \nYou don't need to work with app/code section of Manento and change any PHP code.  \nMake all what you need works via Ajax using only layout xmls, theme templates and javascript.  \n\nIn the Json response frontend developers can receive:\n* All messages that were added to session\n* Some blocks from current page layout\n* Any block that should be added to special layout xml\n  \nSee the example of using Easy Ajax extension: [Ajax Cart extension with only one JS file and without any PHP code](https://github.com/hws47a/VF_AjaxCart).  \n  \n## What's new?  \n  \n* Added 'update' method to easy load and update container with data using mapping\n* Fixed compartability with prototype 1.6 (Magento \u003c 1.6)\n* Fixed checking that module is enabled\n* Fixed compartability with Magento \u003c 1.6\n* Added 'redirect' param with url where controller want to redirect\n* Fixed issue with custom layout when cache is enabled\n  \n## How to install\n\nYou can either copy all files to magento root and install it using modman or composer\n\nTo install using composer make sure that you have firegento repository set\n```\n    \"repositories\": {\n        \"firegento\": {\n            \"type\": \"composer\",\n            \"url\": \"https://packages.firegento.com\"\n        }\n    }\n```\n\nthen add `\"hws47a/easy_ajax\":\"~1.1\"` package to the require part.\n  \n## How to use:  \n  \nFor any page url add easy_ajax=1 and this page returns json instead of html.  \nIt returns:  \n1. messages: [{type: , code: }] if on this page some message is added to any session model.  \n2. action_content_data: {} if you add to params action_content[] with block names  \n3. custom_content_data: {} if you add to params custom_content[] with block names\n\n### Custom layout:\nYou can use additional layout handlers for easy ajax requests:\n* \\\u003ceasy_ajax_default\u003e - blocks from it can be loaded from any easy ajax request\n* \\\u003ceasy_ajax_ROUTE_CONTROLLER_ACTION\u003e - you can specify a layout for each action. blocks from it can be loaded only from ROUTE_CONTROLLER_ACTION request.\n  \n### Example  \n  \nFor add product to cart via Ajax use default add to cart url and add this params:  \n* easy_ajax: 1  \n* action_content[0]:cart_sidebar  \n* action_content[1]:top.links  \n\nYou will get json response with \n* messages: [{type: 'success', code: 'Massage that product was successfully added to cart.'}]  \n* action_content_data: {cart_sidebar: \"\\\u003cdiv ... \\\u003c/div\u003e\", top.links: \"\\\u003cul ... \\\u003c/ul\u003e\"}  \n  \nSo with response data you can simple update needed blocks: \n* cart_sidebar with items recently added to cart\n* top.links with count of items near link to My Cart\n\n### Custom layout example\n\nAdd to layout handler \\\u003ceasy_ajax_default\u003e some block with name \"test_default\"  \nAdd to layout handler \\\u003ceasy_ajax_checkout_cart_add\u003e some block with name \"test\"  \nAdd to request 2 additional fields:  \n* custom_content[0]: test_default\n* custom_content[1]: test\n\nYou will get response with additional field:\n* custom_content_data: {test_default: \"...\", test: \"...\"}\n\n### JS Wrapper for requests\n\n1\\. Using `EasyAjax.Request` instead of `Ajax.Request` you don't need to specify easy_ajax=1 param and you can add action_content and custom_content params easy.\nTo add action_content and/or custom_content params just add it to options list as arrays.  \n\nExample:\n```\nnew EasyAjax.Request(href, {\n     method: 'post',\n     action_content: ['cart_sidebar', 'top.links'],\n     parameters: params,\n     onComplete: function (transport) {\n        //some code...\n     }\n });\n```\n\n2\\. Second useful method is `EasyAjax.update`. Use it if you want to easily load data and add it to some container.  \n`action_content` will be used to load data.\n\nThe code can look like this:\n```\nEasyAjax.update(location.href, {\n    \"top.links\": \".top-links-container\",\n    \"block.card\":\".top-card-container\"\n});\n```\n\n### RESTful requests  \n  \nInstead of using easy_ajax=1 in params you can use RESTful interface and .json to action name.  \nExample: instead of `customer/account/loginPost?easy_ajax=1` you can use `customer/account/loginPost.json`\n\nNOTE: This feature is disabled by default, to enable it just uncomment default/web/routers/json in config.xml\n\n## Unit Tests\n\nUnit Tests writing is in progress.  \nTo run PHP tests use EcomDev_PHPUnit module.  \nTo run Js file test use CasperJs.  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhws47a%2FVF_EasyAjax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhws47a%2FVF_EasyAjax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhws47a%2FVF_EasyAjax/lists"}