Post by hohosiu » Thu Mar 26, 2015 10:53 am

Hi,

Does anyone has any suggestions on a good extension to make product options unique SKU/UPC?

E.g. we have products with different colour and each need to have a unique code.

Thanks.

Newbie

Posts

Joined
Mon Nov 24, 2014 11:26 pm

Post by notrick » Sun Apr 19, 2015 5:23 pm

I can help u with it for free.
Go To admin/controller/catalog/product.php

After
private $error = array();

Add
public function getNewSKUNumber() {
$newmodelnumber = date("ymdHis");
$sql = 'SELECT (MAX(product_id)+1) product_id FROM '.DB_PREFIX.'product';
$query = $this->db->query($sql);
if ($query->num_rows) {
foreach ($query->rows as $result) {
$newmodelnumber = $result['product_id'];
}
}
return "UNIQUE" . $newmodelnumber;
}


Note
Here If you know PHP, you can either use a function to get a hash of date time and return it using this function.
You can also configure the above function and replace UNIQUE to whatever you want.


NEXT
Search for
$data['sku'] = '';
Replace it with
$data['sku'] = $this->getNewModelNumber();


Hope u get the idea what I am trying to do here.

Newbie

Posts

Joined
Sun Apr 19, 2015 4:58 pm
Who is online

Users browsing this forum: No registered users and 2 guests