mspace Posted December 15, 2014 Share Posted December 15, 2014 (edited) Hello I have created a custom form so the customer can order custom products. In the form I have a text field that is the product id and the user has to fill it with the relate product id. I need to grab the id from the field in the <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}"> Is there any way so to pass the value from the field in the data-id-product? thank you Edited December 17, 2014 by mspace (see edit history) Link to comment Share on other sites More sharing options...
mspace Posted December 17, 2014 Author Share Posted December 17, 2014 Hello I have created a custom form so the customer can order custom products. In the form I have a text field that is the product id and the user has to fill it with the relate product id. I need to grab the id from the field in the <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}"> Is there any way so to pass the value from the field in the data-id-product? thank you I managed to pass the product id to data-id-product. I pass it to a variable to a php file. $prodid=$_POST['co_prodcod']; Then I echo the button echo "<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='{$prodid}'> But now I cannot pass the product id to : href='{$link->getPageLink('cart',false, NULL, 'add=1&id_product={$product.id_product|intval}' so to begin the add to cart functionality Can someone help with this problem? Link to comment Share on other sites More sharing options...
Recommended Posts