Product Donations

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
peter69
Posts: 95
Joined: 09 Jun 2022, 19:31

Re: Product Donations

Post by peter69 » 30 Jan 2023, 14:45

Hello!

I have sent you the error as a private message,

Regards,

User avatar
peter69
Posts: 95
Joined: 09 Jun 2022, 19:31

Re: Product Donations

Post by peter69 » 31 Jan 2023, 04:40

Hello Aimeos,

I checked in detail the error and made several tests. The issue occurs because the getCatalogIds function returns an empty array. I checked the configuration of the category and had it configured with the state: "hidden", apparently this function does not take into account the categories that have this state.

To avoid generating an error in the frontend, it might be a good idea to verify that the $treeCatalogIds variable that contains the array is not empty to avoid generating a MariaDB/MySQL error.

Best regards!
Attachments
query
query
get catalog id by code.png (69.24 KiB) Viewed 1425 times
getCatalogIds return empty array
getCatalogIds return empty array
query-error-laravel-aimeos.png (18.62 KiB) Viewed 1425 times

User avatar
peter69
Posts: 95
Joined: 09 Jun 2022, 19:31

Re: Product Donations

Post by peter69 » 31 Jan 2023, 06:49

I was analyzing, and as in this part the products will be donated, then the customers should not set the delivery address in the checkout process.

Is there any way you recommend to hide the delivery address form?

One option I can think of is to create a page where you list the products that can be donated. When the user enters that page, a cookie or a value will be saved in the localstorage, if the customer goes immediately to the checkout (after adding products to the cart), in step 2 of the checkout, check if there is a cookie called for example "from_donation". If the cookie exists, then hide the delivery address form, otherwise show it.

What do you think of this approach?

Thank you very much for your help,

Regards!

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Product Donations

Post by aimeos » 01 Feb 2023, 09:21

peter69 wrote: 31 Jan 2023, 04:40 I checked in detail the error and made several tests. The issue occurs because the getCatalogIds function returns an empty array. I checked the configuration of the category and had it configured with the state: "hidden", apparently this function does not take into account the categories that have this state.
The used "->filter(true)" statement adds "status > 0" to the filter and hidden has a value of "2" so that should not be the problem. Can you check if the configured category codes are different from the used ones in the mshop_catalog table?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Product Donations

Post by aimeos » 01 Feb 2023, 09:23

peter69 wrote: 31 Jan 2023, 06:49 Is there any way you recommend to hide the delivery address form?
You could write a decorator for the address part of the checkout/standard component which removes the existing delivery addresses from the view and sets the config to disable new delivery addresses if all products in the basket are donations.

If the basket contains mixed products (donations and non-donations), you should show the delivery addresses nevertheless.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
peter69
Posts: 95
Joined: 09 Jun 2022, 19:31

Re: Product Donations

Post by peter69 » 03 Feb 2023, 03:32

aimeos wrote: 01 Feb 2023, 09:21
peter69 wrote: 31 Jan 2023, 04:40 I checked in detail the error and made several tests. The issue occurs because the getCatalogIds function returns an empty array. I checked the configuration of the category and had it configured with the state: "hidden", apparently this function does not take into account the categories that have this state.
The used "->filter(true)" statement adds "status > 0" to the filter and hidden has a value of "2" so that should not be the problem. Can you check if the configured category codes are different from the used ones in the mshop_catalog table?
I have checked the table and they have the correct code configured. I checked the filter and filterBase function and I see that when you pass true, it will only take into account the state: 1.

You can see it in the screenshots.
Attachments
screenshot---.png
screenshot---.png (41.2 KiB) Viewed 1398 times
screenshot--.png
screenshot--.png (35.46 KiB) Viewed 1398 times
screenshot-.png
screenshot-.png (54.3 KiB) Viewed 1398 times

User avatar
peter69
Posts: 95
Joined: 09 Jun 2022, 19:31

Re: Product Donations

Post by peter69 » 03 Feb 2023, 03:36

aimeos wrote: 01 Feb 2023, 09:23
peter69 wrote: 31 Jan 2023, 06:49 Is there any way you recommend to hide the delivery address form?
You could write a decorator for the address part of the checkout/standard component which removes the existing delivery addresses from the view and sets the config to disable new delivery addresses if all products in the basket are donations.

If the basket contains mixed products (donations and non-donations), you should show the delivery addresses nevertheless.
I will try it!

Thank you so much for your recommendations!!!

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Product Donations

Post by aimeos » 03 Feb 2023, 09:52

peter69 wrote: 03 Feb 2023, 03:32 I have checked the table and they have the correct code configured. I checked the filter and filterBase function and I see that when you pass true, it will only take into account the state: 1.
OK, this means we need to change:

Code: Select all

filter( true) -> filter( null )
Done that in the Aimeos core and you can check when installing the -dev version:

Code: Select all

composer req aimeos/aimeos-core:2022.10.x-dev
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
peter69
Posts: 95
Joined: 09 Jun 2022, 19:31

Re: Product Donations

Post by peter69 » 04 Feb 2023, 18:09

I will update it!

Thank so much!!!

Post Reply