Skip to content

Commit

Permalink
[shopsys] removed preorder and vendor delivery date features (#2942)
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmannmartin authored Dec 7, 2023
2 parents faa4660 + 8edeed8 commit d7efab4
Show file tree
Hide file tree
Showing 45 changed files with 83 additions and 829 deletions.
3 changes: 0 additions & 3 deletions app/config/graphql/types/ModelType/Product/Product.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ Product:
fullName:
type: "String!"
description: "The full name of the product, which consists of a prefix, name, and a suffix"
hasPreorder:
type: "Boolean!"
description: "Distinguishes if the product can be pre-ordered"
files:
type: "[File!]!"
description: "List of downloadable files"
Expand Down
8 changes: 0 additions & 8 deletions app/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -812,8 +812,6 @@ type MainVariant implements Product & Breadcrumb & Slug {
flags: [Flag!]!
"The full name of the product, which consists of a prefix, name, and a suffix"
fullName: String!
"Distinguishes if the product can be pre-ordered"
hasPreorder: Boolean!
"Product id"
id: Int!
"Product images"
Expand Down Expand Up @@ -1466,8 +1464,6 @@ interface Product {
flags: [Flag!]!
"The full name of the product, which consists of a prefix, name, and a suffix"
fullName: String!
"Distinguishes if the product can be pre-ordered"
hasPreorder: Boolean!
"Product id"
id: Int!
"Product images"
Expand Down Expand Up @@ -1870,8 +1866,6 @@ type RegularProduct implements Product & Breadcrumb & Slug {
flags: [Flag!]!
"The full name of the product, which consists of a prefix, name, and a suffix"
fullName: String!
"Distinguishes if the product can be pre-ordered"
hasPreorder: Boolean!
"Product id"
id: Int!
"Product images"
Expand Down Expand Up @@ -2148,8 +2142,6 @@ type Variant implements Product & Breadcrumb & Slug {
flags: [Flag!]!
"The full name of the product, which consists of a prefix, name, and a suffix"
fullName: String!
"Distinguishes if the product can be pre-ordered"
hasPreorder: Boolean!
"Product id"
id: Int!
"Product images"
Expand Down
4 changes: 1 addition & 3 deletions app/src/DataFixtures/Demo/ProductDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -1985,15 +1985,14 @@ public function load(ObjectManager $manager): void
$productData->usingStock = true;
$productData->stockQuantity = 550;
$productData->outOfStockAction = Product::OUT_OF_STOCK_ACTION_HIDE;
$this->setStocksQuantity($productData, 0);
$this->setStocksQuantity($productData, 10);

$this->setUnit($productData, UnitDataFixture::UNIT_PIECES);
$this->setAvailability($productData, AvailabilityDataFixture::AVAILABILITY_IN_STOCK);
$this->setCategoriesForAllDomains($productData, [CategoryDataFixture::CATEGORY_TV, CategoryDataFixture::CATEGORY_PC]);
$this->setFlags($productData, [FlagDataFixture::FLAG_PRODUCT_NEW]);

$productData->sellingDenied = false;
$productData->preorder = true;
$this->setBrand($productData, BrandDataFixture::BRAND_SAMSUNG);

$this->createProduct($productData);
Expand Down Expand Up @@ -2416,7 +2415,6 @@ public function load(ObjectManager $manager): void
$this->setFlags($productData, []);

$productData->sellingDenied = false;
$productData->preorder = true;
$this->setBrand($productData, BrandDataFixture::BRAND_LG);

$this->createProduct($productData);
Expand Down
5 changes: 0 additions & 5 deletions app/src/DataFixtures/Demo/SettingValueDataFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ public function load(ObjectManager $manager)
'Disallow: *?filter=',
$domainId,
);
$this->setting->setForDomain(
Setting::DELIVERY_DAYS_ON_STOCK,
70,
$domainId,
);
$this->setting->setForDomain(
Setting::TRANSFER_DAYS_BETWEEN_STOCKS,
7,
Expand Down
14 changes: 0 additions & 14 deletions app/src/Form/Admin/ProductFormTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,6 @@ private function setDisplayAvailabilityGroup(FormBuilderInterface $builder, ?Pro
->remove('outOfStockAvailability');

$groupBuilder
->add('preorder', YesNoType::class, [
'required' => false,
'disabled' => $this->isProductMainVariant($product),
'label' => t('Allow overselling'),
])
->add('sellingDenied', YesNoType::class, [
'required' => false,
'label' => t('Exclude from sale on whole eshop'),
Expand All @@ -173,15 +168,6 @@ private function setDisplayAvailabilityGroup(FormBuilderInterface $builder, ?Pro
'entry_type' => YesNoType::class,
'position' => ['after' => 'sellingDenied'],
])
->add('vendorDeliveryDate', TextType::class, [
'required' => false,
'label' => t('Supplier\'s delivery time'),
'constraints' => [
new Constraints\Type(['type' => 'numeric', 'message' => 'Supplier\'s delivery time must be a number']),
new Constraints\GreaterThanOrEqual(['value' => 0, 'message' => 'Supplier\'s delivery time must be 0 or more']),
],

])
->add('usingStock', YesNoType::class, [
'data' => true,
'required' => false,
Expand Down
2 changes: 1 addition & 1 deletion app/src/FrontendApi/Model/Cart/CartWatcherFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private function checkUnavailableStockQuantityItems(Cart $cart): void
{
foreach ($cart->getItems() as $cartItem) {
$product = $cartItem->getProduct();
$maximumOrderQuantity = $this->productAvailabilityFacade->getMaximumOrderQuantity($product, $this->domain->getId());
$maximumOrderQuantity = $this->productAvailabilityFacade->getGroupedStockQuantityByProductAndDomainId($product, $this->domain->getId());

if ($maximumOrderQuantity === 0) {
$cart->removeItemById($cartItem->getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@ public function getFullname(array $data): string
);
}

/**
* @param array $data
* @return bool
*/
public function hasPreorder(array $data): bool
{
return $data['has_preorder'];
}

/**
* @param array $data
* @return bool
Expand Down
27 changes: 0 additions & 27 deletions app/src/Migrations/Version20200316101714.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/Model/Cart/CartFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function addProductToExistingCart(
BaseCart $cart,
bool $isAbsoluteQuantity = false,
): AddProductResult {
$maximumOrderQuantity = $this->productAvailabilityFacade->getMaximumOrderQuantity($product, $this->domain->getId());
$maximumOrderQuantity = $this->productAvailabilityFacade->getGroupedStockQuantityByProductAndDomainId($product, $this->domain->getId());
$notOnStockQuantity = 0;

if (!is_int($quantity) || $quantity <= 0) {
Expand Down
25 changes: 0 additions & 25 deletions app/src/Model/Order/Preview/OrderPreviewCalculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use App\Model\Order\PromoCode\CurrentPromoCodeFacade;
use App\Model\Order\PromoCode\PromoCode;
use App\Model\Product\Availability\ProductAvailabilityFacade;
use Shopsys\FrameworkBundle\Model\Customer\User\CustomerUser;
use Shopsys\FrameworkBundle\Model\Order\OrderPriceCalculation;
use Shopsys\FrameworkBundle\Model\Order\Preview\OrderPreview as BaseOrderPreview;
Expand Down Expand Up @@ -35,7 +34,6 @@ class OrderPreviewCalculation extends BaseOrderPreviewCalculation
* @param \Shopsys\FrameworkBundle\Model\Payment\PaymentPriceCalculation $paymentPriceCalculation
* @param \Shopsys\FrameworkBundle\Model\Order\OrderPriceCalculation $orderPriceCalculation
* @param \App\Model\Order\PromoCode\CurrentPromoCodeFacade $currentPromoCodeFacade
* @param \App\Model\Product\Availability\ProductAvailabilityFacade $productAvailabilityFacade
*/
public function __construct(
QuantifiedProductPriceCalculation $quantifiedProductPriceCalculation,
Expand All @@ -44,7 +42,6 @@ public function __construct(
PaymentPriceCalculation $paymentPriceCalculation,
OrderPriceCalculation $orderPriceCalculation,
private readonly CurrentPromoCodeFacade $currentPromoCodeFacade,
private readonly ProductAvailabilityFacade $productAvailabilityFacade,
) {
parent::__construct(
$quantifiedProductPriceCalculation,
Expand Down Expand Up @@ -168,28 +165,6 @@ public function calculatePreview(
);
}

/**
* @param \Shopsys\FrameworkBundle\Model\Order\Item\QuantifiedProduct[] $quantifiedProducts
* @param int $domainId
* @return string[]
*/
protected function getProductsAvailability(array $quantifiedProducts, int $domainId): array
{
$availability = [];

foreach ($quantifiedProducts as $quantifiedProduct) {
/** @var \App\Model\Product\Product $product */
$product = $quantifiedProduct->getProduct();
$availability[$product->getId()] =
$this->productAvailabilityFacade->getProductAvailabilityInformationByQuantifiedProductAndDomainId(
$quantifiedProduct,
$domainId,
);
}

return $availability;
}

/**
* @param \Shopsys\FrameworkBundle\Model\Pricing\Price[] $quantifiedItemsDiscounts
* @return \Shopsys\FrameworkBundle\Model\Pricing\Price
Expand Down
Loading

0 comments on commit d7efab4

Please sign in to comment.