Not for official support
We do not provide technical support in this forum.
If you want to contact our customer support, please use our support form.
You are not logged in.
hi
i have 600 product in store.
when i add this product i dont need to SKU(product code)...and all 600 products havnt SKU!
now i want add sku...but its very difficult to open all 600 product and edit it!
in product list, price and in stock is editable...how we can change sku field and convert it to editable field?
tnx alot dear Rat...
Offline
1. In file published/SC/html/scripts/templates/backend/categories_products.html change
<td><a href="{$product_url}">{$GridRows[i].product_code|escape:'html'} </a></td>to
<td><input type="text" name="product_code_{$GridRows[i].productID}" size="10" value="{$GridRows[i].product_code|escape:'html'}" /></td>2. In file published/SC/html/scripts/modules/test/_methods/b_categories_products.php change
$data = scanArrayKeysForID($_POST, array( "price", "left", "sort_order" ) );
foreach( $data as $key => $val ){
$sqlValues = array();
if ( isset($val["price"]) ){
$temp = $val["price"];
$temp = round($temp*100)/100;
$sqlValues[] = "Price='{$temp}'";
//db_query( "UPDATE ".PRODUCTS_TABLE." SET Price='$temp' "." WHERE productID=".$key );
}
if ( isset($val["left"]) ){
$sqlValues[] = 'in_stock = \''.intval($val["left"]).'\'';
//db_query( "UPDATE ".PRODUCTS_TABLE." SET in_stock = '".$val["left"]."' WHERE productID=".$key);
}
if ( isset($val["sort_order"]) ){
$sqlValues[] = 'sort_order = '.$val["sort_order"];
//db_query( "UPDATE ".PRODUCTS_TABLE." SET sort_order = '".$val["sort_order"]."' WHERE productID=".$key);
}
/*if(isset($_POST['categoryID'])){
$sqlValues[] = 'categoryID =\''.intval($_POST['categoryID']).'\'';
}*/
if(count($sqlValues)){
$sql = 'UPDATE `'.PRODUCTS_TABLE.'` SET '.implode(', ',$sqlValues).' WHERE productID='.$key;
db_query($sql);
}
}to
$data = scanArrayKeysForID($_POST, array( "price", "left", "sort_order", "product_code" ) );
foreach( $data as $key => $val ){
$sqlValues = array();
if ( isset($val["price"]) ){
$temp = $val["price"];
$temp = round($temp*100)/100;
$sqlValues[] = "Price='{$temp}'";
//db_query( "UPDATE ".PRODUCTS_TABLE." SET Price='$temp' "." WHERE productID=".$key );
}
if ( isset($val["left"]) ){
$sqlValues[] = 'in_stock = \''.intval($val["left"]).'\'';
//db_query( "UPDATE ".PRODUCTS_TABLE." SET in_stock = '".$val["left"]."' WHERE productID=".$key);
}
if ( isset($val["sort_order"]) ){
$sqlValues[] = 'sort_order = '.$val["sort_order"];
//db_query( "UPDATE ".PRODUCTS_TABLE." SET sort_order = '".$val["sort_order"]."' WHERE productID=".$key);
}
if ( isset($val["product_code"]) ){
$sqlValues[] = 'product_code = "'.$val["product_code"].'"';
}
/*if(isset($_POST['categoryID'])){
$sqlValues[] = 'categoryID =\''.intval($_POST['categoryID']).'\'';
}*/
if(count($sqlValues)){
$sql = 'UPDATE `'.PRODUCTS_TABLE.'` SET '.implode(', ',$sqlValues).' WHERE productID='.$key;
db_query($sql);
}
}Offline
now i add ProductID...but sorting with ProductID dont work!!!
i think...all product sort with name.
how we can do this?
Offline
How do you add productID?
Offline
$data = scanArrayKeysForID($_POST, array( "price", "left", "sort_order", "product_code", "productID" ) );
foreach( $data as $key => $val ){
$sqlValues = array();
if ( isset($val["price"]) ){
$temp = $val["price"];
$temp = round($temp*100)/100;
$sqlValues[] = "Price='{$temp}'";
//db_query( "UPDATE ".PRODUCTS_TABLE." SET Price='$temp' "." WHERE productID=".$key );
}
if ( isset($val["left"]) ){
$sqlValues[] = 'in_stock = \''.intval($val["left"]).'\'';
//db_query( "UPDATE ".PRODUCTS_TABLE." SET in_stock = '".$val["left"]."' WHERE productID=".$key);
}
if ( isset($val["sort_order"]) ){
$sqlValues[] = 'sort_order = '.$val["sort_order"];
//db_query( "UPDATE ".PRODUCTS_TABLE." SET sort_order = '".$val["sort_order"]."' WHERE productID=".$key);
}
if ( isset($val["productID"]) ){
$sqlValues[] = 'productID = "'.$val["productID"].'"';
}
if ( isset($val["product_code"]) ){
$sqlValues[] = 'product_code = "'.$val["product_code"].'"';
}
/*if(isset($_POST['categoryID'])){
$sqlValues[] = 'categoryID =\''.intval($_POST['categoryID']).'\'';
}*/
if(count($sqlValues)){
$sql = 'UPDATE `'.PRODUCTS_TABLE.'` SET '.implode(', ',$sqlValues).' WHERE productID='.$key;
db_query($sql);
}
}and add this to template files:
<td><a href="{$product_url}">{$GridRows[i].productID|escape:'html'} </a></td>Last edited by cyrus (2012-05-07 12:52)
Offline
It is not productID but product code (or SKU). What exactly are you doing at what happens?
Offline
i want sort product by ProductID(or sort by Add Date) and after add Sku(productID+145=Product Code)
i need to add product code for all product...if product sort by ID or add date i can edit easely add SKU.
Offline
Your question is not clear to me, I'm afraid. Will you try to re-phrase it?
Offline
In file published/SC/html/scripts/modules/test/_methods/b_categories_products.php change
$callBackParam['sort'] = 'name';
to
$callBackParam['sort'] = 'productID';
In file published/SC/html/scripts/core_functions/product_functions.php change
if(isset($callBackParam['sort'])&&in_array($callBackParam['sort'],array('name','brief_description','in_stock','Price','customer_votes','customers_rating','list_price','sort_order','items_sold','product_code','shipping_freight'))){to
if(isset($callBackParam['sort'])&&in_array($callBackParam['sort'],array('name','brief_description','in_stock','Price','customer_votes','customers_rating','list_price','sort_order','items_sold','product_code','shipping_freight', 'productID'))){Offline