Custom attribute search suggestions - intershop

We have a requirement to retrieve 3 kinds of search suggestions:
Product suggestions
Category suggestions
Brand suggestions
Its important to note here that the brand suggestions should come from a custom attribute named Brand.
So far we have tried 2 different approaches, both unsuccessful for different reasons:
Approach 1 - SF Object Suggest Search
By using the SF Object Suggest Search we almost got what we needed. The product and category suggestions are working as expected. The problem lies with the brand suggestions. According to the documentation the brand suggestions come from the ManufacturerName attribute:
The brand suggestions are collected from the ManufacturerName index attribute of the SFProductSearch index.
Besides it being a very bad practice from Intershop to name something Brand whilst it is actually the ManufacturerName our real problem with this is that
all our products have a custom attribute named Brand which specifies the brand, and we use the default ManufacturerName field for the actual manufacturer of the product.
What we would like to achieve is that the brand suggestions are collected from the Brand index attribute of the SFProductSearch index instead of from the ManufacturerName index attribute.
The documentation also specifies that one of the downsides of the SFObjectSuggestSearch is that it has:
A limited hard-coded set of supported attributes
This made us believe that it will never be possible to modify the SFObjectSuggestSearch in such a way that it behaves in the way we want. So we tried approach 2.
Approach 2 - SFProduct Search Suggest
By using the SFProduct Search Suggest and adding the autosuggest attributes to the SFProductSearch product index we are able to retrieve all the attributes we need.
The downside of this approach is however that all SolrSuggestResultItem objects that are created have the type of Unspecified, which makes it impossible for us to group the products, categories and brands together in a nice way.
The documentation on this point is extremely poor/vague as it reads:
The custom values in the suggest index at search index configuration
level can configure custom values with the prefix SuggestType_
followed by a type.
So we suspect we have to do something with SuggestType_ but we can't seem to figure it out. The search index configuration options in the backoffice don't seem to provide anything like it. As a last resort we also tried to make the changes directly into the ISH-Config.xml but any changes in these files are overridden every time the search index is build.
Summary
Approach 1 is unsuccessful since it suggests manufacturers instead of brands.
Approach 2 is unsuccessful since the returned SolrSuggestResultItems all have a type of Unspecified.
Is there any way to get this working with either of these approaches? At this point we don't have a preference for approach 1 or 2, so a solution for either one, or guidance towards a more suitable approach, would be greatly appreciated.

To answer my own question:
After some experimentation we got it to work by making a modification to approach 1.
Inside the ISH-Config.xml we changed this:
<custom-value name="ObjectSuggestType_brand" type="string">
<value>ManufacturerName</value>
</custom-value>
To this:
<custom-value name="ObjectSuggestType_brand" type="string">
<value>Brand</value>
</custom-value>
With this configuration the brand suggestions are now collected from the Brand index attribute of the SFProductSearch index instead of from the ManufacturerName index attribute.
By redeploying the server directly after making this change the configuration won't be overridden when you make changes to the SF Object Suggest Search later on.

Related

woocommerce - large number of variations for a variable product

I have a variable product with 3 attributes. The total number of variations generated is 900. This will make the admin page incredibly slow and hard to work with, so I need to find a workaround. I thought about replacing the dynamically generated dropdowns(for attribute values) with static ones, but the shopping cart expects to receive a variation number, which is non-existent in this case. I'd also like to mention that the variations are identical in all parameters, besides the attributes. How can I solve this?
Thanks.

How to remove/hide all Google Analytics data associated with a specific page?

For about a week, Google Analytics was erroneously reporting page views for a few request URIs, severely skewing my data. I have read that there is no way to remove data once it is reported. If this is the case, is there a way to simply hide this data from the view?
I have tried a number of things (such as creating global filters, view filters, etc.) to no avail. Using segments also doesn't work, because apparently you can only filter out visits/users (whereas my goal is to filter out page views associated with a specific page). At this point, I feel like I must be going about it the totally wrong way...
Below is a screenshot of the Behavior > Overview section. The page views I want to move are #1, #2, and #5.
Alex, unfortunately, there is nothing you can do about the historical data.
However, you can use simple filter to exclude pages you don't want to see (the filter field above the report table, not filters related to account/profiles) -- see the attached screen below.
Make sure you select exclude and then pick Page dimension. The easiest way would be to use regular expressions, like:
(a|b|c)
This one would remove any pages that contain either "a", or "b" or "c".
The expression would be probably a bit more complicated in your case and I suggest using tools like RegEx Hero (free, online). I am not sure if there is anything common for the pages you would like to remove from the reports, but regular expression can do quite a lot :).
One last thing -- be aware there is a slight difference in segments and (table) filters. If you use segments for page dimension, you would end up with ALL the pages that were seen during a visit, which includes the page you set in the segment. Might be a bit confusing, but see this article for detailed explanation.

Filter out nodes that refer to a specific kind of node

I have a node type (reviews) that uses CCK to refer to another kind of node (either books or videos). Is there a way for me to use Views so that I can show only Reviews of Books or only Reviews of Videos?
I've tried creating a Relationship in the View and using a parameter, but that doesn't seem to work.
Are you using a CCK node reference field? If so this documentation may help get you started: http://drupal.org/node/289738
I was able to get my client to agree to a change, so that each node gets a radio button to mark what kind of review it is. That means that users will have to select the book/video and then say which type it is, but they are college-educated and hopefully this won't be beyond them.
So then I can add the review type into my Filters, and show only book reviews or video reviews that way. I suspect that my initial question is impossible without a lot of hacking.
You can do this with Views 3, which may not be a solution for you at all. :/
You add a required relationship based on your node reference, and then add a filter on node type of book/movie. The filter's 'Use relationship' should be set to the required relationship you set up previously.

Drupal vote_up_down module reporting incorrect points

I am working on a project using Drupal 6 (6.11 at the moment, haven't yet upgraded to 6.12) and part of the core functionality is the ability to vote on nodes. I'm having some rather weird behaviour that has taken me an age to track down and now I have, I still can't fix it.
This is what I've managed to figure out so far:
The template file sites/default/modules/vote_up_down/theme/vote_up_down_points.tpl.php automatically calls the function template_preprocess_vote_up_down_points() from vote_up_down.module.
vote_up_down.module then queries the database using the values stored in the $variables array that is passed to it
On only one of the 3 occasions this is called on a typical node (in this case forum posts) $variables doesn't have a value for $variables['cid'].
That one occasion is when it reads the score so as to display it below the post itself. And, instead of locating the current post's score, it locates the first-ever-voted-on post's score. (This is because instead of returning the score of one post, it returns the score of all posts and then uses the first one from the list).
I am assuming that $variables is a system-wide constant (looking at the content of it using print_r seems to confirm that) and so perhaps this is a core bug as it should always be the same. I checked the contents of $variables and the only 4 parts of around 50 that are different in the one that doesn't work are: cid - blank, tag - blank (although this is discovered by the function and correctly substituted as 'vote'), zebra - even & id - 2. I imagine the last 2 are not really important for this, so the key must be in why $variables['cid'] is not being passed through.
So, my questions are:
Has anyone had this problem before and how did you fix it?
If not, do you have any tips as to how I can figure out why this is not working correctly?
I can't tell you the answer, but you'll probably have better luck posting this in the module's issue queue, since then the maintainer and others using it will see it.
I can't believe I didn't try this before, but I just upgraded to the latest development snapshot of vote_up_down and the problem went away. A 2 minute fix in the end vs about 6 hours of trying to tie the problem down.
Lesson learnt!

How to display only taxonomy terms with nodes associated to in Views 2?

I've created a view with a set filters exposed (to show filtering options in the page). And one of those filters is a select field with all the taxonomy terms of a vocabulary.
That's ok, it's showing now. But I want to only show the taxonomy terms that have at least one node associated to it. To avoid empty results if selects an empty term.
Anyone knows how to do that?
Thanks.
Solution in views 3 (which may work in views 2)
Set a relationship for the view to join the terms to the nodes (in views 3 this is 'Taxonomy term: Content with term')
Then in the options tick 'Require this relationship' (this excludes terms without any nodes)
This may produce duplicates, in views 3 you open up Query settings, and tick Distinct (this will omit duplicates)
This would be a great feature for Views to have and you should submit a feature request to the maintainers for it. Unfortunately you can't do this with the existing Views code.
\What you could do, though, is see how Views constructs a filter control in its own source code, and implement that function yourself and add in an extra check to see if there are any posts with that term or not, and not display that term if there aren't any.
This is a simpler way. Hope it helps.
Add a relationship, filter for terms and choose "Taxonomy term: Representative node". Check the "require this relationship" and thats it. Optionally tick "Query settings > Distinct" in case of duplicate terms.
Based on http://www.waldbeek.com/blog/view-taxonomy-term-and-hide-empty-terms
With views 3 this gets very simple using aggregation! I'm posting this replay because I spent a lot of time discovering it. Everything is very well explained in this screencast: http://dev.nodeone.se/en/the-aggregation-setting-the-emmajane-episode

Resources