Hi, depending on the login state I'd like to switch between Login/Logout in the header menu. Similar to the demo I've created a controller to include those links.
When calling the getCustomer() method, the service is not available:
$customer = $this->get(CustomerContextInterface::class)->getCustomer();
Service "CoreShop\Component\Customer\Context\CustomerContextInterface" not found: even though it exists in the app's container, the container inside "App\Controller\LayoutController" is a smaller service locator that only knows about the "doctrine", "form.factory", "http_kernel", "message_bus", "messenger.default_bus", "parameter_bag", "request_stack", "router", "security.authorization_checker", "security.csrf.token_manager", "security.token_storage", "serializer", "session" and "twig" services. Try using dependency injection instead.
Did I miss something in the install process? How can i access the CoreShop Services in App context directly?
bin/console debug:config app
it looks like it's registered correctly. Unfortunately $this->get('coreshop.repository.stack.purchasable')->findAll()
doesn't list the custom products. Is there anything else to consider about custom Product Objects?
Hi,
followed docs for adding custom checkout step:
https://docs.coreshop.org/2.2.0/Development/Checkout/Checkout_Manager.html
using coreshop 3 beta-1
copied shipment step from core as own step, as first try.
file config/config.yaml:
core_shop_core:
checkout:
default:
steps:
shipment: false
payment: false # disables the payment step
custom:
step: app.coreshop.checkout.custom
priority: 30
file bundles/FrontendBundle/Resources/config/services.yml:
FrontendBundle\CoreShop\Checkout\Step\PackagingShippingCheckoutStep:
public: true
arguments:
- '@CoreShop\Component\Shipping\Validator\ShippableCarrierValidatorInterface'
- '@form.factory'
- '@CoreShop\Component\Order\Manager\CartManagerInterface'
app.coreshop.checkout.custom:
alias: FrontendBundle\CoreShop\Checkout\Step\PackagingShippingCheckoutStep
file bundles/FrontendBundle/CoreShop/Checkout/Step/PackagingShippingCheckoutStep.php
```
<?php
declare(strict_types=1);
namespace FrontendBundle\CoreShop\Checkout\Step;
use CoreShop\Bundle\CoreBundle\Form\Type\Checkout\CarrierType;
use CoreShop\Component\Address\Model\AddressInterface;
use CoreShop\Component\Core\Model\CarrierInterface;
use CoreShop\Component\Order\Checkout\CheckoutException;
use CoreShop\Component\Order\Checkout\CheckoutStepInterface;
use CoreShop\Component\Order\Checkout\OptionalCheckoutStepInterface;
use CoreShop\Component\Order\Checkout\ValidationCheckoutStepInterface;
use CoreShop\Component\Order\Manager\CartManagerInterface;
use CoreShop\Component\Order\Model\OrderInterface;
use CoreShop\Component\Shipping\Validator\ShippableCarrierValidatorInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Webmozart\Assert\Assert;
class PackagingShippingCheckoutStep implements CheckoutStepInterface, OptionalCheckoutStepInterface, ValidationCheckoutStepInterface
{
public function __construct(
private ShippableCarrierValidatorInterface $shippableCarrierValidator,
private FormFactoryInterface $formFactory,
private CartManagerInterface $cartManager)
{
}
public function getIdentifier(): string
{
return 'pack_shipping';
}
public function isRequired(OrderInterface $cart): bool
{
Assert::isInstanceOf($cart, \CoreShop\Component\Core\Model\OrderInterface::class);
return $cart->hasShippableItems();
}
public function doAutoForward(OrderInterface $cart): bool
{
Assert::isInstanceOf($cart, \CoreShop\Component\Core\Model\OrderInterface::class);
return $cart->hasShippableItems() === false;
}
public function validate(OrderInterface $cart): bool
{
Assert::isInstanceOf($cart, \CoreShop\Component\Core\Model\OrderInterface::class);
return $cart->hasShippableItems() === false
|| ($cart->hasItems() &&
$cart->getCarrier() instanceof CarrierInterface &&
$cart->getShippingAddress() instanceof AddressInterface &&
$this->shippableCarrierValidator->isCarrierValid($cart->getCarrier(), $cart, $cart->getShippingAddress()));
}
public function commitStep(OrderInterface $cart, Request $request): bool
{
$form = $this->createForm($request, $cart);
if ($form->isSubmitted()) {
if ($form->isValid()) {
$cart = $form->getData();
$this->cartManager->persistCart($cart);
return true;
}
throw new CheckoutException('Shipping Form is invalid', 'coreshop.ui.error.coreshop_checkout_shipping_form_invalid');
}
return false;
}
public function prepareStep(OrderInterface $cart, Request $request): array
{
return [
'form' => $this->createForm($request, $cart)->createView(),
];
}
private function createForm(Request $request, OrderInterface $cart): FormInterface
{
$form = $this->formFactory->createNamed('coreshop', CarrierType::class, $cart, [
'cart' => $cart,
]);
if ($request->isMethod('post')) {
$form = $form->handleRequest($request);
}
return $form;
}
}
I can call FE. When putting article in cart I get:
CoreShop\Component\Registry\PrioritizedServiceRegistry::getIndex(): Return value must be of type int, bool returned
I measn https://docs.coreshop.org/2.2.0/Development/Checkout/Checkout_Step.html
What's wrong/missing?
Hi, I want to extend the CoreShopOrder class with a Custom class to add methods used in the confirmation mail. At the checkout step /de/shop/checkout/address following error is triggered
Model with class "App\Model\DataObject\CoreShopOrder" does not exist -> vendor/coreshop/core-shop/src/CoreShop/Component/Resource/Metadata/Registry.php:43
Do I have to register the Custom Model in the CoreShop Metadata Registry?
Hi, when updating Pimcore from 6.9 to X, I got to this error
Script Pimcore\Composer::clearCache handling the pimcore-scripts event terminated with an exception [RuntimeException] An error occurred when executing the "/usr/local/bin/php --php-ini=/usr/local/etc/php/php.ini bin/console --ansi cache:clear --no-warmup" command:
Exit code: 255
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException {#6164
-id: "security.authentication.provider.dao"
-sourceId: null
-alternatives: []
#message: "You have requested a non-existent service "security.authentication.provider.dao"."
#code: 0
#file: "./vendor/symfony/dependency-injection/ContainerBuilder.php"
#line: 996 trace: {
./vendor/symfony/dependency-injection/ContainerBuilder.php:996 { …}
./vendor/symfony/dependency-injection/ContainerBuilder.php:1028 { …}
./vendor/pimcore/pimcore/bundles/CoreBundle/DependencyInjection/Compiler/PasswordFactoryDecoratorPass.php:35 { …} ./vendor/symfony/dependency-injection/Compiler/Compiler.php:82 { …}
./vendor/symfony/dependency-injection/ContainerBuilder.php:757 { …} ./vendor/symfony/http-kernel/Kernel.php:548 { …}
./vendor/pimcore/pimcore/lib/Kernel.php:237 { …} ./vendor/symfony/http-kernel/Kernel.php:789 { …}
./vendor/symfony/http-kernel/Kernel.php:128 { …} ./vendor/pimcore/pimcore/lib/Kernel.php:216 { …}
./vendor/pimcore/pimcore/lib/Bootstrap.php:255 { …}
./vendor/pimcore/pimcore/lib/Bootstrap.php:60 { …}
./bin/console:34 {
› /** @var \Pimcore\Kernel $kernel */
› $kernel = \Pimcore\Bootstrap::startupCli();
› $application = new \Pimcore\Console\Application($kernel);
}
}
}
Any hint will be very appreciated
app/resources
folder anymore see docu
If you try to login as customer, the following error/exception occurs: "You must configure the check path to be handled by the firewall."
This happens not only in my installation but also in the official demo shop:
https://demox.coreshop.org/en/shop/login
How to fix?