Process Conditional Pagination
Permalink
I have some products as pages with their details in attribute. Using Page List and Pagination, search with ajax works fine. My problem occurred when filtering with product price. The products are for renting and according to the location, the price changes. The basic price is stored as an attribute and Rent is calculated by an equation depending on the location. All of these works fine. I use foreach loop to go through pages calculating the price and setting other details to be passed through ajax. The price filtering is done after price is calculated and the loop is skipped using continue. But when I do that those pages that I skip are taken into consideration when creating the pagination.
I'll Illustrate with an example:
I have 10 products returned satisfying all other conditions. First 3 of them are skipped since the price range is different. So if I have 5 results per page, the first page shows only two of them.
How can I solve this?
This is the PHP for ajax target
Any help would be appreciated... :)
I'll Illustrate with an example:
I have 10 products returned satisfying all other conditions. First 3 of them are skipped since the price range is different. So if I have 5 results per page, the first page shows only two of them.
How can I solve this?
This is the PHP for ajax target
$list = new PageList(); $list->setItemsPerPage(5); $list->sortByProductPrice(); $list->filterByPageTypeHandle('product'); //Get Location Express Object $location_object = Express::getEntry($_POST['location']); $location_value = $location_object->getFinderStandortValue(); $list->filterByLocation($location_value); //Get Stand Type Express Object $standartObject = Express::getEntry($_POST['type']); $list->filterByAttribute('standart_object', $_POST['type']); //Get Stand Size Express Object $standSizeObject = Express::getEntry($_POST['size']); $list->filterByAttribute('stand_size_object', $_POST['size']); //Stand Buy/Rent
Viewing 15 lines of 63 lines. View entire code block.
Any help would be appreciated... :)