1

so I have breadcrumbs in breadcrumbs.phtml and I don't know how to change their format for example I have this in $crumbs:

  [category1484] => Array
        (
            [label] => Laptop
            [link] => http://www.someweb.com/radioshack/catalog/category/view/s/laptop/id/1484/
            [title] => 
            [first] => 
            [last] => 
            [readonly] => 
        )

Instead I want to have the url keys for the breadcrumb so that I have like this:

http://www.someweb.com/radioshack/laptop

for example in products I could use to get urls like this:

 <a href="<?php  echo  Mage::helper('core/url')->getCurrentUrl()."/".$prod->geturl_key(); ?>"> 

But I do not have this option in bread crumbs should I customize breadcrumbs and start over or can I change the format?

We have url rewrites in just one store and we can show the products and categories by url_key but for breadcrumbs I have problem and if you ask why you have just for one store it is because we needed it to be faster so we kept it in just one store

1

Replace your breadcrumbs.phtml with this:

<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs">
<ul>
    <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
        <li class="<?php echo $_crumbName ?>">
        <?php if($_crumbInfo['link']): ?>
            <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></a>
        <?php elseif($_crumbInfo['last']): ?>
            <strong><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong>
        <?php else: ?>
            <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
        <?php endif; ?>
        <?php if(!$_crumbInfo['last']): ?>
            <span>/ </span>
        <?php endif; ?>
        </li>
    <?php endforeach; ?>
</ul>
</div>
<?php endif; ?>

Ensure that:

System > Configuration > General > Web > Search Engine Optimizations > Use Web Server Rewrites = 'Yes'

System > Configuration > Catalog > Catalog > Web > Search Engine Optimizations > Product URL Suffix is empty 

System > Configuration > Catalog > Catalog > Web > Search Engine Optimizations > Use Categories Path for Product URLs = 'Yes' 

Reindex Catalog URL Rewrites

Flush Cache

Reload Page

9
  • I checked all configuration options that you told me and all were the same and I changed it to your code and still I have the same unfriendly urls – Nickool Sep 10 '14 at 22:52
  • BACKUP DB and then truncate core_url_rewrite table, flush cache and reload – Joshua34 Sep 10 '14 at 23:01
  • ok let me see what will happen – Nickool Sep 10 '14 at 23:02
  • I do not have any in my table now and it doesn't show the page – Nickool Sep 10 '14 at 23:05
  • Sorry System > Index Management > Catalog UrL Rewrites > reindex data – Joshua34 Sep 10 '14 at 23:10
0

I fixed my problem by changing Rewrite.php it was in a core file so I copy pastes in local file and then changed as following:

path: /app/code/local/Mage/Core/Model/Url/Rewrite.php

I changed this getstoreid to the store that I have url rewrite for which is 1:

 $select->where('store_id IN(?)', array(Mage_Core_Model_App::ADMIN_STORE_ID, $object->getStoreId()));

to

$select->where('store_id IN(?)', array(Mage_Core_Model_App::ADMIN_STORE_ID, 1));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.