![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/scripts/ |
<?php use Magento\Framework\App\Bootstrap; use Magento\Framework\App\ResourceConnection; try { require_once '../app/bootstrap.php'; } catch (\Exception $e) { echo 'Autoload error: ' . $e->getMessage(); exit(1); } ini_set('display_errors', 1); error_reporting(E_ALL); $bootstrap = Bootstrap::create(BP, $_SERVER); $objectManager = $bootstrap->getObjectManager(); // Set the area code to avoid errors in non-admin scripts $appState = $objectManager->get(\Magento\Framework\App\State::class); $appState->setAreaCode('frontend'); $resource = $objectManager->get(ResourceConnection::class); $connection = $resource->getConnection(); try { $connection->update( 'catalog_category_product', ['position' => 1], ); echo "Product positions updated successfully.\n"; } catch (\Exception $e) { echo "An error occurred: " . $e->getMessage() . "\n"; }