Closed plagasul closed 3 years ago
Hey @plagasul,
the exception is thrown here.
https://github.com/wagnerwagner/merx/blob/43e9b8ddf195b1a6f540319dd49cda1de074a1b7/src/cart.php#L51-L57
Can you try to get the details.exception
(Line 56 of cart.php) object of the Exception.
I enclosed the add code in a try catch block, and dumped the exception object, is this what you meant ?
Does it seem to say Page not found
is the issue ?
For products in subfolders should we pass the id with full path including the parent, like frame-options/white-frame
or similar ?
Thanks
Kirby\Exception\Exception Object
(
[data:protected] => Array
(
[id] => wood-white
)
[httpCode:protected] => 500
[details:protected] => Array
(
[exception] => Exception Object
(
[message:protected] => Page not found.
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /home/myuser/public_html/dev/dietz/site/plugins/merx/src/cart.php
[line:protected] => 41
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /home/myuser/public_html/dev/dietz/site/templates/home.php
[line] => 22
[function] => add
[class] => Wagnerwagner\Merx\Cart
[type] => ->
)
[1] => Array
(
[file] => /home/myuser/public_html/dev/dietz/kirby/src/Toolkit/Tpl.php
[line] => 37
[args] => Array
(
[0] => /home/myuser/public_html/dev/dietz/site/templates/home.php
)
[function] => require
)
[2] => Array
(
[file] => /home/myuser/public_html/dev/dietz/kirby/src/Cms/Template.php
[line] => 167
[function] => load
[class] => Kirby\Toolkit\Tpl
[type] => ::
)
[3] => Array
(
[file] => /home/myuser/public_html/dev/dietz/kirby/src/Cms/Page.php
[line] => 1156
[function] => render
[class] => Kirby\Cms\Template
[type] => ->
)
[4] => Array
(
[file] => /home/myuser/public_html/dev/dietz/kirby/src/Cms/App.php
[line] => 597
[function] => render
[class] => Kirby\Cms\Page
[type] => ->
)
[5] => Array
(
[file] => /home/myuser/public_html/dev/dietz/kirby/src/Cms/App.php
[line] => 925
[function] => io
[class] => Kirby\Cms\App
[type] => ->
)
[6] => Array
(
[file] => /home/myuser/public_html/dev/dietz/index.php
[line] => 5
[function] => render
[class] => Kirby\Cms\App
[type] => ->
)
)
[previous:Exception:private] =>
)
)
[isTranslated:protected] => 1
[message:protected] => Item "wood-white" could not be added to cart.
[string:Exception:private] =>
[code:protected] => error.merx.cart.add
[file:protected] => /home/myuser/public_html/dev/dietz/site/plugins/merx/src/cart.php
[line:protected] => 50
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /home/myuser/public_html/dev/dietz/site/templates/home.php
[line] => 22
[function] => add
[class] => Wagnerwagner\Merx\Cart
[type] => ->
)
[1] => Array
(
[file] => /home/myuser/public_html/dev/dietz/kirby/src/Toolkit/Tpl.php
[line] => 37
[args] => Array
(
[0] => /home/myuser/public_html/dev/dietz/site/templates/home.php
)
[function] => require
)
[2] => Array
(
[file] => /home/myuser/public_html/dev/dietz/kirby/src/Cms/Template.php
[line] => 167
[function] => load
[class] => Kirby\Toolkit\Tpl
[type] => ::
)
[3] => Array
(
[file] => /home/myuser/public_html/dev/dietz/kirby/src/Cms/Page.php
[line] => 1156
[function] => render
[class] => Kirby\Cms\Template
[type] => ->
)
[4] => Array
(
[file] => /home/myuser/public_html/dev/dietz/kirby/src/Cms/App.php
[line] => 597
[function] => render
[class] => Kirby\Cms\Page
[type] => ->
)
[5] => Array
(
[file] => /home/myuser/public_html/dev/dietz/kirby/src/Cms/App.php
[line] => 925
[function] => io
[class] => Kirby\Cms\App
[type] => ->
)
[6] => Array
(
[file] => /home/myuser/public_html/dev/dietz/index.php
[line] => 5
[function] => render
[class] => Kirby\Cms\App
[type] => ->
)
)
[previous:Exception:private] =>
)
It seems to be the case the id passed to the cart needs to be full in case of products in subfolders. It, of course makes sense, the smae happens with page().
So I have to use frames-options/wood-white
not just wood-white
doh!
Thank you
Hello,
I am getting the exception
'Item "{id}" could not be added to cart.'
when trying to add certain products to the cart.Contrary to regular products, which I can add without problems, these products sit in a subpage
These frame-products also have a different blueprint from regular products,
frame-product.yml
which goes like this:This is an example .txt file of such product:
The code that triggers the exception is simply:
Which works fine by susbstituting the id by that of a regular product, such as
'cactus'
.As I am not getting
'No "id" is provided.'
,'Page not found.'
or'Page must have a price field.'
I assume those are not the issues here (shouldn't be nevertheless).So ¿what could be the issue?
Danke