We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [json]

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

Filter by
Sorted by
Tagged with
2
votes
3answers
837 views

I have one json file of all products, and now I want to display only those products of current categories?

$baseUrl = $this->getBaseUrl(); $skinUrl = $this->getSkinUrl(); $currcategory = Mage::getSingleton('catalog/layer')->getCurrentCategory(); $products = file_get_contents('c_node.json'); $arr = ...
1
vote
3answers
6k views

How can i get image url with proper path?

<?php foreach ($temp as $product): ?> <?php $id = $product['entity_id']; $img = $product['image']; $url = $product['url_path']; $small_image = $skinUrl.$product['small_image']...
0
votes
1answer
94 views

How can I get image url with product data in one json file?

public function productDataToJson(Varien_Event_Observer $observer) { $array = array(); $products = Mage::getModel('catalog/product')->getCollection(); foreach ($products as $_product) { ...
0
votes
3answers
141 views

Not getting product image urls of all products in json file?

public function productDataToJson(Varien_Event_Observer $observer) { // $product = $observer->getProduct(); $products = Mage::getModel('catalog/product')->getCollection(); foreach (...
0
votes
4answers
382 views

How to write function for getting subcategories of particular category?

function productDescription() { $_helper = Mage::helper('catalog/category'); $category = Mage::getModel('catalog/category')->load($categoryId); $_categories = $category->...
2
votes
2answers
550 views

Serialized array in controller

This is my script <script> function callAjax(){ var customoptionhtml = document.getElementById("customoption-dynamic").innerHTML; //alert(test);//alert(jQuery(test).text()); var ...
2
votes
2answers
3k views

Magento 2 how to unserialize backend config

I've created Magento 2 module that saves a particular configuration. Screenshot: Now I want to use this value in a frontend block. If I check the core_config table, the value is saved like this: a:1:...
5
votes
4answers
6k views

Magento 1.9.3.3 - How do you return a JSON array from a controller to ajax

I have a ajax call to a controller (suburbSearchAction) which retrieves a list of suburbs based suburb text received from the user Ajax call inputSuburbData = jQuery(inputSuburb).val().trim(); ...
0
votes
1answer
115 views

Parsing JSON with PHP

How do I parse this JSON with PHP: a:6:{s:15:"info_buyRequest";a:6:{s:4:"uenc";s:148:"...
0
votes
0answers
114 views

How do I get two attribute values in same json file?

function productDescription() { $attribute = Mage::getSingleton('eav/config') ->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'size'); if ($attribute->usesSource()) { $options ...
0
votes
1answer
338 views

How to save key value pair of array from JSON in magento 1.9?

Here is my test code trying to save data what I am getting in request, but it is not saving in table. $json = '{ "isMobileConfirm":false, "cid":"85036", "managerid":"12345", "location":...
0
votes
0answers
420 views

Jsonp getting internal server error

I tried to update the order status using an external app file the process in Magento file execute successfully that I can update the order status but the issue in jsonp I get false function here is my ...
1
vote
1answer
893 views

Magento 2 API - declare @return JSON

I'm playing with M2 API. I built a test module that returns specific Order items in JSON format. I set @return as 'string' (see screenshot below). Problem: I'm getting error: Class string does not ...
1
vote
1answer
666 views

Magento Patch 9767 “Decoding failed: Syntax error” [closed]

I am running EE 1.14.0.1 and PHP 5.6 and got below error on production server only. I cleared the cache and implement the solutions suggested by @folektoras133 at Security Patch SUPEE-9767 - Possible ...
1
vote
1answer
170 views

Add category description to “catalog/category_tree” collection

class Ab_CategoryObserver_Model_Observer { public function updateTopMenuJson(Varien_Event_Observer $observer) { $_helper = Mage::helper('catalog/category'); $_categories = $...
0
votes
1answer
65 views

I am gettig all my catagorries and subcatagories in json string,but I want only active catagories in my json string

class Ab_CategoryObserver_Model_Observer { public function updateTopMenuJson(Varien_Event_Observer $observer) { $_helper = Mage::helper('catalog/category'); $_categories = $_helper-...
1
vote
1answer
197 views

something is wrong in the code. theows an error->getNodeChildrenData() must be an instance of Varien_Data_Tree_Node,on line 18 [duplicate]

<?php class Ab_CategoryObserver_Model_Observer{ public function updateTopMenuJson(Varien_Event_Observer $observer){ $_helper = Mage::helper('catalog/category'); $_categories = $...
0
votes
2answers
84 views

What to do exactly? my code throw an error -> 'Call to undefined function getNodeChildrenData()'

class Ab_CategoryObserver_Model_Observer{ public function updateTopMenuJson(Varien_Event_Observer $observer){ $_helper = Mage::helper('catalog/category'); $_categories = $_helper->...
2
votes
3answers
7k 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
516 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
958 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,"...
2
votes
1answer
126 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
870 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
492 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
102 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
689 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
25 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
593 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
343 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
162 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
273 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
885 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
669 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
117 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
38 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
780 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
146 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
199 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
327 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
582 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
172 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
436 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 ...