Jump to content

Import discount from CSV vat excluded


fabrizio

Recommended Posts

Hello at all,

I have a little problem importing the discount amount via csv (prestashop 1.7).
My shop have a lot of products (more than 1600), I have imported all of them in the right way via csv without problems. Just the "discount amount" was imported "VAT included" but I need this value "VAT excluded".

There is any way to change this parameter without opening products one by one?

Thanks for your help,
Fabrizio

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

for the moment prestashop dont have that option. the only solution is to modify the controllers/admin/adminimportcontroller.php fiel to exclude teh vat

around line 2000 you have next code, you can find a workaround to exclude the vat ()

 

if ((isset($info['reduction_price']) && $info['reduction_price'] > 0) || (isset($info['reduction_percent']) && $info['reduction_percent'] > 0)) {
foreach ($id_shop_list as $id_shop) {
$specific_price = SpecificPrice::getSpecificPrice($product->id, $id_shop, 0, 0, 0, 1, 0, 0, 0, 0);
 
if (is_array($specific_price) && isset($specific_price['id_specific_price'])) {
$specific_price = new SpecificPrice((int)$specific_price['id_specific_price']);
} else {
$specific_price = new SpecificPrice();
}
$specific_price->id_product = (int)$product->id;
$specific_price->id_specific_price_rule = 0;
$specific_price->id_shop = $id_shop;
$specific_price->id_currency = 0;
$specific_price->id_country = 0;
$specific_price->id_group = 0;
$specific_price->price = -1;
$specific_price->id_customer = 0;
$specific_price->from_quantity = 1;
$specific_price->reduction = (isset($info['reduction_price']) && $info['reduction_price']) ? $info['reduction_price'] : $info['reduction_percent'] / 100;
$specific_price->reduction_type = (isset($info['reduction_price']) && $info['reduction_price']) ? 'amount' : 'percentage';
$specific_price->from = (isset($info['reduction_from']) && Validate::isDate($info['reduction_from'])) ? $info['reduction_from'] : '0000-00-00 00:00:00';
$specific_price->to = (isset($info['reduction_to']) && Validate::isDate($info['reduction_to'])) ? $info['reduction_to'] : '0000-00-00 00:00:00';
if (!$validateOnly && !$specific_price->save()) {
$this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->trans('Discount is invalid', array(), 'Admin.Advparameters.Notification'));
}
 
 
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...