views:

185

answers:

3

I want to add url for each simple product listed under Grouped product in Magento i have changed it with below code in app\design\frontend\blank\default\template\catalog\product\view\type\grouped.phtml but still not work for me it's link but with main group product (Example: Main Grouped product and three simple products Item1 Item2 Item3 but all simple product show same url of ain Grouped product)

<td><a href="<?php $_item->getUrlPath() ?>"><?php echo $this->htmlEscape($_item->getName()) ?></a> </td>

and this also

<td><a href="<?php $_item->getProductUrl() ?>"><?php echo $this->htmlEscape($_item->getName()) ?></a> </td>

i am doing any mistek pls. help how and where to change it

A: 

Firstly, you'll need to echo the output of the Url methods:

<a href="<?php echo $_item->getProductUrl() ?>">

Then, I'm not sure about the code that you're using to get the items, but I'd guess that you might need to load the products first before you can call the getUrlPath and getProductUrl methods.

For example:

$product = Mage::getModel('catalog/product')->load($_item->getProductId());
echo $product->getProductUrl();

Try those out and see if they help.

Chris Norton
A: 

Hey Chris thanks you, u r great it works, actually i m newbie for Magento so this help me a lot thanks again :)

what i did is here

<td><a href="<?php echo $_item->getProductUrl() ?>" target="_blank"><?php echo $this->htmlEscape($_item->getName()) ?></a></td>

and this work like a charm

yogs
A: 

Hi. Could you please specify where you're placing this code, if you're replacing code, etc.

As I understand: when viewing a grouped product, this will show each simple product title as a link to that simple product's page.

I assume you are replacing this code: <td><?php echo $this->htmlEscape($_item->getName()) ?></td>

amanda