PHP code example of ambimax / magento-module-ambimax-productnotfoundhandler

1. Go to this page and download the library: Download ambimax/magento-module-ambimax-productnotfoundhandler library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ambimax / magento-module-ambimax-productnotfoundhandler example snippets



    /**
     * 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;
    }