Hi,
I am trying to create a text input pi module. Some of the products we sell allow or require text input.
I have created a text input box but am stumped on the next step, adding it to the cart session and then in to the customers_basket table.
Does anyone have experience of doing this? I would prefer to use hooks as opposed to hard coding.
Any help is much appreciated.
Add fields to $_SESSION['cart']
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Add fields to $_SESSION['cart']
For what you are doing, you might be better off doing things in some different fashion. Note that the original Option Type Feature modified the tables to store a string instead of a number. The contents array is accessible from outside the shopping cart. So you could override the necessary actions and modify the array directly.
I could add new hooks to the action processing. That would save having to override the action file. But it probably won't get released until at least November.
I could add new hooks to the action processing. That would save having to override the action file. But it probably won't get released until at least November.
-
LeeFoster
- Contributor
- Posts: 263
- Joined: Sun Feb 28, 2021 9:41 pm
- Phoenix Version: v1.0.8.20
- Has thanked: 1 time
- Been thanked: 5 times
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Add fields to $_SESSION['cart']
includes/actions/add_product.php might be the only action that works with attributes.
-
LeeFoster
- Contributor
- Posts: 263
- Joined: Sun Feb 28, 2021 9:41 pm
- Phoenix Version: v1.0.8.20
- Has thanked: 1 time
- Been thanked: 5 times
Re: Add fields to $_SESSION['cart']
I'm not adding it as an attribute, it's a stand alone field.ecartz wrote: ↑Tue Sep 07, 2021 1:00 am includes/actions/add_product.php might be the only action that works with attributes.