Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $str_catalogo = file_get_contents('http://localhost/artigraf.pt/Catalog_es_ES_DEMO.json');
- //var_dump($str);
- $json_catalogo = json_decode($str_catalogo, true);
- $catalogo = $json_catalogo['root']['Products'][0];
- //print_r($catalogo);
- foreach ($catalogo['Product'] as $field_catalogo => $value_catalogo) {
- $value_catalogo['id'];
- echo '
- <div class="col-sm-4 col-xs-12" >
- <div class="product-image-wrapper">
- <div class="single-products">
- <div class="productinfo text-center" style="background-color: #f2f2f2; border: #e6e6e6 1px solid">';
- $str_imagens = file_get_contents('http://localhost/artigraf.pt/MultimediaLinks_es_ES_DEMO.json');
- //var_dump($str);
- $json_imagens = json_decode($str_imagens, true);
- $imagens_count = count($json_imagens['root']['Products'][0]['Product']);
- // serve para percorrer todas as imagens do ficheiro
- for ($i = 0; $i < $imagens_count; $i++) {
- $imagens = $json_imagens['root']['Products'][0]['Product'][$i]['MultimediaLinks'];
- //print_r($imagens);
- foreach ($imagens['MultimediaLink'] as $field_imagens => $value_imagens) {
- // serve para ir buscar o id no ficheiro de catalogo
- $imagens_1 = $json_imagens['root']['Products'][0];
- foreach ($imagens_1['Product'] as $field_imagens_1 => $value_imagens_1) {
- if ($value_catalogo['id'] === $value_imagens_1['id']) {
- echo '<img src="' . $value_imagens['Url'] . '" width="500" height="250" alt=""/>';
- }
- }
- }
- }
- echo '
- <a href="product-details.php?id_produto=' . $value_catalogo['id'] . '">
- <p style="margin: 20px 0 10px;"></p>
- <h2 style="margin-bottom: 9%"> €</h2>
- <button class="btn_lista add-to-cart" style="">Comprar agora +
- </button>
- </a>
- </div>
- </div>
- </div>
- </div> ';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement