diff --git a/UPGRADE.md b/UPGRADE.md index 777134a219f..5572ddfaf3e 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -9,7 +9,7 @@ In this document you will find a changelog of the important changes related to t * Deprecation: The Database Column impressions in s_articles_details in now deprecated. Please use the s_statistics_article_impression table. * `Shopware_Components_Plugin_Bootstrap` now has a `addFormTranslations()` method to facilitate translations creation for forms. * Removed view variables `sOrders` and `sNotes` from `/engine/Shopware/Controllers/Frontend/Account.php` index action -* The method `sGetOpenOrderData` in `/engine/core/class/sAdmin.php` returns now a different array structure and will accept new optional parameters +* The methods `sGetOpenOrderData` and `sGetDownloads` in `/engine/core/class/sAdmin.php` will now return a different array structure and will accept new optional parameters to provide a pager functionality * Added X-Sendfile support for ESD downloads. `redirectDownload` configuration variable is now deprecated, `esdDownloadStrategy` should be used instead * Deprecation: `/engine/Shopware/Models/Payment/Repository.php:` `getPaymentsQuery` and `getPaymentsQueryBuilder` use `getActivePaymentsQuery` and `getActivePaymentsQueryBuilder` instead. diff --git a/engine/Shopware/Controllers/Frontend/Account.php b/engine/Shopware/Controllers/Frontend/Account.php index 396fda3193a..c6377a74de1 100644 --- a/engine/Shopware/Controllers/Frontend/Account.php +++ b/engine/Shopware/Controllers/Frontend/Account.php @@ -175,7 +175,12 @@ public function ordersAction() */ public function downloadsAction() { - $this->View()->sDownloads = $this->admin->sGetDownloads(); + $destinationPage = (int)$this->Request()->sPage; + $orderData = $this->admin->sGetDownloads($destinationPage); + $this->View()->sDownloads = $orderData["orderData"]; + $this->View()->sNumberPages = $orderData["numberOfPages"]; + $this->View()->sPages = $orderData["pages"]; + //this has to be assigned here because the config method in smarty can't handle array structures $this->View()->sDownloadAvailablePaymentStatus = Shopware()->Config()->get('downloadAvailablePaymentStatus'); } diff --git a/engine/core/class/sAdmin.php b/engine/core/class/sAdmin.php index ae1180813a5..a03b1761938 100755 --- a/engine/core/class/sAdmin.php +++ b/engine/core/class/sAdmin.php @@ -2060,19 +2060,18 @@ public function sSaveRegister($paymentObject=null) } - - - /** * Account - get purchased instant downloads * @access public + * @param int $destinationPage + * @param int $perPage * @return array - Data from orders who contains instant downloads */ - public function sGetDownloads() + public function sGetDownloads($destinationPage = 1, $perPage = 10) { $getOrders = $this->sSYSTEM->sDB_CONNECTION->GetAll(" SELECT id, ordernumber, invoice_amount, invoice_amount_net, invoice_shipping, invoice_shipping_net, DATE_FORMAT(ordertime,'%d.%m.%Y %H:%i') AS datum, status,cleared, comment - FROM s_order WHERE userID=? AND s_order.status>=0 ORDER BY ordertime DESC LIMIT 10 + FROM s_order WHERE userID=? AND s_order.status>=0 ORDER BY ordertime DESC LIMIT 500 ",array($this->sSYSTEM->_SESSION["sUserId"])); foreach ($getOrders as $orderKey => $orderValue) { @@ -2111,7 +2110,6 @@ public function sGetDownloads() $getOrderDetails[$orderDetailsKey]["serial"] = implode(",",$numbers); // Building download-link $getOrderDetails[$orderDetailsKey]["esdLink"] = $this->sSYSTEM->sCONFIG["sBASEFILE"].'?sViewport=account&sAction=download&esdID='.$orderDetailsValue['id']; - //$getOrderDetails[$orderDetailsKey]["esdLink"] = "http://".$this->sSYSTEM->sCONFIG["sBASEPATH"]."/engine/core/php/loadesd.php?id=".$orderDetailsValue["id"]; } else { unset($getOrderDetails[$orderDetailsKey]); } @@ -2127,7 +2125,14 @@ public function sGetDownloads() $getOrders = Enlight()->Events()->filter('Shopware_Modules_Admin_GetDownloads_FilterResult', $getOrders, array('subject'=>$this,'id'=>$this->sSYSTEM->_SESSION["sUserId"])); - return $getOrders; + // Make Array with page-structure to render in template + $numberOfPages = ceil(count($getOrders) / $perPage); + $offset = ($destinationPage - 1) * $perPage; + $orderData["orderData"] = array_slice($getOrders, $offset, $perPage, true); + $orderData["numberOfPages"] = $numberOfPages; + $orderData["pages"] = $this->getPagerStructure($destinationPage, $numberOfPages); + + return $orderData; } @@ -2275,6 +2280,7 @@ public function sGetOpenOrderData($destinationPage = 1, $perPage = 10) */ public function getPagerStructure($destinationPage, $numberOfPages, $additionalParams = array()) { + $destinationPage = !empty($destinationPage) ? $destinationPage : 1; $pagesStructure = array(); $baseFile = $this->sSYSTEM->sCONFIG['sBASEFILE']; if ($numberOfPages > 1) { diff --git a/templates/_default/frontend/account/downloads.tpl b/templates/_default/frontend/account/downloads.tpl index 42e3efd2b6d..a0c869c7cd0 100644 --- a/templates/_default/frontend/account/downloads.tpl +++ b/templates/_default/frontend/account/downloads.tpl @@ -93,6 +93,43 @@ {/if} {/foreach} {/foreach} + +
 
+ + {block name='frontend_account_downloads_actions_paging'} + {if $sPages.numbers|@count > 1} +
+
+
+ + + {if $sPages.previous} + + {/if} + + {foreach from=$sPages.numbers item=page} + {if $page.markup} + {$page.value} + {else} + + {$page.value} + + {/if} + {/foreach} + + {if $sPages.next} + {s name="ListingTextNext"}>{/s} + {/if} +
+
+ {se name="ListingTextSite"}Seite{/se} {if $sPage}{$sPage}{else}1{/if} {se name="ListingTextFrom"}von{/se} {$sNumberPages} +
+
+
+ {/if} + {/block} {/if} diff --git a/templates/_emotion/frontend/_resources/styles/emotion.css b/templates/_emotion/frontend/_resources/styles/emotion.css index 86f072c8b3e..613c777c750 100755 --- a/templates/_emotion/frontend/_resources/styles/emotion.css +++ b/templates/_emotion/frontend/_resources/styles/emotion.css @@ -364,8 +364,8 @@ div.orderdata_box div, #newsletterfrm, #frmRegister {background-color: #f7f7f7;} #content div.inner .change_shipping div.alternative_shipping, #content div.inner .change_billing .shipping_address {border-color: #dfdfdf;} #content .orders .orderoverview_active .lastrow {border-color: #dfdfdf;} #content .orders .orderoverview_active .table_foot p.bold, #content .orders .orderoverview_active .table_foot div p {color:#333;} -#content .orders .listing_actions {width: 760px; padding-left: 10px; padding-right: 10px;} -#content .orders .listing_actions .bottom {border-top: none;} +#content .orders .listing_actions, #content .downloads .listing_actions {width: 760px; padding-left: 10px; padding-right: 10px;} +#content .orders .listing_actions .bottom, #content .downloads .listing_actions .bottom {border-top: none;} .addresses .inner_container, .addresses .inner_container .select_billing, .addresses .inner_container .select_shipping, .account .password .inner_container {border-color: #dfdfdf;} .password .outer {border-color: #dfdfdf;}