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.
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.
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.
Who is online
Users browsing this forum: No registered users and 0 guests