Product option price error in Magento 1.9.4

REASON OF THE ERROR

Magento moved a Product.OptionsPrice class constructor from varien/product.js to varien/product_options.js.

Also, they added this file to the product page via layouts:

app\design\frontend\rwd\default\layout\catalog.xml

app\design\frontend\base\default\layout\catalog.xml

<action method=”addJs”>varien/product_options.js</action>

As a result, after you update your Magento version, product.js file does not include code with Product.OptionsPrice initialization any more.

HOW TO FIX THE ERROR

Therecommend the following workflow:

  1. go to app\design\frontend\yourpackage\yourtheme\layout\catalog.xml
  2. find <catalog_product_view translate=”label”> section, and
  3. insert <action method=”addJs”>varien/product_options.js</action> …… after this line: <action method=”addJs”>varien/product.js</action>

Don’t forget to flush Magento cache after these actions.

Ref: https://amasty.com/blog/product-optionsprice-error-magento-1-9-3-1-fix/

Sequel Pro error when importing database

When I was trying to import an external database to setup my local working environment in Sequel Pro, I often get this ‘file read error’: 

An error occurred when reading the file, as it could not be read in the encoding you selected (Autodetect – Unicode (UTF-8)).

Solution:

To solve this issue, need to delete all the tables and try again with encoding ‘Western: Mac OS Roman’. As like the picture below.

phpBB: localhost redirects to my live site

To test on localhost with an existing database, you must also change the database table ‘config’.

config_name         config_value (from)       config_value (to)
"cookie_domain";    "example.com"             "localhost url"
"server_name";      "www.example.com"         "localhost url"
"server_protocol"   "https://"                "http://"
"site_home_url"     "https://www.example.com/" "http://localhost url/"
"script_path"       "/"                        "/"

Also need to change the config.php from root.

<?php
// phpBB 3.0.x auto-generated configuration file
// Do not change anything in this file!
$dbms = 'mysql';
$dbhost = 'localhost';
$dbport = '';
$dbname = 'REMOVED';
$dbuser = 'REMOVED';
$dbpasswd = 'REMOVED';
$table_prefix = 'phpbb_';
$acm_type = 'file';
$load_extensions = '';

@define('PHPBB_INSTALLED', true);
@define('DEBUG', true);
@define('DEBUG_EXTRA', true);
?>

How to install Composer on MacOS

There is some ways to install it. I will describe the way with Brew.

If you don’t have a brew, let’s do the followings…

It’s very easy to install brew. You have to run only your terminal and paste this code:

Step1 Install brew:

/usr/bin/ruby \
-e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

What does that code do here ?
1. Get script from https://raw.githubusercontent.com/Homebrew/install/master/install
2. Do it by using ruby

Step2 Install Composer:

brew install composer

Step3 check the version:

composer –version

Ref Link:

https://pilsniak.com/install-composer-mac-os/

Switch branch and ignore any changes without committing

Following is the way to do this:

git stash save
git checkout branch
// do something
git checkout oldbranch
git stash pop

Indeed what it says (to be complete):
git stash save OR git stash (when in working branchY)
then git checkout branchX do something on branchX such as git add/commit -m etc.
git checkout branchY again and
git stash pop to get back the stash

Reference:

https://stackoverflow.com/questions/1304626/git-switch-branch-and-ignore-any-changes-without-committing

How to undo ‘git add’ before commit on git ?

We can undo git add before commit with the following command ..

git reset

Which will remove it from the current index (the “about to be committed” list) without changing anything else.

We can also use

git reset

without any file name to unstage all due changes. This can come in handy when there are too many files to be listed one by one in a reasonable amount of time.

Reference:
https://stackoverflow.com/questions/348170/how-to-undo-git-add-before-commit

The way to search through posts by ID in WordPress admin panel

Here we can do it ….

Please add the following code in your functions.php file.


add_action( 'parse_request', 'idsearch' );
function idsearch( $wp ) {
global $pagenow;

// If it's not the post listing return
if( 'edit.php' != $pagenow )
return;

// If it's not a search return
if( !isset( $wp->query_vars['s'] ) )
return;

// If it's a search but there's no prefix, return
if( '#' != substr( $wp->query_vars['s'], 0, 1 ) )
return;

// Validate the numeric value
$id = absint( substr( $wp->query_vars['s'], 1 ) );
if( !$id )
return; // Return if no ID, absint returns 0 for invalid values

// If we reach here, all criteria is fulfilled, unset search and select by ID instead
unset( $wp->query_vars['s'] );
$wp->query_vars['p'] = $id;
}

All you then do is search using the regular search box using a #(hash) prefix infront of the numeric ID.

#123

..would return the post with an ID of 123.

Ref: https://wordpress.stackexchange.com/questions/9276/search-posts-by-id-in-admin