22emilie22 Posted February 5, 2014 Share Posted February 5, 2014 Bonjour à toutes et à tous,je me permets de revenir vers vous concernant un format qui me semble être un export du catalogue, mais impossible d'en savoir plus. Je dois adapter un module qui apparemment fait un f_open de ce genre de fichier {"91":{"id":"Arabesque Ardoise Blanc","produits":[{"id_product":"2597","id_supplier":"0","id_manufacturer":"0","id_category_default":"91","id_shop_default":"1","id_tax_rules_group":"1","on_sale":"0","online_only":"0","ean13":"","upc":"","ecotax":"0.000000","quantity":-12,"minimal_quantity":"1","price":"25.000000","wholesale_price":"0.000000","unity":"","unit_price_ratio":"0.000000","additional_shipping_cost":"0.00","reference":"","supplier_reference":"","location":"","width":"0.000000","height":"0.000000","depth":"0.000000","weight":"0.000000","out_of_stock":"2","quantity_discount":"0","customizable":"0","uploadable_files":"0","text_fields":"0","active":"1","available_for_order":"1","available_date":"0000-00-00","condition":"new","show_price":"1","indexed":"1","visibility":"both","cache_is_pack":"0","cache_has_attachments":"0","is_virtual":"0","cache_default_attribute":"0","date_add":"2013-05-17 09:53:50","date_upd":"2013-05-17 10:59:54","advanced_stock_management":"0","id_shop":"1","id_product_attribute":"0","description":"<p>Format 17,7 x 20,5 cm ferm\u00e9<br \/>Couverture en papier de cr\u00e9ation ardoise 300 gr. au touch\u00e9 velout\u00e9,<br \/>motifs arabesques en vernis relief<br \/>avec petit carton Arabesque personnalis\u00e9<br \/>24 pages int\u00e9rieures blanches avec intercalaires calques <br \/>Inscription \"Il \u00e9tait une fois...\"<br \/><span style=\"line-height: 1.5em;\">en dorure argent sur la 1\u00e8re page<br \/><\/span><span style=\"line-height: 1.5em;\">Dorure sur tranche couleur argent<\/span><\/p>","description_short":"<p>Format 17,7 x 20,5 cm ferm\u00e9, 24 pages<\/p>","available_now":"","available_later":"","link_rewrite":"album-photos-arabesque-ardoise-blanc","meta_description":"","meta_keywords":"","meta_title":"","name":"ALBUM PHOTOS ARABESQUE ARDOISE \/ BLANC","id_image":"2597-6325","legend":null,"manufacturer_name":null,"tax_name":"TVA FR 19.6%","rate":"19.600","category_default":"Arabesque Ardoise Blanc","new":"0","orderprice":"29.9000000000000","allow_oosp":true,"category":"arabesque-ardoise-blanc","link":"http:\/\/2597-album-photos-arabesque-ardoise-blanc.html","attribute_price":0,"price_tax_exc":25,"price_without_reduction":25,"reduction":0,"specific_prices":{"price":"25.000000"},"features":[],"attachments":[],"virtual":0,"pack":0,"packItems":[],"nopackprice":0,"getAttributesInformations":[],"dataImage":"http:\/\/ \/img\/p\/2597-6325.jpg","imagesInformations":[]},{"id_product":"2592","id_supplier":"0","id_manufacturer":"0","id_category_default":"91","id_shop_default":"1","id_tax_rules_group":"1","on_sale":"0","online_only":"0","ean13":"","upc":"","ecotax":"0.000000","quantity":- connaissez vous ce format ? savez-vous comment je peux faire ce genre d'export.?? Merci d'avance. Emilie. Link to comment Share on other sites More sharing options...
customcode Baptiste Posted February 5, 2014 Share Posted February 5, 2014 Bonjour, Quel est le module ? Avez vous un fichier " test " permettant de formatter votre catalogue ? Link to comment Share on other sites More sharing options...
22emilie22 Posted February 6, 2014 Author Share Posted February 6, 2014 (edited) Bonjour Baptiste et merci pour votre réponse. en fait je dois adapter une boutique qui existe déja. Apparemment après quelques recherches dans le code sources, c'est un export JSON puisqu'après il est traité comme ci-dessous : $datas = file_get_contents('monfichier.php'); $donnees =json_decode($datas); le truc c'est que j'ai modifié mon catalogue et que celui-ci le fichier n'ayant pas été recréé, il ne tient pas compte des modifis. En fait, ce fichier est généré dans /controllers/front/OrderController.php comme suit : public function generateBDCCache($collection_id = 0) { if (!$collection_id) { return 0; } //if (Tools::getValue('bdc') == 1) { $tabzor = array(); if (true){ $liste_cat_classique = Category::getChildren($collection_id, $this->context->language->id); foreach ($liste_cat_classique as $col_classique) { $tabzor[$col_classique['id_category']]['id']= $col_classique['name']; $c = new Category($col_classique['id_category']); $categoryProducts = $c->getProducts($this->context->language->id, 1, 10000, 'name' , 'ASC'); $final_tab = array(); if ($categoryProducts){ foreach ($categoryProducts as $p){ // if (!empty($p['getAttributesInformations'])) { $p['getAttributesInformations'] = array(); $p['dataImage'] = array(); // Product::getAttributesInformationsByProduct($p['id_product']); $test = new Product($p['id_product']); $p['price'] = $test->price; $info_img = Image::getCover($p['id_product']); $image = new Image($info_img['id_image']); $p['dataImage'] = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath().".jpg"; $x = $test->getCombinationImages($this->context->language->id); $content= ""; $donnees_image= array(); // print_r($x); if ($x) { foreach ($x as $images_info) { $image = new Image($images_info[0]['id_image']); $images_info[0]['image_url'] = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath().".jpg"; $images_info[0]['image_id'] = $p['id_product'] . '-'. $images_info[0]['id_image']; $donnees_image[$images_info[0]['id_product_attribute']] = $images_info; } } // $p['id_img'] = $p['id_product'] . '-' . $images_info[] $p['imagesInformations'] = $donnees_image; $les_donnees = $test->getAttributeCombinations($this->context->language->id);//Product::getAttributesInformationsByProduct($p['id_product']); //$p['getAttributesInformations'] $go = array(); foreach ( $les_donnees as $combinaison) { foreach ($donnees_image as $img_data) { if ($combinaison['id_product_attribute'] == $img_data[0]['id_product_attribute']) { //on match $combinaison['image_declinaison'] = $img_data[0]['image_url']; } } $go[] = $combinaison; } $p['getAttributesInformations'] = $go; // if (!empty($p['getAttributesInformations'])) { // // foreach ($p['getAttributesInformations'] as $attr) { // $this->context->cart->setupEmptyCart('1', $attr['id_product'], $attr['id_product_attribute']); // } // // }else { // $this->context->cart->setupEmptyCart('1', $p['id_product']); // } // print_r($p['getAttributesInformations']); // print_r($p['imagesInformations']); // $images = Image::getImages($this->context->language->id, $p['id_product']); // print_r($images); // } $final_tab[] =$p; } } $tabzor[$col_classique['id_category']]['produits']= $final_tab; } file_put_contents('cache_bdc_'.$collection_id.'.php', json_encode($tabzor)); return 1; } //} } inclus dans la class OrderControllerCore. Comment pourrais-je réinitialiser ce fichier ? Avez-vous une piste svp ? Merci d'avance Emilie. Edited February 6, 2014 by 22emilie22 (see edit history) Link to comment Share on other sites More sharing options...
customcode Baptiste Posted February 6, 2014 Share Posted February 6, 2014 Bonjour C'est effectivement du JSON Vous pouvez générer un CSV a partir de store commander ( Version payante seulement ) et convertir ce CSV en JSON : http://www.convertcsv.com/csv-to-json.htm Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now