OpenCart search function isn't working correctly - opencart

I'm having some problems with the search function in OpenCart 1.5.4. Today, I added a product with meta tags, keywords, attributes, etc. All of the things I filled in could be searched for. So if I had a product called "A", with a keyword of "B" I could search for B and get product A as a search result.
However, I just added a new product with its own meta tags, keywords, attributes and so on, but now the search isn't working correctly anymore. I can only search for the product name, if I search on a keyword or tag, nothing is shown and I get the result that no products could be found.
I have deleted these two products, so there are no products now. I've added a new product, but still I can only search for its name. What is happening here?

The default search patterns on opencart are quite restrictive and they require that you use the same case. So if you search for a product with a tag of "Gold" howeve the search script will switch the case of all your searches on tags to lower case. I agree this is quite irritating and I am trying to build a workaround myself to ignore the case.
The problem stems to the model where the search is being performed LCASE is used during the MATCH MySQL command, this means it will not find any mixed case tags etc.
Hope that helps

Related

How to create a search functionality that searches for ingredients when the user searches for a meal?

I am trying to create a project in Django which allows users to see a list of images of the ingredients when they search for a particular meal, but I am not sure how I would start this project.
I can see that there are some apis available, however, I intend to create this from scratch.
For example, if the user enters lasagne the images displayed will be the ingredients of lasagne so the pastry, minced meat etc.
You can use a search engine such as Elasticsearch which will index your data and give you an optimized search solution.
If you don't intend on using a search engine, you can have a look at Field lookups (such as exact, contains, etc)in django which help you find model objects on the basis of the text you type in
Link of django docs:
https://docs.djangoproject.com/en/2.1/ref/models/querysets/#field-lookups

sitecore 7 multi datasource field

I have a treelist field that I want to set the datasource to 3 folders p.e.:
/sitecore/Website/News/
/sitecore/Website/Events/
/sitecore/Website/Articles/
Under the website item there are more "folders".
I've searched and spent few hours trying different approaches but none seemed to work.
Is this possible? Do I need to extend the field?
Thank you in advance
A while back I wrote a blog post about the different ways you can control the Datasource of your multilist and treelist fields (with and without search). The third technique listed for fields with search is what I think you are looking for:
Search in two or more places of the content tree (Fields with Search):
StartSearchLocation={110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}&Filter=_path:110d559fdea542ea9c1c8a5df7e70ef9|_path:3d6658d8a0bf4e75b3e2d050fabcf4e1
For your implementation:
StartSearchLocation={Website.ID}&Filter=_path:[News.ID (guid form; no brackets)]|_path:[Events.ID (guid form; no brackets)]|_path:[Articles.ID (guid form; no brackets)]
Search in two or more places of the content tree (Fields without Search):
If you are using a Multilist field (without search) then I would do the following:
DataSource=/path/to/source/1|/path/to/source/2
For your implementation:
DataSource=/sitecore/website/news|/sitecore/website/events|/sitecore/website/articles
I would also add that the Treelist with Search field has been deprecated in later versions of Sitecore 7, so if that is the field that you are using then I advise changing to the Multilist with Search field. If you are using a standard Treelist field, then Ahmed's answer may be viable as well, depending on your use case.
Let me know if you have any questions. Good luck, and happy coding! :)
You can use IncludeTemplatesForDisplay parameter to filter the items based on templates:
DataSource=/Sitecore/Content/Home&IncludeTemplatesForDisplay=News Folder,News,Event Folder,Event
IncludeTemplatesForDisplay parameter accepts comma separated templates names, you might need to include parent folder templates names too so that it appear in treelist.
Hope this helps

Sitecore - How to search by field in multilist with search?

I've made a field "Multilist with Search" in my solution. The point of this field is to add related articles to an article. I have set a source similar to this:
TemplateFilter={TemplateID}&StartSearchLocation=query:/path/to/list/of/items
I want make a search that finds a certain field value. For example, if I want to find the articleId on the searched article. Is there built-in support for this in Sitecore 7.2?
Is it possible to make a search like articleID:706453?
I guess it's not the most easiest solution you're looking for, but you can extend IDataSource in your code and use the type as value in the Source-textbox for the field you want to use it for. With IDataSource you just return an array of items that will be use for your field. You can query whatever item you want.
See the article from John West on the Sitecore blog: http://www.sitecore.net/nederland/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2013/09/Sitecore-7-Custom-Classes-as-Data-Template-Field-Sources.aspx
Otherwise you can try this:
StartSearchLocation=query:/path/to/list/of/items/*[#articleID = '123']
Note that Sitecore queries can be slow.

Assigning Joomla Search Module to Search Specific Pages

On my Joomla site I have a search module that searches through the whole site. I would like to create a user-guide section within my website and add a secondary search function to search ONLY the pages I have created for the user-guide.
I thought maybe I could assign article id's to a search module but I can't see a way to do this.
Any help would be appreciated.
I am not sure if there is a setting for this but I can't remember it being there. You can look for an extension that supports category selection or you can customize the standard module by checking if the results come from a specific category, if not then you don't show them. Hope this gets you on your way.

How can I create a google-analytics profile that will include stuff that matches ANY (not ALL) of my filters?

I have a test profile in my google analytics account, and ultimately I'd like that profile to include all of the following:
all requests to the test.mydomain.com subdomain
all requests that include "test.mydomain.com" somewhere in the URI
all events that include "test.mydomain.com" somewhere in the category
I had originally tried creating 3 filters on that profile (one for each of the above), but it appears that google-analytics profiles only include things that match ALL filters.
I tried using an advanced filter to combine the above 3 items together into one field, so that I could then just search that field using a regex, but I'm not having much luck... Here's what I have so far:
Filter 1:
which should result in "|test|test" being placed into Custom Field 1 (assuming I had "test.mydomain.com" somewhere in the event category and "test.mydomain.com" as the Hostname)
Filter 2:
which should result in "|test|test|test|" being placed into Custom Field 2 (assuming I had "test.mydomain.com" somewhere in the Request URI).
Filter 3:
which should make it so my profile includes all items where "|test|" appears somewhere in Custom Field 2.
Unfortunately, that's not working, as my test profile is always empty. My "include everything" profile is showing that my requests are coming through and that the do include "test.mydomain.com". I've tried other variations of the above filters, such as setting my advanced-filter regular expressions to ".*", so that they simply concatenate the full Category, Hostname, and Request URI together into Custom Field 2 and then adjusting filter 3 accordingly, but still nothing comes through on that profile. I understand that changes made to profiles can sometimes take a couple of hours to start showing up (https://support.google.com/analytics/answer/1638635?hl=en), but my test filters have been set up for days, so Google should have applied them by now.
Does anyone have an idea what I might be doing wrong? Am I just misunderstanding how the advanced filter works?
Does anyone know of a way to inspect the value of "Custom Field 1" and/or "Custom Field 2" so I can see if those are being built correctly?
You can accomplish this with 4 filters (3 advanced, 1 include). If any of the requirements are satisfied, write "ok" in one of the custom fields. Then do an include on that custom field that matches "ok".
filter 1 - advanced
field a - hostname
extract a - test.mydomain.com
output to - custom field 1
constructor - ok
Use the above concept for the remaining 2 conditions. Then do an include on custom field 1 = ok
I found the issue. The technique that I outlined in my original question, or the technique suggested by Andy should work fine. The problem in my specific example is that google-analytics filters do not have full support for regular expressions. In particular, they do not support the positive lookahead in my example. The other part of my issue was that I sometimes wasn't waiting long enough before testing my profile changes (google can sometimes take a few hours before applying the changes).
To see what regex options google does support, see https://support.google.com/analytics/answer/1034324?hl=en. I originally thought that page was a "getting started with regular expressions" page, but, apparently, that might be all of the regex language that google supports.
If you are unsure if there are parts of your regex that google doesn't support, you can test it on the google-analytics site directly, and in realtime on live data (without waiting for google to apply your profile changes), by navigating to Content > Site Content > All Pages in your Profile, then click on "Advanced" at the top of the "Primary Dimension" table, then change the match type to "Matching RegExp" (see https://support.google.com/analytics/answer/2936903?hl=en). There you can enter in your regex, and if google doesn't support part of your regex, it will tell you immediately when you click "Apply" (not sure why they don't include that regex validation on their profile filter page...). You will also be able to see it immediately filter the content of that table.