Jump to content

How to asign a value input to new variable


arturobelver

Recommended Posts

In product-list.tpl, Im using '$product.minimal_quantity' like mutiple to product and i use two inputs for this.

One of this inputs is the value insert by the client for multiplicate to product's multiple and the other input is this, hidden because i want add the new variable in attribute value="{$new_var * $product.minimal_quantity} 

Link to comment
Share on other sites

My button-container of product-list.tpl

<div class="button-container">
   {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.customizable != 2 && !$PS_CATALOG_MODE}
      {if isset($static_token)}
         <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">
            <span>{l s='Add to cart'}</span>
	 </a>
      {else}
	 <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart',false, NULL, 'add=1&id_product={$product.id_product|intval}', false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">
	    <span>{l s='Add to cart'}</span>
	 </a>
      {/if}	
      {if ($product.allow_oosp || $product.quantity > 0)}
         <input style="position:absolute; margin-top:3px; left:180px; padding: 0 3px; text-align:center; height: 40px; border: 1px solid #ccc; display:inline-block; float:left; width:25px;" type="" name="cantidad" id="cantidad" value="1"/>
         <span style="color:#719F41; font-size:20px; position:absolute; margin-top:3px; left:210px; padding: 0 3px; height:40px; line-height:40px ">
            x{$product.minimal_quantity}
         </span>
         <input style="position:absolute; margin-top:3px; left:210px; padding: 0 3px; text-align:center; height: 40px; border: 1px solid #ccc; display:none; float:left; width:25px;" type="text" name="qty" id="quantity_to_cart_{$product.id_product|intval}" value="{$product.minimal_quantity}"/>
      {/if}							
   {else}
      <span class="button ajax_add_to_cart_button btn btn-default disabled">
         <span>{l s='Add to cart'}</span>
      </span>
   {/if}
</div>

post-777862-0-75386400-1399027260_thumb.png

Link to comment
Share on other sites

i don't understand what you expect.

you ased about input, so you've got it in product-list.tpl file.

 

now what? you want to send it with add to cart? or... or what?

 

Im sorry vekia and thanks for your patience.

 

I want that when the client push 'add to cart', the input value is multiplied with the minimal_quantity and the total is added to the cart

Link to comment
Share on other sites

I'm trying to do something but can not get it to work

<input id="quantity" type="" value="1" onmouseout="<script type="text/javascript">var quantity_user = $("#quantity").val();</script>"  />

Could you please give some suggestion? Thanks

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...