
Pinakin Patel
PHP Web Developer
How to add new banner region in xcart 4 banner system
If you need to add a new banner region to the banner system module in x-cart 4
Automatically setting a customer to a membership group on account creation in x-cart 4
Ideally you should create a new config variable in the configuration table to store the membershipid you would like to make default. But htis example will allow you to set a customer as member rather than just an account holder with no membership.
SCP Copy file from Remote host to local host
To copy a file using SCP from a remote host you can use the following
Fetch a single wordpress post using JSON using PHP
If you need to fetch a single blog articles from your wordpress site to show them in another web application then you can use the new JSON API in wordpress to do this.
Fetch a JSON list of blog posts from wordpress using PHP
If you need to fetch a list of articles from your wordpress site to show them in another we application then you can use the new JSON API in wordpress to do this.
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.
Listing and extracting specific content from a tar.gz file
I usually look this up everytime someone tells me to check a database back from the cpanel daily/weekly backup routine. By default cpanel backs up to the /backup folder.
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
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
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 Import a .sql file using terminal
How to import a .sql file using terminal. You mush have the database username, password and database name at hand
How to export a mysql database using terminal and zip at the same time
Sometimes a database is just too big for phpMyadmin to export so you need to be able to export the database to a .sql file and maybe zipped too.
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
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.
Testing Idev Affiliate banner tracking
I have created this post to test idev affiliate links for doggiesolutions.co.uk
How to change WordPress URLs in MySQL Database
Here is how to replace the old url in wordpress
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
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
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 export/import a MySQL database via SSH
To export a MySQL database, you need to use the mysqldump command. Here is the full command for exporting your database:
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 can I view the size of a folder in Linux using SSH?
How to get the size of a folder in SSH
Using RSYNC to copy a folder in SSH
You can copy the content of one folder to another using the following RSYNC syntax
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...






















