1

How can I get all SKUs and Product URLs using only SQL Query?

1

Magento does not save product URLs completely in database tables. It saves only URL key, so you can get SKU and URL key directly from tables.

SKU is saved in catalog_product_entity table.

By default product's URL key is an attribute which is of type varchar, so its value is saved in catalog_product_entity_varchar table. By default attribute id of product's URL key is 124.

Please let me know if you want more detail.

  • The catalog_product_entity table does not contain URL key in 2.1.7 .However, how can we construct the complete URL from the URL key? – observo Jul 11 '17 at 11:40
  • I think all the URLs are available in the url_rewrite table. Now the question comes in how to link this URL with the SKU. – observo Jul 11 '17 at 11:55
  • Yes, you are going in right direction. – Mohit Kumar Arora Jul 11 '17 at 11:56
  • You can get ID from sku and then get url from url rewrite table using path. – Mohit Kumar Arora Jul 11 '17 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.