Community Store - add more questions to checkout

Permalink 1 user found helpful
Hi all,

I am working community store package which is going great (great features, well done to all involved), I have one question though relating to the checkout:

How do I add two radio buttons to the checkout that will then get sent through with order confirmation? I have successfully inserted the following code and it displays correctly but I'm not sure how to get its responses sent through with the order confirmation to the admin

<h2><?= t("Other options") ?></h2>
<div class="form-group">
    <label><?= t('If a plant I have selected is unavailable:'); ?></label>
    <div class="radio">
        <label>
            <input type="radio" name="OutofStockOptions" id="OutofStockOptions" value="Select a suitable substitute for me" checked>Select a suitable substitute for me
        </label>
    </div>
    <div class="radio">
        <label>
            <input type="radio" name="OutofStockOptions" id="OutofStockOptions" value="Send the rest of my order and refund me for the missing plant">Send the rest of my order and refund me for the missing plant
        </label>
    </div>
</div>


Any help would be greatly appreciated.

 
mesuva replied on at Permalink Best Answer Reply 4 Attachments
mesuva
You could investigate the 'Order Attributes' section, this is where you can create attributes to display in an 'Customer Choices' panel that appears in the checkout steps. Those then get stored against the order and added to emails.

You have to create your order attribute then make sure it's in that particular 'Customer Choices' attribute group to appear. For a radio/select option, I had to go to Attribute Types (/index.php/dashboard/system/attributes/types) and configure it to be available to 'Store Order'.

This achieved what you are after when I tested it, but in the checkout it only showed a 1 or a 2 as the selected option, not the text I entered in as the choice. So you could either look into why that is happening, or potentially use a checkbox instead.

Screenshots attached
mobius2000 replied on at Permalink Reply
Hi Mesuva, you really are a Concrete5 guru... I'm having one issue with your solution, how do I enable the orderChoicesEnabled?

I have added a basic checkbox attribute via the order>attributes section, placed it in the "other customer choices" section but it doesn't appear. Looking at the checkout singlepage I can see the container but it is looking for a setting of orderChoicesEnabled which I have no idea where to enable.

Any hints?
mesuva replied on at Permalink Reply
mesuva
orderChoicesEnabled isn't a setting as such from what I understand, it's really just a variable that goes to true when there is at least one attribute to display.

From my quick test, I didn't have to do anything specific to make it appear, I just made sure the attribute was in that 'Other Customer Choices' set. Are you sure your new attribute has been successfully placed into that particular set?
mobius2000 replied on at Permalink Reply
I need to buy you a beer one day Mesuva, you have saved my butt on numerious occasions now.

Thank you so much!!!
mobius2000 replied on at Permalink Reply
Hi Mesuva,

I have just discovered your solution technically works in the checkout (even though as you pointed out it shows 1/0 for selections) however I have just found that it doesn't even show the 1 or 0 when you view the order details via the dashboard.

I was just hoping to confirm if you found the same thing?
mesuva replied on at Permalink Reply
mesuva
I've done a test on 5.7 and v8, and I had a checkbox attribute value show within the order details, under the heading of 'Other Choices', as either a Yes or a No, so I'm not seeing the same issue.

Are you running the latest release, or the latest from the master branch?
I've just pushed up another release (v1.2.3) which includes all the recent minor bugfixes, including this one that is relevant:
https://github.com/concrete5-community-store/community_store/commit/...