How to search after input value that must be between two feature values in prestashop? - prestashop

To understand it fully I will give a clear example:
Our webshop sells zip ties. Every zip ties can be tightened between a minimum and a maximum diameter. For example say from 0.5" to 2".
In most of the cases the buyer needs a zip tie for a specific needed diameter. What we need is to have a possibility to get an input for the needed diameter and list all the zip ties where this input is between the minimum and maximum diameter.
I have tried different variations with layered navigation but it can not be done with it.
Any help is welcome.

You need to customize blocklayered module, some tips:
let's imagine in shop each product have 2 different features "min diameter" and "max diameter" and you already created filter for them, checkboxes.
hide these blocks by display:none
add in template input field for the actual diameter value.
after customer's input, select all min/max checkboxes that satisfy the condition
call blocklayered method to send the filters.

Related

Shopware API search products endpoint total from a stream inconsistent

I have two dynamic product groups
First: Test Product with variants
Conditions: Product Is equal to Variant product
Result total 7 like I expect this
Second: Active Products
Conditions: Active yes
we allready see that the stream ids are just set to 5 products
Now we get a total of 5 instead of 15 products like expected?
Why is it inconsistent, and how can I modify my request to consider also the variants?
You shouldn't rely on the stream_ids column as an indicator which product is shown in a dynamic product group at any given moment. This is because there are multiple more things that factor into whether a product is shown to a user in a dynamic product group.
The filters you define for the group resolve to an SQL query, which in simplified terms would yield something like WHERE active = 1 AND id IN ('...', '...'). So the stream_ids column isn't used to select the contents of a group, but the entire query including all filters is executed in the storefront request. The result of that query is what you see in the preview of the dynamic product group.
Why doesn't it correlate completely with the content of stream_ids?
Shopware features inheritance of fields. If fields of a variant haven't been assigned a value, they may inherit that value from their parents. This may not be reflected in the contents of stream_ids. In fact the children/variants may even inherit the contents of stream_ids.
Then there's the fact that contents of the product group may vary, depending on the current sales channel. That may be because the sales channel features a different language, hence the content of a translatable field used in a filter may vary. Also if you use price filters, there is the possibility of products with multiple prices, which might only be shown if certain conditions are met, defined by the rule builder.
In short, don't count on the stream_ids, which can't reflect all these variables but are used in some capacity internally, for invalidating caches and such. Instead use the preview to judge what the average user might find when they see a product group. There's also the possibility to choose which sales channel the preview should apply to, for the exact reason, that contents may differ depending on the sales channel.

How do I add an attribute outside of combinations?

I have such a case:
I created appropriate combinations of attributes, assigned prices to them. However, I need to add another attribute that will simply add a discount to calculated price. How to do this? I don't want to add other combinations because I would have to modify many newcombinations and prices manually. I would like to make it simply possible to choose one additional attribute which will give a percentage discount to the calculated price. Is it possible?
If I understand correctly, I think that you can use a catalog rule. Catalog rules are defined under:
Discount rules -> Catalog rules
Maybe they are named exactly differently because I donĀ“t use Prestashop in English and I am translating from another language. Once there you need to create a new rule using the plus ("+") sign at the top right. Once at the rule creation, use "Add a new group condition" at the bottom. There you may choose product characteristics to fire the rule. Remember to click on the "+" at the right to add the condition before saving.

How to see absolute values instead of percents on Events graphs?

I use custom events for tracking statistics about some deprecated modules are used by users. And I`ll want to remove migrations from deprecated module to a new one when amount of usages will be lower a "waterline".
So, it is not enough convenient to track it via clicking on a date on a graph and check amount of events at the date. Could I somehow switch a type of values on a graph to absolute values?
Mike from Fabric here. For the graphs, we will either show the percentage if the custom attribute is a string or the 25th, median and 75th percentiles if the custom attribute is a number. However, the top 10 custom attribute count will be present below the graph.

Tableau: Display Different Number Formats for the Same Measure

I have a field in my dashboard called outcome that displays the performance results for a doctor's office for multiple measures. A majority of the outcome values are rates and should be displayed as percentages. Unfortunately, there are two outcomes, "Utilization Management: Measure 3" and "Utilization Management: Measure 5" that are NOT rates, but actually number values.
Is there a way to display the outcome field in my table so that all 'Measures' that are NOT "Utilization Management: Measure 3" or "Utilization Management: Measure 5" get displayed as percentages, while the two aforementioned measures are displayed as number values?
Please do not get hung up on the appropriateness of combining rate and number values in the same field, as I've tried to have that conversation with my customer...they are insistent on this display ability and will not let it through UAT without it. Thanks.
Same question posed and packaged workbook attached for reference here.
One approach is to define a string valued calculated field that makes the number format part of the calculation logic. This solution does not play well with Measure Names and Measure Values, since you can't put string valued measures on the Measure Values shelf. But you can still build the view your customer wants, with a little effort.
First create a static set based on your field [Measure] (confusing choice of field name, by the way. You have a dimension named Measure.). Call it [Percentage Measures] and check off the ones you want displayed as percentages.
Then for each of your numeric measure fields that you want treated this way, make a corresponding calculated field that looks something like:
if attr([Percentage Measures]) then
str(round(sum([outcome]) * 100, 2)) + "%"
else
str(round(sum([outcome]),3))
end
This approach assumes you will use your calculation on views where your dimension named [Measure] is on some (non-filter) shelf. Adjust the round() function arguments as desired
I took a look at your workbook. It seems that it is not possible to dynamically format values. There is a feature idea here: https://community.tableau.com/ideas/1411 which I believe would allow you to do what you want.

Elastic Search, Nest. functional sorting

I'm building a filter page, with facets etc, which works as it should.
Now the our customer has a request to, basically "Be able to decide which sorting the items comes out in".
Each product is decorated with a Product Display Order, and is in a Product Line.
We got these example Product Display Orders:
1. Featured Item
2. Core Item
3. Spare Part
4. Utility
And these Product Lines:
1. Hammers
2. Saw
3. Wood
and the sorting is like this:
Sorting should firstly be based on Product Display Orders, secondly by product lines, thirdly Alphabetically.
So all products which is a Featured Item is listed first, and all these Featured Items is then sorted by their product line, and if some product are in the same Featured Item and Product Line, then its alphabetically.
The challenge is: I can't just get the sorting of Product Display order items and product lines as a number on the product, i only got a name/id.
We've thought of Boosting based on if the product are in the different categories, but it seems a bit messy.
OR
See if it possible to have some logic in the Sorting.
Sort by productDisplayOrder:
1. featured, 2. core Item ...
Then by ProductLines:
1. Hammers, 2. Saw ...
Then by Name DESC.
Which way is the best way to have this sorting, is it possible to give this logic to elastic, if it is a match and then sort it. Or are we needed to twist the boosts of product?
Hopefully this makes sense for you.
Thanks in advance! :)
Option 1). Quickest/Best performing solution would be to create new/separate integer fields for productDisplayOrder and ProductLine and then use those in your sort criteria as described (after reindexing and validating the the data is indexed as expected).
Option 2) If you want more nuance than described (eg higher scoring matches can 'break through' the ordering ceiling described) then you can explore using a Function Score Query to implement a custom scoring strategy that takes productDisplayOrder and ProductLine into consideration in generating an overall match score.
Option 3). If you can't change the mapping and reindexing your data, you can use Script-Based Sorting to generate sorting values from the currently indexed productDisplayOrder/ProductLine text using a script (eg Groovy). Keep in mind that query performance will be worse than the first two options.