magento2 – Get Storefront Product URL for Magento 2

I am trying to get the storefront product URL.

$_Product = $objectManager->create(‘MagentoCatalogModelProduct’)->load($product->getId());
echo $_Product->getUrlModel()->getUrl($_Product);

For some of the products, the URL is showing as the product admin url. i.e.,

I want the product URL as

magento2 – Don’t Sort by Name when have Mysql Search Engine Magento 2.4.1

I installed the Weltpixel AjaxLayeredNavigation extension and with the Swissup extension of Mysql Legacy Search Engine, having both activated when I want to sort by name gives me the following SQL error: Column not found: 1054 Unknown column ‘nameasc’ in ‘order clause’

If someone has gone through a similar error please it would be of great help.

magento2.4 – CPU issues after upgrading from Magento 2.2.4 to Magento 2.4

We recently upgraded our site from Magento 2.2.4 to Magento 2.4.

Done the upgrade on a copy of our site on a test server and everything was fine.

When we upgrade on our live server, the page load time increased dramatically when 4+ people were on the site at the same time. This also crashed EleasticSearch, so we moved that to it’s own VPS and ES works fine now. Before the upgrade, 15-20+ users online at the one time wouldn’t have been uncommon and the server handled it fine.

With 2.2.4, we had a VPS with 6GB RAM, 4 CPU’s. Our hosting provider suggested we increase this when we ran into issues after the upgrade. We’re now at 8CPU’s, 12GB RAM and although that improved performance, load times from server were very long.

We now have Varnish running on a separate VPS and while that has sped up load times, it’s still not good enough. Varnish has been running for the last 24 hours and we’ve been getting 503 and 504 errors and our Magento developer has told me these are due to Varnish waiting so long for our Magento server to respond.

Our hosting company is now telling us we need to get a dedicated server, is this necessary? Our Magento developer has said our VPS, if there’s no issues with the server, should be fine. Our hosting company is telling us that the server is fine.

We’re unsure what to do as we haven’t much confidence in our hosting company as they have just been telling us to increase our package, without really investigating why we’re having these issues.

i had upgraded magento 1.9 to magento 2.4 but it did not work properly so i decided to get back but when i restored it i can see this problem

error log
[14-Apr-2021 15:18:01 Australia/Sydney] PHP Fatal error: Uncaught Error: Class ‘MagentoFrameworkAppErrorHandler’ not found in /home/martarab/public_html/bin/magento:20
Stack trace:
#0 {main}
thrown in /home/martarab/public_html/bin/magento on line 20
enter image description here

php default classes not working in magento

I trying to sort cart item by price

private function getSortedItems($quote, $rule)

    $items = $this->context->getMatchingItems($quote, $rule);
    $itemObject = new ArrayObject($items);
    // Sort and print the resulting array
    $itemObject->uasort(function($a, $b) {
        return $a->getPrice() - $b->getPrice();

    foreach ($itemObject as $itm) {
        print_r($itm->getPrice());exit(" <= price");

    return $itemObject;

but its call me

Fatal error: Uncaught Error: Class ‘VendorMyModuleRuleArrayObject’ not found in /home/public_html/app/code/Vendor/MyModule/Rule/AwaBuyGetFixed.php:117 Stack trace: #0