Recently I had to move a Magento 1.7 (if you are in a similar situation, please suggest to upgrade at least to Magento 1.9.X) website from a Linux server with SSH access to an hosting solution that has only FTP and a CPanel access. The first two parts are generic, the third is specific for … Continue Reading
Category
magento
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 … Continue Reading
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 … Continue Reading
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 … Continue Reading