Honey93 Posted April 10, 2017 Share Posted April 10, 2017 Tried to change the values of specific price table by changing the value at the time of submission in the Admin Product Controller.php but it is not working. Also let me know that how can I find out the view files related to Add a Specific Price. public function processPriceAddition() { // Check if a specific price has been submitted if (!Tools::getIsset('submitPriceAddition')) { return; } $id_product = Tools::getValue('id_product'); $id_product = 45; // Chaged the Default value but it is not getting updated in the table; $id_product_attribute = Tools::getValue('sp_id_product_attribute'); $id_shop = Tools::getValue('sp_id_shop'); $id_currency = Tools::getValue('sp_id_currency'); $id_country = Tools::getValue('sp_id_country'); $id_group = Tools::getValue('sp_id_group'); $id_customer = Tools::getValue('sp_id_customer'); $price = Tools::getValue('leave_bprice') ? '-1' : Tools::getValue('sp_price'); $from_quantity = Tools::getValue('sp_from_quantity'); $reduction = (float)(Tools::getValue('sp_reduction')); $reduction_tax = Tools::getValue('sp_reduction_tax'); $reduction_type = !$reduction ? 'amount' : Tools::getValue('sp_reduction_type'); $reduction_type = $reduction_type == '-' ? 'amount' : $reduction_type; $from = Tools::getValue('sp_from'); if (!$from) { $from = '0000-00-00 00:00:00'; } $to = Tools::getValue('sp_to'); if (!$to) { $to = '0000-00-00 00:00:00'; } if (($price == '-1') && ((float)$reduction == '0')) { $this->errors[] = Tools::displayError('No reduction value has been submitted'); } elseif ($to != '0000-00-00 00:00:00' && strtotime($to) < strtotime($from)) { $this->errors[] = Tools::displayError('Invalid date range'); } elseif ($reduction_type == 'percentage' && ((float)$reduction <= 0 || (float)$reduction > 100)) { $this->errors[] = Tools::displayError('Submitted reduction value (0-100) is out-of-range'); } elseif ($this->_validateSpecificPrice($id_shop, $id_currency, $id_country, $id_group, $id_customer, $price, $from_quantity, $reduction, $reduction_type, $from, $to, $id_product_attribute)) { $specificPrice = new SpecificPrice(); $specificPrice->id_product = (int)$id_product; $specificPrice->id_product_attribute = (int)$id_product_attribute; $specificPrice->id_shop = (int)$id_shop; $specificPrice->id_currency = (int)($id_currency); $specificPrice->id_country = (int)($id_country); $specificPrice->id_group = (int)($id_group); $specificPrice->id_customer = (int)$id_customer; $specificPrice->price = (float)($price); $specificPrice->from_quantity = (int)($from_quantity); $specificPrice->reduction = (float)($reduction_type == 'percentage' ? $reduction / 100 : $reduction); $specificPrice->reduction_tax = $reduction_tax; $specificPrice->reduction_type = $reduction_type; $specificPrice->from = $from; $specificPrice->to = $to; if (!$specificPrice->add()) { $this->errors[] = Tools::displayError('An error occurred while updating the specific price.'); } } } Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now