Commit 82ff69b7 by wd

修复ui组件重复以及数据未过滤问题

parent 32b3fca9
...@@ -122,8 +122,8 @@ class Data extends AbstractHelper ...@@ -122,8 +122,8 @@ class Data extends AbstractHelper
if ($collection->getData()) { if ($collection->getData()) {
foreach ($collection as $barItem) { foreach ($collection as $barItem) {
if ($this->isStoreMatched($barItem['store_id']) && if ($this->isStoreMatched($barItem['store_id']) &&
$this->isCustomerGroupMatched($barItem['customer_group_id'])) { $this->isCustomerGroupMatched($barItem['customer_group_id']) && $barItem->getData('bar_layout_position') != 'insert_snippet') {
return $barItem->getData(); return $barItem->getData();
} }
} }
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<?php <?php
$isModuleEnable = $block->getConfig('sparsh_free_shipping_bar/general/enable'); $isModuleEnable = $block->getConfig('sparsh_free_shipping_bar/general/enable');
$isFreeShippingBarAvailable = null; $isFreeShippingBarAvailable = null;
if ($isModuleEnable): if ($isModuleEnable):
$layoutPosition = $block->getData('position') ? $block->getData('position') : null; $layoutPosition = $block->getData('position') ? $block->getData('position') : null;
$entityId = $block->getData('entity_id') ? $block->getData('entity_id') : null; $entityId = $block->getData('entity_id') ? $block->getData('entity_id') : null;
...@@ -28,15 +29,18 @@ endif; ...@@ -28,15 +29,18 @@ endif;
.sparsh-free-shipping-bar-goal-message{ .sparsh-free-shipping-bar-goal-message{
width: 100%; width: 100%;
height: 60px; height: 60px;
background-image: url("<?= $block->getImgUrl($barData['background_img']) ?>");
line-height: 60px; line-height: 60px;
background-size: 100% 100%!important; background-size: 100% 100%!important;
background-repeat: no-repeat; background-repeat: no-repeat;
text-align: center;
}
.sparsh-free-shipping-bar-goal-message-back-<?= $barData['entity_id']; ?>{
background-image: url('<?= $block->getImgUrl($barData['background_img']) ?>');
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.sparsh-free-shipping-bar-goal-message{ .sparsh-free-shipping-bar-goal-message{
background-image: url("<?= $block->getImgUrl($barData['background_img_phone']) ?>");
width: 100%; width: 100%;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
...@@ -44,14 +48,17 @@ endif; ...@@ -44,14 +48,17 @@ endif;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.sparsh-free-shipping-bar-goal-message-back-<?= $barData['entity_id']; ?>{
background-image: url('<?= $block->getImgUrl($barData['background_img_phone']) ?>');
}
} }
</style> </style>
<div class="sparsh-free-shipping-bar-goal-message" <div class="sparsh-free-shipping-bar-goal-message sparsh-free-shipping-bar-goal-message-back-<?= $barData['entity_id']; ?>"
style=" background-size: 100%; text-align: center; background-color: <?= /* @noEscape */ $barData['bar_background_color']?>; font-size: <?= /* @noEscape */ $barData['bar_font_size'].'px'?>"> style=" background-color: <?= /* @noEscape */ $barData['bar_background_color']?>; font-size: <?= /* @noEscape */ $barData['bar_font_size'].'px'?>">
<a <?= /* @noEscape */ $barData['is_clickable'] ? 'href='.$barData['bar_link_url'] : null ?> <a <?= /* @noEscape */ $barData['is_clickable'] ? 'href='.$barData['bar_link_url'] : null ?>
<?= /* @noEscape */ $barData['is_clickable'] ? ($barData['is_link_open_in_new_page'] ? 'target=_blank' : 'target=_self') : null ?> <?= /* @noEscape */ $barData['is_clickable'] ? ($barData['is_link_open_in_new_page'] ? 'target=_blank' : 'target=_self') : null ?>
style="width: 100%;height: 100%; display: block; color: <?= /* @noEscape */ $barData['bar_text_color']?>"> style="width: 100%;height: 100%; display: block; color: <?= /* @noEscape */ $barData['bar_text_color']?>">
<div data-bind="scope: 'free-shipping-scope'"> <div data-bind="scope: 'free-shipping-scope<?= $barData['entity_id']; ?>'">
<p data-bind="html: goalMessage"></p> <p data-bind="html: goalMessage"></p>
</div> </div>
</a> </a>
...@@ -61,7 +68,7 @@ endif; ...@@ -61,7 +68,7 @@ endif;
"*": { "*": {
"Magento_Ui/js/core/app": { "Magento_Ui/js/core/app": {
"components": { "components": {
"free-shipping-scope": { "free-shipping-scope<?= $barData['entity_id']; ?>": {
"component": "Sparsh_FreeShippingBar/js/free_shipping_bar", "component": "Sparsh_FreeShippingBar/js/free_shipping_bar",
"goal": "<?= /* @noEscape */ $barData['goal'] ?>", "goal": "<?= /* @noEscape */ $barData['goal'] ?>",
"currency": "<?= /* @noEscape */ $block->getCurrentCurrencySymbol() ?>", "currency": "<?= /* @noEscape */ $block->getCurrentCurrencySymbol() ?>",
......
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