@@ 51-74 (lines=24) @@ | ||
48 | * Generate product url by product |
|
49 | * @param $args |
|
50 | */ |
|
51 | public function callbackGenerateProductUrl($args) |
|
52 | { |
|
53 | try { |
|
54 | if (!isset($args['row']['entity_id'])) { |
|
55 | $this->output->writeln('Id not found'); |
|
56 | return; |
|
57 | } |
|
58 | $productId = $args['row']['entity_id']; |
|
59 | $this->progressBar->setMessage($productId); |
|
60 | $this->progressBar->advance(); |
|
61 | ||
62 | ||
63 | $product = clone $args['product']; |
|
64 | $product->load($productId); |
|
65 | $product->setStoreId(null); |
|
66 | $this->removeProductUrls($productId); |
|
67 | $this->replaceUrls( |
|
68 | $this->prepareUrls($product) |
|
69 | ); |
|
70 | } catch (\Exception $e) { |
|
71 | $this->output->writeln($e->getMessage() . '- Product ID -' . $productId); |
|
72 | return; |
|
73 | } |
|
74 | } |
|
75 | ||
76 | /** |
|
77 | * Remove Product urls |
@@ 74-95 (lines=22) @@ | ||
71 | * Generate product url by product |
|
72 | * @param $args |
|
73 | */ |
|
74 | public function callbackGenerateProductUrl($args) |
|
75 | { |
|
76 | if (!isset($args['row']['entity_id'])) { |
|
77 | $this->output->writeln('Id not found'); |
|
78 | return; |
|
79 | } |
|
80 | $id = $args['row']['entity_id']; |
|
81 | $this->progressBar->setMessage($id); |
|
82 | $this->progressBar->advance(); |
|
83 | ||
84 | try { |
|
85 | $product = clone $args['product']; |
|
86 | $product->load($id); |
|
87 | $product->setStoreId(null); |
|
88 | $this->replaceUrls( |
|
89 | $this->prepareUrls($product) |
|
90 | ); |
|
91 | } catch (\Exception $e) { |
|
92 | $this->output->writeln($e->getMessage() . '- Product ID -' . $id); |
|
93 | return; |
|
94 | } |
|
95 | } |
|
96 | ||
97 | ||
98 |