Skip to main content

Posts

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

Configuring php ini settings on magento

Depending on your hosting company, you may or may not be able to change the settings of the php. In that case, we have our custom php.ini file in magento. The php.ini file is location under the root of magento installation with the name of php.ini.sample. Open this file and make the necessary changes to php settings as shown below, ; This file is for CGI/FastCGI installations. ; Try copying it to php5.ini, if it doesn't work ; adjust memory limit memory_limit = 64M max_execution_time = 18000 ; disable magic quotes for php request vars magic_quotes_gpc = off ; disable automatic session start ; before autoload was initialized flag session.auto_start = off ; enable resulting html compression zlib.output_compression = on ; disable user agent verification to not break multiple image upload suhosin.session.cryptua = off ; turn off compatibility with PHP4 when dealing with objects   zend.ze1_compatibility_mode = off ; PHP for some reason ignores thi...