Jump to content

Rachit Agarwal

Members
  • Posts

    28
  • Joined

  • Last visited

About Rachit Agarwal

  • Birthday December 3

Contact Methods

  • Skype
    agarwalra03@gmail.com
  • iMessage
    agarwalra03@gmail.com

Profile Information

  • Location
    Bangalore, India
  • First Name
    Rachit
  • Last Name
    Agarwal
  • Activity
    Freelancer
    Developer
    Module Developer
    Other

Recent Profile Visitors

410 profile views

Rachit Agarwal's Achievements

Newbie

Newbie (1/14)

  • First Post Rare
  • Collaborator Rare
  • Conversation Starter Rare
  • Week One Done Rare
  • One Month Later Rare

Recent Badges

3

Reputation

  1. Hi, I've the same issue facing for backoffice login which is taking more than 10-15 sec to login. PrestaShop version: 1.7.7.2 OS: REHL 7 PHP: 7.1 I've done all the debugging like restarting HTTPD, PHP FPM, MYSQL ROUTER services, even I tried to rebooting the OS as well but the problem still exists. I've been monitoring the CPU usage, memory consumption, everything is fine and had enough space free. Please let me know if anybody finds something to resolve this.
  2. Hi, I've created the new stats module to show the customer sessions as a separate tab in the Stats menu. But only on production env I'm getting the below error: When I checked the httpd logs, I got the below error: Has anyone faced such an issue earlier or have any suggestions to resolve this issue? Note:- I'm getting this only on production env, in non-prod its working fine.
  3. I've some DB table without prefix "ps". I want to create Class Object Model for the same so what are the various ways to generate it? Is there any automatic way to generate it?
  4. While opening dashboard page, i'm seeing below error in the console: dashboard.js:52 Uncaught TypeError: window[data_type] is not a function at Object.success (dashboard.js:52) at j (jquery-1.11.0.min.js:2) at Object.fireWith [as resolveWith] (jquery-1.11.0.min.js:2) at x (jquery-1.11.0.min.js:4) at XMLHttpRequest.b (jquery-1.11.0.min.js:4) Can someone has any idea to resolve this?
  5. Yes I've checked it. If the connection is not there, only then it is logging the error message. I need to log those errors as well, if the connection is established successfully but somehow Prestashop is not able to get the data from Db (it can be happened if we are using MySQL Cluster).
  6. Hi, I want to log the errors if there is an issue in communication with the database after successful connectivity in PS 1.6. So anyone can suggest how I can do that? If I'll use MySQL Cluster and my DB connection is established successfully but there is some issue in MySQL Cluster and My Website is down so how I can get the logs for it?
  7. as per my understanding, mygroup should be in double quotes, so can you please try with below query: $list = Db::getInstance()->executeS('SELECT id_customer FROM `'._DB_PREFIX_.'customer_group` WHERE id_group IN (SELECT id_group FROM `'._DB_PREFIX_.'group_lang` WHERE name LIKE "%MYGROUP%" AND id_lang=5)'); Let's give a try with this one and see what will be result..
  8. I've used the Product.php as overrided class in PS 1.7 <?php class Product extends ProductCore { public static function newPriceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency, $id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_group_reduction, $id_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0) { static $address = null; static $context = null; if ($address === null) { $address = new Address(); } if ($context == null) { $context = Context::getContext()->cloneContext(); } if ($id_shop !== null && $context->shop->id != (int)$id_shop) { $context->shop = new Shop((int)$id_shop); } if (!$use_customer_price) { $id_customer = 0; } if ($id_product_attribute === null) { $id_product_attribute = Product::getDefaultAttribute($id_product); } $cache_id = (int)$id_product.'-'.(int)$id_shop.'-'.(int)$id_currency.'-'.(int)$id_country.'-'.$id_state.'-'.$zipcode.'-'.(int)$id_group. '-'.(int)$quantity.'-'.(int)$id_product_attribute. '-'.(int)$with_ecotax.'-'.(int)$id_customer.'-'.(int)$use_group_reduction.'-'.(int)$id_cart.'-'.(int)$real_quantity. '-'.($only_reduc?'1':'0').'-'.($use_reduc?'1':'0').'-'.($use_tax?'1':'0').'-'.(int)$decimals; // reference parameter is filled before any returns $specific_price = SpecificPrice::getSpecificPrice( (int)$id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute, $id_customer, $id_cart, $real_quantity ); if (isset(self::$_prices[$cache_id])) { /* Affect reference before returning cache */ if (isset($specific_price['price']) && $specific_price['price'] > 0) { $specific_price['price'] = self::$_prices[$cache_id]; } return self::$_prices[$cache_id]; } // fetch price & attribute price $cache_id_2 = $id_product.'-'.$id_shop; if (!isset(self::$_pricesLevel2[$cache_id_2])) { $sql = new DbQuery(); $sql->select('product_shop.`price`, product_shop.`ecotax`,p.`usage_type`,p.`pulse_rate_value`'); $sql->from('product', 'p'); $sql->innerJoin('product_shop', 'product_shop', '(product_shop.id_product=p.id_product AND product_shop.id_shop = '.(int)$id_shop.')'); $sql->where('p.`id_product` = '.(int)$id_product); if (Combination::isFeatureActive()) { $sql->select('IFNULL(product_attribute_shop.id_product_attribute,0) id_product_attribute, product_attribute_shop.`price` AS attribute_price, product_attribute_shop.default_on'); $sql->leftJoin('product_attribute_shop', 'product_attribute_shop', '(product_attribute_shop.id_product = p.id_product AND product_attribute_shop.id_shop = '.(int)$id_shop.')'); } else { $sql->select('0 as id_product_attribute'); } $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); if (is_array($res) && count($res)) { foreach ($res as $row) { if($row['usage_type'] == 'usage_based') $array_tmp = array( 'price' => $row['pulse_rate_value'], 'ecotax' => $row['ecotax'], 'attribute_price' => (isset($row['attribute_price']) ? $row['attribute_price'] : null) ); else $array_tmp = array( 'price' => $row['price'], 'ecotax' => $row['ecotax'], 'attribute_price' => (isset($row['attribute_price']) ? $row['attribute_price'] : null) ); self::$_pricesLevel2[$cache_id_2][(int)$row['id_product_attribute']] = $array_tmp; if (isset($row['default_on']) && $row['default_on'] == 1) { self::$_pricesLevel2[$cache_id_2][0] = $array_tmp; } } } } if (!isset(self::$_pricesLevel2[$cache_id_2][(int)$id_product_attribute])) { return; } $result = self::$_pricesLevel2[$cache_id_2][(int)$id_product_attribute]; if (!$specific_price || $specific_price['price'] < 0) { $price = (float)$result['price']; } else { $price = (float)$specific_price['price']; } // convert only if the specific price is in the default currency (id_currency = 0) if (!$specific_price || !($specific_price['price'] >= 0 && $specific_price['id_currency'])) { $price = Tools::convertPrice($price, $id_currency); if (isset($specific_price['price']) && $specific_price['price'] >= 0) { $specific_price['price'] = $price; } } // Attribute price if (is_array($result) && (!$specific_price || !$specific_price['id_product_attribute'] || $specific_price['price'] < 0)) { $attribute_price = Tools::convertPrice($result['attribute_price'] !== null ? (float)$result['attribute_price'] : 0, $id_currency); // If you want the default combination, please use NULL value instead if ($id_product_attribute !== false) { $price += $attribute_price; } } // Tax $address->id_country = $id_country; $address->id_state = $id_state; $address->postcode = $zipcode; $tax_manager = TaxManagerFactory::getManager($address, Product::getIdTaxRulesGroupByIdProduct((int)$id_product, $context)); $product_tax_calculator = $tax_manager->getTaxCalculator(); // Add Tax if ($use_tax) { $price = $product_tax_calculator->addTaxes($price); } // Eco Tax if (($result['ecotax'] || isset($result['attribute_ecotax'])) && $with_ecotax) { $ecotax = $result['ecotax']; if (isset($result['attribute_ecotax']) && $result['attribute_ecotax'] > 0) { $ecotax = $result['attribute_ecotax']; } if ($id_currency) { $ecotax = Tools::convertPrice($ecotax, $id_currency); } if ($use_tax) { // reinit the tax manager for ecotax handling $tax_manager = TaxManagerFactory::getManager( $address, (int)Configuration::get('PS_ECOTAX_TAX_RULES_GROUP_ID') ); $ecotax_tax_calculator = $tax_manager->getTaxCalculator(); $price += $ecotax_tax_calculator->addTaxes($ecotax); } else { $price += $ecotax; } } // Reduction $specific_price_reduction = 0; if (($only_reduc || $use_reduc) && $specific_price) { if ($specific_price['reduction_type'] == 'amount') { $reduction_amount = $specific_price['reduction']; if (!$specific_price['id_currency']) { $reduction_amount = Tools::convertPrice($reduction_amount, $id_currency); } $specific_price_reduction = $reduction_amount; // Adjust taxes if required if (!$use_tax && $specific_price['reduction_tax']) { $specific_price_reduction = $product_tax_calculator->removeTaxes($specific_price_reduction); } if ($use_tax && !$specific_price['reduction_tax']) { $specific_price_reduction = $product_tax_calculator->addTaxes($specific_price_reduction); } } else { $specific_price_reduction = $price * $specific_price['reduction']; } } if ($use_reduc) { $price -= $specific_price_reduction; } // Group reduction if ($use_group_reduction) { $reduction_from_category = GroupReduction::getValueForProduct($id_product, $id_group); if ($reduction_from_category !== false) { $group_reduction = $price * (float)$reduction_from_category; } else { // apply group reduction if there is no group reduction for this category $group_reduction = (($reduc = Group::getReductionByIdGroup($id_group)) != 0) ? ($price * $reduc / 100) : 0; } $price -= $group_reduction; } if ($only_reduc) { return Tools::ps_round($specific_price_reduction, $decimals); } $price = Tools::ps_round($price, $decimals); if ($price < 0) { $price = 0; } self::$_prices[$cache_id] = $price; return self::$_prices[$cache_id]; } } It's working for me... its for your reference.. I'm just overriding class with a function and tried to check its impact.
  9. As i said in my last quote as @idnovate.com said So to get the actual amount you should go for ps_orders table.
  10. yes, at the time of order creation, values are being calculated according to applied discount as per the ps_cart_rule table and stored in ps_orders to reduce the joins and recalculation everytime while fetching order details. So if we want the original discount information from where it is calculated, that is in ps_cart_rule and calculated amount is in ps_orders.
  11. All discounts define in ps_cart_rule table with how much price or percent will be applied. and the relation between order and this cart rule comes under ps_cart_cart_rule.
  12. is it not available in cookie or session?
  13. As per my Observation, In PS 1.6, there is no need to clear the cache after creating new override file. But in PS 1.7, clear Cache is required after changing in JS file or creating new override file. So have you cleared the cache?
  14. which information has been changed in DB to place a new order. Please describe in detail.
×
×
  • Create New...