Prestashop pagination weird behaviour of previous button - javascript

im working on building shop with Presta,
I have problem with previous button in pagination at category page, it always adds something to href, it wouldn't be a problem but i wrote javascript to operate things like changing products per page or category filters by changing links.
Lets say my actual link is something like
localhost/index.php?id_category=10&controller=category?resultsPerPage=18&page=2
Normally previous button should have href to
localhost/index.php?id_category=10&controller=category?resultsPerPage=18
But in my case it has href to
localhost/index.php?id_category=10&controller=category?resultsPerPage=18y
I tried to make js script to slice last letter from href, but it just doesnt work, there's always something added to this href, letter isn't problem it just looks weird but site as far as i tested works fine, but if it is digit it can result in change properties of for example resultsPerPage. I wonder if its a problem with Pagination.php and its' link building method, because in my scripts i have nothing that could couse this problem, maybe anyone had same problem and knows any solution?

Related

Create an anchor without having it displayed in the url

So I have this page which has 3-4 anchors and whenever I click the button to jump to the section I want, the url should remain the same (without adding #anchor).
I googled this but I couldn't find anything that works and I'm still learning JS so I don't have the knowledge to do this.
Not sure what you mean, Perhaps you can edit your question to show us what you have already tried. Anchors are how the browser knows where to scroll to, if you want to achieve the same thing but without changing the anchor in the address bar you can try something like this on click:
elmnt.scrollIntoView();
See also: https://www.w3schools.com/jsref/met_element_scrollintoview.asp

Change an url on an image depending on something checked before

I am trying to make an E-commerce website. I'm using Wordpress/Woocomerce.
But the guy I am working for, wanted special pages with a really special design. So he asked me for something that I did.
But now the fact is that I have a problem with the attributes and adding it to the cart button.
So I'd like to find a way to change the url on the "add to cart" button, which is an image.
Is there anyway to make an url on a page ( not in the search bar, but in the code ) change if u check or uncheck something ?
Like a radio button or anything.
Also I'm looking for a cool way to keep the selected size white once I clicked on. Actually it's just an image with an invert effect on hover . And I just found a way to make all work with 1 page per size but it would be really could if I could change the link on the add to cart button change. I just dont know how to change it.
Here is the link : http://mtcdistrup.cluster003.ovh.net/black-onyx/
As you can see, if u click on S it loads another page and on the new page the add to cart button links straight to the good product.
I hope all is clear and that u can help me a bit.

Dynamic pagination button animations (jQuery)

I'm working on a project which involves creating a dynamic search bar which searches through a list of students and dynamically paginates the results (10 students per page):
https://github.com/KyleVassella/Dynamic-Paginated-Search/tree/page-button-animation-broken
I've succeeded in dynamically returning matched students and dynamically appending the correct number of page buttons based on the number of results.
My last requirement is include a simple animation when transitioning between pages. I'm stuck on this.
When you first load the page you'll find the search function works correctly - even clicking the pagination buttons animates like it should. But once you press one of the pagination buttons, the search function partially breaks (try searching something after you change pages). It still returns the correctly matched array of students (see the console.log and the appended page numbers), but some of the results seem to be invisible.
I believe the problem lies in my showArray2() function on line 50 (which contains my animation) or the fact that I called this function inside of a $(document).on(click) function on line 97 - not sure.
Perhaps I need to go about another way such as appending CSS classes - but I still can't figure out how to apply some sort of opacity change fadeout/fadein like I want with that method. Can you solve this using my current jQuery .animate() strategy and if not, what about a different way (CSS classes, etc)?
From a structural standpoint, I believe the issue has to do with you relying on a single allstudents students variable.
Each search needs to be treated as an independent collection, drawn from the true original set of all students.
That being said, I believe you are searching the entire collection when you're searching after paginating, but you need to reset the visibility state of the entire original collection of students upon the start of new search.
Your search is returning the correct results and writing them to the page, but they haven't had their visibility reset so that's why they're not showing up.
...also your git repo as it's currently structured doesn't work ;)

JQuery mobile: page links unreliable

Playing around with JQuery Mobile... demo example here (in Dutch, but it does not matter):
https://c9.io/pieter78/neurodss/workspace/noac/index.html
If you take the first item (dagibatran) and then the second item on the next page (elective ingrepen) the link does not work. However, if you go directly to the second page:
https://c9.io/pieter78/neurodss/workspace/noac/dagibatran.html
(or simply reload it if you came from the first page) it does work.
In IE I can see that if you click "dagibatran" on the first link, you end up on this URL:
https://c9.io/pieter78/neurodss/workspace/noac/index.html#/pieter78/neurodss/workspace/noac/dagibatran.html
I can understand that this does not work, but I do not understand why this happens. IMHO the code is correct.
Any suggestions?
This page shows the solution I was looking for:
http://jquerymobile.com/demos/1.0a4.1/docs/pages/link-formats.html
If you do Click me then I get the result I want. Otherwise the link will be considered as an AJAX request, and that gives a different experience.

Problem adding item to sortable list

I'm not entirely sure how to post this question, but here goes...
I have a web app that has a list of sortable items. I sort them ajax style using Sortable. That works like a charm. I can drag and drop the items till my heart is content.
At the same time, there is a button that allows for the creation of new items on my list. This is also ajaxified and works for the most part. The new item appears on my list anyway, and firebug shows that the code being rendered is exactly the same as the other list items. Oh and it is contained in the correct list.
The problem is that the new item is not draggable/sortable/whatever. I can't do anything with it unless I refresh the page. Any ideas why this is the case or how I can get around it? I'd really like to solve this.
I tried to paste code in here, but couldn't quite make it work, so I went with pastie. Anyway, here is the code for a page with 2 sortable items. This is a fresh load and everything works as expected.
http://pastie.org/432585
In this one, I have clicked the button that creates a new section, but not refreshed. So the first 2 sections are DnD-able, but the new one is not...
http://pastie.org/432591
I'm using ruby and rails to do the ajaxing here and admittedly, I'm not very familiar with how it should work. But I believe this behavior comes from prototype.js and maybe dragdrop.js.
On completion of the ajax call that causes the new element to be injected into the page, the new element, I imagine, needs to be bound to the DOM, and delared as a Sortable.
Would be great if you could show us some code, or at least let us know which library(s) you are using for ajax and Sortable elements.

Categories