BigCommerce - Hosted Ecommerce Software by Interspire

Interspire Forum

 
Go Back   Interspire Forum > Interspire Shopping Cart Community Forum > E-Commerce and Selling Online

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-26-2013, 11:33 PM
daniloras
Guest
 
Posts: n/a
Default SEO Category - Not URL

Hello today I have a site that the categories I can not transform the name to URL friendly.

For an application made ​​on a corporate website to get the categories generated on site, but the URL link does not work, any help to solve this problem.

Link Generate ECommerce - OK:

http://www.loja.com.br/loja/categori...3%A3o-da-pele/

Link Generate Site Corporate - Not Ok
http://www.loja.com.br/loja/categori...E7%E3o-da-pele

Function PHP

HTML Code:
<?php
echo "LINK OK - CATEGORY - ECOMMERCE";
echo "http://www.loja.com.br/loja/categories/Anti%252dSepsia-e-Desinfeccao/anti%252ds%C3%A9ptico-para-degerma%C3%A7%C3%A3o-da-pele/";

echo "LINK NOT OK - WEBSITE CORPORATE";
echo "http://www.loja.com.br/loja/categories/Anti%252dSepsia-e-Desinfeccao/anti%252ds%E9ptico-para-degerma%E7%E3o-da-pele";

function MakeURLSafe($val) {
    $val = str_replace("-", "%2d", $val);
    $val = str_replace("+", "%2b", $val);
    $val = str_replace("+", "%2b", $val);
    $val = str_replace("/", "{47}", $val);
    $val = urlencode($val);
    $val = str_replace("+", "-", $val);
    return $val;
}

$listar_categoria = listar_tabela("shop_categories WHERE catparentid = 0 ORDER BY catname ASC ");
$d = new ArrayIterator($listar_categoria);

echo "<ul>";

while ($d->valid()):
    $listagem = $d->current();

    $categoria = MakeURLSafe($listagem['catname']);

    $categoria_URL = "http://www.loja.com.br/loja/categories/" . $categoria;

    echo "<li>";
    echo "<a href='";
    echo $categoria_URL;
    echo "'>";
    echo $listagem['catname'];
    echo "</a>";

    $contagem = contagemRegistrosParametro("shop_categories", "catparentid", $listagem['categoryid']);

    if ($contagem >= 1) {

        $listar_subcategoria = listar_tabela("shop_categories WHERE catparentid = $listagem[categoryid] ORDER BY catname ASC ");

        echo "<ul>";

        foreach ($listar_subcategoria as $sub) {

            $categoria_URL_1 = MakeURLSafe($listagem['catname']);
            $subcategoria_URL_2 = MakeURLSafe($sub['catname']);

            $subcategoria_URL_oficial = "http://www.loja.com.br/loja/categories/" . $categoria_URL_1 . "/" . $subcategoria_URL_2;


            echo "<li>";
            echo "<a href='";
            echo $subcategoria_URL_oficial;
            echo "'>";
            echo $sub['catname'];
            echo "</a>";
            echo "</li>";
        }
        echo "</ul>";
    }

    echo "</li>";

    $d->next();
endwhile;

echo "</ul>";
?>

Last edited by daniloras; 08-27-2013 at 10:00 AM..
Reply With Quote
 

Tags
category, seo

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump