Kurre Posted April 26, 2019 Share Posted April 26, 2019 I found a topic that is closed so I can´t write there, I have osCommerce 2.3.4.1 CE BS version but I can´t find the code <?php if (MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS == 'True') { ?> in the file catalog/includes/modules/product_listing.php , the code is <?php if ( (defined('MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS') && MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS == 'True') && (strpos(MODULE_HEADER_TAGS_GRID_LIST_VIEW_PAGES, basename($PHP_SELF)) !== false) ) { ?> I guess it is that code but if I add this code right above it <?php if (!tep_session_is_registered('max_products_per_page')) tep_session_register('max_products_per_page'); if (!isset($max_products_per_page) || !is_integer($max_products_per_page) || ($max_products_per_page < 1)) $max_products_per_page = MAX_DISPLAY_SEARCH_RESULTS; if (isset($HTTP_GET_VARS['mppp']) && is_numeric($HTTP_GET_VARS['mppp']) && ($HTTP_GET_VARS['mppp'] > 0)) $max_products_per_page = intval($HTTP_GET_VARS['mppp']); $mppp_list = array(); for ($i = 1; $i <= 5; $i += 1) { //change $i <= 5 to show more or less page options, default is 5 (Example: 12, 24, 36, 48, 60 (total: 5 options)) $mppp = intval($i * 12); //change $i * 12 for products shown per page, default is 12 $mppp_list[] = array('id' => $mppp, 'text' => $mppp); } $mppp_list[] = array('id' => 9999999, 'text' => TEXT_ALL_ITEMS); $gvhf = ''; $ignore = array('page', 'mppp'); if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) { reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if ( (strlen($value) > 0) && ($key != tep_session_name()) && (!in_array($key, $ignore)) ) { $gvhf .= tep_draw_hidden_field($key, $value); } } } $maxpppform = tep_draw_form('prod_per_page', basename($PHP_SELF), 'get') . $gvhf . tep_draw_pull_down_menu('mppp', $mppp_list, $max_products_per_page, 'class="form-control input-sm" style="width:70px;" onchange="this.form.submit()"') . '</form>'; $listing_split = new splitPageResults($listing_sql, $max_products_per_page, 'p.products_id'); ?> <form class="form-inline pull-right"> <label class="control-label"><?php echo TEXT_SHOW; ?></label> <?php echo $maxpppform; ?> </form> It doesnt work, the dropdown menu is there and all but if I chose like 48 items it will not show that. Anyoone have a solution for this ? Link to comment Share on other sites More sharing options...
♥ecartz Posted April 27, 2019 Share Posted April 27, 2019 I don't think that is the right place. Look for $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id'); and replace it with if (!tep_session_is_registered('max_products_per_page')) tep_session_register('max_products_per_page'); if (!isset($max_products_per_page) || !is_integer($max_products_per_page) || ($max_products_per_page < 1)) $max_products_per_page = MAX_DISPLAY_SEARCH_RESULTS; if (isset($HTTP_GET_VARS['mppp']) && is_numeric($HTTP_GET_VARS['mppp']) && ($HTTP_GET_VARS['mppp'] > 0)) $max_products_per_page = intval($HTTP_GET_VARS['mppp']); $mppp_list = array(); for ($i = 1; $i <= 5; $i += 1) { //change $i <= 5 to show more or less page options, default is 5 (Example: 12, 24, 36, 48, 60 (total: 5 options)) $mppp = intval($i * 12); //change $i * 12 for products shown per page, default is 12 $mppp_list[] = array('id' => $mppp, 'text' => $mppp); } $mppp_list[] = array('id' => 9999999, 'text' => TEXT_ALL_ITEMS); $gvhf = ''; $ignore = array('page', 'mppp'); if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) { reset($HTTP_GET_VARS); while (list($key, $value) = each($HTTP_GET_VARS)) { if ( (strlen($value) > 0) && ($key != tep_session_name()) && (!in_array($key, $ignore)) ) { $gvhf .= tep_draw_hidden_field($key, $value); } } } $maxpppform = tep_draw_form('prod_per_page', basename($PHP_SELF), 'get') . $gvhf . tep_draw_pull_down_menu('mppp', $mppp_list, $max_products_per_page, 'class="form-control input-sm" style="width:70px;" onchange="this.form.submit()"') . '</form>'; $listing_split = new splitPageResults($listing_sql, $max_products_per_page, 'p.products_id'); Then put the <form class="form-inline pull-right"> <label class="control-label"><?php echo TEXT_SHOW; ?></label> <?php echo $maxpppform; ?> </form> Wherever you have it now (so long as it is after the other code that you added), as that is working. It's also worth noting that Edge already has a version of this. You might check to see if Frozen does as well. If so, you might be better off just updating to Frozen rather than trying to figure out how to implement this. Another thing is that you may want to replace $HTTP_GET_VARS with $_GET everywhere that it appears. And there may be similar issues that aren't leaping out at me. Always back up before making changes. Link to comment Share on other sites More sharing options...
Kurre Posted April 27, 2019 Author Share Posted April 27, 2019 Thanks for trying to help, but that did not work either. This is my product_listing.php <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2016 osCommerce Released under the GNU General Public License */ $num_list = (isset($_GET['view']) && ($_GET['view'] == 'all') ) ? 999999 : MAX_DISPLAY_SEARCH_RESULTS; $listing_split = new splitPageResults($listing_sql, $num_list, 'p.products_id'); ?> <?php if ($messageStack->size('product_action') > 0) { echo $messageStack->output('product_action'); } ?> <div class="contentText"> <?php if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) { ?> <div class="row"> <div class="col-sm-6 pagenumber hidden-xs"> <?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?> </div> <div class="col-sm-6"> <div class="pull-right pagenav"><ul class="pagination"><?php echo $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></ul></div> <span class="pull-right"><?php echo TEXT_RESULT_PAGE; ?></span> </div> </div> <?php } if ($listing_split->number_of_rows > 0) { ?> <div class="well well-sm"> <div class="btn-group btn-group-sm pull-right"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <?php echo TEXT_SORT_BY; ?><span class="caret"></span> </button> <ul class="dropdown-menu text-left"> <?php for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text = TABLE_HEADING_MODEL; break; case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text = TABLE_HEADING_MANUFACTURER; break; case 'PRODUCT_LIST_PRICE': $lc_text = TABLE_HEADING_PRICE; break; case 'PRODUCT_LIST_QUANTITY': $lc_text = TABLE_HEADING_QUANTITY; break; case 'PRODUCT_LIST_WEIGHT': $lc_text = TABLE_HEADING_WEIGHT; break; case 'PRODUCT_LIST_IMAGE': $lc_text = TABLE_HEADING_IMAGE; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text = TABLE_HEADING_BUY_NOW; break; case 'PRODUCT_LIST_ID': $lc_text = TABLE_HEADING_LATEST_ADDED; break; } if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { $lc_text = tep_create_sort_heading($_GET['sort'], $col+1, $lc_text); echo ' <li>' . $lc_text . '</li>'; } } ?> </ul> </div> <?php if ( (defined('MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS') && MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS == 'True') && (strpos(MODULE_HEADER_TAGS_GRID_LIST_VIEW_PAGES, basename($PHP_SELF)) !== false) ) { ?> <strong><?php echo TEXT_VIEW; ?></strong> <div class="btn-group"> <a href="#" id="list" class="btn btn-default btn-sm"><span class="fa fa-th-list"></span><?php echo TEXT_VIEW_LIST; ?></a> <a href="#" id="grid" class="btn btn-default btn-sm"><span class="fa fa-th"></span><?php echo TEXT_VIEW_GRID; ?></a> </div> <?php } ?> <div class="clearfix"></div> </div> <?php $listing_query = tep_db_query($listing_split->sql_query); $prod_list_contents = NULL; // php 5 $list_group_item = (isset($item_width) ? $item_width : 4); // php 7 // $list_group_item = $item_width ?? 4; while ($listing = tep_db_fetch_array($listing_query)) { $prod_list_contents .= '<div class="item list-group-item col-sm-' . $list_group_item . '" itemprop="itemListElement" itemscope="" itemtype="http://schema.org/Product">'; $prod_list_contents .= ' <div class="productHolder equal-height is-product" data-is-special="' . (int)$listing['is_special'] . '" data-product-price="' . $currencies->display_raw($listing['final_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '" data-product-manufacturer="' . max(0, (int)$listing['manufacturers_id']) . '">'; if (PRODUCT_LIST_IMAGE > 0) { if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) { $prod_list_contents .= ' <a href="' . tep_href_link('product_info.php', 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image('images/' . $listing['products_image'], htmlspecialchars($listing['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'itemprop="image"', NULL, 'img-responsive thumbnail group list-group-image') . '</a>'; } else { $prod_list_contents .= ' <a href="' . tep_href_link('product_info.php', (isset($sort) ? 'sort=' . $sort . '&' : '') . ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image('images/' . $listing['products_image'], htmlspecialchars($listing['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'itemprop="image"', NULL, 'img-responsive thumbnail group list-group-image') . '</a>'; } } $prod_list_contents .= ' <div class="caption">'; if (PRODUCT_LIST_NAME > 0) { $prod_list_contents .= ' <h2 class="h3 group inner list-group-item-heading">'; if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) { $prod_list_contents .= ' <a itemprop="url" href="' . tep_href_link('product_info.php', 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '"><span itemprop="name">' . $listing['products_name'] . '</span></a>'; } else { $prod_list_contents .= ' <a itemprop="url" href="' . tep_href_link('product_info.php', ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '"><span itemprop="name">' . $listing['products_name'] . '</span></a>'; } $prod_list_contents .= ' </h2>'; } $prod_list_contents .= ' <p class="group inner list-group-item-text" itemprop="description">' . strip_tags($listing['products_description'], '<br>') . '…</p><div class="clearfix"></div>'; $extra_list_contents = NULL; if ( (PRODUCT_LIST_MANUFACTURER > 0) && tep_not_null($listing['manufacturers_id']) ) { $extra_list_contents .= '<dt>' . TABLE_HEADING_MANUFACTURER . '</dt>'; $extra_list_contents .= '<dd><a href="' . tep_href_link('index.php', 'manufacturers_id=' . (int)$listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a></dd>'; } if ( (PRODUCT_LIST_MODEL > 0) && tep_not_null($listing['products_model']) ) { $extra_list_contents .= '<dt>' . TABLE_HEADING_MODEL . '</dt>'; $extra_list_contents .= '<dd>' . $listing['products_model'] . '</dd>'; } if ( (PRODUCT_LIST_QUANTITY > 0) && (tep_get_products_stock($listing['products_id']) > 0) ) { $extra_list_contents .= '<dt>' . TABLE_HEADING_QUANTITY . '</dt>'; $extra_list_contents .= '<dd>' . tep_get_products_stock($listing['products_id']) . '</dd>'; } if (PRODUCT_LIST_WEIGHT > 0) { $extra_list_contents .= '<dt>' . TABLE_HEADING_WEIGHT . '</dt>'; $extra_list_contents .= '<dd>' . $listing['products_weight'] . '</dd>'; } if (tep_not_null($extra_list_contents)) { $prod_list_contents .= ' <dl class="dl-horizontal list-group-item-text">'; $prod_list_contents .= $extra_list_contents; $prod_list_contents .= ' </dl>'; } if ( (PRODUCT_LIST_PRICE > 0) || (PRODUCT_LIST_BUY_NOW > 0) ) { $prod_list_contents .= ' <div class="row">'; if (PRODUCT_LIST_PRICE > 0) { if (tep_not_null($listing['specials_new_products_price'])) { $prod_list_contents .= ' <div class="text-center" itemprop="offers" itemscope itemtype="http://schema.org/Offer"><br><meta itemprop="priceCurrency" content="' . tep_output_string($currency) . '" /><div class="text-center" role="group"><del>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</del> <span class="productSpecialPrice" itemprop="price" content="' . $currencies->display_raw($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span></div></div><br>'; } else { $prod_list_contents .= ' <div class="text-center" itemprop="offers" itemscope itemtype="http://schema.org/Offer"><br><meta itemprop="priceCurrency" content="' . tep_output_string($currency) . '" /><div class="text-center" role="group"><span itemprop="price" content="' . $currencies->display_raw($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span></div></div><br>'; } } if (PRODUCT_LIST_BUY_NOW > 0) { $prod_list_contents .= ' <div class="text-center">'; $prod_list_contents .= tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'fa fa-shopping-cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . (int)$listing['products_id']), NULL, array('params' => 'data-has-attributes="' . ((tep_has_product_attributes((int)$listing['products_id']) === true) ? '1' : '0') . '" data-in-stock="' . (int)$listing['in_stock'] . '" data-product-id="' . (int)$listing['products_id'] . '"'), 'btn-success btn-product-listing btn-buy'); $prod_list_contents .= ' </div>'; } $prod_list_contents .= ' </div>'; } $prod_list_contents .= ' </div>'; $prod_list_contents .= ' </div>'; $prod_list_contents .= '</div>'; } echo '<div id="products" class="row list-group" itemscope itemtype="http://schema.org/ItemList">'; echo ' <meta itemprop="numberOfItems" content="' . (int)$listing_split->number_of_rows . '" />'; echo $prod_list_contents; echo '</div>'; } else { ?> <div class="alert alert-info"><?php echo TEXT_NO_PRODUCTS; ?></div> <?php } if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) { ?> <div class="row"> <div class="col-sm-6 pagenumber hidden-xs"> <?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?> </div> <div class="col-sm-6"> <div class="pull-right pagenav"><ul class="pagination"><?php echo $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></ul></div> <span class="pull-right"><?php echo TEXT_RESULT_PAGE; ?></span> </div> </div> <?php } ?> </div> Link to comment Share on other sites More sharing options...
Kurre Posted April 30, 2019 Author Share Posted April 30, 2019 I got it working when I changed all $HTTP_GET_VARS with $_GET thanks to @ecartz FIND: <?php if ( (defined('MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS') && MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS == 'True') && (strpos(MODULE_HEADER_TAGS_GRID_LIST_VIEW_PAGES, basename($PHP_SELF)) !== false) ) { ?> and ADD RIGHT ABOVE it this: <?php if (!tep_session_is_registered('max_products_per_page')) tep_session_register('max_products_per_page'); if (!isset($max_products_per_page) || !is_integer($max_products_per_page) || ($max_products_per_page < 1)) $max_products_per_page = MAX_DISPLAY_SEARCH_RESULTS; if (isset($_GET['mppp']) && is_numeric($_GET['mppp']) && ($_GET['mppp'] > 0)) $max_products_per_page = intval($_GET['mppp']); $mppp_list = array(); for ($i = 1; $i <= 5; $i += 1) { //change $i <= 5 to show more or less page options, default is 5 (Example: 12, 24, 36, 48, 60 (total: 5 options)) $mppp = intval($i * 12); //change $i * 12 for products shown per page, default is 12 $mppp_list[] = array('id' => $mppp, 'text' => $mppp); } $mppp_list[] = array('id' => 9999999, 'text' => TEXT_ALL_ITEMS); $gvhf = ''; $ignore = array('page', 'mppp'); if (is_array($_GET) && (sizeof($_GET) > 0)) { reset($_GET); while (list($key, $value) = each($_GET)) { if ( (strlen($value) > 0) && ($key != tep_session_name()) && (!in_array($key, $ignore)) ) { $gvhf .= tep_draw_hidden_field($key, $value); } } } $maxpppform = tep_draw_form('prod_per_page', basename($PHP_SELF), 'get') . $gvhf . tep_draw_pull_down_menu('mppp', $mppp_list, $max_products_per_page, 'class="form-control input-sm" style="width:70px;" onchange="this.form.submit()"') . '</form>'; $listing_split = new splitPageResults($listing_sql, $max_products_per_page, 'p.products_id'); ?> <form class="form-inline pull-right"> <label class="control-label"><?php echo TEXT_SHOW; ?></label> <?php echo $maxpppform; ?> </form> Thats all. Link to comment Share on other sites More sharing options...
burt Posted April 30, 2019 Share Posted April 30, 2019 I believe I made one for the 2018 28d, so that is another option. From what I recall I used a Hook rather than a load of core code change. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted April 30, 2019 Share Posted April 30, 2019 4 hours ago, Kurre said: I got it working when I changed all $HTTP_GET_VARS with $_GET thanks to @ecartz Cool Kurre, works fine just tested on osC CE BS4 Link to comment Share on other sites More sharing options...
Kurre Posted April 30, 2019 Author Share Posted April 30, 2019 19 minutes ago, JcMagpie said: Cool Kurre, works fine just tested on osC CE BS4 Great. Glad I could do somtehing to help the community. Link to comment Share on other sites More sharing options...
SCH_001 Posted June 7, 2019 Share Posted June 7, 2019 @burt so where can the below be found? On 4/30/2019 at 8:34 PM, burt said: I believe I made one for the 2018 28d, so that is another option. From what I recall I used a Hook rather than a load of core code change. Link to comment Share on other sites More sharing options...
burt Posted June 7, 2019 Share Posted June 7, 2019 In my 28d 2018 package (I think). Have a look at my club. I've made so many modules I may be mistaken as to where it is. Link to comment Share on other sites More sharing options...
SCH_001 Posted June 7, 2019 Share Posted June 7, 2019 @burt I have not been able to find it on http://www.clubosc.com Link to comment Share on other sites More sharing options...
burt Posted June 7, 2019 Share Posted June 7, 2019 Yeah I've made hundreds of mods over the years. Oh well. Link to comment Share on other sites More sharing options...
SCH_001 Posted June 7, 2019 Share Posted June 7, 2019 So I know this is more a php programming question but how do I add some white space between the two below boxes. I have tried adding in a few different places in the above code but been unable to get the desired results Link to comment Share on other sites More sharing options...
♥JcMagpie Posted June 7, 2019 Share Posted June 7, 2019 Not sure how you managed that as it should be like this, which version are you using BS3 or BS4? or just pm your code. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.