bluehat09 Posted August 6, 2011 Share Posted August 6, 2011 @rocky or @tomerg3 Please help. Thanks. First of all, many thanks for PrestaShop. My preferred business and e commerce CMS. I'm trying to do a WP plugin that will show PrestaShop products randomly from the whole database and from one specified category. I need to construct the image path for a product having the product id only. All I ask is a SQL query that will help me to construct the right path to the right image for the right product. I know the default path is img/p/product_id/image_id/product_idimage_id-home.jpg and that's all I need. E.g.: \img\p\1\5\15-home.jpg For the purpose of simplicity I will ignore the colors and the language. My problem is how to get the image_id I suppose is all about left join some tables. Any suggestion is welcomed. Thanks for help. Link to comment Share on other sites More sharing options...
bluehat09 Posted August 6, 2011 Author Share Posted August 6, 2011 You are still welcomed with that complicate SQL join. It looks too complicate to work with Webservices. Thanks in advance. Link to comment Share on other sites More sharing options...
bluehat09 Posted August 29, 2011 Author Share Posted August 29, 2011 Can anyone help, please? Many thanks in advance for any suggestion. Link to comment Share on other sites More sharing options...
guest* Posted November 8, 2011 Share Posted November 8, 2011 Hi, thank you for your mail. Did you tried the Wiki for devs ? Sorry I'm not a coder. Link to comment Share on other sites More sharing options...
bluehat09 Posted November 10, 2011 Author Share Posted November 10, 2011 Thanks cd2500 for your suggestion. For me, the wiki is useless. What I'm trying to do is to pull out the images. I figure out that complicate SQL and even I constructed the path. The problem come from using an htacess file to rewrite the path for images. Now, the real problem is the image will not show the first time but second time. It looks like is cached somehow or I have access denied somewhere. I randomly select 3 products from database. I first look if the files exist in their physical location and they exist. When I'm trying to display them in my WP, the images are not there. Strange isn't it? $image_path = $image_folder . '/' . $row['id_product'].'-' . $row['id_image']. '-' . $image_size . '.jpg'; $image_path_no_image = 'images/no_image.jpg'; if (url_validate($image_path)){ echo '<img src="'.$image_path.'" alt="'.$row['name'].'" /></a><br />'; }else{ echo '<img src="'.$image_path_no_image.'" alt="No image" /></a><br />'; } 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