Skip to content

Commit

Permalink
Merge pull request #287 from mageplaza/2.3-develop
Browse files Browse the repository at this point in the history
Clean code
  • Loading branch information
haitv282 authored Nov 19, 2020
2 parents 324dc20 + f8597ce commit 2d491de
Show file tree
Hide file tree
Showing 57 changed files with 828 additions and 824 deletions.
4 changes: 2 additions & 2 deletions Block/AbandonedCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function getSubtotal($inclTax = false)
{
$subtotal = 0;
if ($quote = $this->getQuote()) {
$address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress();
$address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress();
$subtotal = $inclTax ? $address->getSubtotalInclTax() : $address->getSubtotal();
}

Expand Down Expand Up @@ -175,7 +175,7 @@ public function getProductImage(Item $item)
/** @var Product $product */
$product = $this->_productRepository->getById($productId);
/** @var Store $store */
$store = $this->_storeManager->getStore();
$store = $this->_storeManager->getStore();
$imageUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_MEDIA) . 'catalog/product' . $product->getImage();

return str_replace('\\', '/', $imageUrl);
Expand Down
2 changes: 1 addition & 1 deletion Block/Adminhtml/AbandonedCart/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Edit extends Container
{
protected function _construct()
{
$this->_objectId = 'id';
$this->_objectId = 'id';
$this->_blockGroup = 'Mageplaza_Smtp';
$this->_controller = 'adminhtml_AbandonedCart';
parent::_construct();
Expand Down
20 changes: 11 additions & 9 deletions Block/Adminhtml/AbandonedCart/Edit/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,26 @@
namespace Mageplaza\Smtp\Block\Adminhtml\AbandonedCart\Edit;

use Exception;
use IntlDateFormatter;
use Magento\Backend\Block\Template\Context;
use Magento\Backend\Block\Widget\Form\Generic;
use Magento\Catalog\Helper\Data as CatalogHelper;
use Magento\Config\Model\Config\Source\Email\Identity;
use Magento\Config\Model\Config\Source\Email\Template;
use Magento\Customer\Api\GroupRepositoryInterface;
use Magento\Customer\Model\Address\Config as AddressConfig;
use Magento\Framework\Data\FormFactory;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\Registry;
use Magento\Quote\Model\Quote;
use Magento\Quote\Model\Quote\Address;
use Magento\Quote\Model\Quote\Item;
use Mageplaza\Smtp\Model\Source\AbandonedCartStatus;
use Magento\Catalog\Helper\Data as CatalogHelper;
use Magento\Config\Model\Config\Source\Email\Identity;
use Magento\Config\Model\Config\Source\Email\Template;
use Magento\Tax\Model\Config as TaxConfig;
use Mageplaza\Smtp\Model\ResourceModel\Log\CollectionFactory as LogCollectionFactory;
use Mageplaza\Smtp\Helper\EmailMarketing;
use Magento\Customer\Api\GroupRepositoryInterface;
use Mageplaza\Smtp\Model\ResourceModel\Log\CollectionFactory as LogCollectionFactory;
use Mageplaza\Smtp\Model\Source\AbandonedCartStatus;

/**
* Class Form
Expand Down Expand Up @@ -222,10 +224,10 @@ public function getSentDateLogs($ids)
foreach ($collection as $log) {
$logDatesHtml .= $this->formatDate(
$log->getCreatedAt(),
\IntlDateFormatter::MEDIUM,
IntlDateFormatter::MEDIUM,
true
);
$logDatesHtml.='</br>';
$logDatesHtml .= '</br>';
}
}
}
Expand Down Expand Up @@ -354,7 +356,7 @@ public function isSingleStoreMode()
* @param Quote $quote
*
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws NoSuchEntityException
*/
public function getStoreName(Quote $quote)
{
Expand Down
6 changes: 3 additions & 3 deletions Block/Adminhtml/Log/ClearButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public function __construct(UrlInterface $urlBuilder)
public function getButtonData()
{
return [
'label' => __('Clear All Logs'),
'class' => 'primary',
'on_click' => 'deleteConfirm(\'' . __(
'label' => __('Clear All Logs'),
'class' => 'primary',
'on_click' => 'deleteConfirm(\'' . __(
'Are you sure you want to clear all email logs?'
) . '\', \'' . $this->_urlBuilder->getUrl('*/*/clear') . '\')',
'sort_order' => 10,
Expand Down
4 changes: 2 additions & 2 deletions Block/Adminhtml/System/Config/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ protected function _getElementHtml(AbstractElement $element)
$originalData = $element->getOriginalData();
$this->addData([
'button_label' => $originalData['button_label'],
'button_url' => $this->getUrl($originalData['button_url'], ['_current' => true]),
'html_id' => $element->getHtmlId(),
'button_url' => $this->getUrl($originalData['button_url'], ['_current' => true]),
'html_id' => $element->getHtmlId(),
]);

return $this->_toHtml();
Expand Down
Loading

0 comments on commit 2d491de

Please sign in to comment.