Skip to content

Commit

Permalink
Merge pull request magento#104 from magento-vanilla/PR
Browse files Browse the repository at this point in the history
[Vanilla] Sprint 13
  • Loading branch information
vpelipenko committed Mar 2, 2015
2 parents 1faf79c + 5a16dd2 commit c587bcc
Show file tree
Hide file tree
Showing 50 changed files with 952 additions and 646 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ $product = $block->getSaleableItem();
<?php endforeach; ?>
</ul>
<?php if ($msrpShowOnGesture):?>
<script>
require(["jquery", "mage/mage"], function($){

$('.product-info-main').mage('tierPrice', {
inputQty: '#qty',
productForm: '#product_addtocart_form'
});

});
</script>
<script type="text/x-magento-init">
{
".product-info-main": {
"tierPrice": {
"inputQty": "#qty",
"productForm": "#product_addtocart_form"
}
}
}
</script>
<?php endif;?>
<?php endif; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,20 @@ $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');
<div class="product-addto-links" data-role="add-to-links">
<?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?>
<a href="#"
class="action towishlist"
title="<?php echo __('Add to Wishlist') ?>"
data-post='<?php echo $_wishlistSubmitParams; ?>'
data-action="add-to-wishlist"><span><?php echo __('Add to Wishlist') ?></span></a>
class="action towishlist"
title="<?php echo __('Add to Wishlist') ?>"
data-post='<?php echo $_wishlistSubmitParams; ?>'
data-action="add-to-wishlist"><span><?php echo __('Add to Wishlist') ?></span></a>
<?php endif; ?>
<a href="#" data-post='<?php echo $compareHelper->getPostDataParams($_product);?>'
data-role="add-to-links"
title="<?php echo __('Add to Compare') ?>"
class="action tocompare"><span><?php echo __('Add to Compare') ?></span></a>
data-role="add-to-links"
title="<?php echo __('Add to Compare') ?>"
class="action tocompare"><span><?php echo __('Add to Compare') ?></span></a>
</div>
<script>
require([
"jquery",
"mage/mage"
], function(jQuery){
jQuery('body').mage('addToWishlist',
<?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($block->getWishlistOptions())?>
);
});
<script type="text/x-magento-init">
{
"body": {
"addToWishlist": <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($block->getWishlistOptions())?>
}
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,38 @@
</fieldset>
</div>
<?php endif; ?>
<?php if ($block->isRedirectToCartEnabled()) : ?>
<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"Magento_Catalog/product/view/validation": {
"radioCheckboxClosest": ".nested"
}
}
}
</script>
<?php else : ?>
<script>
<?php if ($block->isRedirectToCartEnabled()) : ?>
require([
"jquery",
"mage/mage",
"Magento_Catalog/product/view/validation"
], function($){
$('#product_addtocart_form').mage('validation', {
radioCheckboxClosest: '.nested'
});
});
<?php else : ?>
require([
"jquery",
"mage/mage",
"Magento_Catalog/product/view/validation",
"Magento_Catalog/js/catalog-add-to-cart"
], function($){
$('#product_addtocart_form').mage('validation', {
radioCheckboxClosest: '.nested',
submitHandler: function(form) {
var widget = $(form).catalogAddToCart({bindSubmit: false});
widget.catalogAddToCart('submitForm', $(form));
return false;
}
});
require([
'jquery',
'mage/mage',
'Magento_Catalog/product/view/validation',
'Magento_Catalog/js/catalog-add-to-cart'
], function ($) {
'use strict';

$('#product_addtocart_form').mage('validation', {
radioCheckboxClosest: '.nested',
submitHandler: function (form) {
var widget = $(form).catalogAddToCart({
bindSubmit: false
});

widget.catalogAddToCart('submitForm', $(form));

return false;
}
});
<?php endif; ?>
});
</script>
<?php endif; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -138,40 +138,39 @@ $thumbHeight = $block->getVar("product_page_more_views:height") ?: $thumbWidth;
<script data-template="notice" type="text/x-magento-template">
<p class="notice" data-role="notice"><%= data.text %></p>
</script>
<script>
require(["jquery", "mage/mage"], function($){

$('[data-role=media-gallery]')
.mage('gallery', {
sizes: {
small: {
width: <?php echo $thumbWidth ?>,
height: <?php echo $thumbHeight ?>
<script type="text/x-magento-init">
{
"[data-role=media-gallery]": {
"gallery": {
"sizes": {
"small": {
"width": <?php echo $thumbWidth ?>,
"height": <?php echo $thumbHeight ?>
},
medium: {
width: <?php echo $_resizedWidth ?>,
height: <?php echo $_resizedHeight ?>
"medium": {
"width": <?php echo $_resizedWidth ?>,
"height": <?php echo $_resizedHeight ?>
}
},
controls: {
notice: {
text: '<?php echo $block->escapeJsQuote(__("Click on image to view it full sized")) ?>'
"controls": {
"notice": {
"text": "<?php echo $block->escapeJsQuote(__('Click on image to view it full sized')) ?>"
}
}
})
.mage('zoom', {
controls: {
display: {
left: 20,
top: 65
},
"zoom": {
"controls": {
"display": {
"left": 20,
"top": 65
},
notice: {
text: '<?php echo $block->escapeJsQuote(__("Click on image to zoom")) ?>'
"notice": {
"text": "<?php echo $block->escapeJsQuote(__('Click on image to zoom')) ?>"
}
}
})
.mage('galleryFullScreen', {});

});
</script>
},
"galleryFullScreen": {}
}
}
</script>
<?php endif; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@

<?php $_options = $block->decorateArray($block->getOptions()) ?>
<?php if (count($_options)):?>
<script>
require([ 'jquery', 'Magento_Catalog/js/price-options' ], function($){
$('#product_addtocart_form')
.priceOptions({
'optionConfig':<?php echo $block->getJsonConfig()?>,
'controlContainer': '.field',
'priceHolderSelector': '[data-role=priceBox]'
});
});
<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"priceOptions": {
"optionConfig": <?php echo $block->getJsonConfig()?>,
"controlContainer": ".field",
"priceHolderSelector": "[data-role=priceBox]"
}
}
}
</script>
<?php foreach ($_options as $_option): ?>
<?php echo $block->getOptionHtml($_option) ?>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<?php $_optionId = $_option->getId() ?>
<?php $class = ($_option->getIsRequire()) ? ' required' : ''; ?>
<div class="field date<?php echo $class; ?>"
data-mage-init='{"priceOptionDate":{"fromSelector":"#product_addtocart_form"}}'>
data-mage-init='{"priceOptionDate":{"fromSelector":"#product_addtocart_form"}}'>
<label class="label">
<span><?php echo $block->escapeHtml($_option->getTitle()) ?></span>
<?php echo $block->getFormatedPrice() ?>
Expand All @@ -31,26 +31,25 @@

<?php if ($_option->getIsRequire()): ?>
<input type="hidden"
name="validate_datetime_<?php echo $_optionId ?>"
class="validate-datetime-<?php echo $_optionId ?>"
value=""
data-validate="{'validate-required-datetime':<?php echo $_optionId?>}"/>
name="validate_datetime_<?php echo $_optionId ?>"
class="validate-datetime-<?php echo $_optionId ?>"
value=""
data-validate="{'validate-required-datetime':<?php echo $_optionId?>}"/>
<?php else: ?>
<input type="hidden"
name="validate_datetime_<?php echo $_optionId ?>"
class="validate-datetime-<?php echo $_optionId ?>"
value=""
data-validate="{'validate-optional-datetime':<?php echo $_optionId?>}"/>
name="validate_datetime_<?php echo $_optionId ?>"
class="validate-datetime-<?php echo $_optionId ?>"
value=""
data-validate="{'validate-optional-datetime':<?php echo $_optionId?>}"/>
<?php endif; ?>
<script>
require([
'jquery',
'mage/mage'
], function($){
$('#product_addtocart_form').mage('validation', {
ignore: ':hidden:not(input[name^="validate_datetime_"])'
});
});
</script>
<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"validation": {
"ignore": ":hidden:not(input[name^='validate_datetime_'])"
}
}
}
</script>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,15 @@
</div>
</fieldset>
</div>

<script>
require([
"jquery",
"mage/mage"
], function($){

var addtocartForm = $('#product_addtocart_form');
addtocartForm.mage('validation');
addtocartForm.mage('addToCart', {
cartButtonId: "#product-updatecart-button",
cartForm: "#product_addtocart_form"
});

});
</script>
<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"validation": {},
"addToCart": {
"cartButtonId": "#product-updatecart-button",
"cartForm": "#product_addtocart_form"
}
}
}
</script>
<?php endif; ?>
Loading

0 comments on commit c587bcc

Please sign in to comment.