Posts

wordpress - Woocommerce switch language on order completed mail -

i'm using woocommerce + wpml , set programmatically email order completed. i'm trying using $sitepress->switch_lang() seems not work. add_action( 'woocommerce_order_status_completed', 'mysite_woocommerce_order_status_completed' ); function mysite_woocommerce_order_status_completed($order_id) { global $sitepress; $sitepress->switch_lang('en', true); if($sitepress->get_current_language() == 'en') { $mailer = wc()->mailer(); $recipient = 'customer@mail.com'; $subject = 'your order has been completed'; $content = get_processing_notification_content_completed( $order, $subject, $mailer ); $headers = "content-type: text/html\r\n"; $mailer->send( $recipient, $subject, $content, $headers ); } } function get_processing_notification_content_completed( $order, $heading = false, $mailer ) { $template = 'emails/customer-completed-order.php...

c++ - Run python scripts (different python verions) with one C program -

i want run few python scripts in threads small c/++ program, need different python versions run these scripts, because package mysqldb isn't working in python3 , packages aren't available in python2. #include <stdio.h> #include <python2.7/python.h> #include <python3/python.h> void main(int argc, char *argv[]) { file* file; py_setprogramname(argv[0]); py_initialize(); pysys_setargv(argc, argv); file = fopen("myscript.py","r"); pyrun_simplefile(file, "myscript.py"); py_finalize(); return; } or via system ("python2.7 myscript1.py arg1 arg2"); system ("python3 myscript2.py arg1 arg2"); do have ideas or way solve problem? you can use system() call execute python scripts, there no need of specifying version of python executable on command line. you can use shebang. use #!/usr/bin/python3 first line scripts want run python3 , #!/usr/bin/python2 in scripts...

Wordpress/Woocommerce checkout page 500 error -

im getting 500 error page on woocommerce store checkout page. noticed when cart empty there no error, when add products in it the address https://www.belizajec.si/webshop/checkout/ when debug mode enabled error notice: register_sidebar called incorrectly. no id set in arguments array "translator header" sidebar. defaulting "sidebar-1". manually set id "sidebar-1" silence notice , keep existing sidebar content. please see debugging in wordpress more information. (this message added in version 4.2.0.) in /home/apartkri/public_html/webshop/wp-includes/functions.php on line 4137 fatal error: class 'wc_gateway_paypal' not found in /home/apartkri/public_html/webshop/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php on line 105 thanks did update woocommerce 3.0? make sure theme using compatible woocommerce 3.0. if it's plugin using paypal disable first , see if thats 1 causing issue. seems incompatibility. ...

iis - How to change localhost to custom url for a project in visual studio? -

i working on outlook web addin (owa) project , downloaded sample project internet showing basic information of selected email. email information showing in .html page , .html page showing in iframe of owa. till point , can see details , handled project downloaded. now our main requirement when user clicks on "inbox" need capture event , something. problem facing owa running in different domain , .html page running using visual studio running in different domain. don't have control on owa , if iframe page , main page both not in same domain can't execute js code parent page elements. owa url: https://inexyz.customdomain.com/owa/#path=/mail iframe url: https://localhost:12345/messageread.html the problem facing how can run addin project incustomdomain.com. if host on local iis while debugging how can append messageread.html page url iframe? there way change localhost:12345 customdomain.com while debuggin using visual studio. to resolve above problem tried ...

html - Detect CSS class in a page and write if/else in PHP -

i have page need detect css class , apply if/else statement using php. how do that? html <body> <div class="insights"> hello world </div> </body> what php code detect , find "insights" class exists , show "yes, exists". if there's no class of name show "no, doesn't exists." how should achieve this? a simple solution use strpos $contains = str($html, 'class="insights"') !== false; a more complex , robust solution be, use regular expression following class="[^"]*\binsights\b[^"]*" this used in php this $contains = (bool) preg_match('/class="[^"]*\binsights\b[^"]*"/', $html);

android - Can I share images on Twitter without Twitter app -

i'm trying share image on twitter app. i'm using tweetcomposer in code share image on twitter share text not image. not given error or exception. so, want confirm possible share image on twitter without app? yes can share images or links on twitter without application use code.first add socialauth 4.4.jar file in library , then private socialauthadapter socialauthadapter; if (utils.isonline(activity)) { // initialize socialauthadapter responselistener pd = progressdialog.show(activity, null, null); socialauthadapter = new socialauthadapter(new responselistener( share)); // add twitter set provider post on twitter socialauthadapter.addprovider(socialauthadapter.provider.twitter, r.drawable.twitter); // line authorize start socialauthadapter.authorize(activity, socialauthadapter.provider.twitter);...

ios - Is it possible for a button to open into a specific tab when using the Tab Bar Controller? -

Image
the question little confusing articulate image little more helpful. here's setup: so, want first view button open firstviewcontroller , , want second view button open secondviewcontroller . if link second view button secondviewcontroller this: i lose tab navigation. , if connect button tabviewcontroller this: then automatically open firstviewcontroller . unless i'm missing something, seems need done little code cannot seem find explains how this. thank you! create storyboard segue viewcontroller tabbarcontroller identifier. assign selelctedindex value of tabbarcontroller in prepareforsegue method @ibaction func firstbtnaction(_ sender: any) { (sender as! uibutton).tag = 0 performsegue(withidentifier: "tabbar", sender: sender) } @ibaction func secbtnaction(_ sender: any) { (sender as! uibutton).tag = 1 performsegue(withidentifier: "tabbar", sender: sender) } override func prepare(for segue: uistoryboard...