所以我希望我的购物车总是链接,当点击标题在移动设备上,脚本我有在所有平台上都很好,但想严格它只移动。脚本在我的blockcart.tpl文件(prestashop 1.6.1.9)中。
{literal}
<script type="text/javascript">
$(".shopping_cart").click(function() {
location.href = "{/literal}
{$link->getPageLink($order_process,true)|escape:'html':'UTF-8'}
{literal}"; });
</script>
{/literal} 让这个脚本只针对移动设备有什么帮助吗?
我尝试了一下(但不起作用):
{literal}
{if isset($displayMobile)}
<script type="text/javascript">
$(".shopping_cart").click(function() {
location.href = "{/literal}
{$link->getPageLink($order_process,true)|escape:'html':'UTF-8'}
{literal}"; });
</script>
{/if}
{/literal} 发布于 2017-02-24 13:55:18
PrestaShop中有一个用来检测移动设备的PHP类。您可以使用它来检测移动设备,并传递一个smarty变量来签入您的blockcart.tpl
$mobile = new Mobile_Detect();
if ($mobile->isMobile()) {
$this->context->smarty->assign('ismobile', 1);
} else {
$this->context->smarty->assign('ismobile', 0);
}https://stackoverflow.com/questions/42418306
复制相似问题