Rev0lt Posted April 6, 2011 Share Posted April 6, 2011 Hi, I have installed a 2.3.1 template that has a nice looking New products for <month> box below everything on the main page, but I want to change this to specials, or set products that I can manually enter. I have tried the new products mashup from Club OsCommerce, but that was for 2.2 and only the first section of code is identical to 2.3.1. I am useless when it comes to php, so I couldn't figure out how to get it working. On a side note (don't want to spam the forum with multiple threads), is there an easy way of displaying the Top > Catalog > Cat-1 > Sub-cat thing that is just above the category menu by default? My template does not have this, and I want to put it in where the category title is. Thanks for any help :) Link to comment Share on other sites More sharing options...
Guest Posted April 6, 2011 Share Posted April 6, 2011 Trent, If you post the code changes for the new products module we can help you through the changes to make it 2.3.1 compatible. OR you can install Featured products, replacing the new products on the main page and allowing you to choose which products will appear there. Because your template was not written to include breadcrumbs you would have to TRY to implement the code into your template. You can look at the default code from v2.3.1 to fit it in. Sorry, I can't be more specific, all templates are different. Chris Link to comment Share on other sites More sharing options...
Rev0lt Posted April 6, 2011 Author Share Posted April 6, 2011 Hi Chris, I didn't realise that featured products script is now working with 2.3. I will try and give that a go, but this is my current new_products.php code: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ ?> <?php if ($first_page === true){ if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_PRODUCTS_FIRST_PAGE); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_PRODUCTS_FIRST_PAGE); } }else{ if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } } $col = 0; $row = 0; if ($first_page == 0){ $col_items = (MAX_DISPLAY_NEW_PRODUCTS_PER_ROW - 1); $colspan = ((MAX_DISPLAY_NEW_PRODUCTS_PER_ROW * 2) - 1); }else{ $col_items = (MAX_DISPLAY_NEW_PRODUCTS_PER_ROW_FIRST_PAGE - 1); $colspan = ((MAX_DISPLAY_NEW_PRODUCTS_PER_ROW_FIRST_PAGE * 2) - 1); } $col_width = (int)(100 / ($col_items + 1)).'%'; $new_prods_content .= '<div class="prods_content prods_table">'; while ($new_products = tep_db_fetch_array($new_products_query)) { if (($col === 0) && ($row != 0)) { $new_prods_content .= '<ul><li class="prods_hseparator">'.tep_draw_separator('spacer.gif', '1', '1').'</li></ul>'; } if ($col === 0) { $new_prods_content .= '<ul class="row" id="row-'.$row.'">'; }else { $new_prods_content .= '<li class="prods_vseparator">'.tep_draw_separator('spacer.gif', '1', '1').''; } // ************************************* // ************************************* $product_query = tep_db_query("select products_description, products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$new_products['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); $product = tep_db_fetch_array($product_query); $p_id = $new_products['products_id']; $p_pic = '<a class="prods_pic_bg" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], (SMALL_IMAGE_WIDTH), (SMALL_IMAGE_HEIGHT), '') . '</a>'; $p_name = '<span><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></span>'; // $p_desc = ''.substr(strip_tags($product['products_description']), 0, MAX_DESCR_1).' ...'; $p_desc = mb_substr(strip_tags($product['products_description']), 0, MAX_DESCR_MODUL_NEW_PRODS, 'UTF-8').'...'; $p_price = '<span class="productSpecialPrice">' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span>'; // ************************************* $p_details_text = '<div class="bg_button22" onMouseOut="this.className=\'bg_button22\';" onMouseOver="this.className=\'bg_button22-act\';">' .tep_draw_button_top() . '<a href="' . tep_href_link('product_info.php?products_id='.$p_id) . '" id="tdb1" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary ui-priority-secondary" role="button"><span class="ui-button-icon-primary ui-icon ui-icon-triangle-1-e"></span><span class="ui-button-text">'. IMAGE_BUTTON_DETAILS .'</span></a>' . tep_draw_button_bottom().'</div>'; $p_buy_now_text = '<div class="bg_button2" onMouseOut="this.className=\'bg_button2\';" onMouseOver="this.className=\'bg_button2-act\';">' .tep_draw_button_top() . '<a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'" id="tdb1" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary ui-priority-secondary" role="button"><span class="ui-button-icon-primary ui-icon ui-icon-cart"></span><span class="ui-button-text">'. IMAGE_BUTTON_IN_CART .'</span></a>' . tep_draw_button_bottom().'</div>'; // ************************************* // ************************************* $new_prods_content .= '<li style="width:' . PRODS_BLOCK_WIDTH . 'px;" class="wrapper_prods">'. ' <div class="pic_padd">'.$p_pic.'</div>'. "\n". ' <div class="box-padd">'. "\n". ' <div class="name name_padd equal-height">'.$p_name.'</div>'. "\n". ' <h2 class="price price_padd un"><b>'.PRICE. '</b>'.$p_price.'</h2>'. "\n". ' <div class="button__padd">'.$p_buy_now_text.''.$p_details_text.'</div>'. "\n". ' </div>'. "\n"; $col ++; if ($col > $col_items) { $new_prods_content .= '</ul>'; $row ++; $col = 0; }else{ $new_prods_content .= '</li>'; } } $new_prods_content .= '</div>'; ?> <?php echo tep_draw_title_top();?> <h1 class="cl_both "><?php echo sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')); ?></h1> <?php echo tep_draw_title_bottom();?> <div class="contentPadd"> <?php echo $new_prods_content; ?> </div> <script type="text/javascript"> $(document).ready(function(){ var row_list = $('.row'); row_list.each(function(){ new equalHeights($('#' + $(this).attr("id"))); }); }) </script> <script type="text/javascript"> $(document).ready(function(){ var row_list2 = $('.row2'); row_list2.each(function(){ new equalHeights2($('.row3')); }); }) </script> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.