Jump to content

adding checkbox to a product


lorenzo.p

Recommended Posts

I have a prestashop site set up, the products sold are sandwiches, what i need to do is add for each sandwices (product)

two groups of checkbox (and not radio as you can do with atributes)

one for the sauce ex. "mustard, mayonaise, kechup ect... "

and one for the accompaniments ex "salad, carrots, cumcumbers ect....."

 

the client (on the front end) must be able to select any sauce and any accopaniments combinaisons that's why i need checkbox. the selected choice will have no effect on the price but need to be shown on the order.

 

I added a field on the ps_product database that hold all the sauces separated by ", " and i'am able to display them as checkbox on the product page editing the product.tpl of my template like so: 

{assign var=sauces value=", "|explode:$product->sauce}

<fieldset class="attribute_fieldset">

{foreach from=$sauces item=foo}
    <label class="attribute_label" for="{$foo}">
       {$foo} 
       <input id="{$foo}" type="checkbox" name="{$foo}" value="{$foo}" />
    </label> 

{/foreach}

</fieldset>

i put That block of code in the <div id="attributes"> so it gets added after my other attributes

 

but i can't figure how to save the choice when the product is added to the cart,

i tried overwriting the cart.php class and CartController.php with no luck so far i'am not sure when or where that form is being processed before it gets added to the cart, i would like to simply append the values of the selected checkbox to the description of the product when it's added to the cart so it keeps that description trough all the order process and trough the invoice and e-mail sent.

 

Thanks alot for your help

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...