Jump to content

get the product id so to open cart procedure


mspace

Recommended Posts

Hello


(sorry for posting it also in this forum but i didn't get any help)


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="{$product.id_product|intval}"?


 


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

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