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

Commit

Permalink
Fixes #170 product variation titles corrected in cart and orders
Browse files Browse the repository at this point in the history
Fixes #170 when WooCommerce 3.0.8+ active, product variation titles
corrected in cart and orders
  • Loading branch information
Jon007 committed Jun 5, 2017
1 parent 9b4d465 commit 046307e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 39 deletions.
1 change: 1 addition & 0 deletions readme.txt
Expand Up @@ -120,6 +120,7 @@ Just make sure to setup your permalinks , and every thing will be fine , I promi
== Changelog ==

== 1.0.1 ==
Fixes #170 when WooCommerce 3.0.8+ active, product variation titles corrected in cart and orders
Added Documentation links to new wiki Documentation pages
Added minified javascript (enable SCRIPT_DEBUG to use unminified versions)
Fixes #174 Error in autofill of missing translations of parent category
Expand Down
39 changes: 0 additions & 39 deletions src/Hyyan/WPI/Order.php
Expand Up @@ -48,9 +48,6 @@ public function __construct()
add_filter(
'woocommerce_order_item_product', array($this, 'translateProductsInOrdersDetails'), 10, 3
);
add_filter(
'woocommerce_order_item_name', array($this, 'translateProductNameInOrdersDetails'), 10, 3
);
}

/**
Expand Down Expand Up @@ -103,42 +100,6 @@ public function translateProductsInOrdersDetails($product)
}
}

/**
* Translate the product name in order details page.
*
* @param string $name product name
* @param array $item order item
* @param boolean $is_visible whether product is visible. Defaults to false.
*
* @return string product name
*
* @todo should I remove this filter and let handle the translation in the
* theme file?
*/
public function translateProductNameInOrdersDetails($name, $item, $is_visible = false)
{
$id = (Utilities::woocommerceVersionCheck('3.0')) ? $item->get_product_id() : $item['item_meta']['_product_id'][0];
$product = Utilities::getProductTranslationByID($id);
if ($product) {
if (Utilities::woocommerceVersionCheck('3.0')) {
if (!$is_visible) {
return $product->get_name();
} else {
return sprintf('<a href="%s">%s</a>', get_permalink($product->get_id()), $product->get_name());
}
} else {
if (!$is_visible) {
return get_post($product->get_id())->post_title;
//return $product->post->post_title;
} else {
return sprintf('<a href="%s">%s</a>', get_permalink($product->get_id()), get_post($product->get_id())->post_title);
//return sprintf('<a href="%s">%s</a>', get_permalink($product->id), $product->post->post_title);
}
}
} else {
return $name;
}
}

/**
* Correct My account order query.
Expand Down

0 comments on commit 046307e

Please sign in to comment.