1

I am trying to add both an ahref link to the backend order view + the frontend store view (items grid) @ Mage_Adminhtml_Block_Sales_Items_Column_Name. This is not working; some small things that are boggling me.

  • How can we retrieve the frontend url? (the problem is you have to detect what store it was sold in + build the URL)

  • How can we retrieve the backend URL to directly edit (and see) the product

  • Suppose it is a simple product: how would we then retrieve the same as above; only this time with the parent information (if it exists ... we probably need to add some HasParent() information)

The end link would look something like this

<a href="linktorightfrontendproduct">online: getSKU</a> (if has parent show parent link)

<a href="linktobackendproduct">online: getSKU</a>

<a href="linktorightfrontendPARENTproduct">parent link: getSKU</a> (if has parent show parent link)

Greatly appreciate your insights

0

This is what we have so far: at least it is a start

Working

  • shows backend edit url of (parent) configurable
  • show frontend link, via workaround and using search

Not working yet

  • show frontend link directly to the product (not via search)
  • show backend edit url of child item (if it exists) for this order_item

Code so far

HELP WELCOME!

<?php
/**
 * @see Mage_Adminhtml_Block_Sales_Items_Column_Name
 */
?>

<?php if ($_item = $this->getItem()): ?>

<?php
  $productUrl = Mage::getUrl() . $_item->getProductUrl();
  $productSku = $_item->getSku();
  $productId  = $_item->getProductId();
  $storeId = $_item->getStoreId();
  $adminUrl = Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/edit', array('id' => $productId));
  $frontendUrl = "https://example.com/catalogsearch/result/?q={$productSku}";
?>    

    <h5 class="title"><span id="order_item_<?php echo $_item->getId() ?>_title"><?php echo "SKU:{$productSku} "; ?><?php echo $this->escapeHtml($_item->getName()) ?></span></h5>
    <div>
    <a style="cursor: pointer;" href="<?php echo $frontendUrl; ?>" target="_blank">view online</a>&nbsp;|&nbsp;
    <a style="cursor: pointer;" href="<?php echo $adminUrl; ?>" target="_blank">backend edit</a>
    </div>
| improve this answer | |
  • Hello snh_nl, instead of putting your clarification as an answer, please edit the question itself and put it there. – Rajeev K Tomy Jun 22 '17 at 11:56

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.