Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from tuyennn/develop
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
tuyennn authored Feb 28, 2020
2 parents bf0231d + 62c1959 commit 786e55b
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 28 deletions.
4 changes: 2 additions & 2 deletions Block/Initialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace GhoSter\Quickview\Block;

use Magento\Framework\View\Element\Template\Context;
use Magento\Framework\Exception\NoSuchEntityException;
use GhoSter\Quickview\Model\Config as QuickViewConfig;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;

/**
* Class Initialize block init the js
Expand Down
8 changes: 3 additions & 5 deletions Block/QuickViewButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace GhoSter\Quickview\Block;

use GhoSter\Quickview\Model\Config;
use Magento\Catalog\Model\Product;
use Magento\Customer\Model\Context as CustomerContext;
use Magento\Framework\App\Http\Context as HttpContext;
use Magento\Framework\View\Element\Template\Context;
use Magento\Framework\DataObject\IdentityInterface;
use Magento\Framework\View\Element\Template;
use Magento\Framework\Json\EncoderInterface;
use GhoSter\Quickview\Model\Config;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;

/**
* Class QuickViewButton for rendering the button
Expand Down Expand Up @@ -70,7 +70,6 @@ public function __construct(
]);
}


/**
* @return string
*/
Expand Down Expand Up @@ -101,7 +100,6 @@ public function isAdminArea()

/**
* @return array
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getCacheKeyInfo()
{
Expand Down
2 changes: 1 addition & 1 deletion Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace GhoSter\Quickview\Model;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\Store;
use Magento\Store\Model\StoreManagerInterface;

/**
* Class Config provide configurations
Expand Down
2 changes: 0 additions & 2 deletions Model/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ public function renderProductQuickViewButton(Product $product, $mode = self::MOD
return $html;
}


private function generateHtml(Product $product)
{
if ($this->buttonBlock === null) {
$this->buttonBlock = $this->layout->createBlock(QuickViewButton::class);
}

return $this->buttonBlock->setProduct($product)->toHtml();
}
}
7 changes: 3 additions & 4 deletions Observer/AddUpdateHandlesObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace GhoSter\Quickview\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\Request\Http as HttpRequest;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Store\Model\StoreManagerInterface;

/**
* Class AddUpdateHandlesObserver add handles types
Expand Down Expand Up @@ -71,7 +71,6 @@ public function execute(Observer $observer)
}

$layout->getUpdate()->addHandle('ghoster_quickview_catalog_product_view_type_' . $product->getTypeId());

}

return $this;
Expand Down
5 changes: 1 addition & 4 deletions Plugin/CartAddPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
* @return mixed
*/
public function afterExecute(
\Magento\Checkout\Controller\Cart\Add $subject,
Add $subject,
$result
) {

Expand All @@ -45,9 +45,6 @@ public function afterExecute(
if (strpos($refererUrl, 'ghoster_quickview/catalog_product/view') !== false) {
return $subject->getResponse()->representJson($this->jsonEncoder->encode([]));
}

return $result;
}


}
1 change: 1 addition & 0 deletions Plugin/Catalog/Product/ListProductPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function __construct(
* @param $subject
* @param $result
* @return string
* @noinspection PhpUndefinedMethodInspection
*/
public function afterToHtml(
$subject,
Expand Down
9 changes: 4 additions & 5 deletions Plugin/ResultPagePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace GhoSter\Quickview\Plugin;

use Magento\Framework\View\Result\Page;
use Magento\Framework\App\Request\Http as HttpRequest;
use Magento\Framework\View\Layout;
use Magento\Framework\View\Result\Page;

/**
* Class ResultPagePlugin adding the default catalog_product_view
Expand Down Expand Up @@ -39,15 +39,14 @@ public function __construct(
* @return array
*/
public function beforeAddPageLayoutHandles(
\Magento\Framework\View\Result\Page $subject,
Page $subject,
array $parameters = [],
$defaultHandle = null
) {
if ($this->request->getFullActionName() == 'ghoster_quickview_catalog_product_view') {
return [$parameters, 'catalog_product_view'];
} else {
return [$parameters, $defaultHandle];
}
}

return [$parameters, $defaultHandle];
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
This Magento 2 extension provides quick view button, popup view the product from product list, widget.

[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/bf0757d0063e489eb3bff2479964fce2)](https://www.codacy.com/app/GhoSterInc/AutoInstagramPost?utm_source=github.com&utm_medium=referral&utm_content=tuyennn/AutoInstagramPost&utm_campaign=Badge_Grade)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/a0c2c8faab694998abc3c90ad3e7cc98)](https://www.codacy.com/manual/GhoSterInc/ProductQuickView?utm_source=github.com&utm_medium=referral&utm_content=tuyennn/ProductQuickView&utm_campaign=Badge_Grade)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/thinghost)
[![Build Status](https://travis-ci.org/tuyennn/ProductQuickView.svg?branch=master)](https://travis-ci.org/tuyennn/AutoInstagramPost)
[![Build Status](https://travis-ci.org/tuyennn/ProductQuickView.svg?branch=master)](https://travis-ci.org/tuyennn/ProductQuickView)
![Version 1.0.0](https://img.shields.io/badge/Version-1.0.0-green.svg)

---
Expand Down
2 changes: 1 addition & 1 deletion view/base/templates/button.phtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php // @codingStandardsIgnoreFile ?>
<?php
/** @var \Magento\Product\Model\Product $product */
/** @var \Magento\Catalog\Model\Product $product */
/** @var \GhoSter\Quickview\Block\QuickViewButton $block */

$product = $block->getProduct();
Expand Down
4 changes: 2 additions & 2 deletions view/base/web/js/initQuickView.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ define([

observer = new IntersectionObserver(function (entries) {
if (entries[0].isIntersecting) {
self.execQuickView();
observer.disconnect();
self.execQuickView();
observer.disconnect();
}
});

Expand Down

0 comments on commit 786e55b

Please sign in to comment.