dryan Posted January 18, 2005 Posted January 18, 2005 This is a very simple mod to do one thing. On some product pages I wanted a simple listing of products with no images. On others I wanted to show an image beside each product. The following single change makes this possible in: /catalog/includes/modules/product_listing.php find: } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> '; } break; replace with: } else { // MOD TO REMOVE IMAGES FROM SELECTED CATEGORIES // include in the following if statement any cPath pages // on which you do NOT want images // it it currently set to display images for all categories EXCEPT 2 and 3 // you MUST change these values to suit your needs // the $cPath variable appears at the end of the URL for each category if($cPath == 3 || $cPath == 2){ $lc_text = ' '; } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> '; } } break;
Guest Posted January 18, 2005 Posted January 18, 2005 Dale, Looks like i could use this mod. How do i Control what is shown and what isn't?
Guest Posted January 18, 2005 Posted January 18, 2005 Maybe change this code: if($cPath == 3 || $cPath == 2){ ...to something like this: $exclude = '1,2,3'; $exclude_array = explode(',' , $exclude); if( in_array($cPath, $exclude_array) ){ It's a few more characters but it makes it extremely portable and able to be integrated into some admin control panel management script. For example, look at this code: $exclude = SOME_DEFINED_STRING_FROM_ADMIN_SETTINGS; $exclude_array = explode(',' , $exclude); if( in_array($cPath, $exclude_array) ){ Now we're getting somewhere! See how the code is able to use an admin control panel setting string for comparison? If it were me I would create a simple script to control which categories were excluded. I could be as simple as a single page with checkboxes... As an example, you could use this code to loop the checkbox field: ///* -- Some query to pull the categorories -- */// /* -- Some code to loop the query array -- */ # foreach (something as somethingelse echo ' ' . tep_draw_checkbox_field("cat_id[]", $somequery['cateories_id'], $checked).'<b>'.$query['categories_name'].'</b><br>'; # end the foreach Then of course you would need to implode the passed array once it was submitted...and save it in a table somewhere. Finally, the code above would work and be completely controlled from the admin control panel. For those that don't know better...the code I posted is a quick example of how to integrate it into the control panel and make it more easily managed. Don't copy-n-paste it... Bobby
dryan Posted January 19, 2005 Author Posted January 19, 2005 It would be a HUGE improvement to be able to set this from the admin page. I think it is a really necessary feature for people selling certain kinds of things. If you sell 150 different kinds of widgets and 4 different kinds of wombats, you are probably going to want to display the names but no photos of the widgets but both names and photos of the wombats. Anybody willing to do this the right way? I'm sure there are some *other functions of product_listing.php that it would be useful to control from the admin page. Suggestions?
Guest Posted January 19, 2005 Posted January 19, 2005 I laid it out above...should be a 30 minute script. I'll let someone else handle it. Anyone interested? Should be a great first contribution for someone! Bobby
Lufine Posted November 9, 2005 Posted November 9, 2005 With this I got an error message (unexpected T_STRING) if($cPath == 3 || $cPath == 2){ but this works fine :-) if($cPath == '3' || $cPath == '2'){ Has anyone an idea, how and where I could change the number of displayed articles for the same categories? Usually we display 10 Articles but in these categories we would like display about 50 articles per page Thanks Lufine
Recommended Posts
Archived
This topic is now archived and is closed to further replies.