Lorenzo Sfarra - News

Tech stuff, funny stuff, good stuff, hot stuff....stuff.
Jul 0
Jul 0

PCI Compliance made simple

Are you trying to understand if your server has to be PCI compliant? Are you reading some docs around and the more you read, the more you are confused? Here’s some very simple and short tips for PCI compliance, according to Braintree and SecurityMetrics sources (you should check with your payment gateway / Qualified Security […]

  Read more
Jun 0
Jun 0

Magento2 API: get product details by ID or URL key

So, you are using the Magento2 APIs and you need to access a product. The core API forces you to access product by its SKU: GET /V1/products/:sku Sometimes you need to access a product by its ID, or by its URL key. Let’s see how we can create two simple APIs to perform this task. First […]

  Read more
May 0
May 0

Magento2 database transactions: how to save multiple model instances

Sometimes in your logic you have to save different model instances at once. Magento1 already had the concept of transaction, using the classic singleton model: Mage::getModel(‘core/resource_transaction’) Magento2 has its concept of transaction, too, so let’s see with a simple example how to use this feature. Let’s say we have a DB table ‘table’ described as […]

  Read more
Mar 0
Mar 0

Magento2 Rest APIs: add a bundle to cart

Yeah, with Magento2 it’s hard even to perform some common tasks. Here’s how to add a bundle to an existent cart. Let’s assume that our bundle has bundle01 as its SKU. First of all, we need to get some info that we are going to pass as parameters later. GET /products/bundle01?searchCriteria Here, we need to take […]

  Read more
Jan 0
Jan 0

How to make Selenium2 work for Mac OS X with Firefox Nightly and Python

This is one of the shortest articles ever, almost nothing to explain here. First, install Selenium2 through easy_install sudo easy_install selenium Then, simply go to the /Applications directory and create a symbolic link, because selenium looks for the Firefox binary in a  specific path: $ cd /Applications $ sudo ln -s FirefoxNightly.app Firefox.app   Time […]

  Read more
Dec 0
Dec 0

Check user’s location, client side without libraries and registrations

Why The article can be: “Do it server-side.“. But sometimes it’s not possible, so, how we can do it?   If you need something accurate and you cannot use server-side solutions, you can use libraries like GeoIP or of course Yahoo!/Google APIs. Let’s see two simple approaches using two different services, we just use JQuery […]

  Read more