Skip to main content
replaced http://magento.stackexchange.com/ with https://magento.stackexchange.com/
Source Link

For my store I want to create the situation where children of Configurable Products that are set to 'Not Visible Individually' are accessable anyway, when the direct URL is provided. Currently it returns a 404-error.

The purpose of this is, so we can only load the direct URLs in Google Shopping using Product Feeds, but not display the products in either Search or Catalog on the site.

I have no idea where to start. Can anyone help me out?

Update:

Using Marius' code from [another question](httphttps://magento.stackexchange.com/questions/104492/how-redirect-simple-products-of-configurable-product?rq=1) I created a module with the following code in /Namespace/Modulename/Model/Observer.php
<?php
     class Namespace_Modulename_Model_Observer {
        public function redirectToUrl($observer) {
            $id = Mage::app()->getRequest()->getParam('id');
            $_product = Mage::getModel('catalog/product')->load($id);

            $urlKey = $_product->getProductUrl($id);

            if (isset($urlKey)) {

            Mage::app()->getResponse()->setRedirect($urlKey, 301);
            Mage::app()->getResponse()->sendResponse();
            exit;
        }
        return $this;
    }
} ?>

This (obviously) sends the server in a loop, as I'm trying to send it to the simple product's page and Magento is trying to send it back to 404.

I think I'm very close to a solution, because all that needs to be done now (I think) is a way to overwrite Magento's default behavior of sending it to 404.

Any ideas?

Update #2

It's starting to seem that what I want is impossible and I can't find anything on the internet that can help me out.

For my store I want to create the situation where children of Configurable Products that are set to 'Not Visible Individually' are accessable anyway, when the direct URL is provided. Currently it returns a 404-error.

The purpose of this is, so we can only load the direct URLs in Google Shopping using Product Feeds, but not display the products in either Search or Catalog on the site.

I have no idea where to start. Can anyone help me out?

Update:

Using Marius' code from [another question](http://magento.stackexchange.com/questions/104492/how-redirect-simple-products-of-configurable-product?rq=1) I created a module with the following code in /Namespace/Modulename/Model/Observer.php
<?php
     class Namespace_Modulename_Model_Observer {
        public function redirectToUrl($observer) {
            $id = Mage::app()->getRequest()->getParam('id');
            $_product = Mage::getModel('catalog/product')->load($id);

            $urlKey = $_product->getProductUrl($id);

            if (isset($urlKey)) {

            Mage::app()->getResponse()->setRedirect($urlKey, 301);
            Mage::app()->getResponse()->sendResponse();
            exit;
        }
        return $this;
    }
} ?>

This (obviously) sends the server in a loop, as I'm trying to send it to the simple product's page and Magento is trying to send it back to 404.

I think I'm very close to a solution, because all that needs to be done now (I think) is a way to overwrite Magento's default behavior of sending it to 404.

Any ideas?

Update #2

It's starting to seem that what I want is impossible and I can't find anything on the internet that can help me out.

For my store I want to create the situation where children of Configurable Products that are set to 'Not Visible Individually' are accessable anyway, when the direct URL is provided. Currently it returns a 404-error.

The purpose of this is, so we can only load the direct URLs in Google Shopping using Product Feeds, but not display the products in either Search or Catalog on the site.

I have no idea where to start. Can anyone help me out?

Update:

Using Marius' code from [another question](https://magento.stackexchange.com/questions/104492/how-redirect-simple-products-of-configurable-product?rq=1) I created a module with the following code in /Namespace/Modulename/Model/Observer.php
<?php
     class Namespace_Modulename_Model_Observer {
        public function redirectToUrl($observer) {
            $id = Mage::app()->getRequest()->getParam('id');
            $_product = Mage::getModel('catalog/product')->load($id);

            $urlKey = $_product->getProductUrl($id);

            if (isset($urlKey)) {

            Mage::app()->getResponse()->setRedirect($urlKey, 301);
            Mage::app()->getResponse()->sendResponse();
            exit;
        }
        return $this;
    }
} ?>

This (obviously) sends the server in a loop, as I'm trying to send it to the simple product's page and Magento is trying to send it back to 404.

I think I'm very close to a solution, because all that needs to be done now (I think) is a way to overwrite Magento's default behavior of sending it to 404.

Any ideas?

Update #2

It's starting to seem that what I want is impossible and I can't find anything on the internet that can help me out.

The url which has given by author, that page is not found, so i removed
Source Link

For my store I want to create the situation where children of Configurable Products that are set to 'Not Visible Individually' are accessable anyway, when the direct URL is provided. Currently it returns a 404-error.

The purpose of this is, so we can only load the direct URLs in Google Shopping using Product Feeds, but not display the products in either Search or Catalog on the site.

I have no idea where to start. Can anyone help me out?

Update:

Using Marius' code from [another question](http://magento.stackexchange.com/questions/104492/how-redirect-simple-products-of-configurable-product?rq=1) I created a module with the following code in /Namespace/Modulename/Model/Observer.php
<?php
     class Namespace_Modulename_Model_Observer {
        public function redirectToUrl($observer) {
            $id = Mage::app()->getRequest()->getParam('id');
            $_product = Mage::getModel('catalog/product')->load($id);

            $urlKey = $_product->getProductUrl($id);

            if (isset($urlKey)) {

            Mage::app()->getResponse()->setRedirect($urlKey, 301);
            Mage::app()->getResponse()->sendResponse();
            exit;
        }
        return $this;
    }
} ?>

This (obviously) sends the server in a loop, as I'm trying to send it to the simple product's page and Magento is trying to send it back to 404.

I think I'm very close to a solution, because all that needs to be done now (I think) is a way to overwrite Magento's default behavior of sending it to 404.

Any ideas?

Update #2

It's starting to seem that what I want is impossible and I can't find anything on the internet that can help me out. I'm trying a different approach.

For my store I want to create the situation where children of Configurable Products that are set to 'Not Visible Individually' are accessable anyway, when the direct URL is provided. Currently it returns a 404-error.

The purpose of this is, so we can only load the direct URLs in Google Shopping using Product Feeds, but not display the products in either Search or Catalog on the site.

I have no idea where to start. Can anyone help me out?

Update:

Using Marius' code from [another question](http://magento.stackexchange.com/questions/104492/how-redirect-simple-products-of-configurable-product?rq=1) I created a module with the following code in /Namespace/Modulename/Model/Observer.php
<?php
     class Namespace_Modulename_Model_Observer {
        public function redirectToUrl($observer) {
            $id = Mage::app()->getRequest()->getParam('id');
            $_product = Mage::getModel('catalog/product')->load($id);

            $urlKey = $_product->getProductUrl($id);

            if (isset($urlKey)) {

            Mage::app()->getResponse()->setRedirect($urlKey, 301);
            Mage::app()->getResponse()->sendResponse();
            exit;
        }
        return $this;
    }
} ?>

This (obviously) sends the server in a loop, as I'm trying to send it to the simple product's page and Magento is trying to send it back to 404.

I think I'm very close to a solution, because all that needs to be done now (I think) is a way to overwrite Magento's default behavior of sending it to 404.

Any ideas?

Update #2

It's starting to seem that what I want is impossible and I can't find anything on the internet that can help me out. I'm trying a different approach.

For my store I want to create the situation where children of Configurable Products that are set to 'Not Visible Individually' are accessable anyway, when the direct URL is provided. Currently it returns a 404-error.

The purpose of this is, so we can only load the direct URLs in Google Shopping using Product Feeds, but not display the products in either Search or Catalog on the site.

I have no idea where to start. Can anyone help me out?

Update:

Using Marius' code from [another question](http://magento.stackexchange.com/questions/104492/how-redirect-simple-products-of-configurable-product?rq=1) I created a module with the following code in /Namespace/Modulename/Model/Observer.php
<?php
     class Namespace_Modulename_Model_Observer {
        public function redirectToUrl($observer) {
            $id = Mage::app()->getRequest()->getParam('id');
            $_product = Mage::getModel('catalog/product')->load($id);

            $urlKey = $_product->getProductUrl($id);

            if (isset($urlKey)) {

            Mage::app()->getResponse()->setRedirect($urlKey, 301);
            Mage::app()->getResponse()->sendResponse();
            exit;
        }
        return $this;
    }
} ?>

This (obviously) sends the server in a loop, as I'm trying to send it to the simple product's page and Magento is trying to send it back to 404.

I think I'm very close to a solution, because all that needs to be done now (I think) is a way to overwrite Magento's default behavior of sending it to 404.

Any ideas?

Update #2

It's starting to seem that what I want is impossible and I can't find anything on the internet that can help me out.

Considering this question a dead end.
Source Link

For my store I want to create the situation where children of Configurable Products that are set to 'Not Visible Individually' are accessable anyway, when the direct URL is provided. Currently it returns a 404-error.

The purpose of this is, so we can only load the direct URLs in Google Shopping using Product Feeds, but not display the products in either Search or Catalog on the site.

I have no idea where to start. Can anyone help me out?

Update:

Using Marius' code from [another question](http://magento.stackexchange.com/questions/104492/how-redirect-simple-products-of-configurable-product?rq=1) I created a module with the following code in /Namespace/Modulename/Model/Observer.php
<?php
     class Namespace_Modulename_Model_Observer {
        public function redirectToUrl($observer) {
            $id = Mage::app()->getRequest()->getParam('id');
            $_product = Mage::getModel('catalog/product')->load($id);

            $urlKey = $_product->getProductUrl($id);

            if (isset($urlKey)) {

            Mage::app()->getResponse()->setRedirect($urlKey, 301);
            Mage::app()->getResponse()->sendResponse();
            exit;
        }
        return $this;
    }
} ?>

This (obviously) sends the server in a loop, as I'm trying to send it to the simple product's page and Magento is trying to send it back to 404.

I think I'm very close to a solution, because all that needs to be done now (I think) is a way to overwrite Magento's default behavior of sending it to 404.

Any ideas?

Update #2

It's starting to seem that what I want is impossible and I can't find anything on the internet that can help me out. I'm trying a different approach.

For my store I want to create the situation where children of Configurable Products that are set to 'Not Visible Individually' are accessable anyway, when the direct URL is provided. Currently it returns a 404-error.

The purpose of this is, so we can only load the direct URLs in Google Shopping using Product Feeds, but not display the products in either Search or Catalog on the site.

I have no idea where to start. Can anyone help me out?

Update:

Using Marius' code from [another question](http://magento.stackexchange.com/questions/104492/how-redirect-simple-products-of-configurable-product?rq=1) I created a module with the following code in /Namespace/Modulename/Model/Observer.php
<?php
     class Namespace_Modulename_Model_Observer {
        public function redirectToUrl($observer) {
            $id = Mage::app()->getRequest()->getParam('id');
            $_product = Mage::getModel('catalog/product')->load($id);

            $urlKey = $_product->getProductUrl($id);

            if (isset($urlKey)) {

            Mage::app()->getResponse()->setRedirect($urlKey, 301);
            Mage::app()->getResponse()->sendResponse();
            exit;
        }
        return $this;
    }
} ?>

This (obviously) sends the server in a loop, as I'm trying to send it to the simple product's page and Magento is trying to send it back to 404.

I think I'm very close to a solution, because all that needs to be done now (I think) is a way to overwrite Magento's default behavior of sending it to 404.

Any ideas?

For my store I want to create the situation where children of Configurable Products that are set to 'Not Visible Individually' are accessable anyway, when the direct URL is provided. Currently it returns a 404-error.

The purpose of this is, so we can only load the direct URLs in Google Shopping using Product Feeds, but not display the products in either Search or Catalog on the site.

I have no idea where to start. Can anyone help me out?

Update:

Using Marius' code from [another question](http://magento.stackexchange.com/questions/104492/how-redirect-simple-products-of-configurable-product?rq=1) I created a module with the following code in /Namespace/Modulename/Model/Observer.php
<?php
     class Namespace_Modulename_Model_Observer {
        public function redirectToUrl($observer) {
            $id = Mage::app()->getRequest()->getParam('id');
            $_product = Mage::getModel('catalog/product')->load($id);

            $urlKey = $_product->getProductUrl($id);

            if (isset($urlKey)) {

            Mage::app()->getResponse()->setRedirect($urlKey, 301);
            Mage::app()->getResponse()->sendResponse();
            exit;
        }
        return $this;
    }
} ?>

This (obviously) sends the server in a loop, as I'm trying to send it to the simple product's page and Magento is trying to send it back to 404.

I think I'm very close to a solution, because all that needs to be done now (I think) is a way to overwrite Magento's default behavior of sending it to 404.

Any ideas?

Update #2

It's starting to seem that what I want is impossible and I can't find anything on the internet that can help me out. I'm trying a different approach.

Added an update of an attempt I made.
Source Link
Loading
deleted 23 characters in body
Source Link
Marius
  • 198.5k
  • 55
  • 424
  • 833
Loading
Source Link
Loading