1
A
回答
1
我打算假設你使用Hotcakes 1.xx而不是2.xx版本,但代碼應該是對於兩者都是相同的。我只在01.10.04進行了測試。
我已經建立了一個基於您可以在視圖中找到的購物車視圖來完成此操作的示例。
原來的願望列表視圖看起來是這樣的:
@model IEnumerable<Hotcakes.Modules.Core.Areas.Account.Models.SavedItemViewModel>
<h2>@Localization.GetString("SavedItems")</h2>
@Html.Raw((string)TempData["messages"])
<div class="hc-record-list hc-wishlist clearfix">
@foreach (var item in Model)
{
<div class="hc-record">
<div class="hc-recimage">
<a href="@item.FullProduct.ProductLink">
<img src="@item.FullProduct.ImageUrls.SmallUrl" border="0" alt="@item.FullProduct.ImageUrls.SmallAltText" />
</a>
</div>
<div class="hc-recname">
<h2>@item.FullProduct.Item.ProductName</h2>
<div class="hc-recdescription">
@Html.Raw(item.FullProduct.Item.LongDescription)
</div>
</div>
<div class="hc-reccontrols">
<table class="dnnFormItem">
<tr>
<td class="hc-recprice">
@Html.Raw(item.FullProduct.UserPrice.DisplayPrice(true))
</td>
<td>
@if(!item.FullProduct.Item.IsGiftCard && !item.FullProduct.Item.IsUserSuppliedPrice)
{
using (Html.BeginHccRouteForm(HccRoute.WishList, new { action = "addtocart" }, FormMethod.Post))
{
<input type="hidden" name="itemid" value="@item.SavedItem.Id" />
<input class="dnnPrimaryAction" type="submit" value="@Localization.GetString("AddToCart")" />
}
}
</td>
<td>
@using (Html.BeginHccRouteForm(HccRouteNames.WishList, new { action = "delete" }, FormMethod.Post))
{
<input type="hidden" name="itemid" value="@item.SavedItem.Id" />
<input type="submit" class="hc-delete" value="@Localization.GetString("RemoveSavedItem")" />
}
</td>
</tr>
</table>
</div>
</div>
}
</div>
以下產品的描述中,我添加了下面的代碼片段:
@using Hotcakes.Commerce.Catalog
@if (item.SavedItem.SelectionData != null && item.SavedItem.SelectionData.OptionSelectionList != null && item.SavedItem.SelectionData.OptionSelectionList.Count > 0)
{
<div class="clearfix">
@Html.Raw(item.FullProduct.Item.Options.CartDescription(item.SavedItem.SelectionData.OptionSelectionList))
</div>
}
這使得整個觀點是這樣的:
@using Hotcakes.Commerce.Catalog
@model IEnumerable<Hotcakes.Modules.Core.Areas.Account.Models.SavedItemViewModel>
<h2>@Localization.GetString("SavedItems")</h2>
@Html.Raw((string)TempData["messages"])
<div class="hc-record-list hc-wishlist clearfix">
@foreach (var item in Model)
{
<div class="hc-record">
<div class="hc-recimage">
<a href="@item.FullProduct.ProductLink">
<img src="@item.FullProduct.ImageUrls.SmallUrl" border="0" alt="@item.FullProduct.ImageUrls.SmallAltText" />
</a>
</div>
<div class="hc-recname">
<h2>@item.FullProduct.Item.ProductName</h2>
<div class="hc-recdescription">
@Html.Raw(item.FullProduct.Item.LongDescription)
</div>
@if (item.SavedItem.SelectionData != null && item.SavedItem.SelectionData.OptionSelectionList != null && item.SavedItem.SelectionData.OptionSelectionList.Count > 0)
{
<div class="clearfix">
@Html.Raw(item.FullProduct.Item.Options.CartDescription(item.SavedItem.SelectionData.OptionSelectionList))
</div>
}
</div>
<div class="hc-reccontrols">
<table class="dnnFormItem">
<tr>
<td class="hc-recprice">
@Html.Raw(item.FullProduct.UserPrice.DisplayPrice(true))
</td>
<td>
@if(!item.FullProduct.Item.IsGiftCard && !item.FullProduct.Item.IsUserSuppliedPrice)
{
using (Html.BeginHccRouteForm(HccRoute.WishList, new { action = "addtocart" }, FormMethod.Post))
{
<input type="hidden" name="itemid" value="@item.SavedItem.Id" />
<input class="dnnPrimaryAction" type="submit" value="@Localization.GetString("AddToCart")" />
}
}
</td>
<td>
@using (Html.BeginHccRouteForm(HccRouteNames.WishList, new { action = "delete" }, FormMethod.Post))
{
<input type="hidden" name="itemid" value="@item.SavedItem.Id" />
<input type="submit" class="hc-delete" value="@Localization.GetString("RemoveSavedItem")" />
}
</td>
</tr>
</table>
</div>
</div>
}
</div>
相關問題
- 1. 在Prestashop Wishlist模塊中顯示產品價格
- 2. DNN-顯示產品清單
- 3. Magento:塊可配置產品選項在搜索中顯示
- 4. 在產品列表中顯示自定義產品選項
- 5. DNN Hotcakes結帳地址
- 6. 有條件地顯示產品頁面選項卡中的塊
- 7. OpenCart在產品塊中顯示重量
- 8. Magento:捆綁產品不顯示選項
- 9. 許可DNN模塊的選項?
- 10. 在magento中以編程方式在wishlist中添加產品目錄產品
- 11. 如何顯示和UnShow DNN模塊
- 12. 如何在Magento中顯示產品屬性選項產品頁面?
- 13. 在靜態模塊中顯示產品ID - Magento
- 14. prestashop的模塊產品選項卡滑塊
- 15. 如何在類別視圖中顯示產品選項?
- 16. 在Magento產品列表中顯示自定義選項
- 17. 在Magento訂單報表中顯示產品選項
- 18. 在各個產品下方顯示類似口味的產品選項
- 19. 如何顯示opencart模塊中的所有產品信息?
- 20. CSS在DNN模塊
- 21. 如何在dnn模塊搜索中顯示圖像
- 22. 在DNN的html模塊中顯示.mht文件
- 23. Magento的 - 顯示/隱藏CMS塊時顯示模式「靜座及產品」在
- 24. 從wishlist頁面點擊產品詳細頁面時顯示致命錯誤
- 25. Magento產品顯示不在後端顯示產品reindex
- 26. 如何在OpenCart的「最新產品」模塊中排除產品?
- 27. 在產品列表頁面上顯示產品組合和分組產品選項
- 28. 如何在發票上顯示opencart產品選項重量
- 29. Magento - 售罄時在簡單產品上顯示選項
- 30. DNN Hotcakes服務器端API用於創建單個變體
不錯!這工作完美。謝謝,威爾,你很神奇! –