Jump to content

External Database Link and update


jpdean

Recommended Posts

Hi All,

I've been looking in the forum and I can seem to find anything.
One of my suppliers has provided a line that could be really interesting for me.
"Make a direct connection between your shop and our productdatabase"
And gives the PHP code to do this. Funny thing is I have no idea how to do this! Arg!

Here is the code and what should I do with this to link my Presta database with their file.

----------------

// Example source code; import of productlist
//

$login = "XXXX"; // Fill in your username / customerid
$password = "XXXX"; // Fill in your password

$filename = "http://blablabla.com/pricelist.php?action=pricelist&productid=on&name_english=on&description_english=on&price=on&salesprice=on&stock=on&plaintext=on&admin;_username=".$login."&admin;_password=".$password;

// Get the pricelist into an array.
$lines = file($filename);
// Loop through our array
foreach ($lines as $line_num => $line) {
echo "Line #{$line_num} : " . htmlspecialchars($line) . "

 

\n";

$column = explode ( '"~"', $line ); // use the "~" as explode char
echo $column[0] . " productid

";
echo $column[1] . " name

";
echo $column[2] . " info

";
echo $column[3] . " price

";
// etc

// Insert / update the product in your database
//Example sqlcode $sql = "INSERT INTO `product` ( `productid` , `name` , `info`) VALUES ('".$column[0]."', '".$column[1]."', '".$column[2]."')";
}

------------------

Oh great [spam-filter]'s of Prestashop, can anyone help me on this one? or direct me to a page if this has been resolved already.

Many thanks,
Beast regards,
JP.

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...