New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loaded only one page and stop v.3 #362
Comments
Did you also update the pagination element? That’s what IAS is using to load the next page. |
Yes, I did. I want to send a new url with category_id to the pagination element . |
And when I clicked on the category button the page counter must be 0 |
I`m confused :-) |
I generate pagination element in the Opencart controller and send it to the view. $pagination = new Pagination();
$pagination->total = $productCount;
$pagination->page = $page;
$pagination->limit = $limit;
$pagination->url = $this->url->link('common/home', $url . '&page={page}');
$data['pagination'] = $pagination->render(); |
And got products from category via JQuery $.get |
I only see you replacing the products, not the pagination element. If you change the cateogory, the next page url should also be changed, right? |
Yes, it is. Category_id must be added to the url via &. |
I take a category_id from data-categoryId in the category anchor tag: <a href="<?php echo $category['category_url']; ?>"
class="category__link"
data-categoryId="<?php echo $category['category_id']; ?>"
>
<?php echo $category['name']; ?>
</a> And pass it to the $.get |
And products block has two states:
In both cases, the script should work. |
Here is such a task :-) |
Do you have any idea? |
No sorry, just that you need to update the pagination after the |
Ok. Thank you for all. |
Hello.
I use the script v. 3 and Opencart.
I have pagination with products when the page loads normally. Your script works fine and everything looks good.
I also have several categories anchor tags with category_id in "href".
My html code:
When I click on the button, the data is sent and I get the products of the desired category. Then I insert this data into the div:
All looking good.
But when I scroll down the page bellow, the items I have uploaded are deleted. In their place are loaded products from the second page. And the script stops.
My code is:
Where did I go wrong?
The text was updated successfully, but these errors were encountered: