2

I am trying to create a one page store and I would like to delete the product page as I have the product description as a drop down on the page. So is there any way that I could disable the products page as when the person clicks on the product in the cart/minicart it will not redirect him to the product page.

I was trying to find answer but couldn't find anything.

1 Answer 1

3

The easiest way to make sure the product URL always leads to your custom page is to rewrite the product url model.

Using your own custom module (more on that here) you can add your own product url factory.

Make sure you add a dependency on Mage_Catalog in app/etc/modules/Namespace_Module.xml

<?xml version="1.0"?>
<config>
    <modules>
        <[Namespace_Module]>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Catalog />
            </depends>
        </[Namespace_Module]>
    </modules>
</config>

Now in your config.xml you'll need to add the following node in the global node

<catalog>
   <product>
      <url>
         <model>[namespace]_[module]/catalog_product_url</model>
      </url>
   </product>
</catalog>

Now we can create the actual factory model app/code/local/[Namespace]/[Module]/Model/Catalog/Product/Url.php

class [Namespace]_[Module]_Model_Catalog_Product_Url extends Mage_Catalog_Model_Product_Url
{

    /**
     * Retrieve product URL based on requestPath param
     * This method is called from several other methods that return URLs for usage on frontend
     *
     * @param Mage_Catalog_Model_Product $product
     * @param string $requestPath
     * @param array $routeParams
     *
     * @return string
     */
    protected function _getProductUrl($product, $requestPath, $routeParams)
    {
        /**
         * Do whatever magic you need to do here to format the correct URL per product
         */

        return $url;
    }
}
2
  • that is really good idea @Sander +vote
    – Amit Bera
    Commented Oct 28, 2015 at 10:04
  • Great answer I will get on it straight away. Thank you +vote Commented Oct 28, 2015 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.