Jump to content

Problem with update product price in multistore


chlebo

Recommended Posts

Hi,

I have a problem with update product price in multistore. 

 

This is code for update:

<?php
 
include('../config/config.inc.php');
 
$filename = "update_price.txt";
 
if(file_exists($filename) && !is_dir($filename) && is_readable($filename)) {
 
if(!isset($_GET['confirm']) || $_GET['confirm']!="ok") {
?>
<script type="text/javascript">
function confirm_run_script() {
if(confirm("Tento skriptik chce zmeniť cenu zo suboru. Chcete pokračovať? Potvrdte.")) {
document.location.href = '<?php echo $_SERVER["PHP_SELF"] ?>?confirm=ok';
return true;
} else {
return false;
}
}
confirm_run_script();
</script>
 
<?php
}
 
if(isset($_GET['confirm']) && $_GET['confirm']=="ok") {
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
$rows = explode("\n",$contents);
 
foreach($rows as $row){
if(count(explode(" ",$row)) == 2){
list($id, $price) = explode(" ",$row);
$productUpdate = new Product($id);
 
echo "Price: $id == $price<br />";
 
if(is_object($productUpdate)){
$productUpdate->price = (float)str_replace(",", ".", $price);
$productUpdate->update();
}
}
}
fclose($handle);
}
 
} else {
if(!file_exists($filename)) {
die("File is not exist.");
}
 
if(!is_readable($filename)) {
die("File is not readable.");
}
}
 
 
 
?>

 

 

 

This code update price only one store

 

 

You do not know where is the problem?

Edited by chlebo (see edit history)
Link to comment
Share on other sites

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...