-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Shop][Product] Adding products to cart #16774
[Shop][Product] Adding products to cart #16774
Conversation
Wojdylak
commented
Aug 26, 2024
Q | A |
---|---|
Branch? | bootstrap-shop |
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Related tickets | n/a |
License | MIT |
Bunnyshell Preview Environment deletedAvailable commands:
|
e6e86bc
to
55c5414
Compare
use Symfony\UX\LiveComponent\Attribute\LiveArg; | ||
use Symfony\UX\LiveComponent\Attribute\LiveListener; | ||
use Symfony\UX\LiveComponent\Attribute\LiveProp; | ||
use Symfony\UX\LiveComponent\DefaultActionTrait; | ||
use Symfony\UX\TwigComponent\Attribute\PostMount; | ||
|
||
#[AsLiveComponent] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😃
{ | ||
public function __construct(private OrderModifierInterface $orderModifier) | ||
{ | ||
} | ||
|
||
public function removeOrderItem(GenericEvent $event): void | ||
public function removeFromOrder(GenericEvent $event): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function removeFromOrder(GenericEvent $event): void | |
public function removeItemFromOrder(GenericEvent $event): void |
🤔
@@ -1,5 +1,5 @@ | |||
{% set item = hookable_metadata.context.item %} | |||
|
|||
<td {{ sylius_test_html_attribute('cart-item-product' ) }}> | |||
{% include '@SyliusShop/shared/product/info.html.twig' with {'variant': item.variant} %} | |||
{{ component('sylius_shop:order_item:product_info', { item: item }) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we declare this component in hooks?
FlashBagProvider | ||
::getFlashBag($this->requestStack) | ||
->add('success', 'sylius.cart.add_item'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FlashBagProvider | |
::getFlashBag($this->requestStack) | |
->add('success', 'sylius.cart.add_item'); | |
FlashBagProvider::getFlashBag($this->requestStack) | |
->add('success', 'sylius.cart.add_item') | |
; |
or even
FlashBagProvider | |
::getFlashBag($this->requestStack) | |
->add('success', 'sylius.cart.add_item'); | |
FlashBagProvider::getFlashBag($this->requestStack)->add('success', 'sylius.cart.add_item'); |
@@ -44,6 +48,7 @@ public function createForProduct(ProductInterface $product): OrderItemInterface | |||
$variant = $this->variantResolver->getVariant($product); | |||
Assert::nullOrIsInstanceOf($variant, ProductVariantInterface::class); | |||
$cartItem->setVariant($variant); | |||
$this->orderItemQuantityModifier->modify($cartItem, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary? 🤔