A past take home assignment for a job interview has me scratching my head…

Hey guys I just wanted to share with you some past job homework assignment, that really stumped me, I didn’t get the job but felt the need to share with you a very interesting problem that I still want to solve just for the fun of it:

• Create custom module for adding 10% off after 4th item in cart, not utilizing cart price rules

I found this method has way too many touchpoints:

https://belvg.com/blog/how-to-use-total-models-in-magento-2.html

it involves, showing discount in cart, checkout, invoice, and email templates, essentially dealing with extending classes, a ui component, and using knockout.

I find that absurd. If I want to alter a quote, I have to do all that in Magento?

Something tells me that method is outdated though. Perhaps someone can shed some light on this. I was thinking of a hacky way to implement this so my module wouldn’t have that many touch points:

why cant I just mock a coupon DiscountRule class with a plugin and just call it a day?

submitted by /u/detectretract
[link] [comments]

Need help please. Experience on average time required per week to manage a Magento shop (as a User)

A friend of mine runs a business manufacturing and selling frozen foods. They currently have a very very simple SaaS system for selling their products. They have expanded and this system is no longer suitable.

I have built them a Magento 2 platform. I tried to keep it simple with minimum modules, but they kept expanding their scope, so they now have a store with 11 modules (some purchased some custom built) which cover forward ordering, delivery management, SMS messaging, special payment gateways, auto emails, related products – all kinds of things. This is all fine and not where I am having an issue.

I am happy to manage the hardware/software but I have a full time job, so I cant manage the day to day management from the admin panel. I have explained to them that they need a member of staff to at least work part time every day managing the system. However they think an hour a week and pulling off their orders is more than enough time. I have given them simple books on using the admin interface and will train them, but they have not looked at this material.

This is where I could do with some help in explaining to them that the system needs time to be managed. They have;

  • 2 shops in 2 languages. Each shop has its own product catalogue with around 400 simple products

  • Over the 2 shops, they expect to process 400 orders a week

  • It is a food business so promotions, stocks, products will be changed fairly frequently

I know its very difficult to give an exact figure, but from your experience, roughly how long each week would they need to commit to maintaining the stores operation from the Admin interface?

submitted by /u/redditinchina
[link] [comments]

Setting up configurable products on M2.4.2

Hello M2 family. I am not able to wrap my head setting up configurable product for my store. I hope someone here might help.

Below are the setups:

I have an apparel A, with 4 different colours. Each colour has 3 different sizes. Each size belonging to the each colour has different quantities.

That is product A

Colors: white red blue Green

Sizes: L XL XXL, L XL XXL, L XL XXL, L XL XXL

Qty: 2 3 1, 4 9 12 , 10 4 20, 3 5 12

How do I set this up as a configurable product or what is the best option to use?

Also how do I display individual simple products, and clicking on it leads to configurable product?

Is it possible for each colour swatch select in the configure product displayed to show the product colour, and also switch the url to the respective colour?

What will be the best option for SEO purposes as well.

Cheers.

submitted by /u/figonju
[link] [comments]

Thanks Magento 1

I have been running an online store based on Magento 1 for the last ten years.

I switched to woocommerce instead of Magento 2 for several reasons but, anyway, I would like to share a big thank you to Magento as a product and to all the community.

I haven’t had any major issues during all this time and the store performed perfectly well.

Ten years is a lot of time for a web application and today web development is quite different but, again, Magento was an excellent choice and everything worked like a charm.

That’s it 🙂

submitted by /u/ubiquae
[link] [comments]

Bundling in Magento 2.1

I’ve hired a consultant to help our company with the upcoming Core Web Vitals change from Google. The first thing he suggested was bundling. I took that to my lead engineer, and he said that they had tried bundling in the past, but it broke the site. Apparently, Magento 2.1 doesn’t handle bundling very well, and after weeks of work they gave up on it.

As a product owner, I’m trying to be sympathetic to this viewpoint while balancing the idea that “well, if it breaks it, then implement the change and fix what breaks.”

Has anyone successfully implemented bundling in Magento 2.1? If so, were there any special tricks you had to employ to get that bundling to work in your store?

submitted by /u/mattdalorian
[link] [comments]

Uncaught TypeError: $.widget is not a function

My code :

define([ 'Magento_Customer/js/model/authentication-popup', 'Magento_Ui/js/modal/alert', 'Magento_Ui/js/modal/confirm', 'underscore', 'jquery/ui', 'jquery-ui-modules/core', 'jquery-ui-modules/widget', 'mage/decorate', 'mage/collapsible', 'mage/cookies', 'loader' ], function ($, authenticationPopup, customerData, alert, confirm, _) { 'use strict'; return function (widget) { $.widget('mage.sidebar', widget, { _updateItemQty: function (elem) { var itemId = elem.data('cart-item'); var btnplus = elem.data('btn-plus'); var btnminus = elem.data('btn-minus'); $('#cart-item-' + itemId + '-qty').trigger('processStart'); this._ajax(this.options.url.update, { 'item_id': itemId, 'item_qty': $('#cart-item-' + itemId + '-qty').val(), 'item_btn_plus': btnplus, 'item_btn_minus': btnminus, }, elem, this._updateItemQtyAfter); $('#cart-item-' + itemId + '-qty').trigger('processStop'); this._customerData(); }, /** * Update content after update qty * * @param {HTMLElement} elem */ _updateItemQtyAfter: function (elem) { var productData = this._getProductById(Number(elem.data('cart-item'))); if (!_.isUndefined(productData)) { $(document).trigger('ajax:updateCartItemQty'); if (window.location.href === this.shoppingCartUrl) { window.location.reload(false); } } this._hideItemButton(elem); }, _customerData : function () { var sections = ['cart']; customerData.invalidate(sections); customerData.reload(sections, true); } } ); return $.mage.sidebar; } }); 

Console Error 1 : https://snipboard.io/4NK3b5.jpg

Console Error 2 : https://snipboard.io/iqX8yF.jpg

Module : https://github.com/kirtinariya1/MinicartAjaxQtyIncrementDecrement

submitted by /u/aveeva7
[link] [comments]

firebase otp verification

So I was trying to use firebase OTP verification on phone no on my Magento store.
Here is the code

<script> // Your web app's Firebase configuration var firebaseConfig = { apiKey: "##############################", authDomain: "###########################", projectId: "#########################", storageBucket: "########################", messagingSenderId: "#################", appId: "#######################", measurementId: "#######################" }; // Initialize Firebase firebase.initializeApp(firebaseConfig); window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container', { 'size': 'normal', 'callback': function(response) { phoneAuth(); } } ); function phoneAuth() { //get the number var number=document.getElementById('number').value; //phone number authentication function of firebase //it takes two parameter first one is number,,,second one is recaptcha // firebase.auth().settings.appVerificationDisabledForTesting = true; firebase.auth().signInWithPhoneNumber(number,window.recaptchaVerifier).then(function (confirmationResult) { //s is in lowercase window.confirmationResult=confirmationResult; coderesult=confirmationResult; console.log(coderesult); alert("Message sent"); }).catch(function (error) { alert(error.message); }); } function codeverify() { var code=document.getElementById('verificationCode').value; coderesult.confirm(code).then(function (result) { alert("Successfully registered"); var user=result.user; console.log(user); }).catch(function (error) { alert(error.message); }); } </script> <script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-app.js" src_type="url"></script> <script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-auth.js" src_type="url"></script> <form> <input type="text" id="number" placeholder="+91********"> <div id="recaptcha-container"></div> <button type="button" onclick="phoneAuth();">SendCode</button> </form><br> <h1>Enter Verification code</h1> <form> <input type="text" id="verificationCode" placeholder="Enter verification code"> <button type="button" onclick="codeverify();">Verify code</button> </form> 

So this code is working fine in isolated environment but when I integrated this into my page. It’s not working. I am little confused that where thing going wrong. All scripts are loading fine.

submitted by /u/LiveAlbatross619
[link] [comments]

How to include ajax loader

How to add https://devdocs.magento.com/guides/v2.4/javascript-dev-guide/widgets/widget_loader.html ajax loader to my script,

define([ 'jquery', 'Magento_Customer/js/model/authentication-popup', 'Magento_Customer/js/customer-data', 'Magento_Ui/js/modal/alert', 'Magento_Ui/js/modal/confirm', 'underscore', 'jquery/ui', 'mage/decorate', 'mage/collapsible', 'mage/cookies' ], function ($, authenticationPopup, customerData, alert, confirm, _) { 'use strict'; return function (widget) { $.widget('mage.sidebar', widget, { _updateItemQty: function (elem) { var itemId = elem.data('cart-item'); var btnplus = elem.data('btn-plus'); var btnminus = elem.data('btn-minus'); this._ajax(this.options.url.update, { 'item_id': itemId, 'item_qty': $('#cart-item-' + itemId + '-qty').val(), 'item_btn_plus': btnplus, 'item_btn_minus': btnminus }, elem, this._updateItemQtyAfter); this._customerData(); }, /** * Update content after update qty * * @param {HTMLElement} elem */ _updateItemQtyAfter: function (elem) { var productData = this._getProductById(Number(elem.data('cart-item'))); if (!_.isUndefined(productData)) { $(document).trigger('ajax:updateCartItemQty'); if (window.location.href === this.shoppingCartUrl) { window.location.reload(false); } } this._hideItemButton(elem); }, _customerData : function () { var sections = ['cart']; customerData.invalidate(sections); customerData.reload(sections, true); } }); return $.mage.sidebar; } }); 

Thanks.

submitted by /u/aveeva7
[link] [comments]