View Issue Details

IDProjectCategoryView StatusLast Update
0006697OXID eShop (all versions)1.08. Listmania, Notice list, Gift registrypublic2024-04-15 19:33
Reportermichael_keiluweit Assigned To 
PrioritylowSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version4.10.5 / 5.3.5 
Summary0006697: Order overview shows no pagination when using customer can buy in all shops with one account
DescriptionEnterprise Edition
(id 1) Supershop
 -- (id 2) Mastershop inherits all from Supershop
 -- (id 3) Mastershop inherits all from Supershop

The option is activated that a registered user in one of these shops can buy in any shop.

If the user buys 10 articles in shop id 2 and 15 articles in shop id 3, then he has overall 25 orders.

Opening the menue "my account -> my account" there is the submenue "Order history" it shows the amount of orders which made in this particular shop.
In case of shop id 2 the number is 10 and in case of the shop id 3 the number is 15.
By default, the shop adds a paginating, if there are more than 10 items in the list.

Opening the order overview in shop id 2, you will see the 10 orders from shop id 2.
Opening the order overview in shop id 3, you will see the 15 orders from shop id 3 on two pages. But! You will see a few orders from shop id 2. Exactly 5, because the second pages has space for 5 more items. But the pagination don't let you to jump to page 3, where the last 5 items would be listed.

The reason is simple:
The list is filled by a method which reads all orders from the customer.
The pagination is build by a method which counts all orders from the current shop id.

Now I'm not sure which scenario is buggy. Because the menue "my account -> my account" shows the number of orders from this one shop, but the order overview tries to list all orders from the customer.

In my opinion this should be configurable.
To be more clear: There should be an Enterprise Edition only option to configure, if the order overview should be build over all shops or with the currently active shop.
Steps To Reproduce1. Install EE 5.3
2. Admin -> Core Settings -> Mall -> Activate: Allow users from other shops.
3. Add a new shop as mastershop. Inherit all articles from parent (supershop).
4. Add a new shop as mastershop. Inherit all articles from parent (supershop).
5. order 10 times from shop 2.
6. order 15 times from shop 3.
7. Open shop 2, go to my account -> my account and see order overview. The current amount of orders is 10. Click the link to open the order overview. You will have no pagination.
8. Open shop 3, go to my account -> my account and see order overview. The current amount of orders is 15. Click the link to open the order overview. You will have a pagination and see 20 items over 2 pages.
Additional InformationIf all orders from all shops should be listed, the pagination needs to be set up with the correct amount of shops.
To realise this, there are two solutions:

\Account_Order::getOrderList

1.
\Account_Order::getOrderList
Search
    $this->_iAllArtCnt = $oUser->getOrderCount();
Replace with
    $this->_iAllArtCnt = $oUser->getOrders()->count();

Disadvantage: All orders are read again (which was made before to build the list), so it's not perfect regarding the performance. But the performance impact shouldn't be that huge.


2.
\Account_Order::getOrderList
Search
    $this->_iAllArtCnt = $oUser->getOrderCount();
Replace with
    $this->_iAllArtCnt = $oUser->getOrderCount(true);


\oxUser::getOrderCount

Search
    public function getOrderCount()
Replace with
    public function getOrderCount($blForAllShops = false)

Search
    $sQ = 'select count(*) from oxorder where oxuserid = ' . $oDb->quote($this->getId()) . ' AND oxorderdate >= ' . $oDb->quote($this->oxuser__oxregister->value) . ' and oxshopid = "' . $this->getConfig()->getShopId() . '" ';
Replace with
    if ($blForAllShops) {
        $sQ = 'select count(*) from oxorder where oxuserid = ' . $oDb->quote($this->getId()) . ' AND oxorderdate >= ' . $oDb->quote($this->oxuser__oxregister->value);
    } else {
        $sQ = 'select count(*) from oxorder where oxuserid = ' . $oDb->quote($this->getId()) . ' AND oxorderdate >= ' . $oDb->quote($this->oxuser__oxregister->value) . ' and oxshopid = "' . $this->getConfig()->getShopId() . '" ';
    }

Disadvantage: Duplicate code as for this the method \oxUser::getOrders does exactly this. But for this method there is currently a open decision. See the linked bug entry 0006652.



As I see, the methods are equivalent to version 6, the behavior should be the same.
TagsEnterprise, Multi Shop, Order List
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Relationships

related to 0006652 acknowledgedSven Brunk oxUser->getOrders() and oxUser->getOrderCount() - have different selects 

Activities

There are no notes attached to this issue.