Skip to content

Commit

Permalink
Merge pull request #1403 from spryker/bugfix/ps-11725-quick-order-cre…
Browse files Browse the repository at this point in the history
…ate-order

PS-11725 "Quick-order" kills active cart
  • Loading branch information
dereuromark authored Dec 27, 2019
2 parents bde7859 + 655bd2f commit 76cc9a6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@
<transfer name="CsvFile">
</transfer>

<transfer name="Quote">
</transfer>

</transfers>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace SprykerShop\Yves\QuickOrderPage\Dependency\Client;

use Generated\Shared\Transfer\QuoteTransfer;

class QuickOrderPageToQuoteClientBridge implements QuickOrderPageToQuoteClientInterface
{
/**
Expand All @@ -23,10 +25,12 @@ public function __construct($quoteClient)
}

/**
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return void
*/
public function clearQuote()
public function setQuote(QuoteTransfer $quoteTransfer)
{
$this->quoteClient->clearQuote();
$this->quoteClient->setQuote($quoteTransfer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@

namespace SprykerShop\Yves\QuickOrderPage\Dependency\Client;

use Generated\Shared\Transfer\QuoteTransfer;

interface QuickOrderPageToQuoteClientInterface
{
/**
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return void
*/
public function clearQuote();
public function setQuote(QuoteTransfer $quoteTransfer);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Generated\Shared\Transfer\ItemTransfer;
use Generated\Shared\Transfer\QuickOrderTransfer;
use Generated\Shared\Transfer\QuoteTransfer;
use SprykerShop\Yves\QuickOrderPage\Dependency\Client\QuickOrderPageToCartClientInterface;
use SprykerShop\Yves\QuickOrderPage\Dependency\Client\QuickOrderPageToQuoteClientInterface;
use SprykerShop\Yves\QuickOrderPage\Dependency\Client\QuickOrderPageToZedRequestClientInterface;
Expand Down Expand Up @@ -96,9 +97,9 @@ public function addToEmptyCart(QuickOrderTransfer $quickOrderTransfer): bool
return false;
}

$this->quoteClient->clearQuote();
$this->clearQuote();

return $this->addToCart($quickOrderTransfer);
return $this->addItemsToCart($quickOrderTransfer);
}

/**
Expand All @@ -111,6 +112,14 @@ protected function hasItems(QuickOrderTransfer $quickOrderTransfer): bool
return (bool)$quickOrderTransfer->getItems()->count();
}

/**
* @return void
*/
protected function clearQuote(): void
{
$this->quoteClient->setQuote(new QuoteTransfer());
}

/**
* @param \Generated\Shared\Transfer\QuickOrderTransfer $quickOrderTransfer
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ protected function flattenColumns(ProductConcreteTransfer $productConcreteTransf

foreach ($quickOrderFormColumnPlugins as $additionalColumnPlugin) {
$path = $additionalColumnPlugin->getDataPath();
$columns[$path] = $this->getDataByPath($productConcreteTransfer, $path);
$data = $this->getDataByPath($productConcreteTransfer, $path);

if ($data) {
$columns[$path] = $data;
}
}

return $columns;
Expand Down

0 comments on commit 76cc9a6

Please sign in to comment.