1

How can I change the order in which Magento lists the Values and Labels of configurable products and the custom options of their associate products.

Example:

Configurable T-shirt has Size and Color attributes, and the simple products ha custom options for Logo placement. When users order a large, red t-shirt with the logo on the front, Magento lists the options in the cart as:

T-Shirt size-large (attribute) color-red (attribute) logo-front (custom option)

I just want the logo-front above size-large, but can't figure out where the list order is created.

(Note: this is a simplistic example. There is a good reason why the "logo position" can't be just another attribute to the config product).

Thanks.

2 Answers 2

2

I'm not 100% sure on this, I've ever actually used custom options, but tracing back from the template, I think you'd need to rewrite Mage_Catalog_Helper_Product_Configuration::getCustomOptions. I'm assuming the custom option comes from the additional_options field so at the bottom of that function you can just re-arrange the order:

$addOptions = $item->getOptionByCode('additional_options');
if ($addOptions) {
    // switch around the order of the items in the array like so
    $options = array_merge(unserialize($addOptions->getValue()), $options);
}
2
  • Thanks Cags, but this didn't work. Maybe I'm not rewriting the helper properly, or maybe it only controls the array_merge for attributes of and custom options assigned to the configurable products, while my custom options are assigned to the associated simple product. Also, I am using the Simple Configurable Products extension. It doesn't seem to rewrite Mage_Catalog_Helper_Product_Configuration, and it uses the same call of Mage::helper('core')->decorateArray($this->getOptions()). But it may alter where the array is generated?
    – Dustin
    Commented Dec 15, 2013 at 23:46
  • Funnily enough, we also use SCP. Did you put a die in your getCustomOptions to see if it actually get's there? If not put one in core and see if it get's there (maybe something else rewrites it). Then you can work out if the code doesn't work, or if the rewrite doesn't work by editing core temporarily. It is of course possible I'm wrong and the additional_options isn't where your information is stored, you could maybe check the sales_flat_quote(_item)? tables. Commented Dec 16, 2013 at 7:39
1

Since you are using SCP, this should be easy. To reorder the attributes, you can click and drag them to the order you want on the product info page in admin. If there are many options per attribute, I find the javascript works better if you do this before you add all of those products. (See image below)

To reorder the options within each attribute, go to Catalog > Attributes > Manage Attributes > Manage Label/Options. You then need to enter the Position value for each item in the list.

Reorder Attributes

2
  • Thanks iJeep. But, this question is regarding the combination of configurable product attributes and its associated simple product's custom options. Currently the custom options are above the attributes. I'd like to switch their order so the simple product's custom options are listed first and then the configurable product's attributes would be listed.
    – Dustin
    Commented Jan 16, 2014 at 3:15
  • I see. Sorry, I misunderstood.
    – iJeep
    Commented Jan 17, 2014 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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