Magento Expert Forum - Improve your Magento experience
-
Pagination problem: Same pages showing differents products and order
Hi everyone,
This is my first post in the forum, I have a problem with our Magento site related with pagination:
1. We have created a custom date attribute for our catalog products
2. The pagination is configured to sort the elements by default using the custom date attribute in descending mode.
3. Accessing to the section/page with pagination, when you change the pages you can see that for the same page Magento does not show the same elements in the same order.
For example, you navigate to page 4 and see the results, change to page 3 and then change back to page 4 and the elements and order are not he same than the first time.
I have tried the following solutions with no success:
1. Checked in System-->Catalog-->FrontEnd the two checks for use plain catalog category and use plain catalog article (with no effect after reindexing).
2. Tried to create an event catalog_product_collection_load_before in order to add a second sort condition when the collection is obtained, but not sure if its working or not (the pagination still working in the same way):
- /var/www/magento/app/etc/modules/Encamina_Ordenacion.xml:
<?xml version="1.0"?>
<config>
<modules>
<Encamina_Ordenacion>
<codePool>local</codePool>
<active>true</active>
<depends>
<Mage_Catalog />
</depends>
</Encamina_Ordenacion>
</modules>
</config>
- /var/www/magento/app/code/local/Encamina/Ordenacion/etc/config.xml:
<?xml version="1.0"?>
<config>
<modules>
<Encamina_Ordenacion>
<version>1.0.0</version>
</Encamina_Ordenacion>
</modules>
<global>
<models>
<encamina_ordenacion>
<class>Encamina_Ordenacion_Model</class>
</encamina_ordenacion>
</models>
</global>
<adminhtml>
<events>
<catalog_product_collection_load_before><!-- observe the event -->
<observers>
<encamina_ordenacion>
<class>encamina_ordenacion/observer</class>
<method>agregarParametroOrdenacion</method>
</encamina_ordenacion>
</observers>
</catalog_product_collection_load_before>
</events>
</adminhtml>
</config>
- /var/www/magento/app/code/local/Encamina/Ordenacion/Model/Observer.php:
<?php
class Encamina_Ordenacion_Model_Observer {
public function agregarParametroOrdenacion($observer) {
$observer->getCollection()->addAttributeToSort('sku', 'desc');
}
}
?>
Not sure if everything for the event is correct, any help withs this or any additional option to solve the problem will be appreciated.
Thanks in advance.
Best regards.
View more threads in the same category:
- Portable rv air conditioner
- Transforming Karachi's Skylines with Fiber Shades
- Unveiling the Power of E911 Solutions Enhancing Caller Identification
- List of Top 10 Interior Designers in Pakistan
- buy registered drivers license online(legitcleandocs.com)passport,IELTS certific
- Malaysia Visit Visa from Dubai
- Buy Passport,Driver License,Age & ID Card,(Whatsapp:.......: +1 (551) 239-2904) Visas
- 슬롯사이트 추천 - 인터넷슬롯링크 2024 best 온라인슬롯
- Buy Passport,Driver License,Age & ID Card,(Whatsapp:.......: +1 (551) 239-2904) Visas
- Buy Passport,Driver License,Age & ID Card,Visas and Undetected Counterfeit Money. Ema
-
-
Adding a second sort parameter in the Toolbar.php file seems to solve the problem.
public function setCollection($collection)
{
$this->_collection = $collection;
$this->_collection->setCurPage($this->getCurrentPage());
// we need to set pagination only if passed value integer and more that 0
$limit = (int)$this->getLimit();
if ($limit) {
$this->_collection->setPageSize($limit);
}
if ($this->getCurrentOrder()) {
$this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
$this->_collection->setOrder('sku', 'desc');
}
return $this;
}
-
-
Randomizing the request of the returned posts in a WordPress inquiry is simple returned arbitrarily by and by and you get an altogether unique arrangement of posts. In the wake of having this issue various occasions myself I chose to discover a route around it. so it utilizes a similar irregular request on each ensuing page load.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks