Jump to content

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

Hooks Names Required For Company Registration Rate Topic   - - - - -

 
  • technoob
  • Senior Member
  • Trial users
  • Join Date: 08-Jun 15
  • 309 posts

Posted 28 August 2017 - 08:53 AM #1

When a vendor applies for an account we want to send him sms for registration application received ack. 

 

Any hooks for this purpose.

 

Couldnt find anything in companies.php file.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17827 posts

Posted 28 August 2017 - 01:05 PM #2

You can use the update_company hook in the fn_update_company function (app/functions/fn.companies.php)


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • technoob
  • Senior Member
  • Trial users
  • Join Date: 08-Jun 15
  • 309 posts

Posted 28 August 2017 - 02:30 PM #3

Update company will fire when the company isapproved ( active) by the admin.

 

We want to do the sms event after the vendor applies for registration.



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

Posted 29 August 2017 - 12:30 AM #4

Use a pre controller conditioned on a post request for the frontend companies controller.

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.


 
  • technoob
  • Senior Member
  • Trial users
  • Join Date: 08-Jun 15
  • 309 posts

Posted 29 August 2017 - 04:46 AM #5

can u please elaborate how to implement this file wise.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17827 posts

Posted 29 August 2017 - 05:40 AM #6

Update company will fire when the company isapproved ( active) by the admin.

 

We want to do the sms event after the vendor applies for registration.

 

There is the $action variable in this hook. So you can use the following code to check if the vendor applies for registration

if (AREA == 'C' && $action == 'add') {
    ...
}

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


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

Posted 29 August 2017 - 06:11 PM #7

can u please elaborate how to implement this file wise.

File: app/addons/my_changes/controllers/frontend/companies.pre.php

Then look at whether the $_SERVER['REQUEST_METHOD'] is 'POST' and take the appropriate action.  You should have all the company info available in the $_REQUEST data.


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.


 
  • technoob
  • Senior Member
  • Trial users
  • Join Date: 08-Jun 15
  • 309 posts

Posted 30 August 2017 - 01:51 AM #8

ok thx will chk



 
  • technoob
  • Senior Member
  • Trial users
  • Join Date: 08-Jun 15
  • 309 posts

Posted 30 August 2017 - 01:55 AM #9

 

There is the $action variable in this hook. So you can use the following code to check if the vendor applies for registration

if (AREA == 'C' && $action == 'add') {
    ...
}

Ecom where to add this code ( file)



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17827 posts

Posted 30 August 2017 - 06:07 AM #10

Ecom where to add this code ( file)

 

You can use this code in the fn_YOUR_ADDON_update_company function. Did not forget to init hook in the init.php file of your module


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • technoob
  • Senior Member
  • Trial users
  • Join Date: 08-Jun 15
  • 309 posts

Posted 03 September 2017 - 10:03 PM #11

File: app/addons/my_changes/controllers/frontend/companies.pre.php

Then look at whether the $_SERVER['REQUEST_METHOD'] is 'POST' and take the appropriate action.  You should have all the company info available in the $_REQUEST data.

Shouldnt this be in companies.post.php so that if the company has been added then we send the sms , incase there could be an error on company addition sms will still go if we use the pre controller ??



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

Posted 04 September 2017 - 07:11 PM #12

Trouble with handling POSTed data in a 'post' controller is that sometimes a controller will redirect after handling the POSTed data itself and the 'post' controller will never be called while request_method is POST.  But yes, if there are errors in the form data then it could be a problem.  About the only one I can think of that would be fatal would be a duplicate email address (in that case the company wouldn't be created and you would have sent an SMS).  You can review the standard controller code and duplicate some of the validation if you are concerned about it having errors.

 

Cs-cart is very flexible.  Using the update_company hook as Ecom suggested gets you past some of the validation issues and is but one of many alternatives as well as a pre controller.  Each has it merits.  Note also that different merchants have different technical skills so sometimes setting up and using hooks can be a struggle for them versus just adding code to a controller.


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.


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

Posted 04 March 2018 - 06:22 PM #13

If you don't know how to code then I'd strongly suggest you work with someone who can.

If you've been modifying distributed code, then hiring a developer to go in and try to fix it or reconstruct it is now going to be more expensive than if you'd simply hired someone who knew what they were doing to start with.  Not a criticism, just facts.

 

Be happy to work with you, but advice is free, work is not.


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.


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

Posted 12 March 2018 - 08:27 PM #14

Then you were not posting data to the 'companies' controller.  But an 'add' should be a POST.


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.