Questions tagged [json]

This tag should be used for questions related to json data types

2
votes
3answers
6k views

Magento2: How to convert JSON to Array of nested objects

I am wanting to understand if there are some functions in Magento Framework which will assist me in mapping an array of nested objects from JSON (such as what would happen when the REST API is ...
1
vote
1answer
450 views

Magento 2: How can I store my original REST request in a file on the server?

I need to store my REST request within the file system - I have tried serializing the request object, but obviously the file size is quite a lot larger than the original. I have run a test that ...
1
vote
3answers
2k views

magento 2 custom api return in json without response tag

I have created a custom api following "inchoo" tutorial. But I am getting the data in string format instead of json. From my browser I am getting a tag surrounding the api return as below. But ...
1
vote
1answer
914 views

Magento 2: how to get json posted data in payment method

Magento is posting payment detail in json format on rest/default/V1/carts/mine/payment-information Method post {"cartId":"3","billingAddress":{"countryId":"US","regionId":"0","postcode":null,"...
1
vote
1answer
104 views

Move HTTP GET request into a JSON array in Magento 2 REST API (V1/customers/search)

Is it possible to put the content of this rest api in a json array to put in GET parameters instead ? And if yes, what should the code look like ? curl_init("http://my.website.com/index.php/rest/V1/...
0
votes
1answer
2k views

Magento .htaccess Response for preflight has invalid HTTP status code 400

I am doing a rest call from Magento to Angular 2. I am facing this CORS issue and trying many workarounds but nothing seems to work. Figured out its server side issue and made the below changes in ...
3
votes
1answer
751 views

how i update the order status in controller in magento 2?

<?php namespace Vendor\Module\Controller\Index; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\Framework\App\ResponseInterface;class Index extends ...
3
votes
3answers
2k views

How to get json data on frontend controller in magento2?

<?php namespace Vendor\Module\Controller\Index; class Index extends \Magento\Framework\App\Action\Action { protected $resultPageFactory; public function __construct( \Magento\...
2
votes
2answers
436 views

how i get the json body in controller in magento 2?

<?php namespace VEndor\Module\Controller\Index; class Index extends \Magento\Framework\App\Action\Action { protected $resultPageFactory; public function __construct( \Magento\...
0
votes
1answer
100 views

If multiple items are ordered they should have their own line item section

Here is my Code:- $orderIncrementId = "1000001"; $orderCollection = Mage::getModel('sales/order'); $orderCollection->loadByIncrementId($orderIncrementId); $order_data = $...
1
vote
1answer
69 views

Magento add to cart product issue

Getting really weird issue. Some of my products are not getting to cart. https://www.saree.com/beige-and-navy-blue-art-silk-blouse-with-stone-work-saaabl003 while this one works https://www.saree....
1
vote
0answers
661 views

500 Internal Server Error during onepage checkout saveShippingMethod

Hi I have problem in my onepage checkout. I can't choose pay method because ajax all time is reload. In console I have 500 (Internal Server Error) (in adress onepage/json/saveShippingMethod. I can't ...
0
votes
1answer
42 views

model values are not coming in response , why empty response in magento 1.9

public function ws_getPunchForApp($custid,$page=1,$size=10){ if(Mage::getSingleton('customer/session')->isLoggedIn()){ } else{ $res["error"] = "Invalid request"; ...
0
votes
0answers
24 views

how to save value of post data to a custom table in magento 1.9 [duplicate]

Getting error Fatal error: Call to a member function setData() on boolean in /home/company/lampstack-5.6.28-1/apps/kb/htdocs/app/code/local/Namespace/Manager/controllers/Service.php on line 2849 ...
0
votes
1answer
497 views

When creating an order via the Magento2 Rest V1 API, can I disable customer emails?

I'm working through integration of orders from external sources into our Magento store. We sell directly through our Magento instance as well as through some other carts (cartLoom). When an order is ...
0
votes
1answer
329 views

Magento 1.9.2 :how to take data though API from android app to magento database?

We are having android app where we are tracking the location and timing of our sales guys! but how we can save this log in time and log out time in magento database ? how I can interact with android ...
0
votes
1answer
139 views

Setting multiple checkbox option selections on cart item

I have a product in my store with radio and checkbox custom options. using below JSON encoded string to add that item with it's options to shopping cart within my mobile app. { "cartItem": { "...
1
vote
1answer
257 views

How echo json data in a Magento controller on a valid way?

I have created a Magento plugin. In this plugin I call (with ajax) a custom controller where I echo some json data: public function testAction() { echo json_encode('test'); exit; } But when I ...
0
votes
1answer
816 views

Magento 2 - productCollection to json

In a .phtml template file I have loaded a productCollection using objectManager as follow: $productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection'); $...
1
vote
2answers
629 views

Magento 2 ajax success json error

I'm trying to to an ajax call using following code $.ajax({ type: 'POST' ,url: SOME_URL ,data: {testdata : testid} ,...
1
vote
0answers
113 views

Magento 2: How to get JSON API Variable in Model

Below is the REST API called on Checkout Page, when you have multiple address & u click on "Ship here" magento/rest/default/V1/carts/mine/estimate-shipping-methods-by-address-id It passes ...
2
votes
1answer
2k views

KnockoutJS cannot read property 'fromJS' of undefined

I have tried bind json file with knockoutjs into my custom template. But i got this error in browser console: Uncaught TypeError: Cannot read property 'fromJS' of undefined How to avoid this error?...
2
votes
1answer
37 views

Quickcreate JSON error

Using the quick-create-product option on Configurable Products gives an error. An AJAX call is made, the product is created but the JSON response is wrong. So the 'Please wait' overlay stays and the ...
1
vote
1answer
700 views

Magento 2: Make JSON calls inside controller

I'm developing a product import function by XML. The import works fine but the input XML is 9000 products and the request already uses 200MB memory with 100 products (even with the clearInstance() ...
1
vote
2answers
3k views

Create block over ajax Magento 2

I want to send block html in JSON response. To be specific - I want to add functionality where customers are able to edit their addresses via Ajax requests. So the block class will be \Magento\...
3
votes
2answers
3k views

Price not updating on Configurable products after upgrade to Magento 1.9.3

I think I may have found a bug in Magento CE 1.9.3 which was released last week? I upgraded our Staging environment to it and have found that the pricing of Configurable products is not updating ...
1
vote
1answer
138 views

Using Zend json server on Magento 2

I'm new to Magento 2 and I'm trying to create a module that uses Zend Json Server. The initial code in the module controller was (in Magento 1): public function postAction() { $server = new ...
0
votes
1answer
174 views

error while using jsonEncode in magento 2.0

class Calculator implements CalculatorInterface { public function __construct( \Magento\Framework\ObjectManagerInterface $objectManager ) { $this->_objectManager = $objectManager; } $...
0
votes
1answer
266 views

Action when i change the status of an order

I need some help i want generate a json from orders completed, if i change the status order into admin panel, i want to make a json of that order. Could you help me, how can i execute a script or ...
2
votes
1answer
527 views

Why doesn't Magento setHeader('application/json') when appropriate in OnePageCheckout?

I have a Magento environment that is tunneled through Apache via mod_proxy. During the one-page checkout process, Apache is erroneously wrapping JSON responses in HTML because the response header says ...
1
vote
1answer
171 views

Magento2: Add product via external form

I'm making a database connection between two seperate systems. I found a lot of options for updating existing products, but is there also a way to add new products through the Magento2 API?
1
vote
0answers
427 views

Magento 2 calculate custom text fields length and width on product view page

How is possible in magento 2.0? I successfully active in magento 1.9 for bellow thing. I am trying to create a product with two custom text fields: Length and Width. When the user types, both a length ...
2
votes
0answers
120 views

curl and json approve conversion Rest API

i'm currently coding a little api for extole approve conversion api. It's only suppose to send data on declined orders which is equal to cancelled in the magento admin. Here is what i have written ...
1
vote
3answers
4k views

“Zend_Json Decoding failed: syntax error” when submitting order

I recently switched from Apache/PHP 5.5 to a new nginx/PHP 7.0.4 server and now I am getting once in a while a "Decoding failed: Syntax error" when customers try to checkout, apparently when they ...
0
votes
1answer
62 views

how to get current cart items for different mobile app user with magento database?

I want to get cart items in json formate for different mobile app user . It works same as magento cart system how can get ? help me ..
0
votes
1answer
416 views

Create Product using the json data

I have a task to create products programmatically using the JSON data. I created a new module to make a custom controller. Then I hit the url using the http requester add on through Mozilla browser, ...
1
vote
1answer
1k views

Create product using SOAP API and JSON input

I need to create product with SOAP API and JSON, here is my JSON input: {"sku":"tsett","name":"TEST","weight":"3.0000","qty":"18.0000","brand":"sample","category_ids":["107","108","109"],"pirce":"...
-2
votes
1answer
2k views

How to get JSON data output on backend using API? [closed]

In here I have not experience with JSON on Magento. So I need to know useful links or tips to learn that.
22
votes
9answers
34k views

How to update magento2 from 2.0.0 to 2.0.2

The docs here say that you should use the system upgrade utility: http://devdocs.magento.com/guides/v2.0/comp-mgr/upgrader/upgrade-start.html and do it from the admin. I thought that you would be ...
5
votes
3answers
19k views

Magento2 - How to get JSON response from Controller [closed]

I've created my custom controller and I want to return the result formated with JSON. I always get a JSON parse error "JSON.parse: unexpected character at line 1 column 1 of the JSON data" and the ...
0
votes
3answers
743 views

java script 404 error in custom module

I created one module and i want to add js file to that module but in DOM i am getting "404 not found" my file are My\Helloworld\view\frontend\requirejs-config.js var config = { map: { '*':...
7
votes
4answers
18k views

How do I get a response from REST API in JSON format in Magento 2?

I used the resources in “Creating a New REST Web Service in Magento 2” and “Creating a New REST Web Service in Magento 2” to create a custom API module, but the response is in XML format. I need a ...
3
votes
1answer
1k views

Magento 2: Intercept controller's JSON response

I'm trying to intercept a controller returning a JSON object of Magento\Framework\Controller\Result\Json class. The problem is that no matter if I use a plugin or a preference to "catch" the ...
0
votes
1answer
108 views

ajax call failing

On the same page I have 2 sections. First section is generated dynamically (when I enter a text in an autocomplete field) and the second section is loaded on pageload. There is an ajax all I need to ...
3
votes
0answers
429 views

Reset super-attributes in select drop down for configurable products [closed]

Currently I have 2 select options: size and color as dropdown menus for my configurable products. On the frontend, users can select size, then color. Options for color are greyed out accordingly if ...
7
votes
4answers
2k views

Creating a custom module to send order details to external supplier API via XML or JSON

I'm trying to write a custom module for Magento that when certain items are ordered and payment has been made, posts to our clothing supplier's site with details of the ordered item, delivery address ...
1
vote
0answers
87 views

How to return global_messages as JSON string?

I am trying to echo global_messages via JSON on the frontend. I have been looking around for some examples of how to return global_messages as a JSON string but cannot find anything that has helped ...
2
votes
1answer
5k views

Properly convert Magento's returned object to JSON

I made a customer log-in to the site programmatically... I am properly returned the session values in form of an object. Now i want this data carried over and returned from the function in JSON ...
0
votes
2answers
262 views

proper JSON-encode of magento object (decimals/currency)

I'm trying to process a Magento object with JSON. Using json_encode($order->getData()) or Mage::helper('core')->jsonEncode($order->getData()), I get output such as the following: { "entity_id": "...
1
vote
1answer
1k views

How to get json of products/storeConfig by making a request with an url?

I'd like to setup Magento so that if I make a request with an URL such as: http://mymagento.com/api/storeconfig (actual url format not important) would return json with the data requested. How can I ...