• Resolved freittas

    (@freittas)


    Hello,

    Thanks for the great plugin and the last update. Although I noticed that after the update the orders come with this error on it (before the product name):
    Warning: Missing argument 3 for Hyyan\WPI\Order::translateProductNameInOrdersDetails(), called in XXXXX/wp-includes/plugin.php on line 235 and defined in /XXXX/wp-content/plugins/woo-poly-integration/src/Hyyan/WPI/Order.php on line 116

    Can you please advise on how to fix it ?

    Thanks

Viewing 15 replies - 1 through 15 (of 15 total)
  • Hi, I can’t reproduce the problem.

    In which page do you see this message (a screenshot would be great)? Can you please let me know the steps to reproduce the problem?

    Thanks in advance.

    Thread Starter freittas

    (@freittas)

    Hello @decarvalhoaa ,

    Sorry I should have been more clear.

    This error only appears when you get a order confirmation from your woocommerce. So basically the email received by the customer when you complete a sale.

    Screenshot here: http://prntscr.com/ch8dkb

    Let me know if you need anything else.

    Thanks in advance for the fast reply.

    Can you post what are your woocommerce, WordPress, Polylang versions. I’m assuming you are using the version 0.28 of this plugin.

    How did you updated to the last version, manually or via the admin backend? Have you seen any error?

    Thread Starter freittas

    (@freittas)

    Hello @decarvalhoaa ,

    I updated via admin backend and there was no error.

    Wordpress 4.6.1
    Woocommerce 2.6.4
    POlylang 2.0.4

    I deactivated and activated the plugin but the problem continues. Should I delete it and install it again ?

    What’s your recommendation?

    Thanks in advance

    Sorry for the late reply.

    I would indeed delete the plugin (plugin directory) and install the master version in the github repository. It should be exactly the same, but it doesn’t hurt trying. Here is the link
    https://github.com/hyyan/woo-poly-integration/archive/master.zip

    Please make sure to backup and test it in a staging environment first.

    Hello,

    just read through this topic, as I am faced with exactly the same issue as freittas…

    Same message, on order confirmation as well as under >my-account>orders/subscriptions overview – just before the product name:

    Warning: Missing argument 3 for Hyyan\WPI\Order::translateProductNameInOrdersDetails() in /home/xxx/www/xxx.com/wp-content/plugins/woo-poly-integration-master/src/Hyyan/WPI/Order.php on line 116

    I tried to reinstall as suggested but no success. All involved plugins (woocommerce, polylang and woopoly) are up to date with their latest versions.

    Thanks for any idea how to resolve this.

    I would love to be able to offer a solution, but I’m struggling to understand what may be causing the issue.

    Have you tried deactivate all plugins except WC, Polylang and WooPoly? Try also with the free Storefront Theme from WooThemes. Do you still have the same issue?

    If you still have the issue, you can revert the changes in Order.php file in the last release like so:

    Line 50: change
    'woocommerce_order_item_name', array($this, 'translateProductNameInOrdersDetails'), 10, 3
    to
    'woocommerce_order_item_name', array($this, 'translateProductNameInOrdersDetails'), 10, 2

    Line 116: change
    public function translateProductNameInOrdersDetails($name, $item, $is_visible)
    to
    public function translateProductNameInOrdersDetails($name, $item)

    Line 121: change
    if (!$is_visible) {
    to
    if (!$product->is_visible()) {

    There is no issue with this code, but this was the only change in Order.php.

    I this I know what is going on.

    Instead of reverting the changes like I suggested in the post before, do the following.

    In Order.php, simply replace in line 116
    public function translateProductNameInOrdersDetails($name, $item, $is_visible)
    with
    public function translateProductNameInOrdersDetails($name, $item, $is_visible = false)

    Great, thank you for your help! This problem is solved.

    However, I just realised there is another little bug around – sorry to keep you busy… 😉

    I went to woocommerce settings > accounts > account endpoints and have set the “downloads” endpoint to blank (as I have no downloads to offer) in order to make the “downloads” line disappear from the “My account” menu.

    Resulting from this I get the following text displayed on every page of the website:

    Warning: strpos() [function.strpos.php]: Empty needle in /home/xxx/www/xxx.com/wp-content/plugins/woo-poly-integration-master/src/Hyyan/WPI/Endpoints.php on line 231

    Any idea to work around this? Thank you.

    • This reply was modified 8 years, 8 months ago by charlyfox.

    In line 231 of the Endpoints.php file replace
    if (false !== ($pos = strpos($item->url, $value))) {
    with
    if ($value && false !== ($pos = strpos($item->url, $value))) {

    I will prepare a bug fix for these 2 issues for a future release (probably 0.29).

    Please mark this thread as solved/resolved.

    • This reply was modified 8 years, 8 months ago by decarvalhoaa.

    Hi, just tried to insert the code you wrote down in endpoints.php > line 231; However it returns a syntax problem, the site breaks as long as this line is active.
    Could it be the “->” in front of “url”?

    Thanks for having a quick look at it.

    Instead of copy and paste, try typing in the additional text ($value && ). Sometime the copy & paste copies some “hidden” characters.

    Thanks, all good now 🙂

    Thread Starter freittas

    (@freittas)

    Hello @decarvalhoaa,

    That fixed the issue. Thank you very much for your help !

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Error on Order::translateProductNameInOrdersDetails’ is closed to new replies.