PHP Magic Methods

__get()/__set() – These are magic getters and setters for getting and putting values for class properties created dynamically. __isset() – This magic method will be invoked automatically while checking whether a required overloaded property is set or not. __unset() – Similarly, when we call PHP unset() function on such dynamically created properties, this magic method […]

WordPress Upgrade

The WordPress upgrade released time to time. We provide a WordPress upgrade, content management and maintenance services at affordable price. WordPress upgrade fixes bugs, runs cleaner, faster, and is more secure and stable. We will take your site backup including your files and database before and after upgrading, to ensure you have zero downtime. Please […]

Magento 2 Upload image in product

If you are trying to upload image on respective product by script then below code will help you to solve this issue. by this code you can set product thumbnail, small and large image. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->create(‘Magento\Catalog\Mode\Product’)->load($productId); // Load product object $mediaAttribute = array (‘thumbnail’,’small_image’,’image’); $mediaDir = $objectManager->get(‘Magento\Framework\App\Filesystem\DirectoryList’)->getPath(‘media’);// Im Magento 2 $fpath […]

magento 1.9 – Add a custom Price on check out page

In this article, we will show you have to change price on checkout page.  We will create a code in local folder for over-right core files functionality. In local folder your extension file create etc, Helper and Modal folder. In the first step create etc folder which contain “config.xml” file with the below code. <?xml […]

How to skip or remove shipping and payment steps from checkout in magento

In this article we will explain you, How can we remove the payment and shipping method steps in the checkout so that all the users have to do is enter a billing address and complete their order. Create xml file (StackExchange_Checkout.xml) in etc folder & add below code in this file for disabling and enabling […]

Magento 2 : Programmatically creating Magento product

In a development process, you need some testing data you can use. Magento supplies you with it’s default Sample Data that contains products. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // instance of object manager $product = $objectManager->create(‘\Magento\Catalog\Model\Product’); $product->setSku(‘mysku’); // Set your sku here $product->setName(‘Sample Product’); // Name of Product $product->setAttributeSetId(4); // Attribute set id $product->setStatus(1); // Status on […]

Magento 2: Add category programmatically

In this article, I am going to show, how to create multiple categories programmatically. It is useful to import number of categories data from API, CSV and XML file. Here is a code: use \Magento\Framework\App\Bootstrap; include(‘../app/bootstrap.php’); $bootstrap = Bootstrap::create(BP, $_SERVER); $objectManager = $bootstrap->getObjectManager(); $url = \Magento\Framework\App\ObjectManager::getInstance(); $storeManager = $url->get(‘\Magento\Store\Model\StoreManagerInterface’); $mediaurl= $storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA); $state = $objectManager->get(‘\Magento\Framework\App\State’);   // if […]

How to Add Custom Header Links in Magento 2

Step 1: Create a custom extension based on Magento 2 structure in the folder app/code. Ex: Magento 2 root directory/app/code/vk/hd/ Step 2: Create module.xml file in the below path to define your Magento 2 extension. Magento 2 root directory/app/code/vk/hd/etc/module.xml <?xml version=“1.0”?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd”> <module name=”vk_hd” setup_version=”2.0.1″></module> </config>  Step 3: Create routes.xml in the below […]

how to create a contact form in wordpress without plugin

There are a lot of different plugins available to put a contact form on your WordPress site for beginners, but here is a simple way to add a contact form, with existing page.php file. Create your custom template Copy the code from your page.php file into a new file and name it contact.php <?php /* […]