2017 © Pedro Peláez
 

magento-module magento-module-ambimax-productnotfoundhandler

Handles product redirect if sku is found in url

image

ambimax/magento-module-ambimax-productnotfoundhandler

Handles product redirect if sku is found in url

  • Tuesday, October 10, 2017
  • by tschifftner
  • Repository
  • 2 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

ambimax® ProductNotFoundHandler

When importing products the url-key is extended by a continuing number that makes it unique. Additionally a permanent redirect is created from the old url to the new one. Therefore the core_url_rewrite table grows rapidly and slows many Magento sites down., (*1)

To solve this problem we add the sku to the urls and make old urls forever (as long as the product with same sku exists) redirectable without overhead. This module reads the sku from url and redirects to the new url., (*2)

Usage

Url must use this pattern, (*3)

http://domain.tld/any-string-{sku}-{skuLength}/

Sku must not contain any characters except for #[^0-9a-z]+#i, (*4)

Composer

composer require ambimax/magento-module-ambimax-productnotfoundhandler

Installation

1) Install like any other (modman/composer) module, (*5)

2) To enable it please set Configuration > Web > Default Pages > CMS No Route Page (web/default/no_route) to productnotfoundhandler/index/noRoute (default: cms/index/noRoute), (*6)

3) Add sku and skuLength to all url-key attribute of all products, (*7)

Example import usage:, (*8)


/** * Prepare product data on import * * @param array $productData * @return array */ public function row(array $productData) { // ... $url = array($productData['amazon_titel'], $productData['sku'], strlen($productData['sku'])); $product['url_key'] = $this->formatUrlKey(implode(' ', $url)); // ... return $productData; } /** * Format Key for URL * * @param string $str * @return string */ public function formatUrlKey($str) { $urlKey = preg_replace('#[^0-9a-z]+#i', '-', strtolower(Mage::helper('catalog/product_url')->format($str))); $urlKey = trim($urlKey, '-'); return $urlKey; }

Disclaimer

This module comes with no warranty at all., (*9)

License

MIT License, (*10)

Author Information

The Versions

10/10 2017

dev-master

9999999-dev

Handles product redirect if sku is found in url

  Sources   Download

MIT

The Requires

 

by Tobias Schifftner

10/10 2017

1.0.1

1.0.1.0

Handles product redirect if sku is found in url

  Sources   Download

MIT

The Requires

 

by Tobias Schifftner

10/10 2017

1.0.0

1.0.0.0

Handles product redirect if sku is found in url

  Sources   Download

MIT

The Requires

 

by Tobias Schifftner