2017-03-16 89 views
1

我们希望修改prestashop中的订单参考逻辑,为此我们实现了逻辑。逻辑很好。伟大的工作,但我们得到了一个错误如何在prestashop中增加订单参考长度

[PrestaShopException] 

Property OrderPayment->order_reference length (14) must be between 0 and 9 at line 909 in file classes/ObjectModel.php 

904.    } 
905. 
906.    $message = $this->validateField($field, $this->$field); 
907.    if ($message !== true) { 
908.     if ($die) { 
909.      throw new PrestaShopException($message); 
910.     } 
911.     return $error_return ? $message : false; 
912.    } 
913.   } 
914. 

我们的长度为30,我们怎样才能提高9到30的长度?

回答

1

你需要重写OrderPayment类文件/override/classes/order/OrderPayment.php

<?php 
class OrderPayment extends OrderPaymentCore 
{ 
    public function __construct($id = null, $id_lang = null, $id_shop = null) 
    { 
     self::$definition['fields']['order_reference']['size'] = 30; 
     parent::__construct($id, $id_lang, $id_shop); 
    } 
} 

另外,您必须更新phpMyAdmin的SQL选项卡中的数据库order_reference字段大小:

ALTER TABLE `ps_order_payment` 
CHANGE `order_reference` 
`order_reference` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; 
+0

感谢名单...它工作.... –

+0

如果这个答案解决了你的问题,你能否接受它来标记此线程已解决? [如何接受答案的工作?](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) –

+0

如何做到这一点? –