LUCASFRADUSCO

Members
  • Content Count

    2
  • Joined

  • Last visited

  1. Hola, Estoy intentando crear un item con variaciones, pero no estoy pudiendo. estoy enviando en el post todos los campos que veo en la documentación, pero no logro entender en el error que me devuelve mercado libre. aquí el item que le envio a ML Array ( [listing_type_id] => bronze [pictures] => Array ( [0] => Array ( [source] => http://localhost:8888/seret2/uploads/img_products/2b46e4ea9969ecf373a8a95ab0c16e82.jpg ) [1] => Array ( [source] => http://localhost:8888/seret2/uploads/img_products/fab377ccfcad74c59ff97daf5beccbfb.jpg ) [2] => Array ( [source] => http://localhost:8888/seret2/uploads/img_products/f0441f1b499ab7d402b8d18d35ad1759.jpg ) ) [title] => PRODUCTO DEMO NO OFERTAR MAV [available_quantity] => 19 [category_id] => MLA30069 [buying_mode] => buy_it_now [currency_id] => ARS [condition] => new [site_id] => MLA [price] => 666.00 [description] => Array ( [plain_text] => descripcion DEMO NO OFERTAR ) [attributes] => Array ( [0] => Array ( [id] => BRAND [value_name] => Marca de Iluminación 1. ) ) [variations] => Array ( [0] => Array ( [attribute_combinations] => Array ( [0] => Array ( [name] => Color [value_id] => 2055 [value_name] => Verde ) ) [price] => 666.00 [available_quantity] => 19 [attributes] => Array ( [0] => Array ( [id] => EAN [value_name] => 40063813339311 ) ) [sold_quantity] => 0 [pictures] => Array ( [id] => 909706-MLA41754712297_052020 ) ) [1] => Array ( [attribute_combinations] => Array ( [0] => Array ( [name] => Color [value_id] => 2056 [value_name] => azul ) ) [price] => 666.00 [available_quantity] => 3 [attributes] => Array ( [0] => Array ( [id] => EAN [value_name] => 40063813339311 ) ) [sold_quantity] => 0 [pictures] => Array ( [id] => 909706-MLA41754712297_052020 ) ) ) ) y aquí la respuesta de ML Array ( [body] => stdClass Object ( [message] => Validation error [error] => validation_error [status] => 400 [cause] => Array ( [0] => stdClass Object ( [department] => structured-data [cause_id] => 1010 [type] => warning [code] => normalize.item.attribute.id [references] => Array ( [0] => item.variations[0].attribute_combinations[0].id ) [message] => Attribute [Color] to be modified - id [null] should be [COLOR] ) [1] => stdClass Object ( [department] => items [cause_id] => 409 [type] => error [code] => item.pictures.variation.quantity [references] => Array ( [0] => item.variations.picture_ids [1] => item.category_id ) [message] => Every variation of category MLA30069 must have between 1 and 10 pictures. ) [2] => stdClass Object ( [department] => structured-data [cause_id] => 1010 [type] => warning [code] => normalize.item.attribute.id [references] => Array ( [0] => item.variations[1].attribute_combinations[0].id ) [message] => Attribute [Color] to be modified - id [null] should be [COLOR] ) ) ) [httpCode] => 400 ) gracias de antemano
  2. Hola! Yo lo hago mediante un helper. Veo complicado almacenarlas en MYSQL, ya que cada cada categoria tiene subcategorias y estas a su vez tambien las tienen. Yo lo que hago, primero es mostrar por pantalla el listado de categorias, luego, cuando seleccionan una, vuelvo a llamar a la función enviandole como parametro el ID de la categoria elegida, y la api me devuelve el listado de subcategorias, asi sucesivamente hasta que no queden mas subcategorias. public function getCategoriesML() { $categoria = $this->input->get('categoria'); $categories = getCategoriasML($categoria); echo json_encode($categories); } function getCategoriasML($categoria = null){ $ci = &get_instance(); $client_id = "xxxx"; $client_secret = "xxxxx"; require_once APPPATH.'/libraries/Meli/meli.php'; $meli = new Meli($client_id, $client_secret, getTokenML()); if ($categoria) { $categories = $meli->get('/categories/'.$categoria); } else{ $categories = $meli->get('/sites/MLA/categories'); } return $categories; }