Saturday, May 14, 2022

How to add file manager in VestaCP

The Vesta CP is a commonly used web hosting control panel in Linux OS. There is no file manager is there by default in Vesta CP. Here is a simple trick to enable the file manager on the panel.

1. Log in as root to a Vesta installed server via terminal.

2. Open the configuration file using any text editor:
vi /usr/local/vesta/conf/vesta.conf

3. Add the following line at the end of that configuration file:
FILEMANAGER_KEY=’ILOVEREO’

4. Save and exit the file.

Try to log out and re-login to Vesta panel and you will be able to see the file manager option now.

Copy files and folders from current directory to another in CentOS

 Using rsync:

First install rsync (if not installed) : yum install rsync

rsync -a /source_directory /destination_directory


Friday, May 6, 2022

Tuesday, April 19, 2022

Decrease product price by 10% using SQL command in Woocommernce from Phpmyadmin

 Query-1:

UPDATE

   wp_wc_product_meta_lookup

SET

    min_price =(min_price - min_price * .13)

WHERE 1;

Query-2;

 UPDATE

   wp_wc_product_meta_lookup

SET

    max_price =(max_price - max_price * .13)

WHERE 1;

Saturday, April 16, 2022

Mark all products as draft Woocommerce using SQL query

 UPDATE `wp_posts` SET `post_status` = 'draft' WHERE `post_type` = 'product' AND `post_status` = 'publish'

Saturday, April 9, 2022

Print Product Group in WHMCS Invoice Item Description

PRODUCTNAME - Domain (Start Date - End Date)

e.g. Standard - abc.com (04/10/2010 - 03/10/2012)

Need to change it to the following:

PRODUCTNAME - Domain (Start Date - End Date)

PRODUCT DESCRIPTION

e.g. Shared Hosting - Standard - abc.com (04/10/2010 - 03/10/2012)

Method -1: 

Place the following script at the top of your /templates/<templatename>/viewinvoice.tpl:


{php}

foreach ($this->_tpl_vars['invoiceitems'] as $key => $value)

{

$result = mysql_query("SELECT (SELECT name FROM tblproductgroups WHERE gid = tblproducts.id) AS groupname FROM tblproducts WHERE name = '".sanitize(substr($value['description'], 0, strpos($value['description']." - ", " - ")))."'");

$data = mysql_fetch_array($result);

if(mysql_num_rows($result) == 1)

$this->_tpl_vars['invoiceitems'][$key]['description'] = $data['groupname']." - ".$value['description'];

}

{/php}

Now place the following script at the top of your /templates/<templatename>/invoicepdf.tpl:
foreach ($invoiceitems as $key => $value)
{
   $result    = mysql_query("SELECT (SELECT name FROM tblproductgroups WHERE gid = tblproducts.id) AS groupname FROM tblproducts WHERE name = '".sanitize(substr($value['description'], 0, strpos($value['description']." - ", " - ")))."'");
   $data     = mysql_fetch_array($result);

   if(mysql_num_rows($result) == 1)
       $invoiceitems[$key]['description'] = $data['groupname']." - ".$value['description'];
}

Method -2: 
Create a new .php file called invoices_productgroup.php in your action hooks directory (/includes/hooks/), and place the following code in it:

<?php
add_hook("InvoiceCreationPreEmail", 1, "invoice_productgroup");

function invoice_productgroup($vars)
{
   $result = select_query("tblinvoiceitems","id,description",array("invoiceid" => $vars['invoiceid']));

   while($data = mysql_fetch_array ($result))
   {
       $result2 = full_query("SELECT (SELECT name FROM tblproductgroups WHERE gid = tblproducts.id) AS groupname FROM tblproducts WHERE name = '".sanitize(substr($data['description'], 0, strpos($data['description']." - ", " - ")))."'");
       $data2   = mysql_fetch_array($result2);

       if(mysql_num_rows($result2) == 1)
           update_query("tblinvoiceitems", array("description" => $data2['groupname']." - ".$data['description']), array("id" => $data['id']));
   }
}
?>
This will add the product group (if applicable) in front of the description from a new invoice.

Tuesday, March 15, 2022

How to restore a Large cPanel Backup file from Google Drive

 wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.confirm=([0-9A-Za-z_]+)./\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt





Office 2021 Activation using command

  @echo off title Activate Microsoft Office 2021 (ALL versions) for FREE - office.com&cls&echo =====================================...