Questions tagged [json]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
985 views

Show “You need to choose options for your item” message in magento2.2 when I hit API for add to cart configrable product

This is on Magento official document http://devdocs.magento.com/guides/v2.2/get-started/order-tutorial/order-add-items.html magento-host/rest/default/V1/carts/mine/items parameters { "...
0
votes
1answer
987 views

Magento 2 Json return from controller : Recoverable Error: Object of class

How can i pass json from controller. <?php namespace Swarming\FindProdFast\Controller\Index; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\...
1
vote
1answer
822 views

Upgrade Magento 2 via composer not working

I try to upgrade Magento 2.1.6 to Magento 2.1.9. To do this I ran this command: composer require magento/product-community-edition 2.1.9 --no-update after this I ran : composer update and I ...
1
vote
3answers
1k views

How to create json file in magento 2

I need to create a json file with data and store that file in specific directory of magento 2. Can any one please tell me how we can achieve this in magento2 in standard way like file system. Please ...
2
votes
1answer
376 views

How can I get the value of array object?

Im try to pass sql query value as an AJAX request, It have a array object I need to pass only the value, below code for that public function execute() { $resultJson = $this->resultJsonFactory-...
1
vote
1answer
7k views

Javascript Object : How to Remove Square Brackets [closed]

I have this Js Obect, I need to trim/remove one set of square braces "the outermost ones [ ]" from the object . Below is the structure: [[{"id":"5","color":"red",nges":[{"monthindex":3},{"monthindex"...
-1
votes
1answer
40 views

Issue with getting json data

I want to get "scanDetail" array's 1st objects 1st element "Scan": Shipment Delivered details tracking:{ "Shipment":{ "@attributes":{ "WaybillNo":"69561350456", "...
0
votes
3answers
215 views

Compare data in database with jquery and json

Is it returning me error 500 syntax, does anyone see any errors? jQuery Code var ordertxt = $j("#ordertxt"); ordertxt.blur(function() { $j.ajax({ ...
1
vote
1answer
535 views

How to handle custom_attributes from REST API data?

When dealing with the Magento v2 API, I faced a problem where getting product details have inconsistent data from REST API. Example 1: Example 2: These are Note 8 and iPhone 8 data and we can see ...
6
votes
3answers
6k views

how to create grid using ui component with multi table(JOIN) in magento2?

I have created a grid with UI component with one table now I want to join another table so how can I create?? i try but not working in Vendorname\Modulename\Model\ResourceModel\Quote\collection.php ...
0
votes
3answers
2k views

How to solve this “Item (Mage_Catalog_Model_Product) with the same id ”5“ already exist” error

public function productDataToJson(Varien_Event_Observer $observer) { $categoryModel = Mage::getModel('catalog/category'); $treeModel = $categoryModel->getTreeModel(); $categoryIds = $...
1
vote
0answers
82 views

How to get every product's quantity in event observer json file?

public function productDataToJson(Varien_Event_Observer $observer) { $category = Mage::getModel('catalog/category'); $tree = $category->getTreeModel(); $tree->load(); $ids = $tree->...
0
votes
3answers
992 views

Magento 1.9 - How to get attribute labels on product model

public function productDataToJson(Varien_Event_Observer $observer) { $category = Mage::getModel('catalog/category'); $tree = $category->getTreeModel(); $tree->load(); $ids = $tree->...
0
votes
0answers
50 views

How do I get price value with currency, also size and color attribute value instead of id?

public function productDataToJson(Varien_Event_Observer $observer) { $category = Mage::getModel('catalog/category'); $tree = $category->getTreeModel(); $tree->load(); $ids = $tree->...
0
votes
2answers
531 views

How to fix Error: unexpected '​' (T_STRING), expecting ')' error?

How can I fix this error in my code: Parse error: syntax error, unexpected '​' (T_STRING), expecting ')' error Code: public function productDataToJson(Varien_Event_Observer $observer) { $...
2
votes
3answers
1k 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 = ...
3
votes
3answers
8k 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
104 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
161 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
424 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
677 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
4k 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
8k 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
130 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
125 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
432 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
446 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
1k 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
686 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
183 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
68 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
214 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
89 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->...
4
votes
3answers
10k 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
561 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
3k 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
1k 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
160 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
1k 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
3k 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
599 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
116 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
70 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
709 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
46 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
32 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
708 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
358 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
190 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": { "...