Tag Archives: Magento

How to add translations to my custom validation

I have added my own custom validations, with a JS mixin, like: validator.addRule( ‘validate-jurgis’, function (value) { if (value.match(/d/)) {return false;} else {return true;} }, $.mage.__(‘Address should contain a house number’) ); How do I add translations to the message?

Knowing “simple” products are related via REST API

I am doing a search via the REST API, looking for products with a certain color and a certain name: http://127.0.0.1/index.php/rest/V1/products/?searchCriteria[filter_groups][0][filters][0][field]=color&searchCriteria[filter_groups][0][filters][0][value]=49&searchCriteria[filter_groups][0][filters][0][condition_type]=eq&searchCriteria[filter_groups][1][filters][0][field]=name&searchCriteria[filter_groups][1][filters][0][value]=hero%25&searchCriteria[filter_groups][1][filters][0][condition_type]=like This returns the products I am expecting. It is returning all the variant that match the search to. For example (using the magento sample data), I get: Hero Hoodie-XS-Black Hero Hoodie-S-Black Hero Hoodie-MS-Black These… Read More »

Adding category to body element on product page

I can find examples of how to display the current product category through using the Object Manager, and I have found ways of adding a class to the body element via the XML. Is there a way to combine these two so I can inject the current category as an html class in my body… Read More »

Ajax cart with option magento 1.9.3.x

I have a script in js for add product with ajax in cart and updated mini-cart. This work good for simple all product, but when i have options on the product or a configurable product, it also adds it to the cart without any verification. Here is my script, can you tell me where I… Read More »