minishop2 sorting
Hi guys,
I'm using a minishop2 for one of my projects and I'm trying to make a sorting of the products by date and price (newest and oldest and cheapest and expensive).
I'm using the following code with the gerURLParam extra:
and pdoPage:
Thank you in advance!
Deyan
I'm using a minishop2 for one of my projects and I'm trying to make a sorting of the products by date and price (newest and oldest and cheapest and expensive).
I'm using the following code with the gerURLParam extra:
<div class="products-sorting">
<select name="sortby" id="sortby" onChange="window.location.href=this.value">
<option value="[[~[[*id]]]]&date=desc">Sort by:</option>
<option value="[[~[[*id]]]]&date=desc">Date: new to old</option>
<option value="[[~[[*id]]]]&date=asc">Date: old to new</option>
[[- <option value="[[~[[*id]]]]&price=asc">Price: Low to high</option>
<option value="[[~[[*id]]]]&price=desc">Price: High to low</option>]]
</select>
</div>
<ul>
[[!msProducts?
&sortby=`{
"price":"[[!getUrlParam? &name=`price`]]",
"publishedon":"[[!getUrlParam? &name=`date`]]"
}`]]
</ul>
</div>
and pdoPage:
[[!pdoPage?
&element=`msProducts`
&tplPageWrapper=`@INLINE <div class="catalog-pagination"><ul>[[+first]][[+prev]][[+pages]][[+next]][[+last]]</ul></div>`
&tplPageFirst=`@INLINE <li class="control"><a href="[[+href]]">«</a></li>`
&tplPageFirstEmpty=`@INLINE <li class="control"><span>«</span></li>`
&tplPageLast=`@INLINE <li class="control"><a href="[[+href]]">»</a></li>`
&tplPageLastEmpty=`@INLINE <li class="control"><span>»</span></li>`
&tplPageNext=`@INLINE <li class="control"><a href="[[+href]]">></a></li>`
&tplPageNextEmpty=`@INLINE <li class="disabled"><span>></span></li>`
&tplPagePrev=`@INLINE <li class="control"><a href="[[+href]]"><</a></li>`
&tplPagePrevEmpty=`@INLINE <li class="disabled"><span><</span></li>`
&limit=`8`
&pageLimit=`3`
&sortby=`{
"publishedon":"[[!getUrlParam? &name=`date`]]",
"price":"[[!getUrlParam? &name=`price`]]"}`
]]
But there is almost nothing happens. First of all and most ipomrtant is the products to be shown based on the newest products by default when you open the page/s. After that to select and sort them by price or date from the dropdown option menu. At the moment there is a possibility only to select and show the results based on the date option after the user choose it from the options menu. Am I missing something or doing something wrong? Did somebody know how to make it working? Thank you in advance!
Deyan
Комментарии: 3
You need to use links like
And then specify its values to snippet call
If you are using pdoTools 2.0+, you can use fastField tags:
Also you can buy mSearch2 that has its own filtering and sorting system — see demo.
[[~[[*id]]]]&sort=date&dir=desc
And then specify its values to snippet call
[[!msProducts?
&sortby=`[[!getUrlParam? &name=`sort`]]`
&sortdir=`[[!getUrlParam? &name=`dir`]]`
&showLog=`1`
]]
If you are using pdoTools 2.0+, you can use fastField tags:
[[!msProducts?
&sortby=`[[!#get.sort:default=`publishedon`]]`
&sortdir=`[[!#get.dir:default=`desc`]]`
&showLog=`1`
]]
Documentation on russian.Also you can buy mSearch2 that has its own filtering and sorting system — see demo.
OK, thank you!
It works if I'm using fastField tags — the products are showed by default from newest to oldest.
But when I'm using
Could not process query, error #1054: Unknown column 'date' in 'order clause'
It works if I'm using fastField tags — the products are showed by default from newest to oldest.
But when I'm using
[[!msProducts?
&sortby=`[[!#get.sort:default=`publishedon`]]`
&sortdir=`[[!#get.dir:default=`desc`]]`
&showLog=`1`
]]
<select name="sortby" id="sortby" onChange="window.location.href=this.value">
<option value="[[~[[*id]]]]&sort=date&dir=desc">Sort by:</option>
<option value="[[~[[*id]]]]&sort=date&dir=desc">Date: new to old</option>
<option value="[[~[[*id]]]]&sort=date&dir=asc">Date: old to new</option>
<option value="[[~[[*id]]]]&sort=price&dir=asc">Price: low to high</option>
<option value="[[~[[*id]]]]&sort=price&dir=desc">Price: high to low</option>
</select>
the price sorting is working ok and the products are sorted correctly. When I choose some of the date options — newest to oldest or vice versa there is nothing showed, no products — just a white empty screen and the following log:Could not process query, error #1054: Unknown column 'date' in 'order clause'
Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.