mardi 26 janvier 2016

Wordpress: load a plugin into another one

hi and thanks for stopping by. i am currently writing a plugin for wordpress. i need a button inside a certain page, that triggers an email-notification. i figured it would be good to use the woocommerce email functionality, since it is a customer email and i'd like to use the woocommerce-email-templates, too.

i have my content and the class is extended by

class WC_Custom_Email extends WC_Email {
    public function __construct() {
        …
    }
    public function mail( $var1, $var2, $var3 ) {
        …
    }
}

but when i trigger my function via ajax

$email = new WC_Custom_Email();
$email->mail( $var1, $var2, $var3 );

the response is: Fatal error: Class 'WC_Custom_Email' not found in …

same is, when i change it to new WC_Email(). so my guess is, that the woocommerce functionality isn't loaded into my admin->edit_page_xy screen. so the big question is: how would i load the woocommerce functionality (or only the email-functionality) into my plugin..??

hope this is somewhat clear and makes any sense. i only know little php and am completely new to oop.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire