1

In the store, the store views / website's products are kept separated.

To avoid overlap of SKUs, we have to approaches:

  • Add a prefix during import (but we might need to remove that when displaying)
  • Define SKU to be only unique on website level.

Is this second approach generally possible?

1
  • 1
    I'm just curious ..why would you want 2 products with the same SKU? Or better yet, why do you want to have 2 separate product entities with if they are the same product? This increases the db size and could make the management more complicated. If the stock management is the problem then I think can resolve this using some extension that allows you to have the stock managed at website level.
    – Marius
    Commented Aug 27, 2013 at 10:33

2 Answers 2

4

Making this possible in Magento would require you to change the database structure,for example the sku field in the product flat table is a UNIQUE value, but also several files for the admin and any other code that filters products on sku.

If it's purely for a visual reason I would suggest using your first approach. It would require you to edit several template files but would definitely be of less risk to the stability of your installation.

From my experience, making these kinds of big changes to the Magento core inevitably leads to conflicts. Either in the Magento core or third party extensions.

1

Another possibility could be to use an additional attribute for the displayed SKU. Add a prefix/suffix to the original sku to keep the sku unique, and fill the new sku field with the short SKU. You just have to modify the template in order to display the value of the new attribute (or add a frontend after_load-observer to populate the content of the field "sku" with the value from the new attribute - this would have to be tested).

4
  • Nice solution, the only downside as far as I can see is that this custom attribute isn't available by default in the shoppingcart or the orders, invoices and shipments. This would require you to load the original product object every time you need it Commented Aug 27, 2013 at 10:51
  • You don't need to load the product object. You can either add the attribute to the loaded attributes via config.xml (not sure about that) or via observer, or you can quick load just the attribute value with $attributeValue = Mage::getModel('catalog/product')->getResource()->getAttributeRawValue($productId, $attributeCode, Mage::app()->getStoreId());. Commented Aug 27, 2013 at 11:05
  • Forgot about that last one. Thanks for the code snippet! Commented Aug 27, 2013 at 11:06
  • A comment: Having the "real SKU" in two places (as part of SKU and also in the custom_SKU field, would need us to keep both in sync - if the SKU changes - which it might never do)
    – Alex
    Commented Aug 27, 2013 at 13:00

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.