Forums › Forums › OroCommerce › Customized Email Template
This topic contains 7 replies, has 2 voices, and was last updated by aman.srivastava462 4 years, 3 months ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- December 26, 2019 at 2:25 am #41156
I want to add my own entity and variable according to this in the email template. please check the screenshot https://prnt.sc/qfw8b8.
can I customize it? is there any doc so I can customize this? - CreatorTopic
- AuthorReplies
- December 26, 2019 at 5:40 am #41162
To make entity available for email templates you need to make it configurable with the @Config annotation.
December 27, 2019 at 4:11 am #41168Thanks for the reply,
yes entity is added but when I am using these variables https://prnt.sc/qge342, for email template while compiling template from entity I am always getting error like
Calling “getrating” method on a “MarketplaceBundle\Entity\SellerReview” object is not allowed in __string_template__93a32a6beb3f031f07f373abf42c592ed96c1f756a1e43341af9dc9acc0786bf at line 8.December 27, 2019 at 4:31 am #41169Please share the syntax of how do you access this variable in a template and the implementation of a getter method for the property you are working with.
- This reply was modified 4 years, 4 months ago by
Andrey Yatsenko.
December 27, 2019 at 4:38 am #41173I am using like this https://prnt.sc/qgeh0f
and
in code, I have added thisPHP123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270<?phpnamespace MarketplaceBundle\Entity;use Doctrine\ORM\Mapping as ORM;use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\Config;use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\ConfigField;/*** SellerReview.** @ORM\Entity* @ORM\Table(name="wk_mp_seller_reviews")* @Config(* defaultValues={* "wk_mp_seller_reviews"={* "comment"="reviews"* }* }* )*/class SellerReview{/*** @var int*/private $id;/*** @var string*/private $heading;/*** @var string*/private $text;/*** @var \DateTime*/private $createdAt;/*** @var bool*/private $status;/*** @var int*/private $rating;/*** @var string|null*/private $nickname;/*** @var \Webkul\MarketplaceBundle\Entity\Seller*/private $seller;/*** @var \Oro\Bundle\CustomerBundle\Entity\CustomerUser*/private $customer;/*** Get id.** @return int*/public function getId(){return $this->id;}/*** Set heading.** @param string $heading** @return SellerReview*/public function setHeading($heading){$this->heading = $heading;return $this;}/*** Get heading.** @return string*/public function getHeading(){return $this->heading;}/*** Set text.** @param string $text** @return SellerReview*/public function setText($text){$this->text = $text;return $this;}/*** Get text.** @return string*/public function getText(){return $this->text;}/*** Set createdAt.** @param \DateTime $createdAt** @return SellerReview*/public function setCreatedAt($createdAt){$this->createdAt = $createdAt;return $this;}/*** Get createdAt.** @return \DateTime*/public function getCreatedAt(){return $this->createdAt;}/*** Set status.** @param bool $status** @return SellerReview*/public function setStatus($status){$this->status = $status;return $this;}/*** Get status.** @return bool*/public function getStatus(){return $this->status;}/*** Set rating.** @param int $rating** @return SellerReview*/public function setRating($rating){$this->rating = $rating;return $this;}/*** Get rating.** @return int*/public function getRating(){return $this->rating;}/*** Set nickname.** @param string|null $nickname** @return SellerReview*/public function setNickname($nickname = null){$this->nickname = $nickname;return $this;}/*** Get nickname.** @return string|null*/public function getNickname(){return $this->nickname;}/*** Set seller.** @param \Webkul\MarketplaceBundle\Entity\Seller|null $seller** @return SellerReview*/public function setSeller(\Webkul\MarketplaceBundle\Entity\Seller $seller = null){$this->seller = $seller;return $this;}/*** Get seller.** @return \Webkul\MarketplaceBundle\Entity\Seller|null*/public function getSeller(){return $this->seller;}/*** Set customer.** @param \Oro\Bundle\CustomerBundle\Entity\CustomerUser|null $customer** @return SellerReview*/public function setCustomer(\Oro\Bundle\CustomerBundle\Entity\CustomerUser $customer = null){$this->customer = $customer;return $this;}/*** Get customer.** @return \Oro\Bundle\CustomerBundle\Entity\CustomerUser|null*/public function getCustomer(){return $this->customer;}}December 27, 2019 at 4:48 am #41174I see that “seller” property value is an object, so it may be an issue that twig doesn’t know how to render that. But as for the “rating” property that is mentioned in an error message, there is nothing special, so it’s hard to say without debugging.
December 27, 2019 at 5:11 am #41182if I am not using the seller even then it is now working, I am also not getting those values that are not objects if I need to debug so could you please let me know how can I debug it.
which method is calling from the template.December 30, 2019 at 2:31 am #41193Hello Andrew Yatsenko’s,
I have found the solution with the help of this doc,
please add this in your document, so users can easily find this.
Thanks for your help,
Regards,
- This reply was modified 4 years, 4 months ago by
- AuthorReplies
The forum ‘OroCommerce’ is closed to new topics and replies.