Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createManufacturerUrls example
set_time_limit
(
1200
)
;
$offset
=
$this
->
Request
(
)
->
getParam
(
'offset', 0
)
;
$limit
=
$this
->
Request
(
)
->
getParam
(
'limit', 50
)
;
$shopId
=
(int)
$this
->
Request
(
)
->
getParam
(
'shopId', 1
)
;
// Create shop
$this
->
SeoIndex
(
)
->
registerShop
(
$shopId
)
;
$context
=
$this
->
get
(
\Shopware\Bundle\StoreFrontBundle\Service\ContextServiceInterface::
class
)
->
createShopContext
(
$shopId
)
;
// Make sure a template is available
$this
->
RewriteTable
(
)
->
baseSetup
(
)
;
$this
->
RewriteTable
(
)
->
createManufacturerUrls
(
$context
,
$offset
,
$limit
)
;
$this
->
View
(
)
->
assign
(
[
'success' => true,
]
)
;
}
public
function
seoContentTypeAction
(
)
: void
{
@
set_time_limit
(
1200
)
;
$shopId
=
(int)
$this
->
Request
(
)
->
getParam
(
'shopId', 1
)
;
$this
->
baseSetup
(
)
;
$context
=
$this
->contextService->
createShopContext
(
Shopware
(
)
->
Shop
(
)
->
getId
(
)
)
;
$this
->
sCreateRewriteTableCleanup
(
)
;
$this
->
sCreateRewriteTableStatic
(
)
;
$this
->
sCreateRewriteTableCategories
(
)
;
$this
->
sCreateRewriteTableBlog
(
null, null,
$context
)
;
$this
->
sCreateRewriteTableCampaigns
(
)
;
$lastUpdate
=
$this
->
sCreateRewriteTableArticles
(
$lastUpdate
)
;
$this
->
sCreateRewriteTableContent
(
null, null,
$context
)
;
$this
->
createManufacturerUrls
(
$context
)
;
$this
->
createContentTypeUrls
(
$context
)
;
return
$lastUpdate
;
}
/** * Cleanup the rewrite table from non-existing resources. * * @throws Zend_Db_Adapter_Exception */
public
function
sCreateRewriteTableCleanup
(
)
{
$lastId
=
$this
->rewriteTable->
getRewriteArticleslastId
(
)
;
}
while
(
$lastId
!== null
)
;
$this
->seoIndex->
setCachedTime
(
$currentTime
->
format
(
'Y-m-d H:i:s'
)
,
$elementId
,
$shopId
)
;
$context
=
$this
->container->
get
(
ContextServiceInterface::
class
)
->
createShopContext
(
$shopId
)
;
$this
->rewriteTable->
sCreateRewriteTableCategories
(
)
;
$this
->rewriteTable->
sCreateRewriteTableCampaigns
(
)
;
$this
->rewriteTable->
sCreateRewriteTableContent
(
)
;
$this
->rewriteTable->
sCreateRewriteTableBlog
(
null, null,
$context
)
;
$this
->rewriteTable->
createManufacturerUrls
(
$context
)
;
$this
->rewriteTable->
sCreateRewriteTableStatic
(
)
;
$this
->rewriteTable->
createContentTypeUrls
(
$context
)
;
$this
->events->
notify
(
'Shopware_Command_RebuildSeoIndexCommand_CreateRewriteTable',
[
'shopContext' =>
$context
,
'cachedTime' =>
$currentTime
,
]
)
;
}
$lastId
=
$this
->
RewriteTable
(
)
->
getRewriteArticleslastId
(
)
;
}
while
(
$lastId
!== null
)
;
$this
->
SeoIndex
(
)
->
setCachedTime
(
$currentTime
->
format
(
'Y-m-d H:i:s'
)
,
$elementId
,
$shopId
)
;
$context
=
$this
->
get
(
ContextServiceInterface::
class
)
->
createShopContext
(
$shopId
)
;
$this
->
RewriteTable
(
)
->
sCreateRewriteTableCategories
(
)
;
$this
->
RewriteTable
(
)
->
sCreateRewriteTableCampaigns
(
)
;
$this
->
RewriteTable
(
)
->
sCreateRewriteTableContent
(
)
;
$this
->
RewriteTable
(
)
->
sCreateRewriteTableBlog
(
null, null,
$context
)
;
$this
->
RewriteTable
(
)
->
createManufacturerUrls
(
$context
)
;
$this
->
RewriteTable
(
)
->
sCreateRewriteTableStatic
(
)
;
$this
->
RewriteTable
(
)
->
createContentTypeUrls
(
$context
)
;
Shopware
(
)
->
Events
(
)
->
notify
(
'Shopware_CronJob_RefreshSeoIndex_CreateRewriteTable',
[
'shopContext' =>
$context
,
'cachedTime' =>
$currentTime
,
]
)
;
}