Page 1 of 1

Check one or many attributes option

Posted: Sun Nov 19, 2023 4:31 pm
by m0fix
Hi,

[phoenix]
version = 1.0.8.20
[mysql]
version = 10.6.12-MariaDB-0ubuntu0.22.04.1
[php]
version = 8.0.30

I Will be gratful if someone gives me hints on how to get cart sessions with a list of attributes
i tryed to return an array in pi_options_attributes.php but it's not working:

Code: Select all

'selection' => is_string($_GET['products_id'])
                       ? $_SESSION['cart']->contents[$_GET['products_id']]['attributes'][$option_id] ?? []
                       : [],
and have checkbox toogle btns in template:
Screenshot from 2023-11-19 17-29-39.png

thanks

Re: Check one or many attributes option

Posted: Sun Nov 19, 2023 7:34 pm
by Kofod95
Forgive me if I misunderstand, but do you want people to be able to select multiple values for the same option (like ananas and olives in your screenshot)?

The system is not set-up for that, as that would also allow them to choose both S and L for the same product in your screenshot.
To allow multiple attributes, you either need to add more groups (supplements 1, supplements 2 etc) or code a new add-on for it. -At least as far as I know..

//Daniel

Re: Check one or many attributes option

Posted: Sun Nov 19, 2023 10:56 pm
by m0fix
So options1 Size will be radio toogle btns and options2 supplements as a checkbox toogle btn but yes i'm coding an addons something like this one:
app.php/addons/paid_addon/display_optio ... pi_module/

i'm blocked once we have L size, ananas and olives for exemple checked i want to pass those attributes values to $_SESSION['cart']; simply update the cart.

any suggestions?

Re: Check one or many attributes option

Posted: Mon Nov 20, 2023 5:48 am
by heatherbell
m0fix wrote: Sun Nov 19, 2023 10:56 pm any suggestions?
Keep it simple by making an Option for each Supplement and making "No thanks" and "Yes please" as Attributes for each Option.
You could also then extend the Attributes to allow "Double" portions of a Supplement, so for example, make "No thanks", "Single Portion" and "Double Portion" as Attributes which could also then increase the sale price per order.
This now makes me hungry for pizza!
🍕 I'll have mine with Double Kefta and Double Salami please! 🍕

Re: Check one or many attributes option

Posted: Mon Nov 20, 2023 9:53 am
by raiwa
I sugest to use a separate option for each supplement like @heatherbell suggested. The other way to allow multiple selections for one option is not implemented in Phoenix core and would require heavy modifications in the options/attributes system of the whole shop.
A different thing would be to customize how these supplement options show to the customer on the product page and the product listing in the shopping cart, checkout_confirmation, order confirmation mail, invoice, packingslip etc.

You can use the option id's to make things show different for the size option and the supplements options.