Skip to content

Commit

Permalink
Merge branch 'esd-20/fixed-reload-download-remaining-page' into 'master'
Browse files Browse the repository at this point in the history
ESD-20 - Fixed reload download remaining page

See merge request shape-and-shift/plugins/shopware-esd!19
  • Loading branch information
ChristopherDosin committed Nov 23, 2020
2 parents ea9f64a + e1bfade commit f2f3466
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 24 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG_de-DE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.2.9
* Das Neuladen der verbleibenden Download-Daten in Shopware >= v6.3.2.0 wurde behoben. Der verbleibende Download kann aktualisiert werden, nachdem Sie auf "Jetzt herunterladen" geklickt haben

# 1.2.8
* Ein Hotfix zum Senden der Download-E-Mail in der Shopware version 6.3.3.0 wurde erstellt

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG_en-GB.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.2.9
* Fixed reload the remaining download data on Shopware >= v6.3.2.0, can update the remaining download after click download now

# 1.2.8
* Made a hotfix to send the download email on Shopware version 6.3.3.0

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description":"ESD / Download plugin",
"type":"shopware-platform-plugin",
"keywords": ["esd", "download"],
"version":"1.2.8",
"version":"1.2.9",
"license":"proprietary",
"authors":[
{
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/app/storefront/dist/storefront/js/sas-esd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Plugin from 'src/plugin-system/plugin.class';
import StoreApiClient from 'src/service/store-api-client.service';
import HttpClient from 'src/service/http-client.service';

export default class EsdDownloadRemaining extends Plugin {

Expand All @@ -9,7 +9,7 @@ export default class EsdDownloadRemaining extends Plugin {
};

init() {
this.client = new StoreApiClient();
this.client = new HttpClient();
this._registerEvents();
}

Expand Down
1 change: 0 additions & 1 deletion src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
<argument type="service" id="sas_product_esd_order.repository"/>
<argument type="service" id="Sas\Esd\Service\EsdService"/>
<argument type="service" id="Sas\Esd\Service\EsdDownloadService"/>
<argument type="service" id="Shopware\Core\Framework\Store\Services\StoreService" />
</service>

<service id="Sas\Esd\Storefront\Controller\StreamDownloadController" public="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
<div class="account-esd-downloads">
{% sw_include '@Storefront/storefront/page/account/downloads/table.html.twig' with {
esdOrders: esdOrders,
downloadLimits: downloadLimits,
isReloadData: isReloadData
downloadLimits: downloadLimits
} %}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</td>
<td>
{% if esdOrder.esd.esdMedia|length %}
<a class="btn btn-primary {% if isDisabledDownload %}disabled{% else %} {% if isReloadData %}js-esd-download-selector{% endif %}{% endif %}"
<a class="btn btn-primary {% if isDisabledDownload %}disabled{% else %} js-esd-download-selector{% endif %}"
href="{{ url('frontend.sas.esd.download', {esdOrderId: esdOrder.id}) }}">
{{ "sasEsd.account.downloadTable.downloadButton"|trans|sw_sanitize }}
</a>
Expand Down
17 changes: 1 addition & 16 deletions src/Storefront/Controller/DownloadsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
use Shopware\Core\Framework\Routing\Annotation\RouteScope;
use Shopware\Core\Framework\Store\Services\StoreService;
use Shopware\Core\Framework\Uuid\Uuid;
use Shopware\Core\PlatformRequest;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Shopware\Storefront\Controller\StorefrontController;
Expand Down Expand Up @@ -37,21 +36,14 @@ class DownloadsController extends StorefrontController
*/
private $esdDownloadService;

/**
* @var StoreService
*/
private $storeService;

public function __construct(
EntityRepositoryInterface $esdOrderRepository,
EsdService $esdService,
EsdDownloadService $esdDownloadService,
StoreService $storeService
EsdDownloadService $esdDownloadService
) {
$this->esdOrderRepository = $esdOrderRepository;
$this->esdService = $esdService;
$this->esdDownloadService = $esdDownloadService;
$this->storeService = $storeService;
}

/**
Expand All @@ -66,18 +58,11 @@ public function getAccountDownloads(SalesChannelContext $context): Response
/** @var EsdOrderCollection $esdOrdersCollection */
$esdOrdersCollection = $esdOrders->getEntities();

$isReloadData = true;
$shopwareVersion = $this->storeService->getShopwareVersion();
if ($shopwareVersion >= '6.3.2.0' && $shopwareVersion < '6.3.3.0') {
$isReloadData = false;
}

return $this->renderStorefront(
'storefront/page/account/downloads/index.html.twig',
[
'esdOrders' => $esdOrders,
'downloadLimits' => $this->esdDownloadService->getLimitDownloadNumberList($esdOrdersCollection),
'isReloadData' => $isReloadData
]
);
}
Expand Down

0 comments on commit f2f3466

Please sign in to comment.