Search products by price range, using default block search - prestashop

Did someone know what have I to do, to make a possible search products by price range? I know, that Block Layered can filter by it, but it only works in specified category.

You would have to:
1) Add extra input fields next to search box: from and to. The fields must be inside the form element. You can do this by overriding blocksearch.tpl in your theme.
2) Next, you should make override for classes/Search.php, method find(). You should modify SQL queries at line 252 (PS 1.6.0.11). Use Tools::getValue('from') to add extra SQL WHERE statement.

Related

Different parameter count in FORM and PERFORM

I am trying to add a formal parameter in the FORM and PERFORM in an existing code, as I will be need it the extra parameter in a new function that I have to call. The idea is that when executing the new code it keeps showing the error: Different parameter count in FORM and PERFORM (routine: CM_SHOW_CRC, number of formal parameters: 2, number of actual parameters: 3).
The code that I have for the form part is as follows:
FORM cm_show_crc
USING
civ_matnr TYPE matnr
civ_charg TYPE charg_d
civ_werks TYPE werks_d. "The parameter that I added
And the perform code is:
PERFORM cm_show_crc
USING
pis_sdow_alv-matnr
pis_sdow_alv-charg
pis_sdow_alv-werks. "The parameter that I added
The table pis_sdow_alv is type of a structure that also includes the variable WERK(Component type WERKS_D)
Before adding the new parameter WERK the code was working fine.
May anyone know what the problem in this part of the code may be?
There was also another similar question in: Different number of parameters in FORM and PERFORM, however I am not using the syntax CHANGING in my code, as it was also not used prior.
Please do tell me if you need additional information.
Thank you all in advance!
This problem can occur when FORM and PERFORM are in different includes and you only activate one but not the other.
When you activate an include, then it is checked against the active version of all other repository objects it depends on. Not the saved version. This can lead to an annoying catch-22 situation. You can not activate A because it does not match the previous version of B, and you can not activate B because it does not match the previous version of A.
The solution to this conundrum is to activate both objects together. When you activate something in SE80 and you have multiple inactive objects, you get a window where you can select multiple objects to activate together:
In Eclipse, you get a similar list by clicking on the "activate multiple" button:

Building a (process) variable in Appian using the value of another one?

As far as I understand, it is not possible in Appian to dynamically construct (process) variable names, just like you would do e.g. with bash using backticks like MY_OBJECT=pv!MY_CONS_`extract(valueOfPulldown)`. Is that correct? Is there a workaround?
I have set of Appian constants, let's call them MY_CONS_FOO, MY_CONS_BAR, MY_CONS_LALA, all of which are e.g. refering to an Appian data store entity. I would like to write an Appian expression rule which populates another variable MY_OBJECT of the same type (here: data store entity), depending e.g. of the options of a pull-down menu having the possible options stored in an array MY_CONS_OPTIONS looking as follows
FOO
BAR
LALA
I could of course build a lengthy case-structure which I have to maintain in addition to MY_CONS_OPTIONS, so I am searching for a more dynanmic approach using the extract() function depending on valueOfPulldown as the chosen value of the pulldown-menu.
Edit: Here the expression-rule (in pseudo-code) I want to avoid:
if (valueOfPulldown = 'FOO') then MY_OBJECT=pv!MY_CONS_FOO
if (valueOfPulldown = 'BAR') then MY_OBJECT=pv!MY_CONS_BAR
if (valueOfPulldown = 'LALA') then MY_OBJECT=pv!MY_CONS_LALA
The goal is to be able to change the data store entity via pulldown-menu.
This can help you find what is behind your constant.
fn!typeName(fn!typeOf(cons!YOUR_CONSTANT)).
Having in mind additional details I would do as follows:
Create separate expression that will combine details into list of Dictionary like below:
Expression results (er):
{
{dd_label: "label1", dd_value: 1, cons: "cons!YOUR_CONSTANT1" }
,{dd_label: "label2", dd_value: 2, cons: "cons!YOUR_CONSTANT2" }
}
on UI for your dropdown control use er.dd_label as choiceLabels and er.dd_value as choiceValues
when user selects value on Dropdown save dropdown value to some local variable and then use it to find your const by doing:
property( index(er, wherecontains(local!dropdownselectedvalue, tointeger(er.dd_value))), "cons")
returned value of step 3 is your constant
This might not be perfect as you still have to maintain your dictionary but you can avoid long if...else statements.
As a alternative have a look on Decisions Tables in Appian https://docs.appian.com/suite/help/21.1/Appian_Decisions.html

Putting the cursor in a specific place in a live template

I just wanted to know how you put a cursor in a specific place in a live template for IntelliJ
For example:
# $var$ is an insance of the $objectType$ class
assert isinstance($var$, $objectType$)$END$
What happens here is that your cursor gets dragged to $var$ in the comment string first and then to your other values inside assert. What I wanted to know is how you chose where the cursor goes first.
I've read the documentation, but this is not mentioned, although a lot of other things are.
You can arrange the order that your variables are visited in. You find the information under bullet number five in this IntelliJ help document: http://www.jetbrains.com/idea/webhelp/creating-and-editing-template-variables.html
To arrange variables in the order you want IntelliJ IDEA to switch between associated input fields, use the Move Up and Move Down buttons.
Edit
You have to update the macro definition to similar to this:
# $varComment$ is an insance of the $objectTypeComment$ class
assert isinstance($var$, $objectType$)$END$
And then you define the order and expression to something like this (I didn't have any good expression for the var and orderType for you):
Since you fill in the Skip if defined for the two comment variable they will just take the values from the var and orderType and fill it in. This will do exactly what you are looking for :-)

Filling parameter with value from Zeconfig_var table

I have the following selection parameter:
PARAMETERS: p_ver(2) AS LISTBOX VISIBLE LENGTH 5.
I would like to populate it with the results from a ZECONFIG_VAR table.
At what point would I do this. Selection Screen Output, Start of Selection, or other. I am trying to allow users the ability to decide what version of the web service they would like to call. The config table will have different url's for the different versions.
I have looked at this Answer and the tutorial provided does not make sense to me.
I would do it at the event INITIALIZATION
However, it may be even easier to just create a search-help, and assign it to p_ver using the following:
parameters: p_ver(2) visible lenghth 5 MATCHCODE OBJECT zshelpname.
Esti is right that you probably want to fill an internal table from the DB table during INITIALIZATION.
But to the populate the listbox parameter, you need to put the call to VRM_SET_VALUES in AT SELECTION-SCREEN OUTPUT.

Displaying/Formatting Tabular Data (web)

In my example I have a table where each row is a user for example. Columns could include their name, address, email address, etc. I now need to add a column for (hypothetical example) their cat's names. While most people will have no cats and some people will have 1- 2 cats there will be the occasional person with 20 cats that create one very long row in the table. This is giving me an issue in presentation and for filtering/searching for cat names. Is there a good solution to displaying this type of data?
Have the first 50 (or whatever) characters of the field displayed as normal then put the rest in a block with its visibility set to hidden through CSS. Include a link / button / icon that will allow the user to toggle the visibility so they can see the entire value.
Several options:
Set a maximum width for the cell and allow the data to wrap
Place the content inside a wrapper tag (such as a div) and set the div with a fixed width/height and style of overflow:hidden to ensure that a particularly long word doesn't force out the width of the cell.
Truncate the output text on the server side
For cases #2 and #3, set the Title attribute of the TD tag to contain the full non-truncated text. This will present itself as a tooltip when hovering over the cell.
I would mention other CSS-based solutions but they're very sparsely supported right now, so not worth mentioning.
You might want to try doing something like what SO does. Namely, once someone reaches a certain point in their Rep, it suffixes the number and appromixates it. Ex. 10k instead of 10,236.
That way the numbers don't get out of hand.