Jump to content

[Resolved] Search Results Shown with apostrophe v6.0.8


Dirty Butter

Recommended Posts

I'm getting a backslash when I search for Carter's - I don't remember that happening previous to 6.0.8, but maybe it was doing it previously and I just didn't notice it.

Products found matching 'carter\'s'.

 Is this a case of incorrectly merging my code with 6.0.8?

cubecart.class.php

		if (isset($_REQUEST['search']) && is_array($_REQUEST['search'])) {
			if (!$GLOBALS['catalogue']->searchCatalogue($_REQUEST['search'], $page, $catalogue_products_per_page)) {
// BSMITHER ORIGINAL NOT FOUND SEARCH RESULTS REPLACED WITH "FOUND" CODE SO SEARCH ATTEMPT SHOWS FOR CUSTOMER
				//$GLOBALS['catalogue']->setCategory('cat_name', $GLOBALS['language']->navigation['search_results']);
$GLOBALS['catalogue']->setCategory('cat_name', sprintf($GLOBALS['language']->catalogue['notify_product_search'],$_REQUEST['search']['keywords']));
				$GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->common['search'], 'index.php?_a=search');
				$GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->navigation['search_results'], currentPage());
				$GLOBALS['gui']->setError($GLOBALS['language']->catalogue['error_search_no_results']);
			} else {
				$GLOBALS['catalogue']->setCategory('cat_name', sprintf($GLOBALS['language']->catalogue['notify_product_search'], htmlspecialchars($_REQUEST['search']['keywords'])));
				$GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->common['search'], 'index.php?_a=search');
				$GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->navigation['search_results'], currentPage());
			}

 

Edited by Dirty Butter
Link to comment
Share on other sites

You can try making this edit (in two places):

From just this part:

$_REQUEST['search']['keywords']

To:

stripslashes($_REQUEST['search']['keywords'])

I also think the first occurrence of this part:

catalogue['notify_product_search'],$_REQUEST['search']['keywords']));

should be like the code of the second part:

catalogue['notify_product_search'],htmlspecialchars($_REQUEST['search']['keywords'])));
Link to comment
Share on other sites

I had realized I needed to add the htmlspecialchars part, but had no idea how to add the stripslashes correctly. Thanks!

NOW

// BSMITHER ORIGINAL NOT FOUND SEARCH RESULTS REPLACED WITH "FOUND" CODE SO SEARCH ATTEMPT SHOWS FOR CUSTOMER
				//$GLOBALS['catalogue']->setCategory('cat_name', $GLOBALS['language']->navigation['search_results']);
$GLOBALS['catalogue']->setCategory('cat_name', sprintf($GLOBALS['language']->catalogue['notify_product_search'],$_REQUEST['search']['keywords']));
				$GLOBALS['catalogue']->setCategory('cat_name', sprintf($GLOBALS['language']->catalogue['notify_product_search'], htmlspecialchars(stripslashes($_REQUEST['search']['keywords']))));
				$GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->navigation['search_results'], currentPage());
				$GLOBALS['gui']->setError($GLOBALS['language']->catalogue['error_search_no_results']);
			} else {
				$GLOBALS['catalogue']->setCategory('cat_name', sprintf($GLOBALS['language']->catalogue['notify_product_search'], htmlspecialchars(stripslashes($_REQUEST['search']['keywords']))));
				$GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->common['search'], 'index.php?_a=search');
				$GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->navigation['search_results'], currentPage());
			}

May you have a wonderful 2016, @Bsmither !! You certainly deserve it!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...