Magento

Enable MySQL query logging in Magento 2

You’re probably aware of the fact that Magento is a very heavy application. It is especially hard on database, and performs a lot of queries in order to function properly (which it does not a lot of times, unfortunately). Sooner or later, a need will arise for you to check what queries are being performed on the page. Either you’re hunting for the slow ones, or are trying to optimize their number. There is a simple way to have this working.

Change Magento 2 admin url

If you’re like me, you probably just fly through the Magento 2 installation, without actually reading anything. Usually, this is not an issue (especially if you’ve done it several times), but recently Magento has an addition with creating an administration url.

Reindex manually in Magento 2

Maybe you’ve noticed that Magento 2 does not allow you to reindex data from the administration side. Additionally, there is no script called ‘indexer.php’ or something like that, that you would usually call. How do you reindex manually then? Use magento command line tool:

Create a coupon page in Magento

Wouldn’t it be great if you could show all your coupons to customers on one page? This way they would know where to search for the coupons, and coupons would come from a reliable source - you. Also, you could advertise this page and get more customers to sign up because, well, you offer coupons only for registered customers. ^^ How would we go about doing something like this?

X-Cart to Magento: Customers

At times there is a need to switch the eCommerce platform you are working on. Reasons for this can be numerous. Your existing platform might be outdated, might be without any future improvements coming up, you might have heard great things about some other platform or simply you are not satisfied with the way your current platform works and behaves. Nevertheless, you’ve decided to do the switch. It is not an easy task to do because, in almost every case, platforms are not compatible with each other and in order to keep all of the data from previous platform (like your customers, orders, reviews etc.), some changes have to be performed on the data.

Add custom attributes to magento SOAP API v1 and v2

Sometimes a need arises for you to add additional attributes to the standard Magento API responses. While doing this in Mageno API v1 is fairly easy, as you will see soon, the v2 has some quirks that had to be found out the hard way, unfortunately. So in order for this to not happen again, here is the explanation. I will assume you already have your API roles set up, and you can invoke Magento API and get responses.

Block caching in Magento

Everyone knows what a caching is, but to put it simply, it is a mechanism to store (save) data that is frequently accessed but rarely changed in order to have a faster response time.

Show products on transactional emails in magento

One of the requirements from clients will likely be to change transactional emails. Whether they want to add some styling or add new informations, you will have to change the default emails. Sometimes the requirement involves showing products on emails, to increase marketing and in extend revenue.

Add fee or discount to order/invoice/creditmemo email messages

In the last few days I have been playing with the functionality of adding another fee to the checkout process. While exploring the topic I stumbled upon a lot of good tutorials for doing exactly that. Namely this, and this one. I read them and followed instructions stated there. With some changes, I managed to recreate the functionality I needed. But, while reading the comments for both articles, I saw the main trouble people had with them. The part about showing the fee or discount in email messages of orders, invoices and credit memos was missing (or not implemented), so here is how i did it.

Change reward message in magento

Reward messages in magento are not coming from database. They are not coming from configuration in admin. They are not set in blocks nor templates. So where are they then?

Search in this category functionality - Magento

Magento search query, when entered in the form.mini.phtml (template/catalogsearch/form.mini.phtml) is doing the search on database in Mage_CatalogSearch_Model_Layer:prepareProductCollection().

Sublime Text 2 environment for Magento development

Recently I got a new job (my first real one, actually), and it is revolving around PHP, i.e. Magento development. Before my first day at the job, I was wondering what kind of IDE or text editor should I use and what kind of one my future co-workers use. I emailed them and the response was just as I expected it to be: “full fledged IDEs like eclipse, netbeans or phpStorm”. I have had a lot of previous experience with those environments, mostly doing Java programming, and I was aware of all the bloat they bring. They were slow most of the time, they were laggy and pretty much uneasy to work with. Sure, that was the case on my own machine which is not really a “state of the art”, and I am sure they perform better on more powerful computers.

Back to Top ↑

PHP

PHP Generator

Just a regular function, which yields things (but can return them sometimes as well).

Stream large video file in Symfony

Streaming a large video file from your Symfony application is an interesting problem. We need to be able to serve data to the client continuously, as well as make sure memory footprint on server is not causing issues. Let’s take a look at a simple approach to solving this.

Output buffering

One of those weird function calls we see when reading internal code for majority of frameworks. ob_start() and ob_end_flush() may have caused some confusion, but no more. The thing is fairly straightforward.

Set up Xdebug 3 in vscode

Xdebug 3 has some major differences in configuration, when compared to older versions. I’m showing how to set it up on your dockerized environment.

X-Cart to Magento: Customers

At times there is a need to switch the eCommerce platform you are working on. Reasons for this can be numerous. Your existing platform might be outdated, might be without any future improvements coming up, you might have heard great things about some other platform or simply you are not satisfied with the way your current platform works and behaves. Nevertheless, you’ve decided to do the switch. It is not an easy task to do because, in almost every case, platforms are not compatible with each other and in order to keep all of the data from previous platform (like your customers, orders, reviews etc.), some changes have to be performed on the data.

Add custom attributes to magento SOAP API v1 and v2

Sometimes a need arises for you to add additional attributes to the standard Magento API responses. While doing this in Mageno API v1 is fairly easy, as you will see soon, the v2 has some quirks that had to be found out the hard way, unfortunately. So in order for this to not happen again, here is the explanation. I will assume you already have your API roles set up, and you can invoke Magento API and get responses.

Block caching in Magento

Everyone knows what a caching is, but to put it simply, it is a mechanism to store (save) data that is frequently accessed but rarely changed in order to have a faster response time.

Show products on transactional emails in magento

One of the requirements from clients will likely be to change transactional emails. Whether they want to add some styling or add new informations, you will have to change the default emails. Sometimes the requirement involves showing products on emails, to increase marketing and in extend revenue.

Add fee or discount to order/invoice/creditmemo email messages

In the last few days I have been playing with the functionality of adding another fee to the checkout process. While exploring the topic I stumbled upon a lot of good tutorials for doing exactly that. Namely this, and this one. I read them and followed instructions stated there. With some changes, I managed to recreate the functionality I needed. But, while reading the comments for both articles, I saw the main trouble people had with them. The part about showing the fee or discount in email messages of orders, invoices and credit memos was missing (or not implemented), so here is how i did it.

Search in this category functionality - Magento

Magento search query, when entered in the form.mini.phtml (template/catalogsearch/form.mini.phtml) is doing the search on database in Mage_CatalogSearch_Model_Layer:prepareProductCollection().

Sublime Text 2 environment for Magento development

Recently I got a new job (my first real one, actually), and it is revolving around PHP, i.e. Magento development. Before my first day at the job, I was wondering what kind of IDE or text editor should I use and what kind of one my future co-workers use. I emailed them and the response was just as I expected it to be: “full fledged IDEs like eclipse, netbeans or phpStorm”. I have had a lot of previous experience with those environments, mostly doing Java programming, and I was aware of all the bloat they bring. They were slow most of the time, they were laggy and pretty much uneasy to work with. Sure, that was the case on my own machine which is not really a “state of the art”, and I am sure they perform better on more powerful computers.

Back to Top ↑

linux

Set up Xdebug 3 in vscode

Xdebug 3 has some major differences in configuration, when compared to older versions. I’m showing how to set it up on your dockerized environment.

Bitcoinj dev - generate address and receive funds

Introduction

Bitcoinj is a library designed specifically to interact with Bitcoin network. You can use it to interact with real bitcoin blockchain, or play around in TestNet - bitcoin’s testing network. It allows us to do some pretty cool stuff. This post (and hopefully a series of them) is my way of trying to learn more about bitcoin, and its inner workings by using this library. For starters, I’d like to focus on simple tasks - creating a wallet, an address, and receiving some funds to it. This introduction assumes you’ll be able to download the library, and include it into Java project, either using Maven, or manually. Either way is fine.

Short introduction to ssh-copy-id and ssh config files

When you’re working on many different servers, you might get tired of constantly looking for an IP address, or a password to log in. This makes the whole process very tiring.. Ctrl+R on linux can be helpful if you remember a part of the hostname, but remembering the password is almost impossible - of course if you use a secure one.

Quickly zip or tar a git project

There are times when you need to zip your project, either for backup or whatever. You can always use tar or zip commands. But if you use git as a version control, there is a very simple way to achieve this.

Back to Top ↑

Bitcoin

bitcoinjs-lib in Meteor.js

If you want to use bitcoinjs-lib in Meteor js, try out this package: https://atmospherejs.com/ca333/bitcoinjs add it via: meteor add ca333:bitcoinjs

Bitcoin for the masses: Bitcoin Address

You know what an email address is? I’m sure you do.. It’s a string of letters (and numbers) in a certain format (eg. with an @ symbol), that serves as your identification and also as a pointer as to where the message you’re sending should go. Bitcoin’s address is very similar, only instead of sending the message to it, you’re sending a different kind of information - Bitcoin.

Bitcoin for the masses (series of posts)

Recently, my interest in large proportions switched to Bitcoin both from financial and technical standpoint. I’ve been reading a lot on the topic (be it books, forums, reddit discussions, youtube videos, various conference talks etc.). One thing I noticed, and it has been noted many times by many people (and very influential ones) in Bitcoin community, is the difficulty of “getting” the Bitcoin, and understanding what it is from the standpoint of a “regular” human - Homo Domesticus .

Back to Top ↑

Ruby

String manipulation in Ruby

Strings in Ruby are, just like in other programming languages, objects for handling text. If you ever tried to write some Ruby code, you are familiar with them and their syntax. But this post is not about syntax that is well known. While reading through some ruby books and tutorials I found some pretty interesting ways of dealing with strings.

Ruby memoization

I’ve been going through Ruby Best Practices book lately and, while it covers a lot of interesting topics, one thing caught my eye. It was sub-chapter about memoization.

Memoization is an optimization technique used to speed up your programs by avoiding to repeat function calls for already calculated inputs.

Back to Top ↑

javascript

bitcoinjs-lib in Meteor.js

If you want to use bitcoinjs-lib in Meteor js, try out this package: https://atmospherejs.com/ca333/bitcoinjs add it via: meteor add ca333:bitcoinjs

Make immutable objects in javascript

Cool thing I ran into when watching Douglas Crockford’s talk on Javascript: the good parts was a different way of creating objects, with lot more options than usual way I was doing it. More specifically, I found it interesting to see that we can set certain properties as non-writeable ie. immutable.

Back to Top ↑

emberjs

Simple markdown editor in Ember.js

Recently I have been playing with Ember.js. It is a javascript front-end framework for developing web applications. You can find more details and really thorough guides on their website. As my new blog post, I have decided to create a tutorial for building a simple markdown editor (in ember). Markdown, for those unaware of it, is a simple, lightweight markup language. I use it a lot for my github readme pages. While there are several great applications for editing markdown in real time out there, I thought it would be a good exercise to create one of my own, and since this is really easy to do in ember, I am showing it as a simple tutorial.

Back to Top ↑

Hadoop

Sum of even and odd numbers in Hadoop

I have been reading about Hadoop in the last few weeks. I went through few books and articles, and wanted to try a more hands-on approach. So, while googling for examples I noticed that there is only one real simple example for Hadoop - Word count. This one is pretty easy, but it would not be really interesting to write another article about it. So, my example will be to count the sum of even and odd numbers in a file.

Back to Top ↑

Java

Sum of even and odd numbers in Hadoop

I have been reading about Hadoop in the last few weeks. I went through few books and articles, and wanted to try a more hands-on approach. So, while googling for examples I noticed that there is only one real simple example for Hadoop - Word count. This one is pretty easy, but it would not be really interesting to write another article about it. So, my example will be to count the sum of even and odd numbers in a file.

Back to Top ↑

Apache

Back to Top ↑

mysql

Enable MySQL query logging in Magento 2

You’re probably aware of the fact that Magento is a very heavy application. It is especially hard on database, and performs a lot of queries in order to function properly (which it does not a lot of times, unfortunately). Sooner or later, a need will arise for you to check what queries are being performed on the page. Either you’re hunting for the slow ones, or are trying to optimize their number. There is a simple way to have this working.

Back to Top ↑

python

Watching the GPT hypetrain

It feels like everyone in tech circles is talking about this, and even non-tech people got interested, and joined on the fun. ChatGPT - the man of the hour.

Back to Top ↑

Symfony

Stream large video file in Symfony

Streaming a large video file from your Symfony application is an interesting problem. We need to be able to serve data to the client continuously, as well as make sure memory footprint on server is not causing issues. Let’s take a look at a simple approach to solving this.

Back to Top ↑