Linking Simple product to their page listed under Grouped product in Magento
I want to add url for eac开发者_Go百科h 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 does 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>
Am I doing any mistakes? Please help how and where to change it?
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.
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>
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
精彩评论