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
Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
And then specify its values to snippet call
If you are using pdoTools 2.0+, you can use fastField tags:
Documentation on russian.
Also you can buy mSearch2 that has its own filtering and sorting system — see demo.
It works if I'm using fastField tags — the products are showed by default from newest to oldest.
But when I'm using
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'
You must use «createdon» or «publishedon» field.