# Virtuelle URL

**URL:** <https://forum.shopware.com/t/virtuelle-url/24995>\
**Category:** Shopware 3.5\
**Tags:** programming\
**Created:** [9. Februar 2015 um 14:45 UTC](https://forum.shopware.com/t/virtuelle-url/24995 "2015-02-09T14:45:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecomai](https://avatars.discourse-cdn.com/v4/letter/e/8e8cbc/32.png) [@ecomai](https://forum.shopware.com/u/ecomai)\
**Post date:** [9. Februar 2015 um 14:45 UTC](https://forum.shopware.com/t/virtuelle-url/24995/1 "2015-02-09T14:45:34Z")

</div>

Wie lässt sich in einem Plugin die virtuelle URL ermitteln?

---

<div class="post-metadata">

**Author:** ![moep](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@moep](https://forum.shopware.com/u/moep)\
**Post date:** [9. Februar 2015 um 16:31 UTC](https://forum.shopware.com/t/virtuelle-url/24995/2 "2015-02-09T16:31:32Z")

</div>

Ich weiß nicht ob es einen einfacheren Weg gibt, aber ich mache es so: ` public function generateUrl(Shop $shop) { $articleId = $this-\>articleId; $shopId = $shop-\>getId(); $urlResult = Shopware()-\>Db()-\>fetchRow("SELECT r.path as url FROM s\_core\_rewrite\_urls r WHERE r.org\_path LIKE \"sViewport=detail&sArticle=%\" AND RIGHT(r.org\_path, LENGTH(r.org\_path) - 26) = $articleId AND r.subshopID = $shopId ORDER BY r.id DESC LIMIT 1"); $this-\>url = $urlResult['url']; return $this; }` LG Marc
