T
T
Timur Kalimullin2015-06-19 20:05:16
1C-Bitrix
Timur Kalimullin, 2015-06-19 20:05:16

How to correctly create a rule for filter variables in urlrewrite.php 1C Bitrix?

Good afternoon,
using urlrewrite.php in 1C Bitrix, I'm trying to set up the CNC for filter parameters, now the url
looks
like
: balkon_da/ploshad_ot_0_do_12/esheget/get2/get3/...
There can be n number of these variables passed from the filter form.
Is it possible to write a condition that will receive values ​​for variables depending on their presence in the url?
Do not carry a huge tail of all possible parameters:

array(
  "CONDITION" => "#^/filter/tip_([a-zA-Z0-9\\-\\_]+)/etag_([a-zA-Z0-9\\-\\_]+)/balkon_([a-zA-Z0-9\\-\\_]+)\\?*(.*?)$#", // ...итд
  "RULE" => "type=\$1&etag=\$2&balkon=/$3", // ..итд
  "ID" => "",
  "PATH" => "/filter/index.php",
),

Or do I still need to write my own rule for each case? ...
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2015-06-20
Madzhugin @Suntechnic

the goal is to get the form
?tip_prodaga/etag_2/balkon_da/ploshad_ot_0_do_12/esheget/get2/get3/...

What for? If this path is still a parameter, then what is the point in all these body movements?
In general, how many times the discussion of such things came up, the same number of times it was possible to convince the customer not to engage in nonsense. He's a filter for that and a filter.
Well, if it still fails, then I will support Pavel Bezrukov - pass this entire path into one variable, and parse this tip_prodaga/etag_2/balkon_da/ploshad_ot_0_do_12/ already in PHP runtime. It's simpler, more convenient, and won't burden the rewrite with a bunch of complicated rules, which, due to their length, will end up at the beginning of your urlrewrite and will be checked on every hit.

P
Pavel Bezrukov, 2015-06-19
@bezrukovPS

Try like this

Array(
"CONDITION" => "#^/filter/tip_([a-zA-Z0-9-_]+)/etag_([a-zA-Z0-9-_]+)/balkon_([a-zA-Z0-9-_]+)#", // ...итд
  "RULE" => "type=\$1&etag=\$2&balkon=\$3", // ...итд
  "ID" => "bitrix:catalog.smart.filter",
  "PATH" => "/filter/index.php",
),
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question