Updating DB prices between 2 DB...
Posted: Thu Oct 13, 2011 4:36 pm
Hey guys i have an Xcart set up and i have a program that uploads my Access(POS file) file to Mysql.
Now My access files has all my prices and inventory up to date.So it keeps the web site up to date..
now my issue is if the product is not in my Db(Access file)it put the prices to 0.00$...
So my question is how can i update the prices without affecting the products not in my file??
this is my script
Now My access files has all my prices and inventory up to date.So it keeps the web site up to date..
now my issue is if the product is not in my Db(Access file)it put the prices to 0.00$...
So my question is how can i update the prices without affecting the products not in my file??
this is my script
Code: Select all
///1 Product codes to match
$sql2 = "UPDATE TbItemInventory p
LEFT JOIN xcart_products pp
ON p.Name = pp.productcode
SET p.XcartID = pp.productid
WHERE p.Name = pp.productcode";
$retval = mysql_query( $sql2 );
if(! $retval )
{
die('Could not update data: ' . mysql_error());
}
///2 QTY
$sql3 = "UPDATE xcart_products p
LEFT JOIN TbItemInventory pp
ON p.productid = pp.XcartID
SET p.avail = pp.QuantityOnHand
WHERE p.productid = pp.XcartID";
$retval1 = mysql_query( $sql3 );
if(! $retval1 )
{
die('Could not update data: ' . mysql_error());
}
///5 Pricing per membership
$sql4 = "UPDATE xcart_pricing p
LEFT JOIN TbItemInventory pp
ON p.productid = pp.XcartID
SET p.price = pp.SalesPrice
WHERE p.membershipid = 1 ";
$retval4 = mysql_query( $sql4 );
if(! $retval4 )
{
die('Could not update data: ' . mysql_error());
}
////6
$sql5 = "UPDATE xcart_pricing p
LEFT JOIN TbItemInventory pp
ON p.productid = pp.XcartID
SET p.price = pp.SalesPrice2
WHERE p.membershipid = 5 ";
$retval5 = mysql_query( $sql5 );
if(! $retval5 )
{
die('Could not update data: ' . mysql_error());
}
echo "All prices Updated successfully";
echo "<meta http-equiv=Refresh content=2;url=index.php>";