Skip to content

Commit

Permalink
Change shop url (when multishop).
Browse files Browse the repository at this point in the history
  • Loading branch information
PrestaSafe committed Aug 19, 2024
1 parent 2f6bede commit 996306a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
16 changes: 13 additions & 3 deletions _dev/src/components/form/ShopSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { defineComponent, ref, watch } from 'vue'
import { Listbox, ListboxButton, ListboxLabel, ListboxOption, ListboxOptions } from '@headlessui/vue'
import { ChevronUpDownIcon } from '@heroicons/vue/24/solid'
import { useStoredZones, useCurrentZone } from '../../store/pinia'
import { usePrettyBlocksContext } from '../../store/pinia'
import { trans } from '../../scripts/trans'
Expand All @@ -11,7 +11,7 @@ defineComponent({
ChevronUpDownIcon
})
let items = ref(ajax_urls.shops);
let prettyBlocksContext = usePrettyBlocksContext()
const props = defineProps({
// api url to get the data
Expand All @@ -23,7 +23,17 @@ const props = defineProps({
const changetItem = (item) => {
props.modelValue.shop_name = item.name
// emitter.emit('changeUrl', item)
prettyBlocksContext.$patch({
psContext: {
id_lang: item.id_lang,
id_shop: item.id_shop,
shop_name: item.name,
current_url: item.base_url + (item.base_url.includes('?prettyblocks=1') ? '' : '?prettyblocks=1'),
href: item.base_url,
}
})
prettyBlocksContext.changeUrl(item.base_url)
}
const emit = defineEmits(['update:modelValue.shop_name'])
Expand Down
11 changes: 11 additions & 0 deletions src/Controller/AdminThemeManagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,24 @@ public function uploadAction(Request $request)
]);
}


private function getShops()
{
$shops = \Shop::getShops();
$results = [];
$link = new \Link();

foreach ($shops as $shop) {
$shop['current_url'] = $this->buildShopUri($shop);
$shop['base_url'] = $link->getPageLink(
'index',
true,
(int) \Configuration::get('PS_LANG_DEFAULT', null, null, $shop['id_shop']),
[],
false,
$shop['id_shop'],
false
);
$results[] = $shop;
}

Expand Down

0 comments on commit 996306a

Please sign in to comment.