SHARE
TWEET

Untitled

a guest Jul 18th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <block class="MagentoBackendBlockWidgetGridColumn">
  2.                     <arguments>
  3.                         <argument name="header" xsi:type="string" translate="true">Recipient Email</argument>
  4.                         <argument name="index" xsi:type="string">recipient_email</argument>
  5.                         <argument name="renderer" xsi:type="string">CompanyModuleBlockAdminhtmlWidgetGridColumnRendererRecipientemail</argument>
  6.                         <argument name="sortable" xsi:type="boolean">false</argument>
  7.                     </arguments>
  8.                 </block>
  9.      
  10. <?php
  11. namespace CompanyModuleBlockAdminhtmlWidgetGridColumnRenderer;
  12. class Recipientemail extends MagentoBackendBlockWidgetGridColumnRendererAbstractRenderer
  13. {
  14.     protected $_storeManager;
  15.  
  16.     public function __construct(
  17.         MagentoBackendBlockContext $context,
  18.         MagentoStoreModelStoreManagerInterface $storeManager,      
  19.         MagentoSalesModelOrderItem $orderItem,
  20.         array $data = []
  21.     ) {
  22.         parent::__construct($context, $data);
  23.         $this->_storeManager = $storeManager;      
  24.         $this->orderitem =  $orderItem;  
  25.     }
  26.  
  27.  
  28.     public function render(MagentoFrameworkDataObject $row)
  29.     {
  30.         $code = $row->getCode();
  31.         $result = array();
  32.         $salesorderitem =  $this->orderitem->getCollection()
  33.                           ->addFieldToFilter('product_options', array('like' => '%'.$code.'%'));
  34.  
  35.         if(!empty($salesorderitem))
  36.         {
  37.             foreach($salesorderitem as $orderdata){
  38.                 $productOptions = $orderdata->getProductOptions();  
  39.                 $recipientemail = $productOptions['giftcard_recipient_email'];
  40.                 if(!empty($recipientemail)){
  41.                 return $recipientemail;
  42.                 }else{
  43.                     return '-';
  44.                 }
  45.             }
  46.         }else{
  47.                return '-';
  48.         }
  49.  
  50.  
  51.     }
  52.      
  53. {"info_buyRequest":{"uenc":"aHR0cDovLzE5Mi4xNjguMS4xODQvZGcvZHJ1bW1vbmQtZ29sZi1lLWdpZnQtY2FyZC5odG1s","product":"76450","selected_configurable_option":"","related_product":"","giftcard_amount":"5","giftcard_sender_name":"test","giftcard_sender_email":"testmscgoriteeps@gmail.com","giftcard_recipient_name":"test22","giftcard_recipient_email":"arjun.cmarix@gmail.com","giftcard_message":"test test gift","qty":"1"},"giftcard_sender_name":"test","giftcard_sender_email":"testmscgoriteeps@gmail.com","giftcard_recipient_name":"test22","giftcard_recipient_email":"arjun.cmarix@gmail.com","giftcard_message":"test test gift","giftcard_lifetime":null,"giftcard_is_redeemable":0,"giftcard_email_template":null,"giftcard_type":"0","email_sent":0,"giftcard_created_codes":["HQE9EMUNTA6N"]}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top