Skip to content

Commit

Permalink
admin improvements (#3641)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitek-rostislav authored Jan 14, 2025
2 parents b1618ea + 6b6b27b commit 47b0412
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/Controller/Admin/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @property \App\Component\Setting\Setting $setting
* @property \Shopsys\FrameworkBundle\Component\Domain\Domain $domain
* @method setSellingToUntilEndOfDay(\App\Model\Product\ProductData|null $productData)
* @method __construct(\Shopsys\FrameworkBundle\Model\Product\MassAction\ProductMassActionFacade $productMassActionFacade, \Shopsys\FrameworkBundle\Component\Grid\GridFactory $gridFactory, \App\Model\Product\ProductFacade $productFacade, \App\Model\Product\ProductDataFactory $productDataFactory, \Shopsys\FrameworkBundle\Model\AdminNavigation\BreadcrumbOverrider $breadcrumbOverrider, \Shopsys\FrameworkBundle\Model\Administrator\AdministratorGridFacade $administratorGridFacade, \Shopsys\FrameworkBundle\Model\Product\Listing\ProductListAdminFacade $productListAdminFacade, \Shopsys\FrameworkBundle\Model\AdvancedSearch\AdvancedSearchProductFacade $advancedSearchProductFacade, \Shopsys\FrameworkBundle\Model\Product\ProductVariantFacade $productVariantFacade, \App\Twig\ProductExtension $productExtension, \Shopsys\FrameworkBundle\Component\Domain\Domain $domain, \Shopsys\FrameworkBundle\Model\Product\Unit\UnitFacade $unitFacade, \App\Component\Setting\Setting $setting)
* @method __construct(\Shopsys\FrameworkBundle\Model\Product\MassAction\ProductMassActionFacade $productMassActionFacade, \App\Model\Product\ProductFacade $productFacade, \App\Model\Product\ProductDataFactory $productDataFactory, \Shopsys\FrameworkBundle\Model\AdminNavigation\BreadcrumbOverrider $breadcrumbOverrider, \Shopsys\FrameworkBundle\Model\Administrator\AdministratorGridFacade $administratorGridFacade, \Shopsys\FrameworkBundle\Model\Product\Listing\ProductListAdminFacade $productListAdminFacade, \Shopsys\FrameworkBundle\Model\AdvancedSearch\AdvancedSearchProductFacade $advancedSearchProductFacade, \Shopsys\FrameworkBundle\Model\Product\ProductVariantFacade $productVariantFacade, \App\Twig\ProductExtension $productExtension, \Shopsys\FrameworkBundle\Component\Domain\Domain $domain, \Shopsys\FrameworkBundle\Model\Product\Unit\UnitFacade $unitFacade, \App\Component\Setting\Setting $setting, \Shopsys\FrameworkBundle\Model\Product\ProductGridFactory $productGridFactory)
* @property \Shopsys\FrameworkBundle\Model\Product\ProductVariantFacade $productVariantFacade
* @property \Shopsys\FrameworkBundle\Model\Product\Unit\UnitFacade $unitFacade
* @method \App\Model\Administrator\Administrator getCurrentAdministrator()
Expand Down
1 change: 1 addition & 0 deletions app/src/Model/Order/OrderFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
* @method __construct(\Doctrine\ORM\EntityManagerInterface $em, \Shopsys\FrameworkBundle\Model\Order\OrderNumberSequenceRepository $orderNumberSequenceRepository, \App\Model\Order\OrderRepository $orderRepository, \Shopsys\FrameworkBundle\Model\Order\OrderUrlGenerator $orderUrlGenerator, \Shopsys\FrameworkBundle\Model\Order\Status\OrderStatusRepository $orderStatusRepository, \App\Model\Order\Mail\OrderMailFacade $orderMailFacade, \Shopsys\FrameworkBundle\Model\Order\OrderHashGeneratorRepository $orderHashGeneratorRepository, \App\Component\Setting\Setting $setting, \Shopsys\FrameworkBundle\Model\Localization\Localization $localization, \Shopsys\FrameworkBundle\Model\Administrator\Security\AdministratorFrontSecurityFacade $administratorFrontSecurityFacade, \App\Model\Order\PromoCode\CurrentPromoCodeFacade $currentPromoCodeFacade, \App\Model\Cart\CartFacade $cartFacade, \App\Model\Customer\User\CustomerUserFacade $customerUserFacade, \App\Model\Customer\User\CurrentCustomerUser $currentCustomerUser, \Shopsys\FrameworkBundle\Model\Heureka\HeurekaFacade $heurekaFacade, \Shopsys\FrameworkBundle\Component\Domain\Domain $domain, \Shopsys\FrameworkBundle\Model\Order\OrderFactoryInterface $orderFactory, \Shopsys\FrameworkBundle\Model\Order\OrderPriceCalculation $orderPriceCalculation, \Shopsys\FrameworkBundle\Model\Order\Item\OrderItemPriceCalculation $orderItemPriceCalculation, \Shopsys\FrameworkBundle\Twig\NumberFormatterExtension $numberFormatterExtension, \Shopsys\FrameworkBundle\Model\Payment\PaymentPriceCalculation $paymentPriceCalculation, \Shopsys\FrameworkBundle\Model\Transport\TransportPriceCalculation $transportPriceCalculation, \App\Model\Order\Item\OrderItemFactory $orderItemFactory, \Shopsys\FrameworkBundle\Model\Payment\Transaction\PaymentTransactionFacade $paymentTransactionFacade, \Shopsys\FrameworkBundle\Model\Payment\Transaction\PaymentTransactionDataFactory $paymentTransactionDataFactory, \Shopsys\FrameworkBundle\Model\Payment\Service\PaymentServiceFacade $paymentServiceFacade, \App\Model\Order\Item\OrderItemDataFactory $orderItemDataFactory, \App\Model\Order\OrderDataFactory $orderDataFactory)
* @method \App\Model\Order\Order edit(int $orderId, \App\Model\Order\OrderData $orderData)
* @method \App\Model\Order\Order[] getLastCustomerOrdersByLimit(\Shopsys\FrameworkBundle\Model\Customer\Customer $customer, int $limit, string $locale)
* @method array<int,\App\Model\Order\Order> findByIds(int[] $ids)
*/
class OrderFacade extends BaseOrderFacade
{
Expand Down
1 change: 1 addition & 0 deletions app/src/Model/Order/OrderRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* @method \App\Model\Order\Order[] getAllWithoutTrackingNumberByTransportType(string $transportType)
* @method \App\Model\Order\Order[] getLastTenCustomerOrders(\Shopsys\FrameworkBundle\Model\Customer\Customer $customer)
* @method \App\Model\Order\Order[] getLastCustomerOrdersByLimit(\Shopsys\FrameworkBundle\Model\Customer\Customer $customer, int $limit, string $locale)
* @method array<int,\App\Model\Order\Order> findByIds(int[] $ids)
*/
class OrderRepository extends BaseOrderRepository
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

declare(strict_types=1);

namespace Tests\App\Functional\Model\Product;

use App\DataFixtures\Demo\ProductDataFixture;
use App\Model\Product\ProductDataFactory;
use App\Model\Product\ProductFacade;
use Shopsys\FrameworkBundle\Component\Domain\Domain;
use Shopsys\FrameworkBundle\Model\Product\ProductVisibilityFacade;
use Tests\App\Test\TransactionFunctionalTestCase;

class ProductVisibilityFacadeTest extends TransactionFunctionalTestCase
{
/**
* @inject
*/
private ProductVisibilityFacade $productVisibilityFacade;

/**
* @inject
*/
private ProductDataFactory $productDataFactory;

/**
* @inject
*/
private ProductFacade $productFacade;

public function testAreProductsVisibleForDefaultPricingGroupOnSomeDomainIndexedByProductId(): void
{
$productId = 1;
$visibilityIndexedByProductId = $this->productVisibilityFacade->areProductsVisibleForDefaultPricingGroupOnEachDomainIndexedByProductId(
[$productId],
);
$this->assertTrue($visibilityIndexedByProductId[$productId]);
}

public function testAreProductsVisibleForDefaultPricingGroupOnEachDomainIndexedByProductId(): void
{
$productId = 1;

$visibilityIndexedByProductId = $this->productVisibilityFacade->areProductsVisibleForDefaultPricingGroupOnEachDomainIndexedByProductId(
[$productId],
);
$this->assertTrue($visibilityIndexedByProductId[$productId]);

$product = $this->getReference(ProductDataFixture::PRODUCT_PREFIX . $productId);
$productData = $this->productDataFactory->createFromProduct($product);
$productData->domainHidden[Domain::FIRST_DOMAIN_ID] = true;

$this->productFacade->edit($productId, $productData);
$this->handleDispatchedRecalculationMessages();

$visibilityIndexedByProductId = $this->productVisibilityFacade->areProductsVisibleForDefaultPricingGroupOnEachDomainIndexedByProductId(
[$productId],
);
$this->assertFalse($visibilityIndexedByProductId[$productId]);

$visibilityIndexedByProductId = $this->productVisibilityFacade->areProductsVisibleForDefaultPricingGroupOnSomeDomainIndexedByProductId(
[$productId],
);
$this->assertTrue($visibilityIndexedByProductId[$productId]);
}
}

0 comments on commit 47b0412

Please sign in to comment.