ะ
ืืชื ืืืชืืจ: ืืื'ื ืื ืืฉ ืคืื ืงืฆืืื ืืืืช ืืืื ื ืขืืืจ
ื ืืชื ืืจืืืช ืืช ืืงืื ืื ืืืข ืืืชืืืช ืฉื ื ืืืืืจืื ืืืืืื Magento "
- ืืืฆืจืื ื ืืฆืจืื ืจืง, ืื ืืขืืืื ืื.
- ืืืกื ืืื
- ืจืง ืฉืืืช ืงืืืืจืืืช ืืืืืืื, ืืื ืืืื ื ืฉืืื
- ืืื ื ื ืชืื ืื ืชืืืืื ืืืจืกื 2.3
JSON ืืืืืื โโืืืฆืจ ืืืื:
{
"sku": "MVA20D-UBV-3",
"name": "ะะฐะณะปััะบะฐ ะดะปั ะฟะปะพะผะฑะธัะพะฒะบะธ ะะ47-29 IEK",
"desc": "ะะฑะตัะฟะตัะตะฝะธะต ะดะพัััะฟะฐ ะบ ััััะพะนััะฒะฐะผ ...",
"desc_short": "ะะฐะณะปััะบะฐ ะดะปั ะฟะปะพะผะฑะธัะพะฒะบะธ ะะ47-29 IEK ะฟัะตะดะฝะฐะทะฝะฐัะตะฝะฐ ะดะปั ...",
"price": 5.00,
"qty": 25,
"categories": ["ะะฐัะตะณะพัะธั 1", "ะะฐัะตะณะพัะธั 2"],
"image_path": "mva20d_ubv_3.png"
}
ืกืงืืจื ืืืืืช ืฉื ืืฉืืืื ืืขืืงืจืืื ืฉื ืืืืืื
- ืจืืฉืื ืืืืฆืจ ืขืฆืื
- ืืืืืจ ืืื ืืืฆืจ ืืืชืจ
- ืชืืื ืืช ืืืฆืจ ืืกืืกืืืช (EAV)
- ื ืชืื ื ืืืื (ืืืืช ืืืืฆืจ ืืืืื)
- ืืืื (ืชืืื ืืช)
- ืืืืืจ ืืงืืืืจืืืช ืงืืืืืืืช
ืจืืฉืื ืืืืฆืจ
ืืืืข ืืกืืกื ืขื ืืืืฆืจ ื ืืชื ืืืฆืื ื catalog_product_entity
:
CREATE TABLE `catalog_product_entity` (
`entity_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Entity Id',
`attribute_set_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Attribute Set ID',
`type_id` varchar(32) NOT NULL DEFAULT 'simple' COMMENT 'Type ID',
`sku` varchar(64) DEFAULT NULL COMMENT 'SKU',
`has_options` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Has Options',
`required_options` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Required Options',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation Time',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update Time',
PRIMARY KEY (`entity_id`),
KEY `CATALOG_PRODUCT_ENTITY_ATTRIBUTE_SET_ID` (`attribute_set_id`),
KEY `CATALOG_PRODUCT_ENTITY_SKU` (`sku`)
)
ืืืืืข ืืืื ืืืื ืื ืืจืฉ ืืืฆืืจืช ืขืจื ืืืจืฉื ืืืืฆืจ ืืื:
attribute_set_id
sku
ื ืึนืกึธืฃ:
type_id
- ืื ืื ื ืฆืืื ืืืช, ืืืขืฉื ืฉืืืืฉ ื'ืคืฉืื'
ืืื ืืืชืื ืืฉืืจืืช ืืืกื ืื ืชืื ืื, ืื ื ืืฉืชืืฉ ืืืชืื ื-DB ืฉื Magento ืขืฆืื:
function create($sku, $typeId, $attrSetId)
{
/** @var MagentoFrameworkAppResourceConnection $this->resource */
/** @var MagentoFrameworkDBAdapterPdoMysql $conn */
$conn = $this->resource->getConnection();
$table = $this->resource->getTableName('catalog_product_entity');
$bind = [
'sku' => $sku,
'type_id' => $typeId,
'attribute_set_id' => $attrSetId
];
$conn->insert($table, $bind);
$result = $conn->lastInsertId($table);
return $result;
}
ืืืืจ ืจืืฉืื ืืืืฆืจ ืขื catalog_product_entity
ืื ืืืคื ืืืืืช ืืืื ืืคืื ื ืื ืืืื, ืืจืฉืช ืืืืฆืจ (ืงืืืื/ืืืฆืจืื).
ืงืฉืจ ืืื ืืืฆืจ ืืืชืจ
ืืฉืืื ืฉื ืืืืฆืจ ืืืชืจ ืงืืืข ืืืืื ืื ืืืืช ืืชืฆืืืืช ืืืืฆืจ ืืืื ืืืื ืืืืืช.
function linkToWebsite($prodId, $websiteId)
{
/** @var MagentoFrameworkAppResourceConnection $this->resource */
/** @var MagentoFrameworkDBAdapterPdoMysql $conn */
$conn = $this->resource->getConnection();
$table = $this->resource->getTableName('catalog_product_website');
$bind = [
'product_id' => $prodId,
'website_id' => $websiteId
];
$conn->insert($table, $bind);
}
ืชืืื ืืช ืืืฆืจ ืืกืืกืืืช
ืืืืฆืจ ืฉื ืจืฉื ืืืืจืื ื ืืื ืขืืืื ืฉื ืื ืชืืืืจ. ืื ืื ื ืขืฉื ืืืืฆืขืืช
name
price
description
short_description
status
tax_class_id
url_key
visibility
ืืืืฆืจ ืืื ืืชืืืกืคืช ืชืืื ื ื ืคืจืืช (ืืคืจืืื ืฉื ืงืืืช ืืืืื ืืกืื ืืชืืื ื ืืืงืื ืฉืื ื ืฉืืืื):
public function create($prodId, $attrCode, $attrValue)
{
$attrId = /* get attribute ID by attribute code */
$attrType = /* get attribute type [datetime|decimal|int|text|varchar]) by attribute code */
if ($attrId) {
/** @var MagentoFrameworkAppResourceConnection $this->resource */
/** @var MagentoFrameworkDBAdapterPdoMysql $conn */
$conn = $this->resource->getConnection();
$tblName = 'catalog_product_entity_' . $attrType;
$table = $this->resource->getTableName($tblName);
$bind = [
'attribute_id' => $attrId,
'entity_id' => $prodId,
/* put all attributes to default store view with id=0 (admin) */
'store_id' => 0,
'value' => $attrValue
];
$conn->insert($table, $bind);
}
}
ืืืืฆืขืืช ืงืื ืืชืืื ื, ืื ื ืงืืืขืื ืืช ืืืืื ืืกืื ืื ืชืื ืื ืฉืื (datetime
, decimal
, int
, text
, varchar
), ืืืืืจ ืืื ืืชืื ืืช ืื ืชืื ืื ืขืืืจ ืืืื ืื ืืืื ืืืืื ืืืชืืืื (store_id = 0
).
ืืืืจ ืืืกืคืช ืืืืคืืื ืื ืืขืื ืืืืฆืจ, ืืชื ืืงืื ืืช ืืชืืื ื ืืื ืืคืื ื ืื ืืืื:
ื ืชืื ื ืืืื
ืืื ืืืจืกื 2.3 ืืื'ื ืื, ืืฉื ื ืฉืชื ืงืืืฆืืช ืืงืืืืืช ืฉื ืืืืืืช ืืืกืคืงืืช ืืืกืื ืฉื ืืืืข ืืืื (ืืืืช ืืืืฆืจ):
cataloginventory_*
: ืืื ื ืืฉื;inventory_*
: ืืื ื ืืืฉ (MSI - Multi Source Inventory);
ืืชื ืฆืจืื ืืืืกืืฃ ื ืชืื ื ืืืื ืืฉื ื ืืืื ืื, ืื ืืืื ื ืืืืฉ ืขืืืื ืื ืขืฆืืื ืืืืืืื ืืืืฉื (ืกืืืจ ืืืื ืฉืขืืืจ default
ืืืกื ืืืื ื ืืืืฉ ืืขืืจื ืฉืืืื cataloginventory_stock_status
ืืื inventory_stock_1
).
ืงืืืืืืืื_
ืืขืช ืคืจืืกืช Magneto 2.3 ืืฉ ืื ื ืืชืืืื 2 ืื ืืกืืช store_website
, ืืืชืืื ืืฉื ื ืืชืจืื - ืื ืืื ืืืงืื ืจืืฉื:
website_id|code |name |sort_order|default_group_id|is_default|
----------|-----|------------|----------|----------------|----------|
0|admin|Admin | 0| 0| 0|
1|base |Main Website| 0| 1| 1|
ืืืืื cataloginventory_stock
ืืฉ ืื ื ืจืง ืื ืืกื ืืืช:
stock_id|website_id|stock_name|
--------|----------|----------|
1| 0|Default |
ืืืืืจ, ืืืื ื ืืืฉื ืฉืื ื ืืฉ ืจืง "ืืืกื" ืืื (stock
) ืืืื ืืงืืฉืจ ืืืชืจ ืื ืืืืื. ืืืกืคืช ืืืฉืื ืืจื ืคืื ื ืื ืืืื sources
/stocks
ื-MSI (ืืื ื ืืืฉ) ืืื ื ืืืจื ืืขืจืืื ืืืฉืื ื cataloginventory_stock
.
ื ืชืื ื ืืืื ืขื ืืืฆืจืื ืืืื ื ืืืฉื ื ืจืฉืืื ืชืืืื ืืืืืืืช:
cataloginventory_stock_item
cataloginventory_stock_status
cataloginventory_stock_item
function createOldItem($prodId, $qty)
{
$isQtyDecimal = (((int)$qty) != $qty);
$isInStock = ($qty > 0);
/** @var MagentoFrameworkAppResourceConnection $this->resource */
/** @var MagentoFrameworkDBAdapterPdoMysql $conn */
$conn = $this->resource->getConnection();
$table = $this->resource->getTableName('cataloginventory_stock_item');
$bind = [
'product_id' => $prodId,
/* we use one only stock in 'cataloginventory' structure by default */
'stock_id' => 1,
'qty' => $qty,
'is_qty_decimal' => $isQtyDecimal,
'is_in_stock' => $isInStock,
/* default stock is bound to admin website (see `cataloginventory_stock`) */
'website_id' => 0
];
$conn->insert($table, $bind);
}
ืกืืืืก_ืืืื_ืงืืืื
function createOldStatus($prodId, $qty)
{
$isInStock = ($qty > 0);
/** @var MagentoFrameworkAppResourceConnection $this->resource */
/** @var MagentoFrameworkDBAdapterPdoMysql $conn */
$conn = $this->resource->getConnection();
$table = $this->resource->getTableName('cataloginventory_stock_status');
$bind = [
'product_id' => $prodId,
/* we use one only stock in 'cataloginventory' structure by default */
'stock_id' => 1,
'qty' => $qty,
'stock_status' => MagentoCatalogInventoryApiDataStockStatusInterface::STATUS_IN_STOCK,
/* default stock is bound to admin website (see `cataloginventory_stock`) */
'website_id' => 0
];
$conn->insert($table, $bind);
}
ืึฐืึทืื_
ืืชืืืื, ืืืื ื ืืืืฉ ืืืืกืื ื ืชืื ื ืืืื ืืืื 1 "ืืงืืจ"(inventory_source
):
source_code|name |enabled|description |latitude|longitude|country_id|...|
-----------|--------------|-------|--------------|--------|---------|----------|...|
default |Default Source| 1|Default Source|0.000000| 0.000000|US |...|
ืืืื "ืืืกื"(inventory_stock
):
stock_id|name |
--------|-------------|
1|Default Stock|
ยซืืงืืจยป ืืืืฆื ืืช ืืืืกืื ืืคืืื ืฉื ืืืฆืจืื (ืืจืฉืืื ืืืืื ืงืืืืจืืื ืืืช ืคืืืืืช ืืืชืืืช ืืืืจ). "ืืจืื"ืืื ืืืืื ืืืื ืฉื ืืื "ืืงืืจืืช" (inventory_source_stock_link
)
link_id|stock_id|source_code|priority|
-------|--------|-----------|--------|
1| 1|default | 1|
ืืจืื ืฉืื ืืชืจืืฉ ืืืืืืจ ืืขืจืืฅ ืืืืืจื (inventory_stock_sales_channel
)
type |code|stock_id|
-------|----|--------|
website|base| 1|
ืื ืืฉืคืื ืืคื ืืื ื ืื ืชืื ืื, ืื ืืืื ืกืืืื ืฉืื ืื ืฉื ืขืจืืฆื ืืืืจื, ืื ืืืจืืจืช ืืืื ืจืง ืืืืืืจ "ืื ืืืช"-"ืืชืจ ืืื ืืจื ื"(ืืงืืฉืืจ ืืืชืจ ืขืืงื ืืืจ ืงืื ืืืชืจ - base
).
ืืื "ืืืกื"ื ืืชื ืืงืฉืจ ืืืื"ืืงืืจืืช"ืืืื "ืืงืืจ" - ืืืื "ืืืกื ืื"(ืืขืจืืช ืืืกืื ืฉื ืจืืื ืืจืืื). ืืืจืืืื ืื ืืจืืจืช ืืืื "ืืงืืจ"ื"ืืืกื". ืื ืืื ื ืืงืืฉืจืื ืืืืฉ ืืืฉืืืืช ืืืจืืช (ืืืืื ืืจืืช ืืงืื - ืืฉืืืื "ืื ื ืืชื ืืฉืืืจ ืงืืฉืืจ ืืงืฉืืจ ืืืงืืจ ืืจืืจืช ืืืืื ืื ืืืืื ืืจืืจืช ืืืืื"). ืคืจืืื ื ืืกืคืื ืขื ืืื ื MSI ืืื'ื ืื 2 ื ืืชื ืืืฆืื ืืืืืจ "
ืื ื ืืฉืชืืฉ ืืชืฆืืจืช ืืจืืจืช ืืืืื ืืืืกืืฃ ืืช ืื ืืืืข ืืืืื ืืืงืืจ default
, ืืืขืืจื ืืขืจืืฅ ืืืืืจื ืืืฉืืื ืืืชืจ ืขื ืืงืื base
(ืืชืืื ืืงืฆื ืืงืืื ืฉื ืืื ืืช - ืจืื store_website
):
function createNewItem($sku, $qty)
{
/** @var MagentoFrameworkAppResourceConnection $this->resource */
/** @var MagentoFrameworkDBAdapterPdoMysql $conn */
$conn = $this->resource->getConnection();
$table = $this->resource->getTableName('inventory_source_item');
$bind = [
'source_code' => 'default',
'sku' => $sku,
'quantity' => $qty,
'status' => MagentoInventoryApiApiDataSourceItemInterface::STATUS_IN_STOCK
];
$conn->insert($table, $bind);
}
ืืืืจ ืืืกืคืช ื ืชืื ื ืืืื ืืืืฆืจ ืืคืื ื ืื ืืืื, ืืชื ืืงืื ืืช ืืชืืื ื ืืืื:
ืืืื
ืืืฉืจ ืืืกืืคืื ืชืืื ื ืืืืฆืจ "ืืื ืืช" ืืจื ืคืื ื ืื ืืืื, ืืืืืข ืืจืืืื ืื ื ืจืฉื ืืืืืืืช ืืืืืช:
catalog_product_entity_media_gallery
: ืจืืฉืื ืืืื (ืชืืื ืืช ืืงืืฆื ืืืืื);catalog_product_entity_media_gallery_value
: ืงืืฉืืจ ืืืื ืืืืฆืจืื ืืืืื ืืช ืจืืืื (ืืืงืืืืฆืื);catalog_product_entity_media_gallery_value_to_entity
: ืงืืฉืืจ ืืืื ืืืืฆืจืื ืืืื (ืืื ืื ืจืื ืชืืื ืืืื ืืจืืจืช ืืืื ืขืืืจ ืืืืฆืจ);catalog_product_entity_varchar
: ืืชืคืงืืืื ืฉืืื ื ืขืฉื ืฉืืืืฉ ืืชืืื ื ืืืืืกื ืื ืืื;
ืืืชืืื ืืช ืขืฆืื ื ืฉืืจืืช ืืกืคืจืืื ./pub/media/catalog/product/x/y/
ืืืคื x
ะธ y
- ืืืืช ืืจืืฉืื ื ืืืฉื ืืื ืฉื ืฉื ืงืืืฅ ืืชืืื ื. ืืืฉื, ืงืืืฅ image.png
ืฆืจืื ืืืืฉืืจ ืืชืืจ ./pub/media/catalog/product/i/m/image.png
, ืืื ืฉืืคืืืคืืจืื ืชืืื ืืืฉืชืืฉ ืื ืืชืืื ื ืืขืช ืชืืืืจ ืืืฆืจืื ืืืงืืืื.
catalog_product_enity_media_gallery
ืืืจืฉืื ืคืืจืกื ื ./pub/media/catalog/product/
ืงืืืฅ ืืืื (ืชืืืื ืืฆืืช ืืงืืืฅ ืขืฆืื ืืื ื ื ืืื ืืืืืจ ืื):
function createMediaGallery($imgPathPrefixed)
{
$attrId = /* get attribute ID by attribute code 'media_gallery' */
/** @var MagentoFrameworkAppResourceConnection $this->resource */
/** @var MagentoFrameworkDBAdapterPdoMysql $conn */
$conn = $this->resource->getConnection();
$table = $this->resource->getTableName('catalog_product_entity_media_gallery');
$bind = [
'attribute_id' => $attrId,
'value' => $imgPathPrefixed,
/* 'image' or 'video' */
'media_type' => 'image',
'disabled' => false
];
$conn->insert($table, $bind);
$result = $conn->lastInsertId($table);
return $result;
}
ืืืฉืจ ื ืจืฉื, ืืงืืืฅ ืืืื ืืืฉ ืืืงืฆื ืืืื.
ืขืจื_ืืืจืืืช_ืืืื_ืืืฆืจ_ืงืืืื
ืื ื ืืฉืืืืื ืืช ืงืืืฅ ืืืืื ืืจืฉืื ืืืืฆืจ ืืืชืืื ืขืืืจ ืืืื ืืจืืืื ืฉื ืืจืืจืช ืืืืื:
function createGalleryValue($mediaId, $prodId)
{
/** @var MagentoFrameworkAppResourceConnection $this->resource */
/** @var MagentoFrameworkDBAdapterPdoMysql $conn */
$conn = $this->resource->getConnection();
$table = $this->resource->getTableName('catalog_product_entity_media_gallery_value');
$bind = [
'value_id' => $mediaId,
/* use admin store view by default */
'store_id' => 0,
'entity_id' => $prodId,
'label' => null,
/* we have one only image */
'position' => 1,
'disabled' => false
];
$conn->insert($table, $bind);
}
catalog_product_entity_media_gallery_value_to_entity
ืื ื ืืงืฉืจืื ืืช ืงืืืฅ ืืืืื ืืจืฉืื ืืืืฆืจ ืืืชืืื ืืืื ืืืืืช ืงืฉืืจ ืืืืื ืจืืืื ืืืฉืื. ืื ืืจืืจ ืืืื ืืืืืง ื ืขืฉื ืฉืืืืฉ ืื ืชืื ืื ืืืื ืืืืืข ืื ืืคืฉืจ ืืืฉืช ืื ืชืื ืื ืืืืืื ืืงืืืืช, ืืื ืืืืื ืืื ืงืืืืช ืืื ืชืื ืื ื ืืชืืื ืืืื ืืฉืืืกืืคืื ืชืืื ื ืืืืฆืจ. ืื ืืื ืื.
function createGalleryValueToEntity($mediaId, $prodId)
{
/** @var MagentoFrameworkAppResourceConnection $this->resource */
/** @var MagentoFrameworkDBAdapterPdoMysql $conn */
$conn = $this->resource->getConnection();
$table = $this->resource->getTableName('catalog_product_entity_media_gallery_value_to_entity');
$bind = [
'value_id' => $mediaId,
'entity_id' => $prodId
];
$conn->insert($table, $bind);
}
catalog_product_entity_varchar
ื ืืชื ืืืฉืชืืฉ ืืงืืืฅ ืืืื ืขื ืชืคืงืืืื ืฉืื ืื (ืงืื ืืชืืื ื ืืืชืืื ืืฆืืื ืืกืืืจืืื):
- ืืกืืก(
image
) - ืชืืื ื ืงืื ื (
small_image
) - ืชืืื ื ืืืืืขืจืช (
thumbnail
) - ืชืืื ืช ืืืืืืช (
swatch_image
)
ืงืืฉืืจ ืชืคืงืืืื ืืงืืืฅ ืืืื ืื ืืืืืง ืื ืฉืงืืจื ืื catalog_product_entity_varchar
. ืืงืื ืืืืืื ืืืื ืืงืื ื-"ืชืืื ืืช ืืืฆืจ ืืกืืกืืืช".
ืืืืจ ืืืกืคืช ืชืืื ื ืืืืฆืจ ืืคืื ื ืื ืืืื ืื ื ืจืื ืื:
ืงืืืืจืืืช
ืืืืืืช ืขืืงืจืืืช ืืืืืืืช ื ืชืื ืื ืืคื ืงืืืืจืืืช:
catalog_category_entity
: ืจืืฉืื ืงืืืืจืืืช;catalog_category_product
: ืืืืืจ ืืื ืืืฆืจืื ืืงืืืืจืืืช;catalog_category_entity_*
: ืขืจืื ืชืืื ืช EAV;
ืืชืืืื, ืืืคืืืงืฆืืืช ืื'ื ืื ืจืืงื, ืจืืฉืื ืืงืืืืจืืืช ืืืื 2 ืงืืืืจืืืช (ืงืืฆืจืชื ืืช ืฉืืืช ืืขืืืืืช: crt
- created_at
, upd
- updated_at
):
entity_id|attribute_set_id|parent_id|crt|upd|path|position|level|children_count|
---------|----------------|---------|---|---|----|--------|-----|--------------|
1| 3| 0|...|...|1 | 0| 0| 1|
2| 3| 1|...|...|1/2 | 1| 1| 0|
ืืงืืืืจืื ืขื id=1 ืืื ืืฉืืจืฉ ืฉื ืื ืงืืืื ืื'ื ืื ืืืื ื ืืืื ื ืื ืืคืื ื ืื ืืืื ืืื ืืขืืื ืืจืืฉืื. ืงืืืืจืื ืขื id=2 (ืงืืืืจืืช ืืจืืจืช ืืืื) ืืื ืงืืืืจืืืช ืืฉืืจืฉ ืฉื ืืื ืืช ืืจืืฉืืช ืฉื ืืืชืจ ืืจืืฉื (ืื ืืช ืืืชืจ ืืจืืฉืืช) ื ืืฆืจ ืืขืช ืคืจืืกืช ืืืืฉืื (ืจืื. ืื ืื / ืื ืืืืช / ืื ืืื ืืืืช). ืืชืจื ืืื, ืื ืงืืืืจืืืช ืืฉืืจืฉ ืฉื ืืื ืืช ืขืฆืื ืืื ื ืืืื ื ืืืืืช, ืืื ืจืง ืชืช ืืงืืืืจืืืช ืฉืื.
ืืืืืื ืฉืื ืืฉื ืฉื ืืืืจ ืื ืืื ืขืืืื ืืืืื โโื ืชืื ืื ืขื ืืืฆืจืื, ืื ืืฉืชืืฉ ืืื ืืกื ืืฉืืจื ืืืกื ืื ืชืื ืื ืืขืช ืืฆืืจืช ืงืืืืจืืืช, ืืื ืืฉืชืืฉ ืืืืืงืืช ืฉืืกืคืงืช Magento ืขืฆืื (ืืืืืื ืืืืืจืื). ืื ืืกื ืืฉืืจื ืืืกื ืื ืชืื ืื ืืฉืืฉืช ืจืง ืืื ืืฉืืื ืืช ืืืืฆืจ ืืืืืื ืืงืืืืจืื (ืืงืืืืจืื ืืืชืืืช ืืฉืื, ืืืืื ืืงืืืืจืื ืืืืืืจ ืืืืื ืืืชืืื):
function create($prodId, $catId)
{
/** @var MagentoFrameworkAppResourceConnection $this->resource */
/** @var MagentoFrameworkDBAdapterPdoMysql $conn */
$conn = $this->resource->getConnection();
$table = $this->resource->getTableName('catalog_category_product');
$bind = [
'category_id' => $catId,
'product_id' => $prodId,
];
$conn->insert($table, $bind);
}
ืืืืจ ืืืกืคืช ืงืืฉืืจ ืืืืฆืจ ืืงืืืืจืืืช "ืงืืืืจืื 1" ื-"ืงืืืืจืื 2", ืคืจืื ืืืืฆืจ ืืคืื ื ืื ืืืื ื ืจืืื ืืขืจื ืื:
ืคืขืืืืช ื ืืกืคืืช
ืืืืจ ืืฉืืืช ืืืืื โโืื ืชืื ืื, ืขืืื ืืืฆืข ืืช ืืฉืืืื ืื ืืกืคืื ืืืืื:
- ืืื ืืงืก ื ืชืื ืื: ืืชืงืฉืจ ืืืกืืฃ
./bin/magento indexer:reindex
; - ืืฆืืจืช ืืชืืืืช URL ืืืืฉ ืขืืืจ ืืืฆืจืื/ืงืืืืจืืืช: ืืชื ืืืื ืืืฉืชืืฉ ืืชืืกืฃ "
elgentos/regenerate-catalog-urls ยซ
ืืืฆืจืื ืืคืื ื ืื ืืืื ืืืืจ ืืืฆืืข ืคืขืืืืช ื ืืกืคืืช:
ืืืืืืช:
ืชืงืฆืืจ
ืืืชื ืกื ืืืฆืจืื (10 ืืชืืืืช) ืืื ืืืชืื ืืงืืืืช ืืืืื ืืคืืืช ืืกืืจ ืืืื ืืืืจ ืืืชืจ (ืฉื ืืื ืืืช ืืขืืืช 1). ืืื ืืืขืจืื ืืฆืืจื ืืืืืงืช ืืืชืจ ืืช ืืืืืจืืช, ืืชื ืฆืจืื ืืกืคืจ ืืืื ืืืชืจ ืฉื ืืืฆืจืื - ืืื ืืืืช, ืื ืืื ืืืชืจ ืืืคืื. ืขื ืืืช, ืื ืขื ืืืื ืื ืงืื ืฉื ื ืชืื ื ืงืื, ืื ื ืืืืืื ืืืกืืง ืฉืืฉืืืืฉ ืืืืื ืฉืืกืคืงืช Magento (ืืืืืื ืืืืืจืื) ืืื ืืฉืืขืืชื (ืื ื ืืืืืฉ - ืืจืื!) ืืืืืฅ ืืช ืคืืชืื ืืคืื ืงืฆืืื ืืืืช ืื ืืจืฉืช, ืื ืื ืืื ืืช ืืืืคื ืืฉืืขืืชื (ืื ื ืืืืืฉ - ืืจืื!) ืืืคืืืช ืืช ืืืืืจืืช ืฉืื ื ืชืื ืื ื ืื ืกืื ืืืกื ืื ืชืื ืื.
ืืชืืฆืื ืืื ืืชืืจืจ ืฉืืืื ืจืืืืื ืืื ืืืืืจ ืืืืืื. ืขื ืืืช, ืขืืฉืื ืืฉ ืื ืืช ืืงืื ืืฉืืง ืืืชื ืืืืื ืืืืืข ืืืื ืืกืงื ืืช ืืขื ืืื ืืช ืืืชืจ.
ืืงืืจ: www.habr.com