2

Example:

A product has a custom attribute called "wheel_size_1mm" where I choose from a drop down the size of the wheel.

Is there an html code or similar I can use in "Description" / "Short Description" fields that will display that attribute?

In the WYSIWYG editor I've seen the following option "Insert/edit attributes" but I can't find any documentation for this and assume it's not actually related to pulling any information from custom attributes. I've played with it but no luck.

But:

I know you're going to say, why do you need that info when it's already displayed in the "Additional Info" section.

Well, I have an extension for bundled products that pulls images and the short description for bundled simple products, to show customers better what they're choosing instead of just a dropdown list. Here's an example you can check out: https://www.newtons-shred.co.uk/courtney-conlogue-carver-pro-model-surfskate.html

The extension is BunbledMojo IIRC.

So I really want to remove the hassle of manually updating product "Description" / "Short Description" fields, and work the product attributes instead.

Effectively turning catalogue updating into a data entry task.

So:

Can magento handle this with some built in feature I'm missing? Or do I need to look into export/import automated alternatives? Do I need to upgrade from 1.7 to a version with this feature?

My IT partner tells me the Magento database is a clusterfudge and a pain to work with, otherwise this kind of thing would be easy to do.

0

No, that's not possible with any built in feature, also not in later versions. You might have luck with this "insert/edit attributes" button in the WYSIWYG editor but this is not a core feature, and I have no idea from which extension it comes and what it does.

But if you are comfortable with Magento module development, you can add this feature with very little code:

Write an observer for catalog_controller_product_view like this:

public function replaceAttributePlaceholders(Varien_Event_Observer $observer)
{
    $product = $observer->getProduct();
    $attributeCodes = ['description', 'short_description'];
    foreach ($attributeCodes as $_code) {
        $product->setData(
            $_code,
            $this->_replacePlaceholders(
                $originalAttributeValue,
                $product->getData($_code)
            );
        }
    }
}
protected function _replacePlaceholders($value, $product)
{
    return preg_replace_callback(
        '/\{\{(\w+)\}\}/',         // matches "{{XXX}}"
        function($matches) use ($product) {
            return $product->getData($matches[1]);
        },
        $value
    );
}

Then you can use {{wheel_size_1mm}} within description and short description, it will be replaced by the attribute value before the product page gets rendered.

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.