rofli123 Posted January 7, 2017 Share Posted January 7, 2017 (edited) My product page doesn't load anymore after overriding Product class like this: <?php Class Product extends ProductCore { public function getAdjacentPictures($product_id) { $sql= "SELECT id_image FROM `"._DB_PREFIX_."image` WHERE `id_product` = $product_id"; $sql_q = Db::getInstance()->getRow($sql); k = mysqli_num_rows($sql_q); for (i=1;i<k;i++ { $sql2= "SELECT id_image FROM `"._DB_PREFIX_."image` WHERE `id_product` = $product_id AND position = $i"; $pics['$i'] = Db::getInstance()->getRow($sql2); } return $pics; } } ?> Any idea? I want to get all image_id from a single product in order to let a Jquery script change them when some buttons are clicked. Thank you for your help! Edited January 8, 2017 by rofli123 (see edit history) Link to comment Share on other sites More sharing options...
yaniv14 Posted January 7, 2017 Share Posted January 7, 2017 Hi, Turn debug on so you can see errors. Why do you use getRow? isn't executeS better? I think get row will only return the first row and if you have more than 1 image to the product? Do you get the the white page after you try to run the new function? Did you erase class_index from cache folder? 1 think I will definitely do is declare $pics at the beginning because you might try to return something that is not there ( $pics = array(); ) Good luck Link to comment Share on other sites More sharing options...
rofli123 Posted January 7, 2017 Author Share Posted January 7, 2017 Thank you yaniv14 for your reply! I didn't know about Debug mode :-) It works now. Cheers Link to comment Share on other sites More sharing options...
polaije Posted October 13, 2017 Share Posted October 13, 2017 Hi, I come in the discussion because I have a similar problem to add a message for some products. Where do you use this function added to the product class ? I have added the new field and I want to do exactly what you function do but I d'nt know where to launch the function. Can you help ? Jean-Marie 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