├── Api ├── GetCategoryUrlByIdManagementInterface.php ├── GetProductUrlByIdManagementInterface.php └── GetProductUrlBySkuManagementInterface.php ├── Model ├── GetCategoryUrlByIdManagement.php ├── GetProductUrlByIdManagement.php └── GetProductUrlBySkuManagement.php ├── README.md ├── composer.json ├── etc ├── di.xml ├── module.xml └── webapi.xml └── registration.php /Api/GetCategoryUrlByIdManagementInterface.php: -------------------------------------------------------------------------------- 1 | categoryRepository = $categoryRepository; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | public function getCategoryUrlById($categoryId, $storeId) 35 | { 36 | try { 37 | return $this->categoryRepository->get($categoryId, $storeId)->getUrl(); 38 | } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { 39 | return 'Requested store or category doesn\'t exist'; 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Model/GetProductUrlByIdManagement.php: -------------------------------------------------------------------------------- 1 | productRepository = $productRepository; 28 | } 29 | 30 | /** 31 | * {@inheritdoc} 32 | */ 33 | public function getProductUrlById($productId, $storeId) 34 | { 35 | try { 36 | return $this->productRepository->getById($productId, false, $storeId)->getProductUrl(); 37 | } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { 38 | return 'Requested store or product doesn\'t exist'; 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Model/GetProductUrlBySkuManagement.php: -------------------------------------------------------------------------------- 1 | productRepository = $productRepository; 28 | } 29 | 30 | /** 31 | * {@inheritdoc} 32 | */ 33 | public function getProductUrlBySku($productSku, $storeId) 34 | { 35 | try { 36 | return $this->productRepository->get($productSku, false, $storeId)->getProductUrl(); 37 | } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { 38 | return 'Requested store or product doesn\'t exist'; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Module add additional web API to the Magento 2 store 2 | 3 | 4 | 5 | 1. Get Product URL By SKU 6 | 7 | Example: 8 | 9 | https://mysite.com/index.php/rest/V1/products/sku/24-MB01/store/1/url 10 | 11 | 2. Get Product URL By ID 12 | 13 | Example: 14 | 15 | https://mysite.com/index.php/rest/V1/products/id/1/store/1/url 16 | 17 | 3. Get Category URL by ID 18 | 19 | Example: 20 | 21 | https://mysite.com/index.php/rest/V1/categories/2/store/1/url 22 | 23 | ## 🇺🇦 Stand with Ukraine! [How can you help?](https://magefan.com/blog/join-our-donations) 24 | 25 | ## Installation Instruction 26 | https://magefan.com/blog/how-to-install-magento-2-extension-2 27 | 28 | ## Support 29 | If you have any issues, please [contact us](mailto:support@magefan.com) 30 | then if you still need help, open a bug report in GitHub's 31 | [issue tracker](https://github.com/magefan/module-blog/issues). 32 | 33 | 34 | ## Need More Features? 35 | Please contact us to get a quote 36 | https://magefan.com/contact 37 | 38 | ## License 39 | The code is licensed under [EULA](https://magefan.com/end-user-license-agreement). 40 | 41 | ## [Magento 2 Extensions](https://magefan.com/magento-2-extensions) by Magefan 42 | 43 | ### [Magento 2 Google Extensions](https://magefan.com/magento-2-extensions/google-extensions) 44 | 45 | * [Magento 2 Google Indexing](https://magefan.com/magento-2-google-indexing-api) 46 | * [Magento 2 Google Analytics 4](https://magefan.com/magento-2-google-analytics-4) 47 | * [Magento 2 Google Tag Manager](https://magefan.com/magento-2-google-tag-manager) 48 | * [Magento 2 Google Shopping Feed](https://magefan.com/magento-2-google-shopping-feed-extension) 49 | * [Magento 2 Google Customer Reviews](https://magefan.com/magento-2-google-customer-reviews) 50 | 51 | ### Magento 2 SEO Extensions 52 | 53 | * [Magento 2 SEO Extension](https://magefan.com/magento-2-seo-extension) 54 | * [Magento 2 Rich Snippets](https://magefan.com/magento-2-rich-snippets) 55 | * [Magento 2 HTML Sitemap](https://magefan.com/magento-2-html-sitemap-extension) 56 | * [Magento 2 XML Sitemap](https://magefan.com/magento-2-xml-sitemap-extension) 57 | * [Magento 2 Facebook Open Graph](https://magefan.com/magento-2-open-graph-extension-og-tags) 58 | * [Magento 2 Twitter Cards](https://magefan.com/magento-2-twitter-cards-extension) 59 | 60 | 61 | ### [Magento 2 Speed Optimization Extensions](https://magefan.com/magento-2-extensions/speed-optimization) 62 | 63 | * [Magento 2 Google Page Speed Optimizer](https://magefan.com/magento-2-google-page-speed-optimizer) 64 | * [Magento 2 Full Page Cache Warmer](https://magefan.com/magento-2-full-page-cache-warmer) 65 | * [Magento 2 Image Lazy Load](https://magefan.com/magento-2-image-lazy-load-extension) 66 | * [Magento 2 WebP Images](https://magefan.com/magento-2-webp-optimized-images) 67 | * [Magento 2 Rocket JavaScript](https://magefan.com/rocket-javascript-deferred-javascript) 68 | 69 | ### [Magento 2 Admin Panel Extensions](https://magefan.com/magento-2-extensions/admin-extensions) 70 | 71 | * [Magento 2 Size Chart Extension](https://magefan.com/magento-2-size-chart) 72 | * [Magento 2 Security Extension](https://magefan.com/magento-2-security-extension) 73 | * [Magento 2 Admin Action Log](https://magefan.com/magento-2-admin-action-log) 74 | * [Magento 2 Order Editor](https://magefan.com/magento-2-edit-order-extension) 75 | * [Magento 2 Better Order Grid](https://magefan.com/magento-2-better-order-grid-extension) 76 | * [Magento 2 Extended Product Grid](https://magefan.com/magento-2-product-grid-inline-editor) 77 | * [Magento 2 Product Tabs](https://magefan.com/magento-2/extensions/product-tabs) 78 | * [Magento 2 Facebook Pixel](https://magefan.com/magento-2-facebook-pixel-extension) 79 | * [Magento 2 Email Attachments](https://magefan.com/magento-2-email-attachments) 80 | * [Magento 2 Admin View](https://magefan.com/magento-2-admin-view-extension) 81 | * [Magento 2 Admin Email Notifications](https://magefan.com/magento-2-admin-email-notifications) 82 | * [Magento 2 Login As Customer](https://magefan.com/login-as-customer-magento-2-extension) 83 | 84 | ### Magento 2 Blog Extensions 85 | 86 | * [Magento 2 Blog](https://magefan.com/magento2-blog-extension) 87 | * [Magento 2 Multi Blog](https://magefan.com/magento-2-multi-blog-extension) 88 | * [Magento 2 Product Widget](https://magefan.com/magento-2-product-widget) 89 | 90 | ### [Magento 2 Marketing Automation Extensions](https://magefan.com/magento-2-extensions/marketing-automation) 91 | 92 | * [Magento 2 Cookie Consent](https://magefan.com/magento-2-cookie-consent) 93 | * [Magento 2 Product Labels](https://magefan.com/magento-2-product-labels) 94 | * [Magento 2 Base Price](https://magefan.com/magento-2-base-price) 95 | * [Magento 2 Dynamic Categories](https://magefan.com/magento-2-dynamic-categories) 96 | * [Magento 2 Dynamic Blocks and Pages Extension](https://magefan.com/magento-2-cms-display-rules-extension) 97 | * [Magento 2 Automatic Related Products](https://magefan.com/magento-2-automatic-related-products) 98 | * [Magento 2 Price History](https://magefan.com/magento-2-price-history) 99 | * [Magento 2 Mautic Integration](https://magefan.com/magento-2-mautic-extension) 100 | * [Magento 2 YouTube Video](https://magefan.com/magento2-youtube-extension) 101 | 102 | ### [Magento 2 Cart Extensions](https://magefan.com/magento-2-extensions/cart-extensions) 103 | 104 | * [Magento 2 Checkout Extension](https://magefan.com/better-magento-2-checkout-extension) 105 | * [Magento 2 Coupon Code](https://magefan.com/magento-2-coupon-code-link) 106 | * [Magento 2 Guest to Customer](https://magefan.com/magento2-convert-guest-to-customer) 107 | 108 | ### [Magento 2 Multi-Language Extensions](https://magefan.com/magento-2-extensions/multi-language-extensions) 109 | 110 | * [Magento 2 Hreflang Tags](https://magefan.com/magento2-alternate-hreflang-extension) 111 | * [Magento 2 Auto Currency Switcher](https://magefan.com/magento-2-currency-switcher-auto-currency-by-country) 112 | * [Magento 2 Auto Language Switcher](https://magefan.com/magento-2-auto-language-switcher) 113 | * [Magento 2 GeoIP Store Switcher](https://magefan.com/magento-2-geoip-switcher-extension) 114 | * [Magento 2 Translation](https://magefan.com/magento-2-translation-extension) 115 | 116 | ### [Developers Tools](https://magefan.com/magento-2-extensions/developer-tools) 117 | 118 | * [Magento 2 Zero Downtime Deployment](https://magefan.com/blog/magento-2-zero-downtime-deployment) 119 | * [Magento 2 Cron Schedule](https://magefan.com/magento-2-cron-schedule) 120 | * [Magento 2 CLI Extension](https://magefan.com/magento2-cli-extension) 121 | * [Magento 2 Conflict Detector](https://magefan.com/magento2-conflict-detector) 122 | 123 | ## [Shopify Apps](https://magefan.com/shopify/apps) by Magefan 124 | 125 | * [Shopify Login As Customer](https://apps.shopify.com/login-as-customer) 126 | * [Shopify Blog](https://apps.shopify.com/magefan-blog) 127 | * [Shopify Size Chart](https://magefan.com/shopify/apps/size-chart) 128 | * [Shopify Google Indexer](https://magefan.com/shopify/apps/google-indexing) 129 | * [Shopify Product Feeds](https://magefan.com/shopify/apps/product-feed) 130 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "magefan/module-urlwebapi", 3 | "description": "", 4 | "require": { 5 | "magefan/module-community" : ">=2.0.4" 6 | }, 7 | "type": "magento2-module", 8 | "version": "2.0.0", 9 | "autoload": { 10 | "files": [ 11 | "registration.php" 12 | ], 13 | "psr-4": { 14 | "Magefan\\UrlWebapi\\": "" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /etc/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /etc/webapi.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /registration.php: -------------------------------------------------------------------------------- 1 |