3

In my magento application created a phtml page in template/page/ folder..

Here displayed a products...Then there is a need for displaying

$this->getAddToCartUrl($product)

But it return null value...that means no value returned it.

How can i get it in my phtml page?

This is the html code:

<input id="url_<?php echo $_iterator;?>" name="url_$_iterator;" type="text" value="<?php echo $this->getAddToCartUrl($product) ?>">

2 Answers 2

10

Try calling this instead:

$this->helper('checkout/cart')->getAddUrl($product)
1
  • thanku so much....its working....
    – Kichu
    Mar 27, 2013 at 7:19
1

Using the helper 'checkout/cart' with get link but it want solve the problem as you will run with similar issues with the price.

I think it is better to change if you can change the template type definition in your xml, something like this:

<block type="catalog/product_list" template="your-template.phtml" name="your-name" as="your-name" />

Like that you will have in $this not only the link but the price with out calling the magento helper directly.

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.