如何将订单参考更改为编号参考 [英] How to change the Order Reference to Number Reference

查看:47
本文介绍了如何将订单参考更改为编号参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用新版本的 Prestashop 1.5.2.0.我想将订单参考(字母)更改为字母数字值.我尝试在论坛中搜索并看到此论坛.不幸的是,它对我不起作用.

Using new version of Prestashop 1.5.2.0. I would like to change the Order reference ( alphabets ) to alphanumeric value. I tried searching in forums and Seen this forum. Unfortunately it wont work for me.

任何人都可以解决在整个应用程序中将顺序引用(字母)更改为字母数字值的方法.

Can any one have solution to change Order reference ( alphabets ) to alphanumeric value in entire application.

我的意思是AQMKATRQG"到LD1001"并将其增加到LD1002"我想将订单参考(字母)更改为字母数字值.我尝试在论坛中搜索并看到此论坛.不幸的是,它对我不起作用.

I mean "AQMKATRQG" to "LD1001" and the increment it to "LD1002" I would like to change the Order reference ( alphabets ) to alphanumeric value. I tried searching in forums and Seen this forum. Unfortunately it wont work for me.

任何人都可以解决在整个应用程序中将顺序引用(字母)更改为字母数字值的方法.

Can any one have solution to change Order reference ( alphabets ) to alphanumeric value in entire application.

我的意思是将AQMKATRQG"改为LD1001"并将其增加到LD1002"

I mean "AQMKATRQG" to "LD1001" and the increment it to "LD1002"

推荐答案

在 PrestaShop 1.6(在 v1.6.0.14 中测试并确认工作)中,您可以通过以下方法完成此操作.

In PrestaShop 1.6 (tested and confirmed working in v1.6.0.14) you can accomplish this by the following method.

  1. 复制文件/classes/PaymentModule.php/override/classes/PaymentModule.php.

编辑文件 /override/classes/PaymentModule.php 如下.

第 337-341 行是一个代码块,应该是这样的:

At lines 337-341 is a code block that should read like this:

if (!result)
{
  PrestaShopLogger::addLog('PaymentModule::validateOrder - Order cannot be created',
    3, null, 'Cart', (int)$id_cart, true);
  throw new PrestaShopException('Can\'t save Order');
}

在该代码块之后立即插入以下两行代码:

Immediately after that code block, insert the following two lines of code:

$order->reference = str_pad($order->id, 9, '0', STR_PAD_LEFT);
$order->update();

  1. 删除文件 /cache/class_index.php 以便 Prestashop 考虑到新的覆盖文件自动重新创建此文件.

  1. Delete the file /cache/class_index.php so that Prestashop automatically re-creates this file taking into account the new override file.

可以使用 phpMyAdmin 等工具手动更新 PrestaShop 数据库中的任何现有记录以使用数字参考.

我认为这些步骤与 PrestaShop v1.5 的步骤非常相似,但目前我尚未使用 PrestaShop v1.5 测试此解决方案.如果有人发现此解决方案适用于 v1.5,也许他们可以在评论中确认这一点.谢谢.

I would imagine the steps would be very similar if not identical to these for PrestaShop v1.5 but at this time I have not tested this solution with PrestaShop v1.5. If someone finds this solution works on v1.5 perhaps they could confirm this in the comments. Thank you.

这篇关于如何将订单参考更改为编号参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆