studiomitte / cart-count
EXT:cart 购物车信息端点,可以通过 AJAX 请求获取
1.0.0
2023-09-22 08:51 UTC
Requires
- extcode/cart: ^9 || dev-9.x-dev
- typo3/cms-core: ^12.4
Replaces
- typo3-ter/cart-count: 1.0.0
README
此扩展提供了在使用 TYPO3 扩展 cart 时从当前购物车会话获取信息的基礎端点。主要好处是页面仍然可以缓存并显示例如购物车中的文章数量。
{ "net":551, "gross":551, "count":1, "products": [ { "title":"A title", "sku":"1234", "net":551, "gross":551, "quantity":1 } ] }
安装
使用 composer require studiomitte/cart-count
安装此扩展。
使用方法
通过调用 URL /?cartId=123
可以获取购物车信息。123
是在购物车插件中配置并保存订单的页面。
此扩展 不 使用任何 JS 来获取数据,但可以提供一个示例
$.get("/?cartId=195", function (data) { if (data.count > 0) { $(".cart__icon__wrapper").append("<span class='cart__count cart__count--big'>" + data.count + "</span>"); } });
致谢
此扩展由 Georg Ringer 为 Studio Mitte, Linz 制作,充满爱心。
查看我们为 TYPO3 站点开发的更多扩展,这些扩展提供了额外的功能。