Commit 0ddb698c by lmf

优化色块取消提示

parent 9f289db8
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<catalog>
<frontend>
<swatches_per_product>16</swatches_per_product>
<show_swatches_in_product_list>1</show_swatches_in_product_list>
<show_swatch_tooltip>0</show_swatch_tooltip>
</frontend>
</catalog>
<system>
<media_storage_configuration>
<allowed_resources>
<swatches_folder>attribute</swatches_folder>
</allowed_resources>
</media_storage_configuration>
</system>
<general>
<validator_data>
<input_types>
<swatch_visual>swatch_visual</swatch_visual>
<swatch_text>swatch_text</swatch_text>
</input_types>
</validator_data>
</general>
</default>
</config>
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php
/** @var $block \Magento\Swatches\Block\Product\Renderer\Configurable */
/** @var \Magento\Swatches\ViewModel\Product\Renderer\Configurable $configurableViewModel */
$configurableViewModel = $block->getConfigurableViewModel()
?>
<div class="swatch-opt" data-role="swatch-options"></div>
<script type="text/x-magento-init">
{
"[data-role=swatch-options]": {
"Magento_Swatches/js/swatch-renderer": {
"jsonConfig": <?= /* @noEscape */ $swatchOptions = $block->getJsonConfig() ?>,
"jsonSwatchConfig": <?= /* @noEscape */ $swatchOptions = $block->getJsonSwatchConfig() ?>,
"mediaCallback": "<?= $block->escapeJs($block->escapeUrl($block->getMediaCallback())) ?>",
"gallerySwitchStrategy": "<?= $block->escapeJs($block->getVar('gallery_switch_strategy', 'Magento_ConfigurableProduct')) ?: 'replace'; ?>",
"jsonSwatchImageSizeConfig": <?= /* @noEscape */ $block->getJsonSwatchSizeConfig() ?>,
"showTooltip": <?= $block->escapeJs($configurableViewModel->getShowSwatchTooltip()) ?>
}
},
"*" : {
"Magento_Swatches/js/catalog-add-to-cart": {}
}
}
</script>
require([
'jquery',
'Magento_ConfigurableProduct/js/options-updater'
], function ($, Updater) {
'use strict';
var selectors = {
formSelector: '#product_addtocart_form',
swatchSelector: '.swatch-opt'
},
swatchWidgetName = 'mageSwatchRenderer',
widgetInitEvent = 'swatch.initialized',
/**
* Sets all configurable swatch attribute's selected values
*/
updateSwatchOptions = function () {
var swatchWidget = $(selectors.swatchSelector).data(swatchWidgetName);
if (!swatchWidget || !swatchWidget._EmulateSelectedByAttributeId) {
return;
}
swatchWidget._EmulateSelectedByAttributeId(this.productOptions);
},
updater = new Updater(widgetInitEvent, updateSwatchOptions);
updater.listen();
});
......@@ -1592,4 +1592,15 @@ button.action.submit.primary {
}
//色块强制大小
#product-options-wrapper .swatch-option.image{
width: 40px !important;;
height: 40px !important;;
border-radius: 50% !important;;
}
//颜色提示强制关闭
.breeze .field-tooltip-content, .breeze .dropdown.options .dropdown, .breeze .tooltip.wrapper .tooltip.content, .breeze .minicart-wrapper .mage-dropdown-dialog, .breeze .minisearch .search-autocomplete, .breeze .map-popup, .breeze .navigation .submenu, .breeze .swatch-option-tooltip {
display: none !important;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment