<a href="../Public/singleproduct?id=<?php echo $row["Product"]["id"];?>">
<div class="single-products">
<div class="productinfo text-center myimg">
<?php echo $this->Html->image("product/".$row["Product"]["photo"]); ?>
<h2>Rs.<?php echo $row["Product"]["price"];?></h2>
<p><?php echo $row["Product"]["name"];?></p>
<a href="javascript:document.ff<?php echo ($i++);?>.submit()" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
<?php echo $this->Session->flash('flash', array('element' => 'flash_notification')); ?>
</div>
</div>
</a>
in using pagination i need to convert this link in cakephp way because on other page of pagination this html <a href=""></a>
will not work.
And this is my all code of that .ctp file
<?php
$i=0;
foreach($product as $row)
{
?>
<form name="ff<?php echo $i;?>" method="post">
<input type="hidden" name="product_tbls_id" value="<?php echo $row["Product"]["id"];?>">
<input type="hidden" name="qty" value="1">
<div class="col-sm-4">
<div class="product-image-wrapper">
<a href="../Public/singleproduct?id=<?php echo $row["Product"]["id"];?>">
<div class="single-products">
<div class="productinfo text-center myimg">
<?php echo $this->Html->image("product/".$row["Product"]["photo"]); ?>
<h2>Rs.<?php echo $row["Product"]["price"];?></h2>
<p><?php echo $row["Product"]["name"];?></p>
<a href="javascript:document.ff<?php echo ($i++);?>.submit()" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
<?php echo $this->Session->flash('flash', array('element' => 'flash_notification')); ?>
</div>
</div>
</a>
</div>
</div>
</form>
<?php
}
?>
i tried this and it's working for me.Posting answer just because may be it can help someone.
<?php
echo $this->Html->link('<div class="single-products">'.'<div class="productinfo text-center myimg">'.$this->Html->image("product/".$row["Product"]["photo"]).'<h2>'.$row["Product"]["price"].'</h2>'.'<p>'.$row["Product"]["name"]."</p><a href='javascript:document.ff".($i++).".submit()' class='btn btn-default add-to-cart'><i class='fa fa-shopping-cart'></i>Add to cart</a>".$this->Session->flash('flash', array('element' => 'flash_notification')).'</div>'.'</div>',
array
(
'controller'=>'Public',
'action'=>'singleproduct?id='.$row["Product"]["id"],
),
array
(
'escape'=>false
)
);
?>