Unable to override Helper Class in Magento2

I have used below code to override helper class. Vendor/Module/etc/di.xml <?xml version=”1.0″?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:ObjectManager/etc/config.xsd”> <preference for=”Magento\CatalogInventory\Helper\Stock” type=”Vendor\Module\Helper\Stock” /> </config> Then Vendor\Module\Helper\Stock.php <?php namespace Vendor\Module\Helper; class Stock extends \Magento\CatalogInventory\Helper\Stock { public function addIsInStockFilterToCollection($collection) { $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $category = $objectManager->get(‘Magento\Framework\Registry’) ->registry(‘current_category’);//get current category $categoryId = $category->getId(); $writer = new \Zend\Log\Writer\Stream(BP . ‘/var/log/testlog.log’); $logger = new…

most viewed collection sorting

Hi I have most viewed collection sorting in my plp here is my toolbar.php code if ($subject->getCurrentOrder() == ‘most_viewed’) { if (!$this->_subQueryApplied) { $period = $this->scopeConfig->getValue($this->_configPeriodPath, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); switch ($period) { case “yearly”: $table = “report_viewed_product_aggregated_yearly”; break; case “monthly”: $table = “report_viewed_product_aggregated_monthly”; break; default: $table = “report_viewed_product_aggregated_daily”; break; } $reportTable = $this->_collection->getResource()->getTable($table); $this->_collection->getSelect() ->joinLeft( array(“report_table” =>…

Magento 2: Added product not showing on wish list page

I am trying to add product to wish list programmatically,but unable to add the product. here is my code: <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productObject = $objectManager->get(‘Magento\Catalog\Model\Product’); $simpleProduct = $productObject->load(16); ?> <a href=”#” data-post='<?php echo $this->helper(‘Magento\Wishlist\Helper\Data’)->getAddParams($simpleProduct) ?>’ class=”action towishlist” data-action=”add-to-wishlist”><span>Add to wishlist</span></a> When I click on Add to wish list button it redirects to My Wish…

Magento EE upgrade from 2.2.9 to 2.3.4 issue

I have upgraded Magento from 2.2.9 to 2.3.4 using composer. And run the setup: upgrade, then I am getting below error. SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (#sql-27b_17e, CONSTRAINT QUOTE_ITEM_PARENT_ITEM_ID_QUOTE_ITEM_ITEM_ID FOREIGN KEY (parent_item_id) REFERENCES quote_item (item_id) ON DELETE CASCADE), query was: ALTER TABLE quote_item…

Magento1.9 – Cart page subtotal is wrong

I am facing on the issue in My Magento1.9 cart page where the product subtotal is different than expected. Expected result: Unit Price * QTY = Subtotal Actual result: Unite Price * QTY = Some other price Please see the screenshot for more detail. Magento 1.9.3.1 PHP 7.2.27 I have also tried https://github.com/hartmut-co-uk/magento-php7-totals-fix and https://magento.com/tech-resources/download#download2240

Magento 2 Store getCurrentUrl always refers to previously visited URL

I have a website with multiple websites and multiple store views. To display store switcher in the header I have added the below code. <ul class=”sub-lang”> <?php foreach ($helper->getWebsites() as $website) { foreach ($website->getGroups() as $group) { $stores = $group->getStores(); foreach ($stores as $store) { ?> <li><a class=”<?php echo $store->getName(); ?>” href=”<?php echo $helper->getCurrentUrl(); ?>”><?php…