How to keep 'search filters checks' active after changing between different categories - ajax

I'm trying to maintain the "search_filters / facets_search_wrapper" status of the checks after changing between categories, for exemple, when the user selects "size: L" and changes the category to t-shirts, keep the "size:L" check active.
I've been thinking of saving some part of the URL that identifies the selected search filters, but I don't manage to find any solution for this.
Any ideas?
Thanks for your time!

Don't use any URL parameters, think about using Local Storage where you can filter out results on DOMReady, or you can use cookies and alter results with PHP.
Facet module is completely different in PrestaShop 1.7, there i'd suggest to use cookie method, if you are working on 1.6 tho, i'd go for a JS solution.

Related

Set a Kibana dashboard filter through the url

I created a Kibana dashboard, containing some visualization. I can successfully embed the dashboard using the provided url:
{url}/app/kibana#/dashboard/{dashboard_uuid}?embed=true&_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-1y,mode:quick,to:now))
Now, I would like to have any user of my app to see this dashboard, filtered in order to only see their data. The filter query that I need is very simple, because all the data contains a field user_id.
An example: For the user with identifier $id, I want to load the dashboard with the filter user_id:$id
In there a way to set the filter through the url? I see there are some parameters already (refreshInterval, time..) but I couldn't find the proper documentation. Any ideas?
Using Kibana 6.2.2 and ElasticSearch 6.6.0
I tried setting the filters through the _a parameter, as explained here: https://discuss.elastic.co/t/dashboard-search-parameter-via-url/84385 without success.
{url}/app/kibana#/dashboard/{dashboard_uuid}?
embed=true&
_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-1y,mode:quick,to:now))&
_a=(filters:!(),query:(querystring:(query: "user_id:1")))
I stumbled upon this while looking for a solution to a slightly similar question. I figured I would share two options that I have gotten to [mostly] work, but either should do what you are looking for.
URL With Variable Set to Application State:
../app/dashboards#/view/{dashboard_uuid}?_a=(filters:!((query:(match_phrase:(user_id:$id)))))
Using this method, the filter is not "pinned", so if you have another link on your landing dashboard, the filter will not remain if you click that link. However, your other global state settings (timeframe, etc.) do remain.
URL With Variable Set to Global State:
../app/dashboards#/view/{dashboard_uuid}?_g=(filters:!((query:(match_phrase:(user_id:$id)))))
Using this method, the filter is "pinned" and remains throughout additional clicks. However, this URL will overwrite all your other global state settings (timeframe, etc.).
This is where I am. I would like the filter to remain pinned, but if I have a time filter set as well, clicking this link will unfortunately default to the timepicker:timeDefaults setting in Kibana.
I still have not found a solution to my issue, but I hope this answers the original question; or perhaps help someone else that stumbles here (seeing as how this thread is very old now).

Presta Accessing Products before addToCart

In Presta 1.6 there was the possibility to use the JS ajaxCart Object to add ajax functions to alter your products before they are appended to the Cart. I am trying to rediscover such an ability in Presta 1.7 where apparently the ajaxCart Object is no longer defined.
Unfortunately I do not have code or anything to show, I simply would need to know whether there is a proper way now, a hook or anything, to modify your products before adding them to the Cart?
If there is no proper way, I would also be thankful for improper ways. Did the ajaxCart Object get a different scope? Was it replaced by another mechanism? Unfortunately I did not succeed a whole lot in reverse engineering the changed.

custom routing in magento

I have multi store views in website,
The current URL for a category for the dutch store view would be;
http://www.domain.ext/nl/category.html,
http://www.domain.ext/de/category.html etc
Now I want to add country code with store code. I mean to say, I am getting country code from Users Ip and want to extend it with store code. It will be look like
If the country is set to NL the URL should now be;
http://www.domain.ext/nl_nl/category.html
If the storeview is Dutch (NL) but the country is Belgium (BE), the URL should become;
http://www.domain.ext/nl_bel/category.html
I want this only in category page. I am trying to change in match function of standard.php, but I think its role starts from controller name, please help me how can I achieve it. Any help is highly appreciated.
Are you sure you want to incorporate it into the URL like that?
I think you are going to fight a lot of Magento code to achieve it (product url, catalog url, indexing, getUrl functions and collections, rewrites).
I'm sure you have considered this and the many ways to do what you want but I think you are making work for yourself. Perhaps adding the country code as a URL query string ?c=bel or keeping it all internal to Magento by storing it in a session variable or a general function that you can call at any time eg getCustomCountryCode(). Using a cookie might be a possibility too.
If the URL is purely cosmetic then perhaps an .htaccess rewrite would suffice combined with some rel='canonical' href="http://www.domain.ext/nl_bel/category.html" on the category pages.
If you are determined to proceed then study the class Mage_Catalog_Model_Url

SEO Friendly exposed filter view Drupal 7

Currently url display like this
news/?tid=telecom
I need to alias
news/telecom
using clean URL its works in all pages but in view exposed filters not worked
Have you tried views contextual filters to solve your problem?
You can also solve it using contextual filter. You can use taxonomy term names with this filter by adjusting Specify validation criteria settings. please see this answer Drupal 7 views contextual filters taxonomy name
Currently, it's my belief that the only generic way to solve this issue is either manipulating the URLs at the httpd layer, or using hook_url_inbound_alter and hook_url_outbound_alter. You can read a bit more about the mentioned hooks at this question.
However, if I were to give this another shoot myself, I would attempt a Views specific solution instead, as this problem is common enough that it could be justified to have a module for this.
In hook_views_pre_build, one could take data from a url like "members/valuea/valueb", push these values into $_GET['q'], let views build it's query seeing the get arguments "in the url", then possibly remove them again in hook_views_post_build.
I hope this will help you.

CakePHP session data cleared on paginator sort

My session data is being saved in my form as expected.
However, when I run a sort on any column of my results, my form session values are cleared.
I am calling in my search form through en element as it's used on specific locations of the site.
Does anyone know why pagination is clearing out my session? Is this standard Cake?
The paginator sort elements are simply a link generated by the paginator and won't consider any of your form data. The first thing you need to make sure that you're doing is tell the paginator to include any URL paramters for the current page in the url it generates. Put this anywhere in the view before you call any of the $paginator functions.
$paginator->options(array('url' => $this->passedArgs));
Secondly, make sure that your search parameters are being included in the URL. It sounds like they probably aren't. I just answered another question on the best practices of search result URLs here: CakePHP Search Results Best Practices
I solved this:
CakePHP session ID path or other method to share the results of a url - recommendations welcome

Resources