What are the Slack Archives?
Itβs a history of our time together in the Slack Community! Thereβs a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you wonβt be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hi, I am currently manipulating the prices in our shop with a company-based margin. So far - so good
Hi, I am currently manipulating the prices in our shop with a company-based margin. So far - so good. But now I am stuck at one last point: the PriceProductMapper seems to has no link to the customer at all.
I was wondering, if I could prepare accessing the current customer (->getCompanyUserTransfer()->getCompanyBusinessUnit()->getMargin()
) in the DependencyProvider. I've added the following function in the DependencyProvider order to access the customer of QuoteTransfer:
protected function addQuoteClient(Container $container) { $container[static::CLIENT_QUOTE] = function (Container $container) { return new PriceProductToQuoteClientBridge($container->getLocator()->quote()->client()); }; return $container; }
calling quote() there brings up the message Method 'quote' not found in \Generated\Zed\Ide\AutoCompletion|\Spryker\Shared\Kernel\LocatorLocatorInterface
. Any ideas, how to get this running? π¨
Comments
-
More Meta: when returning the
MoneyValueTransfer
, i am adding an individual multiplier in/src/Pyz/Zed/PriceProduct/Business/Model/Product/PriceProductMapper.php
.
This file doesn't know the Customer (yet). See my thoughts on how to solve this above)0 -
in which method are you using calling the
addQuoteClient
method? Is isprovideBusinessLayerDependencies()
?0 -
another point: if possible, try to get rid of bridges in project scope, e.g. instead of
return new PriceProductToQuoteClientBridge()
just returnreturn $container->getLocator()->quote()->client()
0 -
itβs a general Spryker recommendation
0 -
in which method are you using calling the
addQuoteClient
method? Is isprovideBusinessLayerDependencies()
?Yes.
/src/Pyz/Zed/PriceProduct/PriceProductDependencyProvider.php:provideBusinessLayerDependencies()
0 -
Now, to the point: you might be doing something wrong, if you intent to provide
Client
inZed
β¦0 -
First of all, you might end-up in βZed is calling Zedβ situation, which for sure you donβt want to do.
0 -
On the other side,
Client
might try to querySession
, which is not right to do from Zed0 -
Can you investigate, whatβs your target method in the client, what should it call eventually?
0 -
if you feel like providing
PriceProductMapper
with information about customer - I would go for extending the incoming transfer object with customerId and passing it from Yves. But it is still doesnβt feel right, there might be some βhookβ point where you would introduce your plugin or so. I just donβt know your exact business use case0 -
My scenario is: I want to receive the current customer. I thought it was refrenced and accessible in the provided QuoteTransfer π€ I had a look at another function
CompanyUserInvitationPageDependencyProvider:addCustomerclient()
where the CustomerClient was called from given container,.In an Yves module I am accessing the current customer with CustomerClient
return $customer->getCompanyUserTransfer()->getCompanyBusinessUnit()->getMargeRate();
I get you, doesn't appear to be correct to open a Client to request data from Zed π€¦ββοΈ
Now, to the point: you might be doing something wrong, if you intent to provide
Client
inZed
β¦0 -
@ULL0N440J can this be interesting to you?
https://documentation.spryker.com/capabilities/price/prices_per_merchant_relations/price-per-merchant-relation.htm0 -
If itβs not exactly what youβre looking for, maybe you could have a look how it is implemented and find the good solution?
0 -
I get you, doesnβt appear to be correct to open a Client to request data from Zed π€¦ββοΈ
Zed is customer-session agnostic, period. You can pass customer ID from Yves to Zed, and then Zed can fetch customer information, if needed.
0 -
I thought it was refrenced and accessible in the provided QuoteTransfer
that should be it, quote must have a customerId (if itβs not a guest)
0 -
We've already had a look at product lists. We couldn't use this, because we would have to import our products as lists many times (each time, when someone wants to add a new margin. This could reach from 0.1% to x%.. think this would not be viable)
0 -
@ULL0N440J product lists wonβt work here. What about the link Iβve sent above - prices per Merchant relation?
0 -
I would not go towards persisting the all (prices * customers) combinations. Rather store customer margin for customer, and then add % on the fly, when you calculate the quote, by introducing a new item for your calculation stack. That worked for us just perfectly fine.
0 -
just donβt forget to store the current margin value together with the sales order, to make sure you can βexplainβ the price in the future
0 -
but really, have a look at βprices per Merchant relationβ feature
0 -
prices per Merchant relation
I get you. We've had a look on this way already, too. Quite difficult to explain our whole Idea for the Shop:
We would have to set the merchant relations in Yves. Our (kind-of)Admins won't be able to access Zed.
This is where I failed last time; I wasn't able to create merchant-relations from yves π£0 -
ahhh, youβre building market place. So you want the Yves to be also a place where vendors define prices for the customers..
0 -
hmmm, yeah, it very depends on your specific and the way how youβre building things already.. Why is it not possible to create a new βrelationβ by doing Yves->Zed call?
0 -
Why is it not possible to create a new βrelationβ by doing Yves->Zed call?
Didn't find out, how to solve this properly. There was no Client I could use. All I found (but didn't help to get further) was a MerchantRelationToCSV... π€
0 -
Well, then you need to introduce one, definitely
0 -
along with gateway controller(action) and maybe a dedicated facade method. That would sound to me as a right solution
0 -
I will definitly get back to this later. We've committed to solve it quick and dirty for now. I've translated every call to
setNetAmount()
by given multiplier. As long as a customer is provided this works fine for us.0 -
Going back to the initial question - How can I access the customer(client) from the container? The container appears to have a quoteTransfer linked to it. This contains a customerTransfer / customerID
0 -
Now I lost you..
now you want customer client instead of quote ? And I donβt understand how container (dependency container?)appears to have a quoteTransfer linked to it
.. How is this connected with the original question?0 -
Sorry.
All QuoteClients I've seen so far (QuoteTransfer) are containing a customer.
I added the functionprotected function addQuoteClient($container): Container { $container[static::CLIENT_QUOTE] = function (Container $container) { return new PriceProductToQuoteClientBridge($container->getLocator()->quote()->client()); }; return $container; }
to
src/Pyz/Zed/PriceProduct/PriceProductDependencyProvider.php
. I thought I could access the customer in this QuoteTransfer (and resolve it by customerClient.. or request it directly, I am in Zed already). By this, I could receive the Company with its own margin0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K π Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random