sila Posted February 5, 2005 Share Posted February 5, 2005 For certain products I would like to turn off the image on the product_info page and replace it with text and manually placed images. Is there a way turn off the standard image display for some products, possibly through a checkbox "display/don't display image on product info page" for the admin product info input page? Could there be another solution? i've looked but could not find a contribution for this. Unfortunately my php is not versed enough to accomplish it... I appreciate your help. :D Link to comment Share on other sites More sharing options...
sila Posted May 29, 2005 Author Share Posted May 29, 2005 Hm... I still have not been able to figure this one out. My idea of how it could be solved is to add one field to the database product info table, like "image on or off", with default "on". In the admin product info a checkbox would be added to optionally display the product image, default "on". And in the product info page, showing the image would be conditional to the checkbox marked "on": if the chebox is "on" display the image. So much for the logic. If I just knew how to code it... Would anyone help? I need this because i am using some of the sub-categories not as product info pages but as product specificationp pages which show size details, color and design details, other manufacturing details, etc., without the image showing there. I think it might be helpful to others as well. Link to comment Share on other sites More sharing options...
Wendy James Posted May 29, 2005 Share Posted May 29, 2005 You can go into your admin configuration, click on images and set :images required" to false. Wendy James Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep. Link to comment Share on other sites More sharing options...
sila Posted May 29, 2005 Author Share Posted May 29, 2005 Thanks for this suggestion, this would be workaround. It would take care of category and product info display and all other displays when no image is uploaded. I actually do like to show images on the category level, and while for selected product information pages the uploaded image would not be showing. Link to comment Share on other sites More sharing options...
Wendy James Posted May 29, 2005 Share Posted May 29, 2005 Ok, if you just dont want the image to show on product_info.php take out the code that is calling it. <?php if (tep_not_null($product_info['products_image'])) { ?> <table border="0" cellspacing="0" cellpadding="2" align="right"> <tr> <td align="center" class="smallText"> <script language="javascript"><!-- document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>'); //--></script> <noscript> <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> </noscript> </td> </tr> </table> <?php } ?> then put any images you want into the description. Wendy James Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep. Link to comment Share on other sites More sharing options...
sila Posted May 29, 2005 Author Share Posted May 29, 2005 Thanks, I appreciate your help. I saw this alternative in the forum and technically that would work, but in practice the persons uploading the regular products are not html and ftp versed and must upload images through the regular "new product" interface. I've been looking at the "add product field" contributions, but it this particular modification has some slightly different requirements. I've already added a database field to the end of the products table, "products_image_show" with exactly the same parameters as the "products_status" field, with a simple on/off function. On the admin new product page it should best appear with the same kind of radio buttons as product_status. I think this needs to be done somewhere (or multiple places) on the admin/categories.php page. Then there needs to be a specific "if" statement maybe on the admin/categories page and certainly on the product info page, where the image is called. Link to comment Share on other sites More sharing options...
sila Posted June 26, 2005 Author Share Posted June 26, 2005 Ok for the record, I have worked it out on my own, basically along the lines outlined in my first post, mostly through tedious experimentation. A person entering a product in admin can now choose to display the image on the product info page or not. It would be nice to write the mod for it, but my php is too limited to do this properly. Link to comment Share on other sites More sharing options...
running wolf Posted June 26, 2005 Share Posted June 26, 2005 I would be interested in that mod. Any ways you could share it? Or tell what you did exactly? Thanks in advance Kristine Running Wolf Link to comment Share on other sites More sharing options...
sila Posted June 27, 2005 Author Share Posted June 27, 2005 I call this "modification by muddling through" (MBMT). There was a lot of experimenting and I'm not sure if i documented all. If you try it, make sure to back up everything beforehand. And also read this entire post before starting anything. This is based on using cpanel. Honestly I'm somwhat scared of using that thing for database changes, because I have not yet had the opportunity to re-install a messed up database (knock on wood). The priniciple is clear, but it is a long work-through, especially the admin/categories.php is a long file. 1. create the database field (similar to the products_status field) in "products" table. this will guide showing or not showing the image: add field "products_image_show" (or someting like that) with basically with same parameters as "products_status" field: products_image_show type: tinyint(1) Null:No Default:0; [there are some further explanations in the mod "adding product fields v2" but finally that mod is different from this]; also, i had difficulty with assigning the default value of either 0 or 1! 2. add to admin/includes/languages/english.php (and other languages) the texts for the radio buttons on the add/edit products page, something like: define('TEXT_PRODUCTS_IMAGE_SHOW', 'Show Products Image:'); define('TEXT_PRODUCTS_IMAGE_SHOW_YES', 'Yes'); define('TEXT_PRODUCTS_IMAGE_SHOW_NO', 'No, don't show on product info page'); 3.make changes to admin/includes/language/english/categories.php aside from where to put the additions be especialluy careful about spelling consistently (products_image_show followed the general logic, but it is very easy to forget the products "s"), and when your're doing this don't want to fail on spelling. a) basically where ever products_status appears, make a similar addition for products_image_show. Note that this is a lot of places! b ) insert the radio buttons to show the choice show/no show: after <tr> <td class="main"><?php echo TEXT_PRODUCTS_IMAGE; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_file_field('products_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $pInfo->products_image . tep_draw_hidden_field('products_previous_image', $pInfo->products_image); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> insert (this is adapted from the products_status radio button): <tr> <td class="main"><?php echo TEXT_PRODUCTS_IMAGE_SHOW; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('products_image_show', '1', $in_status) . ' ' . TEXT_PRODUCTS_IMAGE_SHOW_YES . ' ' . tep_draw_radio_field('products_image_show', '0', $out_status) . ' ' . TEXT_PRODUCTS_IMAGE_SHOW_NO; ?></td> </tr> also after if (!isset($pInfo->products_status)) $pInfo->products_status = '1'; switch ($pInfo->products_status) { case '0': $in_status = false; $out_status = true; break; case '1': default: $in_status = true; $out_status = false; } i inserted: if (!isset($pInfo->products_image_show)) $pInfo->products_image_show = '1'; switch ($pInfo->products_image_show) { case '0': $in_status = false; $out_status = true; break; case '1': default: $in_status = true; $out_status = false; } I did not make additions in the section where products_status talks about green and red buttons!!! (But still, there seemed to be some effect for some reason, see below). 4. make change on product_info.tpl.php (if template system, or product_info.php if not template system). This is where the image actually becomes "conditional". Basically it says: if you see the value "1" then... put the image. (and if not, there are no instructions = there is no image. find line: if (tep_not_null($product_info['products_image'])) { replace with: if ( $product_info['products_image_show'] == 1) { Basically that is it. There is a chance of confusion among the various "0" and "1" settings. After I was done i noticed that if I turn a product image off, the entire product turns off as well (in the green/red buttons of the product overview in a category) but as long as I turn the product back on, the product does turn back on and the image stays off, all is as intended. Other products with image showing appear just fine. Since I followed "products_status" logic it stands to reason that somewhere I made an addition that actually affects that field, but it turned futile to find out which one it was... . And basically, it works! I hope this helps, I'm not sure if I missed something. Let me know how you fare. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.