Pinakin Patel
PHP Web Developer
Shell command to tar.gz directory excluding certain files/folders
This will allow you to tar.gz a folder and not add the blog and other folders into it.
Setting a session cookie based on an Admin logged in front end on X-Cart 4
In x-cart Admin can longin as customers and place orders on their behalf.
How to identify a customer that is not logged in on shopify
You can use this code snippet to display different content on the site based on whether the user is logged in or not. Great for wholesale customers. {%- if customer.id == null -%} <div class="product-retail-link"><a href="#">Your text...
Making the Logo larger than 250px in the Shopify Taste Theme
By default this theme only allows you to have a maximum logo size of 250px.
Discount Coupon Product Exceptions
In xcart 4 the dscount coupon will discount all products. But in some cases you want to stop it discounting some products and not be part of the offer. This can be done using the following instructions.
Sorting products so out of stock appear at the bottom in X-Cart 4
These instructions are for sorting products in xcart product listing pages what ever sort order is used but the out of stock items are always shown at the bottom. edit the /include/fun/func.product.php //find if ( stripos($query,...
Mass Delete all customers for test server purposes in xcart 4
Create a file in /admin/ called delete_all_customers.adhoc.php and add the following to it. define('IS_MULTILANGUAGE', 1); require './auth.php'; require $xcart_dir.'/include/security.php'; x_load('backoffice'); $customers_sql = "select id from $sql_tbl[customers]...
Commenting out code using liquid in Shopify
In order to comment out the needed part of the code, put the {% comment %} tag before needed code and {% endcomment %} tag after it.
Using An SVG File For Your Shopify Store Logo
How to replace the png image with an svg logo on shopify
How to reset a linux mint user password after you have forgotten it
Reset your linux password
How to reset a wordpress admin password when you server will not send out the password reset email
Need to reset the admin password on wordpress directly in SQL?
Linking to a page when clicking a row using Tabulator
How to link to a new page using the value return in a row when clicked using Tabulator
How to clear down a log file on linux
if you need to clear down a log file on linux as it is getting too big. Rather than delete and allow the application to re-create it. You can use the following command which will not interupt the program using it. cat /dev/null > /path/to/logfile # to empty all the...
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