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
Category
magento2
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