我使用带有多商店选项的 prestashop 1.6.1.2。
我想更改每个商店的标题颜色。
我使用相同的主题,因为复制不适用于当前主题。
在 header.tpl 我添加了:
if {$shop_name=="myshop"} {literal}<style> .header-top { background-color: #d6644a; }</style>{/literal}{/if}
我用if {$id-shop=="3"}
但标题中没有任何变化
我使用带有多商店选项的 prestashop 1.6.1.2。
我想更改每个商店的标题颜色。
我使用相同的主题,因为复制不适用于当前主题。
在 header.tpl 我添加了:
if {$shop_name=="myshop"} {literal}<style> .header-top { background-color: #d6644a; }</style>{/literal}{/if}
我用if {$id-shop=="3"}
但标题中没有任何变化
这种方式更好,之间有空间
.my_store .header {
background: red;
}
检查您的页面源代码。店名应该是这样的
<!--[if IE 8]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body id="index" class="index my_store hide-left-column hide-right-column lang_en">
店名应该是这样的
<body id="index" class="index my_store hide-left-column hide-right-column lang_en">
在你的 header.tpl 中改变这部分
<body{if isset($page_name)} id="{$page_name|escape:'html':'UTF-8'}"{/if} class="{if isset($page_name)}{$page_name|escape:'html':'UTF-8'}{/if}{if isset($body_classes) && $body_classes|@count} {implode value=$body_classes separator=' '}{/if}{if $hide_left_column} hide-left-column{else} show-left-column{/if}{if $hide_right_column} hide-right-column{else} show-right-column{/if}{if isset($content_only) && $content_only} content_only{/if} lang_{$lang_iso}">
以此将商店的名称包含在 body 类中
<body{if isset($page_name)} id="{$page_name|escape:'html':'UTF-8'}"{/if} class="{if isset($page_name)}{$page_name|escape:'html':'UTF-8'}{/if}{if isset($shop_name) && Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE')} {$shop_name|lower|replace:' ':'_'}{/if}{if isset($body_classes) && $body_classes|@count} {implode value=$body_classes separator=' '}{/if}{if $hide_left_column} hide-left-column{else} show-left-column{/if}{if $hide_right_column} hide-right-column{else} show-right-column{/if}{if isset($content_only) && $content_only} content_only{/if} lang_{$lang_iso}">
然后在你的CSS中你可以使用
.my_store .header {
background: red;
}
更好的方式之间有空间
.shop_pro .header-top {
background: red;
}