Using a migx tv to filter with msproducts

Hello,

I am currently developing an e-commerce multi site. I need to filter out products base on its territory. To filter out products, I have created a migx tv named product_prices which has a listbox tv that contain all of the territories where the product maybe available e.g country 1==c1||country 2 ==c2||country 3 ==c3, etc. Also I have 2 date tvs, Deal start date & Deal end date (with date and time options) within this migx, so I can filter out special deal products when a territory has a promotion. I've tried using the code below but nothing happens
[[!msProducts?
    &parents=`[[*id]]`
    &paginator=`pdoPageWrapper@naturesdiscount`
    &element=`msProducts`
    &class=`msProduct`
    &sortold=`ms|price:desc`
    &sort=`resource|menuindex:asc`
    &limit=`3`
    &tplOuter=`nd.tpl.mFilter2.outer`
    &tpl=`nd.tpl.msProducts.row`
    &tplFirst=`nd.Firsttpl.msProducts.row` 
    &tpl_n3=`nd.Thirdtpl.msProducts.row` 
    &tplLast=`nd.Lasttpl.msProducts.row`
    &includeThumbs=`246x246`
    &includeTVs=`store_deals`
    &where=`{"store_deals:find_in_set":"%[[!+storeCountry.code]]%","deal_end_date:>":"[[!current_time]]"}`
]]
My migx tv


Any suggestions as to how to solve this?
Jevon Boyce
03 june 2019, 23:22
27
0

Comments: 4

Василий Наумкин
04 june 2019, 07:44
0
You need to understand how MIGX stores data in database before you could filter it by &where.
    Jevon Boyce
    04 june 2019, 21:31
    0
    It is stored in JSON format. Here is an example from the database

    [{"MIGX_id":"1","store_countries":"bb","dealstartdate":"2019-05-01 00:00:00","dealenddate":"2019-05-31 23:45:00","published":"1"}]
      Jevon Boyce
      04 june 2019, 21:33
      0
      Is there any docs that shows all of the possible operators for the where clause?
      Василий Наумкин
      04 june 2019, 22:30
      0
      I don't think that store all values in one JSON TV is good idea for filtering resource.

      Maybe it would better to split it to 3 separate TVs or miniShop2 options.
Log in or sign in to make new comments.