Magento

Hỏi và đáp cho người dùng nền tảng thương mại điện tử Magento

1
Các bài kiểm tra tĩnh kiểm tra là gì?
Sau khi xây dựng mô-đun của tôi, tôi đã thử chạy bin/magento dev:tests:run static. Điều này đã báo cáo một vài vấn đề với mã của tôi, nhưng tôi không chắc chính xác những gì được kiểm tra khi chạy thử nghiệm này. Các tài liệu chính thức nói Phân …

3
Cấu hình hệ thống Đa mặc định tất cả đã chọn
Tôi có một trường cấu hình hệ thống loại multiselect sẽ được điền bằng catalog/product_attribute_collection. Đây là một phần của system.xmlđịnh nghĩa nó. <attributes> <label>Choose Attributes to JSONize</label> <frontend_type>multiselect</frontend_type> <sort_order>3</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> <source_model>package_module/system_config_attributes</source_model> </attributes> Bây giờ tôi muốn tất cả các giá trị trong multiselect được chọn theo mặc …

5
di chuyển mã tệp .js bên ngoài của mô-đun sang tệp mẫu [phtml]
Chúng tôi có một mô-đun tùy chỉnh với mã dưới đây app/design/frontend/rwd/Theme1/layout/aitcg.xml <action method="addJs"><script>aitoc/aitcg/Aitcg/View/Abstract.js</script></action> Vì chúng ta không thể sử dụng mã php trong tệp .JS này , có cách nào để chúng ta có thể di chuyển mã hiện diện từ Abstract.jstệp này sang .phtmltệp khác không? Biên tập …

2
loại hằng số di.xml so với init_parameter
Tôi thấy trong các di.xmltệp từ lõi có một số đối số có kiểu init_parameternhưng các giá trị của các tham số đều là hằng số. <type name="Magento\Framework\View\Page\Config\Renderer"> <arguments> <argument name="appMode" xsi:type="init_parameter">Magento\Framework\App\State::PARAM_MODE</argument> </arguments> </type> hoặc cái này <type name="Magento\Framework\App\Cache\State"> <arguments> <argument name="banAll" xsi:type="init_parameter">Magento\Framework\App\Cache\State::PARAM_BAN_CACHE</argument> </arguments> </type> và nhiều người khác. Nhưng …
8 magento2  di 




2
Magento 2: cách khác nhau có được lĩnh vực của một bộ sưu tập
Tôi có lớp người trợ giúp này trong Magento 2: class Data extends \Magento\Framework\App\Helper\AbstractHelper { protected $_countryFactory; public function __construct( \Magento\Directory\Model\CountryFactory $countryFactory ) { $this->_countryFactory = $countryFactory; } public function getCountryIsoCode($country = 'US') { $country = $this->_countryFactory->create()->getCollection(); $country->addFieldToFilter('country_id', array('eq' => country)); $countryCode = $country->getFirstItem()->getIso3Code()); $countryCode2 = $country->getFirstItem()->getData('iso3_code')); // $countryCode => …

2
Magento 2: Nhận đường dẫn tệp pub / static
Tôi cần lấy tệp PATH cho một hình ảnh trong pub/static/[VENDOR_THEME]thư mục. Hiện tại, tôi có thể làm điều này bằng cách sử dụng một trình trợ giúp: public function __construct( \Magento\Framework\App\Helper\Context $context, \Magento\Framework\View\Asset\Repository $assetRepository, \Magento\Framework\App\Filesystem\DirectoryList $directoryList ) { parent::__construct($context); $this->_assetRepo = $assetRepository; $this->_directoryList = $directoryList; } public function getImagePath($image) …
8 magento2  paths 

5
Xóa tập tin phiên Magento
Thư mục var / session liên tục lưu trữ dữ liệu rất lớn gây ra sự cố sử dụng dữ liệu lớn trên máy chủ, mỗi khi tôi xóa các tập tin từ thư mục phiên sử dụng innode giảm xuống mức tối thiểu. vì vậy tôi muốn hỏi làm …

2
Magento 2: Ngoại lệ của trình quan sát sự kiện không hiển thị trên màn hình
Trong phần mở rộng tùy chỉnh, tôi tạo người quan sát như thế này. app\code\Vendor\Extension\etc\frontend\events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="sales_quote_remove_item"> <observer name="sales_quote_remove_item_handler" instance="Vendor\Extension\Observer\RemovecartbeforeObserver" shared="false" /> </event> </config> Và người quan sát của tôi: app\code\Vendor\Extension\Observer\RemovecartbeforeObserver.php use Magento\Framework\Event\ObserverInterface; class RemovecartbeforeObserver implements ObserverInterface { public function execute(\Magento\Framework\Event\Observer $observer) { // HERE …


2
Cách hiển thị swatches trên trang chủ Magento 2
Tôi có hai sản phẩm thanh trượt (dựa trên \Magento\Catalog\Block\Product\Widget\NewWidget) trên trang chủ của tôi. Tôi muốn thêm swatches vào các thanh trượt sản phẩm. Các thanh trượt được thêm vào trong bố cục trang chủ của tôi như dưới đây: <container name="items.wrapper.slider" after="full.width.white.bar" htmlTag="div" htmlClass="wrapper wrapper--large c-catalog__products--slider-wrapper"> <block class="Silvan\TestExtension\Block\Product\Widget\NewWidget" …



Khi sử dụng trang web của chúng tôi, bạn xác nhận rằng bạn đã đọc và hiểu Chính sách cookieChính sách bảo mật của chúng tôi.
Licensed under cc by-sa 3.0 with attribution required.