Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed stock_item, and Stock post-processor usage in variant collection from CatalogGraphQl module #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 0 additions & 61 deletions src/Model/Resolver/Inventory/StockCount.php

This file was deleted.

17 changes: 0 additions & 17 deletions src/Model/Variant/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ class Collection
/** @var DataPostProcessor */
protected $dataPostProcessor;

/** @var DataPostProcessor\Stocks */
protected $stocksPostProcessor;

/** @var ProductCollectionFactory */
protected $collectionFactory;

Expand All @@ -87,7 +84,6 @@ class Collection
* @param CollectionProcessorInterface $collectionProcessor
* @param CollectionPostProcessor $collectionPostProcessor
* @param DataPostProcessor $dataPostProcessor
* @param DataPostProcessor\Stocks $stocksPostProcessor
* @param ResourceConnection $connection
* @param StockFilter $stockFilter
* @param StoreManagerInterface $storeManager
Expand All @@ -100,7 +96,6 @@ public function __construct(
CollectionProcessorInterface $collectionProcessor,
CollectionPostProcessor $collectionPostProcessor,
DataPostProcessor $dataPostProcessor,
DataPostProcessor\Stocks $stocksPostProcessor,
ResourceConnection $connection,
StockFilter $stockFilter,
StoreManagerInterface $storeManager
Expand All @@ -111,7 +106,6 @@ public function __construct(
$this->collectionProcessor = $collectionProcessor;
$this->collectionPostProcessor = $collectionPostProcessor;
$this->dataPostProcessor = $dataPostProcessor;
$this->stocksPostProcessor = $stocksPostProcessor;
$this->collectionFactory = $collectionFactory;
$this->connection = $connection;
$this->stockFilter = $stockFilter;
Expand Down Expand Up @@ -445,14 +439,6 @@ protected function fetchPlp($info) : array {

$products = $collection->getItems();

// Populate stock status (use same post processor as for non-plp variants)
$stockStatusCallback = $this->stocksPostProcessor->process(
$products,
'variants_plp/product',
$info,
['isSingleProduct' => false]
);

// Populate attributes (use more simple logic)
$productsData = [];
$productAttributes = [];
Expand Down Expand Up @@ -489,9 +475,6 @@ protected function fetchPlp($info) : array {
];
}

// Set stock status
$stockStatusCallback($product);

$productsData[$product->getId()] = $product->getData() + [
'model' => $product,
's_attributes' => $productAttributes[$productId]
Expand Down
9 changes: 0 additions & 9 deletions src/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ type CategoryTree {

interface ProductInterface {
qty: Float @doc(description: "Qty field for checkout order view")
stock_item: ProductStockItem @resolver(class: "ScandiPWA\\CatalogGraphQl\\Model\\Resolver\\Inventory\\StockCount")
url: String @resolver(class: "ScandiPWA\\CatalogGraphQl\\Model\\Resolver\\Product\\Url")
}

Expand All @@ -63,14 +62,6 @@ type ProductPrice @doc(description: "Represents a product price.") {
discount: ProductDiscount @doc(description: "The price discount. Represents the difference between the regular and final price.")
}

type ProductStockItem {
in_stock: Boolean @doc(description: "Product in stock status")
qty: Float @doc(description: "Product quantity available in stock")
min_sale_qty: Int @doc(description: "Minimal amount of item that can be bought")
max_sale_qty: Int @doc(description: "Maximal amount of item that can be bought")
qty_increments: Int @doc(description: "Increment for number of items that can be bought")
}

extends type Breadcrumb {
category_url: String @doc(description: "Trimmed URL rewrite")
category_is_active: Boolean @doc(description: "Is category active")
Expand Down