Add php files
This commit is contained in:
28
modules/EcmPrices/copyFromPricebook.php
Executable file
28
modules/EcmPrices/copyFromPricebook.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
$from = "e2c0a18d-7c8d-cb0e-46ff-5305e3df9d9c";
|
||||
$to = "a5089802-f543-237f-c7fa-53316fafe922";
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
|
||||
$db->query("DELETE FROM ecmprices_ecmproducts WHERE ecmprice_id='$to'");
|
||||
|
||||
$res = $db->query("SELECT * FROM ecmpricebooks_ecmproducts WHERE ecmpricebook_id='$from' AND deleted='0'");
|
||||
|
||||
while ($row = $db->fetchByAssoc($res)) {
|
||||
|
||||
$id = create_guid();
|
||||
$new[] = $id;
|
||||
|
||||
$tmp = array();
|
||||
$tmp[] = $id;
|
||||
$tmp[] = $to;
|
||||
$tmp[] = $row['ecmproduct_id'];
|
||||
$tmp[] = round(floatval($row['price'])/4,2);
|
||||
|
||||
$query = "INSERT INTO ecmprices_ecmproducts (".implode(",", $fields).") VALUES ('".implode("','", $tmp)."')";
|
||||
$db->query($query);
|
||||
}
|
||||
|
||||
echo 'OK';
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user