Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags in conditions not working like they were before #9615

Closed
duncanmcclean opened this issue Feb 29, 2024 · 0 comments · Fixed by #9621
Closed

Tags in conditions not working like they were before #9615

duncanmcclean opened this issue Feb 29, 2024 · 0 comments · Fixed by #9621
Assignees
Labels

Comments

@duncanmcclean
Copy link
Member

Bug description

After v4.50.0, it seems like the Antlers syntax for using tags in conditions isn't working the same way. I believe it's related to the changes in #9504.

For example, with my Simple Commerce addon, both of these syntaxes used to work:

Cart: {{ if {sc:cart:has} }} {{ sc:cart:id }} ({{ sc:cart:count }} items) {{ else }} None {{ /if }}
Cart: {{ if {sc:cart:has} === true }} {{ sc:cart:id }} ({{ sc:cart:count }} items) {{ else }} None {{ /if }}

However, now, after v4.50.0, only one of those syntaxes works:

+ Cart: {{ if {sc:cart:has} }} {{ sc:cart:id }} ({{ sc:cart:count }} items) {{ else }} None {{ /if }}
- Cart: {{ if {sc:cart:has} === true }} {{ sc:cart:id }} ({{ sc:cart:count }} items) {{ else }} None {{ /if }}

Simple Commerce's tags are a bit funky since they have two colons (I have the concept of subtags, so SC has one tag, then there's subtags for the cart/checkout form/coupons/etc). I don't know much about the Antlers parser but that might be throwing something off?

How to reproduce

  1. Create a new site using the Simple Commerce Starter Kit
    • statamic new cms-9615 duncanmcclean/sc-starter-kit
  2. Open the site, go to the "Products" page and add a product to the cart
  3. In the footer, you'll see "Cart:", which should be followed by your order ID. This is using the syntax which still works.
    • Cart: {{ if {sc:cart:has} }} {{ sc:cart:id }} ({{ sc:cart:count }} items) {{ else }} None {{ /if }}
  4. In the resources/views/layout/_footer.antlers.html view, update line 21 to this:
    • Cart: {{ if {sc:cart:has} === true }} {{ sc:cart:id }} ({{ sc:cart:count }} items) {{ else }} None {{ /if }}
  5. Go back to the site and see "Cart: None"

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 10.46.0
PHP Version: 8.2.13
Composer Version: 2.6.3
Environment: local
Debug Mode: ENABLED
URL: antlers-tags-in-conditions-bug.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Simple Commerce
Currencies: GBP
Gateways: Dummy
Repository: Customer: DuncanMcClean\SimpleCommerce\Customers\EntryCustomerRepository
Repository: Order: DuncanMcClean\SimpleCommerce\Orders\EntryOrderRepository
Repository: Product: DuncanMcClean\SimpleCommerce\Products\EntryProductRepository
Shipping Methods: Free Shipping
Tax Engine: DuncanMcClean\SimpleCommerce\Tax\BasicTaxEngine

Statamic
Addons: 1
Antlers: runtime
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.51.0 PRO

Statamic Addons
duncanmcclean/simple-commerce: 6.0.8

Installation

Starter Kit using via CLI

Antlers Parser

None

Additional details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants