Post by Dhaupin » Wed Sep 10, 2014 2:16 am

Awesome! Does this still work in 1.5.6.x? I don't really wanna try it if there are known issues :)

Thanks a bunch

https://creadev.org | support@creadev.org - Opencart Extensions, Integrations, & Development. Made in the USA.


User avatar
Active Member

Posts

Joined
Tue May 13, 2014 3:45 am
Location - PA

Post by Dhaupin » Tue Sep 16, 2014 12:32 am

This isnt a blackhat tool, its meant to generate SEO urls for your products that are missing them so you dont have to go through 1 by 1 and do them manually.

It seems to work on 1.5.6 but there are some errors, and also it will re-write links it thinks is improper (like with & -> and) possibly resulting in massive amounts of redirects you would have to make :) use with caution for sure and be ready to 301 so no 404 brokens

https://creadev.org | support@creadev.org - Opencart Extensions, Integrations, & Development. Made in the USA.


User avatar
Active Member

Posts

Joined
Tue May 13, 2014 3:45 am
Location - PA

Post by Dhaupin » Thu Sep 18, 2014 4:52 am

Ok tried it out. After a bit of tweaking it worked great. If anyone wants a backwoods edit for this, here is what we used:

1) commented out the "& to And" maker as to not break existing urls
2) commented out the existing url re-write (it will only make urls for products that dont have them, wont update existing)
3) added isset to the $url[0] to silence errors
4) added a dash (-) to regex - if a dash is in title it makes triple dash like various SEO js mods. This will reduce 404 if you use triple dash JS writers

Since this is a very specific use case, pm me or email dhaupin[at]creadev.org if you want this modded version.

If you just wanna fix the undefined index error, change $url[0] to isset($url[0]) and it still seems to work. Of course, always backup before you run this.

https://creadev.org | support@creadev.org - Opencart Extensions, Integrations, & Development. Made in the USA.


User avatar
Active Member

Posts

Joined
Tue May 13, 2014 3:45 am
Location - PA

Post by haydent » Tue Dec 18, 2018 5:37 am

excellent guys ! this is why i love opencart. so i just added this little line to the start of seoURL function to replace & symbols with 'and'

Code: Select all

$str = str_replace('&','and',$str);

User avatar
New member

Posts

Joined
Wed Nov 09, 2011 9:50 am
Location - Sydney, Australia

Post by haydent » Tue Dec 18, 2018 6:05 am

I modded this code to do the manufacturers: (also i noted if you wanted it to run faster reduce or remove the sleep commands, they are really not needed.

Code: Select all

 elseif(isset($_GET['manufacturer'])) {
        $manufacturerp    = $db->query("SELECT * FROM " . DB_PREFIX . "manufacturer");
        $manufacturerp    = $manufacturerp->rows;

        foreach($manufacturerp as $manufacturer) {

            $url = $db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE query = 'manufacturer_id=" . (int)$manufacturer['manufacturer_id'] . "'");
            $url = $url->rows;

            if(!empty($url)) {
                echo 'Match found for ' . $manufacturer['manufacturer_id'] . '. No action taken.<br>---------------<br>';
            } else {
                echo 'URL needed for ' . $manufacturer['manufacturer_id'] . '...<br>';

                    echo 'Name: ' . $manufacturer['name'] . ' | Converting to: ' . seoURL($manufacturer['name']);
                    $manufacturer['name'] = seoURL($manufacturer['name']);
                    sleep(1);
                    $db->query("INSERT INTO " . DB_PREFIX . "url_alias SET query = 'manufacturer_id=" . (int)$manufacturer['manufacturer_id'] . "', keyword = '" . $db->escape($manufacturer['name']) . "'");
                    echo '<br>Inserted!<br>---------------<br>';

            }
        }
        echo '<br><br>All done! <a href="seo-links.php">Back</a>';

    }

Code: Select all

 echo '<p><a href="?manufacturer">Manufacturer</a> - Create information-URLs</p>';

User avatar
New member

Posts

Joined
Wed Nov 09, 2011 9:50 am
Location - Sydney, Australia
Who is online

Users browsing this forum: No registered users and 14 guests