Skip to main content

Posts

Showing posts from 2017

Using SSH for reindexing

We can perform reindex via SSH in magento. It is faster and shows the error log.  But at first, we need the SSH access of the web hosting. We can connect to SSH by using SSH client like putty.exe. Steps: 1. Login to SSH using the credentials provided.  2. Go to the magento installation directory. 3. Go to shell folder. 4. Run the following command:     php indexer.php --reindexall or we can reindex one at a time.     php indexer.php --reindex catalog_product_price to know the status of the reindex    php indexer.php --status for help, we can run:    php indexer.php help

Codeigniter MSSQL connection

We can connect the Microsoft SQL Server 2008 R2 rdbms to php with codeigniter framework. For that we need to install sqlsrv driver on our server.  SqlSrv is a php driver for MS SQL  and is available from Microsoft: » http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx. For earlier version of php before  5.3 , the Mssql driver was needed.  The Mssql extension is not available anymore on Windows with PHP 5.3 or later. After we have sqlsrv driver extension added on server, we can check it on our phpinfo page. The sqlsrv should be there. We may need to install the odbc driver too depending on our system configuration. If there is a problem with connecting sql server database, we can debug to know the error. Then we need to add the following configuration on our database configuration file. $db['default'] = array( 'dsn' => '', 'hostname' => '.\sqlexpress', 'username' => '',

OpenCart - How to change url to seo friendly

If we want to make the default url of opencart to seo friendly, we need to modify seo_url.php controller. Firstly, backup your file. Then, in seo_url.php controller, replace the code with below: 1. edit controller/common/seo_url.php <?php class ControllerCommonSeoUrl extends Controller {    public function index() {       // Add rewrite to url class       if ($this->config->get('config_seo_url')) {          $this->url->addRewrite($this);       }           // Decode URL       if (isset($this->request->get['_route_'])) {          $parts = explode('/', $this->request->get['_route_']);          $route = "";                  foreach ($parts as $part) {             $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");                       if ($query->num_rows) {            

Compiling and Transpiling

Compiling is the general term for taking source code written in one language and transforming into another language. Transpiling is a specific term for taking source code written in one language and transforming into another language that has a similar level of abstraction. It is a specific kind of compiling. So when we compile C#, your method bodies are transformed by the compiler into IL. This cannot be called transpiling because the two languages are very different levels of abstraction. When you compile TypeScript, it is transformed by the compiler into JavaScript. These are very similar levels of abstraction, so you could call this transpiling. Both compilers and transpilers can optimise the code as part of the process. Other examples of transpiling include C++ to C, CoffeeScript to JavaScript, SASS/LESS to CSS, PHP to C++ etc.

Maintenance mode

Sometimes we need to make update on live running site. We may have to update module, add new module or update changes. Updating the magento site can be risky when the site is running live. So, the solution is to temporarily put the site in maintenance mode and do the necessary changes. In magento, we can put the site in maintenance mode by adding the 'maintenance.flag' file at the root of the site. Now, when we browse the site, we will see the screen as shown below: We can also update the look and content of the above page. For that, we need to update the content of 503.phtml page found at 'errors/default/' folder at root. The header and footer template can be found at 'errors/default/page.phtml'. After we make the changes, we have to remove the maintenace.flag file from the root. Then the site will be live again.

Working out with blocks and layouts in magento 2

Page layout declares the wireframe of a page inside the <body> section, for example one-column layout or two-column layout. The allowed layout instructions are:  <container>  <referenceContainer>  <move>  <update> If we want to include a additional template file in home page, we can do it by adding the following layout update at cms design layout update section at admin. <referenceContainer name="footer">     <block class="Magento\Framework\View\Element\Template" name="nameofblock" template="Magento_Theme::template_name.phtml"/> </referenceContainer> Here we are including "template_name.phtml" at footer container section. The phtml template file should be under the templates folder of the module of our theme. Here the template is inside the module "Magento_Theme" under our theme. If we want to include the template from static blocks section at admin, add the

Magento webservice

Magento provides webservice with the ability to manage your eCommerce stores by providing calls for working with resources such as customers, categories, products, and sales orders. It also allows you to manage shopping carts and inventory. A SOAP v2 API version has been available since Magento 1.3, and a WS-I compliant version has been available since Magento 1.6. The Magento API supports SOAP and XML-RPC, where SOAP is the default protocol. With SOAP api, To connect to Magento SOAP web services, load the WSDL into your SOAP client from either of these URLs: http://hostname/api/soap/?wsdl where hostname  is the domain for your Magento host As of v1.3, you may also use the following URL to access the Magento API v2, which has been added to improve compatibility with Java and .NET: http://magentohost/api/v2_soap?wsdl=1 The following PHP example shows how to make SOAP calls to the Magento API v1: require_once('app/Mage.php'); Mage::app(); try { $client = n

Suspected Fraud orders in magento

Magento orders paid via paypal, eway or any other payment gateway, sometimes mark the orders as Suspected Fraud. The Suspected Fraud status is assigned to state "Payment Review". This means the order doesnot have invoice issued and the confirmation email is also not sent. We cannot create the invoice for it either. The Suspected Fraud status is assigned to order because of exchange rates or tax rounding. For example, the amount of money which Paypal charges the customer is out by 1p compared to the amount of money that Magento thinks should have been charged. When Paypal tells Magento that the order has been paid and how much money has been paid, Magento sees this difference and marks it as Suspected Fraud. The solution is to update the state of the Suspected Fraud status to "processing" instead of "payment review". For this, go to magento admin panel and to System -> Order Statuses section. There you can see the list of Order Statuses and the S

Magento 2 insight

What's new in magento 2