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

[Shop][Product] Adding products to cart #16774

Merged

Conversation

Wojdylak
Copy link
Member

Q A
Branch? bootstrap-shop
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Related tickets n/a
License MIT

@Wojdylak Wojdylak requested review from a team as code owners August 26, 2024 07:24
@probot-autolabeler probot-autolabeler bot added the Shop ShopBundle related issues and PRs. label Aug 26, 2024
Copy link

github-actions bot commented Aug 26, 2024

Bunnyshell Preview Environment deleted

Available commands:

  • /bns:deploy to redeploy the environment

@Wojdylak Wojdylak force-pushed the SYL-3732-adding-products-to-cart branch from e6e86bc to 55c5414 Compare August 28, 2024 07:21
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]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙃

Copy link
Member Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 }) }}
Copy link
Member

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?

Comment on lines +109 to +111
FlashBagProvider
::getFlashBag($this->requestStack)
->add('success', 'sylius.cart.add_item');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
FlashBagProvider
::getFlashBag($this->requestStack)
->add('success', 'sylius.cart.add_item');
FlashBagProvider::getFlashBag($this->requestStack)
->add('success', 'sylius.cart.add_item')
;

or even

Suggested change
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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? 🤔

@GSadee GSadee merged commit 0c7eff2 into Sylius:bootstrap-shop Aug 28, 2024
19 checks passed
@Wojdylak Wojdylak deleted the SYL-3732-adding-products-to-cart branch September 27, 2024 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Shop ShopBundle related issues and PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants