-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MC-30989: Adding a configurable product to the cart from the cross-se…
…lls tab shows a 404
- Loading branch information
1 parent
a25c107
commit 909d479
Showing
7 changed files
with
140 additions
and
38 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
app/code/Magento/Catalog/ViewModel/Product/Listing/PreparePostData.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Catalog\ViewModel\Product\Listing; | ||
|
||
use Magento\Framework\View\Element\Block\ArgumentInterface; | ||
use Magento\Framework\App\ActionInterface; | ||
use Magento\Framework\Url\Helper\Data as UrlHelper; | ||
|
||
/** | ||
* Check is available add to compare. | ||
*/ | ||
class PreparePostData implements ArgumentInterface | ||
{ | ||
/** | ||
* @var UrlHelper | ||
*/ | ||
private $urlHelper; | ||
|
||
/** | ||
* @param UrlHelper $urlHelper | ||
*/ | ||
public function __construct(UrlHelper $urlHelper) | ||
{ | ||
$this->urlHelper = $urlHelper; | ||
} | ||
|
||
/** | ||
* Wrapper for the PostHelper::getPostData() | ||
* | ||
* @param string $url | ||
* @param array $data | ||
* @return array | ||
*/ | ||
public function getPostData(string $url, array $data = []):array | ||
{ | ||
if (!isset($data[ActionInterface::PARAM_NAME_URL_ENCODED])) { | ||
$data[ActionInterface::PARAM_NAME_URL_ENCODED] = $this->urlHelper->getEncodedUrl(); | ||
} | ||
return ['action' => $url, 'data' => $data]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters