magento 2 regenerate product url php code

please follow the step as i show below1) backup you database 2) create one controller name Producturl.php3) copy my code into that controller <?php  namespace Company\Module\Controller\Producturl;use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator;use Magento\UrlRewrite\Service\V1\Data\UrlRewrite;use Magento\Store\Model\Store;class Producturl extends...

make url short php

This code is for make you url short through google API<?php// Declare the classclass GoogleUrlApi { public $key=your key // Constructor function GoogleURLAPI($apiURL = 'https://www.googleapis.com/urlshortener/v1/url') { // Keep the API Url $this->apiURL = $apiURL.'?key='.$this->key; } // Shorten a URL function shorten($url) { // Send information along $response = $this->send($url);...

Create virtual host in local pc for you website in ubuntu

Create virtual host in local  pc for you website in ubuntu1) open you terminal with sudo su2) cd /etc/apache2/sites-available/   paste this into your terminal .3) sudo cp 000-default.conf example1.com.conf 4) go to folder  /etc/apache2/sites-available/ and open file example1.com.conf into any editor  you want5) than  paste below code <VirtualHost *:80>...

Add new product image in PrestaShop by core development

// add product image...if(count($_FILES['files']['tmp_name']) > 1){ for($i=0;$i < count($_FILES['files']['tmp_name']);$i++ ){       $image = new Image();       $url = $_FILES['files']['tmp_name'][$i];      $shops = Shop::getShops(true, null, true); $image->id_product = $id_product; $image->position = Image::getHighestPosition($id_product)...

Add new product combination in PrestaShop by core development

$attributes=array();$attribute is a all attribute id wich you selected at the time of product add.$p is product id if(count(Tools::getValue('attribute'))){ $attributes=Tools::getValue('attribute'); $i=0; $combinationAttributes = []; foreach ($attributes as $key => $value) { if($value==0) continue; $combinationAttributes[] = $value; } ...

Add new product in PrestaShop by core development

hello the below code is to add new product in PrestaShop                                $p = new Product; $p->name = Tools::getValue('name'); $p->id_category_default = Tools::getValue('category'); $p->indexed = 1; $p->active = Tools::getValue('active'); $p->redirect_type...

WooCommerce Sample plugin is adding full price when using custom option

Is your WooCommerce Sample e is adding full price of your product rathan than custome sample price than this is the solution for itjust copy and paste this code into the respective file/wp-content/plugins/woocommerce-sample/woocommerce-sample.php1)  add this code in init() function //custome RI code start add_action( 'woocommerce_before_calculate_totals','cp_add_custom_price',...

How to install Sphinx Search in Ubuntu 16.04

~~~~~~~~~~~~~~Step 1 — Installing Sphinx~~~~~~~~~~~~~~~~~~ Installing Sphinx on Ubuntu is easy because it's in the native package repository. Install it using apt-get.    sudo apt-get install sphinxsearch~~~~~~~~~~~~~~~~Step 2 – Creating the Test Database~~~~~~~~~~~~~~~ Next, we'll set up a database using the sample data in the SQL file provided with the package....