Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
Jacker committed Apr 19, 2022
2 parents c6bc55f + d34dabe commit a10dcde
Show file tree
Hide file tree
Showing 10 changed files with 243 additions and 234 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_SalesPopGraphQl
* @package Mageplaza_RecentSalesNotificationGraphQl
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
declare(strict_types=1);

namespace Mageplaza\SalesPopGraphQl\Model\Resolver;
namespace Mageplaza\RecentSalesNotificationGraphQl\Model\Resolver;

use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Query\Resolver\Argument\SearchCriteria\Builder as SearchCriteriaBuilder;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Mageplaza\SalesPop\Helper\Data;
use Mageplaza\SalesPopGraphQl\Model\Resolver\SalesPop\DataProvider;
use Mageplaza\RecentSalesNotification\Helper\Data;
use Mageplaza\RecentSalesNotificationGraphQl\Model\Resolver\RecentSalesNotification\DataProvider;

/**
* Class SalesPop
* @package Mageplaza\SalesPopGraphQl\Model\Resolver
* Class RecentSalesNotification
* @package Mageplaza\RecentSalesNotificationGraphQl\Model\Resolver
*/
class SalesPop implements ResolverInterface
class RecentSalesNotification implements ResolverInterface
{
/**
* @var DataProvider
Expand All @@ -52,7 +52,7 @@ class SalesPop implements ResolverInterface
protected $searchCriteriaBuilder;

/**
* SalesPop constructor.
* RecentSalesNotificationGraphQl constructor.
*
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param DataProvider $dataProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_SalesPopGraphQl
* @package Mageplaza_RecentSalesNotificationGraphQl
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
declare(strict_types=1);

namespace Mageplaza\SalesPopGraphQl\Model\Resolver\SalesPop;
namespace Mageplaza\RecentSalesNotificationGraphQl\Model\Resolver\RecentSalesNotification;

use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Mageplaza\SalesPop\Model\ResourceModel\SalesPop\Collection;
use Mageplaza\SalesPop\Model\ResourceModel\SalesPop\CollectionFactory;
use Mageplaza\RecentSalesNotification\Model\ResourceModel\RecentSalesNotification\Collection;
use Mageplaza\RecentSalesNotification\Model\ResourceModel\RecentSalesNotification\CollectionFactory;

/**
* Class DataProvider
* @package Mageplaza\SalesPopGraphQl\Model\Resolver\SalesPop
* @package Mageplaza\RecentSalesNotificationGraphQl\Model\Resolver\RecentSalesNotification
*/
class DataProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_SalesPopGraphQl
* @package Mageplaza_RecentSalesNotificationGraphQl
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
declare(strict_types=1);

namespace Mageplaza\SalesPopGraphQl\Model\Resolver\SalesPop\FilterArgument;
namespace Mageplaza\RecentSalesNotificationGraphQl\Model\Resolver\RecentSalesNotification\FilterArgument;

use Magento\Framework\GraphQl\Query\Resolver\Argument\FieldEntityAttributesInterface;
use Mageplaza\RecentSalesNotification\Helper\Data;

/**
* Class EntityAttributesForAst
* @package Mageplaza\SalesPopGraphQl\Model\Resolver\SalesPop\FilterArgument
* @package Mageplaza\RecentSalesNotificationGraphQl\Model\Resolver\RecentSalesNotification\FilterArgument
*/
class EntityAttributesForAst implements FieldEntityAttributesInterface
{
Expand All @@ -35,13 +36,22 @@ class EntityAttributesForAst implements FieldEntityAttributesInterface
*/
protected $additionalAttributes = ['pop_id', 'name', 'status', 'pop_type', 'position'];

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

/**
* EntityAttributesForAst constructor.
*
* @param Data $helperData
* @param array $additionalAttributes
*/
public function __construct(array $additionalAttributes = [])
{
public function __construct(
Data $helperData,
array $additionalAttributes = []
) {
$this->helperData = $helperData;
$this->additionalAttributes = array_merge($this->additionalAttributes, $additionalAttributes);
}

Expand All @@ -55,6 +65,6 @@ public function getEntityAttributes(): array
$fields[$attribute] = 'String';
}

return array_keys($fields);
return $this->helperData->versionCompare('2.3.4') ? $fields : array_keys($fields);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_SalesPopGraphQl
* @package Mageplaza_RecentSalesNotificationGraphQl
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
declare(strict_types=1);

namespace Mageplaza\SalesPopGraphQl\Model\Resolver\SalesPop;
namespace Mageplaza\RecentSalesNotificationGraphQl\Model\Resolver\RecentSalesNotification;

use Magento\Framework\GraphQl\Query\Resolver\IdentityInterface;

/**
* Class Identity
* @package Mageplaza\SalesPopGraphQl\Model\Resolver\SalesPop
* @package Mageplaza\RecentSalesNotificationGraphQl\Model\Resolver\RecentSalesNotification
*/
class Identity implements IdentityInterface
{
/** @var string */
private $cacheTag = 'salespop_';
private $cacheTag = 'recentsalesnotification_';

/**
* Get page ID from resolved data
Expand Down
143 changes: 71 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,71 @@
# Magento 2 Sales Pop GraphQL / PWA (FREE)

**Magento 2 Sales Pop GraphQL is a part of Mageplaza Sales Pop extension that adds GraphQL features.** This highly supports PWA compatibility.

[Mageplaza Sales Pop for Magento 2](https://www.mageplaza.com/magento-2-sales-pop/) enables online stores to show customers' real-time purchases as an effective way to market the products and stimulate customers' purchasing decisions.

Customers will consider a lot of factors before purchasing a product from an online store. That sales pop shows the stores' continuous purchases will somehow eliminate the doubt in customers' minds about the store and make them feel safer to make payment. The real-time number of sales displays is an effective and cost-saving way to market the products.

Mageplaza Sales Pop extension supports multiple types of pop-up that enables you to diversify the display of sales pops on your store. They appear friendly and automatically in the store and draw customers' attention without bombarding them countless times. In particular, there are three proven types that help increase sales incredibly, they are:

- Notifications of recent orders: It shows the recent products bought in the store.
- Checkout pop-ups: It shows the current total checkouts.
- Upsell pop-ups: It shows the products that are bought together.

The store admin can set up the rules to display pop-ups. The products or orders that match the rule will be displayed at the frontend. There are three types of conditions:

- Follow cart price rules: The store admin sets the rules based on cart attributes, product attributes, etc.
- Restrict the number of recent orders displaying at the frontend.
- Set the amount of time to check recent orders

The data will be extracted, updated automatically, and displayed correspondingly at the frontend.

Mageplaza Sales Pop supports sales pop-ups on multiple pages, including CMS page, category pages, product pages, shopping cart page, and checkout page. You can configure sales pops to display on the pages corresponding to the customers’ journey from end to end. This will build up customers’ trust gradually and boost their purchase decision effectively.

You can customize the sales pop design and content easily with an HTML-supported and friendly message formula from the admin backend. You can change the background image of the popup, the border, text, link and hover link color easily to match your store theme.

The extension supports A/B testing. One child popup will be created and run along with the parent popup so that you can continue to keep track of both and measure which one is more effective. In addition, another comprehensive report will let you know how your sales popups are performing, the good, the bad, and the uly of all sales pops will be revealed through the number of views, clicks, and closes to make the comparison more accurately.

## 1. How to install
Run the following command in Magento 2 root folder:

```
composer require mageplaza/module-sales-pop-graphql
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
```
**Note:**
Magento Sales Pop GraphQL requires installing [Mageplaza Sales Pop](https://www.mageplaza.com/magento-2-sales-pop/) in your Magento installation.

## 2. How to use

To start working with Sales Pop GraphQl in Magento, please do the following requirements:

- Use Magento 2.3.x. Reture your site to developer mode.
- Install chrome extension (currently does not support other browsers)
- Set GraphQL endpoint as `http://<magento2-3-server>/graphql` in url box, click **Set endpoint**.
(e.g. http://develop.mageplaza.com/graphql/ce232/graphql)
- Mageplaza-supported queries are fully written in the **Description** section of `Query.SalesPop.items`
- To get the popup information by id, enter the id of the necessary popup in the array ids []

![](https://i.imgur.com/DVq9oky.png)

- To get the information of all popups quickly, leave the ids[ array empty.

![](https://i.imgur.com/33cnSY6.png)

## 3. Devdocs
- [Magento 2 Sales Pop API & examples](https://documenter.getpostman.com/view/5977924/SWE2A1Dd?version=latest)

Click on Run in Postman to add these collections to your workspace quickly.

![Magento 2 blog graphql pwa](https://i.imgur.com/lhsXlUR.gif)

## 4. Contribute to this module
Feel free to **Fork** and contribute to this module.

You can create a pull request, and we will consider to merge your proposed changes in the main branch.

## 5. Get support
- Contact us if you have any question. We're please to hear from you.
- If you find this post helpful, please give us a **Star** ![star](https://i.imgur.com/S8e0ctO.png)


# Recent Sales Notification GraphQl (FREE)

**Recent Sales Notification GraphQl is a part of Recent Sales Notification extension that adds GraphQL features.** This highly supports PWA compatibility.

[Recent Sales Notification for Magento 2](https://www.mageplaza.com/magento-2-recent-sales-notification/) enables online stores to show customers' real-time purchases as an effective way to market the products and stimulate customers' purchasing decisions.

Customers will consider a lot of factors before purchasing a product from an online store. That Recent Sales Notification shows the stores' continuous purchases will somehow eliminate the doubt in customers' minds about the store and make them feel safer to make payment. The real-time number of sales displays is an effective and cost-saving way to market the products.

Recent Sales Notification extension supports multiple types of pop-up that enables you to diversify the display of sales pops on your store. They appear friendly and automatically in the store and draw customers' attention without bombarding them countless times. In particular, there are three proven types that help increase sales incredibly, they are:

- Notifications of recent orders: It shows the recent products bought in the store.
- Checkout pop-ups: It shows the current total checkouts.
- Upsell pop-ups: It shows the products that are bought together.

The store admin can set up the rules to display pop-ups. The products or orders that match the rule will be displayed at the frontend. There are three types of conditions:

- Follow cart price rules: The store admin sets the rules based on cart attributes, product attributes, etc.
- Restrict the number of recent orders displaying at the frontend.
- Set the amount of time to check recent orders

The data will be extracted, updated automatically, and displayed correspondingly at the frontend.

Mageplaza Recent Sales Notification supports sales pop-ups on multiple pages, including CMS page, category pages, product pages, shopping cart page, and checkout page. You can configure sales pops to display on the pages corresponding to the customers’ journey from end to end. This will build up customers’ trust gradually and boost their purchase decision effectively.

You can customize the recent sales notification design and content easily with an HTML-supported and friendly message formula from the admin backend. You can change the background image of the popup, the border, text, link and hover link color easily to match your store theme.

The extension supports A/B testing. One child popup will be created and run along with the parent popup so that you can continue to keep track of both and measure which one is more effective. In addition, another comprehensive report will let you know how your sales popups are performing, the good, the bad, and the uly of all sales pops will be revealed through the number of views, clicks, and closes to make the comparison more accurately.

## 1. How to install
Run the following command in Magento 2 root folder:

```
composer require mageplaza/module-recent-sales-notification-graphql
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
```
**Note:**
Recent Sales Notification GraphQl requires installing [Recent Sales Notification](https://www.mageplaza.com/magento-2-recent-sales-notification/) in your Magento installation.

## 2. How to use

To start working with Recent Sales Notification GraphQl in Magento, please do the following requirements:

- Use Magento 2.3.x. Retire your site to developer mode.
- Install chrome extension (currently does not support other browsers)
- Set GraphQL endpoint as `http://<magento2-3-server>/graphql` in url box, click **Set endpoint**.
(e.g. http://develop.mageplaza.com/graphql/ce232/graphql)
- Mageplaza-supported queries are fully written in the **Description** section of `Query.SalesPop.items`
- To get the popup information by id, enter the id of the necessary popup in the array ids []

![](https://i.imgur.com/DVq9oky.png)

- To get the information of all popups quickly, leave the ids[ array empty.

![](https://i.imgur.com/33cnSY6.png)

## 3. Devdocs
- [Magento 2 Recent Sales Notification GraphQl & examples](https://documenter.getpostman.com/view/10589000/UUy37kXJ#5c48f6ab-ff85-41f0-8623-c8e0f73e21f9)
Click on Run in Postman to add these collections to your workspace quickly.

![Magento 2 blog graphql pwa](https://i.imgur.com/lhsXlUR.gif)

## 4. Contribute to this module
Feel free to **Fork** and contribute to this module.

You can create a pull request, and we will consider to merge your proposed changes in the main branch.

## 5. Get support
- Contact us if you have any question. We're please to hear from you.
- If you find this post helpful, please give us a **Star** ![star](https://i.imgur.com/S8e0ctO.png)
46 changes: 23 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"name": "mageplaza/module-sales-pop-graphql",
"description": "Magento 2 Sales Pop GraphQL Extension",
"type": "magento2-module",
"version": "1.0.0",
"license": "proprietary",
"authors": [
{
"name": "Mageplaza",
"email": "support@mageplaza.com",
"homepage": "https://www.mageplaza.com",
"role": "Technical Support"
}
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Mageplaza\\SalesPopGraphQl\\": ""
}
}
}
{
"name": "mageplaza/module-recent-sales-notification-graphql",
"description": "Magento 2 Recent Sales Notification GraphQL Extension",
"type": "magento2-module",
"version": "1.1.0",
"license": "proprietary",
"authors": [
{
"name": "Mageplaza",
"email": "support@mageplaza.com",
"homepage": "https://www.mageplaza.com",
"role": "Technical Support"
}
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Mageplaza\\RecentSalesNotificationGraphQl\\": ""
}
}
}
Loading

0 comments on commit a10dcde

Please sign in to comment.