I am getting exactly the same error message as the topic creator. My Kirby installation is in a subfolder. The .htaccess file is created correctly, incl. RewriteBase.
Has anyone found a solution to this problem?
I had a similar issue on my local environment. For me, writing the whole fetch path in the js file worked.
So instead of fetch('/api/shop/{...}') I used fetch('http://localhost:8888/api/shop/{...}').
“Call to a member function exists() on float” gets shown by the Kirby debug screen right? Do you see, in which file the exists() function is that causes the error?
The error message “Call to a member function exists() on float” appears as a pop-up when you press the add-to-cart button. Unfortunately, a concrete file is not displayed.
I think this probably appears when the existence of the tax field in the product is checked. Did you change the product page model in any way?
Also you could try commenting out
public function tax(): float
{
if ($this->content()->tax()->isEmpty()) {
return 0;
}
return $this->kirby()->option('taxRates')[$this->content()->tax()->toString()];
}
or changing it so that tax() doesn’t return a float in the product.php model. Maybe this causes the problem.
The problem is, that the Merx core at ProductList.php checks if the tax field exists, whereas the tax function in the model the tax function returns a float.
I think changing it to something like this could work:
public function tax(): Field
{
if ($this->content()->tax()->isEmpty()) {
return new Field($this, 'tax', 0);
}
return new Field($this, 'tax', $this->kirby()->option('taxRates')[$this->content()->tax()->toString()]);
}
Argument 2 passed to Kirby\Cms\App::trigger() must be of the type array, object given, called in /Users/TE-NT/Sites/localhost/merx-starterkit/site/plugins/merx/src/cart.php on line 22
as a pop up when i refresh or click add-to-cart button
Hey there, I have the same problem as the original post. The cart pops up but is empty after I click on Add to cart. It’s the same for localhost (MAMP) and on my webserver. Any ideas how to solve it?