magento2 – Change the product grid view to a specific number of columns

The default number of columns is 3. How do I change them in 2? I prefer a solution that uses the administrator, but I will settle for any solution. I reviewed the Magento User Guide at www.magento.com/help/documentation. I use Magento (Commerce) ver. 2.3.0.

I have tried:
On the Custom Design tab for a category, enter this code in the Custom Layout Update box:


2

It had no effect.

magento2 – Magento 2 – Auth.net Sandbox is not working

Using Magento 2.2.4 – I have activated the payment method Auth.net Direct Post, applied the Magento Auth.net patch and with the configuration:

Gateway URL:

https://test.authorize.net/gateway/transact.dll

Transaction Details URL:

https://apitest.authorize.net/xml/v1/request.api

I see the transactions in the auth.net sandbox payment.log:

(TESTMODE) This transaction has been approved

but an error is thrown on the Magento page:

Please enter a transaction ID to authorize this payment

I have tried with activated and deactivated test mode. How can I do it right?

magento2 – Error creating a custom console command in Magento 2

I'll create a console command to enter values ​​into the database. There is an argument that lacks an error. I have gone through several tutorials, but for me code looks fine. The error is:

Not enough arguments (missing: "Credit, Amount has been credited").

Here is the console class:

Use Symfony  Component  Console  Command  Command.
Use Symfony  Component  Console  Input  InputArgument.
Use Symfony  Component  Console  Input  InputInterface.
Use Symfony  Component  Console  Output  OutputInterface.
Use Vendor  Module  Model  AmountFactory.

Class AddItem extends Command
{
const INPUT_KEY_ACTION = & # 39; credit & # 39 ;;
const INPUT_KEY_REFERENCE = & # 39; Amount has been credited & # 39 ;;
// const INPUT_KEY_AMOUNT = 50;

private $ amountFactory;

public function __construct (AmountFactory $ amountFactory)
{

$ this-> amountFactory = $ amountFactory;
parent :: __ construct ();

}

protected function configure ()
{

$ this-> setName (example: Credit: Refund & # 39;)
-> addArgument (
self :: INPUT_KEY_ACTION,
InputArgument :: REQUIRED,
& # 39; Action Name & # 39;
) -> addArgument (
self :: INPUT_KEY_REFERENCE,
InputArgument :: REQUIRED,
& # 39; Action Reference & # 39;
);
// $ this-> setDescription (# demo console command & # 39;);

parent :: configure ();
}
execute protected function (InputInterface $ input, OutputInterface $ output)
{
$ amount = $ this-> amountFactory-> create ();
$ amount-> setAction ($ input-> getArgument (self :: INPUT_KEY_ACTION));
$ amount-> setReference ($ input-> getArgument (self :: INPUT_KEY_REFERENCE));
// $ amount-> setAmount ($ input-> getArgument (self :: INPUT_KEY_AMOUNT));
$ amount-> setIsObjectNew (true);
$ amount-> save ();
return Cli :: RETURN_SUCCESS;
}
}

In di.xml:


   
       
           Vendor  Module  Console  Command  AddItem
       
   

If I comment out lines for a third argument, d. H. The amount, I get an error message

The argument "50" does not exist.

Can someone help find out this mistake? Many Thanks

magento2 – pull data from orders with a nonzero subtotal for each customer

I want the number of orders each customer has placed. Only orders whose subtotal is not zero should be counted. How can I get this data. Please let me know if we can use an SQL query

I have retrieved data by query, but all orders are counted while I only want orders with a nonzero value

$ sql_results = "SELECT
CONCAT (FORMAT (SUM (sales_flat_order.`grand_total`), 2)) AS & # 39; Lifetime_Sales & # 39 ;,
COUNT (sales_flat_order.entity_id) AS & # 39; Orders & # 39 ;,
customer_entity.email AS & # 39; Email & # 39 ;,
customer_entity_varchar.value AS & # 39; name & # 39 ;,
customer_address_entity_varchar.value AS & # 39; Mobile & # 39;
FROM `customer_entity`
LEFT JOIN sales_flat_order ON customer_entity.entity_id = sales_flat_order.customer_id
LEFT JOIN customer_entity_varchar ON customer_entity.entity_id = customer_entity_varchar.entity_id
LEFT JOIN customer_address_entity ON customer_entity.entity_id = customer_address_entity.parent_id
LEFT JOIN customer_address_entity_varchar ON customer_address_entity.entity_id = customer_address_entity_varchar.entity_id
WHERE customer_entity_varchar.attribute_id = 986 AND customer_address_entity_varchar.attribute_id = 17
GROUP BY customer_entity.entity_id
ORDER BY SUM (sales_flat_order.`grand_total`) DESC
LIMIT 10000 OFFSET 0 ";

magento2 – How come the order number in ShipWorks is displayed incorrectly?

I followed this QA method to adjust the order number on my recent Magento 2.3.1 migration. When ShipWorks downloads the orders, they still start at 1,

The ShipWorks support team has called you back and they are feeling this order number Field for order numbers and not increment_id, which is known to be the order number in human language. Once I test the effectiveness of updating the sales_order I'll post a response to the table's auto_increment primary key.

magento2 – Order failed after entering another billing address. Magento 2

• The counterfeit information can not be verified yet because you can not place an order with a different billing address
• It looks like Magento is trying to enter the first and last name of the billing address (we never had the option of entering another name). Is this a Magento error? If Magento, can we disable it? If not, can we always have the name = the delivery name … and just not display it? Error message: Please check whether the information on the billing address first name is a mandatory field. Last name is a required field.

I appreciated your help very much.

magento2 – Best Practices / Methods to Add 100,000 Products in Magento 2?

I have to add 100,000 products by the end of this week. Most of them are simple products, but 30% are configurable products, each with 8 simple products, totaling 100,000 item numbers.

I've used Magmi (in Mage 1), which worked pretty well importing CSV files, but without updated version for Mage 2, most people seem to use the default import feature in admin. But is there a better extension that store owners use? I did some searching without luck, hoping to find a direction.

Is it ever recommended to add products programmatically? I'd rather go that way, since I'm good at PHP, but a little new to Magento. Can experienced shop owners / developers give me advice on how best to add 100,000 products, based on best practices? Many Thanks

magento2 – Initiate an SMS at sales_order_shipment_track_save_after via Shipstation

I'm trying to set up a custom trigger for Shipstation to send a text message over Twilio when restoring. I've got it working if I add a tracking number from the admin page, but it does not seem to work if I add a tracking number via Shipstation (assuming Magento's API is used). Is there another event that I should listen to?

etc / events.xml

    

    

Namespace MyWebsite  Customizations  Model  Observer;

Use Magento  Framework  Event  Observer.
Use Magento  Framework  Event  ObserverInterface.
Use Magento  Sales  Api  Data  ShipmentInterface.
Use Magento  Sales  Api  Data  ShipmentTrackInterface.
Use Magento  Framework  Exception  CouldNotSaveException.
Use Magento  Framework  Exception  NoSuchEntityException.
Use Twilio  Rest  Client.

/ **
* Class shipping
* /
Class TextShipment implements ObserverInterface
{
protected $ _logger;

public function __construct ( Psr  Log  LoggerInterface $ logger) {
$ this -> _ logger = $ logger;
}

/ **
*
* @param observer $ observer
* @return void
* /
public function execute (observer $ observer)
{
$ track = $ observer-> getTrack ();
$ shipment = $ track-> getShipment ();
$ order = $ shipment-> getOrder ();
$ shippingAddress = $ order-> getShippingAddress ();
$ telephone = $ this-> makePhoneNumberValid ($ shippingAddress-> getTelephone ());
$ trackUrl = $ this-> getTrackingUrl ($ track);
$ countryId = $ shippingAddress-> getCountryId ();
$ firstName = $ shippingAddress-> getFirstname ();

$ initialGreeting = & # 39; & # 39 ;;

if ($ firstName == & # 39; & # 39 ;|| $ firstName == null) {
$ initialGreeting = & # 39; Hello  Customer of the Year! & # 39 ;;
}otherwise{
$ initialGreeting = & # 39; Hi & # 39 ;. $ firstName. & # 39 ;! & # 39 ;;
}

$ objectManager =  Magento  Framework  App  ObjectManager :: getInstance ();
// $ notifier = $ objectManager-> create (& # 39; Magento  Shipping  Model  ShipmentNotifier & # 39;);
// $ notifier-> notify ($ delivery);


if ($ countryId == "US" && $ telephone! = null && $ trackUrl! = & # 39; & # 39;) {
// your account SID and authentication token from https://www.twilio.com/console
$ accountSid = "";
$ authToken = "";

$ serviceSid = "";

// initialize client
$ client = new client ($ accountSid, $ authToken);

// $ this -> _ logger-> debug ($ telephone. & # 39; telenumber & # 39;);


// Create a notification
$ client-> messages-> create ()
// The number to which you want to send the message
& # 39; # 39 + 1 ;. $ Phone,
Array (
// A Twilio phone number purchased from twilio.com/console
& # 39; from & # 39; => & # 39; +& # 39 ;,
// The text of the text message you want to send
& # 39; body & # 39; => $ initialGreeting. Your MyWebsite order has been shipped !! You can follow it via the following link: & # 39 ;. $ trackUrl. & # 39 ;. It was our pleasure to serve you and we look forward to your return. With love, MyWebsite & # 39;
)
);
}

}

public function getTrackingUrl ($ track) {

$ trackurl = & # 39; & # 39 ;;
if ($ track-> getCarrierCode () === & # 39; fedex & # 39;) {
$ trackurl = & # 39; https: //www.fedex.com/apps/fedextrack/? action = track & trackingnumber = & # 39;; $ track-> getNumber ();
} elseif ($ track-> getCarrierCode () === & # 39; usps & # 39;) {
$ trackurl = & # 39; https: //tools.usps.com/go/TrackConfirmAction_input? qtc_tLabels1 = & # 39;; $ track-> getNumber ();
} elseif ($ track-> getCarrierCode () === & # 39; ups & # 39;) {
$ trackurl = & # 39; https: //wwwapps.ups.com/WebTracking/returnToDetails? tracknum = & # 39;; $ track-> getNumber ();
}
return $ trackurl;
}

public function makePhoneNumberValid ($ number) {
if ($ number == null) {
return $ number;
}


$ patterns = array ();
$ replacements = array ();

$ patterns[] = & # 39; / - / & # 39 ;;
$ patterns[] = & # 39; /  (/ & # 39 ;;
$ patterns[] = & # 39; / ) / & # 39 ;;
$ patterns[] = & # 39; /  + 01 / & # 39 ;;
$ patterns[] = & # 39; /  + 1 / & # 39 ;;
$ patterns[] = & # 39; / ^ $ / & # 39 ;;

for ($ i = 0; $ i <6; $ i ++) {
$ Replacement[] = & # 39; & # 39 ;;
}

$ number = preg_replace ($ patterns, $ replacements, $ number);

if ($ number == "0000000000") {
return zero;
}

return $ number;
}
}
......

magento2 – What is the least intrusive way to make tiny changes in 2.3.1?

While I was not bad with Magento 1, M2 has made such changes that I'm not sure where to start. And anyone who talks about "plugins" simply copies the developer's guide and inserts it, and no one gives an example or explains why or how.

What are the ways to make small improvements to the UI for these examples (extension or plugin or what is "an extension with a plugin"):

  1. The admin panel displays the bar asking you to refresh the cache. When I go to the page, she already knows which ones need updating, and I want to select them already.
  2. Remove the "Select All" option in drop-down lists?
  3. Change the name in the order and contact emails?
  4. Copy comment block in AdminHTML order page to checkout?

Everyone wants to create topics and great projects that are more about the smallest changes and effects on the code.