fresh-advance/sitemap

OXID 7 Sitemap Module

Installs: 32

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 2

Type:oxideshop-module

v1.0.3 2025-05-01 20:32 UTC

README

Development Latest Version PHP Version

Quality Gate Status Coverage Technical Debt

The idea

There is a table (fa_sitemap) which will contain the list of all sitemap urls. Urls are updated and added during the "fa:sitemap:update" commands. The sitemap files are generated by "fa:sitemap:generate" command.

Features

  • Selectors implemented for:
    • Active categories
    • Active products and its variants
    • Active content pages from 'User information' folder
    • Main page of the shop
  • Removal of the urls by removal or deactivation of the related objects
  • Configurable sitemap directory

What to expect in next versions

  • Sitemap access without modifying the .htaccess maybe
  • Multilanguage support
  • Multishop support
  • Configurable step size for update run

Version compatibility

  • v1.0.x is compatible with OXID Shop compilation 7.0 and up

Branch compatibility

  • Branch b-7.1.x is compatible with OXID Shop compilation 7.1.0 and up
  • Branch b-7.0.x is compatible with OXID Shop compilation 7.0.0-rc.2 and up

Installation

Module is available on packagist. Install it via composer and activate the module

composer require fresh-advance/sitemap:^v1.0.0
vendor/bin/oe-eshop-doctrine_migration migrations:migrate fa_sitemap
vendor/bin/oe-console oe:module:activate fa_sitemap

Also consider adding the line to .htaccess file:

RewriteRule ^sitemap.xml$    sitemap/sitemap.xml   [NC,L]

Module usage

Note: directory for sitemap should exist and have enough rights for php to modify its content.

./vendor/bin/oe-console fa:sitemap:updateAll
./vendor/bin/oe-console fa:sitemap:generate

After the "generate" command, the sitemap index and sitemap pages will be generated in "source/sitemap" directory.

Note: Also its possible to update some concrete type of objects IF needed by some reason:

./vendor/bin/oe-console fa:sitemap:update general
./vendor/bin/oe-console fa:sitemap:update content
./vendor/bin/oe-console fa:sitemap:update category
./vendor/bin/oe-console fa:sitemap:update product

Cron

Example command for the cron for every day automatic regeneration. Make sure you change the path to your shop and the log path. Also, docker is used in this example, please double-check it by your needs.

0 3 * * * cd /path/to/shop/root && /usr/bin/docker compose exec php vendor/bin/oe-console fa:sitemap:updateAll >> /logpath/sitemap.log 2>&1
10 3 * * * cd /path/to/shop/root && /usr/bin/docker compose exec php vendor/bin/oe-console fa:sitemap:generate >> /logpath/sitemap.log 2>&1

Development installation

To be able running the tests and other preconfigured quality tools, please install the module as a root package.

The next section shows how to install the module as a root package by using the Fresh Advance Development Base.

In case of different environment usage, please adjust by your own needs.

Development installation on Fresh Advance Development Base

The installation instructions below are shown for the current Fresh Advance Development Base for shop 7.0. Make sure your system meets the requirements of the Development Base.

  1. Ensure all docker containers are down to avoid port conflicts

  2. Clone the SDK for the new project

echo MyProject && git clone https://github.com/Fresh-Advance/development.git $_ && cd $_
  1. Clone the repository to the source directory
git clone --recurse-submodules https://github.com/Fresh-Advance/Sitemap.git --branch=b-7.0.x ./source
  1. Run the recipe to setup the development environment
./source/recipes/setup-development.sh

You should be able to access the shop with http://localhost.local and the admin panel with http://localhost.local/admin (credentials: noreply@oxid-esales.com / admin)

Running the tests and quality tools

Check the "scripts" section in the composer.json file for the available commands. Those commands can be executed by connecting to the php container and running the command from there, example:

make php
composer tests-coverage

Commands can be also triggered directly on the container with docker compose, example:

docker compose exec -T php composer tests-coverage

License

The module is not free to use. Please make sure you checked the License before using the module.