- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试为 Hybris Commerce b2c 中的 addtocart 函数添加自定义值。是带有复选框的 boolean 值。
我已在 core-items.xml 中添加了 bol 自定义值,但现在我需要在选中复选框时获取该值,然后再按 addToCart 按钮,然后在结帐页面中显示该值。
我认为这不是一个短任务,但我只是想了解这种过程的数据流,这是复杂的部分。
如果有人有时间解释一些事情,那就太好了!谢谢 !
<form:form method="post" id="addToCartForm" class="add_to_cart_form" action="${addToCartUrl}">
<div>
<div class="custom-control custom-checkbox">
<input path="trasiego" onclick="ACC.productDetail.enableMinusBtn()" type="checkbox" class="custom-control-input" id="trasiego">
<form:checkbox path="trasiego" value="true"/>
<spring:theme code="product.pdp.pedidoTrasiego"/>
</div>
</div>
<input type="hidden" maxlength="3" size="1" id="qty" name="qty" class="qty js-qty-selector-input" value="1">
<input class = "js-simulate-validate-link" type="hidden" name="productCodePost" value="${fn:escapeXml(product.code)}"/>
<ycommerce:testId code="simulateButton">
<button id="simulateButton" type="button" data-error-simulate-url="${fn:escapeXml(simulatePopup)}" data-simulate-title="<spring:theme code="text.simulate"/>" class="btn btn-default btn-block js-add-to-cart" disabled=disabled">
<spring:theme code="basket.simulate"/>
</button>
</ycommerce:testId>
<ycommerce:testId code="addToCartButton">
<button id="addToCartButton" type="submit" class="btn btn-primary btn-block" disabled=disabled>
<spring:theme code="basket.buy"/>
</button>
<br>
</ycommerce:testId>
</form:form>
最佳答案
如果您觉得有帮助,请阅读以下几点,
I've add the bol custom value in core-items.xml......
当我读到上面的声明时有点困惑,因此想指出接触 OOB 扩展代码库是违反标准做法的。相反,您应该在项目中生成自定义扩展并扩展/更新项目 $extension-items.xml
I need to get that value when the checkbox is selected before press the addToCart Button and then show that value in the checkout page.
您可以通过以下步骤实现:
第 1 步 - 在项目扩展 $extension-items.xml 中,向 AbstractOrder 添加一个新的 boolean 属性
<itemtype code="AbstractOrder" autocreate="false" generate="false" >
<attributes>
<attribute qualifier="code" type="java.lang.Boolean">
<persistence type="property" />
</attribute>
</attribute>
</itemtype>
第 2 步 - 运行 ant clean all
第 3 步 - 在您的项目店面扩展中,在 Jsp/Tag 文件中添加一个复选框
步骤 4 - 如果您想在选择/取消选择此复选框时保留此值的选择,您可以在相应的 JS 文件中编写 onClick() 事件。在你的情况下你可以使用/$storefornt-extension/web/webroot/WEB-INF/_ui-src/responsive/lib/ybase-0.1.0/js/acc.cart.js
第 5 步 - 在 Controller (MVC) 中创建相应的处理程序。您可以根据需要使用 AddToCartController.java 或 CartPageController
第6步-在相应的facade-->服务中,将新的字段值保存到模型中
第 7 步 - 在 AbstractOrderPopulator 或 CartPopulator 中,映射新字段以将其填充回项目模型中的 CartData。并且可以在下一页上使用相同的 View 。
这样,您的字段值将被持久化并获取以在各个 hybris 层之间传输,并且您可以使用相应的数据对象。
希望有帮助。
关于java - 在 Hybris Commerce 上的 AbstractOrder 中添加自定义值 - AddtoCartFunction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58507484/
我正在创建一个Hybris impex文件,以导入到我的数据库中。 我想对文件中的数据执行INSERT_UPDATE操作,因此我需要告诉Hybris哪些列必须是唯一的,以便它知道何时更新记录而不是插入
我正在努力学习 Hybris。我已经成功安装了 hybris,那里有很多博客都在谈论使用您自己的自定义模块来安装核心 hybris 以进行更改,例如这个: http://javainsimpleway
我在“extensioninfo.xml”中有这些扩展: 这些扩展是如何构建的?如果我将它们放在同一个“extensioninfo.xml”文件中,是否有任何顺序?会在“b2bcommerc
我是 hybris 的新手,什么是 diff b/w 关系和集合,为什么我们选择关系而不是集合。 最佳答案 基本上,在 hybris 中建模集合有两种技术上不同的方法: 集合类型 将 hybris 中
我有客户项目类型 "Appeasement",其中包含枚举类型 "AppeasementStatusType"的属性 "appeasementStatus"。 对于 customersupportag
我正在处理 Hybris 项目 非常耗时等待 350 - 550 秒 单个 Hybris 服务器启动 ,即使只是在代码中稍作修改/错误类型。是否可以减少 此 时间 只运行那些我修改过的扩展或其他方式?
为了将 hybris 日志与控制台(catalina)包装器(tanuki)和 tomcat 分开,我创建了这两个配置。 #local.properties log4j.appender.FILE =
现在当我去https://localhost:9002/它打开 hac (hybris admin console). 当我去https://powertools.local:9002/nystore
默认情况下,Hybtis 将 CreditCardType 作为强制属性。我想通过使用 redeclare=true 使其成为 Optional (不使用新模型扩展它)。我想知道为什么它不更新 Cre
我是 Hybris 的新手,正在遵循 Hybris wiki 中给出的 Commerce 线索。我可以看到他们在“平台”标签下执行“更新”。这个操作有什么作用? 最佳答案 从上面的链接。对于没有 wi
我有一个 Hybris 系统,在每个数据库表中都有一个名为“hjmpts”的列。该列包含 INT 值。有人知道这个专栏的原因吗? 最佳答案 它旨在以与 Hibernate 等持久层使用 @Versio
我想知道在 Hybris 属性文件中是否有引用环境变量的方法。 例如,在 local.properties 中:my.property = ${MY_ENVIRONMENT_VARIABLE} 我的搜
您好,我在 commerefacades-beans.xml 中创建了 eProductForm bean,我添加了 ProductData 的自定义属性。 然后在commercewebs
我正在探索 hybris 销售云试用版。我想使用 postman 测试 oauth2,我不知道这是否是正确的方法,但我通过转到 在 SAP Cloud Platform cockpit 中创建了一个客
和 generate="true"等等。 关于类型系统等 最佳答案 autocreate默认情况下为 true 并且在类型中设置此修饰符意味着将在初始化期间创建该项目。generate默认情况下也是如
我将第一次安装DataHub。我正在尝试集成 Hybris Commerce 6.5 和 Hybris Datahub。我建立了hybris commerce 6.5和mysql 5.7.17。我初始
我是hybris的新手。我想使用 external-dependencies.xml 在 hybris 中添加 maven 依赖项。但是我看不到任何弹出的 jar 。是否可以使用 external-d
我正在尝试从 apache 网络服务器访问 yacceleratorstorefront/electronics/en/?site=electronics URL 到配置了电子商店 URL 的 Hyb
在 SAP hybris 平台的构建过程中,我收到以下错误: [java] ERROR StatusLogger Cannot start ShutdownCallbackRegistry, alr
有人可以解释一下 Hybris 中使用的 转换器 和 populators 的概念吗?我正在研究 Hybris 中的 AddOns 的概念,但是在我们在 Hybris 商务加速器中使用 AddOns
我是一名优秀的程序员,十分优秀!