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..
how to get data about product from database in controller ?
Comments
-
Depends, if you want a list of products in Zed, have a look at Tables and Query Containers.
If you wont to show some fields in Zed, have a look at the ProductFacade::getProductConcrete or ProductFacade::getProductAbstract.If you try to show a product field in the Frontend (Yves/Glue), https://documentation.spryker.com/docs/tutorial-architecture-walkthrough-scos will be a good place to start
0 -
i want to get all data about product by id or sku in Zed
0 -
Product concrete or Product abstract?
0 -
You can have at
ProductFacadeInterface
.0 -
Product abstract
0 -
@UKHD8KTMF so how i can use ProductFacadeInterface in controller ?
0 -
I need some context to be able to help you. Are you doing a page in Zed? Trying to show some data on frontend? Please explain your use case.
0 -
Did you do developer bootcamp already https://training.spryker.com/courses/developer-bootcamp. It is free.
0 -
so when i create or update product i must send all data about it to other api i create custom module to catch this (Listener) but i not have data about product
0 -
Did you do something like described here https://documentation.spryker.com/docs/event-listen
0 -
yes
0 -
public function handle(TransferInterface $eventTransfers, $eventName)
{
$data = array(
'eventName' => $eventName,
'data' => $_POST,
);
$this->sender->sendDataToApi($data);
}0 -
$_POST - are data from form
0 -
and $eventTransfers is empty
0 -
This looks wrong to me, because the event transfer should contain the data. How did POST data came to event listener? What are you listening for?
0 -
If I understand correctly, what you want is to call some external API when user creates a product in ZED.
0 -
yes exactly
0 -
You can use some of existing events - check ProductEvents
0 -
in my subscriber function
private function createProductListener(EventCollectionInterface $eventCollection) { $eventCollection->addListener(ProductEvents::PRODUCT_ABSTRACT_AFTER_CREATE, new KacperListener()); return $eventCollection; }
0 -
and its go to my Listener and eventTransfer is empty
0 -
hmm, should not be
$this->triggerEvent(ProductEvents::PRODUCT_ABSTRACT_AFTER_CREATE, $productAbstractTransfer);
0 -
you should have product abstract transfer - are you creating abstract product? maybe you are creating concrete product, but if event is triggered then I guess it is a correct one
0 -
You can put a breakpoint in ProductAbstractManager and debug if data is set
0 -
-
could you change method and show me how to correctly ? I spent many hours on this
0 -
and docs is not clear for me
0 -
can you share also KacperListener ?
0 -
okey
0 -
-
Hi @USLUHK9SQ
For having the product data in fronted stores, (Yves and Glue), we are using Publish and Synchronize (P&S) feature, this acts as CQRS method.
long story short, we trigger events which contain the listener and some meta data information for publishing into database, then we aggregate and denormilize data and provide it via queue to Redis and ES.
here you can find a simple HowTo tutorial
https://documentation.spryker.com/docs/handling-data-publish-and-synchronization0
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