Processing in the Prestashop module
There was a mistake when working with another function.
Note: Trying to get property 'precision' of non-object in /classes/Context.php on line 498
Fatal error: Uncaught TypeError: Argument 1 passed to Notice: Trying to get property 'precision' of non-object in /sites/testsite.com/classes/Context.php on line 498
Fatal error: Uncaught TypeError: Argument 1 passed to PrestaShop\PrestaShop\Core\Localization\CLDR\ComputingPrecision::getPrecision() must be of the type int, null given, called in /sites/testsite.com/classes/Context.php on line 498 and defined in /sites/ikrinka.lv/src/Core/Localization/CLDR/ComputingPrecision.php:41
The Stack Trace:
#0 /sites/testsite.com/classes/Context.php(498): PrestaShop\PrestaShop\Core\Localization\CLDR\ComputingPrecision->getPrecision(NULL)
#1 /sites/testsite.com/classes/order/Order.php(614): ContextCore->getComputingPrecision()
#2 /sites/testsite.com/classes/order/Order.php(667): OrderCore->setProductPrices(Array)
#3 /sites/testsite.com/modules/dg_productlot/dg_productlot.php(121): OrderCore->getProducts()
#4 /sites/testsite.com/modules/dg_productlot/dg_productlot.php(279): Dg_ProductLot->getOrderProducts(20)
#5 /sites/testsite.com/classes/Hook.php(1007): Dg_ProductLot->hookActionOrderStatusUpdate(Array)
#6 /sites/testsite.com/classes/Hook.php(431): HookCore::coreCallHook(Object(Dg_ProductLot), 'hookActionOrder...', in /sites/testsite.com/src/Core/Localization/CLDR/ComputingPrecision.php on line 41
After removing the module from the hookActionOrderStatusUpdate the work of another function is renewed
The module code in this HUCK
public function hookActionOrderStatusUpdate($params)
by {
$products_with_lots = ModuleTools::getProductsWithLots();
$newOrderStatus = $params['newOrderStatus']
$id_order = $params['id_order']
if ($newOrderStatus->id == ConfPL::getConf('STATUS_PROCESS_BUY')
&& !$this->hasOrderStateInOrder($id_order, (int)ConfPL::getConf('STATUS_PROCESS_BUY'))) {
Foreach ($this->getOrderProducts($id_order) as $product) {
if (!Pack::isPack($product['product_id'])) {
if (!in_array($product['product_id'], $products_with_lots)) {
to continue;
The
$this->processBuyProduct($product, $product['product_quantity']);
The other {
* *
* var Product[] $items
* The
$items = Pack::getItems($product['product_id'], $this->context->language->id);
if (is_array($items) && count($items)) {
Foreach ($items as $item) {
$quantity = (int)$product['product_quantity'] * (int)$item->pack_quantity;
$prod = array(
'id_order_detail' => (int)$product['id_order_detail'],
‘product_id’ => (int)$item->id,
'product_attribute_id' => (int)$item->id_pack_product_attribute,
‘product_quantity’ = $quantity
'id_order' => (int)$product['id_order']
and the
$this->processBuyProduct($prod, $prod['product_quantity']);
The
The
The
The
} else if ($newOrderStatus->id == ConfPL::getConf('STATUS_REFUND')
&& !$this->hasOrderStateInOrder($id_order, (int)ConfPL::getConf('STATUS_REFUND'))) {
Foreach ($this->getOrderProducts($id_order) as $product) {
if (!in_array($product['id_product'], $products_with_lots)) {
to continue;
The
$this->processRefundProduct ($product)
The
The other {
Foreach ($this->getOrderProducts($id_order) as $product) {
if (!in_array($product['id_product'], $products_with_lots)) {
to continue;
The
//$this->processBuyProduct($product, $product['product_quantity']);
The
The
$order = new Order ($id_order)
$this->updateQuantityProductsByOrder($order)
The
in the class /classes/Context.php such code (fat line 498)
Returns the computing precision according to the current currency return int */
Public function getComputingPrecision()
{ if ($this->priceComputingPrecision === null) {
$computingPrecision = new ComputingPrecision();
$this->priceComputingPrecision = $computingPrecision->getPrecision($this->currency->precision);
The
return $this->priceComputingPrecision
The
and in /Core/Localization/CLDR/ComputingPrecision.phppublic function getPrecision(int $displayPrecision) (41 times)
by {
// the MULTIPLIER attribute is set to 1 for now, so that it matches display precision
$computingPrecision = $displayPrecision * self::MULTIPLIER;
return ($computingPrecision < self::MINIMAL_VALUE) ?self::MINIMAL_VALUE : $computingPrecision
The
after
Is it possible in the module itself somehow to prescribe the value of this parameter by setting it a constant in the hook function?
-
491 15 0 The answer to the first mistake is here:
https://www.prestashop.com/forums/topic/505618-notice-trying-to-get-property-of-non-object/
Current freelance projects in the category PHP
Multifunctional HTML template for a betting website and parsing match API (
25 USD
I have a Sportsbook API, I need to download a template for an online betting website from the internet and integrate match parsing and a payment system into it) the task is very simple, write who can do it right away) essentially, I need a basic website for testing with a… PHP, Python ∙ 14 hours 37 minutes back ∙ 15 proposals |
Resolve the loading issue on the PrestaShop website hostingThe website requires more and more resources each month. The host's response: During the server check, increased load from the MySQL database server was recorded. At times of the 500 error, the MySQL process uses a significant portion of CPU resources, which can lead to unstable… PHP, Databases & SQL ∙ 15 hours 33 minutes back ∙ 24 proposals |
Integration needed: KeyCRM → Cash Register KashalotIt is necessary to set up integration between KeyCRM and the Cash Register Kahalot. When placing an order in KeyCRM, the data must be automatically transmitted to Kahalot: • order information • products, nomenclature • prices • quantity More details in private. Content Management Systems, PHP ∙ 16 hours 53 minutes back ∙ 21 proposals |
A WordPress site using the Kadence theme and Kadence Blocks.
225 USD
We need to create a website on WordPress using the Kadence theme and Kadence Blocks. There will be no online store (although it may be added in the future). We need a homepage and several internal pages. The graphics are already prepared, the layout structure is mostly defined,… Content Management Systems, PHP ∙ 2 days 2 hours back ∙ 37 proposals |
Development of 2 SEO-oriented websites for selling spare parts (ATVs and special equipment)Development of Two Specialized Websites for Selling Spare PartsGeneral Information It is necessary to develop two specialized websites: Spare parts for ATVs, UTVs, SSVs, and other similar equipment. Spare parts for special equipment. Existing company website:… PHP, Web Programming ∙ 2 days 23 hours back ∙ 76 proposals |