1

There is a question on stackoverflow, perhaps this is a better place to ask for:

https://stackoverflow.com/questions/24490169/magento-product-export-with-full-canonical-url

1

You will need to create an entry in a layout.xml file to put an additional template in the head section of the page when you are on a category page (this would likely be in a catalog_Category_view block). You would also probably need a view file as well as a Block object to fetch the URL you want to use (technically you could put that in the view file, but having the block object is more "Magento").

Your layout.xml block would look something like this

<catalog_category_view>
    <reference name="head">
        <block type="canonical/canonical" name="head_url" as="head_url" template="ocaff/canonical/head.phtml" />
    </reference>
</catalog_category_view>

This block references a head.phtml file. That file would contain:

<link rel="canonical" href="<?php echo $this->getCanonicalUrl() ?>" />

This calls back to a block object that has a function called getCanonicalUrl(). In this function you will find and determine what you want the canonical to be. Most likely you want this to be the URL key, but you may have other logic in mind there.

  • this has nothing in common with my question. i want an export on cli – Kevin Horst Jul 1 '14 at 13:00
  • nice. there is always one person in the world who upvotes wrong answers. great work! – Kevin Horst Jul 1 '14 at 18:40

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.