Skip to content

Commit

Permalink
Merge pull request #28 from mageplaza/2.4-develop
Browse files Browse the repository at this point in the history
2.4 develop
  • Loading branch information
haitv282 authored Jul 6, 2022
2 parents cbad15c + f37f7eb commit 1d0ea4d
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 115 deletions.
18 changes: 17 additions & 1 deletion Controller/Index/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\Controller\Result\Redirect;
use Magento\Framework\Controller\ResultInterface;
use Magento\Framework\Exception\FileSystemException;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
use Mageplaza\ShareCart\Api\ShareCartRepositoryInterface;
use Mageplaza\ShareCart\Helper\Data;
use Mpdf\MpdfException;

/**
Expand All @@ -49,20 +51,28 @@ class Download extends Action
*/
protected $checkoutSession;

/**
* @var Data
*/
protected $helper;

/**
* Download constructor.
*
* @param Context $context
* @param ShareCartRepositoryInterface $printProcess
* @param Session $checkoutSession
* @param Data $helper
*/
public function __construct(
Context $context,
ShareCartRepositoryInterface $printProcess,
Session $checkoutSession
Session $checkoutSession,
Data $helper
) {
$this->printProcess = $printProcess;
$this->checkoutSession = $checkoutSession;
$this->helper = $helper;

parent::__construct($context);
}
Expand All @@ -76,6 +86,12 @@ public function __construct(
*/
public function execute()
{
/** @var Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
if (!$this->helper->isEnabled()) {
$this->messageManager->addErrorMessage(__('The Share Cart extension is disable'));
return $resultRedirect->setPath('checkout/cart');
}
$mpShareCartToken = $this->checkoutSession->getQuote()->getMpShareCartToken();

$this->printProcess->downloadPdf($mpShareCartToken);
Expand Down
2 changes: 1 addition & 1 deletion Model/Template/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function processTemplate()
$this->setUseAbsoluteLinks(true);
$html = $processor->setStoreId($storeId)
->setDesignParams([0])
->filter(__($this->getTemplateHtml()));
->filter((string)__($this->getTemplateHtml()));

if ($isDesignApplied) {
$this->cancelDesignConfig();
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"description": "Magento 2 Share Cart extension",
"type": "magento2-module",
"require": {
"mageplaza/module-core": "^1.4.5",
"mageplaza/module-core": "^1.4.12",
"mpdf/mpdf": "^7.1.0 | ^8.0.0"
},
"version": "4.0.3",
"version": "4.0.4",
"license": "proprietary",
"authors": [
{
Expand Down
9 changes: 4 additions & 5 deletions view/frontend/templates/cart/button.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@
</button>
<button data-bind="click:function(){}"
name="action_sharecart_link"
class="action_sharecart_link"
title="<?= $block->escapeHtml(__('Share Cart')) ?>"
class="download cart">
class="action_sharecart_link download cart"
title="<?= $block->escapeHtml(__('Share Cart')) ?>">
<span><?= /** @noEscape */ __('Share Cart') ?></span>
</button>
</script>
Expand All @@ -53,7 +52,7 @@
<?php if ($item->getProductType() === 'configurable'): ?>
<?= /** @noEscape */ ($item->getQty() . ' x ' .
$block->getNameConfigurable($item) . ' - ' .
$block->formatPrice($item->getBasePriceInclTax()))
$block->formatPrice($item->getBasePrice()))
?>
<?php endif; ?>
<?php if ($item->getParentItemId() && $block->checkConfigurableProduct($item)): ?>
Expand All @@ -62,7 +61,7 @@
<?php if ($item->getProductType() !== 'configurable'): ?>
<?= /** @noEscape */ ($item->getQty() . ' x ' .
$item->getName() . ' - ' .
$block->formatPrice($item->getBasePriceInclTax())) ?>
$block->formatPrice($item->getBasePrice())) ?>
<?php endif; ?>
<br>
<?php endforeach ?>
Expand Down
8 changes: 4 additions & 4 deletions view/frontend/templates/cart/items.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ $quote = $block->getData('quote');
<td><?= /** @noEscape */ $item->getQty() ?></td>
<td><?= /** @noEscape */ $item->getSku() ?></td>
<td><?= /** @noEscape */ $block->getNameConfigurable($item) ?></td>
<td><?= /** @noEscape */ $block->formatPrice($item->getBasePriceInclTax()) ?></td>
<td class="td5 mark"><?= /** @noEscape */ $block->formatPrice($item->getBaseRowTotalInclTax()) ?></td>
<td><?= /** @noEscape */ $block->formatPrice($item->getBasePrice()) ?></td>
<td class="td5 mark"><?= /** @noEscape */ $block->formatPrice($item->getBaseRowTotal()) ?></td>
</tr>
<?php endif; ?>
<?php if ($item->getParentItemId() && $block->checkConfigurableProduct($item)): ?>
Expand All @@ -50,8 +50,8 @@ $quote = $block->getData('quote');
<td><?= /** @noEscape */ $item->getQty() ?></td>
<td><?= /** @noEscape */ $item->getSku() ?></td>
<td><?= /** @noEscape */ $item->getName() ?></td>
<td><?= /** @noEscape */ $block->formatPrice($item->getBasePriceInclTax()) ?></td>
<td class="td5 mark"><?= /** @noEscape */ $block->formatPrice($item->getBaseRowTotalInclTax()) ?></td>
<td><?= /** @noEscape */ $block->formatPrice($item->getBasePrice()) ?></td>
<td class="td5 mark"><?= /** @noEscape */ $block->formatPrice($item->getBaseRowTotal()) ?></td>
</tr>
<?php endif; ?>
<?php endforeach ?>
Expand Down
206 changes: 104 additions & 102 deletions view/frontend/web/css/style.css
Original file line number Diff line number Diff line change
@@ -1,102 +1,104 @@
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_ShareCart
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
.actions .primary.sharecart {
margin: 0 10px 15px;
}

button.action.primary.sharecart {
display: block;
width: 100%;
line-height: 2.2rem;
padding: 14px 17px;
font-size: 1.8rem;
margin: unset;
}

.mp-sharecart-popup .modal-title {
border: none;
padding-bottom: 25px;
}

.mp-sharecart-popup .modal-inner-wrap {
width: 600px;
}

.mp-popup-cart {
display: none;
}

#mp_show_download_share {
display: inline-block;
}

.mp-tooltipped {
position: relative;
}

.mp-tooltipped:before {
position: absolute;
z-index: 1000001;
display: none;
width: 0;
height: 0;
color: rgba(0, 0, 0, .8);
pointer-events: none;
content: "";
border: 5px solid transparent;
top: auto;
right: 50%;
bottom: -5px;
margin-right: -5px;
border-bottom-color: rgba(0, 0, 0, .8)
}

.mp-tooltipped:after {
position: absolute;
z-index: 1000000;
display: none;
padding: 5px 8px;
font: normal normal 11px/1.5 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
color: #fff;
text-align: center;
text-decoration: none;
text-shadow: none;
text-transform: none;
letter-spacing: normal;
word-wrap: break-word;
white-space: pre;
pointer-events: none;
content: attr(aria-label);
background: rgba(0, 0, 0, .8);
border-radius: 3px;
-webkit-font-smoothing: subpixel-antialiased;
top: 100%;
right: 50%;
margin-top: 5px;
-webkit-transform: translateX(50%);
-ms-transform: translateX(50%);
transform: translateX(50%)
}

.mp-tooltipped:hover:before, .mp-tooltipped:active:before, .mp-tooltipped:focus:before,
.mp-tooltipped:hover:after, .mp-tooltipped:active:after, .mp-tooltipped:focus:after {
display: inline-block;
text-decoration: none
}
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_ShareCart
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
.actions .primary.sharecart {
margin: 0 10px 15px;
}
button, a.action.primary {
margin: 2px;
}
button.action.primary.sharecart {
display: block;
width: 100%;
line-height: 2.2rem;
padding: 14px 17px;
font-size: 1.8rem;
margin: unset;
}

.mp-sharecart-popup .modal-title {
border: none;
padding-bottom: 25px;
}

.mp-sharecart-popup .modal-inner-wrap {
width: 600px;
}

.mp-popup-cart {
display: none;
}

#mp_show_download_share {
display: inline-block;
}

.mp-tooltipped {
position: relative;
}

.mp-tooltipped:before {
position: absolute;
z-index: 1000001;
display: none;
width: 0;
height: 0;
color: rgba(0, 0, 0, .8);
pointer-events: none;
content: "";
border: 5px solid transparent;
top: auto;
right: 50%;
bottom: -5px;
margin-right: -5px;
border-bottom-color: rgba(0, 0, 0, .8)
}

.mp-tooltipped:after {
position: absolute;
z-index: 1000000;
display: none;
padding: 5px 8px;
font: normal normal 11px/1.5 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
color: #fff;
text-align: center;
text-decoration: none;
text-shadow: none;
text-transform: none;
letter-spacing: normal;
word-wrap: break-word;
white-space: pre;
pointer-events: none;
content: attr(aria-label);
background: rgba(0, 0, 0, .8);
border-radius: 3px;
-webkit-font-smoothing: subpixel-antialiased;
top: 100%;
right: 50%;
margin-top: 5px;
-webkit-transform: translateX(50%);
-ms-transform: translateX(50%);
transform: translateX(50%)
}

.mp-tooltipped:hover:before, .mp-tooltipped:active:before, .mp-tooltipped:focus:before,
.mp-tooltipped:hover:after, .mp-tooltipped:active:after, .mp-tooltipped:focus:after {
display: inline-block;
text-decoration: none
}

0 comments on commit 1d0ea4d

Please sign in to comment.