5

I want share product link that I had order, for that added email option on my order page in , but dont know what should i write at herf in anchor tag i.e that will redirect to refer to friend page

1
  • please share what you have tried so far?
    – Amit Bera
    Aug 2, 2018 at 18:22

1 Answer 1

4

You can get an idea from below code:

<?php foreach($items as $_item): ?>
    <?php $hreflink = $block->getUrl('sendfriend/product/send', ['_current' => true, '_use_rewrite' => true, '_query' => ['id' => $_item->getProductId()]]); ?>
    <a href="<?php echo $hreflink; ?>">Refer to Friend</a>
<?php endforeach; ?>

Code not tested.

3
  • its working perfectly ! just i need do some changes like get $items .can u explain why u used '_use_rewrite' => true Aug 3, 2018 at 6:21
  • 1
    If its working. Kindly accept it so that it will help other developers in future. Oct 8, 2018 at 13:21
  • Tick the green mark near my answer to accept it as solution. Oct 8, 2018 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.