我正在为我的网站使用Hotcake电子商务工具。我的网站使用的是DNN平台。
因为我有2个不同的网站和产品需要跟踪到谷歌电子商务,因此我需要2套谷歌电子商务代码。
一个是ga('ecommerce:send');,这没问题,另一个必须是ga('Hatch.ecommerce:send');
但是,Hotcake不允许我修改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>我认为如果客户购买多个产品…,它必须在循环中。如果你能给这个…一些提示或帮助,那就太好了。。谢谢,杰克
发布于 2016-04-20 23:57:49
在查看您的代码时,"model“和"Model”中似乎有一些拼写错误,script标记中有额外的空格和字符,产品名称的使用方式也不符合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>https://stackoverflow.com/questions/36733141
复制相似问题