Coding

Excel: Format Utf8, Delemiter, separate

Excel: Format Utf8, Delemiter, separate

1) Ctr+ N to create a new file   2) Click on tab data then choose "From text" right below, choose your file (csv, excel, ...)   Choose Format Utf8, then click on next button choose Delimiter = comma, ... depend on you file.

Read more

Fixing a MySQL Character Encoding Mismatch

Fixing a MySQL Character Encoding Mismatch

  Export the data as Latin-1. Because MySQL knows that the table is already using a Latin-1 encoding, it will do a straight export of the data without trying to convert the data to another character set. If you try to export as UTF-8, MySQL appears to attempt to convert the (supposedly) Latin-1 data to...

Read more

MySQL doesn't starts on AMPPS OS X

MySQL doesn't starts on AMPPS OS X

  Open AMPPS Application -> MySQL Tab -> Configuration. In [mysqld] section, add the following line: innodb_force_recovery = 1 Save the file and try starting MySQL Remove that line which you just added and Save.  

Read more

Magento: Delete all Product Images

Magento: Delete all Product Images

<?php require_once "YOURMAGENTODIR/app/Mage.php"; umask(0); Mage::app('admin'); Mage::setIsDeveloperMode(true);   $productCollection=Mage::getResourceModel('catalog/product_collection'); foreach($productCollection as $product){ echo $product->getId(); echo "<br/>";  ...

Read more

Bootstrap 3 Media Queries

Bootstrap 3 Media Queries

/*==========  Mobile First Method  ==========*/   /* Custom, iPhone Retina */  @media only screen and (min-width : 320px) {   }   /* Extra Small Devices, Phones */  @media only screen and (min-width : 480px) {   }   /* Small Devices, Tablets */ @media only screen...

Read more

Magento: Unable to Apply Catalog Price Rules for huze amount of data in Magento

Magento: Unable to Apply Catalog Price Rules for huze amount of data in Magento

If you want to apply particular rule than you cna do it like below:   <?php      $catalogPriceRule = Mage::getModel('catalogrule/rule')->load(7);     $catalogPriceRule->applyAll(); ?> Or if you want to appyall rules than you can do like below:   <?php  ...

Read more

Magento: Swatch images on Magmi imported products removed when viewing product

Magento: Swatch images on Magmi imported products removed when viewing product

You can solve the problem like this :   Rewrite the model class Mage_Catalog_Model_Resource_Product_Attribute_Backend_Media in your own module and modify loadGallery() function like this   public function loadGallery($product,$object)  {     ...     //$this->_removeDuplicates($result);...

Read more

How to search all loaded scripts in Chrome Developer Tools?

How to search all loaded scripts in Chrome Developer Tools?

 Open a new Search pane in Developer Tools by: pressing Ctrl+Shift+F (Cmd+Option+F on mac) clicking the overflow menu (⋮) in DevTools,  clicking the overflow menu in the Console (⋮) and choosing the Search option You can search across all your scripts with support for regular...

Read more

Magento: How to create a custom grid from scratch

Magento: How to create a custom grid from scratch

We received a request from a client where they wanted to implement an expanded order grid while still keeping the default Magento’s one. For this example we’ll create a new module named Inchoo Orders.     Step 1.   Create new module in etc/modules called Inchoo_Orders.xml   <?xml...

Read more

Magento: How to get tax rate for particular country in magento?

Magento: How to get tax rate for particular country in magento?

The following code will:   Load a customer address and get the country id e.g. "US" or "DE" Load a collection of all tax rates for that given country Note that $customer_id should be a relevant customer id and you could use the current logged in customer. Also note that getDefaultBillingAddress...

Read more

Log Prestashop

Log Prestashop

Logger::addLog('ok', 1);

Read more

Magento: How to import multiple coupons in Magento from a CSV

Magento: How to import multiple coupons in Magento from a CSV

 A customer asked how to import product into Magento from a nice CSV. There is an easy trick that solves this matter. We found code on the internet and modified it to import using a percentage. Upload the CSV to your server in the same folder as the script.   Here is the template for the CSV coupon import.     is_active,coupon_code,description,discount_amount 1,1c5e8b24,serie1...

Read more

Magento Sort By Best Seller In Toolbar.

Magento Sort By Best Seller In Toolbar.

Hi, this is my solution sorting by saleability.   I chaneged in code/local/Mage/Catalog/Block/Product/List/Toolbar.php method setCollection to   public function setCollection($collection) { parent::setCollection($collection); if ($this->getCurrentOrder()) { if($this->getCurrentOrder() == ‘saleability’)...

Read more

Magento: Enable template path hint in admin pages

Magento: Enable template path hint in admin pages

open /app/etc/local.xml and add the follow code <config>       ...       <websites>         <admin>             <dev>                 <debug>      ...

Read more

Magento: not use oAuth on Magento's REST API?

Magento: not use oAuth on Magento's REST API?

Make sure you have an Admin User Type role under: System -> Web Services -> REST - Roles. If not, add a new role and specify your desired Role API Rsources. Make sure you have full right for REST Attributes under: System -> Web Services -> REST - Attributes for the Admin User Type. Trick Magento Auth Model...

Read more

Magento: How to create Magento invoice from order

Magento: How to create Magento invoice from order

Maybe you want to create an invoice from some custom script or through cron script. Here is one very useful example of code. First of all, we have to load some order over model “sales/order”, this is very easy.   $order = Mage::getModel("sales/order")->load($order_id) // $order_id is entity_id...

Read more

Magento: How To Reset admin password

Magento: How To Reset admin password

Open up phpMyAdmin by accessing your site's cPanel. Click on your database name for Magento from the sidebar on the left. Click on the SQL tab and type the following in to the text box:   UPDATE `admin_user` SET `password` = MD5('PASSWORD') WHERE `username` = 'USERNAME';   You'll want to replace the...

Read more

Magento: export database without log tables

Magento: export database without log tables

We can use  --ignore-table to exclude tables from a database when exporting  mysqldump -u root -p'123456' db_name --ignore-table=db_name.log_quote --ignore-table=db_name.log_customer --ignore-table=db_name.log_summary_type --ignore-table=db_name.log_url --ignore-table=db_name.log_url_info --ignore-table=db_name.log_visitor...

Read more

Magento: Change status of order

Magento: Change status of order

$order = Mage::getModel('sales/order')->loadByIncrementID(100000012); $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save(); $order->setStatus('preorder', true); $order->save();

Read more

Magento: Add custom attribute to customer address then use it when creating order in Magento

Magento: Add custom attribute to customer address then use it when creating order in Magento

 In Magento, one customer has 2 default address, one for billing and one for shipping address. The information seem to fit most general address over the world. However, in some countries, the address structure is more complicated   Here is default attributes for customer's address     Default...

Read more

Magento Dataflow Export/Import form the command line

Magento Dataflow Export/Import form the command line

 <?php //THIS SCRIPT JUST INITIALS THE PROFILE TO BE RUN VIA MAGENTO ADMIN "RUN PROFILE IN POPUP". Its the same thing as click just via this file that you can run via cron $profileId = 8; // SYSTEM - IMPORT/EXPORT - ADVANCED PROFILES <-- you need to go into your magento admin and grab the exact...

Read more

Magento – current store currency details

Magento – current store currency details

// store currency code eg. USD, INR $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();   // store currency symbol eg. $ $currency_symbol = Mage::app()->getLocale()->currency( $currency_code )->getSymbol();   // store currency name eg. Indian Rupee $currency_name = Mage::app()->getLocale()->currency(...

Read more

Prestashop: Install Yotpo Star Rating on Product Category Pages on a Prestashop Shop

Prestashop: Install Yotpo Star Rating on Product Category Pages on a Prestashop Shop

 The Yotpo Star Rating presents an aggregated star rating for your products. Presented in a category page, it will show the aggregated star ratings for products that have been reviewed.   To install Star Rating, please follow these steps:     1. Locate the file product-list.tpl. This is found in...

Read more

Prestashop: Module Block Contact Infos On One Line

Prestashop: Module Block Contact Infos On One Line

Replace whole blockcontactinfos.tpl in /modules or themes/#current theme#/modules with:     <!-- MODULE Block contact infos --> <section id="block_contact_infos" class="block "> <button id="contactNavButton" class="hidden nav-button">{l s='Contact...

Read more

Magento: How to Clean up magento cache and log table

Magento: How to Clean up magento cache and log table

 Create a file called cleanup.php and add the following code to it:       <?php switch($_GET['clean']) {     case 'log':         clean_log_tables();     break;     case 'var':         clean_var_directory();    ...

Read more

Magento: the “global” tag in Magento “config.xml” file?

Magento:  the “global” tag in Magento “config.xml” file?

  require 'app/Mage.php'; Mage::app();   $global = Mage::getConfig()->getNode('global');   foreach ($global->children() as $node) {     echo $node->getName(), PHP_EOL; }   ?></pre>

Read more

Magento: Unassign simple products from a configurable product

Magento: Unassign simple products from a configurable product

There are 2 ways to Unassign simple products from a configurable product:  <?php /* * Unassign simple products from a configurable product */ require_once 'abstract.php'; class Mage_Shell_Unassign extends Mage_Shell_Abstract {     public function run()     {        ...

Read more

truncate string css

truncate string css

.truncate {     text-overflow: ellipsis;     white-space: nowrap;     overflow: hidden; }

Read more

How to import a specific table in to mysql database using command line

How to import a specific table in to mysql database using command line

 In command line mysql -u username -p databasename < path/example.sql put your table in example.sql I) Import / Export for single table: Export table schema mysqldump -u username -p databasename tableName > path/example.sql This will create a file named example.sql at the...

Read more

Magento: Reduce size of database

Magento: Reduce size of database

SET FOREIGN_KEY_CHECKS=0; truncate table sales_flat_quote_address; truncate table sales_flat_quote; truncate table log_customer; truncate table log_quote; truncate table log_summary; truncate table log_summary_type; truncate table log_url; truncate table log_url_info; truncate table log_visitor; truncate table...

Read more

Magento: Delete multi products quickly

Magento: Delete multi products quickly

The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted.     <?php require_once 'abstract.php'; class Mage_Shell_removal extends Mage_Shell_Abstract {     public function run()     {      ...

Read more

Magento: Delete All Products Using PhpMyAdmin

Magento: Delete All Products Using PhpMyAdmin

 A quick way to do this would be thru phpmyadmin.   Before running this code please make sure you have a backup of the entire database.   This code worked fine on magento 1.9.3.2   Copy and paste this code @ phpmyadmin under SQL tab and run it.       SET FOREIGN_KEY_CHECKS =...

Read more

SASS: Referencing parent selectors using the ampersand character

SASS: Referencing parent selectors using the ampersand character

 Referencing parent selectors by using the ampersand (&) can be a powerful tool, if used right. There are simple uses of this feature as well as some very complex uses of this feature. In this post we will cover the basic uses of the ampersand (&) as well as link you to a post by Joel Oliveira that goes much...

Read more

Magento: Controller URL construction and redirection

Magento: Controller URL construction and redirection

 Constructing the controller url. In a controller or block, you can just use $this->getUrl($url)     Mage::getUrl('module/controller/action');//Example url pattern Mage::getUrl('helloworld/index/index');//hellow world index page Mage::getUrl('checkout/cart');//checkout cart index page Redirecting...

Read more

Magento: Add Terms and Conditions Checkbox during Checkout

Magento: Add Terms and Conditions Checkbox during Checkout

 Requiring customers to accept an eCommerce site’s terms and conditions before placing an order is becoming a common practice.  From the perspective of a store owner, this is often the most effective way to get customers to acknowledge their site’s shipping, return, and other policies.  Also,...

Read more

Magento: Recoverable Error: Argument 1 passed to Mage_Core_Model_Store :: setWebsite() must be an instance of Mage_Core_Model_Website

Magento: Recoverable Error: Argument 1 passed to Mage_Core_Model_Store :: setWebsite() must be an instance of Mage_Core_Model_Website

It looks like that this problems appears most of users. There are some recommended fix too:   1: Delete following file:   app/etc/use_cache.ser   2: Update database with following query:   SET FOREIGN_KEY_CHECKS=0; UPDATE `core_store` SET store_id = 0 WHERE code='admin'; UPDATE `core_store_group`...

Read more

Magento: limit product categories to only three levels

Magento: limit product categories to only three levels

There is an admin setting called System -> Configuration -> Catalog -> Category Top Navigation -> Maximal Depth, which is only available in global scope.

Read more

How to auto-complete PHP code in Vim

How to auto-complete PHP code in Vim

 Vim is able to auto-complete syntax for some of the most popular programming languages, but it's not enabled by default. While in command mode, enter the following :set omnifunc=phpcomplete#CompletePHP To start using PHP auto completion, press the Ctrl + x followed by Ctrl + o keys while...

Read more

How to auto-complete CSS syntax in Vim

How to auto-complete CSS syntax in Vim

 Being the language used in website designs, is one of the language supported by Vim's auto-complete feature. To start using the feature, enter the following while in Vim's command mode. :set omnifunc=csscomplete#CompleteCSS That will enable CSS auto-completion in Vim. To use it, press Ctrl...

Read more

Cách lấy lại mật khẩu admin cho wordpres

Cách lấy lại mật khẩu admin cho wordpres

Đôi khi bạn quên mất mật khẩu tài khoản admin cho wordpress do bạn không nhớ hoặc vì một ai đó đã thay đổi mật khẩu admin wordpress của bạn và cách reset password qua email cũng không hoạt động.Vậy phải làm sao để lấy lại password của mình. Hãy cùng Thủ...

Read more

Default To The Numeric, Email, And URL Keyboards On The iPhone

Default To The Numeric, Email, And URL Keyboards On The iPhone

<form>           Type="Number":<br />         <input type="number" /><br />         <br />           Type="Url":<br />         <input...

Read more

Vim: Quickly change word or line

Vim: Quickly change word or line

To quickly change a word you can use cw,caw or ciw. Use c$ or just C to quickly change from the cursor to the end of a line, cc to change an entire line, or cis for a sentence.   The standard change word command requires you to type cw, then a new word, then press Escape. Using the version below, you would type pw,...

Read more

Notepad++: How to use ending linux.

Notepad++:  How to use ending linux.

 System > preferences > New Document > Format > Line ending linux (use linux has a content smaller)

Read more

HTTP Error on Media Upload

HTTP Error on Media Upload

Solved : On our AWS instance using NGINX, we had to adjust "client_max_body_size". in /etc/nginx/nginx.conf The default "client_max_body_size" on NGINX is 1MB. We added: client_max_body_size 10m; and restarted NGINX.

Read more

Configurate VIM

Configurate VIM

I) Default 1) Default 1 tab = 4 spacing : :set tabstop=4 shiftwidth=4 expandtab 2) change color themce : colorscheme slate 3) to see line-endings :set list :set nolist to go back to normal. While I don't think you can see n or rn in vi, you can see which type of file it is (UNIX, DOS, etc.) to infer which line...

Read more

OpenCart : How to reset Admin Password

OpenCart : How to reset  Admin Password

If you've forgot your admin password for OpenCart, you can reset the password in the database. You'll have to use phpMyAdmin in cPanel to change the password to the admin account. Since you'll be resetting the password to something easy like "password" it's very important to make sure once you are logged in to...

Read more

Fix error of Adaptive images on nginx

Fix error of Adaptive images on nginx

Note: Add this code outside of location / {} if ($request_filename !~* ai-cache){rewrite .(?:jpe?g|gif|png)$ /adaptive-images.php last;}For More detail please reach this link: http://adaptive-images.com/

Read more

Magento SKUs not working in basic search

Magento SKUs not working in basic search

it's catalogsearch_fulltext. Magento fills this table during partial and full reindex of "Catalog Search" index.   I think the problem is in the attribute's settings. Go to Admin Panel -> Catalog -> Attributes -> Manage attributes -> (chose SKU attribute) -> Use in Quick Search -> Value...

Read more

git-stash Manual Page

git-stash Manual Page

  NAME git-stash - Stash the changes in a dirty working directory away SYNOPSIS git stash list [<options>] git stash show [<stash>] git stash drop [-q|--quiet] [<stash>] git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>] git stash branch <branchname> [<stash>] git...

Read more

Onepage Checkout - Get current payment method

Onepage Checkout - Get current payment method

$paymentMethod = Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance()->getCode();

Read more