What is strrpos()?

strrpos() is a string function in PHP used to find the position of the last occurrence of a substring (needle) in a string (haystack). strrpos(string $haystack, string $needle) strrpos(string $haystack, string $needle, int $offset) $str = “https://www.example.com/track?code=12345”; $pos = strrpos($str, ‘=’); echo $pos; // Output: 36 (position of the last “=”) Why use it? To… Continue reading What is strrpos()?

Steps to Install Argento Theme in Magento 2

Purchase & Download Argento Theme Visit https://argentotheme.com Purchase the theme if you haven’t already. You’ll get access to a ZIP package or installation files. Upload Theme Files to Magento Unzip the Argento package. Connect to your server using FTP/SFTP or SSH. Upload the theme files into the Magento root directory: app/design/frontend/Swissup/ app/code/Swissup/ Argento comes with… Continue reading Steps to Install Argento Theme in Magento 2

Add Custom Attribute To Recently Viewed Products Widget

here is the solution for overiding the controllers Namespace/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”> <type name=”MagentoCatalogUiDataProviderProductProductRenderCollectorComposite”> <arguments> <argument name=”productProviders” xsi:type=”array”> <item name=”sku” xsi:type=”object”>NamespaceModuleUiDataProviderProductListingCollectorSku</item> </argument> </arguments> </type> </config> Namespace/Module/etc/extension_attributes.xml <?xml version=”1.0″?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:Api/etc/extension_attributes.xsd”> <extension_attributes for=”MagentoCatalogApiDataProductRenderInterface”> <attribute code=”sku” type=”string”/> </extension_attributes> </config> Namespace/Module/etc/widget.xml <?xml version=”1.0″ encoding=”UTF-8″?> <widgets xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:module:Magento_Widget:etc/widget.xsd”> <widget id=”catalog_recently_viewed”> <parameters> <parameter name=”show_attributes” xsi:type=”multiselect” required=”true” visible=”true”>… Continue reading Add Custom Attribute To Recently Viewed Products Widget

Get quantity in stock for items added in cart in JS

In your phtml file : <script type=”text/x-magento-init”> { “#idofyourdiv” : { “yourJSdefinedinRequireJS” : { “data1” : “data1”, “data2” : “data2”, “data3” : “data3”, } } } </script> In your JS : define([ ‘jquery’, ‘mage/translate’, ‘jquery/ui’ ], function ($, $t) { ‘use strict’; $.widget(‘mage.yourjsdefinedinrequirejs’, { options: { data1: data1, data2: data2, data3:data3 }, … …. …… Continue reading Get quantity in stock for items added in cart in JS

Magento Show only tier prices for Level Customer- No promotional prices

<?php /**  * Copyright © Magento, Inc. All rights reserved.  * See COPYING.txt for license details.  */ use MagentoFrameworkPricingAmountAmountFactory; ?> <?php /** @var MagentoCatalogPricingRenderFinalPriceBox $block */ /** ex: MagentoCatalogPricingPriceRegularPrice */ /** @var MagentoFrameworkPricingPricePriceInterface $priceModel */ $priceModel = $block->getPriceType(‘regular_price’); /** ex: MagentoCatalogPricingPriceFinalPrice */ /** @var MagentoFrameworkPricingPricePriceInterface $finalPriceModel */ $finalPriceModel = $block->getPriceType(‘final_price’); $idSuffix = $block->getIdSuffix() ? $block->getIdSuffix()… Continue reading Magento Show only tier prices for Level Customer- No promotional prices

Explanation for Default stock and Salable Qty in Magento

Explanation for Default stock and Salable Qty    Now magento has introduced MSI feature by-default in magento.   In this you can use Multi-source inventory.   First there is a need to understand three terms:-   1.Source:- You can relate this with warehouses. As you can have single warehouse or multi-warehouses for your website similarly you… Continue reading Explanation for Default stock and Salable Qty in Magento

How to Add Quick Add Feature in Magento Checkout Cart

Steps to Add Quick Add Feature in Magento Checkout Cart: Prepare the Product Search by SKU: Create a search functionality that allows users to quickly search for a product by entering its SKU (Stock Keeping Unit). This will enable users to find specific products without browsing through categories. Modify Checkout Cart Page: Access the checkout… Continue reading How to Add Quick Add Feature in Magento Checkout Cart

Error “Your session has expired” when click on add to cart in magento 2

when clicking on product’s add to cart then it’s giving me error–> Your session has expired. Solution UPDATE `core_config_data` SET `value` = ‘http://127.0.0.1/zain/accessories/’ WHERE `core_config_data`.`path` = ‘web/unsecure/base_url’; UPDATE `core_config_data` SET `value` = ‘http://127.0.0.1/zain/accessories/’ WHERE `core_config_data`.`path` = ‘web/secure/base_url’; http://127.0.0.1/zain/accessories/ in this write your frontend url (home page url) what you have after that run command in your… Continue reading Error “Your session has expired” when click on add to cart in magento 2

Features on Argento template in Magento

Argento 1.25.1-1.25.2 updates In October 2021 we added Page Builder and Breeze integration with some Argento modules. Ultimately, we added many more improvements to our premium Magento 2 theme. Check it out here. The latest Argento template version has several general enhancements: Products grid/slider elements improvements Argento Essence: Fixed search overlapping dropdowns Argento Force: Fixed visible configurable… Continue reading Features on Argento template in Magento

How to create a new admin user in Magento via the terminal

To create a new admin user in Magento via the terminal, follow these steps: Access Your Server: Open your terminal or SSH into your server. Navigate to Your Magento Installation: Change to the Magento root directory: Create a New Admin User: Use the following command to create a new admin user. Replace <new_username>, <new_email>, and… Continue reading How to create a new admin user in Magento via the terminal