Y
Y
Yaroslav Chinaski2017-10-15 18:07:10
MODX
Yaroslav Chinaski, 2017-10-15 18:07:10

Selecting elements through TV parameter, how to do on modx?

Hello!
I will try to be brief and state the essence of the problem correctly.
The structure of the site, approximately, looks like this:
Portfolio(23)

  • Category#2(28)
    • Item#1(24)
    • Item#2(25)
    • Item#3(26)
    • Item#4(27)
    • ...

  • Category#2(28)
    • Item#1(29)
    • Item#2(30)
    • Item#3(31)
    • ...

About Us(32)
Services(33)
Jobs(34)
Cities(35)
  • Moscow(36)
  • Kyiv(37)
  • Saint Petersburg(38)

...
Goods must be interconnected with the city, so that it can be filtered out. Solution: I created a tv-field with the select type, in the possible parameters I specified:
@EVAL return $modx->runSnippet('pdoResources',array('parents'=>35,'limit'=>10,'tpl'=>'@INLINE ==#648046#','outputSeparator'=>'||'));

Thanks to this simple manipulation, it became possible to select a city in the goods.
It is necessary that filtering by the TV field occurs, for example: I click on the link Kyiv (36) and it displays the first 10 products, and I need the product to be displayed only the one that has “Kyiv” in the parameters. Call template and field:

CityTemplate:
<div class="title_holder">
            <div class="container1">
                <div class="container_inner clearfix">
                    <div class="title_on_bottom_wrap">
                        <div class="title_on_bottom_holder">
                            <div class="title_on_bottom_holder_inner" >
                                <h1 style="color:#ffffff" ><span></span></h1>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<div class="wpb_row vc_row-fluid" style="text-align:left;">
    <section class="section  grid_section" style=" padding-top:50px; padding-bottom:60px;">
        <div class="section_inner clearfix">
            <div class="vc_span12 wpb_column column_container">
                <div class="wpb_wrapper">
                    <div class="wpb_row vc_row-fluid" style="text-align:left;">
<h2 style="color: #0570f9;"></h2>
<p><a class="lightbox" href=""><img style="width: 30%; float: right; margin: 0 0 0 100px;" src=""  width="245" height="245"></a></p>
<h3> </h3>
<p><a class="qbutton tiny checkout_form fastorder" style="margin-right: 25px;" href="">Посмотреть в портфолио </a><a class="qbutton tiny checkout_form fastorder" href="zakaz.html?data-name='Вы заказываете сайт'" data-fancybox-type="iframe"> Заказать такой сайт</a></p>
                    </div>
                </div> 
            </div> 
        </div>
    </section>
</div>

I hope for your help. If you have questions ask.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2017-10-19
@ig0r74

Something like this is needed
```

`` `

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question