mohanjith / web-invoice

Automatically exported from code.google.com/p/web-invoice
GNU General Public License v3.0
0 stars 2 forks source link

WPML compatibility #75

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I use WPML for multilanguage blogging. Since WebInvoice is tied to a page, it 
would be nice to tie it to the page translations as well. I can provide a code 
to do that in the frontend context (i.e. find correct permalink of the 
translated page starting from the original page id - see below)

Test cases.
Switching to another language the translated page would be loaded instead.
When issuing a new invoice admin should be able to choose the invoice language, 
affecting the link sent via email.

Please provide any additional information below.
WPML related code. Suppose 100 is the page ID tied to WebInvoice in Settings.

//$pid is the admin language page connected to web invoice
function wpml_translated($pid){
  if (function_exists(icl_get_languages)) {
    $id = icl_object_id($pid, 'page', true);
    $url = get_permalink( icl_object_id($pid, 'page', true) );
  }
  else { 
  $id=$pid;
  $url = get_permalink($pid);
  }
  return $id;
  //return $url;
}

Original issue reported on code.google.com by vencu.ri...@gmail.com on 12 Oct 2010 at 9:24

GoogleCodeExporter commented 9 years ago
and to list the defined languages in WPML you can use this:

if (function_exists(icl_get_languages)) {
  $languages = icl_get_languages('skip_missing=0&orderby=code'); 
}

Not sure if this works outside the loop though...

Original comment by vencu.ri...@gmail.com on 12 Oct 2010 at 9:28

GoogleCodeExporter commented 9 years ago

Original comment by sh.mohanjith on 17 Oct 2010 at 11:27

GoogleCodeExporter commented 9 years ago
We use WPML here too and it would be very nice to have web-invoice integrated 
with it.

thanks

Original comment by guillaum...@gmail.com on 11 Jan 2011 at 7:26