magento2写日志 - mattqiu/m2 GitHub Wiki
Welcome to the m2 wiki!
获取库存
getProduct() ?> get('\Magento\CatalogInventory\Api\StockStateInterface'); $remain = $StockState->getStockQty($_product->getId(), $_product->getStore()->getWebsiteId()); ?>在搜索页面左侧显示产品分类
vendor/magento/module-catalog-search/view/frontend/layout/catalogsearch_result_index.xml加上
产品页面的分类加载的是vendor/magento/module-catalog/view/frontend/layout/catalog_category_view_type_default.xml复制过来即可
获取产品分类图片 $categoryId = 111; $_objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $category = $_objectManager->create('Magento\Catalog\Model\Category')->load($categoryId);
if ($_imgUrl = $category->getImageUrl()) {
$html .= '<img src="' . $_imgUrl . '" />';
}
写日志 protected function log($msg) { if (is_array($msg) || is_object($msg)) { $msg = print_r($msg, true); } $_objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $msg = '['.date('Y-m-d H:i:s').']: '.$msg.LINE.FILE."\n"; $directory = $_objectManager->get('\Magento\Framework\Filesystem\DirectoryList'); file_put_contents($directory->getPath('log').'/mattqiu.log', $msg, FILE_APPEND); }
忘记管理员密码 bin/magento admin:user:create
sudo bin/magento catalog:image:resize报错: libpng warning: Interlace handling should be turned on when using png_read_image 先执行find . -iname '*.png' -execdir convert {} -interlace none {} ;,然后再resize
商品详情页slider不显示大图 sudo vi vendor/magento/module-catalog/Block/Product//View/Gallery.php foreach ($this->getGalleryImagesConfig()->getItems() as $imageConfig) { $object_key = ($imageConfig->getData('data_object_key') == 'medium_image_url') ? 'large_image_url' : $imageConfig->getData('data_object_key');
$imageItem->setData(
$imageConfig->getData('json_object_key'),
$image->getData($object_key)
//$image->getData($imageConfig->getData('data_object_key'))
);
}
$imagesItems[] = $imageItem->toArray();
convert: /lib64/libjpeg.so.62: version `LIBJPEG_6.2' not found (required by /usr/lib64/libtiff.so.5) yum install libpng libpng-devel libtiff libtiff-devel libjpeg-turbo libjpeg-turbo-devel
/Users/instar/Downloads/www/m2/app/design/frontend/TemplateMonster/theme048/Magento_Theme/layout/default.xml
顶部右侧菜单
后台开启模板路径无效 Open vendor/magento/module-developer/Model/TemplateEngine/Plugin/DebugHints.php (tested in 2.3.2)
write this code inside afterCreate function : (at the start, above the storecode line)
if(isset($_GET['shreyasPathHints']) && $_GET['shreyasPathHints'] == 'on'){ return $this->debugHintsFactory->create([ 'subject' => $invocationResult, 'showBlockHints' => 1, ]); } Now, you can open any magento page and append ?shreyasPathHints=on to the url. No need to run any commands.
vendor/magento/framework/File/Uploader.php 上传图片报错
app/design/frontend/TemplateMonster/theme048/TemplateMonster_Blog/templates/widget/post_column.phtml footer上面三列
app/code/TemplateMonster/Parallax/view/frontend/templates/layers.phtml 三列上面的广告
顶部购物车数量加上括号app/design/frontend/TemplateMonster/theme048/Magento_Checkout/templates/cart/minicart.phtml
顶部搜索框 app/design/frontend/TemplateMonster/theme048/Magento_Search/templates/form.mini.phtml
产品widget报错 app/code/TemplateMonster/FeaturedProduct/Block/FeaturedProduct/Widget/Product.php
去掉商品详情页图片上面的字 sku改为article no:vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml
详情页显示in stock 改为显示产品库存 vendor/magento/module-catalog/view/frontend/templates/product/view/type/default.phtml
详情页价格 vendor/magento/module-catalog/view/base/templates/product/price/amount/default.phtml
Be the first to review this product app/design/frontend/TemplateMonster/theme048/Magento_Review/templates/helper/summary.phtml
商品列表页左侧调整 vendor/magento/module-catalog/view/frontend/templates/navigation/left.phtml
移除产品列表compare app/design/frontend/TemplateMonster/theme048/Magento_Catalog/templates/product/compare/sidebar.phtml
移除产品列表wish list app/design/frontend/TemplateMonster/theme048/Magento_Wishlist/templates/sidebar.phtml
移除产品列表PayPal logo 后台payment methods里面找到PayPal点击config,advance config里面的frontend experience settings的PayPal product logo由now accepting 150 X 60改为no logo
调整列表页中的商品 app/design/frontend/TemplateMonster/theme048/Magento_Catalog/templates/product/list.phtml
设置商品列表产品不显示描述,config,monster,theme options,category page,show description no
产品列表页商品图片跟上下的内边距调整 vendor/magento/module-catalog/view/frontend/templates/product/image_with_borders.phtml
去掉商品列表的product title app/design/frontend/TemplateMonster/theme048/Magento_Theme/templates/html/title.phtml
商品列表页修改页码样式 app/design/frontend/TemplateMonster/theme048/Magento_Theme/templates/html/pager.phtml
修改商品列表的分类样式 vendor/magento/module-catalog/view/frontend/templates/navigation/left.phtml
m2/vendor/magento/module-catalog/Block/Navigation.php
public function getStoreCategories($cid, $sorted = false, $asCollection = false, $toLoad = true) { return $this->_catalogCategory->getStoreCategories2($cid, $sorted , $asCollection, $toLoad); }
vendor/magento/module-catalog/Helper/Category.php
public function getStoreCategories2($parent, $sorted = false, $asCollection = false, $toLoad = true) { $cacheKey = sprintf('%d-%d-%d-%d', $parent, $sorted, $asCollection, $toLoad); if (isset($this->_storeCategories[$cacheKey])) { return $this->_storeCategories[$cacheKey]; }
/**
* Check if parent node of the store still exists
*/
$category = $this->_categoryFactory->create();
/* @var $category ModelCategory */
if (!$category->checkId($parent)) {
if ($asCollection) {
return $this->_dataCollectionFactory->create();
}
return [];
}
$recursionLevel = max(
0,
(int)$this->scopeConfig->getValue(
'catalog/navigation/max_depth',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$storeCategories = $category->getCategories($parent, $recursionLevel, $sorted, $asCollection, $toLoad);
$this->_storeCategories[$cacheKey] = $storeCategories;
return $storeCategories;
}
toplinks去掉compare
app/design/frontend/TemplateMonster/theme048/Magento_Catalog/templates/product/compare/link.phtml
增加my wish list icon
app/design/frontend/TemplateMonster/theme048/Magento_Wishlist/templates/link.phtml
app/design/frontend/TemplateMonster/theme048/Magento_Theme/templates/html/topmenu.phtml 头部菜单
app/code/TemplateMonster/Parallax/view/frontend/web/js/rd-parallax/jquery.rd-parallax.js parallax插件修改网上距离
为了修改products菜单不显示默认菜单,执行流程为以下三个文件
app/design/frontend/TemplateMonster/theme048/Magento_Theme/templates/html/topmenu.phtml
vendor/magento/module-theme/Block/Html/Topmenu.php
app/code/TemplateMonster/Megamenu/Block/Html/Topmenu.php
修改最后一个文件
if($child->getName() != 'Products'){ $html .= $this->_addSubMenu( $child, $childLevel, $childrenWrapClass, $limit ); }
Exception #0 (Magento\Framework\Exception\NoSuchEntityException): No linked stock found The website with code usa that was requested wasn't found. Verify the website and try again. inventory_stock_sales_channel修改code跟website里的code一致,比如base
后台保存store view报错 /Users/instar/Downloads/www/m2/vendor/magento/framework/App/Config.php if ($scopeCode) { $configPath .= is_array($scopeCode) ? '/english' : '/' . $scopeCode; //$configPath .= '/' . $scopeCode; }
中图不显示: app/code/TemplateMonster/ThemeOptions/Block/Config/View.php // if ($mediaId == 'product_page_image_medium') { // if (!empty($this->_helper->getProductGalleryImgWidth())) { // $dimensions['page_image_width'] = $this->_helper->getProductGalleryImgWidth(); // } // if (!empty($this->_helper->getProductGalleryImgHeight())) { // $dimensions['page_image_height'] = $this->_helper->getProductGalleryImgHeight(); // } // }
模板iconlist问题 sudo vi app/code/TemplateMonster/ThemeOptions/Helper/Data.php
public function getFontIcon($section) { $this->_checkSection($section);
$con_str = $this->scopeConfig->getValue(
sprintf(self::XML_PATH_FONT_SOCIAL_ICONS, $section), ScopeInterface::SCOPE_STORE);
$data = @unserialize($con_str);
if($data == false){
return json_decode($con_str, true);
}
return $data;
/**return unserialize($this->scopeConfig->getValue(
sprintf(self::XML_PATH_FONT_SOCIAL_ICONS, $section), ScopeInterface::SCOPE_STORE));**/
}
修改顶部文字不是全部大写 parallels@debian-gnu-linux-vm:/usr/local/www/m2$ sudo vi app/design/frontend/TemplateMonster/theme048/web/css/style.css parallels@debian-gnu-linux-vm:/usr/local/www/m2$ sudo vi app/design/frontend/TemplateMonster/theme048/web/css/modules.css
页面宽度1440
The attribute 'before' is not allowed.去掉before app/design/frontend/TemplateMonster/theme048/Magento_Checkout/layout/checkout_cart_index.xml
[2020-05-06 09:14:21] main.CRITICAL: Notice: Uninitialized string offset: 0 in /usr/local/www/m2/app/code/TemplateMonster/Megamenu/Observer/PrepareCategory.php on line 25 {"exception":"[object] (Exception(code: 0): Notice: Uninitialized string offset: 0 in /usr/local/www/m2/app/code/TemplateMonster/Megamenu/Observer/PrepareCategory.php on line 25 at /usr/local/www/m2/vendor/magento/framework/App/ErrorHandler.php:61)"} []
sudo vi app/code/TemplateMonster/Megamenu/Observer/PrepareCategory.php public function execute(\Magento\Framework\Event\Observer $observer) { $category = $observer->getCategory(); $image = $category->getMmImage(); if (isset($image['delete']) && $image['delete']) { $category->setData('mm_image_additional_data', ['delete' => true]); } else { isset($image[0]) ? $category->setMmImage($image[0]['name']) : $category->setMmImage(''); } }
Errors during compilation: TemplateMonster\FilmSlider\Model\ResourceModel\Slider Incompatible argument type: Required type: string. Actual type: \Magento\Framework\Stdlib\DateTime; File: /usr/local/www/app/code/TemplateMonster/FilmSlider/Model/ResourceModel/Slider.php
Total Errors Count: 1
In Log.php line 92:
Error during compilation
Original: public function __construct( \Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, $connectionName = null ) { parent::__construct($context, $connectionName); $this->_storeManager = $storeManager; } Change public function __construct( \Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Stdlib\DateTime $dateTime, $connectionName = null ) { parent::__construct($context, $connectionName); $this->_storeManager = $storeManager; }
Errors during compilation: TemplateMonster\Megamenu\Plugin\Block\Topmenu Incompatible argument type: Required type: \Magento\Catalog\Model\ResourceModel\Category\StateDependentCollectionFactory. Actual type: \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; File: /usr/local/www/app/code/TemplateMonster/Megamenu/Plugin/Block/Topmenu.php
Total Errors Count: 1
In Log.php line 92:
Error during compilation
public function __construct( \Magento\Catalog\Helper\Category $catalogCategory, \Magento\Catalog\Model\ResourceModel\Category\StateDependentCollectionFactory $categoryStateDependentCollectionFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer\Resolver $layerResolver ) { $this->_myCollectionFactory = $categoryCollectionFactory; $this->_myStoreManager = $storeManager; $this->_myLayerResolver= $layerResolver; parent::__construct($catalogCategory, $categoryStateDependentCollectionFactory, $storeManager, $layerResolver); }
public function __construct( \Magento\Catalog\Helper\Category $catalogCategory, \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollectionFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer\Resolver $layerResolver ) { $this->_myCollectionFactory = $categoryCollectionFactory; $this->_myStoreManager = $storeManager; $this->_myLayerResolver= $layerResolver; parent::__construct($catalogCategory, $categoryCollectionFactory, $storeManager, $layerResolver); }
Errors during compilation: TemplateMonster\ThemeOptions\Block\Config\View Incompatible argument type: Required type: string. Actual type: array; File: /usr/local/www/app/code/TemplateMonster/ThemeOptions/Block/Config/View.php
Total Errors Count: 1
In Log.php line 92:
Error during compilation
public function __construct( Data $helper, FileResolverInterface $fileResolver, ConverterInterface $converter, SchemaLocatorInterface $schemaLocator, ValidationStateInterface $validationState, $fileName, $idAttributes = [], $domDocumentClass = 'Magento\Framework\Config\Dom', $defaultScope = 'global', $xpath = [] ) { parent::__construct( $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass, $defaultScope, $xpath ); $this->_helper = $helper; }
public function __construct( FileResolverInterface $fileResolver, ConverterInterface $converter, SchemaLocatorInterface $schemaLocator, ValidationStateInterface $validationState, $fileName, $idAttributes = [], $domDocumentClass = 'Magento\Framework\Config\Dom', $defaultScope = 'global', $xpath = [] ) { parent::__construct( $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass, $defaultScope, $xpath ); $this->_helper = $helper; }
In ErrorHandler.php line 61:
Notice: Undefined variable: helper in /usr/local/www/app/code/TemplateMonst
er/ThemeOptions/Block/Config/View.php on line 56
$this->_helper = $helper;
$this->_helper = isset($helper) ? $helper : 0;
2020-04-01 13:33:28] main.CRITICAL: Notice: Undefined index: src in /usr/local/www/vendor/magento/framework/View/Page/Config/Generator/Head.php on line 126 {"report_id":"828ffe9902044726edfe7c621ab5dae1c9420fca4c81ca75ba37b9b1c24ab1de","exception":"[object] (Exception(code: 0): Notice: Undefined index: src in /usr/local/www/vendor/magento/framework/View/Page/Config/Generator/Head.php on line 126 at /usr/local/www/vendor/magento/framework/App/ErrorHandler.php:61)"} [
protected function processAssets(Structure $pageStructure) { foreach ($pageStructure->getAssets() as $name => $data) { $data['src'] = ''; if (isset($data['src_type']) && in_array($data['src_type'], $this->remoteAssetTypes)) { if ($data['src_type'] === self::SRC_TYPE_CONTROLLER) { $data['src'] = $this->url->getUrl($data['src']); }
$this->pageConfig->addRemotePageAsset(
$data['src'],
isset($data['content_type']) ? $data['content_type'] : self::VIRTUAL_CONTENT_TYPE_LINK,
$this->getAssetProperties($data),
$name
);
} else {
$this->pageConfig->addPageAsset($name, $this->getAssetProperties($data));
}
}
return $this;
}
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block', attribute 'type': The attribute 'type' is not allowed. app/design/frontend/TemplateMonster/theme048/Magento_Theme/layout/default.xml
Exception #0 (Exception): Notice: Undefined variable: categoryCollectionFactory in /usr/local/www/app/code/TemplateMonster/Megamenu/Plugin/Block/Topmenu.php on line 24
https://magento.stackexchange.com/questions/194010/magento-2-2-unable-to-unserialize-value bin/magento module:disable Temando_Shipping vendor/magento/framework/Serialize/Serializer/Json.php
public function unserialize($string) { if($this->is_serialized($string)) { $string = $this->serialize($string); } $result = json_decode($string, true); if (json_last_error() !== JSON_ERROR_NONE) { throw new \InvalidArgumentException('Unable to unserialize value.');
}
return $result;
}
function is_serialized($value, &$result = null) {
if (!is_string($value))
{
return false;
}
if ($value === 'b:0;')
{
$result = false;
return true;
}
$length = strlen($value);
$end = '';
switch ($value[0])
{
case 's':
if ($value[$length - 2] !== '"')
{
return false;
}
case 'b':
case 'i':
case 'd':
$end .= ';';
case 'a':
case 'O':
$end .= '}';
if ($value[1] !== ':')
{
return false;
}
switch ($value[2])
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
break;
default:
return false;
}
case 'N':
$end .= ';';
if ($value[$length - 1] !== $end[0])
{
return false;
}
break;
default:
return false;
}
if (($result = @unserialize($value)) === false)
{
$result = null;
return false;
}
return true;
}
MariaDB [magento2]> CREATE TABLE customer_group
( customer_group_id
smallint(5) unsigned NOT NULL AUTO_INCREMENT, customer_group_code
varchar(32) NOT NULL COMMENT 'Customer Group Code', tax_class_id
int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Tax Class ID', PRIMARY KEY (customer_group_id
) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Customer Group';
MariaDB [magento2]> create table temando_product_attribute_mapping2 like temando_product_attribute_mapping; Query OK, 0 rows affected (0.00 sec)
MariaDB [magento2]> insert into temando_product_attribute_mapping2 select * from temando_product_attribute_mapping; Query OK, 6 rows affected (0.00 sec) Records: 6 Duplicates: 0 Warnings: 0
MariaDB [magento2]> truncate table temando_product_attribute_mapping; Query OK, 0 rows affected (0.01 sec)
Public Key: 7b3a23fca8a80cf0290ff37fe2d82e38 Private Key: c06f323982f6471f9820d51f68d5fd93
安装完成后magento自动跳转,修改数据库
SELECT * FROM core_config_data
WHERE path
LIKE '%base%'
update core_config_data set value='http://debian-gnu-linux-vm/' where config_id=3;
sudo vi app/code/TemplateMonster/ThemeOptions/Block/Config/View.php
app/code/TemplateMonster/ThemeOptions/Block/Config/View.php
sudo vi app/design/frontend/TemplateMonster/theme048/Magento_Checkout/layout/checkout_cart_index.xml app/design/frontend/TemplateMonster/theme048/TemplateMonster_FeaturedProduct/templates/widget/products-grid.phtml
购物车404 data-mage-init='{"redirectUrl":{"url":"getAddToCartUrl($_item) ?>"}}’
data-post=''
helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?>底部版权显示jssudo vi vendor/magento/module-theme/view/frontend/templates/html/copyright.phtml 把$block->escapeHtml($block->getCopyright()) 改为$block->getCopyright() systemctl restart vsftpd.service
vendor/magento/module-swatches/view/frontend/templates/product/view/renderer.phtml vendor/magento/module-swatches/view/frontend/templates/product/listing/renderer.phtml "showTooltip": = $block->escapeJs($configurableViewModel->getShowSwatchTooltip()) ?>
data-mage-init='{"redirectUrl":{"url":"getAddToCartUrl($_item) ?>"}}’
composer config repositories.magento composer https://repo.magento.com composer require magento/data-migration-tool:2.3.4 composer内存不足: 1552 sudo php -d memory_limit=-1 /usr/local/bin/composer update 1554 sudo php -d memory_limit=-1 /usr/local/bin/composer require magento/data-migration-tool:2.3.4
sudo bin/magento migrate:settings -r vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.8.1.0/config.xml
sudo php -d memory_limit=-1 bin/magento migrate:data -r -a vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.8.1.0/config.xml
php -d memory_limit=-1 bin/magento migrate:data -a vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.8.1.0/config.xml
保存分类报错 sudo vi vendor/magento/module-catalog/Model/Category/FileInfo.php private function getFilePath($fileName) { $fileName = is_array($fileName) ? '' : $fileName;//add $filePath = $this->removeStorePath($fileName); $filePath = ltrim($filePath, '/');
定义不迁移产品和分类 sudo vi vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.8.1.0/map.xml.dist
store不存在 查看三个store表 删除config里面store和website大于1的 删除cms_block里面大于1的 cms_block_page里面大于1的 Magento\Framework\Exception\NoSuchEntityException: The store that was requested wasn't found. Verify the store and try again. in /usr/local/www/m2/vendor/magento/module-store/Model/StoreRepository.php:112 Stack trace: #0
UPDATE sales_shipment
SET store_id
= '1';
UPDATE sales_shipment_grid
SET store_id
= '1’;
UPDATE cms_block_store
SET store_id
= '0'
UPDATE eav_entity_store
SET store_id
= '0'
UPDATE sales_order
SET store_id
= '1’
UPDATE sales_order_grid
SET store_id
= '1’
UPDATE sales_order_item
SET store_id
= '1’
UPDATE customer_entity
SET website_id
= '1’
SET FOREIGN_KEY_CHECKS=0;
UPDATE store
SET store_id = 0 WHERE code='admin';
UPDATE store_group
SET group_id = 0 WHERE name='Default';
UPDATE store_website
SET website_id = 0 WHERE code='admin';
UPDATE customer_group
SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;
theme_options/footer/social/font_icon {"_1589028925000_0":{"css_class":"icon icon-xs icon-circle fa fa-facebook","social_url":"https://www.facebook.com/TemplateMonster","font_size":"15","line_height":"40"},"_1589028925657_657":{"css_class":"icon icon-xs icon-circle fa fa-twitter","social_url":"https://twitter.com/templatemonster?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor","font_size":"15","line_height":"40"},"_1589028926264_264":{"css_class":"icon icon-xs icon-circle fa fa-instagram","social_url":"https://www.instagram.com/template_monster/?hl=en","font_size":"15","line_height":"40"},"_1589028926904_904":{"css_class":"icon icon-xs icon-circle fa fa-youtube-play","social_url":"https://www.youtube.com/user/TemplateMonsterCo","font_size":"15","line_height":"40"}}
INSERT INTO customer_entity
(entity_id
, website_id
, email
, group_id
, increment_id
, store_id
, created_at
, updated_at
, is_active
, disable_auto_group_change
, created_in
, prefix
, firstname
, middlename
, lastname
, suffix
, dob
, password_hash
, rp_token
, rp_token_created_at
, default_billing
, default_shipping
, taxvat
, confirmation
, gender
, failures_num
, first_failure
, lock_expires
)
VALUES
(27002, 1, '[email protected]', 1, NULL, 1, '2020-04-29 17:46:34', '2020-04-29 17:46:34', 1, 0, 'English', NULL, 'matt', NULL, 'qiu', NULL, NULL, 'e059027e46050da55b4d217bbe9cdcb9dad78f9e3b558644768815e3b0bef1c0:tvrLIctBEP0wVPI7:2', 'Z8j2F484YUQU1xNZs97wdVfXEgzvfHDO', '2020-04-29 09:46:34', NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
<crypt_key>ef593752d2a60390781a19b7ea49cbb1</crypt_key>
data-post=''
helper('Magento\Framework\Data\Helper\PostHelper'); $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) ?>SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-Mi
gration_Default' for key 'EAV_ATTRIBUTE_SET_ENTITY_TYPE_ID_ATTRIBUTE_SET_NA
ME' 删除eav_attribute eav_attribute_group eav_attribute_set eav_entity_type数据
Notice: Undefined index: dest in /usr/local/www/m2/vendor/magento/data-migation-tool/src/Migration/Step/Eav/InitialData.php on line 161
Warning: Invalid argument supplied for foreach() in /usr/local/www/m2/vendo
r/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 449
Warning: Invalid argument supplied for foreach() in /usr/local/www/m2/vendo
r/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 915
Warning: Invalid argument supplied for foreach() in /usr/local/www/m2/vendo
r/magento/data-migration-tool/src/Migration/Step/Eav/Data.php on line 924
Notice: Undefined offset: 462 in /usr/local/www/m2/vendor/magento/data-migr
ation-tool/src/Migration/Step/Eav/Data.php on line 818
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' f
or key 'PRIMARY'
#2 /usr/local/www/m2/vendor/magento/data-migration-tool/src/Migration/ResourceModel/Destination.php(52): Migration\ResourceModel\Adapter\Mysql->insertRecords('catalog_eav_att...', Array, false)
#3 /usr/local/www/m2/vendor/magento/data-migration-tool/src/Migration/Step/Eav/Data.php(838): Migration\ResourceModel\Destination->saveRecords('catalog_eav_att...', Object(Migration\ResourceModel\Record\Collection))
catalog_eav_attribute
delete from eav_attribute; delete from eav_attribute_group; delete from eav_attribute_set; delete from eav_entity_type; delete from catalog_eav_attribute; delete from eav_attribute_label; delete from eav_attribute_option; delete from eav_attribute_option_swatch; delete from eav_attribute_option_value; delete from eav_entity_attribute; delete from eav_entity_store; delete from customer_eav_attribute;
Notice: Undefined index: catalog_product in /usr/local/www/m2/vendor/magent
o/data-migration-tool/src/Migration/Step/Eav/Integrity/AttributeGroupNames.
php on line 57
Warning: Invalid argument supplied for foreach() in /usr/local/www/m2/vendor/magento/d
ata-migration-tool/src/Migration/Step/Eav/Model/IgnoredAttributes.php on line 50
Warning: Invalid argument supplied for foreach() in /usr/local/www/m2/vendor/magento/d
ata-migration-tool/src/Migration/Step/Eav/Model/IgnoredAttributes.php on line 51
Notice: Undefined offset: 1 in /usr/local/www/m2/vendor/magento/data-migration-tool/sr
c/Migration/Step/Eav/Data.php on line 292
Notice: Undefined index: in /usr/local/www/m2/vendor/magento/data-migration-tool/src/
Migration/Step/Eav/Data.php on line 293
sudo vi vendor/magento/module-catalog/etc/di.xml
sudo vi vendor/magento/module-catalog/Model/ResourceModel/Product/Attribute/Collection.php sudo vi vendor/magento/module-catalog/Ui/Component/Listing/Attribute/Repository.php
1 exception(s): Exception #0 (InvalidArgumentException): Invalid filter type I have the same problem. I resaved category_ids and visibility attributes from magento2 backend. Steps:-https://github.com/Smile-SA/elasticsuite/issues/1114
Login to Admin. Store->attributes->product. Search category_ids and save it. Than search visibility and resave it. Cache clean & flush
Exception #0 (Exception): Notice: Array to string conversion in /usr/local/www/m2/vendor/magento/framework/App/Config.php on line 78 if ($scopeCode) { //$configPath .= '/' . $scopeCode; if(is_array($scopeCode)){ $configPath .= '/english'; }else{ $configPath .= '/' . $scopeCode; } }
public function getCategory() { return $this->registry->registry('category');获取值 }
Mac下/usr/local目录默认是对于Finder是隐藏,如果需要到/usr/local下去,打开Finder,然后使用command+shift+G,在弹出的目录中填写/usr/local就可以了。
重启nginx:sudo nginx -s reload
instar@INSTARs-Mac-mini-2 nginx % tail -f /usr/local/var/log/nginx/*
/usr/local/etc/nginx/
/usr/local/var/log/nginx/
sudo chmod -R 777 /var/run/php-fpm.sock
sudo pkill php-fpm 启动PHP服务:sudo php-fpm cd /private/etc/php-fpm.d sudo cp www.conf.default www.conf
instar@INSTARs-Mac-mini-3 run % sudo chown nobody:nobody php-fpm.sock
chmod 755 /Users chmod 755 /Users/instar chmod 755 /Users/instar/Downloads
sudo chmod -R 777 /Users/instar/Downloads/www
If you need to have [email protected] first in your PATH run: echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
For compilers to find [email protected] you may need to set: export LDFLAGS="-L/usr/local/opt/[email protected]/lib" export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
To have launchd start [email protected] now and restart at login: brew services start [email protected] Or, if you don't want/need a background service you can just run: /usr/local/opt/[email protected]/bin/mysql.server start //直接安装 brew install [email protected] 设置MySQL的开机自启动:
ln -sfv /usr/local/opt/[email protected]/*.plist ~/Library/LaunchAgents /Users/wangteng/Library/LaunchAgents/[email protected] -> /usr/local/opt/[email protected]/[email protected] 增加环境变量
export PATH="/usr/local/opt/[email protected]/bin:$PATH" 增加完环境变量别忘了使之生效
然后启动mysql
mysql.server start
mysql8设置root密码和远程连接
ALTER USER 'root'@'localhost' IDENTIFIED BY ‘222222’;
alter user 'root'@'%' identified with mysql_native_password by '222222';
create database magento2 default charset utf8 COLLATE utf8_general_ci;
https://php-osx.liip.ch/ 1023 sudo /usr/local/php5-7.3.8-20190811-205217/sbin/php-fpm 1024 sudo cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf 1025 sudo /usr/local/php5-7.3.8-20190811-205217/sbin/php-fpm 1026 sudo cp /usr/local/php5/etc/php-fpm.d/www.conf.default /usr/local/php5-7.3.8-20190811-205217/etc/php-fpm.d/www.conf 1027 sudo /usr/local/php5-7.3.8-20190811-205217/sbin/php-fpm 1028 sudo cp /usr/local/php5/etc/php-fpm.d/www.conf 1029 sudo vi /usr/local/php5/etc/php-fpm.d/www.conf 1030 sudo /usr/local/php5-7.3.8-20190811-205217/sbin/php-fpm 1031 sudo chmod -R 777 /var/run/php-fpm.sock
instar@INSTARs-Mac-mini-3 m2 % sudo cp -r /Users/instar/Desktop/Magento2TemplateSpices/sources/sample_data/ /Users/instar/Downloads/www/m2 instar@INSTARs-Mac-mini-3 m2 % sudo cp -r /Users/instar/Desktop/Magento2TemplateSpices/theme048/ /Users/instar/Downloads/www/m2
instar@INSTARs-Mac-mini-3 m2 % sudo rm -rf app/etc/env.php &&% sudo rm -rf app/etc/config.php && sudo rm -rf var/cache && sudo rm -rf generated && sudo bin/magento maintenance:disable
1208 /usr/local/opt/[email protected]/bin/mysqld --initialize --user=mysql 1209 ps aux | grep mysql /usr/local/opt/[email protected]/bin/mysqld --basedir=/usr/local/opt/[email protected] --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/opt/[email protected]/lib/plugin --log-error=INSTARs-Mac-mini-3.fritz.box.err --pid-file=INSTARs-Mac-mini-3.fritz.box.pid
222222aaaaaa update mysql.user set authentication_string=password('222222aaaaaa') where user=‘root’ flush privileges; 1210 sudo rm -rf /usr/local/var/mysql/*
InnoDB: Unable to lock ./ibdata1 error: 35
1670 ps aux |grep mysql 1671 kill -9 75769 1672 ps aux |grep mysql 1673 sudo chmod -R 777 /tmp/mysql.sock /usr/local/opt/[email protected]/bin/mysqld --user=mysql &
Deploy using quick strategy
In Abstract.php line 144:
SQLSTATE[HY000] [2002] No such file or directory
找到相应的.sock文件,并设置php.ini文件中的pdo_mysql.default_socket的值为.sock文件的路径。
pdo_mysql.default_socket=/tmp/mysql.sock
Custom_group是否已导入 truncate table temando_product_attribute_mapping;
sudo php -dmemory_limit=-1 bin/magento setup:di:compile
deploy出错 sudo chown -R _www:_www /Users/instar/Downloads/www/m2 sudo chmod -R 777 /Users/instar/Downloads/www/m2
sudo vi app/code/TemplateMonster/ThemeOptions/Block/Config/View.php Sudo bin/magento deploy:mode:set developer sudo php -dmemory_limit=-1 bin/magento setup:static-content:deploy -f
Exception #0 (Exception): Warning: array_key_exists() expects parameter 2 to be array, string given in /Users/instar/Downloads/www/m2/app/code/TemplateMonster/FeaturedProduct/Block/FeaturedProduct/Widget/Product.php on line 173 先sudo bin/magento deploy:mode:set default 后sudo bin/magento deploy:mode:set developer
setsockopt(TCP_NODELAY) failed (22: Invalid argument) while keepalive 12 events { 13 use kqueue; 14 worker_connections 1024; 15 } #use 设置用于复用客户端线程的轮询方法。如果你使用Linux 2.6+,你应该使用epoll。如果你使用BSD如mac,你应该使用kqueue
Configuration/Developer/Static Files Settings/Sign Static Files/ 设置为NO