Where could I store some key/value pairs?

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
BrianMecler
Posts: 41
Joined: 03 Jun 2023, 17:30

Where could I store some key/value pairs?

Post by BrianMecler » 02 Aug 2023, 11:50

Hello,

Laravel Framework 10.13.1, php8.1-fpm, aimeos/aimeos-laravel 2023.04.2

I want to implement sales tax per state. I want to avoid doing additional API calls during the checkout/basket process. My thought process is that I can store sales tax rates for each state in a database table. I will then periodically run some type of console command or a cronjob to keep these rates updated from an API.

Would a database table be appropriate? Or is there some existing key/value pair storage mechanism I should be using?
And if a database table is the way to go, where would something like that ideally be placed?

Thank you

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: Where could I store some key/value pairs?

Post by aimeos » 04 Aug 2023, 05:13

There's a basket plugin available which changes the tax rate according to the country/state of the customer (during checkout):
https://aimeos.org/docs/latest/manual/plugins/#taxrates
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

BrianMecler
Posts: 41
Joined: 03 Jun 2023, 17:30

Re: Where could I store some key/value pairs?

Post by BrianMecler » 04 Aug 2023, 11:50

Thank you,

If I wanted to programmatically keep these values up-to-date, could I keep updating these values directly in the database?

I see its here:

Code: Select all

mysql> select * from mshop_plugin where provider = 'TaxRates'  limit 5 \G
*************************** 1. row ***************************
      id: 9
  siteid: 1.
    type: order
provider: Taxrates
   label: Country and state tax rates
  config: {"country-taxrates":{"US":"5.00","AT":"20.00"},"state-taxrates":{"CA":"6.25"}}
     pos: 90
  status: 0
   mtime: 2023-06-06 14:13:38
   ctime: 2023-06-06 14:13:38
  editor: core
1 row in set (0.00 sec)
Would it be inadvisable to be directly interacting with the database?

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: Where could I store some key/value pairs?

Post by aimeos » 05 Aug 2023, 08:28

At least it's possible to do so.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply