oracle765 Posted February 18, 2014 Author Share Posted February 18, 2014 hey thanks seems to be getting somewhere it just seems to be showing a load of images though for some reason you can see the on compareandchoose.com.au/shopping.php I have attached the full page code for clairity sake once again I personally thank you shopping.php Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted February 19, 2014 Share Posted February 19, 2014 (edited) This code is looping over the images stored in the imageList array // display product images echo '<p><b>Images: </b>'; $imageListKey = ($key == 'offer') ? 'imageList' : 'images'; foreach($item[$key][$imageListKey]['image'] as $image) { echo '<img src="'.$image['sourceURL'].'" /> '; } echo '</p>'; If you only want to display one image size, say a 200px x 200px image of the product then replace the above code with echo '<p><b>Image: </b><img src="'.$item[$key][$imageListKey]['image'][1]['sourceURL'].'" /></p>'; Edited February 19, 2014 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
oracle765 Posted February 19, 2014 Author Share Posted February 19, 2014 Hi there thanks for that, it does not show any image at all now, I gather you were pointing to the [1] within that array? also do you know which array set the min price is in for that store Quote Link to comment Share on other sites More sharing options...
oracle765 Posted February 19, 2014 Author Share Posted February 19, 2014 oh and I replaced the whole of the foreach loop with that code is that correct Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted February 19, 2014 Share Posted February 19, 2014 Oops, replace the code in reply #28 with $imageListKey = ($key == 'offer') ? 'imageList' : 'images'; // <-- forgot to include this echo '<p><b>Image: </b><img src="'.$item[$key][$imageListKey]['image'][1]['sourceURL'].'" /></p>'; Quote Link to comment Share on other sites More sharing options...
oracle765 Posted February 19, 2014 Author Share Posted February 19, 2014 That seems to have done it and extracted the images, thanks again, although I have no idea what is happening lol these multidimensional arrays are frying my brain I just have to figure out how to get the minimum price in the array and why some of the Buy froms and Manufacturers are blank after all I am aiming along the lines of 3 products found, prices from $$$ then click compare which shows the different stores prices if you know what I mean Quote Link to comment Share on other sites More sharing options...
oracle765 Posted February 21, 2014 Author Share Posted February 21, 2014 [2] => Array ( [name] => Store [attributeURL] => http://www.au.shopping.com/washing-machines/washing-machine/products~all-store~MS-1?oq=washing_machine&linkin_id=8084586 [attributeValues] => Array ( [attributeValue] => Array ( [0] => Array ( [name] => Appliances Online [attributeValueURL] => http://www.au.shopping.com/washing-machines/washing-machine+store-appliances-online-4114784/products~linkin_id-8084586 [id] => store_appliances_online_4114784 [matchingItemsCount] => 76 ) [1] => Array ( [name] => Masters Home Improvement [attributeValueURL] => http://www.au.shopping.com/washing-machines/washing-machine+store-masters-home-improvement-9689/products~linkin_id-8084586 [id] => store_masters_home_improvement_9689 [matchingItemsCount] => 19 ) [2] => Array ( [name] => The Good Guys [attributeValueURL] => http://www.au.shopping.com/washing-machines/washing-machine+store-the-good-guys/products~linkin_id-8084586 [id] => store_the_good_guys [matchingItemsCount] => 3 ) [3] => Array ( [name] => Mr Appliance [attributeValueURL] => http://www.au.shopping.com/washing-machines/washing-machine+store-mr-appliance-9689/products~linkin_id-8084586 [id] => store_mr_appliance_9689 [matchingItemsCount] => 3 ) ) [matchedValueCount] => 4 [returnedValueCount] => 4 Hi Ch0cu3r I aint touch any of the code since you last mailed me but I have noticed that in the array its trying to out put the store name but I only seem to get on store even though there are 4 stores in there as shown Any ideas why its only showing appliances online and not the rest? again for clarity sake I have attached the page code, but to be fair I have never changed anything Thanks Alan shopping.php Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted February 21, 2014 Share Posted February 21, 2014 My code does not use that store array for displaying the store name. This code only displays the store, if the current item has a store array defined, hence the if statement // the store logo and name echo '<p><b>Buy From: </b>'; if(isset($item[$key]['store'])) { echo '<img src="'.$item[$key]['store']['logo']['sourceURL'].'" /> ' .$item[$key]['store']['name'] .'</p>'; } Quote Link to comment Share on other sites More sharing options...
oracle765 Posted February 21, 2014 Author Share Posted February 21, 2014 ah ok I see, no worries thanks Quote Link to comment Share on other sites More sharing options...
oracle765 Posted February 22, 2014 Author Share Posted February 22, 2014 Hi again Still baffled with this array how do I actually drill down to the min price and number of stores in the array so I can show in format like this item, description, number of stores, prices from, CompareButton(which goes to the stores) thanks in advance Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.