1

Having a bit of a strange issue here, with a very unique scenario.

Currently my main categories have no products, but they have a child category with products, and a grandchild category with products, that all show up on the main category page.

list.phtml

$category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
$childCategories = $category->getChildren();

foreach(explode(',',$childCategories) as $childId):

$childCategory = Mage::getModel('catalog/category')->load($childId);

This has allowed me to pull the product collection from the children categories just fine, as well as the child category name, description, etc. I have the full grid of products rendering just fine except for the configurable swatches.

Here is the bit of php for the configurable swatches which is misbehaving:

if ($this->getChild('name.after')) {
    $_nameAfterChildren = $this->getChild('name.after')->getChildren();
        foreach ($_nameAfterChildren as $_nameAfterChildName) {
            $_nameAfterChild = $this->getChild('name.after')->getChild($_nameAfterChildName);
            $_nameAfterChild->setProduct($_gcProduct);
            echo $_nameAfterChild->toHtml();
        }
}

It doesn't render anything. However if I put an 'echo "Hello!";' after the if statement, that shows up.. so it thinks it's true. I've tried changing $this to $childCategories (which can be used to access the full category) but still nothing shows up for the swatches.

Any suggestions/ideas?

Your Answer

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

Browse other questions tagged or ask your own question.