多个网站共享相同的订单增量 ID 序列?

发布于 2024-10-12 04:47:47 字数 265 浏览 2 评论 0原文

我注意到之前问过这个问题,但我不确定如何实现答案。这是链接。

Magento:您可以设置它,以便所有网站共享相同的订单增量 ID 序列吗?

您能告诉我将此添加到哪个文件以及哪一行吗?

谢谢

I noticed this question as asked before but i am not sure how to implement the answer. This is the link.

Magento: Can you set it so all Websites share the same order increment id sequence?

Can you tell me which file to add this to and what line?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烂柯人 2024-10-19 04:47:47

基本上,您需要添加一个新模块或编辑现有模块并将其添加到您的 config.xml 中,显然要进行更改以匹配您的设置。

<resources>
<module_setup>
    <setup>
        <module>Package_Module</module>
        <class>Package_Module_Model_Resource_Mysql4_Setup</class>
    </setup>
    <connection>
        <use>core_setup</use>
    </connection>
</module_setup>
</resources>

您需要将该类添加到 app/code/local/Package/Module/Model/Resource/Mysql4/Setup.php

然后在下创建一个 sql 文件夹
app/code/local/Package/Module/

,然后在 sql 文件夹下创建一个名为 module_setup 的文件夹。所以路径应该是这样的
app/code/local/Package/Module/sql/module_setup

在此文件夹内,您将根据模块的版本号放置安装或升级脚本,例如 mysql4-install-0.1.0.php

这是版本号可以是位于您的 config.xml 中,如下所示

<modules>
<Package_Module>
    <version>0.1.0</version>
</Package_Module>
</modules>

您应该有一个具有以下结构的文件
app/code/local/Package/Module/sql/module_setup/mysql4-install-0.1.0.php

在该文件内,您可以使用以下内容设置文件

$installer = $this;
$installer->startSetup();
$installer->run("
   your code here
");
$installer->endSetup();

然后您可以打开浏览器并点击站点上的任何网址,它应该如果没有更新,您可以通过删除 core_resources 表下 module_setup 的记录器来继续测试。

Basically you need to add a new module or edit one that you have existing and add this to your config.xml, obviously change to match your setup.

<resources>
<module_setup>
    <setup>
        <module>Package_Module</module>
        <class>Package_Module_Model_Resource_Mysql4_Setup</class>
    </setup>
    <connection>
        <use>core_setup</use>
    </connection>
</module_setup>
</resources>

You will want to add that class to be located app/code/local/Package/Module/Model/Resource/Mysql4/Setup.php

Then you create a sql folder under
app/code/local/Package/Module/

and then create a folder called module_setup under the sql folder. so the path should look like this
app/code/local/Package/Module/sql/module_setup

Inside of this folder you will put your install or upgrade script based on the version number of your module such as mysql4-install-0.1.0.php

This is version number can be located in your config.xml such as the following

<modules>
<Package_Module>
    <version>0.1.0</version>
</Package_Module>
</modules>

You should then have a file located with the following structure
app/code/local/Package/Module/sql/module_setup/mysql4-install-0.1.0.php

Inside that file you can setup the file with the following

$installer = $this;
$installer->startSetup();
$installer->run("
   your code here
");
$installer->endSetup();

You can then open your browser and hit any url on your site and it should update if not you can keep testing by deleting the recorder for module_setup under the core_resources table.

凯凯我们等你回来 2024-10-19 04:47:47

您可以直接在数据库中更改它。参见表 sales_sequence_meta =>列sequence_table,并将“entity_type”中“order”的引用更改为同一个表,如sequence_order_0。

例如:默认表
meta_identity_typestore_idsequence_table

5order1sequence_order_1

6order2sequence_order_27order3sequence_order_3

8order4sequence_order_4

帮助

更改为

5order1sequence_order_06order2sequence_order_07order3sequence_order_08order4sequence_order_0

这可能对

You can change it directly in the database. See table sales_sequence_meta => column sequence_table and change reference of 'order' in 'entity_type' to same table like sequence_order_0.

Ex: Default Table
meta_id entity_type store_id sequence_table

5 order 1 sequence_order_1

6 order 2 sequence_order_2

7 order 3 sequence_order_3

8 order 4 sequence_order_4

Change To

5 order 1 sequence_order_0

6 order 2 sequence_order_0

7 order 3 sequence_order_0

8 order 4 sequence_order_0

This may help you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文