Hotcakes 电子商务模块的 Google 电子商务脚本

问题描述 投票:0回答:2

我的网站使用 Hotcakes 电子商务工具。我的网站正在使用 DNN 平台。

因为我有2个不同的网站和产品需要追踪到Google电子商务,所以我需要2套Google电子商务代码。

一个是

ga('ecommerce:send');
,可以,另一个必须是
ga('Hatch.ecommerce:send');

但是 Hotcakes 不允许我修改 Google 电子商务代码。所以我必须把它关掉并自己编辑到视图模型中

我已经实现了代码,但它导致页面上的视图错误。

有人可以帮我解决这个问题吗?

它给出了此错误消息“发生错误。错误:当前无法结帐。”

这是“receipt.cshtml”的代码。我在底部附近添加了 Google 电子商务代码:

@model Hotcakes.Modules.Core.Models.OrderViewModel
<div class="hc-receipt">
<h2>Thank you for purchasing</h2>
We know you will love creating beautiful embroidery designs with our Hatch products.<br /><br />
<a href="https://dyul59n6ntr4m.cloudfront.net/Hatch_Setup.exe">Click here to download Hatch Embroidery</a><br /><br />
<strong>You are not required to download Hatch If you purchased:</strong>
<ul>
<li>Additional Hatch add-ons</li>
<li>An UPGRADE to Embroidery Creator or Embroidery Digitizer</li>
<li>Hatch Fonts Packs</li>
</ul>
Simply RESTART the software for your new purchase to be available.<br />
Have fun and please share your creations with us on our <a href="https://www.facebook.com/wilcom" target="new">Facebook page</a><br />
@Html.Partial("_SetFirstPassword")
@Html.Partial("_ViewOrder", Model)
@for (int i = 0; i < Model.Items.Count(); i++)
{
var item = Model.Items.ElementAt(i);
@item.ProductName
<span>@item.ProductSku</span><br />
**<script type="text/javascript">
ga('Hatch.ecommerce:addTransaction', {
'id': '149428',
'affiliation': 'Hatch Embroidery Online Shop',
'revenue': '0',
'shipping': '0',
'tax': '@model.LocalOrder.TotalTax',
'city': '@model.LocalOrder.BillingAddress.City',
'state': '@model.LocalOrder.BillingAddress.RegionDisplayName',
'country': '@model.LocalOrder.BillingAddress.CountryDisplayName'
});
ga('Hatch.ecommerce:addItem', {
'id': '@item.Id',
'name': '@item.ProductName',
'sku': '@item.ProductSku',
'category': 'Hatch Product',
'price': '@item.AdjustedPricePerItem',
'quantity': '@item.Quantity'
});
ga('Hatch.ecommerce:send');
</script>** 
}
</div>

我认为如果客户购买多种产品,它必须在循环内...... 如果您能提供一些提示或帮助,那就太好了…… 谢谢 杰克

e-commerce dotnetnuke
2个回答
1
投票

在查看您的代码时,“模型”与“模型”之间似乎存在一些拼写错误,脚本标记中存在额外的空格和字符,并且产品名称没有按照 Razor 期望的方式正确使用。我不确定这是否能解决您遇到的所有问题,但到目前为止,它们似乎都是 Razor 语法和拼写错误问题。

@model Hotcakes.Modules.Core.Models.OrderViewModel
<div class="hc-receipt">
    <h2>Thank you for purchasing</h2>
    We know you will love creating beautiful embroidery designs with our Hatch products.<br /><br />
    <a href="https://dyul59n6ntr4m.cloudfront.net/Hatch_Setup.exe">Click here to download Hatch Embroidery</a><br /><br />
    <strong>You are not required to download Hatch If you purchased:</strong>
    <ul>
        <li>Additional Hatch add-ons</li>
        <li>An UPGRADE to Embroidery Creator or Embroidery Digitizer</li>
        <li>Hatch Fonts Packs</li>
    </ul>
    Simply RESTART the software for your new purchase to be available.<br />
    Have fun and please share your creations with us on our <a href="https://www.facebook.com/wilcom" target="new">Facebook page</a><br />
    @Html.Partial("_SetFirstPassword")
    @Html.Partial("_ViewOrder", Model)
    @for (int i = 0; i < Model.Items.Count(); i++)
    {
        var item = @Model.Items.ElementAt(i);
        <text>@item.ProductName</text>
        <span>@item.ProductSku</span><br />
        <script type="text/javascript">
            ga('Hatch.ecommerce:addTransaction', {
                'id': '149428',
                'affiliation': 'Hatch Embroidery Online Shop',
                'revenue': '0',
                'shipping': '0',
                'tax': '@Model.LocalOrder.TotalTax',
                'city': '@Model.LocalOrder.BillingAddress.City',
                'state': '@Model.LocalOrder.BillingAddress.RegionDisplayName',
                'country': '@Model.LocalOrder.BillingAddress.CountryDisplayName'
            });
            ga('Hatch.ecommerce:addItem', {
                'id': '@item.Id',
                'name': '@item.ProductName',
                'sku': '@item.ProductSku',
                'category': 'Hatch Product',
                'price': '@item.AdjustedPricePerItem',
                'quantity': '@item.Quantity'
            });
            ga('Hatch.ecommerce:send');
        </script>
    }
</div>

0
投票

购买XXXTentacion连帽衫不仅仅是一次交易;更是一次交易。这是与颇具影响力的说唱歌手 XXXTentacion 的遗产建立联系的有效方式。这些连帽衫通常带有受他的音乐启发的标志性图案、歌词和符号,使它们不仅仅是一件衣服。

© www.soinside.com 2019 - 2024. All rights reserved.