Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
Merge pull request #28 from ebelrose/patch-1
Browse files Browse the repository at this point in the history
Resolving issue #16
  • Loading branch information
hyyan authored Jul 30, 2016
2 parents 8cd3107 + 26c612c commit e0b14ce
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Hyyan/WPI/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ public function saveOrderLanguage($order)
*/
public function translateProductsInOrdersDetails($product)
{
return Utilities::getProductTranslationByObject($product);
if($product){
return Utilities::getProductTranslationByObject($product);
}else{
return false;
}
}

/**
Expand All @@ -120,10 +124,14 @@ public function translateProductNameInOrdersDetails($name, $item)
{
$id = $item['item_meta']['_product_id'][0];
$product = Utilities::getProductTranslationByID($id);
if (!$product->is_visible()) {
return $product->post->post_title;
} else {
return sprintf('<a href="%s">%s</a>', get_permalink($product->id), $product->post->post_title);
if($product){
if (!$product->is_visible()) {
return $product->post->post_title;
} else {
return sprintf('<a href="%s">%s</a>', get_permalink($product->id), $product->post->post_title);
}
}else{
return $name;
}
}

Expand Down

0 comments on commit e0b14ce

Please sign in to comment.