Error while using code from docs

Đang mở
#389 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
58/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
php
Lĩnh vực
documentation

Hướng nghiên cứu

Bắt đầu với phần “Step 3 “Create the carrier model”” trong tutorial Adobe Commerce được liên kết và so sánh các thuộc tính mẫu của phần này với Magento\Shipping\Model\Carrier\AbstractCarrier. Xác nhận lỗi PHP 8.3 và cập nhật các khai báo được ghi trong tài liệu để ví dụ khớp với lớp cha. Hoàn tất khi tutorial không còn tạo ra các lỗi typed-property đã được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Is there an existing issue for this?
  • I have searched the existing issues
Expected behavior

I have tried code from https://developer.adobe.com/commerce/php/tutorials/frontend/custom-checkout/add-shipping-carrier/#step-3-create-the-carrier-model

While testing with PHP 8.3.4 (cli) (built: Mar 16 2024 08:39:49) (NTS) it is throwing an error

"Fatal Error: 'Type of ---\Model\Carrier\Express::$_code must not be defined (as in class Magento\Shipping\Model\Carrier\AbstractCarrier)' in '.../Model/Carrier/Express.php' on line 18"

"Fatal Error: 'Type of ...\Model\Carrier\Express::$_isFixed must not be defined (as in class Magento\Shipping\Model\Carrier\AbstractCarrier)' in '.../Model/Carrier/Express.php' on line 18"

Should be fixed in docs.

Actual behavior

It should be corrected

protected string $_code = 'expressdelivery';

protected bool $_isFixed = true;

protected $_code = 'expressdelivery';

protected $_isFixed = true;

Steps to reproduce

Create custom module from https://developer.adobe.com/commerce/php/tutorials/frontend/custom-checkout/add-shipping-carrier/#step-3-create-the-carrier-model

Run coomands
Go to cart or checkout

Environment
  • Browser:Chrome
  • OS:Linux
Sample code

protected string $_code = 'expressdelivery';

protected bool $_isFixed = true;

protected $_code = 'expressdelivery';

protected $_isFixed = true;

Logs

"Fatal Error: 'Type of ---\Model\Carrier\Express::$_code must not be defined (as in class Magento\Shipping\Model\Carrier\AbstractCarrier)' in '.../Model/Carrier/Express.php' on line 18"

"Fatal Error: 'Type of ...\Model\Carrier\Express::$_isFixed must not be defined (as in class Magento\Shipping\Model\Carrier\AbstractCarrier)' in '.../Model/Carrier/Express.php' on line 18"

Ngôn ngữ chính
JavaScript
Star
12
Fork
178
Merge trung bình
2 giờ 41 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AdobeDocs/commerce-php

Tất cả issue của AdobeDocs/commerce-php

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.