toolcrazy Posted December 14, 2002 Posted December 14, 2002 I would like to change the default on the specials box. I would like it to disappear when there are no specials in it and it would appear when there are specials in it. Like the featured product box. I am using OSCloaded v4 12/5/02 Steve -------------------------
Guest Posted December 14, 2002 Posted December 14, 2002 That should be do-able....Both scripts are similar. Compare the 2 to see what makes the featured disappear when it's empty and try adding it to the specials. Good idea! I may try it myself!
Ajeh Posted December 14, 2002 Posted December 14, 2002 Doesn't it already do that? The if on it looks like it wants to have at least on product before it even begins to draw the box.
mattice Posted December 14, 2002 Posted December 14, 2002 what you need to do is see if the query returned a result. If there isn't don't show anything. First thing you should make sure of is there is no html output (or php echo'd html OUTPUT) BEFORE the query is retuned. So you might have to move the <TD> bit. HTH Mattice "Politics is the art of preventing people from taking part in affairs which properly concern them"
Ajeh Posted December 14, 2002 Posted December 14, 2002 Just checked ... I set all my specials off and the box vanished ... The If statement is checking to see if something is found, and if nothing is found you never get to the part that draws it and php just goes on its merry way as if it was never there ... :D
nick Posted December 14, 2002 Posted December 14, 2002 Maybe it's the loaded snapshot that is different. I've just installed loaded 4 and have same thing with specials box showing up even without any specials.
mattice Posted December 14, 2002 Posted December 14, 2002 might be a version thing though... I remember my March snap didn't hide the 'New Products for [month] header on the main pages.... that was fixed at some point. Regards, Mattice "Politics is the art of preventing people from taking part in affairs which properly concern them"
Ajeh Posted December 14, 2002 Posted December 14, 2002 Let me peek in Load 4 version and see what's up.
Guest Posted December 14, 2002 Posted December 14, 2002 Linda, Will you post or email your specials.php for a comparison for those of us that are stuck with the header when there are no specials?
nick Posted December 14, 2002 Posted December 14, 2002 OK the specials.php works fine on loaded 4 - I just tested it. The part that I was referring to and I think toolcrazy as well is on the default.php page there is a featured products section and specials section where new products usually goes. This is generated by includes/modules/default_specials.php and it does not have any type of check. Can most likely just rip the required bit of info from specials.php
nick Posted December 14, 2002 Posted December 14, 2002 ok in includes/modules/default_specials.php ... At the top of the file change <!-- default_specials //--> <tr> to <!-- default_specials //--> <?php $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and s.status = '1' order by s.specials_date_added DESC"; $specials_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SPECIAL_PRODUCTS, $specials_query_raw, $specials_numrows); $specials_query = tep_db_query($specials_query_raw); if ($specials_numrows > 0) { ?> <tr> and then add closing brace at bottom so change new contentBox($info_box_contents); ?> <!-- default_specials_eof //--> to new contentBox($info_box_contents); } ?> <!-- default_specials_eof //--> That should do it - it's a bad hack / copy & paste job and I'm sure someone else can do it a lot better
Ajeh Posted December 14, 2002 Posted December 14, 2002 I don't know if this is cleaner ... but this was the change I made to work with the default_specials.php in Ian's Load4 <!-- default_specials //--> <?php // BOF: WebMakers.com Added: Show only if there $new = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and s.status = '1' order by s.specials_date_added DESC limit " . MAX_DISPLAY_SPECIAL_PRODUCTS); if ($chk_specials = tep_db_fetch_array($new)) { ?> <tr> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <?php $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_DEFAULT_SPECIALS, strftime('%B'))); new contentBoxHeading($info_box_contents); $info_box_contents = array(); $row = 0; $col = 0; while ($default_specials = tep_db_fetch_array($new)) { $default_specials['products_name'] = tep_get_products_name($default_specials['products_id']); $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $default_specials['products_image'], $default_specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $default_specials['products_id']) . '">' . $default_specials['products_name'] . '</a><br><s>' . $currencies->display_price($default_specials['products_price'], $default_specials['products_tax_class_id']) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($default_specials['specials_new_products_price'], $default_specials['products_tax_class_id']).'</span>' ); $col ++; if ($col > 2) { $col = 0; $row ++; } } new contentBox($info_box_contents); ?> <?php // EOF: WebMakers.com Added: Show only if there } ?> <!-- default_specials_eof //-->
toolcrazy Posted December 15, 2002 Author Posted December 15, 2002 Linda, Thanks, It works, but with two side effects. Now the Cart box doesn't go all the way to the top like it did and the bar with the date doesn't go all the way across the bottom. I don't know if it is something you did or I did. I am going to check it out. Thanks again, Steve Steve -------------------------
toolcrazy Posted December 15, 2002 Author Posted December 15, 2002 OOPS, It was me. Left in a table row, stupid me. It works perfect. Thanks very, very much. You all are great. Steve Steve -------------------------
Ajeh Posted December 15, 2002 Posted December 15, 2002 LOL ... I sure was hoping it was you ... I was in the middle of re-writting all the modules that section touches when this question came up and thought I messed up the order of popping back in the original code for the files in the area and putting in this code to work normally. I was getting really dizzy trying to see where I left out something that might break other things without all the other changes I had made, taken out, put back ... etc. ... :D Thanks for letting me know. And don't feel stupid ... think how much faster you will find the next error that results in a similar error? 8)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.