Jump to content

Cart : New functionnality


Serial

Recommended Posts

Hi,

 

I will like to be able to inform a new parameter in my shopping cart. I will like that the customer can ask for a parameter of cut for his product.

Example: a product ordered with a quantity of 3 meters, the customer can require to cut the product in 3 x 1 meter.

 

In shopping-cart.tpl, I added :

{if $product.id_category_default != 99}<th class="cart_coupe item text-center">{l s='Coupe'}</th>{/if}

In shopping-cart-product-line.tpl, I added :

{if $product.id_category_default != 99}
    <td class="coupe_tissus" data-title="{l s='Coupe'}">
        <input id="coupe_select" type="checkbox">Coupe</input>
        <div id="param_coupe">
            <div class="coupe-content"><input id="nb_pieces" type="text" value="{$product.cart_quantity}" style="width:40px;"/> pièces x <input id="nb_metres" type="text" style="width:40px;" disabled /> m</div>
        </div>
    </td>
{/if}

Lastly, in my cart-summary.js, I will like to be able to display or not the div param_coupe function of the checkbox coupe_select :

function CalculCoupe()
{
        $('#coupe_select').checkboxChange(function(){
            $('#param_coupe').show('slow');
        }, function(){
            $('#param_coupe').hide('slow');
        });
}

Of course, I wrote my CalculeCoupe() function right before the functions so that executed out.

 

Result : my first line functions correctly. On the other hand, if I add 2 products in my shopping cart, the first line of product, that's work but not for the second-row forward.

Herewith, a screen of the result. If I check the 1st line, my div appears. Not for 2nd since it appears without being checked. How to carry out my Javascript for each lines of products ?

post-1055497-0-90562300-1441703668_thumb.png

Edited by Serial (see edit history)
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...