Skip to content

Commit

Permalink
Merge pull request #1870 from dpfaffenbauer/issues/1826
Browse files Browse the repository at this point in the history
[FrontendBundle] fix createQuoteAction
  • Loading branch information
dpfaffenbauer authored Feb 17, 2022
2 parents c52047f + 176b95f commit 06bc225
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/CoreShop/Bundle/FrontendBundle/Controller/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use CoreShop\Bundle\OrderBundle\Form\Type\AddToCartType;
use CoreShop\Bundle\OrderBundle\Form\Type\CartType;
use CoreShop\Bundle\OrderBundle\Form\Type\ShippingCalculatorType;
use CoreShop\Bundle\WorkflowBundle\Manager\StateMachineManagerInterface;
use CoreShop\Component\Address\Model\AddressInterface;
use CoreShop\Component\Core\Order\Modifier\CartItemQuantityModifier;
use CoreShop\Component\Order\Cart\CartModifierInterface;
Expand All @@ -30,6 +31,7 @@
use CoreShop\Component\Order\Model\OrderInterface;
use CoreShop\Component\Order\Model\OrderItemInterface;
use CoreShop\Component\Order\Model\PurchasableInterface;
use CoreShop\Component\Order\OrderSaleTransitions;
use CoreShop\Component\Order\Repository\CartPriceRuleVoucherRepositoryInterface;
use CoreShop\Component\Shipping\Calculator\TaxedShippingCalculatorInterface;
use CoreShop\Component\Shipping\Resolver\CarriersResolverInterface;
Expand All @@ -50,6 +52,15 @@ public function widgetAction(Request $request): Response
]);
}

public function createQuoteAction(Request $request, StateMachineManagerInterface $machineManager)
{
$order = $this->getCart();
$workflow = $machineManager->get($order, OrderSaleTransitions::IDENTIFIER);
$workflow->apply($order, OrderSaleTransitions::TRANSITION_QUOTE);

return $this->redirectToRoute('coreshop_quote_detail', ['quote' => $order->getId()]);
}

public function summaryAction(Request $request): Response
{
$cart = $this->getCart();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,8 @@ thumbnails:
- method: scaleByWidth
arguments:
width: 1200
coreshop_productQuote:
items:
- method: scaleByWidth
arguments:
width: 400
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use CoreShop\Bundle\WorkflowBundle\Applier\StateMachineApplierInterface;
use CoreShop\Component\Address\Model\AddressInterface;
use CoreShop\Component\Order\Committer\OrderCommitterInterface;
use CoreShop\Component\Order\Committer\QuoteCommitterInterface;
use CoreShop\Component\Order\Manager\CartManagerInterface;
use CoreShop\Component\Order\Model\OrderInterface;
use CoreShop\Component\Order\NumberGenerator\NumberGeneratorInterface;
Expand All @@ -35,7 +34,7 @@
use Pimcore\Model\DataObject\Service;
use Webmozart\Assert\Assert;

class OrderCommitter implements OrderCommitterInterface, QuoteCommitterInterface
class OrderCommitter implements OrderCommitterInterface
{
public function __construct(protected CartManagerInterface $cartManager, protected FolderCreationServiceInterface $folderCreationService, protected NumberGeneratorInterface $numberGenerator, protected ObjectClonerInterface $objectCloner, protected StateMachineApplierInterface $stateMachineApplier)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use Carbon\Carbon;
use CoreShop\Component\Address\Model\AddressInterface;
use CoreShop\Component\Order\Committer\OrderCommitterInterface;
use CoreShop\Component\Order\Committer\QuoteCommitterInterface;
use CoreShop\Component\Order\Manager\CartManagerInterface;
use CoreShop\Component\Order\Model\OrderInterface;
Expand All @@ -28,7 +27,7 @@
use Pimcore\Model\DataObject\Service;
use Webmozart\Assert\Assert;

class QuoteCommitter implements OrderCommitterInterface, QuoteCommitterInterface
class QuoteCommitter implements QuoteCommitterInterface
{
protected string $orderFolderPath;

Expand Down

0 comments on commit 06bc225

Please sign in to comment.