Open prestamodule opened 4 years ago
Hi @prestamodule,
Thanks for your report. I manage to reproduce the issue with PS1.7.6.3 & PS1.7.5.2. https://drive.google.com/file/d/1oGN0-ycdvMiu5wCUmR7YjzJtLd61KYjr/view I used this script
<?php
require dirname(__FILE__).'/config/config.inc.php';
$product = new Product();
$product->id = 1;
$product->active = 0;
$product->name = array((int)Configuration::get('PS_LANG_DEFAULT') => 'testing');
$product->link_rewrite = array((int)Configuration::get('PS_LANG_DEFAULT') => 'test');
$force_ids = true;
//this will force ObjectModel to use your ID
$product->force_id = (bool) $force_ids;
$product->save();
echo "Done, pro well updated";
?>
I’ll add this to the debug roadmap so that it’s fixed. If you have already fixed it on your end or if you think you can do it, please do send us a pull request! Thanks!
Related to: https://github.com/PrestaShop/PrestaShop/issues/17449
Current behavior on develop.
In ProductCore __construct, there is this line..
$this->price = Product::getPriceStatic((int) $this->id, false, null, 6, null, false, true, 1, false, null, null, null, $this->specificPrice);
then when you check getPriceStatic
, there is $with_ecotax = true,
parameter, which causes ecotax to be added to price.
Correct solution I see is to gradually remove everything from the constructor, so the object model really serves only as a data storage.
Ping @kpodemski
Ping @Hlavtox & @kpodemski did you reproduce this issue with 81x?
Describe the bug When using
save()
method on a product object, there are some issuesTo Reproduce Into a module, or anywhere in a file... Use this simple code snippet:
After the save(), unit price value displayed into BackOffice is reset to 0.
Now, if you are using this code snippet:
After the save():
save()
is done