2

Good morning guys,

Something odd I've noticed. When I'm purchasing a configurable product, within the order 3 dashes get added to the SKU.

For example:

A configurable product has the SKU of pickmewine, and the simple product has an SKU of PD101. In the order, the SKU of the actual item ordered becomes PD101---.

Is this normal? If so - how do I reliably remove the dashes? I'm linking into an internal business system and using a str_replace isn't an option as there may be legitimate dashes in an SKU.

Related to this, in the order, I get 2 items for each config products bought. Is using $order->getAllVisibleItems() the best way around that?

Thanks all

3
  • Do you have any extensions that are updating the config products? – kab8609 Aug 30 '13 at 18:46
  • I don't. After some more research it seems to be something thats added by Mage when a product has custom options. In which case, I'm not sure its possible, or sensible, to remove these dashes. I have thankfully used a workaround for my specific issue by loading the product by ID and then grabbing the SKU from that. – thebluefox Sep 6 '13 at 12:25
  • 1
    When a product has custom options that have their own SKU they are added with dashes. It seems like Magento is adding the SKU's even tho there aren't any. Might be a direction to start debugging – Sander Mangel Sep 8 '13 at 7:40
5

Check for spaces in the SKU field of your custom options:

enter image description here

See Mage_Catalog_Model_Product_Type_Abstract::getOptionSku() for the reason why.

2
  • Hi Ben - that was exactly the issue. Spaces in the custom options (carried through from product import) were causing the issue. We were able to do some coding to detect these and remove them to give us the proper SKU. Thanks for your reply! – thebluefox Oct 10 '13 at 11:52
  • Hi Ben, you are my hero! I had struggling around this for a while before finding your post. – Phoenix128_RiccardoT May 6 '16 at 10:07
1

We also have this issue. But I noticed that it happens when multiple custom options are chosen at a specific product. The SKU fields are all empty so no spaces are filled in and no dashes should be added. But if the customer uses the checkboxes to add 2 options from one custom option then 2 dashes are added. When customer selects 3 values from one custom option then 3 dashes are added.

We fixed it by not using checkboxes but for some custom options it would be nice to add several values (repair service for instance).

I found somewhere that changing in

app/code/core/Mage/Catalog/Model/Product/Type/<yourtype>.php

the function

public function getOptionSku($optionValue, $skuDelimiter)
{
   return '';
}

But I think changing this will have effect on different locations...

Kind regards,

Sander

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.