Using GREP to search for a file using a string

Using GREP to search for a file using a string

This command will search in the recursively in the includes folder for any file type which contains the string “string_to_find” in its content. This will not find the string in filenames.

Changes to address fields and layout in OPC – X-Cart 4

Changes to address fields and layout in OPC – X-Cart 4

Looking to edit the order of the fields or even introducing new fields on the customer profile. You can do this by following this guide. The initial order of the fields is set in the "init.php" script ($default_address_book_fields array). Further the fields are cached...

Count Files Recursively using find

Count Files Recursively using find

In order to count files recursively on Linux, you have to use the “find” command and pipe it with the “wc” command in order to count the number of files. $ find <directory> -type f | wc -l

Enabling Benchmark Trace on X-Cart 4

Enabling Benchmark Trace on X-Cart 4

This feature allows you to see how long each PHP or MYSQL command is taking to run on a page load. It allows you to easily pinpoint which part of the code is the major headache. //Speed Optimization if (!empty($debug) OR !empty($_GET['debug'])) { define('BENCH',...

How to flush DNS on linux

How to flush DNS on linux

Once you edit the hosts file with your overrides you may need to flush the local DNS on linux.

How to find the number of arrays in an array using smarty

How to find the number of arrays in an array using smarty

In smarty you will sometimes want to know if there are more than X amount of arrays within an array. Very useful for when you want to use collapse to show the first 5 and then hide the remaining 10 until a button is clicked.

How to add fields to the Manufacturer module in X-Cart 4

How to add fields to the Manufacturer module in X-Cart 4

In this example I will add a drop select box to a manufacturer in X-Cart. The select box will have a Yes/No option and will default to Yes. The field will be used in the front end to show the manufacturers in a drop down in the main navigation. Add new field to...

How to find the menu data in the wordpress database

How to find the menu data in the wordpress database

Sometimes you just need to update the menu information in batch using SQL. use the following to find where this information is held. Menu by itself is a taxonomy in WP. It means that you can find all menus in wp_terms table, by running following query:...

X-Cart 4 Creating a product level module

X-Cart 4 Creating a product level module

Sometimes you just want to add a new data dimension to a product without having to use x-cart's extra fields module. The extra fields modules is great but very limited when it comes to adding grouped data and multiple grouped fields. So I have documented how to do...

How to show the current year using smarty

How to show the current year using smarty

If you need to show the current year in the footer of a website like so. Company name 2003 - 2020 but not have to keep updating the current year once a year, then using the following smarty example. Company name 2003 - {$smarty.now|date_format:"%Y"}

How to create tar.gz file in Linux using command line

How to create tar.gz file in Linux using command line

The procedure to create a tar.gz file on Linux is as follows: Open the terminal application in LinuxRun tar command to create an archived named file.tar.gz for given directory name by running: tar -czvf file.tar.gz directoryVerify tar.gz file using the ls command...