Tricky question about custom dispatch event

So, I have this observer which is giving me customer object on customer_save_after event like this:

$customer = $observer->getEvent()->getCustomer(); 

On this object I getDataModel(), setCustomAttribute, updateData and save like this:

$customerData = $customer->getDataModel();
$customerData->setCustomAttribute(‘myattributename’, $myattributevalue); $customer->updateData($customerData); $customer->save();

As said, this is working fine when I observecustomer_save_after

I need this complete logic in a custom event. I’m dispatching my custom event in an after Plugin like this

public function afterAddCustomer()
{
$this->eventManager->dispatch(
‘custom_customer_save_after’,
[‘customer’ => $this]
);
}

The event is triggered but the problem is that either the $observer->getEvent()->getCustomer(); already is not available or the getDataModel(); (I’m not exactly sure on that).

getDataModel() should be available in: https://www.magentoextensions.org/documentation/interface_magento_1_1_customer_1_1_api_1_1_data_1_1_attribute_metadata_interface.html

Anyway, I think, I have a basic misunderstanding about dispatching custom events. I think what I’m missing is the option to pass along the data which I need, don’t I?

Could anybody explain the concept behind custom events and also how to fix my problem?

Any help is highly appreciated. Thanks a lot

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

Add foreach loop in knockout

I am using the following condition and its print one value,

if(self.options.nearestlocationsBlock) { var firstStore = _.first(locations.items); var newContent = '<div class="store"> <div class="zipcode">'+firstStore.address+','+firstStore.city+','+firstStore.state+','+firstStore.zip+'</div></div>'; self.storeListIdentifier.html(newContent); } 

I want to print the next three values, how to do that?

eg: I am print first value, i want to print next three values in second condition, how to do that?

Workout:

I am trying following script, its return but keep page loading,

if(self.options.nearestlocationsBlock) { var firstStore = locations.items; firstStore.foreach(function(firstStore){ var newContent = '<div class="store"> <div class="zipcode">'+firstStore.address+','+firstStore.city+','+firstStore.state+','+firstStore.zip+'</div></div>'; self.storeListIdentifier.html(newContent); }); 

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

Product SKUs and updates

Hello everyone!

I have a question regarding product updates. Every 6 months, we receive massive spreadsheets with products from our supplier. Some of these suppliers alter product names and some do not even include SKUs for simple products. Hence, I have to manually create products SKUs for the missing ones.

When I receive the new product sets, I have to update all the products and so it becomes difficult since I cannot match the SKUs. Note that in the new product sets, old products are also included. My boss is always worried about losing the url connected to the former product when the update is made.

Has anyone faced a similar situation and if so, what has been your approach to solving this?

Can it be that I am missing something as well?

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

Could not open input file: bin/magento

In the root@….:/var/www/html/magento240 I am running following command: php bin/magento setup:install –base-url=”http://127.0.0.1/magento240/” –db-host=”localhost” –db-name=”magento240″ –db-user=”root” –db-password=”2014″ –admin-firstname=”mage” –admin-lastname=”comp” –admin-email=”[email protected]” –admin-user=”admin” –admin-password=”admin@123″ –language=”en_US” –currency=”USD” –timezone=”America/Chicago” –use-rewrites=”1″ –backend-frontname=”admin”

But I am always getting this error:

Could not open input file: bin/magento

I am using Ubuntu 20.4 and fulfill all perquisites. What am I doing wrong? (127.0.0.1 is running)

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

How to set action attribute in form with custom function in controller file.

My title can be confusing so I will try to explain my problem. I have made a function(saveData()) in controller file to get the data from template file and insert it into table. So I wanna ask how can I call this function when form gets submitted through action attribute.

Template file path – app/code/company_name/module/view/frontend/templates/form1.phtml

Controller file – app/code/company_name/module/Controller/Index/Form1.php

Please ask if you find this confusing.

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

Shopping Cart Price Rules problem

Greetings everyone. I would like to ask if anyone can help me with the following issue:

I work at a liquor store with an online store and we would like to ccreate a mix and match list for selected wine SKUs so that if someone buys :

*any 6 to 11 of the selected category bottles then they get 10% off

*any 12 or more of the selected category bottles then they get 15% off

I have created one rule that is as follows:

Conditions: Shipping country is my native country (ALL conditions TRUE)

Actions: Apply percent of product price discount

Discount Amount 10%

Maximum Qty Discount is Applied To 0

Discount Qty Step (Buy X) 0

Apply to Shipping Amount NO

Free Shipping For shipment with matching items

Stop Further Rules Processing NO

If ALL of these conditions are TRUE :

  • Quantity in cart equals or greater than 6
  • Quantity in cart less than 12
  • SKU is one of 30-00-201-06-13 , 30-00-201-05…

with all the codes in the category in that field

Same for 12 bottles or more with the following difference

  • Quantity in cart equals or greater than 12

My first logical error resides in choosing “is one of” in SKU field.

Any help with that?

Thanks in advance

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

AD0-E700 aka Magento 2 Solution Specialist exam

Good day community,

I’d like to ask you If anyone happened to study or pass Magento 2 certified solution specialist test aka Adobe Certified Expert Magento Commerce Business Practitioner (AD0-E700)?

Please see few questions:

  1. What is the learning scope of the AD0-E700 in terms of hours if starting from scratch?

  1. There is provided content in the official article (Exam Objectives and Scope) divided into 5 learning sections. Are all exam questions will be strictly limited up to the provided content?

  1. I will study only from provided content material for around ~150 hours will it be enough?

  1. Is it true that the test covers the commerce edition? That especially the B2B part with sandbox is a must?

Any other experience related to taking the exam, preparation mode would be much appreciated.

Cheers

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

Magento 2.4 Local Setup for Plugin Development?

Hi guys. I’m a little desperate as PHP and Magento is not my strongest suit but is currently required as part of my R&D work. I have dabbled with extension development last year for Magento 2.3 (? if my memory serves me correct) and I was able to install Magento 2.3 on my local machine.

However, I have read that 2.4 deprecated several search engines and is now requiring me to setup ElasticSearch by default. When I tried this, I noticed that my machine’s resource usage just shot up. I can barely use my machine for any other work.

Any tips on what your setup is like? Below are the specs of my machine at the moment.

  • 12GB RAM
  • Intel Core i7
  • 512GB SSD / 1TB HDD

Thanks.

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

Toggle prices option and save as cookie

Hi /r/magento,

I’m wondering if there’s a way to let users toggle (show/hide) prices by clicking a button and save the setting to a cookie.

I was playing around with jquery toggle() and save it in localStorage. It kind of works but with a lot of drawbacks. E.g. the price is shown for a few milliseconds when I refresh the page and sometimes it does not even work at all (I think because of Ajax and / or caching).

That’s why I’m looking for a different approach. Any help would be highly appreciated.

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

Magento Checkout customization

Hi, I have a checkout layout with a phtml file. It’s a static file with a new design for the checkout. I have to integrate checkout entirely. Right now my problem is the shipping and billing address. It’s the same as the default Magento but with a new design. Having only a phtml file, I don’t know how to integrate the data to this billing and shipping address using the default Magento way. I think I only have to call the js file in that. I did that but it didn’t help me at all. Please, I am losing my hope here. Help me out if u are available. I need to complete this asap. I don’t know what else to add.

submitted by /u/Outside-Blood-5389
[link] [comments]