Hotclutch Posted April 23, 2015 Share Posted April 23, 2015 Hi All Does anybody know why the order of page and sort parameters on products_new.php are the other way around from index.php (categories)? Where is this set, and is there a quick fix to reverse the order they appear in? products_new.php?sort=5d&page=4 category-c-17.html?page=2&sort=2a Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted April 23, 2015 Share Posted April 23, 2015 If you just want the same listing, you can use this code for products_new.php <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_NEW); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW)); require(DIR_WS_INCLUDES . 'template_top.php'); ?> <!-- body_text //--> <h1> <?php echo BOX_HEADING_WHATS_NEW; ?></h1> <?php $listing_sql1 = "select distinct p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " .TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_id = p2c.products_id and c.categories_id = p2c.categories_id and products_status = '1'"; $listing_sql = $listing_sql1 . " order by p.products_id DESC"; include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?> <!-- body_text_eof //--> <?php require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt Link to comment Share on other sites More sharing options...
burt Posted April 23, 2015 Share Posted April 23, 2015 Does anybody know why the order of page and sort parameters on products_new.php are the other way around from index.php (categories)? Where is this set, and is there a quick fix to reverse the order they appear in? What is the reason for wanting the parameters in a particular way ? Link to comment Share on other sites More sharing options...
Hotclutch Posted April 23, 2015 Author Share Posted April 23, 2015 If you just want the same listing, you can use this code for products_new.php <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_NEW); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW)); require(DIR_WS_INCLUDES . 'template_top.php'); ?> <!-- body_text //--> <h1> <?php echo BOX_HEADING_WHATS_NEW; ?></h1> <?php $listing_sql1 = "select distinct p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " .TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_id = p2c.products_id and c.categories_id = p2c.categories_id and products_status = '1'"; $listing_sql = $listing_sql1 . " order by p.products_id DESC"; include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?> <!-- body_text_eof //--> <?php require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Thank you, i am going to try it out. @@burt I am running a redirect script, where i want to redirect $redirects['products_new.php?sort=5d&page=1'] = 'products_new.php'; unfortunately that will also redirect products_new.php?sort=5d&page=11 or products_new.php?sort=5d&page=12 to products_new.php. If the order of the parametes are reversed then there's no problem. Link to comment Share on other sites More sharing options...
burt Posted April 23, 2015 Share Posted April 23, 2015 Never rely on something in this way.. I am running a redirect script, where i want to redirect $redirects['products_new.php?sort=5d&page=1'] = 'products_new.php'; Extend the logic: $page = 'products_new.php?page=1&sort=5d'; // try these as well //$page = 'products_new.php?sort=5d&page=1'; //$page = 'products_new.php?page=1&sort=5d&a=1&b=2&c=3&widget=blue'; parse_str(parse_url($page, PHP_URL_QUERY), $end_array); echo ( ($end_array['sort'] == '5d') && ($end_array['page'] == '1') ) ? "match" : "no match"; Link to comment Share on other sites More sharing options...
Hotclutch Posted April 23, 2015 Author Share Posted April 23, 2015 Never rely on something in this way.. Extend the logic: $page = 'products_new.php?page=1&sort=5d'; // try these as well //$page = 'products_new.php?sort=5d&page=1'; //$page = 'products_new.php?page=1&sort=5d&a=1&b=2&c=3&widget=blue'; parse_str(parse_url($page, PHP_URL_QUERY), $end_array); echo ( ($end_array['sort'] == '5d') && ($end_array['page'] == '1') ) ? "match" : "no match"; Thanks for the tip. Link to comment Share on other sites More sharing options...
MrPhil Posted April 25, 2015 Share Posted April 25, 2015 I agree with @@burt. While page= and sort= should have the same effect on PHP no matter what order they're given in (PHP literally doesn't know what order the $_GET elements were given), that can create a problem if you write code that somehow depends upon that order in the Query String. Avoid that at all costs, by picking apart the Query String and examining its components individually. Link to comment Share on other sites More sharing options...
Hotclutch Posted April 25, 2015 Author Share Posted April 25, 2015 The effect is the same from a coding point of view, from a SEO point of view they are 2 different URLs. On products_new.php and advanced_search_result.php, sort parameter comes before page parameter, but then you have the drop down sort box that reverses the order. Would still like to know why that does not happen on index.php (categories). I am thinking somewhere in split_page_results.php maybe? Link to comment Share on other sites More sharing options...
MrPhil Posted April 25, 2015 Share Posted April 25, 2015 Any SEO that considers a Query String fragment sort=5d&page=1 to be any different from page=1&sort=5d is horribly wrong. I hope Google isn't doing this! Link to comment Share on other sites More sharing options...
Hotclutch Posted April 25, 2015 Author Share Posted April 25, 2015 http://googlewebmastercentral.blogspot.com/2008/09/demystifying-duplicate-content-penalty.html "Like www.example.com/skates.asp?color=black&brand=riedell and www.example.com/skates.asp?brand=riedell&color=black. Having this type of duplicate content on your site can potentially affect your site's performance, but it doesn't cause penalties." There's no penalty as such, but the performance of your site may well suffer if your script links inconsistently like that. Link to comment Share on other sites More sharing options...
MrPhil Posted April 25, 2015 Share Posted April 25, 2015 According to the article, Google considers the two to be duplicates, as they point to the same content. They will usually try to pick just one or the other to show in search results. I'm not sure what we're arguing about... Link to comment Share on other sites More sharing options...
Hotclutch Posted April 26, 2015 Author Share Posted April 26, 2015 Any SEO that considers a Query String fragment sort=5d&page=1 to be any different from page=1&sort=5d is horribly wrong. I hope Google isn't doing this! You're saying these 2 URLs are the same, despite the order of the parameters? Link to comment Share on other sites More sharing options...
MrPhil Posted April 26, 2015 Share Posted April 26, 2015 Logically they are the same. Any system which considers them different because of the parameter order, is defective. In a Query String, the order of the parameters is immaterial. What counts is the order in which you process the allowed parameters within your code, in case they have overlapping domains. The article quoted says they are the same (duplicates). Link to comment Share on other sites More sharing options...
Hotclutch Posted April 26, 2015 Author Share Posted April 26, 2015 From a coding point of view, yes they are the same. Google makes attempts to handle that, but the article makes it clear that you may have performance issues as a result, and that it results in crawling inefficiencies. The correct way to handle it is to link consistently throughout your 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.