-
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.
Merge pull request #1558 from magento-tango/2.1-DEVELOP-PR
Bugs - MAGETWO-70892 [Backport] - [Google Tag Manager] Ajax "Add to Cart" / "Remove from Cart" do not fire any events - for 2.1 - MAGETWO-71398 Attribute values on store view level not searchable - MAGETWO-69560 [Backport] - Out of stock configurable product displays with zero price - for 2.1 - MAGETWO-70606 [Backport] - [GITHUB] Simple product videos display the thumbnail image rather than the embedded video player. #6360 - for 2.1
- Loading branch information
Showing
27 changed files
with
1,094 additions
and
171 deletions.
There are no files selected for viewing
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
48 changes: 48 additions & 0 deletions
48
app/code/Magento/Catalog/view/frontend/web/js/validate-product.js
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,48 @@ | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
define([ | ||
'jquery', | ||
'mage/mage', | ||
'Magento_Catalog/product/view/validation', | ||
'catalogAddToCart' | ||
], function ($) { | ||
'use strict'; | ||
|
||
$.widget('mage.productValidate', { | ||
options: { | ||
bindSubmit: false, | ||
radioCheckboxClosest: '.nested' | ||
}, | ||
|
||
/** | ||
* Uses Magento's validation widget for the form object. | ||
* @private | ||
*/ | ||
_create: function () { | ||
var bindSubmit = this.options.bindSubmit; | ||
|
||
this.element.validation({ | ||
radioCheckboxClosest: this.options.radioCheckboxClosest, | ||
|
||
/** | ||
* Uses catalogAddToCart widget as submit handler. | ||
* @param {Object} form | ||
* @returns {Boolean} | ||
*/ | ||
submitHandler: function (form) { | ||
var jqForm = $(form).catalogAddToCart({ | ||
bindSubmit: bindSubmit | ||
}); | ||
|
||
jqForm.catalogAddToCart('submitForm', jqForm); | ||
|
||
return false; | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
return $.mage.productValidate; | ||
}); |
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
57 changes: 57 additions & 0 deletions
57
app/code/Magento/ConfigurableProduct/Block/Plugin/Product/Media/Gallery.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,57 @@ | ||
<?php | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\ConfigurableProduct\Block\Plugin\Product\Media; | ||
|
||
use Magento\ConfigurableProduct\Model\Product\Type\Configurable; | ||
use Magento\Catalog\Model\Product; | ||
|
||
/** | ||
* Provides a serialized media gallery data for configurable product options. | ||
*/ | ||
class Gallery | ||
{ | ||
/** | ||
* @param \Magento\Catalog\Block\Product\View\Gallery $subject | ||
* @param string $result | ||
* @return string | ||
*/ | ||
public function afterGetOptionsMediaGalleryDataJson( | ||
\Magento\Catalog\Block\Product\View\Gallery $subject, | ||
$result | ||
) { | ||
$result = json_decode($result, true); | ||
$parentProduct = $subject->getProduct(); | ||
if ($parentProduct->getTypeId() == Configurable::TYPE_CODE) { | ||
/** @var Configurable $productType */ | ||
$productType = $parentProduct->getTypeInstance(); | ||
$products = $productType->getUsedProducts($parentProduct); | ||
/** @var Product $product */ | ||
foreach ($products as $product) { | ||
$key = $product->getId(); | ||
$result[$key] = $this->getProductGallery($product); | ||
} | ||
} | ||
return json_encode($result); | ||
} | ||
|
||
/** | ||
* @param Product $product | ||
* @return array | ||
*/ | ||
private function getProductGallery($product) | ||
{ | ||
$result = []; | ||
$images = $product->getMediaGalleryImages(); | ||
foreach ($images as $image) { | ||
$result[] = [ | ||
'mediaType' => $image->getMediaType(), | ||
'videoUrl' => $image->getVideoUrl(), | ||
'isBase' => $product->getImage() == $image->getFile(), | ||
]; | ||
} | ||
return $result; | ||
} | ||
} |
Oops, something went wrong.