0

I am getting following array

    Array
(
    [product_id] => ?
    [sku] => testsku
    [type] => simple
    [created_at] => ?
    [updated_at] => ?
    [type_id] => ?
    [name] => newproduct
    [description] => newproduct
    [short_description] => newproduct
    [weight] => 1
    [status] => 1
    [url_key] => newproduct.html
    [url_path] => newproduct
    [visibility] => 4
    [has_options] => ?
    [gift_message_available] => ?
    [price] => 15
    [special_price] => ?
    [special_from_date] => ?
    [special_to_date] => ?
    [tax_class_id] => 4
    [meta_title] => ?
    [meta_keyword] => ?
    [meta_description] => ?
    [custom_design] => ?
    [custom_layout_update] => ?
    [options_container] => ?
    [websitre_id] => ?
    [attribute_set_id] => ?
    [simples_skus] => ?
    [re_skus] => ?
    [configurable_attributes] => ?
    [color] => ?
)

The requirement is different. I used

$array = json_decode(json_encode($data), true)

Basically, I am getting this array by calling magento soap service and want to convert this array to exactly as:

$data = array(0 => array(
        'name' => 'newproduct55445',
        'sku' => 'mynewsku1',
        'description' => 'Product description',
        'short_description' => 'Product short description',
        'weight' => '10',
        'status' => '1',
        'url_key' => 'newproduct',
        'url_path' => 'newproduct.html',
        'visibility' => '4',
        'price' => '100',
        'tax_class_id' => 1,
        'meta_title' => 'Product meta title',
        'meta_keyword' => 'Product meta keyword',
        'meta_description' => 'Product meta description',
        'store' => 'admin',
        'attribute_set' => 'default',
        'type' => 'configurable',
        'tax_class_id' => 4,
        'status' => 1,
        'visibility' => 4,
        'is_in_stock' => 1,
        'simples_skus' => 'myproduct'
        ));
1
  • You can manipulate that using foreach Commented Sep 10, 2015 at 7:10

1 Answer 1

0

you can do like this way:

$array = array();
$array[] = json_decode(json_encode($data), true);
Sign up to request clarification or add additional context in comments.

1 Comment

i can't able to convert [product_id] to 'product_id'

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.