Getting subtotal and grand total in Observer

hey everyone, i’m trying to save the price/subtotal/grandtotal in a custom log file after order is placed using checkout_onepage_controller_success_action

my observer file right now can only get the Product Price, how would i get the other 2 aswell?

<?php namespace CDigitalOrderLogObserver; use MagentoFrameworkEventObserverInterface; use MagentoFrameworkAppRequestDataPersistorInterface; use MagentoFrameworkAppObjectManager; use MagentoCaptchaObserverCaptchaStringResolver; class MyObserver implements ObserverInterface { public function execute(MagentoFrameworkEventObserver $observer) { $order = $observer->getEvent()->getOrder(); $writer = new Zend_Log_Writer_Stream(BP . '/var/log/order.log'); $logger = new Zend_Log(); $logger->addWriter($writer); foreach ($order->getAllItems() as $item) { $PPrice = number_format($item->getPrice(), 2); $logger->info(print_r("Product Price: " . $PPrice, true)); } return $this; } } 

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

Canonical Rewrite

Hi Guys,

I am looking for a canonical rewrite in Magento2 update. But unable to find an exact solution. Is anyone expert in Magento SEO who can guide me for canonical rewrite tags? There are so many duplicate categories and sub-category pages available on my eCommerce site. I want to redirect them and as well as update the canonical tag.

​

Thanks in advance,

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

Recipe for creating subscriptions orders using only the API

Hi all,

I’m using Magedelight’s Subscription Now Pro to allow for recurring subscription orders but it’s cron based order processor has no sense of “bundling”. That is, if a single customer orders subscribes to two products at the same time (with the same frequency) two different subscription profiles are created (one for each product) and when the time comes to send, they’re treated as two separate orders with two separate shipping costs.

To get around this, I am considering creating my own processor that would be written in PHP but not leverage the Magento framework. It would directly read the subscriber table created by the Subscribe Now Pro plugin to identify items and order that need to be created. The “bundling” logic would be handled there. For creating the actual order I am looking at using the Rest APIs to create a cart on behalf of the customer, populate the cart with the products that need to be shipped, and then process the order. Payment for subscription items is handled via a reusable customer/payment token so requires no interaction with the customer.

I’m still fairly new to Magento so really just looking for a gut check here. Does this sound like a reasonable approach? Do you know of any existing code (github?) that has a demo of how to create an order on behalf of a customer? Is there an easier way?

Thanks!

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

Elastic Search Issues

Anyone else get recurring issues with Elastic Search crashing on the server?

Of course, when this falls over, it takes down a ton of things on the website.

We’ve no idea why this happens, we just get the error about no clusters found and then discover that the service is not running and requires restarting.

We encounter this problem on multiple server environments. Just wondering if this is more widespread and others are encountering the same (this is more aimed at developers who will know if ES is falling over).

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

PSA: Not all REST API endpoint adhere to the siteview scope in URL

TLDR: Not all REST API endpoints adhere to the siteview scope you can set in the URL. The Magento dev’s won’t fix this bug, but also do not specify which REST API endpoints are affected by this bug.

​

Long version:
A few weeks ago, we upgraded to Magento 2.4.3-p1. To our suprise, the bundle product API broke, causing problems with our options in different siteviews. Normally, you can specify which siteview the rest api call affects by passing the scope in the URL like so: `<HTTP verb> http://<host>/rest/<scope>/<endpoint>`. However, when you do this with the bundle options, only the scope you specify gets updated. The rest of the siteview **get their price set to 0**. This means you can never use the API to update the prices, because it will always leave 1 or more siteviews with prices of 0.

I created a issue regarding this problem, expecting it would be marked as bug and would be fixed. To my suprise, I had to explain multiple times what the issue was, on multiple test machines, and even record my testcase since they threw away my test setup twice…, only to hear that it was “expected behavior” and won’t be fixed. With no workaround to this, there is absolutely no possible way to update bundle products using the REST API without causing problems in other sideviews.

If you are a Magento API Consumer and you care about using this functionality, please show support on github to draw some more attention to this problem.

Github issue: https://github.com/magento/magento2/issues/35595

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

Looking for part time opportunities

Hi Reddit folks,

Looking for a hourly contract (up to 15 hours per week), would be grateful for any suggestions!

Send me DM to discuss your project.

https://www.linkedin.com/in/elevinskii/ – always glad to new contacts!

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

Does anyone have experience with Adobe Live Search?

I was all ready to start a contract with Klevu for my B2B 2.4.4 site, but our Adobe rep threw up his hands and told me to use Live Search because it’s part of our commerce contract. Live Search has only been around for about a year, though, and I’m worried there are too many unknowns.

Does anyone have experience working with Adobe Live Search? Did you run into any roadblocks along the way? Does it provide better or equal results to any SAAS options you might have used before?

Would love to hear any thoughts.

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

Bulk updating multi-select product attributes without clearing previous selections

Does anyone have a solution for bulk updating a multi-select attribute for products without wiping any attribute values that were selected already (which differs between products)…?

It seems to be a pretty big oversight to have not made this actually usable. The only way would be to select all products that you want to make identical… 🤷‍♂️

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

Vouchers, Discounts and rules not working

We’re always getting tickets about vouchers and discounts not working. 99/100 are not a “bug” but a misconfiguration.

The Magento/Adobe Commerce guides tell you how to functionally use them but not how to problem solve, what to watch out for or how to set up some common discount types.

So we did. I hope it’s useful to you and if there is something you think we should add I’d be well up for hearing what.

https://www.rixxo.com/catalogue-price-rules-cart-price-rules-in-magento/

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