Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.1-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #12928: Issues #10559 - Extend swatch using mixins (M2.1) (by @srenon)
 - #14151: [Backport 2.1] 8373: Fix CURL Json POST (by @simpleadm)


Fixed GitHub Issues:
 - #10559: Extending swatch functionality using javascript mixins does not work in Safari and MS Edge (reported by @srenon) has been fixed in #12928 by @srenon in 2.1-develop branch
   Related commits:
     1. 155f91c

 - #3489: CURL Json POST (reported by @Grohotun) has been fixed in #14151 by @simpleadm in 2.1-develop branch
   Related commits:
     1. a676af8
  • Loading branch information
magento-engcom-team authored Mar 17, 2018
2 parents 08648cb + e9fb542 commit 00d657a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
* See COPYING.txt for license details.
*/
?>
<?php /** @var $block \Magento\Swatches\Block\Product\Renderer\Listing\Configurable */ ?>
<div class="swatch-opt-<?php /* @escapeNotVerified */ echo $block->getProduct()->getId() ?>"></div>
<script>
require(
["jquery", "jquery/ui", "Magento_Swatches/js/swatch-renderer", "Magento_Swatches/js/catalog-add-to-cart"],
function ($) {
$('.swatch-opt-<?php /* @escapeNotVerified */ echo $block->getProduct()->getId() ?>').SwatchRenderer({
selectorProduct: '.product-item-details',
onlySwatches: true,
enableControlLabel: false,
numberToShow: <?php /* @escapeNotVerified */ echo $block->getNumberSwatchesPerProduct(); ?>,
jsonConfig: <?php /* @escapeNotVerified */ echo $block->getJsonConfig(); ?>,
jsonSwatchConfig: <?php /* @escapeNotVerified */ echo $block->getJsonSwatchConfig(); ?>,
mediaCallback: '<?php /* @escapeNotVerified */ echo $block->getMediaCallback() ?>'
});
});
<div class="swatch-opt-<?php /* @escapeNotVerified */ echo $block->getProduct()->getId() ?>"
data-role="swatch-option-<?php /* @escapeNotVerified */ echo $block->getProduct()->getId() ?>"
></div>

<script type="text/x-magento-init">
{
"[data-role=swatch-option-<?php /* @escapeNotVerified */ echo $block->getProduct()->getId() ?>]": {
"Magento_Swatches/js/swatch-renderer": {
"selectorProduct": ".product-item-details",
"onlySwatches": true,
"enableControlLabel": false,
"numberToShow": <?php /* @escapeNotVerified */ echo $block->getNumberSwatchesPerProduct(); ?>,
"jsonConfig": <?php /* @escapeNotVerified */ echo $block->getJsonConfig(); ?>,
"jsonSwatchConfig": <?php /* @escapeNotVerified */ echo $block->getJsonSwatchConfig(); ?>,
"mediaCallback": "<?php /* @escapeNotVerified */ echo $block->getMediaCallback() ?>"
},
"Magento_Swatches/js/catalog-add-to-cart": {}
}
}
</script>
13 changes: 10 additions & 3 deletions lib/internal/Magento/Framework/HTTP/Client/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,11 @@ public function get($uri)
/**
* Make POST request
*
* String type was added to parameter $param in order to support sending JSON or XML requests.
* This feature was added base on Community Pull Request https://github.com/magento/magento2/pull/8373
*
* @param string $uri
* @param array $params
* @param array|string $params
* @return void
*
* @see \Magento\Framework\HTTP\Client#post($uri, $params)
Expand Down Expand Up @@ -327,9 +330,13 @@ public function getStatus()

/**
* Make request
*
* String type was added to parameter $param in order to support sending JSON or XML requests.
* This feature was added base on Community Pull Request https://github.com/magento/magento2/pull/8373
*
* @param string $method
* @param string $uri
* @param array $params
* @param array|string $params - use $params as a string in case of JSON or XML POST request.
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
Expand All @@ -340,7 +347,7 @@ protected function makeRequest($method, $uri, $params = [])
$this->curlOption(CURLOPT_URL, $uri);
if ($method == 'POST') {
$this->curlOption(CURLOPT_POST, 1);
$this->curlOption(CURLOPT_POSTFIELDS, http_build_query($params));
$this->curlOption(CURLOPT_POSTFIELDS, is_array($params) ? http_build_query($params) : $params);
} elseif ($method == "GET") {
$this->curlOption(CURLOPT_HTTPGET, 1);
} else {
Expand Down

0 comments on commit 00d657a

Please sign in to comment.