1
1
<?php
2
2
3
-
4
3
namespace ManishJoy \ProductUrlRewrite \Console \Command ;
5
4
6
5
use Symfony \Component \Console \Command \Command ;
@@ -120,10 +119,10 @@ public function enterNewUrlRewrite($_product)
120
119
$ requestPathWithoutSuffix = $ _product ->getUrlKey ();
121
120
122
121
// check if request path exists
123
- $ mathcingRows = $ connection ->fetchAll ("SELECT `url_rewrite_id` FROM " . $ urlRewriteTable . " WHERE `entity_type` = 'product' AND `request_path` = " ."' " .$ requestPathWithoutSuffix .$ this ->getProductUrlSuffix ()."' " );
122
+ $ mathcingRows = $ connection ->fetchAll ("SELECT `url_rewrite_id` FROM " . $ urlRewriteTable . " WHERE `entity_type` = 'product' AND `store_id` = " . $ storeId . " AND ` request_path` = " ."' " .$ requestPathWithoutSuffix .$ this ->getProductUrlSuffix ()."' " );
124
123
while (count ($ mathcingRows ) > 0 ) {
125
124
$ requestPathWithoutSuffix .= '-1 ' ;
126
- $ mathcingRows = $ connection ->fetchAll ("SELECT `url_rewrite_id` FROM " . $ urlRewriteTable . " WHERE `entity_type` = 'product' AND `request_path` = " ."' " .$ requestPathWithoutSuffix .$ this ->getProductUrlSuffix ()."' " );
125
+ $ mathcingRows = $ connection ->fetchAll ("SELECT `url_rewrite_id` FROM " . $ urlRewriteTable . " WHERE `entity_type` = 'product' AND `store_id` = " . $ storeId . " AND ` request_path` = " ."' " .$ requestPathWithoutSuffix .$ this ->getProductUrlSuffix ()."' " );
127
126
}
128
127
$ requestPath = $ requestPathWithoutSuffix .$ this ->getProductUrlSuffix ();
129
128
@@ -142,10 +141,10 @@ public function enterNewUrlRewrite($_product)
142
141
$ requestPathWithoutSuffix = $ categoryPath .$ _product ->getUrlKey ();
143
142
144
143
// check if request path exists
145
- $ mathcingRows = $ connection ->fetchAll ("SELECT `url_rewrite_id` FROM " . $ urlRewriteTable . " WHERE `entity_type` = 'product' AND `request_path` = " ."' " .$ requestPathWithoutSuffix .$ this ->getProductUrlSuffix ()."' " );
144
+ $ mathcingRows = $ connection ->fetchAll ("SELECT `url_rewrite_id` FROM " . $ urlRewriteTable . " WHERE `entity_type` = 'product' AND `store_id` = " . $ storeId . " AND ` request_path` = " ."' " .$ requestPathWithoutSuffix .$ this ->getProductUrlSuffix ()."' " );
146
145
while (count ($ mathcingRows ) > 0 ) {
147
146
$ requestPathWithoutSuffix .= '-1 ' ;
148
- $ mathcingRows = $ connection ->fetchAll ("SELECT `url_rewrite_id` FROM " . $ urlRewriteTable . " WHERE `entity_type` = 'product' AND `request_path` = " ."' " .$ requestPathWithoutSuffix .$ this ->getProductUrlSuffix ()."' " );
147
+ $ mathcingRows = $ connection ->fetchAll ("SELECT `url_rewrite_id` FROM " . $ urlRewriteTable . " WHERE `entity_type` = 'product' AND `store_id` = " . $ storeId . " AND ` request_path` = " ."' " .$ requestPathWithoutSuffix .$ this ->getProductUrlSuffix ()."' " );
149
148
}
150
149
$ requestPath = $ requestPathWithoutSuffix .$ this ->getProductUrlSuffix ();
151
150
$ requestPath = $ categoryPath .$ _product ->getUrlKey ().$ this ->getProductUrlSuffix ();
0 commit comments