Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Add Extra Settings Text Fields On Settings: Company Section Rate Topic   - - - - -

 

Posted 18 August 2019 - 01:58 PM #1

Hi,

 

I'm in a need of adding an extra text field to accept emails which is to send out notifications to additional internal department of the company. 

 

So how do I achieve this goal from Settings: Company section?

 

Where are the areas/ files will I need to edit in order to do this?

 

Can I do this with a custom module?

 

Thanks in advance



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11392 posts

Posted 18 August 2019 - 05:11 PM #2

You would add the setting in the schema.  You would add the label text in the language translations.  You will then need to (most likely) use the mailer_send_pre hook to check if the field is set and/or other conditions.

 

If you know what you want and don't expect it to change frequently, you can do it a lot cheaper/easier by not using a UI and simply setting the email addresses to use in the hook.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 

Posted 18 August 2019 - 07:14 PM #3

HI Tbirnseth,

 

Thank you for responding to my query, 

 

Actually, this email id will be changed from time to time, So I believe adding in a settings page is more appropriate. 

 

I'm sorry, could you be more specif about the files and the locations please? I"m bit confused about 'setting in the schema.' wordings.

 

Should I create a new module to achieve this? or should I need to edit any core files for the purpose? 

 

Thanks again  



 

Posted 19 August 2019 - 02:58 PM #4

HI,

 

I have created a separate addon to accept an email. So bypassing schema editing part.

 

Now in my func.php file I get this email id and trying to inject into $message of this 'mailer_send_pre' hook function

 

But the problem is it seems $message contains all private data and not able to see in a foreach loop.

 

when I do fn_print_r($message) I get following ,

 

 

Tygh\Mailer\Message Object
(
    [id:protected] => low_stock
    [params:protected] => Array
        (
        )
 
    [data:protected] => Array
        (
            [product_options] => 
            [new_qty] => 5
            [product_id] => 2189
            [product_code] => 
            [product] => product name
            [company_data] => Array
                (
                    [company_name] =>  
                    [company_address] => 147 st, Tower T21
                    [company_city] => Sharq
                    [company_country] => KW
                    [company_state] => 
                    [company_zipcode] => 
                    [company_phone] => 345643453
                    [company_phone_2] => 

 

                  ...

                  ....

 

Can anyone suggest me how to fetch ' default_company_support_department' data and to replace with module value?



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11392 posts

Posted 19 August 2019 - 04:05 PM #5

You'll need to look at the class.  There are methods that will affect those private properties or you can adjust the data elements that are in the data variables passed to the Mailer.php file.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 

Posted 20 August 2019 - 10:56 AM #6

Hi Tbirnseth,

 

Thanks for your help,

 

I went through Message.php class to see as you said, And indeed I found few getters and setters functions. 

 

I called them to fetch the data I wanted and was able to achieve what I needed. 

 

It would be great for me and for the community if you can educate editing general settings page to add a custom input element.

 

Thank you again for your tips,