π Hi everyone! I am working on Category listing PLP page , I have add a description field in 's
π Hi everyone!
I am working on Category listing PLP page , I have add a description field in 'spy_category' table and Show that in Zed Category add and edit form and store value for it .
Now i want that when ever we are going to any categoryfrom navigation so i want that attribute to display in Yves frontend On PLP page. i am not getting that attribute in indexAction of CatalogController we are getting the catagoryNode but there is not description attribute , and i dont know where the route defined please suggest me
Comments
-
Hi Aashutosh, you are on the right way. We have set the description in 'spy_category_attribute' and than you can read and write the drescription via 'CategoryLocalizedAttributesMapper' and extend the 'mapCategoryLocalizedAttributesTransfersToCategoryNodeStorageTransferForLocale' with the categoryDescription.
As next step we have added the description in the 'executeIndexAction' to the 'searchResults' and the last step is to add the categoryDescription to{% define data = { ..., categoryDescription: _view.categoryDecription, ...} %}
in the catalog.twig.
I hope this helps you with the implementation.0 -
Thanks for reply , I have gone through that execueIndex method in serach result there is no field related to description there is only metaDescription , and in nodeCategory there are only category id , Actually i have added a new field in 'spy_category' table not 'spy_category_attribut' so my requirement for getting the descripion field which i have created from 'spy_category' table
0 -
Please suggest me it is not working
0 -
Hi, okay, but why do you set the field to "spy_category" and not "spy_category_attribute". With your method you can't use language dependent descriptions .
Of course there is no entry for the description in the 'executeIndexAction', you still have to add that there.0 -
Unfortunately, there is no ootb solution for category descriptions. Everything has to be built. Database fields, additional entries in the transfer objects and, of course, the storage entries so that the data also arrive in Yves.
0 -
So should i have that entry into the 'spy_category_attributes'
0 -
if i create field into the 'spy_category_attribute' soi will be able to get data in StorageNodeTransfer ?
0 -
you have to add the field in CategoryTransfer, CategoryLocalizedAttributesTransfer and in CategoryNodeStorageTransfer.
And as i wrote in my first answer you have to set the Description in CategoryLocalizedAttributesMapper.public function mapCategoryLocalizedAttributesTransfersToCategoryNodeStorageTransferForLocale( ArrayObject $categoryLocalizedAttributesTransfers, CategoryNodeStorageTransfer $categoryNodeStorageTransfer, string $localeName ): CategoryNodeStorageTransfer { $categoryLocalizedAttributesTransfer = $this->findCategoryLocalizedAttributesTransferForLocale( $categoryLocalizedAttributesTransfers, $localeName, ); if (!$categoryLocalizedAttributesTransfer) { return $categoryNodeStorageTransfer; } if ($categoryLocalizedAttributesTransfer->getImage()) { $categoryNodeStorageTransfer->setImage($categoryLocalizedAttributesTransfer->getImageOrFail()->getNameOrFail()); } return $categoryNodeStorageTransfer ->setUrl($categoryLocalizedAttributesTransfer->getUrl()) ->setName($categoryLocalizedAttributesTransfer->getName()) ->setMetaTitle($categoryLocalizedAttributesTransfer->getMetaTitle()) ->setMetaDescription($categoryLocalizedAttributesTransfer->getMetaDescription()) ->setMetaKeywords($categoryLocalizedAttributesTransfer->getMetaKeywords()) ->setCategoryDescription($categoryLocalizedAttributesTransfer->getCategoryDescription()); }
Then the Description should be written in the CategoryNodeStorage and you could read it from the CategoryNodes in the Yves.
0 -
okk
0 -
thanks
0 -
where is this function present in which file can you please explain more , i am new to spryker
0 -
This method is located in the
Spryker\Zed\CategoryStorage\Business\Mapper\CategoryLocalizedAttributesMapper
so you have to extend that method in your namespace or in the Pyz namespace.
Regardless, I highly recommend doing the free tutorials in the Spryker Academy. https://academy.spryker.com Without understanding the basic structure of Spryker, it is very difficult to implement good projects.0 -
Thank you so much for your help
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 75 Spryker News
- 919 Developer Corner
- 779 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 25 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
- 69 Spryker Safari Questions
- 50 Random