ambimax/magento-module-ambimax-productnotfoundhandler 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ambimax/magento-module-ambimax-productnotfoundhandler

Composer 安装命令:

composer require ambimax/magento-module-ambimax-productnotfoundhandler

包简介

Handles product redirect if sku is found in url

README 文档

README

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.

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.

Usage

Url must use this pattern

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

Sku must not contain any characters except for #[^0-9a-z]+#i

Composer

composer require ambimax/magento-module-ambimax-productnotfoundhandler

Installation

  1. Install like any other (modman/composer) module

  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)

  3. Add sku and skuLength to all url-key attribute of all products

Example import usage:


    /**
     * 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.

License

MIT License

Author Information

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固