Reputation: 11
I am working in Magento and I am using an extension called wp_simple_products_generator. Now I want to change the syntax of SKU of my products to "sku-colorcode". Supposing if SKU is DM45 and my black color code is '1' then I would like my SKU format to show like this 'DM45-1'. How can I change the color code in this format ... Thanks
Here is the Automatic Code by Wp_Simple_Products_Generator:
private function _getSimpleProductPrefixes($combination)
{
$skuPrefixParts = $namePrefixParts = array();
$configurableAttributes = $this->_configurableAttributes;
foreach ($combination as $attrCode => $value) {
// --- generate Name of the Simple Product ---
$prefix = $configurableAttributes[$attrCode]['label'] . ' ' . $configurableAttributes[$attrCode]['values'][$value];
$namePrefixParts[] = $prefix;
// $skuPrefixParts[] = str_replace(' ', '-', $prefix);
$prefix_sku = substr($configurableAttributes[$attrCode]['values'][$value],0,10);
$skuPrefixParts[] = str_replace(' ', '-', $prefix_sku );
}
$skuPrefix = '-' . implode('-', $skuPrefixParts);
$namePrefix = ' - ' . implode(' - ', $namePrefixParts);
return array($skuPrefix, $namePrefix);
}
Upvotes: 1
Views: 239