0

I have 2 stores in the same installation (multistore)

I have 1 root category and 3 subcategories.

In store1 I have active subcategory1 and subcategory2.

In store2 I have active subcategory1 and subcategory3.

It's everything ok, except that in store1's url rewrites I'm seeing url's from subcategory3 (not active at this store) and the same happens with the sitemap.

Anyone knows how to fix it?

0

Try to edit the following file app/design/frontend/your_package/your_theme/template/catalog/seo/tree.phtml file in your theme.

Add an if condition just after the foreach loop which checks for activeness of the $_item.

<?php $_items = $this->getCollection(); ?>
<?php if($_items->getSize()): ?>
    <ul class="sitemap">
        <?php foreach ($_items as $_item): ?>
          <?php if( $_item->is_active ) : ?> 
            <li class="level-<?php echo $this->getLevel($_item) ?>" <?php echo $this->getLevel($_item)?'style="padding-left:' . $this->getLevel($_item, 2) . '0px;"':'' ?>><a href="<?php echo $this->getItemUrl($_item) ?>"><?php echo $_item->name ?></a></li>
        <?php endif; ?> 
        <?php endforeach; ?>
    </ul>
<?php else: ?>
    <p class="note-msg">
        <?php echo $this->__('There are no %s available.', $this->getItemsTitle()); ?>
    </p>
<?php endif ?>

For the issue with the active/inactive categories you could try this

Copy /app/code/core/Mage/Catalog/Model/Url.php to your local folder and edit the function _refreshCategoryRewrites

$specificCatID = $category->getId();
$category = Mage::getModel('catalog/category')->load($specificCatID);

if ($category->getIsActive()) {
.. the actual code of the function
    }

Not sure if that works and I haven´t tested it but might be worth a try

  • it fix the sitemap trouble but not the url rewrite, thanks! – David G Jan 19 '16 at 11:09
  • I will look into it more. I thought if its only one category simply deleting it would be enough – Klettseb Jan 19 '16 at 11:19
  • yeah but I want to open more stores and i need to fix it before open anymore. – David G Jan 19 '16 at 11:45
  • Updated it and you could give it a try – Klettseb Jan 19 '16 at 15:08
  • Did you give it a try? – Klettseb Jan 20 '16 at 11:30

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.