Bcmul: Bcmath Function Argument is Not Well-formed - Question | JoomShaper
SP Page Builder 6 is Here! Learn More →

Bcmul: Bcmath Function Argument is Not Well-formed

DC

David Collado

EasyStore 1 month ago

upgraded easystore and go to orders tab and I get: bcmul: bcmath function argument is not well-formed and no orders to show.

This happened with the last two versions you pushed out.

When a customer goes to checkout on the store, the stripe payment just spins and spins not sure if its related to the error above please check.

0
5 Answers
Ziaul Kabir
Ziaul Kabir
Accepted Answer
Support Agent 1 month ago #201582

Hello David,

Thanks for reaching out to us.

To resolve this issues, Please, follow this steps:

Go to this path: JROOT/administrator/components/com_easystore/src/Checkout/OrderManager.php on line nearby 827.

Check this code,

  private function getProducts()
  {
    $products = $this->getOrderItem()->products ?? [];
    if (empty($products)) {
      return $products;
    }
    return array_map(function ($item) {
      $item->weight = $item->weight ?? 0;
      $unit = $item->has_variants 
        ? (isset($item->variant_data->unit) ? $item->variant_data->unit : (isset($item->unit) ? $item->unit : null)) 
        : (isset($item->unit) ? $item->unit : null);
      $item->unit = $unit;
      $item->weight_total = bcmul($item->weight, (int) $item->cart_item->quantity, 2);
      $item->weight_total_with_unit = SettingsHelper::getWeightWithUnit($item->weight_total, $unit);
      $item->weight_with_unit = SettingsHelper::getWeightWithUnit($item->weight, $unit);
      return $item;
    }, $products);
  }

please replace this code with this one,

 private function getProducts()
  {
    $products = $this->getOrderItem()->products ?? [];
    if (empty($products)) {
      return $products;
    }
   return array_map(function ($item) {
    $item->weight = isset($item->weight) && is_numeric($item->weight) ? (string) $item->weight : '0';
    $unit = $item->has_variants 
        ? (isset($item->variant_data->unit) ? $item->variant_data->unit : (isset($item->unit) ? $item->unit : null)) 
        : (isset($item->unit) ? $item->unit : null);

    $item->unit = $unit;
    $item->weight_total = bcmul($item->weight, (string)(int) $item->cart_item->quantity, 2);
    $item->weight_total_with_unit = SettingsHelper::getWeightWithUnit($item->weight_total, $unit);
    $item->weight_with_unit = SettingsHelper::getWeightWithUnit($item->weight, $unit);

    return $item;
}, $products);
  }

Thanks

0
DC
David Collado
Accepted Answer
1 month ago #201583

Does everyone who upgrades have to do this?

0
Ziaul Kabir
Ziaul Kabir
Accepted Answer
Support Agent 1 month ago #201589

Not all users, but some users get this issues.

I already forward this to our development team for further check.

Thanks

0
DC
David Collado
Accepted Answer
1 week ago #205554

I still get this message when upgrading to your newest version on all my stores, this is not acceptable as I have to do this manual code edit on over 20 stores with you when I update your software. What's the status of this fix?

0
Ziaul Kabir
Ziaul Kabir
Accepted Answer
Support Agent 1 week ago #205713

Hello,

I apologies for the inconvenience. This issue has been fixed in the upcoming release. Once it is published, your issue will be permanently resolved.

As a temporary workaround, you can continue using the previous process.

Thank you for your patience and understanding.

Best regards,

0