Code Monkey home page Code Monkey logo

laragento's People

Contributors

genaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laragento's Issues

Product model repository :

public function scopeEAVMonster($q, $ids){

$entity_id = 'row_id';
$ids = implode(',', $ids);
$monster = <<<EOD

select ea.attribute_id, ea.attribute_code, eav.value
FROM catalog_product_entity e
JOIN catalog_product_entity_varchar eav
ON e.$entity_id = eav.$entity_id
JOIN eav_attribute ea
ON eav.attribute_id = ea.attribute_id
WHERE e.$entity_id in ($ids)
UNION
SELECT ea.attribute_id, ea.attribute_code, eav.value
FROM catalog_product_entity e
JOIN catalog_product_entity_int eav
ON e.$entity_id = eav.$entity_id
JOIN eav_attribute ea
ON eav.attribute_id = ea.attribute_id
WHERE e.$entity_id in ($ids)
UNION
SELECT ea.attribute_id, ea.attribute_code, eav.value
FROM catalog_product_entity e
JOIN catalog_product_entity_decimal eav
ON e.$entity_id = eav.$entity_id
JOIN eav_attribute ea
ON eav.attribute_id = ea.attribute_id
WHERE e.entity_id in ($ids)
UNION
SELECT ea.attribute_id, ea.attribute_code, eav.value
FROM catalog_product_entity e
JOIN catalog_product_entity_datetime eav
ON e.$entity_id = eav.$entity_id
JOIN eav_attribute ea
ON eav.attribute_id = ea.attribute_id
WHERE e.$entity_id in ($ids)
UNION
SELECT ea.attribute_id, ea.attribute_code, eav.value
FROM catalog_product_entity e
JOIN catalog_product_entity_text eav
ON e.$entity_id = eav.$entity_id
JOIN eav_attribute ea
ON eav.attribute_id = ea.attribute_id
WHERE e.$entity_id in ($ids)
EOD;

echo $monster;

return DB::select(DB::raw($monster));
}

public function scopeSetStoreId($query, $storeId){
	$this->storeId = $storeId;
	echo "\n Set Store ID: $storeId\n";
	return $query;
}

public function scopeWithVarchar($query)
{
	echo "\n Get Store Id: $this->storeId \n";
		return $query->with( ['catalog_product_entity_varchars' => function ($query){
    		$query->leftJoinRelationship('eav_attribute')->addSelect(['eav_attribute.attribute_code'])
	    	->where('store_id', '=', $this->storeId);
	}
	]);
}
public function scopeWithInt($query)
    {
            return $query->with( ['catalog_product_entity_ints' => function ($query){
                    $query->leftJoinRelationship('eav_attribute')->addSelect(['eav_attribute.attribute_code'])
		->where('store_id', '=', $this->storeId);
                    }
            ]);
    }

public function scopeWithText($query)
    {
            return $query->with( ['catalog_product_entity_texts' => function ($query){
                    $query->leftJoinRelationship('eav_attribute')->addSelect(['eav_attribute.attribute_code'])
		->where('store_id', '=', $this->storeId);
                    }
            ]);
    }

public function scopeWithDecimal($query)
    {
            return $query->with( ['catalog_product_entity_decimals' => function ($query){
                    $query->leftJoinRelationship('eav_attribute')->addSelect(['eav_attribute.attribute_code'])
		->where('store_id', '=', $this->storeId);
                    }
            ]);
    }

public function scopeWithGallary($query)
    {
            return $query->with( ['catalog_product_entity_media_gallery_values' => function ($query){
            	$query->where('store_id', '=', $this->storeId);
	/*        
	$query->leftJoinRelationship('catalog_product_entity_media_gallery_values')->addSelect(['catalog_product_entity_media_gallery_values.*']);
              */
	      }
            ]);
    }

public function scopeWithPrice($query, $group = 0, $website = 0){

	return $query->with(['catalog_product_index_prices' =>  function($q) use ($group,$website){ 
		$q->where([
			['customer_group_id', '=', $group],
			['website_id', '=', $website]
			]);
	}
	]);
}

public  function scopeMergeEAV(){
	var_dump($this);
	/*
	$eav = [];

	foreach($collection as $product)
	 {
		var_dump($product);
		$eav[] = $product->catalog_product_entity_decimals;
		$eav[] = $product->catalog_product_entity_ints;
		$eav[] = $product->catalog_product_entity_varchar;
		$eav[] = $product->catalog_product_entity_texts;
	}

	var_dump($eav);*/
}

public function scopeGetEAVCache(){
$sql = <<<EOD

select distinct ea.attribute_id, ea.attribute_code, 'varchar' as type from catalog_product_entity_varchar eav right JOIN eav_attribute ea ON eav.attribute_id = ea.attribute_id
UNION select distinct ea.attribute_id, ea.attribute_code, 'int' as type from catalog_product_entity_int eav right JOIN eav_attribute ea ON eav.attribute_id = ea.attribute_id
EOD;
$attributes = DB::select(DB::raw($sql));

$attr = [];

foreach($attributes as $e) {
 $attr[$e->attribute_code] = $e->attribute_id;
}

$this->attrCache=$attr;
return $attr;
}

public function scopeAttr($q, $attribute_code){

// var_dump($this->catalog_product_entity_varchars->toArray());
$key = $this->catalog_product_entity_varchars->search(function($a) use ($attribute_code){ return $a->attribute_code === $attribute_code; });
return $this->catalog_product_entity_varchars[$key];
}

public function scopeTrans($q){

// $s = microtime(true);
$linarResult = &$this;

/* foreach($this->attributes as $name => $value){
$linarResult[$name] = $value;
}
*/

foreach ($this->attributeTables as $table){
	if (isset($this->$table)) { //echo $this->$o;
		foreach ($this->$table as $attribute){
		$linarResult[$attribute->attribute_code] = $attribute->value;
		}
		unset($this->$table);
	}
}

// $end = microtime(true); echo "Execution time = " . ($end - $s);

return $linarResult;
}

public function scopeToPG($q, $productData){

config(['database.connections.pgsql.host' => 'localhost']);
config(['database.connections.pgsql.port' => '5432']);
config(['database.connections.pgsql.database' => 'magento']);
config(['database.connections.pgsql.username' => 'postgres']);
config(['database.connections.pgsql.password' => '']);
$pg = DB::connection('pgsql');


foreach($productData as $product){
	$pg->table('product')->upsert(
			['id' => $product->row_id,'data' => $product->toJson()], ['id']
	);
}

DB::disconnect('mysql_source');
}

public function scopeProduct($q){

config(['database.connections.pgsql.host' => 'localhost']);
    config(['database.connections.pgsql.port' => '5432']);
    config(['database.connections.pgsql.database' => 'magento']);
    config(['database.connections.pgsql.username' => 'postgres']);
    config(['database.connections.pgsql.password' => '']);
 	$pg = DB::connection('pgsql')->table('product');

//$start = microtime(true); echo "Execution time = " . ($end - $s);

//$result = $pg->table('product')->select()->get();

//DB::disconnect('mysql_source');
    //$end = microtime(true); echo "JSON select Execution time = " . ($end - $start);

return $pg;
    }

Stock/Inventory SQL

SELECT main_table.*, cp_table.type_id FROM cataloginventory_stock_item AS main_table INNER JOIN catalog_product_entity AS cp_table ON main_table.product_id = cp_table.entity_id AND (cp_table.created_in <= '1630438980' AND cp_table.updated_in > '1630438980') WHERE (main_table.product_id IN('109340')) - > []

SELECT main_table.*, cp_table.sku, cp_table.type_id FROM cataloginventory_stock_status AS main_table INNER JOIN catalog_product_entity AS cp_table ON main_table.product_id = cp_table.entity_id AND (cp_table.created_in <= '1630438980' AND cp_table.updated_in > '1630438980') WHERE (main_table.product_id IN('109340')) AND (main_table.website_id = '0') - > []

SELECT e.*, stock_status_index.stock_status AS is_salable FROM catalog_product_entity AS e LEFT JOIN cataloginventory_stock_status AS stock_status_index ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1 WHERE ((e.entity_id = '109340')) AND (e.created_in <= '1630438980') AND (e.updated_in > '1630438980') - > []

SELECT e.*, price_index.price, price_index.tax_class_id, price_index.final_price, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS minimal_price, price_index.min_price, price_index.max_price, price_index.tier_price, cat_index.position AS cat_index_position, stock_status_index.stock_status AS is_salable, links.link_id, links.product_id AS _linked_to_product_id, link_attribute_position_int.value AS position FROM catalog_product_entity AS e INNER JOIN catalog_product_index_price AS price_index ON price_index.entity_id = e.entity_id AND price_index.customer_group_id = 0 AND price_index.website_id = '1' INNER JOIN catalog_category_product_index_store1 AS cat_index ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id=2 LEFT JOIN cataloginventory_stock_status AS stock_status_index ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1 INNER JOIN catalog_product_link AS links ON links.linked_product_id = e.entity_id AND links.link_type_id = 1 LEFT JOIN catalog_product_link_attribute_int AS link_attribute_position_int ON link_attribute_position_int.link_id = links.link_id AND link_attribute_position_int.product_link_attribute_id = '1' INNER JOIN catalog_product_entity AS product_entity_table ON links.product_id = product_entity_table.row_id AND (product_entity_table.created_in <= '1630438980' AND product_entity_table.updated_in > '1630438980') WHERE ((e.entity_id NOT IN('109340')) AND (links.product_id in (81983)) AND (e.row_id != '81983')) AND (e.created_in <= '1630438980') AND (e.updated_in > '1630438980') ORDER BY e.sku ASC LIMIT 20

SELECT e.*, price_index.price, price_index.tax_class_id, price_index.final_price, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS minimal_price, price_index.min_price, price_index.max_price, price_index.tier_price, cat_index.position AS cat_index_position, stock_status_index.stock_status AS is_salable FROM catalog_product_entity AS e INNER JOIN catalog_product_index_price AS price_index ON price_index.entity_id = e.entity_id AND price_index.customer_group_id = 0 AND price_index.website_id = '1' INNER JOIN catalog_category_product_index_store1 AS cat_index ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id=2 LEFT JOIN cataloginventory_stock_status AS stock_status_index ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1 WHERE ((e.entity_id IN(5690, 2513, 17711, 5174, 32798, 4790, 38782, 38788, 17612, 113135, 5140, 42506, 38779, 106283, 50338, 21245, 24160))) AND (e.created_in <= '1630438980') AND (e.updated_in > '1630438980') LIMIT 17

SELECT main_table.*, cp_table.type_id FROM cataloginventory_stock_item AS main_table
INNER JOIN catalog_product_entity AS cp_table ON main_table.product_id = cp_table.entity_id AND (cp_table.created_in <= '1630438980' AND cp_table.updated_in > '1630438980') WHERE (main_table.product_id IN('49996'))

Need to discuss in Magento forums

I think you need to discuss with Magento team directly,we need to convey them,so that directly we can contribute to Magento codebase directly in some other branch.so if everything fine and stable they can merge into main release branch.

Price Index / Price

SELECT catalogrule_product_price.product_id, catalogrule_product_price.rule_price FROM catalogrule_product_price WHERE (rule_date = '2021-10-12') AND (website_id = '1') AND (customer_group_id = 0) AND (product_id IN('25718'))

Price Index SQL catalog_product_index_price ...

SELECT e.*, price_index.price, price_index.tax_class_id, price_index.final_price, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS minimal_price, price_index.min_price, price_index.max_price, price_index.tier_price, cat_index.position AS cat_index_position, stock_status_index.stock_status AS is_salable, links.link_id, links.product_id AS _linked_to_product_id, link_attribute_position_int.value AS position FROM catalog_product_entity AS e INNER JOIN catalog_product_index_price AS price_index ON price_index.entity_id = e.entity_id AND price_index.customer_group_id = 0 AND price_index.website_id = '1' INNER JOIN catalog_category_product_index_store1 AS cat_index ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id=2 LEFT JOIN cataloginventory_stock_status AS stock_status_index ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1 INNER JOIN catalog_product_link AS links ON links.linked_product_id = e.entity_id AND links.link_type_id = 1 LEFT JOIN catalog_product_link_attribute_int AS link_attribute_position_int ON link_attribute_position_int.link_id = links.link_id AND link_attribute_position_int.product_link_attribute_id = '1' INNER JOIN catalog_product_entity AS product_entity_table ON links.product_id = product_entity_table.row_id AND (product_entity_table.created_in <= '1630438980' AND product_entity_table.updated_in > '1630438980') WHERE ((e.entity_id NOT IN('109340')) AND (links.product_id in (81983)) AND (e.row_id != '81983')) AND (e.created_in <= '1630438980') AND (e.updated_in > '1630438980') ORDER BY e.entity_id ASC LIMIT 20

Option Prices :

SELECT main_table.*, default_option_title.title AS default_title, store_option_title.title AS store_title, IF(store_option_title.title IS NULL, default_option_title.title, store_option_title.title) AS title, default_option_price.price AS default_price, default_option_price.price_type AS default_price_type, store_option_price.price AS store_price, store_option_price.price_type AS store_price_type, IF(store_option_price.price IS NULL, default_option_price.price, store_option_price.price) AS price, IF(store_option_price.price_type IS NULL, default_option_price.price_type, store_option_price.price_type) AS price_type FROM catalog_product_option AS main_table INNER JOIN catalog_product_entity AS cpe ON cpe.row_id = main_table.product_id AND (cpe.created_in <= '1630438980' AND cpe.updated_in > '1630438980') INNER JOIN catalog_product_option_title AS default_option_title ON default_option_title.option_id = main_table.option_id LEFT JOIN catalog_product_option_title AS store_option_title ON store_option_title.option_id = main_table.option_id AND store_option_title.store_id = 1 LEFT JOIN catalog_product_option_price AS default_option_price ON default_option_price.option_id = main_table.option_id AND default_option_price.store_id = 0 LEFT JOIN catalog_product_option_price AS store_option_price ON store_option_price.option_id = main_table.option_id AND store_option_price.store_id = 1 WHERE (cpe.entity_id = '109340') AND (default_option_title.store_id = 0) ORDER BY sort_order ASC, title ASC - > []

Tire customer Group Price:

SELECT catalog_product_entity_tier_price.value_id AS price_id, catalog_product_entity_tier_price.website_id, catalog_product_entity_tier_price.all_groups, catalog_product_entity_tier_price.customer_group_id AS cust_group, catalog_product_entity_tier_price.value AS price, catalog_product_entity_tier_price.qty AS price_qty, catalog_product_entity_tier_price.percentage_value FROM catalog_product_entity_tier_price WHERE (website_id = 0) AND (row_id = '81983') ORDER BY qty ASC

CAtalog rule Product Price:

SELECT catalogrule_product_price.product_id, catalogrule_product_price.rule_price FROM catalogrule_product_price WHERE (rule_date = '2021-10-12') AND (website_id = '1') AND (customer_group_id = 0) AND (product_id IN('109340')) - > []

Gallery SQL

SQL to select Gallery stuff for MAgento 2

SELECT main.value_id, main.value AS file, main.media_type, entity.row_id, IFNULL(value.label, default_value.label) AS label, IFNULL(value.position, default_value.position) AS position, IFNULL(value.disabled, default_value.disabled) AS disabled, default_value.label AS label_default, default_value.position AS position_default, default_value.disabled AS disabled_default, IFNULL(value_video.provider, default_value_video.provider) AS video_provider, IFNULL(value_video.url, default_value_video.url) AS video_url, IFNULL(value_video.title, default_value_video.title) AS video_title, IFNULL(value_video.description, default_value_video.description) AS video_description, IFNULL(value_video.metadata, default_value_video.metadata) AS video_metadata, default_value_video.provider AS video_provider_default, default_value_video.url AS video_url_default, default_value_video.title AS video_title_default, default_value_video.description AS video_description_default, default_value_video.metadata AS video_metadata_default FROM catalog_product_entity_media_gallery AS main INNER JOIN catalog_product_entity_media_gallery_value_to_entity AS entity ON main.value_id = entity.value_id LEFT JOIN catalog_product_entity_media_gallery_value AS value ON main.value_id = value.value_id AND value.store_id = 1 AND value.row_id = entity.row_id LEFT JOIN catalog_product_entity_media_gallery_value AS default_value ON main.value_id = default_value.value_id AND default_value.store_id = 0 AND default_value.row_id = entity.row_id LEFT JOIN catalog_product_entity_media_gallery_value_video AS value_video ON value.value_id = value_video.value_id AND value.store_id = value_video.store_id LEFT JOIN catalog_product_entity_media_gallery_value_video AS default_value_video ON default_value.value_id = default_value_video.value_id AND default_value.store_id = default_value_video.store_id WHERE (main.attribute_id = '88') AND (main.disabled = 0) AND (entity.row_id = '81983') ORDER BY IF(value.position IS NULL, default_value.position, value.position)

SELECT main.value_id, main.value AS file, main.media_type, entity.row_id, IFNULL(value.label, default_value.label) AS label, IFNULL(value.position, default_value.position) AS position, IFNULL(value.disabled, default_value.disabled) AS disabled, default_value.label AS label_default, default_value.position AS position_default, default_value.disabled AS disabled_default, IFNULL(value_video.provider, default_value_video.provider) AS video_provider, IFNULL(value_video.url, default_value_video.url) AS video_url, IFNULL(value_video.title, default_value_video.title) AS video_title, IFNULL(value_video.description, default_value_video.description) AS video_description, IFNULL(value_video.metadata, default_value_video.metadata) AS video_metadata, default_value_video.provider AS video_provider_default, default_value_video.url AS video_url_default, default_value_video.title AS video_title_default, default_value_video.description AS video_description_default, default_value_video.metadata AS video_metadata_default FROM catalog_product_entity_media_gallery AS main

  | INNER JOIN catalog_product_entity_media_gallery_value_to_entity AS entity ON main.value_id = entity.value_id
  | LEFT JOIN catalog_product_entity_media_gallery_value AS value ON main.value_id = value.value_id AND value.store_id = 1 AND value.row_id = entity.row_id
  | LEFT JOIN catalog_product_entity_media_gallery_value AS default_value ON main.value_id = default_value.value_id AND default_value.store_id = 0 AND default_value.row_id = entity.row_id
  | LEFT JOIN catalog_product_entity_media_gallery_value_video AS value_video ON value.value_id = value_video.value_id AND value.store_id = value_video.store_id
  | LEFT JOIN catalog_product_entity_media_gallery_value_video AS default_value_video ON default_value.value_id = default_value_video.value_id AND default_value.store_id = default_value_video.store_id WHERE (main.attribute_id = '88') AND (main.disabled = 0) AND (entity.row_id = '81983') ORDER BY IF(value.position IS NULL, default_value.position, value.position) ASC

Category SQL

SELECT catalog_category_product.category_id, catalog_category_product.position FROM catalog_category_product WHERE (product_id = 109340) - > []

SELECT catalog_category_entity.entity_id FROM catalog_category_entity WHERE ((entity_id = :entity_id)) AND (catalog_category_entity.created_in <= '1630438980') AND (catalog_category_entity.updated_in > '1630438980') - > [2] SQL time [0.00021600723266602] SELECT catalog_category_entity.* FROM catalog_category_entity WHERE ((catalog_category_entity.entity_id = '2')) AND (catalog_category_entity.created_in <= '1630438980') AND (catalog_category_entity.updated_in > '1630438980') - > [] SQL time [0.00021696090698242] SELECT catalog_category_entity.* FROM catalog_category_entity WHERE ((catalog_category_entity.path LIKE '1/2/%')) AND (catalog_category_entity.created_in <= '1630438980') AND (catalog_category_entity.updated_in > '1630438980') ORDER BY catalog_category_entity.position ASC - > [] SQL time [0.0004429817199707] SELECT e.entity_id FROM catalog_category_entity AS e LEFT JOIN catalog_category_entity_varchar AS at_name_default ON (at_name_default.row_id = e.row_id) AND (at_name_default.attribute_id = '41') AND at_name_default.store_id = 0 LEFT JOIN catalog_category_entity_varchar AS at_name ON (at_name.row_id = e.row_id) AND (at_name.attribute_id = '41') AND (at_name.store_id = 1) INNER JOIN catalog_category_entity_int AS d ON e.row_id = d.row_id LEFT JOIN catalog_category_entity_int AS c ON c.attribute_id = :attribute_id AND c.store_id = :store_id AND c.row_id = d.row_id WHERE ((e.entity_id IN('286', '116', )) AND (d.attribute_id = :attribute_id) AND (d.store_id = :zero_store_id) AND (IF(c.value_id > 0, c.value, d.value) = :cond)) AND (e.created_in <= '1630438980') AND (e.updated_in > '1630438980') - > [42 - 1 - 0 - 0]

EAV:

SELECT t_d.attribute_id, e.entity_id, t_d.value AS default_value, t_s.value AS store_value, IF(t_s.value_id IS NULL, t_d.value, t_s.value) AS value FROM catalog_category_entity_varchar AS t_d INNER JOIN catalog_category_entity AS e ON e.row_id = t_d.row_id AND (e.created_in <= '1630438980' AND e.updated_in > '1630438980') LEFT JOIN catalog_category_entity_varchar AS t_s ON t_s.attribute_id = t_d.attribute_id AND t_s.row_id = t_d.row_id AND t_s.store_id = 1 WHERE (e.entity_id IN (

URL Rewrite

URL Rewrite:

SELECT url_rewrite.* FROM url_rewrite WHERE (request_path IN ('cameradept/camera-equipment/l', 'cameradept/camera-equipment/')) AND (store_id IN ('1')) - > []

SELECT url_rewrite.* FROM url_rewrite WHERE (request_path IN ('cameradept/cameral', 'cameradept/camera-equipment//')) AND (store_id IN ('1')) - > []

SELECT url_rewrite.* FROM url_rewrite WHERE (request_path IN ('catalog/product/view/id/109340/category/8679', 'catalog/product/view/id/109340/category/8679/')) AND (store_id IN ('1')) - > []

SELECT url_rewrite.*, relation.category_id, relation.product_id FROM url_rewrite LEFT JOIN catalog_url_rewrite_product_category AS relation ON url_rewrite.url_rewrite_id = relation.url_rewrite_id WHERE (url_rewrite.request_path IN ('catalog/product/view/id/109340/category/8679', 'catalog/product/view/id/109340/category/8679/')) AND (url_rewrite.store_id IN ('1')) AND (relation.category_id IS NULL) - > []

SELECT url_rewrite.*, relation.category_id, relation.product_id FROM url_rewrite LEFT JOIN catalog_url_rewrite_product_category AS relation ON url_rewrite.url_rewrite_id = relation.url_rewrite_id WHERE (url_rewrite.entity_id IN ('109340')) AND (url_rewrite.entity_type IN ('product')) AND (url_rewrite.store_id IN (1)) AND (relation.category_id IS NULL) - > []

SELECT url_rewrite.*, relation.category_id, relation.product_id FROM url_rewrite LEFT JOIN catalog_url_rewrite_product_category AS relation ON url_rewrite.url_rewrite_id = relation.url_rewrite_id WHERE (url_rewrite.entity_type IN ('product')) AND (url_rewrite.entity_id IN ('456', '3618', '5142', '5174', '5689', '5690', '17711', '21247', '24160', '38761', '38779', '38782', '42506', '49597', '106283', '111329', '113135')) AND (url_rewrite.store_id IN (1)) AND (url_rewrite.is_autogenerated IN (1)) AND (relation.category_id IS NULL) - > []
S

Magento Search Re-index SQL - Product-EAV

SELECT catalog_product_index_price.entity_id, catalog_product_index_price.customer_group_id, catalog_product_index_price.website_id, catalog_product_index_price.min_price FROM catalog_product_index_price WHERE (entity_id IN ()) - > []

SELECT e.entity_id, e.type_id, e.sku FROM catalog_product_entity AS e
INNER JOIN catalog_product_website AS website ON website.product_id = e.entity_id AND website.website_id = 4
INNER JOIN cataloginventory_stock_status AS stock_index ON stock_index.product_id = e.entity_id
INNER JOIN catalog_product_entity_int AS visibility_default ON visibility_default.row_id= e.row_id AND visibility_default.attribute_id = '102' AND visibility_default.store_id = 0
LEFT JOIN catalog_product_entity_int AS visibility_store ON visibility_store.row_id= e.row_id AND visibility_store.attribute_id = '102' AND visibility_store.store_id = 4
INNER JOIN catalog_product_entity_int AS status_default ON status_default.row_id= e.row_id AND status_default.attribute_id = '96' AND status_default.store_id = 0
LEFT JOIN catalog_product_entity_int AS status_store ON status_store.row_id= e.row_id AND status_store.attribute_id = '96' AND status_store.store_id = 4 WHERE ((IF(visibility_store.value_id > 0, visibility_store.value, visibility_default.value) IN (3, 2, 4)) AND (IF(status_store.value_id > 0, status_store.value, status_default.value) IN (1)) AND (e.entity_id > 115324) AND (e.entity_id < 117825)) AND (e.created_in <= '1630438980') AND (e.updated_in > '1630438980') ORDER BY e.entity_id ASC

SELECT DISTINCT t.row_id, t.attribute_id, IF(t_store.value_id > 0, t_store.value, t_default.value) AS value FROM catalog_product_entity_int AS t
LEFT JOIN catalog_product_entity_int AS t_store ON t.row_id=t_store.row_id AND t.attribute_id=t_store.attribute_id AND t_store.store_id = '4'
LEFT JOIN catalog_product_entity_int AS t_default ON t.row_id=t_default.row_id AND t.attribute_id=t_default.attribute_id AND t_default.store_id = 0 WHERE (t.attribute_id IN (1319, 624 )) UNION ALL SELECT DISTINCT t.row_id, t.attribute_id, IF(t_store.value_id > 0, t_store.value, t_default.value) AS value FROM catalog_product_entity_varchar AS t
LEFT JOIN catalog_product_entity_varchar AS t_store ON t.row_id=t_store.row_id AND t.attribute_id=t_store.attribute_id AND t_store.store_id = '4'
LEFT JOIN catalog_product_entity_varchar AS t_default ON t.row_id=t_default.row_id AND t.attribute_id=t_default.attribute_id AND t_default.store_id = 0 WHERE (t.attribute_id IN (1313, 1301, )) UNION ALL SELECT DISTINCT t.row_id, t.attribute_id, IF(t_store.value_id > 0, t_store.value, t_default.value) AS value FROM catalog_product_entity_text AS t
LEFT JOIN catalog_product_entity_text AS t_store ON t.row_id=t_store.row_id AND t.attribute_id=t_store.attribute_id AND t_store.store_id = '4'
LEFT JOIN catalog_product_entity_text AS t_default ON t.row_id=t_default.row_id AND t.attribute_id=t_default.attribute_id AND t_default.store_id = 0 WHERE (t.attribute_id IN (72, 83, 73, 343, 332)) AND (t.row_id IN (2039, 11192, )) UNION ALL SELECT DISTINCT t.row_id, t.attribute_id, IF(t_store.value_id > 0, t_store.value, t_default.value) AS value FROM catalog_product_entity_decimal AS t
LEFT JOIN catalog_product_entity_decimal AS t_store ON t.row_id=t_store.row_id AND t.attribute_id=t_store.attribute_id AND t_store.store_id = '4'
LEFT JOIN catalog_product_entity_decimal AS t_default ON t.row_id=t_default.row_id AND t.attribute_id=t_default.attribute_id AND t_default.store_id = 0 WHERE (t.attribute_id IN (75)) AND (t.row_id IN (......))

SELECT u.* FROM ( (SELECT t.value, t.attribute_id, t.store_id FROM catalog_category_entity_text AS t WHERE (row_id = '8183') AND (attribute_id IN (743, 746, 764, 749, 752, 1406, 755, 1409, 758, 1410, 44, 761, 1411, 1412, 1413, 47, 1414, 48, 54, 55, 56, 1424, 1425, 1428, 1440, 1441, 1443, 1444, 65, 721, 62, 1075, 711, 1079, 713, 1083, 1085, 715, 716)) AND (store_id IN ('4', 0)))UNION ALL(SELECT t.value, t.attribute_id, t.store_id FROM catalog_category_entity_varchar AS t WHERE (row_id = '8183') AND (attribute_id IN (41, 1408, 43, 45, 46, 1415, 1416, 49, 58, 701, 1063, 1417, 1429, 1418, 1419, 1431, 1432, 1420, 1421, 1422, 57, 718, 1065, 1434, 1438, 1439, 1457, 1442, 705, 719, 1445, 720, 800, 1069, 133, 61, 66, 1071, 1139, 1073, 709, 710, 1077, 425, 1081, 660, 1087, 1089, 1091, 1375, 1378, 1381, 1387, 1390)) AND (store_id IN ('4', 0)))UNION ALL(SELECT t.value, t.attribute_id, t.store_id FROM catalog_category_entity_int AS t WHERE (row_id = '8183') AND (attribute_id IN (42, 1407, 1446, 1447, 68, 69, 67, 703, 717, 1448, 1430, 1433, 1450, 1423, 1451, 1452, 50, 1435, 1426, 1436, 1427, 1437, 1456, 51, 1067, 1061, 1400, 426, 428, 1384)) AND (store_id IN ('4', 0)))UNION ALL(SELECT t.value, t.attribute_id, t.store_id FROM catalog_category_entity_datetime AS t WHERE (row_id = '8183') AND (attribute_id IN (59, 60, 656, 657)) AND (store_id IN ('4', 0)))UNION ALL(SELECT t.value, t.attribute_id, t.store_id FROM catalog_category_entity_decimal AS t WHERE (row_id = '8183') AND (attribute_id IN (70)) AND (store_id IN ('4', 0))) ) AS u ORDER BY store_id ASC

SELECT u.* FROM ( (SELECT t.value, t.attribute_id, t.store_id FROM catalog_category_entity_text AS t WHERE (row_id = '7279') AND (attribute_id IN (743, 746, 764, 749, 752, 1406, 755, 1409, 758, 1410, 44, 761, 1411, 1412, 1413, 47, 1414, 48, 54, 55, 56, 1424, 1425, 1428, 1440, 1441, 1443, 1444, 65, 721, 62, 1075, 711, 1079, 713, 1083, 1085, 715, 716)) AND (store_id IN ('4', 0)))UNION ALL(SELECT t.value, t.attribute_id, t.store_id FROM catalog_category_entity_varchar AS t WHERE (row_id = '7279') AND (attribute_id IN (41, 1408, 43, 45, 46, 1415, 1416, 49, 58, 701, 1063, 1417, 1429, 1418, 1419, 1431, 1432, 1420, 1421, 1422, 57, 718, 1065, 1434, 1438, 1439, 1457, 1442, 705, 719, 1445, 720, 800, 1069, 133, 61, 66, 1071, 1139, 1073, 709, 710, 1077, 425, 1081, 660, 1087, 1089, 1091, 1375, 1378, 1381, 1387, 1390)) AND (store_id IN ('4', 0)))UNION ALL(SELECT t.value, t.attribute_id, t.store_id FROM catalog_category_entity_int AS t WHERE (row_id = '7279') AND (attribute_id IN (42, 1407, 1446, 1447, 68, 69, 67, 703, 717, 1448, 1430, 1433, 1450, 1423, 1451, 1452, 50, 1435, 1426, 1436, 1427, 1437, 1456, 51, 1067, 1061, 1400, 426, 428, 1384)) AND (store_id IN ('4', 0)))UNION ALL(SELECT t.value, t.attribute_id, t.store_id FROM catalog_category_entity_datetime AS t WHERE (row_id = '7279') AND (attribute_id IN (59, 60, 656, 657)) AND (store_id IN ('4', 0)))UNION ALL(SELECT t.value, t.attribute_id, t.store_id FROM catalog_category_entity_decimal AS t WHERE (row_id = '7279') AND (attribute_id IN (70)) AND (store_id IN ('4', 0))) ) AS u ORDER BY store_id ASC

SELECT cpe.row_id, cpe.entity_id FROM catalog_product_entity AS cpe WHERE ((cpe.entity_id IN (117190, 117195, 117201, 117204, 117207, ...))) AND (cpe.created_in <= '1630438980') AND (cpe.updated_in > '1630438980') - > []

SQL time [0.00033807754516602]

SELECT DISTINCT t.row_id, t.attribute_id, IF(t_store.value_id > 0, t_store.value, t_default.value) AS value FROM catalog_product_entity_int AS t
LEFT JOIN catalog_product_entity_int AS t_store ON t.row_id=t_store.row_id AND t.attribute_id=t_store.attribute_id AND t_store.store_id = '4'
LEFT JOIN catalog_product_entity_int AS t_default ON t.row_id=t_default.row_id AND t.attribute_id=t_default.attribute_id AND t_default.store_id = 0 WHERE (t.attribute_id IN (1319, 624, 420, 463, ....)) UNION ALL SELECT DISTINCT t.row_id, t.attribute_id, IF(t_store.value_id > 0, t_store.value, t_default.value) AS value FROM catalog_product_entity_varchar AS t
LEFT JOIN catalog_product_entity_varchar AS t_store ON t.row_id=t_store.row_id AND t.attribute_id=t_store.attribute_id AND t_store.store_id = '4'
LEFT JOIN catalog_product_entity_varchar AS t_default ON t.row_id=t_default.row_id AND t.attribute_id=t_default.attribute_id AND t_default.store_id = 0 WHERE (t.attribute_id IN (1313, 1301, 1307, 1295, 410, 84, 82, 727, 71, 1026, 413, 97, 1229)) AND (t.row_id IN (5600, 17314, 19355, ....)) UNION ALL SELECT DISTINCT t.row_id, t.attribute_id, IF(t_store.value_id > 0, t_store.value, t_default.value) AS value FROM catalog_product_entity_text AS t
LEFT JOIN catalog_product_entity_text AS t_store ON t.row_id=t_store.row_id AND t.attribute_id=t_store.attribute_id AND t_store.store_id = '4'
LEFT JOIN catalog_product_entity_text AS t_default ON t.row_id=t_default.row_id AND t.attribute_id=t_default.attribute_id AND t_default.store_id = 0 WHERE (t.attribute_id IN (72, 83, 73, 343, 332)) AND (t.row_id IN (5600, 17314, 19355, 19381, 58763, 39463, 51842 ....)) UNION ALL SELECT DISTINCT t.row_id, t.attribute_id, IF(t_store.value_id > 0, t_store.value, t_default.value) AS value FROM catalog_product_entity_decimal AS t
LEFT JOIN catalog_product_entity_decimal AS t_store ON t.row_id=t_store.row_id AND t.attribute_id=t_store.attribute_id AND t_store.store_id = '4'
LEFT JOIN catalog_product_entity_decimal AS t_default ON t.row_id=t_default.row_id AND t.attribute_id=t_default.attribute_id AND t_default.store_id = 0 WHERE (t.attribute_id IN (75)) AND (t.row_id IN (5600, 17314, 19355, .....))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.